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