]> git.lyx.org Git - lyx.git/blob - acinclude.m4
Fixed inset-redraw problems on resizing lyx-window, and some other small
[lyx.git] / acinclude.m4
1 dnl Some useful functions for LyXs configure.in                 -*- sh -*-
2 dnl Author: Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr)
3 dnl         Lars Gullik Bjønnes (larsbj@lyx.org)
4 dnl         Allan Rae (rae@lyx.org)
5
6
7 dnl Usage LYX_GET_VERSION   Sets "lyx_version" to the version of LyX being 
8 dnl   built, displays it and sets variable "lyx_devel" to yes or no depending 
9 dnl   whether the version is a development release or not. 
10 AC_DEFUN(LYX_GET_VERSION,[
11 changequote(, ) dnl
12 VERSION=`grep '#define *LYX_VERSION' $1 |
13               sed -e 's/^.*"\(.*\)"$/\1/' 2>/dev/null`
14 echo "configuring LyX version $VERSION"
15 if echo "$VERSION" | grep 'cvs' >/dev/null ; then
16   lyx_devel_version=yes
17   echo "WARNING: This is a development version. Expect bugs."
18 else
19   lyx_devel_version=no
20 fi
21 if echo "$VERSION" | grep 'pre' > /dev/null ; then
22     lyx_prerelease=yes
23     echo "WARNING: This is a prerelease. Be careful and backup your documents."
24 else
25     lyx_prerelease=no
26 fi
27 changequote([, ]) dnl
28 PACKAGE=lyx${program_suffix}
29 AC_SUBST(lyx_devel_version)
30 if test $lyx_devel_version = yes ; then 
31   AC_DEFINE(DEVEL_VERSION, 1, Define if you are building a development version of LyX)
32 fi])
33
34 dnl Usage: LYX_ERROR(message)  Displays the warning "message" and sets the
35 dnl flag lyx_error to yes.
36 AC_DEFUN(LYX_ERROR,[
37 lyx_error_txt="$lyx_error_txt
38 ** $1
39 "
40 lyx_error=yes])
41
42
43 dnl Usage: LYX_WARNING(message)  Displays the warning "message" and sets the
44 dnl flag lyx_warning to yes.
45 AC_DEFUN(LYX_WARNING,[
46 lyx_warning_txt="$lyx_warning_txt
47 == $1
48 "
49 lyx_warning=yes])
50
51
52 dnl Usage: LYX_LIB_ERROR(file,library)  Displays an error message indication 
53 dnl  that 'file' cannot be found because 'lib' may be uncorrectly installed.
54 AC_DEFUN(LYX_LIB_ERROR,[
55 LYX_ERROR([Cannot find $1. Please check that the $2 library
56    is correctly installed on your system.])])
57
58
59 dnl Usage: LYX_CHECK_ERRORS  Displays a warning message if a LYX_ERROR
60 dnl   has occured previously. 
61 AC_DEFUN(LYX_CHECK_ERRORS,[
62 if test x$lyx_error = xyes; then
63 cat <<EOF
64 **** The following problems have been detected by configure. 
65 **** Please check the messages below before running 'make'.
66 **** (see the section 'Problems' in the INSTALL file)
67 $lyx_error_txt
68 $lyx_warning_txt
69 deleting cache $cache_file
70 EOF
71   rm -f $cache_file
72 else
73
74 if test x$lyx_warning = xyes; then
75 cat <<EOF
76 === The following minor problems have been detected by configure. 
77 === Please check the messages below before running 'make'.
78 === (see the section 'Problems' in the INSTALL file)
79 $lyx_warning_txt
80 EOF
81 fi
82 cat <<EOF
83 Configuration of LyX was successful.  
84 Type 'make' to compile the program, 
85 and then 'make install' to install it.
86 EOF
87 fi])
88
89
90 dnl LYX_SEARCH_PROG(VARIABLE-NAME,PROGRAMS-LIST,ACTION-IF-FOUND)
91 dnl             
92 define(LYX_SEARCH_PROG,[dnl
93 for ac_prog in $2 ; do
94 # Extract the first word of "$ac_prog", so it can be a program name with args.
95   set dummy $ac_prog ; ac_word=$[2]
96   if test -z "[$]$1"; then
97     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
98     for ac_dir in $PATH; do
99       test -z "$ac_dir" && ac_dir=.
100       if test -f [$ac_dir/$ac_word]; then
101         $1="$ac_prog"
102         break
103       fi
104     done
105     IFS="$ac_save_ifs"
106   fi
107
108   if test -n "[$]$1"; then
109     ac_result=yes
110   else
111     ac_result=no
112   fi
113   ifelse($3,,,[$3])
114   test -n "[$]$1" && break
115 done
116 ])dnl
117
118
119 AC_DEFUN(LYX_PROG_CXX_WORKS,
120 [AC_LANG_SAVE
121 AC_LANG_CPLUSPLUS
122 AC_TRY_COMPILER([class foo { int bar; }; int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross)
123 AC_LANG_RESTORE
124 if test $ac_cv_prog_cxx_works = no; then
125   CXX=
126 fi
127 cross_compiling=$ac_cv_prog_cxx_cross
128 ])
129
130
131 AC_DEFUN(LYX_PROG_CXX,
132 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
133 AC_MSG_CHECKING([for a working C++ compiler])
134 LYX_SEARCH_PROG(CXX, $CCC g++ gcc c++ CC cxx xlC cc++, LYX_PROG_CXX_WORKS)
135
136 if test -z "$CXX" ; then
137   AC_ERROR([Unable to find a working C++ compiler])
138 fi
139
140 AC_SUBST(CXX)
141 AC_MSG_RESULT($CXX)
142
143 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
144 AC_MSG_RESULT($cross_compiling)
145
146 AC_PROG_CXX_GNU
147
148 dnl We might want to get or shut warnings.
149 AC_ARG_WITH(warnings,
150   [  --with-warnings         tell the compiler to display more warnings],,
151   [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then
152         with_warnings=yes;
153     else
154         with_warnings=no;
155     fi;])
156 if test x$with_warnings = xyes ; then
157   lyx_flags="$lyx_flags warnings"
158   AC_DEFINE(WITH_WARNINGS, 1,
159   [Define this if you want to see the warning directives put here and
160    there by the developpers to get attention])
161 fi
162
163 # optimize less for development versions
164 if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
165   lyx_opt="-O"
166 else
167   lyx_opt="-O2"
168 fi
169
170 # set the debug flags correctly.
171 if test $ac_cv_prog_gxx = yes; then
172   GXX=yes
173 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
174 dnl plays around with CXXFLAGS (such as to build both debugging and
175 dnl normal versions of a library), tasteless as that idea is.
176   ac_test_CXXFLAGS="${CXXFLAGS+set}"
177   ac_save_CXXFLAGS="$CXXFLAGS"
178   CXXFLAGS=
179 dnl Check the version of g++
180   gxx_version=`${CXX} --version`
181   
182   AC_PROG_CXX_G
183   if test "$ac_test_CXXFLAGS" = set; then
184     CXXFLAGS="$ac_save_CXXFLAGS"
185   elif test $ac_cv_prog_cxx_g = yes; then
186     case $gxx_version in
187       2.95.1)  CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
188       2.95.*)  CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
189       2.96*)   CXXFLAGS="-g $lyx_opt -fhonor-std";;
190       *2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
191       *)       CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
192     esac
193   else
194     CXXFLAGS="$lyx_opt"
195   fi
196   if test x$with_warnings = xyes ; then
197     case $gxx_version in
198         2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
199         2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
200         *)      CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
201     esac
202     if test $lyx_devel_version = yes ; then
203         case $gxx_version in
204             2.95.*) ;;
205             2.96*) ;;
206             *2.91*) ;;
207             *) CXXFLAGS="$CXXFLAGS -pedantic";;
208         esac
209     fi
210   fi
211 else
212   GXX=
213   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
214 fi
215 ])dnl
216
217
218 dnl Usage: LYX_CXX_RTTI : checks whether the C++ compiler
219 dnl   supports RTTI
220 AC_DEFUN(LYX_CXX_RTTI,[
221 ### Check whether the compiler supports runtime type information
222 AC_CACHE_CHECK(whether the C++ compiler supports RTTI,lyx_cv_rtti,
223  [AC_TRY_RUN([
224 class rtti {
225 public:
226    virtual int tag() { return 0; }
227 };
228 class derived1 : public rtti {
229 public:
230     int tag() { return 1; }
231 };
232 class derived2 : public rtti {
233 public:
234     int tag() { return 2; }
235 };
236 int main() {
237     derived1 * foo1 = new derived1();
238     derived2 * foo2 = new derived2();
239     rtti * bar = foo1;
240     derived1 * bar1 = dynamic_cast<derived1 *>(bar);
241     if (bar1 == 0)
242         exit(1);
243     bar = foo2;
244     bar1 = dynamic_cast<derived1 *>(bar);
245     if (bar1 != 0)
246         exit(1);
247     return 0;
248 }
249 ],lyx_cv_rtti=yes,lyx_cv_rtti=no,lyx_cv_rtti=no)
250 ])
251 if test x$lyx_cv_rtti = xyes ; then
252   AC_DEFINE(HAVE_RTTI, 1, 
253    [Define to 1 if your compiler supports runtime type information])
254 fi])
255
256
257 dnl Usage: LYX_CXX_EXPLICIT : checks whether the C++ compiler
258 dnl   understands the "explicit" directive.
259 AC_DEFUN(LYX_CXX_EXPLICIT,[
260 ### Check whether the compiler understands the keyword `explicit'
261 AC_CACHE_CHECK(whether the C++ compiler understands explicit,lyx_cv_explicit,
262  [AC_TRY_COMPILE([
263 class Expl {
264 public:
265         explicit Expl() {};
266 };],,lyx_cv_explicit=yes,lyx_cv_explicit=no)
267 ])
268 if test $lyx_cv_explicit = no ; then
269   AC_DEFINE(explicit,[ ], 
270    [Define to nothing if your compiler does not understand the
271    'explicit' directive])
272 fi])
273
274
275 dnl Usage: LYX_CXX_STL_STACK : checks whether the C++ compiler
276 dnl   has a working stl stack template
277 AC_DEFUN(LYX_CXX_STL_STACK,[
278 AC_CACHE_CHECK(for broken STL stack template,lyx_cv_broken_stack,
279  [AC_TRY_COMPILE([
280 #include <stack>
281 using std::stack;
282 ],[
283     stack<int> stakk;
284     stakk.push(0);
285 ],lyx_cv_broken_stack=no,lyx_cv_broken_stack=yes)
286 ])
287 if test $lyx_cv_broken_stack = yes ; then
288   AC_DEFINE(BROKEN_STL_STACK, 1, 
289    [Define if you have the STL from libg++ 2.7.x, where stack<> is not defined
290    correctly])
291 fi])
292
293
294 dnl Usage: LYX_STD_COUNT : checks wherer the C++ library have a conforming
295 dnl    count template, if not the old HP version is assumed.
296 AC_DEFUN(LYX_STD_COUNT,[
297 AC_CACHE_CHECK(for conforming std::count,lyx_cv_std_count,
298  [AC_TRY_COMPILE([
299 #include <string>
300 #include <algorithm>
301 using std::string;
302 using std::count;
303 int countChar(string const & a, char const c)
304 {
305         return count(a.begin(), a.end(), c);
306 }
307 ],[
308     string a("hello");
309     int i = countChar(a, 'l');
310 ],lyx_cv_std_count=yes,lyx_cv_std_count=no)
311 ])
312 if test $lyx_cv_std_count = yes ; then
313     AC_DEFINE(HAVE_STD_COUNT, 1,
314     [Define if you have a conforming std::count template, otherwise HP version of count template is assumed.])
315 fi])
316
317
318 dnl Usage: LYX_CXX_STL_MODERN_STREAMS : checks whether the C++ compiler
319 dnl   supports modern STL streams
320 AC_DEFUN(LYX_CXX_STL_MODERN_STREAMS,[
321 AC_CACHE_CHECK(for modern STL streams,lyx_cv_modern_streams,
322  [AC_TRY_COMPILE([
323 #include <iostream>
324 ],[
325  std::streambuf * test = std::cerr.rdbuf();
326  test->pubsync();
327 ],lyx_cv_modern_streams=yes,lyx_cv_modern_streams=no)
328 ])
329 if test $lyx_cv_modern_streams = yes ; then
330   AC_DEFINE(MODERN_STL_STREAMS, 1, 
331    [Define if you have modern standard-compliant STL streams])
332 fi])
333
334
335 dnl Usage: LYX_CXX_STL_STRING : checks whether the C++ compiler
336 dnl   has a working stl string container, the check is really stupid
337 dnl   and could need some improvement.
338 AC_DEFUN(LYX_CXX_STL_STRING,[
339     AC_REQUIRE([LYX_PROG_CXX])
340     AC_MSG_CHECKING(whether the included std::string should be used)
341     AC_ARG_WITH(included-string,
342        [  --with-included-string  use LyX string class instead of STL string],
343        [with_included_string=$withval],
344        [AC_TRY_COMPILE([
345             #include <string>
346             using std::string;
347         ],[
348             string a("hello there");
349             a.erase();
350             a = "hey";
351             char s[] = "y";
352             int t = a.compare(a.length() - 1, 1, s);
353             a.erase();
354         ],[
355             with_included_string=no
356         ],[
357             with_included_string=yes
358             
359         ])
360     ])
361     if test x$with_included_string = xyes ; then
362         AC_DEFINE(USE_INCLUDED_STRING, 1,
363             [Define to use the lyxstring class bundled with LyX.])
364             lyx_flags="$lyx_flags included-string"
365     fi
366     AM_CONDITIONAL(USE_LYXSTRING, test x$with_included_string = xyes)
367     AC_MSG_RESULT([$with_included_string])
368 ])
369
370
371 dnl Usage: LYX_REGEX : checks if the header regex.h is available
372 dnl   if it is not available the automake variable USE_REGEX will be
373 dnl   defined and the regex.h and regex.c that we provide will be used.
374 AC_DEFUN(LYX_REGEX,[
375     AC_CHECK_HEADERS(regex.h, lyx_regex=no, lyx_regex=yes)
376     AM_CONDITIONAL(USE_REGEX, test x$lyx_regex = xyes)
377 ])
378
379
380 dnl LYX_CXX_MUTABLE
381 AC_DEFUN(LYX_CXX_MUTABLE, [
382 AC_REQUIRE([LYX_PROG_CXX])
383 AC_MSG_CHECKING(if C++ compiler supports mutable)
384 AC_TRY_COMPILE(
385 [
386 class k {       
387         mutable char *c;
388 public:
389    void foo() const { c=0; }
390 };
391 ],[
392 ],[
393   ac_mutable=yes
394   AC_DEFINE(HAVE_MUTABLE, 1, 
395    [Defined if you compiler supports 'mutable'.])
396 ],[
397   ac_mutable=no
398 ]) 
399 AC_MSG_RESULT([$ac_mutable])
400 ])
401
402
403 dnl LYX_CXX_PARTIAL
404 AC_DEFUN(LYX_CXX_PARTIAL, [
405 AC_REQUIRE([LYX_PROG_CXX])
406 AC_MSG_CHECKING(if C++ compiler supports partial specialization)
407 AC_TRY_COMPILE(
408 [
409 template<class T, class K>
410 class k {       
411 public:
412 };
413 template<class T> class k<void,T> { };
414 ],[
415   k<float, float> b;
416   k<void,void> a;
417 ],[
418   ac_partial_specialization=yes
419   AC_DEFINE(HAVE_PARTIAL_SPECIALIZATION, 1, 
420    [Defined if your compiler supports partial specialization.])
421 ],[
422   ac_partial_specialization=no
423 ]) 
424 AC_MSG_RESULT([$ac_partial_specialization])
425 ])
426
427
428 dnl Usage: LYX_CXX_NAMESPACES : checks whether the C++ compiler
429 dnl   has a correct namespace handling and define CXX_WORKING_NAMESPACES 
430 dnl   if true. This macro does not do a thourough test, but it should be 
431 dnl   good enough to suit our needs.
432 AC_DEFUN(LYX_CXX_NAMESPACES,[
433 AC_CACHE_CHECK(for correct namespaces support,lyx_cv_cxx_namespace,
434  [AC_TRY_COMPILE([
435   namespace foo {
436     int bar;
437   }
438 ],[
439         foo::bar = 0;
440         return 0;
441 ],lyx_cv_cxx_namespace=yes,lyx_cv_cxx_namespace=no)
442 ])
443 if test $lyx_cv_cxx_namespace = yes ; then
444   AC_DEFINE(CXX_WORKING_NAMESPACES, 1, 
445    [Define if your C++ compiler has correct support for namespaces])
446 fi])
447
448
449 dnl Usage: LYX_CXX_CHEADERS : checks whether the C++ compiler
450 dnl   provides wrappers for C headers and use our alternate version otherwise.
451 AC_DEFUN(LYX_CXX_CHEADERS,[
452 AC_CACHE_CHECK(for C headers wrappers,lyx_cv_cxx_cheaders,
453  [AC_TRY_CPP([
454 #include <clocale>
455 #include <cctype>
456 #include <cerrno>
457 #include <cmath>
458 #include <csignal>
459 #include <cstdio>
460 #include <cstdlib>
461 #include <cstring>
462 #include <ctime>],[lyx_cv_cxx_cheaders=yes],[lyx_cv_cxx_cheaders=no])])
463 if test $lyx_cv_cxx_cheaders = no ; then
464   LYX_ADD_INC_DIR(lyx_cppflags,\$(top_srcdir)/src/cheaders)  
465 fi])
466
467
468 dnl Usage LYX_PATH_XPM: Checks for xpm library and header
469 AC_DEFUN(LYX_PATH_XPM,[
470 ### Check for Xpm library
471 AC_CHECK_LIB(Xpm, XpmCreateBufferFromImage,LYX_LIBS="-lXpm $LYX_LIBS",
472         [LYX_LIB_ERROR(libXpm,Xpm)], $LYX_LIBS)
473
474 ### Check for Xpm headers
475 lyx_cv_xpm_h_location="<xpm.h>"
476 AC_CHECK_HEADER(X11/xpm.h,[
477   ac_cv_header_xpm_h=yes
478   lyx_cv_xpm_h_location="<X11/xpm.h>"],[
479 AC_CHECK_HEADER(xpm.h,[],[
480 LYX_LIB_ERROR(xpm.h,Xpm)])])
481 AC_DEFINE_UNQUOTED(XPM_H_LOCATION,$lyx_cv_xpm_h_location)
482
483 ### Test for the header version
484 if test $ac_cv_header_xpm_h = yes; then
485   AC_CACHE_CHECK([xpm header version],lyx_cv_xpmversion,
486   [ cat > conftest.$ac_ext <<EOF
487 #line __oline__ "configure"
488 #include "confdefs.h"
489
490 #include XPM_H_LOCATION
491 "%%%"lyx_cv_xpmv=XpmVersion;lyx_cv_xpmr=XpmRevision"%%%"
492 EOF
493     eval `(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
494       grep '^"%%%"'  2>/dev/null | \
495       sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
496     case "$lyx_cv_xpmr" in
497 changequote(,)
498      [0-9]) lyxxpmr_alpha=`echo $lyx_cv_xpmr |tr 123456789 abcdefghi`
499             lyxxpmv_alpha=" (aka 3.$lyx_cv_xpmv$lyxxpmr_alpha)";;
500 changequote([,])
501          *) ;;
502     esac
503     lyx_cv_xpmversion="$lyx_cv_xpmv.$lyx_cv_xpmr$lyxxpmv_alpha"
504     rm -f conftest*])
505   case "$lyx_cv_xpmr" in 
506 changequote(,)
507         [789]|[0-9][0-9]*) ;;
508 changequote([,])
509         *) LYX_WARNING([Version $lyx_cv_xpmversion of the Xpm library is a bit old. 
510    If you experience strange crashes with LyX, try to upgrade 
511    to at least version 4.7 (aka 3.4g).
512    If you have installed a newer version of the library, check whether you
513    have an old xpm.h header file in your include path.]);;
514   esac
515 fi])
516
517
518 dnl Usage LYX_PATH_XFORMS: Checks for xforms library and flags
519 AC_DEFUN(LYX_PATH_XFORMS,[
520 ### Check for xforms library
521 AC_CHECK_LIB(forms, fl_initialize, LYX_LIBS="-lforms $LYX_LIBS", 
522   [AC_CHECK_LIB(xforms, fl_initialize, LYX_LIBS="-lxforms $LYX_LIBS", 
523     [LYX_LIB_ERROR(libforms or libxforms,xforms)], $LYX_LIBS)], $LYX_LIBS) 
524
525 ### Check for xforms headers
526 lyx_cv_forms_h_location="<forms.h>"
527 AC_CHECK_HEADER(X11/forms.h,[
528   ac_cv_header_forms_h=yes
529   lyx_cv_forms_h_location="<X11/forms.h>"],[
530 AC_CHECK_HEADER(forms.h,[],[
531 LYX_LIB_ERROR(forms.h,forms)])])
532 AC_DEFINE_UNQUOTED(FORMS_H_LOCATION,$lyx_cv_forms_h_location)
533 if test $ac_cv_header_forms_h = yes; then
534   AC_CACHE_CHECK([xforms header version],lyx_cv_xfversion,
535   [ cat > conftest.$ac_ext <<EOF
536 #line __oline__ "configure"
537 #include "confdefs.h"
538
539 #include FORMS_H_LOCATION
540 #if ! defined(FL_INCLUDE_VERSION)
541 "%%%"(unknown)"%%%"
542 #else
543 "%%%"FL_VERSION.FL_REVISION"%%%"
544 #endif
545 EOF
546 lyx_cv_xfversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
547   grep '^"%%%"'  2>/dev/null | \
548   sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
549 rm -f conftest*])
550 case "$lyx_cv_xfversion" in 
551   "(unknown)"|0.8[1-7]) 
552          LYX_ERROR(dnl
553 Version $lyx_cv_xfversion of xforms is not compatible with LyX. 
554    This version of LyX works best with versions 0.88 (recommended) and later.) ;;
555     0.88) ;;
556     0.89) LYX_WARNING(dnl
557 LyX should work ok with version $lyx_cv_xfversion of xforms[,] but
558 it is an unproven version and might still have some bugs. If you
559 have problems[,] please use version 0.88 instead.) ;;
560        *) LYX_WARNING(dnl
561 Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,] 
562  since it is newer than 0.88. You might have slight problems with it.);;
563 esac
564 fi])
565
566
567 dnl Usage: LYX_HPUX  Checks for HP-UX and update CXXFLAGS accordingly
568 AC_DEFUN(LYX_HPUX,
569 [#It seems that HPUX requires using -fpcc-struct-return with gcc.
570 AC_CACHE_CHECK(for HP-UX,ac_cv_hpux,[
571 os=`uname -s | tr '[A-Z]' '[a-z]'`
572 ac_cv_hpux=no
573 test "$os" = hp-ux && ac_cv_hpux=yes])
574 if test "$ac_cv_hpux" = yes; then
575  test "x$GXX" = xyes && CXXFLAGS="$CXXFLAGS -fpcc-struct-return"
576 fi])
577
578
579 dnl Usage: LYX_SUNOS4 Checks for SunOS 4.x and sets the flag lyx_broken_headers
580 dnl   if necessary
581 AC_DEFUN(LYX_SUNOS4,
582 [#The headers are not correct under SunOS4
583 AC_CACHE_CHECK(for SunOS 4.x,ac_cv_sunos4,[
584 changequote(, ) dnl
585 os=`uname -a | sed -e 's/^\([^ ]*\) [^ ]* \([0-9]\)\..*/\1\2/'`
586 changequote([, ]) dnl
587 ac_cv_sunos4=no
588 test "$os" = SunOS4 && ac_cv_sunos4=yes])
589 if test "$ac_cv_sunos4" = yes; then
590  test "x$GXX" = xyes && lyx_broken_headers=yes
591 fi])
592
593
594 dnl Usage: LYX_SCO Checks for SCO and sets the flag lyx_broken_headers
595 dnl   if necessary
596 AC_DEFUN(LYX_SCO,
597 [AC_CACHE_CHECK(for SCO 3.2v4,ac_cv_sco,[
598 ac_cv_sco=no
599 if test `uname -s` != "SCO_SV"; then
600   lyx_machine_rel=`uname -m`:`uname -r`
601   if test $lyx_machine_rel = i386:3.2 || test $lyx_machine_rel = i486:3.2;
602   then
603     if test -f /usr/options/cb.name; then
604       ac_cv_sco=no
605     elif /bin/uname -X 2>/dev/null >/dev/null ; then
606       ac_cv_sco=yes
607     fi
608   fi
609 fi])
610 if test "$ac_cv_sco" = yes; then
611  test "x$GXX" = xyes && lyx_broken_headers=yes
612 fi])
613
614 dnl Usage: LYX_FUNC_PUTENV_ARGTYPE
615 dnl Checks whether putenv() takes 'char const *' or 'char *' as
616 dnl argument. This is needed because Solaris 7 (wrongly?) uses 'char *', 
617 dnl while everybody else uses the former...
618 AC_DEFUN(LYX_FUNC_PUTENV_ARGTYPE,
619 [AC_MSG_CHECKING([type of argument for putenv()])
620  AC_CACHE_VAL(lyx_cv_func_putenv_arg,dnl
621   [AC_TRY_COMPILE(dnl
622 [#include <cstdlib>],
623 [char const * foo = "bar";
624  putenv(foo);],dnl
625    [lyx_cv_func_putenv_arg='char const *'],[lyx_cv_func_putenv_arg='char *'])])
626  AC_MSG_RESULT($lyx_cv_func_putenv_arg)
627  AC_DEFINE_UNQUOTED(PUTENV_TYPE_ARG,$lyx_cv_func_putenv_arg,dnl
628    [Define to the type of the argument of putenv(). Needed on Solaris 7.])])
629
630
631 dnl Usage: LYX_WITH_DIR(dir-name,desc,dir-var-name,default-value, 
632 dnl                       [default-yes-value])  
633 dnl  Adds a --with-'dir-name' option (described by 'desc') and puts the 
634 dnl  resulting directory name in 'dir-var-name'.
635 AC_DEFUN(LYX_WITH_DIR,[
636   AC_ARG_WITH($1,[  --with-$1        specify $2])
637   AC_MSG_CHECKING([for $2])
638   if test -z "$with_$3"; then
639      AC_CACHE_VAL(lyx_cv_$3, lyx_cv_$3=$4)
640   else
641     test "x$with_$3" = xyes && with_$3=$5
642     lyx_cv_$3="$with_$3"
643   fi
644   AC_MSG_RESULT($lyx_cv_$3)])
645
646
647 dnl Usage: LYX_LOOP_DIR(value,action)
648 dnl Executes action for values of variable `dir' in `values'. `values' can 
649 dnl use ":" as a separator.
650 AC_DEFUN(LYX_LOOP_DIR,[
651 IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
652 for dir in `eval "echo $1"`; do
653   if test ! "$dir" = NONE; then
654     test ! -d "$dir" && AC_ERROR([\"$dir\" is not a directory])
655     $2
656   fi
657 done
658 IFS=$ac_save_ifs
659 ])
660
661
662 dnl Usage: LYX_ADD_LIB_DIR(var-name,dir) Adds a -L directive to variable 
663 dnl var-name. 
664 AC_DEFUN(LYX_ADD_LIB_DIR,[
665 $1="${$1} -L$2"
666 if test "`(uname) 2>/dev/null`" = SunOS &&
667     uname -r | grep '^5' >/dev/null; then
668   if test $ac_cv_prog_gxx = yes ; then 
669     $1="${$1} -Wl[,]-R$2" 
670   else
671     $1="${$1} -R$2"
672   fi
673 fi])
674
675
676 dnl Usage: LYX_ADD_INC_DIR(var-name,dir) Adds a -I directive to variable 
677 dnl var-name. 
678 AC_DEFUN(LYX_ADD_INC_DIR,[$1="${$1} -I$2 "])
679
680 ### Check which libsigc++ we're using and make sure any external one works
681 ### Check for libsigc++ library
682 AC_DEFUN(LYX_WITH_SIGC,
683 [AC_MSG_CHECKING(whether the included libsigc++ should be used)
684 AC_ARG_WITH([included-libsigc],
685   [  --without-included-libsigc
686                              Use the libsigc++ installed on the system],
687   [lyx_use_included_libsigc=$withval],
688   [lyx_use_included_libsigc=yes])
689 AC_MSG_RESULT([$lyx_use_included_libsigc])
690 if test x$lyx_use_included_libsigc = xno; then
691   ### Check for libsigc++
692   ## can't use AC_SUBST right here!
693   AM_PATH_SIGC(0.8.7,
694     [ INCLUDED_SIGC=
695     ],
696     [LYX_ERROR(dnl
697     [Cannot find libsigc++ library or headers at least as recent as 0.8.7.
698      Check your installation.  Have you installed the development package?])
699   ])
700 else
701   ### Use the included libsigc++
702   ### sigc-config hasn't been created yet so we can't just do the same as above
703   ### unless of course someone gets keen and merges the sigc++ configure.in 
704   ### with this one.  We don't really gain much by doing that though except
705   ### a considerably smaller dist and more difficult maintenance.
706   ### It'd also mean we'd have the equivalent of config/gettext.m4
707   lyx_flags="$lyx_flags included-libsigc"
708   SIGC_LIBS="\`\${top_builddir}/sigc++/sigc-config --libs-names | sed -e 's/-lsigc//'\`"
709   # Libsigc++ always installs into a subdirectory called sigc++.  Therefore we
710   # have to always use #include <sigc++/signal_system.h> in our code.
711   # Remember if you decide to do anything to the sigc++ code to do your mods on
712   # the makeLyXsigc.sh script in development/tools using a current cvs checkout
713   # of libsigc++.  A tarball distribution doesn't have everything in it that we
714   # need.
715   # We need both these -I entries to build when builddir != srcdir
716   if test "x$src_dir" = "x." ; then
717     SIGC_CFLAGS="-I\${top_srcdir}"
718   else
719     SIGC_CFLAGS="-I\${top_builddir} -I\${top_srcdir}"
720   fi
721   INCLUDED_SIGC="\${top_builddir}/sigc++/libsigc.la"
722   ## can't substitute these here like this otherwise all remaining tests fail
723   ## instead we SUBST directly into the Makefiles
724   ##LIBS="$LIBS \$SIGC_LIBS"
725   ##CPPFLAGS="$CPPFLAGS \$SIGC_CFLAGS"
726   AC_SUBST(SIGC_LIBS)
727   AC_SUBST(SIGC_CFLAGS)
728 fi
729 AC_SUBST(INCLUDED_SIGC)
730 ])
731
732 ### Check for a headers existence and location iff it exists
733 ## This is supposed to be a generalised version of LYX_STL_STRING_FWD
734 ## It almost works.  I've tried a few variations but they give errors
735 ## of one sort or other: bad substitution or file not found etc.  The
736 ## actual header _is_ found though and the cache variable is set however
737 ## the reported setting (on screen) is equal to $ac_safe for some unknown
738 ## reason.
739 ## Additionally, autoheader can't figure out what to use as the name in
740 ## the config.h.in file so we need to write our own entries there -- one for
741 ## each header in the form PATH_HEADER_NAME_H
742 ##
743 AC_DEFUN(LYX_PATH_HEADER,
744 [ AC_CHECK_HEADER($1,[
745   ac_tr_safe=PATH_`echo $ac_safe | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
746 ### the only remaining problem is getting the second parameter to this
747 ### AC_CACHE_CACHE to print correctly. Currently it just results in value
748 ### of $ac_safe being printed.
749   AC_CACHE_CHECK([path to $1],[lyx_cv_path2_$ac_safe],
750   [ cat > conftest.$ac_ext <<EOF
751 #line __oline__ "configure"
752 #include "confdefs.h"
753
754 #include <$1>
755 EOF
756 lyx_path_header_path=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
757   grep $1  2>/dev/null | \
758   sed -e 's/.*\(".*$1"\).*/\1/' -e "1q"`
759 eval "lyx_cv_path2_${ac_safe}=\$lyx_path_header_path"
760 rm -f conftest*])
761   AC_DEFINE_UNQUOTED($ac_tr_safe, $lyx_path_header_path)])
762 ])
763 ### end of LYX_PATH_HEADER
764
765 ### Check for stl_string_fwd.h existence and location if it exists
766 AC_DEFUN(LYX_STL_STRING_FWD,
767 [ AC_CHECK_HEADER(stl_string_fwd.h,[
768   AC_CACHE_CHECK([path to stl_string_fwd.h],lyx_cv_path_stl_string_fwd_h,
769   [ cat > conftest.$ac_ext <<EOF
770 #line __oline__ "configure"
771 #include "confdefs.h"
772
773 #include <stl_string_fwd.h>
774 EOF
775 lyx_cv_path_stl_string_fwd_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
776   grep 'stl_string_fwd.h'  2>/dev/null | \
777   sed -e 's/.*\(".*stl_string_fwd.h"\).*/\1/' -e "1q"`
778 rm -f conftest*])
779   AC_DEFINE_UNQUOTED(STL_STRING_FWD_H_LOCATION,$lyx_cv_path_stl_string_fwd_h,
780 [define this to the location of stl_string_fwd.h to be used with #include,
781   NOTE: Do not set it to <stl_string_fwd.h> as that will find the LyX
782         supplied version of the header.
783   e.g. <../include/stl_string_fwd.h> or better yet use an absolute path])])
784 ])
785
786
787 dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
788 dnl if the cache file is inconsistent with the current host,
789 dnl target and build system types, execute CMD or print a default
790 dnl error message.
791 AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
792     AC_REQUIRE([AC_CANONICAL_SYSTEM])
793     AC_MSG_CHECKING([config.cache system type])
794     if { test x"${ac_cv_host_system_type+set}" = x"set" &&
795          test x"$ac_cv_host_system_type" != x"$host"; } ||
796        { test x"${ac_cv_build_system_type+set}" = x"set" &&
797          test x"$ac_cv_build_system_type" != x"$build"; } ||
798        { test x"${ac_cv_target_system_type+set}" = x"set" &&
799          test x"$ac_cv_target_system_type" != x"$target"; }; then
800         AC_MSG_RESULT([different])
801         ifelse($#, 1, [$1],
802                 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
803     else
804         AC_MSG_RESULT([same])
805     fi
806     ac_cv_host_system_type="$host"
807     ac_cv_build_system_type="$build"
808     ac_cv_target_system_type="$target"
809 ])
810
811 dnl We use this until autoconf fixes its version.
812 AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
813 [AC_MSG_CHECKING([types of arguments for select()])
814  AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
815  [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
816   [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
817    [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
818      for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do      for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
819        AC_TRY_COMPILE(dnl
820 [#ifdef HAVE_SYS_TYPES_H
821 #include <sys/types.h>
822 #endif
823 #ifdef HAVE_SYS_TIME_H
824 #include <sys/time.h>
825 #endif
826 #ifdef HAVE_SYS_SELECT_H
827 #include <sys/select.h>
828 #endif
829 #ifdef HAVE_SYS_SOCKET_H
830 #include <sys/socket.h>
831 #endif
832 extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
833         [ac_not_found=no ; break 3],ac_not_found=yes)
834       done
835      done
836     done
837    ])dnl AC_CACHE_VAL
838   ])dnl AC_CACHE_VAL
839  ])dnl AC_CACHE_VAL
840  if test "$ac_not_found" = yes; then
841   ac_cv_func_select_arg1=int 
842   ac_cv_func_select_arg234='int *' 
843   ac_cv_func_select_arg5='struct timeval *'
844  fi
845  AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
846  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1)
847  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234))
848  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5))
849 ])
850
851 ### Check which frontend we want to use. The default is XForms
852 ###
853 AC_DEFUN(LYX_USE_FRONTEND,
854 [AC_MSG_CHECKING(what frontend should be used as main GUI)
855 AC_ARG_WITH(frontend,
856   [  --with-frontend[=value] Use THIS frontend as main GUI:
857                           Possible values: xforms,kde],
858   [lyx_use_frontend="$withval"], [lyx_use_frontend="xforms"])
859 AC_MSG_RESULT($lyx_use_frontend)
860 lyx_flags="$lyx_flags frontend-$lyx_use_frontend"
861 AC_SUBST(FRONTEND)
862 AC_SUBST(FRONTEND_GUILIB)
863 AC_SUBST(FRONTEND_LDFLAGS)
864 AC_SUBST(FRONTEND_INCLUDES)
865 AC_SUBST(FRONTEND_LIBS)
866 ])
867 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
868 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
869 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
870 ##
871 ## This program is free software; you can redistribute it and/or modify
872 ## it under the terms of the GNU General Public License as published by
873 ## the Free Software Foundation; either version 2 of the License, or
874 ## (at your option) any later version.
875 ##
876 ## This program is distributed in the hope that it will be useful, but
877 ## WITHOUT ANY WARRANTY; without even the implied warranty of
878 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
879 ## General Public License for more details.
880 ##
881 ## You should have received a copy of the GNU General Public License
882 ## along with this program; if not, write to the Free Software
883 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
884 ##
885 ## As a special exception to the GNU General Public License, if you
886 ## distribute this file as part of a program that contains a
887 ## configuration script generated by Autoconf, you may include it under
888 ## the same distribution terms that you use for the rest of that program.
889
890 # serial 40 AC_PROG_LIBTOOL
891 AC_DEFUN(AC_PROG_LIBTOOL,
892 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
893
894 # Save cache, so that ltconfig can load it
895 AC_CACHE_SAVE
896
897 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
898 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
899 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
900 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
901 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
902 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
903 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
904 || AC_MSG_ERROR([libtool configure failed])
905
906 # Reload cache, that may have been modified by ltconfig
907 AC_CACHE_LOAD
908
909 # This can be used to rebuild libtool when needed
910 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
911
912 # Always use our own libtool.
913 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
914 AC_SUBST(LIBTOOL)dnl
915
916 # Redirect the config.log output again, so that the ltconfig log is not
917 # clobbered by the next message.
918 exec 5>>./config.log
919 ])
920
921 AC_DEFUN(AC_LIBTOOL_SETUP,
922 [AC_PREREQ(2.13)dnl
923 AC_REQUIRE([AC_ENABLE_SHARED])dnl
924 AC_REQUIRE([AC_ENABLE_STATIC])dnl
925 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
926 AC_REQUIRE([AC_CANONICAL_HOST])dnl
927 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
928 AC_REQUIRE([AC_PROG_RANLIB])dnl
929 AC_REQUIRE([AC_PROG_CC])dnl
930 AC_REQUIRE([AC_PROG_LD])dnl
931 AC_REQUIRE([AC_PROG_NM])dnl
932 AC_REQUIRE([AC_PROG_LN_S])dnl
933 dnl
934
935 case "$target" in
936 NONE) lt_target="$host" ;;
937 *) lt_target="$target" ;;
938 esac
939
940 # Check for any special flags to pass to ltconfig.
941 libtool_flags="--cache-file=$cache_file"
942 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
943 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
944 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
945 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
946 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
947 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
948 [libtool_flags="$libtool_flags --enable-dlopen"])
949 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
950 [libtool_flags="$libtool_flags --enable-win32-dll"])
951 AC_ARG_ENABLE(libtool-lock,
952   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
953 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
954 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
955
956 # Some flags need to be propagated to the compiler or linker for good
957 # libtool support.
958 case "$lt_target" in
959 *-*-irix6*)
960   # Find out which ABI we are using.
961   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
962   if AC_TRY_EVAL(ac_compile); then
963     case "`/usr/bin/file conftest.o`" in
964     *32-bit*)
965       LD="${LD-ld} -32"
966       ;;
967     *N32*)
968       LD="${LD-ld} -n32"
969       ;;
970     *64-bit*)
971       LD="${LD-ld} -64"
972       ;;
973     esac
974   fi
975   rm -rf conftest*
976   ;;
977
978 *-*-sco3.2v5*)
979   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
980   SAVE_CFLAGS="$CFLAGS"
981   CFLAGS="$CFLAGS -belf"
982   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
983     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
984   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
985     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
986     CFLAGS="$SAVE_CFLAGS"
987   fi
988   ;;
989
990 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
991 [*-*-cygwin* | *-*-mingw*)
992   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
993   AC_CHECK_TOOL(AS, as, false)
994   AC_CHECK_TOOL(OBJDUMP, objdump, false)
995   ;;
996 ])
997 esac
998 ])
999
1000 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
1001 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
1002
1003 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
1004 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1005
1006 # AC_ENABLE_SHARED - implement the --enable-shared flag
1007 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
1008 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1009 #   `yes'.
1010 AC_DEFUN(AC_ENABLE_SHARED, [dnl
1011 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
1012 AC_ARG_ENABLE(shared,
1013 changequote(<<, >>)dnl
1014 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
1015 changequote([, ])dnl
1016 [p=${PACKAGE-default}
1017 case "$enableval" in
1018 yes) enable_shared=yes ;;
1019 no) enable_shared=no ;;
1020 *)
1021   enable_shared=no
1022   # Look at the argument we got.  We use all the common list separators.
1023   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1024   for pkg in $enableval; do
1025     if test "X$pkg" = "X$p"; then
1026       enable_shared=yes
1027     fi
1028   done
1029   IFS="$ac_save_ifs"
1030   ;;
1031 esac],
1032 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
1033 ])
1034
1035 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
1036 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1037 AC_ENABLE_SHARED(no)])
1038
1039 # AC_ENABLE_STATIC - implement the --enable-static flag
1040 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
1041 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1042 #   `yes'.
1043 AC_DEFUN(AC_ENABLE_STATIC, [dnl
1044 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
1045 AC_ARG_ENABLE(static,
1046 changequote(<<, >>)dnl
1047 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
1048 changequote([, ])dnl
1049 [p=${PACKAGE-default}
1050 case "$enableval" in
1051 yes) enable_static=yes ;;
1052 no) enable_static=no ;;
1053 *)
1054   enable_static=no
1055   # Look at the argument we got.  We use all the common list separators.
1056   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1057   for pkg in $enableval; do
1058     if test "X$pkg" = "X$p"; then
1059       enable_static=yes
1060     fi
1061   done
1062   IFS="$ac_save_ifs"
1063   ;;
1064 esac],
1065 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
1066 ])
1067
1068 # AC_DISABLE_STATIC - set the default static flag to --disable-static
1069 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1070 AC_ENABLE_STATIC(no)])
1071
1072
1073 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
1074 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
1075 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1076 #   `yes'.
1077 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
1078 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1079 AC_ARG_ENABLE(fast-install,
1080 changequote(<<, >>)dnl
1081 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
1082 changequote([, ])dnl
1083 [p=${PACKAGE-default}
1084 case "$enableval" in
1085 yes) enable_fast_install=yes ;;
1086 no) enable_fast_install=no ;;
1087 *)
1088   enable_fast_install=no
1089   # Look at the argument we got.  We use all the common list separators.
1090   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1091   for pkg in $enableval; do
1092     if test "X$pkg" = "X$p"; then
1093       enable_fast_install=yes
1094     fi
1095   done
1096   IFS="$ac_save_ifs"
1097   ;;
1098 esac],
1099 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
1100 ])
1101
1102 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
1103 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1104 AC_ENABLE_FAST_INSTALL(no)])
1105
1106 # AC_PROG_LD - find the path to the GNU or non-GNU linker
1107 AC_DEFUN(AC_PROG_LD,
1108 [AC_ARG_WITH(gnu-ld,
1109 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1110 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1111 AC_REQUIRE([AC_PROG_CC])dnl
1112 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1113 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1114 ac_prog=ld
1115 if test "$ac_cv_prog_gcc" = yes; then
1116   # Check if gcc -print-prog-name=ld gives a path.
1117   AC_MSG_CHECKING([for ld used by GCC])
1118   ac_prog=`($CC -print-prog-name=ld) 2>&5`
1119   case "$ac_prog" in
1120     # Accept absolute paths.
1121 changequote(,)dnl
1122     [\\/]* | [A-Za-z]:[\\/]*)
1123       re_direlt='/[^/][^/]*/\.\./'
1124 changequote([,])dnl
1125       # Canonicalize the path of ld
1126       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1127       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1128         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1129       done
1130       test -z "$LD" && LD="$ac_prog"
1131       ;;
1132   "")
1133     # If it fails, then pretend we aren't using GCC.
1134     ac_prog=ld
1135     ;;
1136   *)
1137     # If it is relative, then search for the first ld in PATH.
1138     with_gnu_ld=unknown
1139     ;;
1140   esac
1141 elif test "$with_gnu_ld" = yes; then
1142   AC_MSG_CHECKING([for GNU ld])
1143 else
1144   AC_MSG_CHECKING([for non-GNU ld])
1145 fi
1146 AC_CACHE_VAL(ac_cv_path_LD,
1147 [if test -z "$LD"; then
1148   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1149   for ac_dir in $PATH; do
1150     test -z "$ac_dir" && ac_dir=.
1151     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1152       ac_cv_path_LD="$ac_dir/$ac_prog"
1153       # Check to see if the program is GNU ld.  I'd rather use --version,
1154       # but apparently some GNU ld's only accept -v.
1155       # Break only if it was the GNU/non-GNU ld that we prefer.
1156       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1157         test "$with_gnu_ld" != no && break
1158       else
1159         test "$with_gnu_ld" != yes && break
1160       fi
1161     fi
1162   done
1163   IFS="$ac_save_ifs"
1164 else
1165   ac_cv_path_LD="$LD" # Let the user override the test with a path.
1166 fi])
1167 LD="$ac_cv_path_LD"
1168 if test -n "$LD"; then
1169   AC_MSG_RESULT($LD)
1170 else
1171   AC_MSG_RESULT(no)
1172 fi
1173 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1174 AC_PROG_LD_GNU
1175 ])
1176
1177 AC_DEFUN(AC_PROG_LD_GNU,
1178 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
1179 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1180 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1181   ac_cv_prog_gnu_ld=yes
1182 else
1183   ac_cv_prog_gnu_ld=no
1184 fi])
1185 ])
1186
1187 # AC_PROG_NM - find the path to a BSD-compatible name lister
1188 AC_DEFUN(AC_PROG_NM,
1189 [AC_MSG_CHECKING([for BSD-compatible nm])
1190 AC_CACHE_VAL(ac_cv_path_NM,
1191 [if test -n "$NM"; then
1192   # Let the user override the test.
1193   ac_cv_path_NM="$NM"
1194 else
1195   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1196   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1197     test -z "$ac_dir" && ac_dir=.
1198     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
1199       # Check to see if the nm accepts a BSD-compat flag.
1200       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1201       #   nm: unknown option "B" ignored
1202       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1203         ac_cv_path_NM="$ac_dir/nm -B"
1204         break
1205       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1206         ac_cv_path_NM="$ac_dir/nm -p"
1207         break
1208       else
1209         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
1210         continue # so that we can try to find one that supports BSD flags
1211       fi
1212     fi
1213   done
1214   IFS="$ac_save_ifs"
1215   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
1216 fi])
1217 NM="$ac_cv_path_NM"
1218 AC_MSG_RESULT([$NM])
1219 ])
1220
1221 # AC_CHECK_LIBM - check for math library
1222 AC_DEFUN(AC_CHECK_LIBM,
1223 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1224 LIBM=
1225 case "$lt_target" in
1226 *-*-beos* | *-*-cygwin*)
1227   # These system don't have libm
1228   ;;
1229 *-ncr-sysv4.3*)
1230   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1231   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1232   ;;
1233 *)
1234   AC_CHECK_LIB(m, main, LIBM="-lm")
1235   ;;
1236 esac
1237 ])
1238
1239 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1240 # the libltdl convenience library, adds --enable-ltdl-convenience to
1241 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1242 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1243 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1244 # '${top_builddir}/' (note the single quotes!) if your package is not
1245 # flat, and, if you're not using automake, define top_builddir as
1246 # appropriate in the Makefiles.
1247 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1248   case "$enable_ltdl_convenience" in
1249   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1250   "") enable_ltdl_convenience=yes
1251       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1252   esac
1253   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
1254   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1255 ])
1256
1257 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1258 # the libltdl installable library, and adds --enable-ltdl-install to
1259 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1260 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1261 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1262 # '${top_builddir}/' (note the single quotes!) if your package is not
1263 # flat, and, if you're not using automake, define top_builddir as
1264 # appropriate in the Makefiles.
1265 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1266 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1267   AC_CHECK_LIB(ltdl, main,
1268   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1269   [if test x"$enable_ltdl_install" = xno; then
1270      AC_MSG_WARN([libltdl not installed, but installation disabled])
1271    else
1272      enable_ltdl_install=yes
1273    fi
1274   ])
1275   if test x"$enable_ltdl_install" = x"yes"; then
1276     ac_configure_args="$ac_configure_args --enable-ltdl-install"
1277     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
1278     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1279   else
1280     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1281     LIBLTDL="-lltdl"
1282     INCLTDL=
1283   fi
1284 ])
1285
1286 dnl old names
1287 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
1288 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
1289 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
1290 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
1291 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
1292 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
1293 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
1294
1295 dnl This is just to silence aclocal about the macro not being used
1296 ifelse([AC_DISABLE_FAST_INSTALL])dnl
1297 # Macro to add for using GNU gettext.
1298 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1299 #
1300 # This file can be copied and used freely without restrictions.  It can
1301 # be used in projects which are not available under the GNU Public License
1302 # but which still want to provide support for the GNU gettext functionality.
1303 # Please note that the actual code is *not* freely available.
1304
1305 # serial 5
1306
1307 AC_DEFUN(AM_WITH_NLS,
1308   [AC_MSG_CHECKING([whether NLS is requested])
1309     dnl Default is enabled NLS
1310     AC_ARG_ENABLE(nls,
1311       [  --disable-nls           do not use Native Language Support],
1312       USE_NLS=$enableval, USE_NLS=yes)
1313     AC_MSG_RESULT($USE_NLS)
1314     AC_SUBST(USE_NLS)
1315
1316     USE_INCLUDED_LIBINTL=no
1317
1318     dnl If we use NLS figure out what method
1319     if test "$USE_NLS" = "yes"; then
1320       AC_DEFINE(ENABLE_NLS)
1321       AC_MSG_CHECKING([whether included gettext is requested])
1322       AC_ARG_WITH(included-gettext,
1323         [  --with-included-gettext use the GNU gettext library included here],
1324         nls_cv_force_use_gnu_gettext=$withval,
1325         nls_cv_force_use_gnu_gettext=no)
1326       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1327
1328       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1329       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1330         dnl User does not insist on using GNU NLS library.  Figure out what
1331         dnl to use.  If gettext or catgets are available (in this order) we
1332         dnl use this.  Else we have to fall back to GNU NLS library.
1333         dnl catgets is only used if permitted by option --with-catgets.
1334         nls_cv_header_intl=
1335         nls_cv_header_libgt=
1336         CATOBJEXT=NONE
1337
1338         AC_CHECK_HEADER(libintl.h,
1339           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
1340             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
1341                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
1342
1343            if test "$gt_cv_func_gettext_libc" != "yes"; then
1344              AC_CHECK_LIB(intl, bindtextdomain,
1345                [AC_CACHE_CHECK([for gettext in libintl],
1346                  gt_cv_func_gettext_libintl,
1347                  [AC_CHECK_LIB(intl, gettext,
1348 dnl ============== A fix is here! ======================
1349 dnl -lintl was not added to the LIBS variable in this case
1350                   [gt_cv_func_gettext_libintl=yes
1351                    INTLLIBS="-lintl"],
1352 dnl ==== end of fix
1353                   gt_cv_func_gettext_libintl=no)],
1354                  gt_cv_func_gettext_libintl=no)])
1355            fi
1356
1357            if test "$gt_cv_func_gettext_libc" = "yes" \
1358               || test "$gt_cv_func_gettext_libintl" = "yes"; then
1359               AC_DEFINE(HAVE_GETTEXT)
1360               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1361                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
1362               if test "$MSGFMT" != "no"; then
1363                 AC_CHECK_FUNCS(dcgettext)
1364                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1365                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1366                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1367                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
1368                                return _nl_msg_cat_cntr],
1369                   [CATOBJEXT=.gmo
1370                    DATADIRNAME=share],
1371                   [CATOBJEXT=.mo
1372                    DATADIRNAME=lib])
1373                 INSTOBJEXT=.mo
1374               fi
1375             fi
1376         ])
1377
1378         if test "$CATOBJEXT" = "NONE"; then
1379           AC_MSG_CHECKING([whether catgets can be used])
1380           AC_ARG_WITH(catgets,
1381             [  --with-catgets          use catgets functions if available],
1382             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
1383           AC_MSG_RESULT($nls_cv_use_catgets)
1384
1385           if test "$nls_cv_use_catgets" = "yes"; then
1386             dnl No gettext in C library.  Try catgets next.
1387             AC_CHECK_LIB(i, main)
1388             AC_CHECK_FUNC(catgets,
1389               [AC_DEFINE(HAVE_CATGETS)
1390                INTLOBJS="\$(CATOBJS)"
1391                AC_PATH_PROG(GENCAT, gencat, no)dnl
1392                if test "$GENCAT" != "no"; then
1393                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
1394                  if test "$GMSGFMT" = "no"; then
1395                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
1396                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
1397                  fi
1398                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1399                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1400                  USE_INCLUDED_LIBINTL=yes
1401                  CATOBJEXT=.cat
1402                  INSTOBJEXT=.cat
1403                  DATADIRNAME=lib
1404                  INTLDEPS='$(top_builddir)/intl/libintl.a'
1405                  INTLLIBS=$INTLDEPS
1406                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
1407                  nls_cv_header_intl=intl/libintl.h
1408                  nls_cv_header_libgt=intl/libgettext.h
1409                fi])
1410           fi
1411         fi
1412
1413         if test "$CATOBJEXT" = "NONE"; then
1414           dnl Neither gettext nor catgets in included in the C library.
1415           dnl Fall back on GNU gettext library.
1416           nls_cv_use_gnu_gettext=yes
1417         fi
1418       fi
1419
1420       if test "$nls_cv_use_gnu_gettext" = "yes"; then
1421         dnl Mark actions used to generate GNU NLS library.
1422         INTLOBJS="\$(GETTOBJS)"
1423         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1424           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
1425         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1426         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1427           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1428         AC_SUBST(MSGFMT)
1429         USE_INCLUDED_LIBINTL=yes
1430         CATOBJEXT=.gmo
1431         INSTOBJEXT=.mo
1432         DATADIRNAME=share
1433         INTLDEPS='$(top_builddir)/intl/libintl.a'
1434         INTLLIBS=$INTLDEPS
1435         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
1436         nls_cv_header_intl=intl/libintl.h
1437         nls_cv_header_libgt=intl/libgettext.h
1438       fi
1439
1440       dnl Test whether we really found GNU xgettext.
1441       if test "$XGETTEXT" != ":"; then
1442         dnl If it is no GNU xgettext we define it as : so that the
1443         dnl Makefiles still can work.
1444         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1445           : ;
1446         else
1447           AC_MSG_RESULT(
1448             [found xgettext program is not GNU xgettext; ignore it])
1449           XGETTEXT=":"
1450         fi
1451       fi
1452
1453       # We need to process the po/ directory.
1454       POSUB=po
1455     else
1456       DATADIRNAME=share
1457       nls_cv_header_intl=intl/libintl.h
1458       nls_cv_header_libgt=intl/libgettext.h
1459     fi
1460     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
1461     AC_OUTPUT_COMMANDS(
1462      [case "$CONFIG_FILES" in *po/Makefile.in*)
1463         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
1464       esac])
1465
1466
1467     # If this is used in GNU gettext we have to set USE_NLS to `yes'
1468     # because some of the sources are only built for this goal.
1469     if test "$PACKAGE" = gettext; then
1470       USE_NLS=yes
1471       USE_INCLUDED_LIBINTL=yes
1472     fi
1473
1474     dnl These rules are solely for the distribution goal.  While doing this
1475     dnl we only have to keep exactly one list of the available catalogs
1476     dnl in configure.in.
1477     for lang in $ALL_LINGUAS; do
1478       GMOFILES="$GMOFILES $lang.gmo"
1479       POFILES="$POFILES $lang.po"
1480     done
1481
1482     dnl Make all variables we use known to autoconf.
1483     AC_SUBST(USE_INCLUDED_LIBINTL)
1484     AC_SUBST(CATALOGS)
1485     AC_SUBST(CATOBJEXT)
1486     AC_SUBST(DATADIRNAME)
1487     AC_SUBST(GMOFILES)
1488     AC_SUBST(INSTOBJEXT)
1489     AC_SUBST(INTLDEPS)
1490     AC_SUBST(INTLLIBS)
1491     AC_SUBST(INTLOBJS)
1492     AC_SUBST(POFILES)
1493     AC_SUBST(POSUB)
1494   ])
1495
1496 AC_DEFUN(AM_GNU_GETTEXT,
1497   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1498    AC_REQUIRE([AC_PROG_CC])dnl
1499    AC_REQUIRE([AC_PROG_RANLIB])dnl
1500    AC_REQUIRE([AC_ISC_POSIX])dnl
1501    AC_REQUIRE([AC_HEADER_STDC])dnl
1502    AC_REQUIRE([AC_C_CONST])dnl
1503    AC_REQUIRE([AC_C_INLINE])dnl
1504    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1505    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1506    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1507    AC_REQUIRE([AC_FUNC_MMAP])dnl
1508
1509    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1510 unistd.h sys/param.h])
1511    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1512 strdup __argz_count __argz_stringify __argz_next])
1513
1514    if test "${ac_cv_func_stpcpy+set}" != "set"; then
1515      AC_CHECK_FUNCS(stpcpy)
1516    fi
1517    if test "${ac_cv_func_stpcpy}" = "yes"; then
1518      AC_DEFINE(HAVE_STPCPY)
1519    fi
1520
1521    AM_LC_MESSAGES
1522    AM_WITH_NLS
1523
1524    if test "x$CATOBJEXT" != "x"; then
1525      if test "x$ALL_LINGUAS" = "x"; then
1526        LINGUAS=
1527      else
1528        AC_MSG_CHECKING(for catalogs to be installed)
1529        NEW_LINGUAS=
1530 dnl ============== Fix is here! ======================
1531 dnl Some sh do not like substitution in bounds of for loops
1532 dnl    for lang in ${LINGUAS=$ALL_LINGUAS}; do
1533     tmplinguas=${LINGUAS=$ALL_LINGUAS}
1534     for lang in ${tmplinguas}; do
1535 dnl ==== end of fix
1536          case "$ALL_LINGUAS" in
1537           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1538          esac
1539        done
1540        LINGUAS=$NEW_LINGUAS
1541        AC_MSG_RESULT($LINGUAS)
1542      fi
1543
1544      dnl Construct list of names of catalog files to be constructed.
1545      if test -n "$LINGUAS"; then
1546        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1547      fi
1548    fi
1549
1550    dnl The reference to <locale.h> in the installed <libintl.h> file
1551    dnl must be resolved because we cannot expect the users of this
1552    dnl to define HAVE_LOCALE_H.
1553    if test $ac_cv_header_locale_h = yes; then
1554      INCLUDE_LOCALE_H="#include <locale.h>"
1555    else
1556      INCLUDE_LOCALE_H="\
1557 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
1558    fi
1559    AC_SUBST(INCLUDE_LOCALE_H)
1560
1561    dnl Determine which catalog format we have (if any is needed)
1562    dnl For now we know about two different formats:
1563    dnl   Linux libc-5 and the normal X/Open format
1564    test -d intl || mkdir intl
1565    if test "$CATOBJEXT" = ".cat"; then
1566      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1567
1568      dnl Transform the SED scripts while copying because some dumb SEDs
1569      dnl cannot handle comments.
1570      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
1571    fi
1572    dnl po2tbl.sed is always needed.
1573    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
1574      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
1575
1576    dnl In the intl/Makefile.in we have a special dependency which makes
1577    dnl only sense for gettext.  We comment this out for non-gettext
1578    dnl packages.
1579    if test "$PACKAGE" = "gettext"; then
1580      GT_NO="#NO#"
1581      GT_YES=
1582    else
1583      GT_NO=
1584      GT_YES="#YES#"
1585    fi
1586    AC_SUBST(GT_NO)
1587    AC_SUBST(GT_YES)
1588
1589    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1590    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1591    dnl Try to locate is.
1592    MKINSTALLDIRS=
1593    if test -n "$ac_aux_dir"; then
1594      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1595    fi
1596    if test -z "$MKINSTALLDIRS"; then
1597      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1598    fi
1599    AC_SUBST(MKINSTALLDIRS)
1600
1601    dnl *** For now the libtool support in intl/Makefile is not for real.
1602    l=
1603    AC_SUBST(l)
1604
1605    dnl Generate list of files to be processed by xgettext which will
1606    dnl be included in po/Makefile.
1607    test -d po || mkdir po
1608    if test "x$srcdir" != "x."; then
1609      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1610        posrcprefix="$srcdir/"
1611      else
1612        posrcprefix="../$srcdir/"
1613      fi
1614    else
1615      posrcprefix="../"
1616    fi
1617    rm -f po/POTFILES
1618    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1619         < $srcdir/po/POTFILES.in > po/POTFILES
1620   ])
1621 # Check whether LC_MESSAGES is available in <locale.h>.
1622 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1623 #
1624 # This file can be copied and used freely without restrictions.  It can
1625 # be used in projects which are not available under the GNU Public License
1626 # but which still want to provide support for the GNU gettext functionality.
1627 # Please note that the actual code is *not* freely available.
1628
1629 # serial 1
1630
1631 AC_DEFUN(AM_LC_MESSAGES,
1632   [if test $ac_cv_header_locale_h = yes; then
1633     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1634       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1635        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1636     if test $am_cv_val_LC_MESSAGES = yes; then
1637       AC_DEFINE(HAVE_LC_MESSAGES)
1638     fi
1639   fi])
1640 # Search path for a program which passes the given test.
1641 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1642 #
1643 # This file can be copied and used freely without restrictions.  It can
1644 # be used in projects which are not available under the GNU Public License
1645 # but which still want to provide support for the GNU gettext functionality.
1646 # Please note that the actual code is *not* freely available.
1647
1648 # serial 1
1649
1650 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1651 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1652 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
1653 [# Extract the first word of "$2", so it can be a program name with args.
1654 set dummy $2; ac_word=[$]2
1655 AC_MSG_CHECKING([for $ac_word])
1656 AC_CACHE_VAL(ac_cv_path_$1,
1657 [case "[$]$1" in
1658   /*)
1659   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1660   ;;
1661   *)
1662   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1663   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1664     test -z "$ac_dir" && ac_dir=.
1665     if test -f $ac_dir/$ac_word; then
1666       if [$3]; then
1667         ac_cv_path_$1="$ac_dir/$ac_word"
1668         break
1669       fi
1670     fi
1671   done
1672   IFS="$ac_save_ifs"
1673 dnl If no 4th arg is given, leave the cache variable unset,
1674 dnl so AC_PATH_PROGS will keep looking.
1675 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1676 ])dnl
1677   ;;
1678 esac])dnl
1679 $1="$ac_cv_path_$1"
1680 if test -n "[$]$1"; then
1681   AC_MSG_RESULT([$]$1)
1682 else
1683   AC_MSG_RESULT(no)
1684 fi
1685 AC_SUBST($1)dnl
1686 ])
1687 # Configure paths for Libsigc++
1688 # Based on Gtk-- script by Erik Andersen and Tero Pulkkinen 
1689
1690 dnl Test for Libsigc++, and define SIGC_CFLAGS and SIGC_LIBS
1691 dnl   to be used as follows:
1692 dnl AM_PATH_SIGC(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1693 dnl
1694 AC_DEFUN(AM_PATH_SIGC,
1695 [dnl 
1696 dnl Get the cflags and libraries from the sigc-config script
1697 dnl
1698
1699 dnl
1700 dnl Prefix options
1701 dnl
1702 AC_ARG_WITH(sigc-prefix,
1703 [  --with-sigc-prefix=PREFIX
1704                           Prefix where libsigc++ is installed (optional)]
1705 , sigc_config_prefix="$withval", sigc_config_prefix="")
1706
1707 AC_ARG_WITH(sigc-exec-prefix,
1708 [  --with-sigc-exec-prefix=PREFIX 
1709                           Exec prefix where  libsigc++ is installed (optional)]
1710 , sigc_config_exec_prefix="$withval", sigc_config_exec_prefix="")
1711
1712 AC_ARG_ENABLE(sigctest, 
1713 [  --disable-sigctest     Do not try to compile and run a test libsigc++ 
1714                           program],
1715 , enable_sigctest=yes)
1716
1717 dnl
1718 dnl Prefix handling
1719 dnl
1720   if test x$sigc_config_exec_prefix != x ; then
1721      sigc_config_args="$sigc_config_args --exec-prefix=$sigc_config_exec_prefix"
1722      if test x${SIGC_CONFIG+set} != xset ; then
1723         SIGC_CONFIG=$sigc_config_exec_prefix/bin/sigc-config
1724      fi
1725   fi
1726   if test x$sigc_config_prefix != x ; then
1727      sigc_config_args="$sigc_config_args --prefix=$sigc_config_prefix"
1728      if test x${SIGC_CONFIG+set} != xset ; then
1729         SIGC_CONFIG=$sigc_config_prefix/bin/sigc-config
1730      fi
1731   fi
1732
1733 dnl
1734 dnl See if sigc-config is alive
1735 dnl
1736   AC_PATH_PROG(SIGC_CONFIG, sigc-config, no)
1737   sigc_version_min=$1
1738
1739 dnl
1740 dnl  Version check
1741 dnl
1742   AC_MSG_CHECKING(for libsigc++ - version >= $sigc_version_min)
1743   no_sigc=""
1744   if test "$SIGC_CONFIG" = "no" ; then
1745     no_sigc=yes
1746   else
1747     sigc_version=`$SIGC_CONFIG --version`
1748
1749     SIGC_CFLAGS=`$SIGC_CONFIG $sigc_config_args --cflags`
1750     SIGC_LIBS=`$SIGC_CONFIG $sigc_config_args --libs`
1751     SIGC_MACROS=`$SIGC_CONFIG $sigc_config_args --libs`
1752
1753     sigc_major_version=`echo $sigc_version | \
1754            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1755     sigc_minor_version=`echo $sigc_version | \
1756            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1757     sigc_micro_version=`echo $sigc_version | \
1758            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1759
1760     sigc_major_min=`echo $sigc_version_min | \
1761            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1762     sigc_minor_min=`echo $sigc_version_min | \
1763            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1764     sigc_micro_min=`echo $sigc_version_min | \
1765            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1766
1767     sigc_version_proper=`expr \
1768         $sigc_major_version \> $sigc_major_min \| \
1769         $sigc_major_version \= $sigc_major_min \& \
1770         $sigc_minor_version \> $sigc_minor_min \| \
1771         $sigc_major_version \= $sigc_major_min \& \
1772         $sigc_minor_version \= $sigc_minor_min \& \
1773         $sigc_micro_version \>= $sigc_micro_min `
1774
1775     if test "$sigc_version_proper" = "1" ; then
1776       AC_MSG_RESULT([$sigc_major_version.$sigc_minor_version.$sigc_micro_version])
1777     else
1778       AC_MSG_RESULT(no)
1779       no_sigc=yes
1780     fi
1781
1782     if test "X$no_sigc" = "Xyes" ; then
1783       enable_sigctest=no
1784     fi
1785
1786     AC_LANG_SAVE
1787     AC_LANG_CPLUSPLUS
1788
1789 dnl
1790 dnl
1791 dnl
1792     if test "x$enable_sigctest" = "xyes" ; then
1793       AC_MSG_CHECKING(if libsigc++ sane)
1794       ac_save_CXXFLAGS="$CXXFLAGS"
1795       ac_save_LIBS="$LIBS"
1796       CXXFLAGS="$CXXFLAGS $SIGC_CFLAGS"
1797       LIBS="$LIBS $SIGC_LIBS"
1798
1799       rm -f conf.sigctest
1800       AC_TRY_RUN([
1801 #include <stdio.h>
1802 #include <sigc++/signal_system.h>
1803
1804 #ifdef SIGC_CXX_NAMESPACES
1805 using namespace SigC;
1806 #endif
1807
1808 int foo1(int i) 
1809   {
1810    return 1;
1811   }
1812
1813 int main(int argc,char **argv)
1814   {
1815    if (sigc_major_version!=$sigc_major_version ||
1816        sigc_minor_version!=$sigc_minor_version ||
1817        sigc_micro_version!=$sigc_micro_version)
1818      { printf("(%d.%d.%d) ",
1819          sigc_major_version,sigc_minor_version,sigc_micro_version);
1820        return 1;
1821      }
1822    Signal1<int,int> sig1;
1823    sig1.connect(slot(foo1));
1824    sig1(1);
1825    return 0;
1826   }
1827
1828 ],[
1829   AC_MSG_RESULT(yes)
1830 ],[
1831   AC_MSG_RESULT(no)
1832   no_sigc=yes
1833 ]
1834 ,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1835
1836        CXXFLAGS="$ac_save_CXXFLAGS"
1837        LIBS="$ac_save_LIBS"
1838      fi
1839   fi
1840
1841   dnl
1842   dnl
1843   if test "x$no_sigc" = x ; then
1844      ifelse([$2], , :, [$2])     
1845   else
1846      SIGC_CFLAGS=""
1847      SIGC_LIBS=""
1848      SIGC_MACROS=""
1849      ifelse([$3], , :, [$3])
1850   fi
1851
1852   AC_LANG_RESTORE
1853
1854   AC_SUBST(SIGC_CFLAGS)
1855   AC_SUBST(SIGC_LIBS)
1856   AC_SUBST(SIGC_MACROS)
1857 ])
1858
1859 # Configure paths and libs when using KDE GUI
1860 ##    -*- shell-script -*-
1861
1862 ##    This file is part of the KDE libraries/packages
1863 ##    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
1864 ##              (C) 1997 Stephan Kulow (coolo@kde.org)
1865
1866 ##    This file is free software; you can redistribute it and/or
1867 ##    modify it under the terms of the GNU Library General Public
1868 ##    License as published by the Free Software Foundation; either
1869 ##    version 2 of the License, or (at your option) any later version.
1870
1871 ##    This library is distributed in the hope that it will be useful,
1872 ##    but WITHOUT ANY WARRANTY; without even the implied warranty of
1873 ##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1874 ##    Library General Public License for more details.
1875
1876 ##    You should have received a copy of the GNU Library General Public License
1877 ##    along with this library; see the file COPYING.LIB.  If not, write to
1878 ##    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1879 ##    Boston, MA 02111-1307, USA.        
1880
1881 ## IMPORTANT NOTE:
1882 ## Please do not modify this file unless you expect your modifications to be
1883 ## carried into every other module in the repository. If you decide that you
1884 ## really want to modify it, contact coolo@kde.org mentioning that you have
1885 ## and that the modified file should be committed to every module.
1886 ##
1887 ## Single-module modifications are best placed in configure.in for kdelibs
1888 ## and kdebase or configure.in.1 if present.
1889
1890
1891 ## ------------------------------------------------------------------------
1892 ## Find a file (or one of more files in a list of dirs)
1893 ## ------------------------------------------------------------------------
1894 ##
1895 AC_DEFUN(AC_FIND_FILE,
1896 [
1897 $3=NO
1898 for i in $2;
1899 do
1900   for j in $1;
1901   do
1902     if test -r "$i/$j"; then
1903       $3=$i
1904       break 2
1905     fi
1906   done
1907 done
1908 ])
1909
1910 AC_DEFUN(KDE_FIND_PATH,
1911 [
1912    AC_MSG_CHECKING([for $1])
1913    AC_CACHE_VAL(kde_cv_path_$1,
1914    [
1915      kde_cv_path_$1="NONE"
1916      if test -n "$$2"; then
1917         kde_cv_path_$1="$$2";
1918      else
1919         dirs="$3"
1920         kde_save_IFS=$IFS
1921         IFS=':'
1922         for dir in $PATH; do
1923           dirs="$dirs $dir"
1924         done
1925         IFS=$kde_save_IFS
1926  
1927         for dir in $dirs; do
1928           if test -x "$dir/$1"; then
1929             if test -n "$5"
1930             then
1931               evalstr="$dir/$1 $5 2>&1 "
1932               if eval $evalstr; then
1933                 kde_cv_path_$1="$dir/$1"
1934                 break
1935               fi
1936             else
1937                 kde_cv_path_$1="$dir/$1"
1938                 break
1939             fi
1940           fi
1941         done
1942  
1943      fi
1944  
1945    ])
1946  
1947    if test -z "$kde_cv_path_$1" || test "$kde_cv_path_$1" = "NONE"; then
1948       AC_MSG_RESULT(not found)
1949       $4
1950    else
1951      AC_MSG_RESULT($kde_cv_path_$1)
1952      $2=$kde_cv_path_$1
1953    fi
1954 ])
1955 AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
1956 [
1957     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
1958 Please check whether you installed Qt correctly.
1959 You need to have a running moc binary.
1960 configure tried to run $ac_cv_path_moc and the test didn't
1961 succeed. If configure shouldn't have tried this one, set
1962 the environment variable MOC to the right one before running
1963 configure.
1964 ])
1965 ])
1966
1967 dnl ------------------------------------------------------------------------
1968 dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some
1969 dnl more usual places
1970 dnl ------------------------------------------------------------------------
1971 dnl
1972 AC_DEFUN(AC_PATH_QT_MOC,
1973 [
1974    KDE_FIND_PATH(moc, MOC, [$ac_qt_bindir $QTDIR/bin \
1975             /usr/bin /usr/X11R6/bin /usr/lib/qt/bin \
1976             /usr/local/qt/bin], [KDE_MOC_ERROR_MESSAGE])
1977  
1978    if test -z "$MOC"; then
1979      if test -n "$ac_cv_path_moc"; then
1980        output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"`
1981      fi
1982      echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC
1983      echo "configure:__oline__: moc output: $output" >&AC_FD_CC
1984  
1985      if test -z "$output"; then
1986        KDE_MOC_ERROR_MESSAGE
1987     fi
1988    fi
1989  
1990    AC_SUBST(MOC)
1991 ])
1992
1993 AC_DEFUN(KDE_REPLACE_ROOT,
1994   $1=`echo "$$1" | sed -e "s#^/#\$\{install_root\}/#"`
1995 )
1996
1997 AC_DEFUN(AC_CREATE_KFSSTND,
1998 [
1999 AC_REQUIRE([AC_CHECK_RPATH])
2000
2001 if test "$1" = "default"; then
2002
2003   AC_MSG_CHECKING(for KDE paths)
2004
2005   if test -z "$kde_htmldir"; then
2006     kde_htmldir="\$(prefix)/share/doc/HTML"
2007   fi
2008   if test -z "$kde_appsdir"; then
2009     kde_appsdir="\$(prefix)/share/applnk"
2010   fi
2011   if test -z "$kde_icondir"; then
2012     kde_icondir="\$(prefix)/share/icons"
2013   fi
2014   if test -z "$kde_sounddir"; then
2015     kde_sounddir="\$(prefix)/share/sounds"
2016   fi
2017   if test -z "$kde_datadir"; then
2018     kde_datadir="\$(prefix)/share/apps"
2019   fi
2020   if test -z "$kde_locale"; then
2021     kde_locale="\$(prefix)/share/locale"
2022   fi
2023   if test -z "$kde_cgidir"; then
2024     kde_cgidir="\$(exec_prefix)/cgi-bin"
2025   fi
2026   if test -z "$kde_confdir"; then
2027     kde_confdir="\$(prefix)/share/config"
2028   fi
2029   if test -z "$kde_mimedir"; then
2030     kde_mimedir="\$(prefix)/share/mimelnk"
2031   fi
2032   if test -z "$kde_toolbardir"; then
2033     kde_toolbardir="\$(prefix)/share/toolbar"
2034   fi
2035   if test -z "$kde_wallpaperdir"; then
2036     kde_wallpaperdir="\$(prefix)/share/wallpapers"
2037   fi
2038   if test -z "$kde_bindir"; then
2039     kde_bindir="\$(exec_prefix)/bin"
2040   fi
2041   if test -z "$kde_partsdir"; then
2042     kde_partsdir="\$(exec_prefix)/parts"
2043   fi
2044   AC_MSG_RESULT(defaults)       
2045
2046 else 
2047
2048 AC_CACHE_VAL(kde_cv_all_paths,
2049 [
2050 AC_MSG_CHECKING([for kde headers installed])
2051 AC_LANG_CPLUSPLUS
2052 cat > conftest.$ac_ext <<EOF
2053 #include <stdio.h>
2054 #include "confdefs.h"
2055 #include <kapp.h>
2056
2057 int main() {
2058 printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
2059 printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
2060 printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
2061 printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
2062 printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
2063 printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
2064 printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
2065 printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
2066 printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
2067 printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
2068 printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data());
2069 printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
2070 printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
2071 return 0;
2072 }
2073 EOF
2074
2075 if test -n "$kde_libraries"; then
2076   KDE_TEST_RPATH="-rpath $kde_libraries"
2077 fi
2078
2079 if test -n "$qt_libraries"; then
2080   KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries"
2081 fi
2082
2083 if test -n "$x_libraries"; then
2084   KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries"
2085 fi
2086
2087 KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
2088
2089 ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
2090 if AC_TRY_EVAL(ac_compile); then
2091   AC_MSG_RESULT(yes)
2092 else
2093   AC_MSG_ERROR([your system is not able to compile a small KDE application!
2094 Check, if you installed the KDE header files correctly.])
2095 fi
2096
2097 AC_MSG_CHECKING([for kde libraries installed])
2098 ac_link='/bin/sh ./libtool --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore -lqt -lXext -lX11 $LIBSOCKET $KDE_TEST_RPATH 1>&5'
2099
2100 if AC_TRY_EVAL(ac_link) && test -s conftest; then 
2101   AC_MSG_RESULT(yes)
2102 else
2103   AC_MSG_ERROR([your system fails at linking a small KDE application!
2104 Check, if your compiler is installed correctly and if you have used the
2105 same compiler to compile Qt and kdelibs as you did use now])
2106 fi
2107
2108 AC_MSG_CHECKING([for KDE paths])
2109 if eval `./conftest 2>&5`; then
2110   AC_MSG_RESULT(done)
2111 else
2112   AC_MSG_RESULT(problems)
2113 fi
2114
2115 ./conftest 2> /dev/null >&5 # make an echo for config.log
2116 kde_have_all_paths=yes
2117 AC_LANG_CPLUSPLUS
2118
2119 if test "$kde_have_all_paths" = "yes"; then
2120 kde_cv_all_paths="kde_have_all_paths=\"yes\" \
2121         kde_htmldir=\"$kde_htmldir\" \
2122         kde_appsdir=\"$kde_appsdir\" \
2123         kde_icondir=\"$kde_icondir\" \
2124         kde_sounddir=\"$kde_sounddir\" \
2125         kde_datadir=\"$kde_datadir\" \
2126         kde_locale=\"$kde_locale\" \
2127         kde_cgidir=\"$kde_cgidir\" \
2128         kde_confdir=\"$kde_confdir\" \
2129         kde_mimedir=\"$kde_mimedir\" \
2130         kde_toolbardir=\"$kde_toolbardir\" \
2131         kde_wallpaperdir=\"$kde_wallpaperdir\" \
2132         kde_bindir=\"$kde_bindir\" \
2133         kde_partsdir=\"$kde_partsdir\""
2134 fi
2135 rm -fr conftest*
2136
2137 ])
2138
2139 eval "$kde_cv_all_paths"
2140
2141 if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
2142    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
2143    test -z "$kde_datadir" || test -z "$kde_locale"  ||
2144    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
2145    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
2146    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
2147    test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then
2148   kde_have_all_paths=no
2149   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
2150 Since it had compiled and linked before, it must be a strange problem on your system.
2151 Look at config.log for details. If you are not able to fix this, please contact Stephan Kulow <coolo@kde.org>.])
2152 fi
2153
2154 if test -n "$install_root"; then
2155   KDE_REPLACE_ROOT(kde_htmldir)
2156   KDE_REPLACE_ROOT(kde_appsdir)
2157   KDE_REPLACE_ROOT(kde_icondir)
2158   KDE_REPLACE_ROOT(kde_sounddir)
2159   KDE_REPLACE_ROOT(kde_datadir)
2160   KDE_REPLACE_ROOT(kde_locale)
2161   KDE_REPLACE_ROOT(kde_cgidir)
2162   KDE_REPLACE_ROOT(kde_confdir)
2163   KDE_REPLACE_ROOT(kde_mimedir)
2164   KDE_REPLACE_ROOT(kde_toolbardir)
2165   KDE_REPLACE_ROOT(kde_wallpaperdir)
2166   KDE_REPLACE_ROOT(kde_bindir)
2167   KDE_REPLACE_ROOT(kde_partsdir)
2168   AC_SUBST(install_root)
2169 fi
2170
2171 fi
2172
2173 bindir=$kde_bindir
2174
2175 ])
2176
2177 AC_DEFUN(AC_SUBST_KFSSTND,
2178 [
2179 AC_SUBST(kde_htmldir)
2180 AC_SUBST(kde_appsdir)
2181 AC_SUBST(kde_icondir)
2182 AC_SUBST(kde_sounddir)
2183 kde_minidir="$kde_icondir/mini"
2184 AC_SUBST(kde_minidir)
2185 AC_SUBST(kde_datadir)
2186 AC_SUBST(kde_locale)
2187 AC_SUBST(kde_cgidir)
2188 AC_SUBST(kde_confdir)
2189 AC_SUBST(kde_mimedir)
2190 AC_SUBST(kde_toolbardir)
2191 AC_SUBST(kde_wallpaperdir)
2192 AC_SUBST(kde_bindir)
2193 AC_SUBST(kde_partsdir)
2194 ])
2195
2196 AC_DEFUN(KDE_MISC_TESTS,
2197 [
2198    AC_LANG_C
2199    dnl Checks for libraries. 
2200    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
2201    AC_SUBST(LIBCOMPAT)
2202    AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD
2203    AC_SUBST(LIBCRYPT)
2204    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
2205    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
2206       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
2207         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
2208    fi
2209    AC_CHECK_FUNC(gethostbyname)
2210    if test $ac_cv_func_gethostbyname = no; then
2211      AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
2212    fi
2213    AC_CHECK_FUNC(connect)
2214    if test $ac_cv_func_connect = no; then
2215       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
2216         $X_EXTRA_LIBS)
2217    fi
2218
2219    AC_CHECK_FUNC(remove)
2220    if test $ac_cv_func_remove = no; then
2221       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
2222    fi
2223  
2224    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
2225    AC_CHECK_FUNC(shmat)
2226    if test $ac_cv_func_shmat = no; then
2227      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
2228    fi
2229
2230    LIBSOCKET=$X_EXTRA_LIBS
2231    AC_SUBST(LIBSOCKET)
2232    AC_SUBST(X_EXTRA_LIBS)
2233    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
2234    AC_SUBST(LIBUCB)
2235
2236    case $host in  dnl this *is* LynxOS specific
2237    *-*-lynxos* )
2238         AC_MSG_CHECKING([LynxOS header file wrappers])
2239         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
2240         AC_MSG_RESULT(disabled)
2241         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
2242          ;;
2243     esac
2244
2245 ])
2246
2247 ## ------------------------------------------------------------------------
2248 ## Find the header files and libraries for X-Windows. Extended the 
2249 ## macro AC_PATH_X
2250 ## ------------------------------------------------------------------------
2251 ##
2252 AC_DEFUN(K_PATH_X,
2253 [
2254 AC_MSG_CHECKING(for X)
2255 AC_CACHE_VAL(ac_cv_have_x,
2256 [# One or both of the vars are not set, and there is no cached value.
2257 ac_x_includes=NO ac_x_libraries=NO
2258 AC_PATH_X_DIRECT
2259 AC_PATH_X_XMKMF
2260 if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
2261   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
2262 else
2263   # Record where we found X for the cache.
2264   ac_cv_have_x="have_x=yes \
2265                 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
2266 fi])dnl
2267 eval "$ac_cv_have_x"
2268  
2269 if test "$have_x" != yes; then
2270   AC_MSG_RESULT($have_x)
2271   no_x=yes
2272 else
2273   # If each of the values was on the command line, it overrides each guess.
2274   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
2275   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
2276   # Update the cache value to reflect the command line values.
2277   ac_cv_have_x="have_x=yes \
2278                 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
2279   AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
2280 fi
2281
2282 if test -z "$x_includes" || test "x$x_includes" = xNONE; then
2283   X_INCLUDES=""
2284   x_includes="."; dnl better than nothing :-
2285  else
2286   X_INCLUDES="-I$x_includes"
2287 fi
2288
2289 if test -z "$x_libraries" || test "x$x_libraries" = xNONE; then
2290   X_LDFLAGS=""
2291   x_libraries="/usr/lib"; dnl better than nothing :-
2292  else
2293   X_LDFLAGS="-L$x_libraries"
2294 fi
2295 all_includes="$all_includes $X_INCLUDES"  
2296 all_libraries="$all_libraries $X_LDFLAGS"  
2297
2298 AC_SUBST(X_INCLUDES)
2299 AC_SUBST(X_LDFLAGS)
2300 AC_SUBST(x_libraries)
2301 AC_SUBST(x_includes)
2302 ])
2303
2304 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
2305 [
2306 AC_LANG_CPLUSPLUS
2307 cat > conftest.$ac_ext <<EOF
2308 #include "confdefs.h"
2309 #include <qmovie.h>
2310 #include <qapplication.h>
2311 int main() {
2312   QMovie m;
2313   m.setSpeed(20);
2314   return 0;
2315 }
2316 EOF
2317 ])
2318
2319 AC_DEFUN(KDE_CHECK_QT_DIRECT,
2320 [
2321 AC_MSG_CHECKING([if Qt compiles without flags])
2322 AC_CACHE_VAL(kde_cv_qt_direct,
2323 [
2324 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
2325 ac_LIBRARY_PATH="$LIBRARY_PATH"
2326 ac_cxxflags_safe="$CXXFLAGS"
2327 ac_ldflags_safe="$LDFLAGS"
2328 ac_libs_safe="$LIBS"
2329
2330 CXXFLAGS="$CXXFLAGS -I$qt_includes"
2331 LDFLAGS="$X_LDFLAGS"
2332 LIBS="-lqt -lXext -lX11 $LIBSOCKET"
2333 LD_LIBRARY_PATH=
2334 export LD_LIBRARY_PATH
2335 LIBRARY_PATH=
2336 export LIBRARY_PATH
2337
2338 KDE_PRINT_QT_PROGRAM
2339
2340 if AC_TRY_EVAL(ac_link) && test -s conftest; then
2341   kde_cv_qt_direct="yes"
2342 else
2343   kde_cv_qt_direct="no"
2344   echo "configure: failed program was:" >&AC_FD_CC
2345   cat conftest.$ac_ext >&AC_FD_CC
2346 fi
2347 rm -f conftest*
2348 CXXFLAGS="$ac_cxxflags_safe"
2349 LDFLAGS="$ac_ldflags_safe"
2350 LIBS="$ac_libs_safe"
2351
2352 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
2353 export LD_LIBRARY_PATH
2354 LIBRARY_PATH="$ac_LIBRARY_PATH"
2355 export LIBRARY_PATH
2356 ])
2357
2358 if test "$kde_cv_qt_direct" = "yes"; then
2359   AC_MSG_RESULT(yes)
2360   $1
2361 else
2362   AC_MSG_RESULT(no)
2363   $2
2364 fi
2365 ])
2366
2367 ## ------------------------------------------------------------------------
2368 ## Try to find the Qt headers and libraries.
2369 ## $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
2370 ## and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
2371 ## ------------------------------------------------------------------------
2372 ##
2373 AC_DEFUN(AC_PATH_QT_1_3,
2374 [
2375 AC_REQUIRE([K_PATH_X])
2376
2377 AC_MSG_CHECKING([for Qt])
2378 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
2379 qt_libraries=""
2380 qt_includes=""
2381 AC_ARG_WITH(qt-dir,
2382     [  --with-qt-dir           where the root of qt is installed ],
2383     [  ac_qt_includes="$withval"/include
2384        ac_qt_libraries="$withval"/lib
2385        ac_qt_bindir="$withval"/bin
2386     ])
2387
2388 AC_ARG_WITH(qt-includes,
2389     [  --with-qt-includes      where the Qt includes are. ],
2390     [  
2391        ac_qt_includes="$withval"
2392     ])
2393     
2394 kde_qt_libs_given=no
2395
2396 AC_ARG_WITH(qt-libraries,
2397     [  --with-qt-libraries     where the Qt library is installed.],
2398     [  ac_qt_libraries="$withval"
2399        kde_qt_libs_given=yes
2400     ])
2401
2402 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
2403
2404 AC_CACHE_VAL(ac_cv_have_qt,
2405 [#try to guess Qt locations
2406
2407 qt_incdirs="$ac_qt_includes /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC"
2408 test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
2409 AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
2410 ac_qt_includes="$qt_incdir"
2411
2412 if test ! "$ac_qt_libraries" = "NO"; then
2413   qt_libdirs="$ac_qt_libraries"
2414 fi
2415
2416 qt_libdirs="$qt_libdirs /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries $QTLIB"
2417 test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
2418
2419 test=NONE
2420 qt_libdir=NONE
2421 for dir in $qt_libdirs; do
2422   try="ls -1 $dir/libqt*"
2423   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
2424 done
2425
2426 dnl AC_FIND_FILE(libqt.so libqt.so.1.40 libqt.so.1.41 libqt.so.1 libqt.a libqt.sl, $qt_libdirs, qt_libdir)
2427 ac_qt_libraries="$qt_libdir"
2428
2429 ac_cxxflags_safe="$CXXFLAGS"
2430 ac_ldflags_safe="$LDFLAGS"
2431 ac_libs_safe="$LIBS"
2432
2433 CXXFLAGS="$CXXFLAGS -I$qt_incdir"
2434 LDFLAGS="-L$qt_libdir $X_LDFLAGS"
2435 LIBS="$LIBS -lqt -lXext -lX11 $LIBSOCKET"
2436
2437 KDE_PRINT_QT_PROGRAM
2438
2439 if AC_TRY_EVAL(ac_link) && test -s conftest; then
2440   rm -f conftest*
2441 else
2442   echo "configure: failed program was:" >&AC_FD_CC
2443   cat conftest.$ac_ext >&AC_FD_CC
2444   ac_qt_libraries="NO"
2445 fi
2446 rm -f conftest*
2447 CXXFLAGS="$ac_cxxflags_safe"
2448 LDFLAGS="$ac_ldflags_safe"
2449 LIBS="$ac_libs_safe"
2450
2451 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
2452   ac_cv_have_qt="have_qt=no"
2453   ac_qt_notfound=""
2454   if test "$ac_qt_includes" = NO; then
2455     if test "$ac_qt_libraries" = NO; then
2456       ac_qt_notfound="(headers and libraries)";
2457     else
2458       ac_qt_notfound="(headers)";
2459     fi
2460   else
2461     ac_qt_notfound="(libraries)";
2462   fi
2463
2464   AC_MSG_ERROR([Qt-1.4 $ac_qt_notfound not found. Please check your installation! ]);
2465 else
2466   have_qt="yes"
2467 fi
2468 ])
2469 else
2470   have_qt="yes"
2471 fi
2472
2473 eval "$ac_cv_have_qt"
2474
2475 if test "$have_qt" != yes; then
2476   AC_MSG_RESULT([$have_qt]);
2477 else
2478   ac_cv_have_qt="have_qt=yes \
2479     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
2480   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
2481   
2482   qt_libraries="$ac_qt_libraries"
2483   qt_includes="$ac_qt_includes"
2484 fi
2485
2486 if test ! "$kde_qt_libs_given" = "yes"; then
2487 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
2488 fi
2489
2490 AC_SUBST(qt_libraries)
2491 AC_SUBST(qt_includes)
2492
2493 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
2494  QT_INCLUDES="";
2495 else
2496  QT_INCLUDES="-I$qt_includes"
2497  all_includes="$QT_INCLUDES $all_includes"
2498 fi
2499
2500 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
2501  QT_LDFLAGS=""
2502 else
2503  QT_LDFLAGS="-L$qt_libraries"
2504  all_libraries="$QT_LDFLAGS $all_libraries"
2505 fi
2506
2507 AC_SUBST(QT_INCLUDES)
2508 AC_SUBST(QT_LDFLAGS)
2509 AC_PATH_QT_MOC
2510 ])
2511
2512 AC_DEFUN(AC_PATH_QT,
2513 [
2514 AC_PATH_QT_1_3
2515 ])
2516
2517 ## ------------------------------------------------------------------------
2518 ## Now, the same with KDE
2519 ## $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
2520 ## and $(kde_includes) will be the kdehdrlocation (if needed)
2521 ## ------------------------------------------------------------------------
2522 ##
2523 AC_DEFUN(AC_BASE_PATH_KDE,
2524 [
2525 AC_REQUIRE([KDE_MISC_TESTS])
2526 AC_REQUIRE([AC_PATH_QT])dnl
2527 AC_MSG_CHECKING([for KDE])
2528
2529 if test "${prefix}" != NONE; then
2530   kde_includes=${prefix}/include
2531   ac_kde_includes=$prefix/include
2532
2533   if test "${exec_prefix}" != NONE; then
2534     kde_libraries=${exec_prefix}/lib
2535     ac_kde_libraries=$exec_prefix/lib
2536   else
2537     kde_libraries=${prefix}/lib
2538     ac_kde_libraries=$prefix/lib
2539   fi
2540 else
2541   ac_kde_includes=
2542   ac_kde_libraries=
2543   kde_libraries=""
2544   kde_includes=""
2545 fi
2546
2547 AC_CACHE_VAL(ac_cv_have_kde,
2548 [#try to guess kde locations
2549
2550 if test -z "$1"; then
2551
2552 kde_incdirs="$ac_kde_includes /usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes"
2553 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
2554 AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
2555 ac_kde_includes="$kde_incdir"
2556
2557 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
2558   AC_MSG_ERROR([
2559 in the prefix, you've chosen, are no kde headers installed. This will fail.
2560 So, check this please and use another prefix!])
2561 fi
2562
2563 kde_libdirs="$ac_kde_libraries /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde/lib /usr/X11R6/kde/lib"
2564 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
2565 AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
2566 ac_kde_libraries="$kde_libdir"
2567
2568 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
2569 AC_MSG_ERROR([
2570 in the prefix, you've chosen $ac_kde_libraries, are no kde libraries installed. This will fail.
2571 So, check this please and use another prefix!])
2572 fi
2573 ac_kde_libraries="$kde_libdir"
2574
2575 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
2576   ac_cv_have_kde="have_kde=no"
2577 else
2578   ac_cv_have_kde="have_kde=yes \
2579     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
2580 fi
2581
2582 else dnl test -z $1 
2583   
2584   ac_cv_have_kde="have_kde=no"
2585
2586 fi
2587 ])dnl
2588
2589 eval "$ac_cv_have_kde"
2590
2591 if test "$have_kde" != "yes"; then
2592  if test "${prefix}" = NONE; then
2593   ac_kde_prefix="$ac_default_prefix"
2594  else
2595   ac_kde_prefix="$prefix"
2596  fi
2597  if test "$exec_prefix" = NONE; then
2598   ac_kde_exec_prefix="$ac_kde_prefix"
2599   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
2600  else
2601   ac_kde_exec_prefix="$exec_prefix"
2602   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
2603  fi
2604
2605  kde_libraries="${ac_kde_exec_prefix}/lib"
2606  kde_includes=${ac_kde_prefix}/include
2607
2608 else
2609   ac_cv_have_kde="have_kde=yes \
2610     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
2611   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
2612   
2613   kde_libraries="$ac_kde_libraries"
2614   kde_includes="$ac_kde_includes"
2615 fi
2616 AC_SUBST(kde_libraries)
2617 AC_SUBST(kde_includes)
2618
2619 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
2620  KDE_INCLUDES=""
2621 else
2622  KDE_INCLUDES="-I$kde_includes"
2623  all_includes="$KDE_INCLUDES $all_includes"
2624 fi
2625
2626 if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
2627  KDE_LDFLAGS=""
2628 else
2629  KDE_LDFLAGS="-L$kde_libraries"
2630  all_libraries="$KDE_LDFLAGS $all_libraries"
2631 fi
2632
2633 AC_SUBST(KDE_LDFLAGS)
2634 AC_SUBST(KDE_INCLUDES)
2635
2636 KDE_CHECK_EXTRA_LIBS
2637
2638 AC_SUBST(all_includes)
2639 AC_SUBST(all_libraries)
2640
2641 ])
2642
2643 AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
2644 [
2645 AC_MSG_CHECKING(for extra includes)
2646 AC_ARG_WITH(extra-includes, [  --with-extra-includes   adds non standard include paths], 
2647   kde_use_extra_includes="$withval",
2648   kde_use_extra_includes=NONE
2649 )
2650 if test -n "$kde_use_extra_includes" && \
2651    test "$kde_use_extra_includes" != "NONE"; then
2652
2653    ac_save_ifs=$IFS
2654    IFS=':'
2655    for dir in $kde_use_extra_includes; do
2656      all_includes="$all_includes -I$dir"
2657      USER_INCLUDES="$USER_INCLUDES -I$dir"
2658    done
2659    IFS=$ac_save_ifs
2660    kde_use_extra_includes="added"
2661 else
2662    kde_use_extra_includes="no"
2663 fi
2664
2665 AC_MSG_RESULT($kde_use_extra_includes)
2666
2667 AC_MSG_CHECKING(for extra libs)
2668 AC_ARG_WITH(extra-libs, [  --with-extra-libs       adds non standard library paths], 
2669   kde_use_extra_libs=$withval,
2670   kde_use_extra_libs=NONE
2671 )
2672 if test -n "$kde_use_extra_libs" && \
2673    test "$kde_use_extra_libs" != "NONE"; then
2674
2675    ac_save_ifs=$IFS
2676    IFS=':'
2677    for dir in $kde_use_extra_libs; do
2678      all_libraries="$all_libraries -L$dir"
2679      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
2680      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
2681    done
2682    IFS=$ac_save_ifs
2683    kde_use_extra_libs="added"
2684 else
2685    kde_use_extra_libs="no"
2686 fi
2687
2688 AC_MSG_RESULT($kde_use_extra_libs)
2689
2690 ])
2691
2692 AC_DEFUN(KDE_CHECK_KIMGIO,
2693 [
2694    AC_REQUIRE([AC_FIND_TIFF])
2695    AC_REQUIRE([AC_FIND_JPEG]) 
2696    AC_REQUIRE([AC_FIND_PNG]) 
2697
2698    LIB_KIMGIO='-lkimgio $(LIBJPEG) $(LIBTIFF) $(LIBPNG) -lm'
2699    AC_SUBST(LIB_KIMGIO)
2700    LIB_KHTMLW='-lkhtmlw $(LIB_KIMGIO) -ljscript'
2701    AC_SUBST(LIB_KHTMLW)
2702    LIB_KHTML='-lkhtml $(LIB_KIMGIO) -ljscript'
2703    AC_SUBST(LIB_KHTML)
2704 ])
2705
2706 AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
2707 [
2708    AC_REQUIRE([KDE_MISC_TESTS])
2709
2710    KDE_LIBS='-lqt -lkdecore -lkdeui -lkfm -lkfile'
2711    AC_SUBST(KDE_LIBS)
2712 #   LIB_X11='-lX11 $(LIBSOCKET)'
2713 #   AC_SUBST(LIB_X11)
2714 #   LIB_QT='-lqt $(LIB_X11)'
2715 #   AC_SUBST(LIB_QT)
2716 #   LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
2717 #   AC_SUBST(LIB_KDECORE)
2718 #   LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
2719 #   AC_SUBST(LIB_KDEUI)
2720 #   LIB_KFM='-lkfm $(LIB_KDECORE)'
2721 #   AC_SUBST(LIB_KFM)
2722 #   LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
2723 #   AC_SUBST(LIB_KFILE)
2724 ])
2725
2726 AC_DEFUN(AC_PATH_KDE,
2727 [
2728   AC_BASE_PATH_KDE
2729   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
2730   [
2731   if test "$enableval" = "no"; 
2732     then ac_use_path_checking="default"
2733     else ac_use_path_checking=""
2734   fi
2735   ], [ac_use_path_checking=""]
2736   )
2737
2738   AC_ARG_WITH(install-root, [  --with-install-root     the root, where to install to [default=/]],
2739   [
2740   if test "$withval" = "no";
2741     then kde_install_root="";
2742     else kde_install_root=$withval;
2743   fi
2744   ], [kde_install_root=""]
2745   )
2746   
2747   if test -n "$kde_install_root"; then
2748      install_root="$kde_install_root"
2749   else
2750      install_root=
2751   fi
2752
2753   AC_CREATE_KFSSTND($ac_use_path_checking)
2754
2755   AC_SUBST_KFSSTND
2756   KDE_CREATE_LIBS_ALIASES
2757 ])
2758
2759 dnl slightly changed version of AC_CHECK_FUNC(setenv)
2760 AC_DEFUN(AC_CHECK_SETENV,
2761 [AC_MSG_CHECKING([for setenv])
2762 AC_CACHE_VAL(ac_cv_func_setenv,
2763 [AC_LANG_C
2764 AC_TRY_LINK(
2765 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
2766 dnl which includes <sys/select.h> which contains a prototype for
2767 dnl select.  Similarly for bzero.
2768 [#include <assert.h>
2769 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
2770 extern "C"
2771 #endif
2772 ])dnl
2773 [/* We use char because int might match the return type of a gcc2
2774     builtin and then its argument prototype would still apply.  */
2775 #include <stdlib.h>
2776 ], [
2777 /* The GNU C library defines this for functions which it implements
2778     to always fail with ENOSYS.  Some functions are actually named
2779     something starting with __ and the normal name is an alias.  */
2780 #if defined (__stub_$1) || defined (__stub___$1)
2781 choke me
2782 #else
2783 setenv("TEST", "alle", 1);
2784 #endif
2785 ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
2786
2787 if test "$ac_cv_func_setenv" = "yes"; then
2788   AC_MSG_RESULT(yes)
2789   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV)
2790 else
2791   AC_MSG_RESULT(no)
2792 fi
2793 ])
2794
2795 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
2796 [
2797 AC_LANG_CPLUSPLUS
2798 save_CXXFLAGS="$CXXFLAGS"
2799 if test "$GCC" = "yes"; then
2800 CXXFLAGS="$CXXFLAGS -pedantic-errors"
2801 fi
2802 AC_MSG_CHECKING(for getdomainname)
2803 AC_CACHE_VAL(ac_cv_func_getdomainname,
2804 [
2805 AC_TRY_COMPILE([
2806 #include <stdlib.h>
2807 #include <unistd.h>
2808 ],
2809 [
2810 char buffer[200];
2811 getdomainname(buffer, 200);
2812 ],
2813 ac_cv_func_getdomainname=yes,
2814 ac_cv_func_getdomainname=no)
2815 ])
2816 AC_MSG_RESULT($ac_cv_func_getdomainname)
2817 if eval "test \"`echo `$ac_cv_func_getdomainname\" = yes"; then
2818   AC_DEFINE(HAVE_GETDOMAINNAME)
2819 fi
2820 CXXFLAGS="$save_CXXFLAGS"
2821 ])
2822
2823 AC_DEFUN(AC_CHECK_GETHOSTNAME,
2824 [
2825 AC_LANG_CPLUSPLUS
2826 save_CXXFLAGS="$CXXFLAGS"
2827 if test "$GCC" = "yes"; then
2828 CXXFLAGS="$CXXFLAGS -pedantic-errors"
2829 fi
2830
2831 AC_MSG_CHECKING([for gethostname])
2832 AC_CACHE_VAL(ac_cv_func_gethostname,
2833 [
2834 AC_TRY_COMPILE([
2835 #include <stdlib.h>
2836 #include <unistd.h>
2837 ],
2838 [
2839 char buffer[200];
2840 gethostname(buffer, 200);
2841 ],
2842 ac_cv_func_gethostname=yes,
2843 ac_cv_func_gethostname=no)
2844 ])
2845 AC_MSG_RESULT($ac_cv_func_gethostname)
2846 if eval "test \"`echo `$ac_cv_func_gethostname\" = yes"; then
2847   AC_DEFINE(HAVE_GETHOSTNAME)
2848 fi
2849 CXXFLAGS="$save_CXXFLAGS"
2850 ])
2851
2852 AC_DEFUN(AC_CHECK_USLEEP,
2853 [
2854 AC_LANG_CPLUSPLUS
2855
2856 AC_MSG_CHECKING([for usleep])
2857 AC_CACHE_VAL(ac_cv_func_usleep,
2858 [
2859 ac_libs_safe="$LIBS"
2860 LIBS="$LIBS $LIBUCB"
2861 AC_TRY_LINK([
2862 #include <stdlib.h>
2863 #include <unistd.h>
2864 ],
2865 [
2866 usleep(200);
2867 ],
2868 ac_cv_func_usleep=yes,
2869 ac_cv_func_usleep=no)
2870 ])
2871 AC_MSG_RESULT($ac_cv_func_usleep)
2872 if eval "test \"`echo `$ac_cv_func_usleep\" = yes"; then
2873   AC_DEFINE(HAVE_USLEEP)
2874 fi
2875 LIBS="$ac_libs_safe"
2876 ])
2877
2878 AC_DEFUN(AC_FIND_GIF,
2879    [AC_MSG_CHECKING([for giflib])
2880 AC_CACHE_VAL(ac_cv_lib_gif,
2881 [ac_save_LIBS="$LIBS"
2882 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
2883 AC_TRY_LINK(dnl
2884 [
2885 #ifdef __cplusplus
2886 extern "C" {
2887 #endif
2888 int GifLastError(void);
2889 #ifdef __cplusplus
2890 }
2891 #endif
2892 /* We use char because int might match the return type of a gcc2
2893     builtin and then its argument prototype would still apply.  */
2894 ],
2895             [return GifLastError();],
2896             eval "ac_cv_lib_gif=yes",
2897             eval "ac_cv_lib_gif=no")
2898 LIBS="$ac_save_LIBS"
2899 ])dnl
2900 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
2901   AC_MSG_RESULT(yes)
2902   AC_DEFINE_UNQUOTED(HAVE_LIBGIF)
2903 else
2904   AC_MSG_ERROR(You need giflib23. Please install the kdesupport package)
2905 fi
2906 ])
2907
2908 AC_DEFUN(AC_FIND_JPEG,
2909    [AC_MSG_CHECKING([for jpeglib])
2910 AC_CACHE_VAL(ac_cv_lib_jpeg,
2911 [ac_save_LIBS="$LIBS"
2912 LIBS="$all_libraries -ljpeg -lm"
2913 AC_TRY_LINK(
2914 [/* Override any gcc2 internal prototype to avoid an error.  */
2915 struct jpeg_decompress_struct;
2916 typedef struct jpeg_decompress_struct * j_decompress_ptr;
2917 typedef int size_t;
2918 #ifdef __cplusplus
2919 extern "C" {
2920 #endif
2921     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
2922                                     int version, size_t structsize);
2923 #ifdef __cplusplus
2924 }
2925 #endif
2926 /* We use char because int might match the return type of a gcc2
2927     builtin and then its argument prototype would still apply.  */
2928 ],
2929             [jpeg_CreateDecompress(0L, 0, 0);],
2930             eval "ac_cv_lib_jpeg=-ljpeg",
2931             eval "ac_cv_lib_jpeg=no")
2932 LIBS="$ac_save_LIBS"
2933
2934 dnl what to do, if the normal way fails:
2935 if eval "test \"`echo $ac_cv_lib_jpeg`\" = no"; then
2936         if test -f "$kde_libraries/libjpeg.so"; then
2937            test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
2938            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
2939         else if test -f "$kde_libraries/libjpeg.sl"; then
2940            test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
2941            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"      
2942         else if test -f "$kde_libraries/libjpeg.a"; then
2943            test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
2944            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
2945         else
2946           AC_MSG_ERROR([
2947 You need jpeglib6a. Please install the kdesupport package.
2948 If you have already installed kdesupport, you may have an
2949 old libjpeg somewhere. 
2950 In this case copy $KDEDIR/lib/libjpeg* to /usr/lib.
2951 ])
2952         fi
2953       fi
2954    fi
2955 fi
2956 ])dnl
2957 if eval "test ! \"`echo $ac_cv_lib_jpeg`\" = no"; then
2958   LIBJPEG="$ac_cv_lib_jpeg"
2959   AC_SUBST(LIBJPEG)
2960   AC_MSG_RESULT($ac_cv_lib_jpeg)
2961   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG)
2962 fi
2963 ])
2964
2965 AC_DEFUN(AC_FIND_ZLIB,
2966 [
2967 AC_MSG_CHECKING([for libz])
2968 AC_CACHE_VAL(ac_cv_lib_z,
2969 [ac_save_LIBS="$LIBS"
2970 LIBS="$all_libraries -lz $LIBSOCKET"
2971 AC_TRY_LINK(dnl
2972 [
2973 #include<zlib.h>
2974 ],
2975             [return (zlibVersion() == ZLIB_VERSION); ],
2976             eval "ac_cv_lib_z='-lz'",
2977             eval "ac_cv_lib_z=no")
2978 LIBS="$ac_save_LIBS"
2979 ])dnl
2980 if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
2981 dnl  AC_DEFINE_UNQUOTED(HAVE_LIBZ)
2982   LIBZ="$ac_cv_lib_z"
2983   AC_SUBST(LIBZ)
2984   AC_MSG_RESULT($ac_cv_lib_z)
2985 else
2986   AC_MSG_RESULT(no)
2987   LIBZ=""
2988   AC_SUBST(LIBZ)
2989 fi
2990 ])
2991
2992 AC_DEFUN(AC_FIND_TIFF,
2993 [
2994 AC_REQUIRE([AC_FIND_ZLIB])
2995 AC_REQUIRE([AC_FIND_JPEG])
2996 AC_MSG_CHECKING([for libtiff])
2997 AC_CACHE_VAL(ac_cv_lib_tiff,
2998 [ac_save_LIBS="$LIBS"
2999 LIBS="$all_libraries -ltiff $LIBJPEG $LIBZ -lX11 $LIBSOCKET"
3000 AC_TRY_LINK(dnl
3001 [
3002 #include<tiffio.h>
3003 ],
3004             [return (TIFFOpen( "", "r") == 0); ],
3005             eval "ac_cv_lib_tiff='-ltiff $LIBJPEG $LIBZ'",
3006             eval "ac_cv_lib_tiff=no")
3007 LIBS="$ac_save_LIBS"
3008 ])dnl
3009 if eval "test ! \"`echo $ac_cv_lib_tiff`\" = no"; then
3010   AC_DEFINE_UNQUOTED(HAVE_LIBTIFF)
3011   LIBTIFF="$ac_cv_lib_tiff"
3012   AC_SUBST(LIBTIFF)
3013   AC_MSG_RESULT($ac_cv_lib_tiff)
3014 else
3015   AC_MSG_RESULT(no)
3016   LIBTIFF=""
3017   AC_SUBST(LIBTIFF)
3018 fi
3019 ])
3020
3021
3022 AC_DEFUN(AC_FIND_PNG,
3023 [
3024 AC_REQUIRE([AC_FIND_ZLIB])
3025 AC_MSG_CHECKING([for libpng])
3026 AC_CACHE_VAL(ac_cv_lib_png,
3027 [ac_save_LIBS="$LIBS"
3028 LIBS="$all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
3029 AC_LANG_C
3030 AC_TRY_LINK(dnl
3031     [
3032     #include<png.h>
3033     ],
3034     [
3035     png_structp png_ptr = png_create_read_struct(  // image ptr
3036                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
3037     return( png_ptr != 0 ); 
3038     ],
3039     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
3040     eval "ac_cv_lib_png=no")
3041     LIBS="$ac_save_LIBS"
3042 ])dnl
3043 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
3044   AC_DEFINE_UNQUOTED(HAVE_LIBPNG)
3045   LIBPNG="$ac_cv_lib_png"
3046   AC_SUBST(LIBPNG)
3047   AC_MSG_RESULT($ac_cv_lib_png)
3048 else
3049   AC_MSG_RESULT(no)
3050   LIBPNG=""
3051   AC_SUBST(LIBPNG)
3052 fi
3053 ])
3054
3055 AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
3056 [
3057 AC_MSG_CHECKING(if you need GNU extensions)
3058 AC_CACHE_VAL(ac_cv_gnu_extensions,
3059 [
3060 cat > conftest.c << EOF
3061 #include <features.h>
3062
3063 #ifdef __GNU_LIBRARY__
3064 yes
3065 #endif
3066 EOF
3067
3068 if (eval "$ac_cpp conftest.c") 2>&5 |
3069   egrep "yes" >/dev/null 2>&1; then
3070   rm -rf conftest*
3071   ac_cv_gnu_extensions=yes
3072 else
3073   ac_cv_gnu_extensions=no
3074 fi
3075 ])
3076
3077 AC_MSG_RESULT($ac_cv_gnu_extensions)
3078 if test "$ac_cv_gnu_extensions" = "yes"; then
3079   AC_DEFINE_UNQUOTED(_GNU_SOURCE)
3080 fi
3081 ])
3082
3083 AC_DEFUN(AC_CHECK_COMPILERS,
3084 [
3085   dnl this is somehow a fat lie, but prevents other macros from double checking
3086   AC_PROVIDE([AC_PROG_CC])
3087   AC_PROVIDE([AC_PROG_CPP])
3088   AC_ARG_ENABLE(debug,[  --enable-debug           creates debugging code [default=no]],
3089   [ 
3090    if test $enableval = "no"; dnl 
3091      then ac_use_debug_code="no"
3092      else ac_use_debug_code="yes"
3093    fi
3094   ], [ac_use_debug_code="no"])
3095
3096   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
3097    [ 
3098     if test $enableval = "no"; then 
3099          ac_use_strict_options="no"
3100        else 
3101          ac_use_strict_options="yes"
3102     fi
3103    ], [ac_use_strict_options="no"])
3104
3105 dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
3106   AC_MSG_CHECKING(for a C-Compiler)
3107   dnl if there is one, print out. if not, don't matter
3108   AC_MSG_RESULT($CC) 
3109  
3110   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
3111   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
3112   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
3113   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
3114
3115   AC_PROG_CC_WORKS
3116   AC_PROG_CC_GNU
3117
3118   if test $ac_cv_prog_gcc = yes; then
3119     GCC=yes
3120   else
3121     GCC=
3122   fi
3123
3124   if test -z "$CFLAGS"; then
3125     if test "$ac_use_debug_code" = "yes"; then
3126       AC_PROG_CC_G
3127       if test $ac_cv_prog_cc_g = yes; then
3128         CFLAGS="-g"
3129       fi
3130     else
3131       if test "$GCC" = "yes"; then
3132         CFLAGS="-O2"
3133       else
3134         CFLAGS=""
3135       fi
3136     fi
3137
3138     if test "$GCC" = "yes"; then
3139      CFLAGS="$CFLAGS -Wall"
3140
3141      if test "$ac_use_strict_options" = "yes"; then
3142         CFLAGS="$CFLAGS -W -ansi -pedantic"     
3143      fi
3144     fi
3145
3146   fi
3147
3148   case "$host" in 
3149   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
3150   esac
3151
3152   if test -z "$LDFLAGS" && test "$ac_use_debug_code" = "no" && test "$GCC" = "yes"; then
3153      LDFLAGS="-s"
3154   fi
3155
3156
3157 dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
3158 dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
3159
3160   AC_MSG_CHECKING(how to run the C preprocessor)
3161   # On Suns, sometimes $CPP names a directory.
3162   if test -n "$CPP" && test -d "$CPP"; then
3163     CPP=
3164   fi
3165   if test -z "$CPP"; then
3166   AC_CACHE_VAL(ac_cv_prog_CPP,
3167   [  # This must be in double quotes, not single quotes, because CPP may get
3168     # substituted into the Makefile and "${CC-cc}" will confuse make.
3169     CPP="${CC-cc} -E"
3170     # On the NeXT, cc -E runs the code through the compiler's parser,
3171     # not just through cpp.
3172     dnl Use a header file that comes with gcc, so configuring glibc    
3173     dnl with a fresh cross-compiler works.
3174     AC_TRY_CPP([#include <assert.h>
3175     Syntax Error], ,
3176     CPP="${CC-cc} -E -traditional-cpp"
3177     AC_TRY_CPP([#include <assert.h>
3178     Syntax Error], , CPP=/lib/cpp))
3179     ac_cv_prog_CPP="$CPP"])dnl
3180     CPP="$ac_cv_prog_CPP"
3181   else
3182     ac_cv_prog_CPP="$CPP"
3183   fi
3184   AC_MSG_RESULT($CPP)
3185   AC_SUBST(CPP)dnl
3186
3187
3188   AC_MSG_CHECKING(for a C++-Compiler)
3189   dnl if there is one, print out. if not, don't matter
3190   AC_MSG_RESULT($CXX) 
3191  
3192   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
3193   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
3194   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
3195   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
3196   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
3197
3198   AC_PROG_CXX_WORKS
3199   AC_PROG_CXX_GNU
3200
3201   if test $ac_cv_prog_gxx = yes; then
3202     GXX=yes
3203   else
3204     AC_MSG_CHECKING(whether we are using SPARC CC)
3205     GXX=
3206     cat > conftest.C << EOF
3207 #ifdef __SUNPRO_CC
3208    yes;
3209 #endif
3210 EOF
3211
3212     ac_try="$CXX -E conftest.C"
3213     if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
3214       ac_cv_prog_CC=yes
3215     else
3216       ac_cv_prog_CC=no
3217     fi
3218     AC_MSG_RESULT($ac_cv_prog_CC)
3219   fi
3220
3221   if test -z "$CXXFLAGS"; then 
3222     if test "$ac_use_debug_code" = "yes"; then
3223       AC_PROG_CXX_G
3224       if test $ac_cv_prog_cxx_g = yes; then
3225         CXXFLAGS="-g"
3226       fi
3227       if test "$ac_cv_prog_CC" = "yes"; then
3228         CXXFLAGS="$CXXFLAGS -pto"
3229       fi
3230     else
3231       if test "$GXX" = "yes"; then
3232          CXXFLAGS="-O2"
3233       else
3234          if test "$ac_cv_prog_CC" = "yes"; then
3235             CXXFLAGS="-pto -O2"
3236          else
3237             CXXFLAGS=""
3238          fi
3239       fi
3240     fi
3241
3242     if test "$GXX" = "yes"; then
3243        CXXFLAGS="$CXXFLAGS -Wall"
3244  
3245        if test "$ac_use_strict_options" = "yes"; then
3246         CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional  -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast  -Wsynth"
3247        fi
3248
3249        if test "$kde_very_strict" = "yes"; then
3250          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion"
3251        fi
3252     fi
3253   fi  
3254
3255     case "$host" in
3256       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
3257     esac    
3258
3259 ])
3260
3261 dnl just a wrapper to clean up configure.in
3262 AC_DEFUN(KDE_PROG_LIBTOOL,
3263 [
3264 AC_REQUIRE([AM_ENABLE_SHARED])
3265 AC_REQUIRE([AM_ENABLE_STATIC])
3266 dnl libtool is only for C, so I must force him
3267 dnl to find the correct flags for C++
3268 ac_save_cc=$CC
3269 ac_save_cflags="$CFLAGS"
3270 CC=$CXX
3271 CFLAGS="$CXXFLAGS"
3272 AM_PROG_LIBTOOL dnl for libraries
3273 CC=$ac_save_cc
3274 CFLAGS="$ac_save_cflags"
3275 ])
3276
3277 AC_DEFUN(KDE_DO_IT_ALL,
3278 [
3279 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
3280 KDE_PROG_LIBTOOL
3281 AM_KDE_WITH_NLS
3282 AC_PATH_KDE
3283 ])
3284
3285 AC_DEFUN(AC_CHECK_RPATH,
3286 [
3287 AC_MSG_CHECKING(for rpath)
3288 AC_ARG_ENABLE(rpath,
3289       [  --disable-rpath         do not use the rpath feature of ld],
3290       USE_RPATH=$enableval, USE_RPATH=yes)
3291 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
3292
3293   KDE_RPATH="-rpath \$(kde_libraries)"
3294
3295   if test -n "$qt_libraries"; then
3296     KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)"
3297   fi
3298   dnl $x_libraries is set to /usr/lib in case
3299   if test -n "$X_LDFLAGS"; then 
3300     KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)"
3301   fi
3302   if test -n "$KDE_EXTRA_RPATH"; then
3303     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
3304   fi
3305 fi 
3306 AC_SUBST(KDE_EXTRA_RPATH)
3307 AC_SUBST(KDE_RPATH)
3308 AC_MSG_RESULT($USE_RPATH)
3309 ])
3310
3311 dnl This is a merge of some macros out of the gettext aclocal.m4
3312 dnl since we don't need anything, I took the things we need
3313 AC_DEFUN(AM_KDE_WITH_NLS,
3314   [AC_MSG_CHECKING([whether NLS is requested])
3315     AC_LANG_CPLUSPLUS
3316     dnl Default is enabled NLS
3317     AC_ARG_ENABLE(nls,
3318       [  --disable-nls           do not use Native Language Support],
3319       USE_NLS=$enableval, USE_NLS=yes)
3320     AC_MSG_RESULT($USE_NLS)
3321     AC_SUBST(USE_NLS)
3322
3323     dnl If we use NLS figure out what method
3324     if test "$USE_NLS" = "yes"; then
3325       AC_DEFINE(ENABLE_NLS)
3326
3327       AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, 
3328          [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
3329       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3330
3331       if test -z "`$MSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
3332         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
3333         msgfmt=":"
3334       fi
3335       AC_SUBST(MSGFMT)
3336
3337       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
3338         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
3339
3340       dnl Test whether we really found GNU xgettext.
3341       if test "$XGETTEXT" != ":"; then
3342         dnl If it is no GNU xgettext we define it as : so that the
3343         dnl Makefiles still can work.
3344         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
3345           : ;
3346         else
3347           AC_MSG_RESULT(
3348             [found xgettext programs is not GNU xgettext; ignore it])
3349           XGETTEXT=":"
3350         fi
3351       fi
3352      AC_SUBST(XGETTEXT)
3353     fi
3354
3355   ])
3356
3357 # Search path for a program which passes the given test.
3358 # Ulrich Drepper <drepper@cygnus.com>, 1996.
3359
3360 # serial 1
3361 # Stephan Kulow: I appended a _KDE against name conflicts
3362
3363 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
3364 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3365 AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
3366 [# Extract the first word of "$2", so it can be a program name with args.
3367 set dummy $2; ac_word=[$]2
3368 AC_MSG_CHECKING([for $ac_word])
3369 AC_CACHE_VAL(ac_cv_path_$1,
3370 [case "[$]$1" in
3371   /*)
3372   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3373   ;;
3374   *)
3375   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
3376   for ac_dir in ifelse([$5], , $PATH, [$5]); do
3377     test -z "$ac_dir" && ac_dir=.
3378     if test -f $ac_dir/$ac_word; then
3379       if [$3]; then
3380         ac_cv_path_$1="$ac_dir/$ac_word"
3381         break
3382       fi
3383     fi
3384   done
3385   IFS="$ac_save_ifs"
3386 dnl If no 4th arg is given, leave the cache variable unset,
3387 dnl so AC_PATH_PROGS will keep looking.
3388 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3389 ])dnl
3390   ;;
3391 esac])dnl
3392 $1="$ac_cv_path_$1"
3393 if test -n "[$]$1"; then
3394   AC_MSG_RESULT([$]$1)
3395 else
3396   AC_MSG_RESULT(no)
3397 fi
3398 AC_SUBST($1)dnl
3399 ])
3400
3401
3402 dnl From Jim Meyering.
3403 dnl FIXME: migrate into libit.
3404
3405 AC_DEFUN(AM_FUNC_OBSTACK,
3406 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
3407  [AC_TRY_LINK([#include "obstack.h"],
3408               [struct obstack *mem;obstack_free(mem,(char *) 0)],
3409               am_cv_func_obstack=yes,
3410               am_cv_func_obstack=no)])
3411  if test $am_cv_func_obstack = yes; then
3412    AC_DEFINE(HAVE_OBSTACK)
3413  else
3414    LIBOBJS="$LIBOBJS obstack.o"
3415  fi
3416 ])
3417
3418 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
3419 dnl FIXME: Migrate into libit
3420
3421 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
3422 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
3423  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
3424               am_cv_lib_error_at_line=yes,
3425               am_cv_lib_error_at_line=no)])
3426  if test $am_cv_lib_error_at_line = no; then
3427    LIBOBJS="$LIBOBJS error.o"
3428  fi
3429  AC_SUBST(LIBOBJS)dnl
3430 ])
3431
3432 # Macro to add for using GNU gettext.
3433 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3434
3435 # serial 1
3436 # Stephan Kulow: I put a KDE in it to avoid name conflicts
3437
3438 AC_DEFUN(AM_KDE_GNU_GETTEXT,
3439   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3440    AC_REQUIRE([AC_PROG_RANLIB])dnl
3441    AC_REQUIRE([AC_HEADER_STDC])dnl
3442    AC_REQUIRE([AC_C_INLINE])dnl
3443    AC_REQUIRE([AC_TYPE_OFF_T])dnl
3444    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
3445    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
3446    AC_REQUIRE([AC_FUNC_MMAP])dnl
3447    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
3448    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
3449 unistd.h values.h alloca.h])
3450    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
3451 __argz_count __argz_stringify __argz_next stpcpy])
3452
3453    AM_LC_MESSAGES
3454
3455    if test "x$CATOBJEXT" != "x"; then
3456      if test "x$ALL_LINGUAS" = "x"; then
3457        LINGUAS=
3458      else
3459        AC_MSG_CHECKING(for catalogs to be installed)
3460        NEW_LINGUAS=
3461        for lang in ${LINGUAS=$ALL_LINGUAS}; do
3462          case "$ALL_LINGUAS" in
3463           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
3464          esac
3465        done
3466        LINGUAS=$NEW_LINGUAS
3467        AC_MSG_RESULT($LINGUAS)
3468      fi
3469
3470      dnl Construct list of names of catalog files to be constructed.
3471      if test -n "$LINGUAS"; then
3472        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
3473      fi
3474    fi
3475
3476   ])
3477
3478 AC_DEFUN(AC_HAVE_XPM,
3479  [AC_REQUIRE_CPP()dnl
3480
3481  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
3482  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
3483
3484  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
3485         xpm_test=$withval, xpm_test="yes")
3486  if test "x$xpm_test" = xno; then
3487    ac_cv_have_xpm=no
3488  else
3489    AC_MSG_CHECKING(for XPM)
3490    AC_CACHE_VAL(ac_cv_have_xpm,
3491    [
3492     AC_LANG_C
3493     ac_save_ldflags="$LDFLAGS"
3494     ac_save_cflags="$CFLAGS"
3495     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
3496     CFLAGS="$CFLAGS $X_INCLUDES"
3497     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
3498     AC_TRY_LINK([#include <X11/xpm.h>],[],
3499         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
3500     LDFLAGS="$ac_save_ldflags"
3501     CFLAGS="$ac_save_cflags"
3502    ])dnl
3503  
3504   if test "$ac_cv_have_xpm" = no; then
3505     AC_MSG_RESULT(no)
3506     XPM_LDFLAGS=""
3507     XPMINC=""
3508     $2
3509   else
3510     AC_DEFINE(HAVE_XPM)
3511     if test "$XPM_LDFLAGS" = ""; then
3512        XPMLIB="-lXpm"
3513     else
3514        XPMLIB="-L$XPM_LDFLAGS -lXpm"
3515     fi
3516     if test "$XPM_INCLUDE" = ""; then
3517        XPMINC=""
3518     else
3519        XPMINC="-I$XPM_INCLUDE"
3520     fi
3521     AC_MSG_RESULT(yes)
3522     $1
3523   fi
3524  fi
3525  AC_SUBST(XPMINC)
3526  AC_SUBST(XPMLIB)
3527 ]) 
3528
3529 AC_DEFUN(AC_HAVE_GL,
3530  [AC_REQUIRE_CPP()dnl
3531
3532  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
3533  test -z "$GL_INCLUDE" && GL_INCLUDE=
3534
3535  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
3536         gl_test=$withval, gl_test="yes")
3537  if test "x$gl_test" = xno; then
3538    ac_cv_have_gl=no
3539  else
3540    AC_MSG_CHECKING(for GL)
3541    AC_CACHE_VAL(ac_cv_have_gl,
3542    [
3543     AC_LANG_C
3544     ac_save_ldflags="$LDFLAGS"
3545     ac_save_cflags="$CFLAGS"
3546     LDFLAGS="$LDFLAGS $GL_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
3547     CFLAGS="$CFLAGS $X_INCLUDES"
3548     test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3549     AC_TRY_LINK([],[],
3550         ac_cv_have_gl="yes",ac_cv_have_gl="no")
3551     LDFLAGS="$ac_save_ldflags"
3552     CFLAGS="$ac_save_cflags"
3553    ])dnl
3554  
3555   if test "$ac_cv_have_gl" = no; then
3556     AC_MSG_RESULT(no)
3557     GL_LDFLAGS=""
3558     GLINC=""
3559     $2
3560   else
3561     AC_DEFINE(HAVE_GL)
3562     if test "$GL_LDFLAGS" = ""; then
3563        GLLIB="-lMesaGL -lMesaGLU"
3564     else
3565        GLLIB="-L$GL_LDFLAGS -lMesaGL -lMesaGLU"
3566     fi
3567     if test "$GL_INCLUDE" = ""; then
3568        GLINC=""
3569     else
3570        GLINC="-I$GL_INCLUDE"
3571     fi
3572     AC_MSG_RESULT(yes)
3573     $1
3574   fi
3575  fi
3576  AC_SUBST(GLINC)
3577  AC_SUBST(GLLIB)
3578 ]) 
3579
3580  dnl PAM pam
3581  
3582  dnl Should test for PAM (Pluggable Authentication Modules)
3583  AC_DEFUN(AC_PATH_PAM_DIRECT,
3584  [
3585  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
3586  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
3587  
3588    for ac_dir in               \
3589                                \
3590      /usr/local/include        \
3591      /usr/include              \
3592      /usr/unsupported/include  \
3593      /opt/include              \
3594      /usr/pam/include          \
3595      /usr/local/pam/include    \
3596      /usr/lib/pam/include      \
3597                               \
3598      $extra_include            \
3599      ; \
3600    do
3601      if test -r "$ac_dir/$pam_direct_test_include"; then
3602        no_pam= ac_pam_includes=$ac_dir
3603        break
3604      fi
3605    done
3606  
3607  # First see if replacing the include by lib works.
3608  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
3609                            \
3610      /lib                  \
3611      /usr/lib              \
3612      /usr/local/lib        \
3613      /usr/unsupported/lib  \
3614      /lib/security         \
3615      /usr/security/lib     \
3616      $extra_lib            \
3617      ; \
3618  do
3619    for ac_extension in a so sl; do
3620      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
3621        no_pam= ac_pam_libraries=$ac_dir
3622        break 2
3623      fi
3624    done
3625  done
3626 ])
3627
3628 AC_DEFUN(AC_PATH_PAM,
3629  [AC_REQUIRE_CPP()dnl
3630
3631   AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"], [], [-lpam -ldl])
3632
3633  AC_MSG_CHECKING(for PAM)
3634  AC_ARG_WITH(pam, 
3635 [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
3636   [
3637     if test "x$withval" = "xyes"; then
3638       no_pam=
3639       default_pam=yes
3640     elif test "x$withval" = "xno"; then
3641       no_pam=yes
3642     else
3643       no_pam=
3644       pam_service="$withval"
3645         if test -z "$pam_service"; then
3646         default_pam=yes
3647         else
3648         default_pam=
3649         fi 
3650       fi
3651   ], no_pam=yes
3652  )
3653
3654  if test ! "$no_pam" = yes; then
3655
3656  AC_CACHE_VAL(ac_cv_path_pam,
3657  [
3658  ac_pam_includes=NONE
3659  ac_pam_libraries=NONE
3660  if test -z "$pam_libraries"; then
3661    pam_libraries=NONE
3662  fi
3663  if test -z "$pam_includes"; then
3664    pam_includes=NONE
3665  fi
3666
3667  AC_PATH_PAM_DIRECT
3668  
3669  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
3670  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
3671  
3672  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
3673    ac_pam_libs="-lpam $PAM_MISC_LIB -ldl"
3674    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
3675  else
3676    ac_cv_path_pam="no_pam=yes"
3677  fi
3678  ])
3679
3680  eval "$ac_cv_path_pam"
3681  
3682  fi
3683
3684  if test "$no_pam" = yes; then
3685    AC_MSG_RESULT(no)
3686  else
3687    AC_DEFINE(HAVE_PAM)
3688    PAMLIBS="$ac_pam_libs"
3689    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
3690    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
3691    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
3692  if test "$default_pam" = yes; then
3693    AC_MSG_RESULT(["default pam service name will be used"])
3694  else
3695    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service")
3696    AC_MSG_RESULT(["pam service name will be: " $pam_service])
3697  fi
3698 dnl test whether struct pam_message is const (Linux) or not (Sun)
3699    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
3700    AC_MSG_CHECKING(for const pam_message)
3701    AC_EGREP_HEADER([struct pam_message],
3702       $pam_appl_h,
3703       [ AC_EGREP_HEADER([const struct pam_message],
3704                         $pam_appl_h,
3705                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
3706                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
3707                         AC_DEFINE(PAM_MESSAGE_NONCONST)] 
3708                         )],
3709        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
3710        )
3711  fi
3712  
3713  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
3714      PAMLIBPATHS="-L$pam_libraries"
3715  fi
3716  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
3717      PAMINC="-I$pam_includes"
3718  fi
3719  
3720  AC_SUBST(PAMINC)
3721  AC_SUBST(PAMLIBS)
3722  AC_SUBST(PAMLIBPATHS)
3723
3724 ]) 
3725
3726 AC_DEFUN(KDE_CHECK_LIBDL,
3727 [
3728 AC_CHECK_LIB(dl, dlopen, [
3729 LIBDL="-ldl"
3730 ac_cv_have_dlfcn=yes
3731 ])
3732
3733 AC_CHECK_LIB(dld, shl_unload, [
3734 LIBDL="-ldld"
3735 ac_cv_have_shload=yes
3736 ])
3737
3738 AC_SUBST(LIBDL)
3739 ])
3740
3741 AC_DEFUN(KDE_CHECK_DLOPEN,
3742 [
3743 KDE_CHECK_LIBDL
3744 AC_CHECK_HEADERS(dlfcn.h dl.h)
3745 if test "$ac_cv_header_dlfcn_h" = "no"; then
3746   ac_cv_have_dlfcn=no
3747 fi
3748
3749 if test "$ac_cv_header_dl_h" = "no"; then
3750   ac_cv_have_shload=no
3751 fi
3752
3753 enable_dlopen=no
3754 AC_ARG_ENABLE(dlopen,
3755 [  --disable-dlopen        link staticly [default=no]] ,
3756 [if test "$enableval" = yes; then
3757   enable_dlopen=yes
3758 fi],
3759 enable_dlopen=yes)
3760
3761 # override the user's opinion, if we know it better ;)
3762 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
3763   enable_dlopen=no
3764 fi
3765
3766 if test "$ac_cv_have_dlfcn" = "yes"; then
3767   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
3768 fi
3769
3770 if test "$ac_cv_have_shload" = "yes"; then
3771   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
3772 fi
3773
3774 if test "$enable_dlopen" = no ; then
3775   test -n "$1" && eval $1
3776 else
3777   test -n "$2" && eval $2
3778 fi
3779
3780 ])
3781
3782 AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
3783 [
3784 KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
3785 KDE_PROG_LIBTOOL
3786 AC_MSG_CHECKING([dynamic loading])
3787 eval "`egrep '^build_libtool_libs=' libtool`"
3788 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
3789   dynamic_loading=yes
3790   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
3791 else
3792   dynamic_loading=no
3793 fi
3794 AC_MSG_RESULT($dynamic_loading)
3795 if test "$dynamic_loading" = "yes"; then
3796   $1
3797 else
3798   $2
3799 fi
3800 ])
3801
3802 AC_DEFUN(KDE_ADD_INCLUDES,
3803 [
3804 if test -z "$1"; then 
3805   test_include="Pix.h"
3806 else
3807   test_include="$1"
3808 fi
3809
3810 AC_MSG_CHECKING([for libg++ ($test_include)])
3811
3812 AC_CACHE_VAL(kde_cv_libgpp_includes,
3813 [
3814 kde_cv_libgpp_includes=no
3815
3816    for ac_dir in               \
3817                                \
3818      /usr/include/g++          \
3819      /usr/include              \
3820      /usr/unsupported/include  \
3821      /opt/include              \
3822      $extra_include            \
3823      ; \
3824    do
3825      if test -r "$ac_dir/$test_include"; then
3826        kde_cv_libgpp_includes=$ac_dir
3827        break
3828      fi
3829    done
3830 ])
3831
3832 AC_MSG_RESULT($kde_cv_libgpp_includes)
3833 if test "$kde_cv_libgpp_includes" != "no"; then
3834   all_includes="-I$kde_cv_libgpp_includes $all_includes"
3835 fi
3836 ])
3837 ])
3838
3839
3840 AC_DEFUN(KDE_CHECK_MICO,
3841 [
3842 AC_REQUIRE([KDE_CHECK_LIBDL])
3843 AC_MSG_CHECKING(for MICO)
3844 AC_ARG_WITH(micodir,
3845   [  --with-micodir=micodir  where mico is installed ],
3846   kde_micodir=$withval,
3847   kde_micodir=/usr/local
3848 )
3849 AC_MSG_RESULT($kde_micodir)
3850 if test ! -r  $kde_micodir/include/CORBA.h; then
3851   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
3852 fi
3853
3854 MICO_INCLUDES=-I$kde_micodir/include
3855 AC_SUBST(MICO_INCLUDES)
3856 MICO_LDFLAGS=-L$kde_micodir/lib
3857 AC_SUBST(MICO_LDFLAGS)
3858
3859 AC_MSG_CHECKING([for MICO version])
3860 AC_CACHE_VAL(kde_cv_mico_version,
3861 [
3862 AC_LANG_C
3863 cat >conftest.$ac_ext <<EOF
3864 #include <stdio.h>
3865 #include <mico/version.h>
3866 int main() { 
3867     
3868    printf("MICO_VERSION=%s\n",MICO_VERSION); 
3869    return (0); 
3870 }
3871 EOF
3872 ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
3873 if AC_TRY_EVAL(ac_compile); then
3874   if eval `./conftest 2>&5`; then
3875     kde_cv_mico_version=$MICO_VERSION
3876   else
3877     AC_MSG_ERROR([your system is not able to execute a small application to
3878     find MICO version! Check $kde_micodir/include/mico/version.h])
3879   fi 
3880 else
3881   AC_MSG_ERROR([your system is not able to compile a small application to
3882   find MICO version! Check $kde_micodir/include/mico/version.h])
3883 fi
3884 ])
3885
3886 dnl installed MICO version
3887 mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3888 mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3889 mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3890
3891 dnl required MICO version
3892 req_v_maj=`echo $1 | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3893 req_v_mid=`echo $1 | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3894 req_v_min=`echo $1 | sed -e 's/^.*\..*\.\(.*\)$/\1/'` 
3895
3896 if test "$mico_v_maj" -lt "$req_v_maj" || \
3897    ( test "$mico_v_maj" -eq "$req_v_maj" && \
3898         test "$mico_v_mid" -lt "$req_v_mid" ) || \
3899    ( test "$mico_v_mid" -eq "$req_v_mid" && \
3900         test "$mico_v_min" -lt "$req_v_min" )
3901
3902 then
3903   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $1 \
3904 at least is required. You should upgrade MICO.])
3905 else
3906   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $1, ok)])
3907 fi
3908
3909 LIBMICO="-lmico$kde_cv_mico_version $LIBDL"
3910 AC_SUBST(LIBMICO)
3911 IDL=$kde_micodir/bin/idl
3912 AC_SUBST(IDL)
3913 ])
3914
3915
3916 AC_DEFUN(KDE_CHECK_MINI_STL,
3917 [
3918 AC_REQUIRE([KDE_CHECK_MICO])
3919
3920 AC_MSG_CHECKING(if we use mico's mini-STL)
3921 AC_CACHE_VAL(kde_cv_have_mini_stl,
3922 [
3923 AC_LANG_CPLUSPLUS
3924 kde_save_cxxflags="$CXXFLAGS"
3925 CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
3926 AC_TRY_COMPILE(
3927 [
3928 #include <mico/config.h>
3929 ],
3930 [
3931 #ifdef HAVE_MINI_STL
3932 #error "nothing"
3933 #endif
3934 ],
3935 kde_cv_have_mini_stl=no,
3936 kde_cv_have_mini_stl=yes)
3937 CXXFLAGS="$kde_save_cxxflags"
3938 ])
3939
3940
3941 AC_MSG_RESULT($kde_cv_have_mini_stl)
3942 if test "$kde_cv_have_mini_stl" = "yes"; then
3943   AC_DEFINE_UNQUOTED(HAVE_MINI_STL)
3944 fi
3945 ])
3946
3947 ])
3948
3949
3950 AC_DEFUN(KDE_CHECK_LIBPTHREAD,
3951 [
3952 AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= )
3953 AC_SUBST(LIBPTHREAD)
3954 ])
3955
3956 AC_DEFUN(KDE_TRY_LINK_PYTHON,
3957 [
3958 AC_CACHE_VAL(kde_cv_try_link_python_$1,
3959 [
3960 kde_save_cxxflags="$CXXFLAGS"
3961 CXXFLAGS="$CXXFLAGS $PYTHONINC"
3962 kde_save_libs="$LIBS"
3963 LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
3964 kde_save_ldflags="$LDFLAGS"
3965 LDFLAGS="$LDFLAGS $PYTHONLIB"
3966
3967 AC_TRY_LINK(
3968 [
3969 #include <Python.h>
3970 ],[
3971         PySys_SetArgv(1, 0);
3972 ],
3973         [kde_cv_try_link_python_$1=yes],
3974         [kde_cv_try_link_python_$1=no]
3975 )
3976 CXXFLAGS="$kde_save_cxxflags"
3977 LIBS="$kde_save_libs"
3978 LDFLAGS="$kde_save_ldflags"
3979 ])
3980
3981 if test "$kde_cv_try_link_python_$1" = "yes"; then
3982   $3
3983 else
3984   $4
3985 fi
3986
3987 ])
3988
3989 AC_DEFUN(KDE_CHECK_PYTHON,
3990 [
3991 AC_REQUIRE([KDE_CHECK_LIBDL])
3992 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3993 if test -z "$1"; then 
3994   version="1.5"
3995 else
3996   version="$1"
3997 fi
3998
3999 AC_MSG_CHECKING([for Python$version])
4000
4001 AC_ARG_WITH(pythondir, 
4002 [  --with-pythondir=pythondir   use python installed in pythondir ],
4003 [
4004   ac_python_dir=$withval
4005 ], ac_python_dir=/usr/local
4006 )
4007
4008 python_incdirs="$ac_python_dir/include/python$version /usr/include/python$version /usr/local/include/python$version /usr/local/include"
4009 AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
4010 if test ! -r $python_incdir/Python.h; then
4011   AC_MSG_ERROR(Python.h not found.)
4012 fi
4013
4014 PYTHONINC=-I$python_incdir
4015
4016 python_libdirs="$ac_python_dir/lib/python$version/config /usr/lib/python$version/config /usr/local/python$version/config"
4017 AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
4018 if test ! -r $python_libdir/libpython$version.a; then
4019   AC_MSG_ERROR(libpython$version.a not found.)
4020 fi
4021
4022 PYTHONLIB=-L$python_libdir
4023 LIBPYTHON=-lpython$version
4024
4025 AC_MSG_RESULT(header $python_incdir library $python_libdir)
4026
4027 dnl Note: this test is very weak
4028 AC_MSG_CHECKING(if an Python application links)
4029 KDE_TRY_LINK_PYTHON(normal, "", AC_MSG_RESULT(yes),
4030  [
4031     AC_MSG_RESULT(no)
4032     AC_MSG_CHECKING(if Python depends on -lpthread)
4033     KDE_TRY_LINK_PYTHON(pthread, "$LIBPTHREAD",
4034     [  
4035        AC_MSG_RESULT(yes)
4036        LIBPYTHON="$LIBPYTHON $LIBPTHREAD $LIBDL"
4037     ],
4038     [
4039        AC_MSG_RESULT(no)
4040        AC_MSG_CHECKING(if Python depeds on -ltcl)
4041        KDE_TRY_LINK_PYTHON(tcl, "-ltcl",
4042        [
4043           AC_MSG_RESULT(yes)
4044           LIBPYTHON="$LIBPYTHON -ltcl"
4045        ],
4046        [
4047           AC_MSG_RESULT(no)
4048         AC_MSG_WARN([it seems, Python depends on another library. 
4049     Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this
4050     and contact the authors to let them know about this problem])
4051         ])
4052     ])
4053  ]) 
4054
4055 AC_SUBST(PYTHONINC)
4056 AC_SUBST(PYTHONLIB)
4057 AC_SUBST(LIBPYTHON)
4058
4059 ])
4060
4061
4062 AC_DEFUN(KDE_CHECK_STL_SGI,
4063 [
4064     AC_MSG_CHECKING([if STL implementation is SGI like])
4065     AC_CACHE_VAL(kde_cv_stl_type_sgi,
4066     [
4067       AC_TRY_COMPILE([
4068 #include <string>
4069 ],[
4070   string astring="Hallo Welt.";
4071   astring.erase(0, 6); // now astring is "Welt"
4072   return 0;
4073 ], kde_cv_stl_type_sgi=yes,
4074    kde_cv_stl_type_sgi=no)
4075 ])
4076
4077    AC_MSG_RESULT($kde_cv_stl_type_sgi)
4078
4079    if test "$kde_cv_stl_type_sgi" = "yes"; then
4080         AC_DEFINE_UNQUOTED(HAVE_SGI_STL) 
4081    fi
4082 ])
4083
4084 AC_DEFUN(KDE_CHECK_STL_HP,
4085 [
4086     AC_MSG_CHECKING([if STL implementation is HP like])
4087     AC_CACHE_VAL(kde_cv_stl_type_hp,
4088     [
4089       AC_TRY_COMPILE([
4090 #include <string>
4091 ],[
4092   string astring="Hello World";
4093   astring.remove(0, 6); // now astring is "World"
4094   return 0;
4095 ], kde_cv_stl_type_hp=yes,
4096    kde_cv_stl_type_hp=no)
4097 ])
4098    AC_MSG_RESULT($kde_cv_stl_type_hp)
4099
4100    if test "$kde_cv_stl_type_hp" = "yes"; then
4101         AC_DEFINE_UNQUOTED(HAVE_HP_STL) 
4102    fi
4103 ])
4104
4105 AC_DEFUN(KDE_CHECK_STL,
4106 [
4107     KDE_CHECK_STL_SGI
4108     
4109     if test "$kde_cv_stl_type_sgi" = "no"; then
4110        KDE_CHECK_STL_HP
4111
4112        if test "$kde_cv_stl_type_hp" = "no"; then
4113          AC_MSG_ERROR("no known STL type found")
4114        fi
4115     fi
4116
4117 ])
4118
4119 AC_DEFUN(AC_FIND_QIMGIO,
4120    [AC_REQUIRE([AC_FIND_JPEG])
4121 AC_MSG_CHECKING([for qimgio])
4122 AC_CACHE_VAL(ac_cv_lib_qimgio,
4123 [ac_save_LIBS="$LIBS"
4124 LIBS="$all_libraries -lqimgio -lpng -lz -lqt $LIBJPEG -lX11 $LIBSOCKET"
4125 AC_TRY_LINK(dnl
4126 [
4127 void qInitImageIO ();
4128 ],
4129             [qInitImageIO();],
4130             eval "ac_cv_lib_qimgio=yes",
4131             eval "ac_cv_lib_qimgio=no")
4132 LIBS="$ac_save_LIBS"
4133 ])dnl
4134 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
4135   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
4136   AC_MSG_RESULT(yes)
4137   AC_DEFINE_UNQUOTED(HAVE_QIMGIO)
4138   AC_SUBST(LIBQIMGIO)
4139 else
4140   AC_MSG_RESULT(not found)
4141 fi
4142 ])
4143
4144 AC_DEFUN(KDE_CHECK_ANSI,
4145 [
4146 AC_MSG_CHECKING([for strdup])
4147
4148     AC_CACHE_VAL(kde_cv_stl_type_sgi,
4149     [
4150 AC_LANG_CPLUSPLUS
4151 save_CXXFLAGS="$CXXFLAGS"
4152 if test "$GCC" = "yes"; then
4153   CXXFLAGS="$CXXFLAGS -pedantic-errors"
4154 fi
4155
4156 AC_TRY_COMPILE([
4157 #include <string.h>
4158 ],[
4159   char buffer[] = "Hallo";
4160   strdup(buffer)
4161 ], kde_cv_has_strdup=yes,
4162    kde_cv_has_strdup=no)
4163 CXXFLAGS="$save_CXXFLAGS"
4164 ])
4165 AC_MSG_RESULT($kde_cv_has_strdup)
4166
4167 if test "$kde_cv_has_strdup" = "yes"; then
4168   AC_DEFINE_UNQUOTED(HAVE_STRDUP)
4169 fi
4170
4171 ])
4172
4173 AC_DEFUN(KDE_CHECK_INSURE,
4174 [
4175   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
4176   [
4177   if test $enableval = "no"; dnl
4178         then ac_use_insure="no"
4179         else ac_use_insure="yes"
4180    fi
4181   ], [ac_use_insure="no"])
4182
4183   AC_MSG_CHECKING(if we will use Insure++ to debug)
4184   AC_MSG_RESULT($ac_use_insure)
4185   if test "$ac_use_insure" = "yes"; dnl
4186        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
4187    fi
4188 ])          
4189
4190 dnl this is for kdm:
4191
4192 AC_DEFUN(AC_CHECK_KDM,
4193 [
4194 AC_CHECK_FUNCS(getsecretkey)
4195 dnl checks for X server
4196
4197 AC_PATH_PROG(X_SERVER, X)
4198 if test ! -z "$X_SERVER"; then
4199 X_SERVER=`echo $X_SERVER | sed -e 's+/X$++'`
4200 AC_DEFINE_UNQUOTED(XBINDIR,$X_SERVER)
4201 XBINDIR=$X_SERVER
4202 AC_SUBST(XBINDIR)
4203 fi
4204
4205 dnl This one tries to find XDMDIR for config files
4206 AC_ARG_WITH(xdmdir,
4207         [  --with-xdmdir                  If the xdm config dir can't be found automaticly],
4208         [ ac_xdmdir=$withval],
4209         [ ac_xdmdir="no"])
4210
4211 AC_MSG_CHECKING([for xdm configuration dir])
4212 if test "$ac_xdmdir" = "no"; then
4213     rm -fr conftestdir
4214     if mkdir conftestdir; then
4215         cd conftestdir
4216     cat > Imakefile <<'EOF'
4217 acfindxdm:
4218         @echo 'ac_xdmdir="$(XDMDIR)";'
4219 EOF
4220         if (xmkmf) > /dev/null 2> /dev/null && test -f Makefile; then
4221             eval `${MAKE-make} acfindxdm 2>/dev/null 2>/dev/null | grep -v make`
4222         fi
4223         cd ..
4224         rm -fr conftestdir
4225         dnl Check if Imake was right
4226         if test -f $ac_xdmdir/xdm-config; then
4227             AC_MSG_RESULT($ac_xdmdir)
4228         else
4229             dnl Here we must do something else
4230             dnl Maybe look for xdm-config in standard places, and
4231             dnl if that fails use a fresh copy in $KDEDIR/config/kdm/
4232             AC_FIND_FILE(xdm-config,/etc/X11/xdm /var/X11/xdm /usr/openwin/xdm /usr/X11R6/lib/X11/xdm,ac_xdmdir)
4233             if test -f $ac_xdmdir/xdm-config; then
4234                 AC_MSG_RESULT($ac_xdmdir)
4235             else                                 
4236                 if test "${prefix}" = NONE; then
4237                         ac_xdmdir=$ac_default_prefix/config/kdm
4238                 else
4239                         ac_xdmdir=$prefix/config/kdm
4240                 fi
4241                 AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir])
4242                 xdmconfigsubdir=xdmconfig
4243                 AC_SUBST(xdmconfigsubdir)
4244             fi
4245         fi
4246     fi
4247 else
4248     if test -f $ac_xdmdir/xdm-config; then
4249         AC_MSG_RESULT($ac_xdmdir)
4250     else
4251
4252         AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir])
4253         xdmconfigsubdir=xdmconfig
4254         AC_SUBST(xdmconfigsubdir)
4255     fi
4256 fi
4257 AC_DEFINE_UNQUOTED(XDMDIR,"$ac_xdmdir")
4258 AC_SUBST(ac_xdmdir)
4259
4260 AC_PATH_PAM
4261 if test "x$no_pam" = "xyes"; then 
4262         pam_support="no"
4263 else
4264         pam_support="yes"
4265         shadow_support="no" # if pam is installed, use it. We can't savely 
4266                             # test, if it works *sigh*
4267 fi
4268
4269 AC_ARG_WITH(shadow,
4270         [  --with-shadow                  If you want shadow password support ],
4271         [ if test "$withval" = "yes"; then
4272              shadow_support="yes"
4273           else
4274              shadow_support="no"
4275           fi
4276           if test "$pam_support" = "yes" && test "$shadow_support=yes"; then
4277                 AC_MSG_WARN("You can not define both pam AND shadow")
4278           fi
4279         ],
4280         [ if test -z "$shadow_support"; then shadow_support="no"; fi ] )
4281
4282 if test "$pam_support" = "yes"; then
4283   AC_CHECK_LIB(pam, main, [PASSWDLIB="-lpam -ldl"
4284   AC_DEFINE_UNQUOTED(HAVE_PAM_LIB)],
4285   [],-ldl)
4286 fi
4287
4288 if test -z "$PASSWDLIB" && test "$shadow_support" = "yes"; then
4289   AC_CHECK_LIB(shadow, main,
4290     [ PASSWDLIB="-lshadow"
4291       AC_DEFINE_UNQUOTED(HAVE_SHADOW_LIB)
4292     ])
4293 fi
4294 AC_SUBST(PASSWDLIB)
4295 AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for FreeBSD
4296 AC_SUBST(LIBUTIL)
4297 AC_CHECK_LIB(s, main, [LIB_LIBS="-ls"]) dnl for AIX
4298 AC_SUBST(LIB_LIBS)
4299 AC_CHECK_LIB(Xdmcp, main, [LIBXDMCP="-lXdmcp"], , $X_LDFLAGS -lX11) dnl for Unixware
4300 AC_SUBST(LIBXDMCP)
4301
4302 if test -n "$LIBXDMCP"; then
4303   ac_cpp_safe=$ac_cpp
4304   ac_cpp='$CXXCPP $CPPFLAGS $X_INCLUDES'
4305   AC_CHECK_HEADERS(X11/Xdmcp.h)
4306   ac_cpp=$ac_cpp_safe
4307 fi
4308
4309 ])