Fixed installation directory of mini-icon.
[kdbg.git] / acinclude.m4
blobd8247c783f6e41c9206aed677f8af34b4e9440aa
1 ##   -*- shell-script -*-
3 dnl    This file is part of the KDE libraries/packages
4 dnl    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
5 dnl              (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
7 dnl    This file is free software; you can redistribute it and/or
8 dnl    modify it under the terms of the GNU Library General Public
9 dnl    License as published by the Free Software Foundation; either
10 dnl    version 2 of the License, or (at your option) any later version.
12 dnl    This library is distributed in the hope that it will be useful,
13 dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 dnl    Library General Public License for more details.
17 dnl    You should have received a copy of the GNU Library General Public License
18 dnl    along with this library; see the file COPYING.LIB.  If not, write to
19 dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 dnl    Boston, MA 02111-1307, USA.        
22 dnl IMPORTANT NOTE:
23 dnl Please do not modify this file unless you expect your modifications to be
24 dnl carried into every other module in the repository. If you decide that you
25 dnl really want to modify it, contact coolo@kde.org mentioning that you have
26 dnl and that the modified file should be committed to every module.
27 dnl
28 dnl Single-module modifications are best placed in configure.in for kdelibs
29 dnl and kdebase or configure.in.in if present.
32 dnl ------------------------------------------------------------------------
33 dnl Find a file (or one of more files in a list of dirs)
34 dnl ------------------------------------------------------------------------
35 dnl
36 AC_DEFUN(AC_FIND_FILE,
38 $3=NO
39 for i in $2;
41   for j in $1;
42   do
43     if test -r "$i/$j"; then
44       $3=$i
45       break 2
46     fi
47   done
48 done
51 AC_DEFUN(KDE_FIND_PATH,
53    AC_MSG_CHECKING([for $1])
54    AC_CACHE_VAL(kde_cv_path_$1,
55    [
56      kde_cv_path_$1="NONE"
57      if test -n "$$2"; then
58         kde_cv_path_$1="$$2";
59      else
60         dirs="$3"
61         kde_save_IFS=$IFS
62         IFS=':'
63         for dir in $PATH; do
64           dirs="$dirs $dir"
65         done
66         IFS=$kde_save_IFS
68         for dir in $dirs; do
69           if test -x "$dir/$1"; then
70             if test -n "$5"
71             then
72               evalstr="$dir/$1 $5 2>&1 "
73               if eval $evalstr; then
74                 kde_cv_path_$1="$dir/$1"
75                 break
76               fi
77             else
78                 kde_cv_path_$1="$dir/$1"
79                 break
80             fi
81           fi
82         done
84      fi
85          
86    ])
88    if test -z "$kde_cv_path_$1" || test "$kde_cv_path_$1" = "NONE"; then
89       AC_MSG_RESULT(not found)
90       $4
91    else 
92      AC_MSG_RESULT($kde_cv_path_$1)
93      $2=$kde_cv_path_$1
94    fi
97 AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
99     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
100 Please check whether you installed Qt correctly. 
101 You need to have a running moc binary.
102 configure tried to run $ac_cv_path_moc and the test didn't
103 succeed. If configure shouldn't have tried this one, set
104 the environment variable MOC to the right one before running
105 configure.
109 dnl ------------------------------------------------------------------------
110 dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some
111 dnl more usual places
112 dnl ------------------------------------------------------------------------
114 AC_DEFUN(AC_PATH_QT_MOC,
116    KDE_FIND_PATH(moc, MOC, [$ac_qt_bindir $QTDIR/bin $QTDIR/src/moc \
117             /usr/bin /usr/X11R6/bin /usr/lib/qt/bin \
118             /usr/local/qt/bin], [KDE_MOC_ERROR_MESSAGE])
120    if test -z "$MOC"; then
121      if test -n "$ac_cv_path_moc"; then
122        output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"`
123      fi
124      echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC
125      echo "configure:__oline__: moc output: $output" >&AC_FD_CC
127      if test -z "$output"; then
128        KDE_MOC_ERROR_MESSAGE
129     fi
130    fi
131    
132    AC_SUBST(MOC)
135 AC_DEFUN(KDE_CHECK_PATH_HEADERS,
137     AC_MSG_CHECKING([for KDE headers installed])
138     AC_LANG_CPLUSPLUS
139 cat > conftest.$ac_ext <<EOF
140 #include <stdio.h>
141 #include "confdefs.h"
142 #include <kapp.h>
144 int main() {
145     printf("kde_qt_used_ver=\"" QT_VERSION_STR "\"\n");
146     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
147     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
148     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
149     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
150     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
151     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
152     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
153     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
154     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
155     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
156     printf("kde_wallpaperdir=\\"%s\\"\n", 
157         KApplication::kde_wallpaperdir().data());
158     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
159     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
160     return 0;
161     }
164 ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
165 if AC_TRY_EVAL(ac_compile); then
166   AC_MSG_RESULT(yes)
167 else
168   AC_MSG_ERROR([your system is not able to compile a small KDE application!
169 Check, if you installed the KDE header files correctly.])
173 AC_DEFUN(AC_CREATE_KFSSTND,
175 AC_REQUIRE([AC_CHECK_RPATH])
176 AC_REQUIRE([AC_CHECK_BOOL])
177 AC_REQUIRE([KDE_CHECK_LIBDL])
179 AC_MSG_CHECKING([for KDE paths])
180 kde_result=""
182 AC_CACHE_VAL(kde_cv_all_paths,
184 if test "$1" = "default"; then
186   if test -z "$kde_htmldir"; then
187     kde_htmldir='\$(prefix)/share/doc/HTML'
188   fi
189   if test -z "$kde_appsdir"; then
190     kde_appsdir='\$(prefix)/share/applnk'
191   fi
192   if test -z "$kde_icondir"; then
193     kde_icondir='\$(prefix)/share/icons'
194   fi
195   if test -z "$kde_sounddir"; then
196     kde_sounddir='\$(prefix)/share/sounds'
197   fi
198   if test -z "$kde_datadir"; then
199     kde_datadir='\$(prefix)/share/apps'
200   fi
201   if test -z "$kde_locale"; then
202     kde_locale='\$(prefix)/share/locale'
203   fi
204   if test -z "$kde_cgidir"; then
205     kde_cgidir='\$(exec_prefix)/cgi-bin'
206   fi
207   if test -z "$kde_confdir"; then
208     kde_confdir='\$(prefix)/share/config'
209   fi
210   if test -z "$kde_mimedir"; then
211     kde_mimedir='\$(prefix)/share/mimelnk'
212   fi
213   if test -z "$kde_toolbardir"; then
214     kde_toolbardir='\$(prefix)/share/toolbar'
215   fi
216   if test -z "$kde_wallpaperdir"; then
217     kde_wallpaperdir='\$(prefix)/share/wallpapers'
218   fi
219   if test -z "$kde_bindir"; then
220     kde_bindir='\$(exec_prefix)/bin'
221   fi
222   if test -z "$kde_partsdir"; then
223     kde_partsdir='\$(exec_prefix)/parts'
224   fi
226   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
227         kde_htmldir=\"$kde_htmldir\" \
228         kde_appsdir=\"$kde_appsdir\" \
229         kde_icondir=\"$kde_icondir\" \
230         kde_sounddir=\"$kde_sounddir\" \
231         kde_datadir=\"$kde_datadir\" \
232         kde_locale=\"$kde_locale\" \
233         kde_cgidir=\"$kde_cgidir\" \
234         kde_confdir=\"$kde_confdir\" \
235         kde_mimedir=\"$kde_mimedir\" \
236         kde_toolbardir=\"$kde_toolbardir\" \
237         kde_wallpaperdir=\"$kde_wallpaperdir\" \
238         kde_bindir=\"$kde_bindir\" \
239         kde_partsdir=\"$kde_partsdir\" \
240         kde_result=defaults"
242 else 
244 AC_MSG_RESULT([compiling])
246 KDE_CHECK_PATH_HEADERS
248 KDE_TEST_RPATH=
250 if test -n "$USE_RPATH"; then
252   if test -n "$kde_libraries"; then
253     KDE_TEST_RPATH="-rpath $kde_libraries"
254   fi
256   if test -n "$qt_libraries"; then
257     KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries"
258   fi
260   if test -n "$x_libraries"; then
261     KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries"
262   fi
264   KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
267 AC_MSG_CHECKING([for KDE libraries installed])
268 ac_link='/bin/sh ./libtool --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBDL $LIBQT $KDE_TEST_RPATH 1>&5'
270 if AC_TRY_EVAL(ac_link) && test -s conftest; then 
271   AC_MSG_RESULT(yes)
272 else
273   AC_MSG_ERROR([your system fails at linking a small KDE application!
274 Check, if your compiler is installed correctly and if you have used the
275 same compiler to compile Qt and kdelibs as you did use now])
278 if eval `KDEDIR= ./conftest 2>&5`; then
279   kde_result=done
280 else
281   kde_result=problems
284 KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
285 echo "found Qt $kde_qt_used_ver" >&5 # also log Qt version
286 kde_have_all_paths=yes
287 AC_LANG_CPLUSPLUS
289 if test "$kde_have_all_paths" = "yes"; then
290 kde_cv_all_paths="kde_have_all_paths=\"yes\" \
291         kde_htmldir=\"$kde_htmldir\" \
292         kde_appsdir=\"$kde_appsdir\" \
293         kde_icondir=\"$kde_icondir\" \
294         kde_sounddir=\"$kde_sounddir\" \
295         kde_datadir=\"$kde_datadir\" \
296         kde_locale=\"$kde_locale\" \
297         kde_cgidir=\"$kde_cgidir\" \
298         kde_confdir=\"$kde_confdir\" \
299         kde_mimedir=\"$kde_mimedir\" \
300         kde_toolbardir=\"$kde_toolbardir\" \
301         kde_wallpaperdir=\"$kde_wallpaperdir\" \
302         kde_bindir=\"$kde_bindir\" \
303         kde_partsdir=\"$kde_partsdir\" \
304         kde_result=$kde_result"
310 eval "$kde_cv_all_paths"
312 if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
313    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
314    test -z "$kde_datadir" || test -z "$kde_locale"  ||
315    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
316    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
317    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
318    test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then
319   kde_have_all_paths=no
320   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
321 Since it had compiled and linked before, it must be a strange problem on your system.
322 Look at config.log for details. If you are not able to fix this, look at
323 http://www.kde.org/faq/installation.html or any www.kde.org mirror.
324 (If you're using an egcs version on Linux, you may update binutils!)
326 else
327   rm -f conftest*
328   AC_MSG_RESULT($kde_result)
331 bindir=$kde_bindir
335 AC_DEFUN(AC_SUBST_KFSSTND,
337 AC_SUBST(kde_htmldir)
338 AC_SUBST(kde_appsdir)
339 AC_SUBST(kde_icondir)
340 AC_SUBST(kde_sounddir)
341 kde_minidir="$kde_icondir/mini"
342 AC_SUBST(kde_minidir)
343 AC_SUBST(kde_datadir)
344 AC_SUBST(kde_locale)
345 AC_SUBST(kde_cgidir)
346 AC_SUBST(kde_confdir)
347 AC_SUBST(kde_mimedir)
348 AC_SUBST(kde_toolbardir)
349 AC_SUBST(kde_wallpaperdir)
350 AC_SUBST(kde_bindir)
351 AC_SUBST(kde_partsdir)
354 AC_DEFUN(KDE_MISC_TESTS,
356    AC_LANG_C
357    dnl Checks for libraries. 
358    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
359    AC_SUBST(LIBCOMPAT)
360    AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD
361    AC_SUBST(LIBCRYPT)
362    AC_CHECK_KSIZE_T
363    AC_LANG_C
364    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
365    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
366       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
367         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
368    fi
369    AC_CHECK_FUNC(inet_ntoa)
370    if test $ac_cv_func_inet_ntoa = no; then
371      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
372    fi
373    AC_CHECK_FUNC(connect)
374    if test $ac_cv_func_connect = no; then
375       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
376         $X_EXTRA_LIBS)
377    fi
379    AC_CHECK_FUNC(remove)
380    if test $ac_cv_func_remove = no; then
381       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
382    fi
384    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
385    AC_CHECK_FUNC(shmat)
386    if test $ac_cv_func_shmat = no; then
387      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
388    fi
390    LIBSOCKET="$X_EXTRA_LIBS"
391    AC_SUBST(LIBSOCKET)
392    AC_SUBST(X_EXTRA_LIBS)
393    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
394    AC_SUBST(LIBUCB)
396    case $host in  dnl this *is* LynxOS specific
397    *-*-lynxos* )
398         AC_MSG_CHECKING([LynxOS header file wrappers])
399         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
400         AC_MSG_RESULT(disabled)
401         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
402          ;;
403     esac
405    AC_REQUIRE([KDE_CHECK_LIBDL])
408 dnl ------------------------------------------------------------------------
409 dnl Find the header files and libraries for X-Windows. Extended the 
410 dnl macro AC_PATH_X
411 dnl ------------------------------------------------------------------------
413 AC_DEFUN(K_PATH_X,
415 AC_REQUIRE([AC_PROG_CPP])
416 AC_MSG_CHECKING(for X)
417 AC_LANG_SAVE
418 AC_LANG_C
419 AC_CACHE_VAL(ac_cv_have_x,
420 [# One or both of the vars are not set, and there is no cached value.
421 if test "{$x_includes+set}" = set; then
422    ac_x_includes=NO
424 if test "{$x_libraries+set}" = set; then
425    ac_x_libraries=NO
427 AC_PATH_X_DIRECT
428 AC_PATH_X_XMKMF
429 if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
430   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
431 else
432   # Record where we found X for the cache.
433   ac_cv_have_x="have_x=yes \
434                 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
435 fi])dnl
436 eval "$ac_cv_have_x"
438 if test "$have_x" != yes; then
439   AC_MSG_RESULT($have_x)
440   no_x=yes
441 else
442   # If each of the values was on the command line, it overrides each guess.
443   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
444   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
445   # Update the cache value to reflect the command line values.
446   ac_cv_have_x="have_x=yes \
447                 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
448   AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
451 if test -z "$x_includes" || test "x$x_includes" = xNONE; then
452   X_INCLUDES=""
453   x_includes="."; dnl better than nothing :-
454  else
455   X_INCLUDES="-I$x_includes"
458 if test -z "$x_libraries" || test "x$x_libraries" = xNONE; then
459   X_LDFLAGS=""
460   x_libraries="/usr/lib"; dnl better than nothing :-
461  else
462   X_LDFLAGS="-L$x_libraries"
464 all_includes="$all_includes $X_INCLUDES"  
465 all_libraries="$all_libraries $X_LDFLAGS"  
467 AC_SUBST(X_INCLUDES)
468 AC_SUBST(X_LDFLAGS)
469 AC_SUBST(x_libraries)
470 AC_SUBST(x_includes)
472 LIB_X11='-lX11 $(LIBSOCKET)'
473 AC_SUBST(LIB_X11)
475 AC_MSG_CHECKING(for libXext)
476 AC_CACHE_VAL(kde_cv_have_libXext,
478 kde_ldflags_safe="$LDFLAGS"
479 kde_libs_safe="$LIBS"
481 LDFLAGS="$X_LDFLAGS $USER_LDFLAGS"
482 LIBS="-lXext -lX11 $LIBSOCKET"
484 AC_TRY_LINK([
485 #include <stdio.h>
488 printf("hello Xext\n");
490 kde_cv_have_libXext=yes,
491 kde_cv_have_libXext=no
492    )
494 LDFLAGS=$kde_ldflags_safe
495 LIBS=$kde_libs_safe
496  ])
498 AC_MSG_RESULT($kde_cv_have_libXext)
500 if test "kde_cv_have_libXext" = "no"; then
501   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
502 can't find it itself, we stop here assuming that make wouldn't find
503 them either.])
508 AC_LANG_RESTORE
511 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
513 AC_REQUIRE([KDE_USE_QT])
516 AC_LANG_CPLUSPLUS
517 cat > conftest.$ac_ext <<EOF
518 #include "confdefs.h"
519 #include <qglobal.h>
520 #include <qapplication.h>
521 #include <qobjcoll.h>
523 echo "#if ! ($1)" >> conftest.$ac_ext
524 cat >> conftest.$ac_ext <<EOF
525 #error 1
526 #endif
528 int main() {
529     return 0;
534 AC_DEFUN(KDE_USE_QT,
536 if test -z "$1"; then
537   kde_qtver=2
538 else
539   kde_qtver="$1"
542 if test -z "$2"; then
543   if test $kde_qtver = 2; then
544     kde_qt_minversion=">= 2.0"
545    else
546     kde_qt_minversion=">= 1.42 and < 2.0"
547   fi
548 else
549    kde_qt_minversion="$2"
552 if test -z "$3"; then
553     if test $kde_qtver = 2; then
554     kde_qt_verstring="QT_VERSION >= 200"
555    else
556     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
557   fi
558 else
559    kde_qt_verstring="$3"
563 AC_DEFUN(KDE_CHECK_QT_DIRECT,
565 AC_REQUIRE([KDE_USE_QT])
566 AC_MSG_CHECKING([if Qt compiles without flags])
567 AC_CACHE_VAL(kde_cv_qt_direct,
569 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
570 ac_LIBRARY_PATH="$LIBRARY_PATH"
571 ac_cxxflags_safe="$CXXFLAGS"
572 ac_ldflags_safe="$LDFLAGS"
573 ac_libs_safe="$LIBS"
575 CXXFLAGS="$CXXFLAGS -I$qt_includes"
576 LDFLAGS="$X_LDFLAGS"
577 LIBS="-lqt -lXext -lX11 $LIBSOCKET"
578 LD_LIBRARY_PATH=
579 export LD_LIBRARY_PATH
580 LIBRARY_PATH=
581 export LIBRARY_PATH
583 KDE_PRINT_QT_PROGRAM($kde_qt_verstring)
585 if AC_TRY_EVAL(ac_link) && test -s conftest; then
586   kde_cv_qt_direct="yes"
587 else
588   kde_cv_qt_direct="no"
589   echo "configure: failed program was:" >&AC_FD_CC
590   cat conftest.$ac_ext >&AC_FD_CC
592 rm -f conftest*
593 CXXFLAGS="$ac_cxxflags_safe"
594 LDFLAGS="$ac_ldflags_safe"
595 LIBS="$ac_libs_safe"
597 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
598 export LD_LIBRARY_PATH
599 LIBRARY_PATH="$ac_LIBRARY_PATH"
600 export LIBRARY_PATH
603 if test "$kde_cv_qt_direct" = "yes"; then
604   AC_MSG_RESULT(yes)
605   $1
606 else
607   AC_MSG_RESULT(no)
608   $2
612 dnl ------------------------------------------------------------------------
613 dnl Try to find the Qt headers and libraries.
614 dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
615 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
616 dnl ------------------------------------------------------------------------
618 AC_DEFUN(AC_PATH_QT_1_3,
620 AC_REQUIRE([K_PATH_X])
621 AC_REQUIRE([KDE_USE_QT])
622 LIBQT="-lqt"
623 if test $kde_qtver = 2; then
624   
625   AC_REQUIRE([AC_FIND_PNG])
626   LIBQT="$LIBQT $LIBPNG"
628 AC_MSG_CHECKING([for Qt])
630 LIBQT="$LIBQT -lXext -lX11 $LIBSOCKET"
631 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
632 qt_libraries=""
633 qt_includes=""
634 AC_ARG_WITH(qt-dir,
635     [  --with-qt-dir=DIR       where the root of Qt is installed ],
636     [  ac_qt_includes="$withval"/include
637        ac_qt_libraries="$withval"/lib
638        ac_qt_bindir="$withval"/bin
639     ])
641 AC_ARG_WITH(qt-includes,
642     [  --with-qt-includes=DIR  where the Qt includes are. ],
643     [  
644        ac_qt_includes="$withval"
645     ])
646     
647 kde_qt_libs_given=no
649 AC_ARG_WITH(qt-libraries,
650     [  --with-qt-libraries=DIR where the Qt library is installed.],
651     [  ac_qt_libraries="$withval"
652        kde_qt_libs_given=yes
653     ])
655 AC_CACHE_VAL(ac_cv_have_qt,
656 [#try to guess Qt locations
658 qt_incdirs="$QTINC /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes"
659 test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
660 qt_incdirs="$ac_qt_includes $qt_incdirs"
661 AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
662 ac_qt_includes="$qt_incdir"
664 qt_libdirs="$QTLIB /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries"
665 test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
666 if test ! "$ac_qt_libraries" = "NO"; then
667   qt_libdirs="$ac_qt_libraries $qt_libdirs"
670 test=NONE
671 qt_libdir=NONE
672 for dir in $qt_libdirs; do
673   try="ls -1 $dir/libqt*"
674   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
675 done
677 ac_qt_libraries="$qt_libdir"
679 ac_cxxflags_safe="$CXXFLAGS"
680 ac_ldflags_safe="$LDFLAGS"
681 ac_libs_safe="$LIBS"
683 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
684 LDFLAGS="-L$qt_libdir $all_libraries"
685 LIBS="$LIBS $LIBQT"
687 KDE_PRINT_QT_PROGRAM($kde_qt_verstring)
689 if AC_TRY_EVAL(ac_link) && test -s conftest; then
690   rm -f conftest*
691 else
692   echo "configure: failed program was:" >&AC_FD_CC
693   cat conftest.$ac_ext >&AC_FD_CC
694   ac_qt_libraries="NO"
696 rm -f conftest*
697 CXXFLAGS="$ac_cxxflags_safe"
698 LDFLAGS="$ac_ldflags_safe"
699 LIBS="$ac_libs_safe"
701 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
702   ac_cv_have_qt="have_qt=no"
703   ac_qt_notfound=""
704   if test "$ac_qt_includes" = NO; then
705     if test "$ac_qt_libraries" = NO; then
706       ac_qt_notfound="(headers and libraries)";
707     else
708       ac_qt_notfound="(headers)";
709     fi
710   else
711     ac_qt_notfound="(libraries)";
712   fi
714   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! ]);
715 else
716   have_qt="yes"
720 eval "$ac_cv_have_qt"
722 if test "$have_qt" != yes; then
723   AC_MSG_RESULT([$have_qt]);
724 else
725   ac_cv_have_qt="have_qt=yes \
726     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
727   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
728   
729   qt_libraries="$ac_qt_libraries"
730   qt_includes="$ac_qt_includes"
733 if test ! "$kde_qt_libs_given" = "yes"; then
734 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
737 AC_SUBST(qt_libraries)
738 AC_SUBST(qt_includes)
740 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
741  QT_INCLUDES="";
742 else
743  QT_INCLUDES="-I$qt_includes"
744  all_includes="$QT_INCLUDES $all_includes"
747 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
748  QT_LDFLAGS=""
749 else
750  QT_LDFLAGS="-L$qt_libraries"
751  all_libraries="$QT_LDFLAGS $all_libraries"
754 AC_SUBST(QT_INCLUDES)
755 AC_SUBST(QT_LDFLAGS)
756 AC_PATH_QT_MOC
758 LIB_QT='-lqt $(LIBPNG) $(LIB_X11)'
759 AC_SUBST(LIB_QT)
763 AC_DEFUN(AC_PATH_QT,
765 AC_PATH_QT_1_3
768 dnl ------------------------------------------------------------------------
769 dnl Now, the same with KDE
770 dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
771 dnl and $(kde_includes) will be the kdehdrlocation (if needed)
772 dnl ------------------------------------------------------------------------
774 AC_DEFUN(AC_BASE_PATH_KDE,
776 AC_PREREQ([2.13])
777 AC_REQUIRE([KDE_MISC_TESTS])
778 AC_REQUIRE([AC_PATH_QT])dnl
779 AC_MSG_CHECKING([for KDE])
781 if test "${prefix}" != NONE; then
782   kde_includes=${prefix}/include
783   ac_kde_includes=$prefix/include
785   if test "${exec_prefix}" != NONE; then
786     kde_libraries=${exec_prefix}/lib
787     ac_kde_libraries=$exec_prefix/lib
788   else
789     kde_libraries=${prefix}/lib
790     ac_kde_libraries=$prefix/lib
791   fi
792 else
793   ac_kde_includes=
794   ac_kde_libraries=
795   kde_libraries=""
796   kde_includes=""
799 AC_CACHE_VAL(ac_cv_have_kde,
800 [#try to guess kde locations
802 if test -z "$1"; then
804 kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes"
805 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
806 kde_incdirs="$ac_kde_includes $kde_incdirs"
807 AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
808 ac_kde_includes="$kde_incdir"
810 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
811   AC_MSG_ERROR([
812 in the prefix, you've chosen, are no KDE headers installed. This will fail.
813 So, check this please and use another prefix!])
816 kde_libdirs="/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"
817 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
818 kde_libdirs="$ac_kde_libraries $kde_libdirs"
819 AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
820 ac_kde_libraries="$kde_libdir"
822 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
823 AC_MSG_ERROR([
824 in the prefix, you've chosen, are no KDE libraries installed. This will fail.
825 So, check this please and use another prefix!])
827 ac_kde_libraries="$kde_libdir"
829 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
830   ac_cv_have_kde="have_kde=no"
831 else
832   ac_cv_have_kde="have_kde=yes \
833     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
836 else dnl test -z $1 
837   
838   ac_cv_have_kde="have_kde=no"
841 ])dnl
843 eval "$ac_cv_have_kde"
845 if test "$have_kde" != "yes"; then
846  if test "${prefix}" = NONE; then
847   ac_kde_prefix="$ac_default_prefix"
848  else
849   ac_kde_prefix="$prefix"
850  fi
851  if test "$exec_prefix" = NONE; then
852   ac_kde_exec_prefix="$ac_kde_prefix"
853   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
854  else
855   ac_kde_exec_prefix="$exec_prefix"
856   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
857  fi
859  kde_libraries="${ac_kde_exec_prefix}/lib"
860  kde_includes=${ac_kde_prefix}/include
862 else
863   ac_cv_have_kde="have_kde=yes \
864     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
865   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
866   
867   kde_libraries="$ac_kde_libraries"
868   kde_includes="$ac_kde_includes"
870 AC_SUBST(kde_libraries)
871 AC_SUBST(kde_includes)
873 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
874  KDE_INCLUDES=""
875 else
876  KDE_INCLUDES="-I$kde_includes"
877  all_includes="$KDE_INCLUDES $all_includes"
880 if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
881  KDE_LDFLAGS=""
882 else
883  KDE_LDFLAGS="-L$kde_libraries"
884  all_libraries="$KDE_LDFLAGS $all_libraries"
887 AC_SUBST(KDE_LDFLAGS)
888 AC_SUBST(KDE_INCLUDES)
890 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
892 AC_SUBST(all_includes)
893 AC_SUBST(all_libraries)
897 AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
899 AC_MSG_CHECKING(for extra includes)
900 AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
901                           adds non standard include paths], 
902   kde_use_extra_includes="$withval",
903   kde_use_extra_includes=NONE
905 if test -n "$kde_use_extra_includes" && \
906    test "$kde_use_extra_includes" != "NONE"; then
908    ac_save_ifs=$IFS
909    IFS=':'
910    for dir in $kde_use_extra_includes; do
911      all_includes="$all_includes -I$dir"
912      USER_INCLUDES="$USER_INCLUDES -I$dir"
913    done
914    IFS=$ac_save_ifs
915    kde_use_extra_includes="added"
916 else
917    kde_use_extra_includes="no"
919 AC_SUBST(USER_INCLUDES)
921 AC_MSG_RESULT($kde_use_extra_includes)
923 AC_MSG_CHECKING(for extra libs)
924 AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths], 
925   kde_use_extra_libs=$withval,
926   kde_use_extra_libs=NONE
928 if test -n "$kde_use_extra_libs" && \
929    test "$kde_use_extra_libs" != "NONE"; then
931    ac_save_ifs=$IFS
932    IFS=':'
933    for dir in $kde_use_extra_libs; do
934      all_libraries="$all_libraries -L$dir"
935      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
936      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
937    done
938    IFS=$ac_save_ifs
939    kde_use_extra_libs="added"
940 else
941    kde_use_extra_libs="no"
944 AC_SUBST(USER_LDFLAGS)
946 AC_MSG_RESULT($kde_use_extra_libs)
950 AC_DEFUN(KDE_CHECK_KIMGIO,
952    AC_REQUIRE([AC_BASE_PATH_KDE])
953    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
954    AC_REQUIRE([AC_FIND_TIFF])
955    AC_REQUIRE([AC_FIND_JPEG]) 
956    AC_REQUIRE([AC_FIND_PNG]) 
957    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
958    
959    if test "$1" = "existance"; then
960      AC_LANG_SAVE
961      AC_LANG_CPLUSPLUS
962      kde_save_LIBS="$LIBS"
963      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
964      AC_CHECK_LIB(kimgio, kimgioRegister, [
965       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
966       LIBS="$kde_save_LIBS"
967       AC_LANG_RESTORE   
968    else
969       LIBKIMGIO_EXISTS=yes
970    fi
972    if test "$LIBKIMGIO_EXISTS" = "yes"; then
973      LIB_KIMGIO='-lkimgio $(LIBJPEG) $(LIBTIFF) $(LIBPNG) $(LIB_QT) -lm'
974      LIB_KHTMLW='-lkhtmlw $(LIB_KIMGIO) -ljscript'
975    else
976      LIB_KIMGIO=''
977      LIB_KHTMLW='-lkhtmlw $(LIBJPEG) -ljscript $(LIB_QT)'
978    fi
979    AC_SUBST(LIB_KIMGIO)
980    
981    AC_SUBST(LIB_KHTMLW)
982    LIB_KHTML='-lkhtml $(LIB_KIMGIO) -ljscript'
983    AC_SUBST(LIB_KHTML)
986 AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
988    AC_REQUIRE([KDE_MISC_TESTS])
989    AC_REQUIRE([KDE_CHECK_LIBDL])
990    AC_REQUIRE([K_PATH_X])
992    dnl Check for KDE version (derived from Qt version)
993    if test "`echo $kde_qt_used_ver | sed -e 's/\..*//'`" = "2"; then
994       LIB_KIO_LINK='-lkio'
995       LIB_KDEUTIL='-lkdeutil'
996    else
997       LIB_KIO_LINK='-lkfm'
998       LIB_KDEUTIL=''
999    fi
1001    LIB_KDECORE='-lkdecore -lXext $(LIB_QT) $(LIBDL)'
1002    AC_SUBST(LIB_KDECORE)
1003    LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
1004    AC_SUBST(LIB_KDEUI)
1005    LIB_KFORMULA='-lformula $(LIB_QT)'
1006    AC_SUBST(LIB_KFORMULA)
1007    LIB_KFM='-lkfm $(LIB_KDECORE)'
1008    AC_SUBST(LIB_KFM)
1009    AC_SUBST(LIB_KDEUTIL)
1010    LIB_KIO="$LIB_KIO_LINK"' $(LIB_KDEUI) $(LIB_KDEUTIL)'
1011    AC_SUBST(LIB_KIO)
1012    LIB_KFILE='-lkfile $(LIB_KIO)'
1013    AC_SUBST(LIB_KFILE)
1014    LIB_KAB='-lkab $(LIB_KFM) $(LIB_KIMGIO)'
1015    AC_SUBST(LIB_KAB)
1016    LIB_MEDIATOOL='-lmediatool $(LIB_KDECORE)'
1017    AC_SUBST(LIB_MEDIATOOL) 
1020 AC_DEFUN(AC_PATH_KDE,
1022   AC_BASE_PATH_KDE
1023   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
1024   [
1025   if test "$enableval" = "no"; 
1026     then ac_use_path_checking="default"
1027     else ac_use_path_checking=""
1028   fi
1029   ], [ac_use_path_checking=""]
1030   )
1032   AC_CREATE_KFSSTND($ac_use_path_checking)
1034   AC_SUBST_KFSSTND
1035   KDE_CREATE_LIBS_ALIASES
1038 dnl slightly changed version of AC_CHECK_FUNC(setenv)
1039 AC_DEFUN(AC_CHECK_SETENV,
1040 [AC_MSG_CHECKING([for setenv])
1041 AC_CACHE_VAL(ac_cv_func_setenv,
1042 [AC_LANG_C
1043 AC_TRY_LINK(
1044 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
1045 dnl which includes <sys/select.h> which contains a prototype for
1046 dnl select.  Similarly for bzero.
1047 [#include <assert.h>
1048 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
1049 extern "C"
1050 #endif
1051 ])dnl
1052 [/* We use char because int might match the return type of a gcc2
1053     builtin and then its argument prototype would still apply.  */
1054 #include <stdlib.h>
1055 ], [
1056 /* The GNU C library defines this for functions which it implements
1057     to always fail with ENOSYS.  Some functions are actually named
1058     something starting with __ and the normal name is an alias.  */
1059 #if defined (__stub_$1) || defined (__stub___$1)
1060 choke me
1061 #else
1062 setenv("TEST", "alle", 1);
1063 #endif
1064 ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
1066 if test "$ac_cv_func_setenv" = "yes"; then
1067   AC_MSG_RESULT(yes)
1068   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV)
1069 else
1070   AC_MSG_RESULT(no)
1074 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
1076 AC_LANG_CPLUSPLUS
1077 save_CXXFLAGS="$CXXFLAGS"
1078 if test "$GCC" = "yes"; then
1079 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1081 AC_MSG_CHECKING(for getdomainname)
1082 AC_CACHE_VAL(ac_cv_func_getdomainname,
1084 AC_TRY_COMPILE([
1085 #include <stdlib.h>
1086 #include <unistd.h>
1089 char buffer[200];
1090 getdomainname(buffer, 200);
1092 ac_cv_func_getdomainname=yes,
1093 ac_cv_func_getdomainname=no)
1095 AC_MSG_RESULT($ac_cv_func_getdomainname)
1096 if eval "test \"`echo `$ac_cv_func_getdomainname\" = yes"; then
1097   AC_DEFINE(HAVE_GETDOMAINNAME)
1099 CXXFLAGS="$save_CXXFLAGS"
1102 AC_DEFUN(AC_CHECK_GETHOSTNAME,
1104 AC_LANG_CPLUSPLUS
1105 save_CXXFLAGS="$CXXFLAGS"
1106 if test "$GCC" = "yes"; then
1107 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1110 AC_MSG_CHECKING([for gethostname])
1111 AC_CACHE_VAL(ac_cv_func_gethostname,
1113 AC_TRY_COMPILE([
1114 #include <stdlib.h>
1115 #include <unistd.h>
1118 char buffer[200];
1119 gethostname(buffer, 200);
1121 ac_cv_func_gethostname=yes,
1122 ac_cv_func_gethostname=no)
1124 AC_MSG_RESULT($ac_cv_func_gethostname)
1125 if eval "test \"`echo `$ac_cv_func_gethostname\" = yes"; then
1126   AC_DEFINE(HAVE_GETHOSTNAME)
1128 CXXFLAGS="$save_CXXFLAGS"
1131 AC_DEFUN(AC_CHECK_USLEEP,
1133 AC_LANG_CPLUSPLUS
1135 AC_MSG_CHECKING([for usleep])
1136 AC_CACHE_VAL(ac_cv_func_usleep,
1138 ac_libs_safe="$LIBS"
1139 LIBS="$LIBS $LIBUCB"
1140 AC_TRY_LINK([
1141 #include <stdlib.h>
1142 #include <unistd.h>
1145 usleep(200);
1147 ac_cv_func_usleep=yes,
1148 ac_cv_func_usleep=no)
1150 AC_MSG_RESULT($ac_cv_func_usleep)
1151 if eval "test \"`echo `$ac_cv_func_usleep\" = yes"; then
1152   AC_DEFINE(HAVE_USLEEP)
1154 LIBS="$ac_libs_safe"
1157 AC_DEFUN(AC_CHECK_RANDOM,
1159 AC_LANG_CPLUSPLUS
1161 AC_MSG_CHECKING([for random])
1162 AC_CACHE_VAL(ac_cv_func_random,
1164 ac_libs_safe="$LIBS"
1165 LIBS="$LIBS $LIBUCB"
1166 AC_TRY_LINK([
1167 #include <stdlib.h>
1170 random();
1172 ac_cv_func_random=yes,
1173 ac_cv_func_random=no)
1175 AC_MSG_RESULT($ac_cv_func_random)
1176 if eval "test \"`echo `$ac_cv_func_random\" = yes"; then
1177   AC_DEFINE(HAVE_RANDOM)
1179 LIBS="$ac_libs_safe"
1182 AC_DEFUN(AC_FIND_GIF,
1183    [AC_MSG_CHECKING([for giflib])
1184 AC_CACHE_VAL(ac_cv_lib_gif,
1185 [ac_save_LIBS="$LIBS"
1186 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
1187 AC_TRY_LINK(dnl
1189 #ifdef __cplusplus
1190 extern "C" {
1191 #endif
1192 int GifLastError(void);
1193 #ifdef __cplusplus
1195 #endif
1196 /* We use char because int might match the return type of a gcc2
1197     builtin and then its argument prototype would still apply.  */
1199             [return GifLastError();],
1200             eval "ac_cv_lib_gif=yes",
1201             eval "ac_cv_lib_gif=no")
1202 LIBS="$ac_save_LIBS"
1203 ])dnl
1204 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1205   AC_MSG_RESULT(yes)
1206   AC_DEFINE_UNQUOTED(HAVE_LIBGIF)
1207 else
1208   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
1212 AC_DEFUN(KDE_FIND_JPEG_HELPER,
1214 AC_MSG_CHECKING([for libjpeg$2])
1215 AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
1217 ac_save_LIBS="$LIBS"
1218 LIBS="$all_libraries -ljpeg$2 -lm"
1219 AC_TRY_LINK(
1220 [/* Override any gcc2 internal prototype to avoid an error.  */
1221 struct jpeg_decompress_struct;
1222 typedef struct jpeg_decompress_struct * j_decompress_ptr;
1223 typedef int size_t;
1224 #ifdef __cplusplus
1225 extern "C" {
1226 #endif
1227     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1228                                     int version, size_t structsize);
1229 #ifdef __cplusplus
1231 #endif
1232 /* We use char because int might match the return type of a gcc2
1233     builtin and then its argument prototype would still apply.  */
1235             [jpeg_CreateDecompress(0L, 0, 0);],
1236             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
1237             eval "ac_cv_lib_jpeg_$1=no")
1238 LIBS="$ac_save_LIBS"
1241 if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
1242   LIBJPEG="$ac_cv_lib_jpeg_$1"
1243   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
1244 else
1245   AC_MSG_RESULT(no)
1246   $3
1251 AC_DEFUN(AC_FIND_JPEG,
1253 KDE_FIND_JPEG_HELPER(6b, 6b,
1254    KDE_FIND_JPEG_HELPER(normal, [],
1255     [
1256 dnl what to do, if the normal way fails:
1257         if test -f "$kde_libraries/libjpeg.so"; then
1258            test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
1259            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1260         else if test -f "$kde_libraries/libjpeg.sl"; then
1261            test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
1262            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"      
1263         else if test -f "$kde_libraries/libjpeg.a"; then
1264            test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
1265            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1266         else
1267           AC_MSG_ERROR([
1268 You need jpeglib6b. Please install the kdesupport package.
1269 If you have already installed kdesupport you may have an
1270 old libjpeg somewhere. 
1271 In this case copy $KDEDIR/lib/libjpeg* to /usr/lib.
1273         fi
1274       fi
1275    fi
1277    LIBJPEG=$ac_cv_lib_jpeg
1280 AC_SUBST(LIBJPEG)
1281 AC_DEFINE_UNQUOTED(HAVE_LIBJPEG)
1285 AC_DEFUN(AC_FIND_ZLIB,
1287 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1288 AC_MSG_CHECKING([for libz])
1289 AC_CACHE_VAL(ac_cv_lib_z,
1291 AC_LANG_C
1292 kde_save_LIBS="$LIBS"
1293 LIBS="$all_libraries -lz $LIBSOCKET"
1294 kde_save_CFLAGS="$CFLAGS"
1295 CFLAGS="$CFLAGS $all_includes"
1296 AC_TRY_LINK(dnl
1298 #include<zlib.h>
1300             [return (zlibVersion() == ZLIB_VERSION); ],
1301             eval "ac_cv_lib_z='-lz'",
1302             eval "ac_cv_lib_z=no")
1303 LIBS="$kde_save_LIBS"
1304 CFLAGS="$kde_save_CFLAGS"
1305 ])dnl
1306 if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
1307   AC_DEFINE_UNQUOTED(HAVE_LIBZ)
1308   LIBZ="$ac_cv_lib_z"
1309   AC_SUBST(LIBZ)
1310   AC_MSG_RESULT($ac_cv_lib_z)
1311 else
1312   AC_MSG_RESULT(no)
1313   LIBZ=""
1314   AC_SUBST(LIBZ)
1318 AC_DEFUN(KDE_TRY_TIFFLIB,
1320 AC_MSG_CHECKING([for libtiff $1])
1322 AC_CACHE_VAL(kde_cv_libtiff_$1, 
1324 AC_LANG_C
1325 kde_save_LIBS="$LIBS"
1326 LIBS="$all_libraries -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
1327 kde_save_CFLAGS="$CFLAGS"
1328 CFLAGS="$CFLAGS $all_includes"
1330 AC_TRY_LINK(dnl
1332 #include<tiffio.h>
1334     [return (TIFFOpen( "", "r") == 0); ],
1336     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
1337 ], [
1338     kde_cv_libtiff_$1=no
1341 LIBS="$kde_save_LIBS"
1342 CFLAGS="$kde_save_CFLAGS"
1346 if test "$kde_cv_libtiff_$1" = "no"; then
1347     AC_MSG_RESULT(no)
1348     LIBTIFF=""
1349     $3
1350 else
1351     LIBTIFF="$kde_cv_libtiff_$1"
1352     AC_MSG_RESULT(yes)
1353     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF)
1354     $2
1359 AC_DEFUN(AC_FIND_TIFF,
1361 AC_REQUIRE([K_PATH_X])
1362 AC_REQUIRE([AC_FIND_ZLIB])
1363 AC_REQUIRE([AC_FIND_JPEG])
1364 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1366 KDE_TRY_TIFFLIB(tiff, [],
1367    KDE_TRY_TIFFLIB(tiff34))
1369 AC_SUBST(LIBTIFF)
1373 AC_DEFUN(AC_FIND_PNG,
1375 AC_REQUIRE([AC_FIND_ZLIB])
1376 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1377 AC_MSG_CHECKING([for libpng])
1378 AC_CACHE_VAL(ac_cv_lib_png,
1380 kde_save_LIBS="$LIBS"
1381 LIBS="$LIBS $all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
1382 kde_save_CFLAGS="$CFLAGS"
1383 CFLAGS="$CFLAGS $all_includes"
1384 AC_LANG_C
1385 AC_TRY_LINK(dnl
1386     [
1387     #include<png.h>
1388     ],
1389     [
1390     png_structp png_ptr = png_create_read_struct(  /* image ptr */
1391                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1392     return( png_ptr != 0 ); 
1393     ],
1394     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
1395     eval "ac_cv_lib_png=no"
1397 LIBS="$kde_save_LIBS"
1398 CFLAGS="$kde_save_CFLAGS"
1399 ])dnl
1400 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
1401   AC_DEFINE_UNQUOTED(HAVE_LIBPNG)
1402   LIBPNG="$ac_cv_lib_png"
1403   AC_SUBST(LIBPNG)
1404   AC_MSG_RESULT($ac_cv_lib_png)
1405 else
1406   AC_MSG_RESULT(no)
1407   LIBPNG=""
1408   AC_SUBST(LIBPNG)
1412 AC_DEFUN(AC_CHECK_BOOL,
1414         AC_MSG_CHECKING([for bool])
1415         AC_CACHE_VAL(ac_cv_have_bool,
1416         [
1417                 AC_LANG_CPLUSPLUS
1418                 AC_TRY_COMPILE([],
1419                  [bool aBool = true;],
1420                  [ac_cv_have_bool="yes"],
1421                  [ac_cv_have_bool="no"])
1422         ]) dnl end AC_CHECK_VAL
1423         AC_MSG_RESULT($ac_cv_have_bool)
1424         if test "$ac_cv_have_bool" = "yes"; then
1425                 AC_DEFINE(HAVE_BOOL) 
1426         fi 
1429 AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
1431 AC_MSG_CHECKING(if you need GNU extensions)
1432 AC_CACHE_VAL(ac_cv_gnu_extensions,
1434 cat > conftest.c << EOF
1435 #include <features.h>
1437 #ifdef __GNU_LIBRARY__
1439 #endif
1442 if (eval "$ac_cpp conftest.c") 2>&5 |
1443   egrep "yes" >/dev/null 2>&1; then
1444   rm -rf conftest*
1445   ac_cv_gnu_extensions=yes
1446 else
1447   ac_cv_gnu_extensions=no
1451 AC_MSG_RESULT($ac_cv_gnu_extensions)
1452 if test "$ac_cv_gnu_extensions" = "yes"; then
1453   AC_DEFINE_UNQUOTED(_GNU_SOURCE)
1457 AC_DEFUN(AC_CHECK_COMPILERS,
1459   dnl this is somehow a fat lie, but prevents other macros from double checking
1460   AC_PROVIDE([AC_PROG_CC])
1461   AC_PROVIDE([AC_PROG_CPP])
1462   AC_ARG_ENABLE(debug,[  --enable-debug          creates debugging code [default=no]],
1463   [ 
1464    if test $enableval = "no"; dnl 
1465      then ac_use_debug_code="no"
1466      else ac_use_debug_code="yes"
1467    fi
1468   ], [ac_use_debug_code="no"])
1470   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
1471    [ 
1472     if test $enableval = "no"; then 
1473          ac_use_strict_options="no"
1474        else 
1475          ac_use_strict_options="yes"
1476     fi
1477    ], [ac_use_strict_options="no"])
1479 dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
1480   AC_MSG_CHECKING(for a C-Compiler)
1481   dnl if there is one, print out. if not, don't matter
1482   AC_MSG_RESULT($CC) 
1484   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
1485   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
1486   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
1487   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
1489   AC_PROG_CC_WORKS
1490   AC_PROG_CC_GNU
1492   if test $ac_cv_prog_gcc = yes; then
1493     GCC=yes
1494   else
1495     GCC=
1496   fi
1498   if test -z "$CFLAGS"; then
1499     if test "$ac_use_debug_code" = "yes"; then
1500       AC_PROG_CC_G
1501       if test $ac_cv_prog_cc_g = yes; then
1502         CFLAGS="-g"
1503       fi
1504     else
1505       if test "$GCC" = "yes"; then
1506         CFLAGS="-O2"
1507       else
1508         CFLAGS=""
1509       fi
1510     fi
1512     if test "$GCC" = "yes"; then
1513      CFLAGS="$CFLAGS -Wall"
1515      if test "$ac_use_strict_options" = "yes"; then
1516         CFLAGS="$CFLAGS -W -ansi -pedantic"     
1517      fi
1518     fi
1520   fi
1522   case "$host" in 
1523   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
1524   esac
1526   if test -z "$LDFLAGS" && test "$ac_use_debug_code" = "no" && test "$GCC" = "yes"; then
1527      LDFLAGS="-s"
1528   fi
1531 dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
1532 dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
1534   AC_MSG_CHECKING(how to run the C preprocessor)
1535   # On Suns, sometimes $CPP names a directory.
1536   if test -n "$CPP" && test -d "$CPP"; then
1537     CPP=
1538   fi
1539   if test -z "$CPP"; then
1540   AC_CACHE_VAL(ac_cv_prog_CPP,
1541   [  # This must be in double quotes, not single quotes, because CPP may get
1542     # substituted into the Makefile and "${CC-cc}" will confuse make.
1543     CPP="${CC-cc} -E"
1544     # On the NeXT, cc -E runs the code through the compiler's parser,
1545     # not just through cpp.
1546     dnl Use a header file that comes with gcc, so configuring glibc    
1547     dnl with a fresh cross-compiler works.
1548     AC_TRY_CPP([#include <assert.h>
1549     Syntax Error], ,
1550     CPP="${CC-cc} -E -traditional-cpp"
1551     AC_TRY_CPP([#include <assert.h>
1552     Syntax Error], , CPP=/lib/cpp))
1553     ac_cv_prog_CPP="$CPP"])dnl
1554     CPP="$ac_cv_prog_CPP"
1555   else
1556     ac_cv_prog_CPP="$CPP"
1557   fi
1558   AC_MSG_RESULT($CPP)
1559   AC_SUBST(CPP)dnl
1562   AC_MSG_CHECKING(for a C++-Compiler)
1563   dnl if there is one, print out. if not, don't matter
1564   AC_MSG_RESULT($CXX) 
1566   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
1567   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
1568   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
1569   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
1570   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
1572   AC_PROG_CXX_WORKS
1573   AC_PROG_CXX_GNU
1575   if test $ac_cv_prog_gxx = yes; then
1576     GXX=yes
1577   else
1578     AC_MSG_CHECKING(whether we are using SPARC CC)
1579     GXX=
1580     cat > conftest.C << EOF
1581 #ifdef __SUNPRO_CC
1582    yes;
1583 #endif
1586     ac_try="$CXX -E conftest.C"
1587     if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
1588       ac_cv_prog_CC=yes
1589     else
1590       ac_cv_prog_CC=no
1591     fi
1592     AC_MSG_RESULT($ac_cv_prog_CC)
1593     if test "$ac_cv_prog_CC" = "yes"; then
1594       AC_MSG_ERROR([Sparc CC doesn't work on KDE sources at least til version
1595 4.2. This compiler has several problems accepting legal C++ code 
1596 including the builtin C++ type bool. Since KDE is a freeware project,
1597 we decided, that we don't want to support that broken compilers. 
1599 If you really want to see support for Sparc CC within KDE, make reasonable
1600 patches and join the KDE project. More information about KDE can be found
1601 on www.kde.org])
1602     fi
1603   fi
1605   if test -z "$CXXFLAGS"; then 
1606     if test "$ac_use_debug_code" = "yes"; then
1607       AC_PROG_CXX_G
1608       if test $ac_cv_prog_cxx_g = yes; then
1609         CXXFLAGS="-g"
1610       fi
1611       if test "$ac_cv_prog_CC" = "yes"; then
1612         CXXFLAGS="$CXXFLAGS -pto"
1613       fi
1614     else
1615       if test "$GXX" = "yes"; then
1616          CXXFLAGS="-O2"
1617       else
1618          if test "$ac_cv_prog_CC" = "yes"; then
1619             CXXFLAGS="-pto -O2"
1620          else
1621             CXXFLAGS=""
1622          fi
1623       fi
1624     fi
1626     if test "$GXX" = "yes"; then
1627        CXXFLAGS="$CXXFLAGS -Wall"
1629        if test "$ac_use_strict_options" = "yes"; then
1630         CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional  -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast  -Wsynth"
1631        fi
1633        if test "$kde_very_strict" = "yes"; then
1634          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion"
1635        fi
1636     fi
1637   fi  
1639     case "$host" in
1640       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
1641     esac    
1642   
1643     AC_PROVIDE(AC_PROG_CXXCPP)
1645     AC_MSG_CHECKING(how to run the C++ preprocessor)
1646     if test -z "$CXXCPP"; then
1647       AC_CACHE_VAL(ac_cv_prog_CXXCPP,
1648       [
1649          AC_LANG_SAVE[]dnl
1650          AC_LANG_CPLUSPLUS[]dnl
1651          CXXCPP="${CXX-g++} -E"
1652          AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
1653          ac_cv_prog_CXXCPP="$CXXCPP"
1654          AC_LANG_RESTORE[]dnl
1655      ])dnl
1656      CXXCPP="$ac_cv_prog_CXXCPP"
1657      fi
1658     AC_MSG_RESULT($CXXCPP)
1659     AC_SUBST(CXXCPP)dnl
1660     
1663 dnl just a wrapper to clean up configure.in
1664 AC_DEFUN(KDE_PROG_LIBTOOL,
1666 AC_REQUIRE([AC_ENABLE_SHARED])
1667 AC_REQUIRE([AC_ENABLE_STATIC])
1668 dnl libtool is only for C, so I must force him
1669 dnl to find the correct flags for C++
1670 kde_save_cc=$CC
1671 kde_save_cflags="$CFLAGS"
1672 CC=$CXX
1673 CFLAGS="$CXXFLAGS"
1674 AM_PROG_LIBTOOL dnl for libraries
1675 LIBTOOL="$LIBTOOL --silent"
1676 AC_SUBST(LIBTOOL)
1677 CC=$kde_save_cc
1678 CFLAGS="$kde_save_cflags"
1681 AC_DEFUN(KDE_DO_IT_ALL,
1683 AC_CANONICAL_SYSTEM 
1684 AC_ARG_PROGRAM 
1685 AM_INIT_AUTOMAKE($1, $2)
1686 AM_DISABLE_LIBRARIES
1687 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
1688 AC_CHECK_COMPILERS
1689 KDE_PROG_LIBTOOL
1690 AM_KDE_WITH_NLS
1691 AC_PATH_KDE
1694 AC_DEFUN(AC_CHECK_RPATH,
1696 AC_MSG_CHECKING(for rpath)
1697 AC_ARG_ENABLE(rpath,
1698       [  --disable-rpath         do not use the rpath feature of ld],
1699       USE_RPATH=$enableval, USE_RPATH=yes)
1701 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
1703   KDE_RPATH="-rpath \$(kde_libraries)"
1705   if test -n "$qt_libraries"; then
1706     KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)"
1707   fi
1708   dnl $x_libraries is set to /usr/lib in case
1709   if test -n "$X_LDFLAGS"; then 
1710     KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)"
1711   fi
1712   if test -n "$KDE_EXTRA_RPATH"; then
1713     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
1714   fi
1715 fi 
1716 AC_SUBST(KDE_EXTRA_RPATH)
1717 AC_SUBST(KDE_RPATH)
1718 AC_MSG_RESULT($USE_RPATH)
1721 dnl Check for the type of the third argument of getsockname
1722 AC_DEFUN(AC_CHECK_KSIZE_T,
1723 [AC_MSG_CHECKING(for the third argument of getsockname)  
1724 AC_LANG_CPLUSPLUS
1725 AC_CACHE_VAL(ac_cv_ksize_t,
1726 [AC_TRY_COMPILE([
1727 #include <sys/types.h>
1728 #include <sys/socket.h>
1730 socklen_t a=0; 
1731 getsockname(0,(struct sockaddr*)0, &a);
1733 ac_cv_ksize_t=socklen_t,
1734 ac_cv_ksize_t=)
1735 if test -z "$ac_cv_ksize_t"; then
1736 ac_safe_cxxflags="$CXXFLAGS"
1737 if test "$GCC" = "yes"; then
1738   CXXFLAGS="-Werror $CXXFLAGS"
1740 AC_TRY_COMPILE([
1741 #include <sys/types.h>
1742 #include <sys/socket.h>
1744 int a=0; 
1745 getsockname(0,(struct sockaddr*)0, &a);
1747 ac_cv_ksize_t=int,
1748 ac_cv_ksize_t=size_t)
1749 CXXFLAGS="$ac_safe_cxxflags"
1753 if test -z "$ac_cv_ksize_t"; then
1754   ac_cv_ksize_t=int
1757 AC_MSG_RESULT($ac_cv_ksize_t)
1758 AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t)
1762 dnl This is a merge of some macros out of the gettext aclocal.m4
1763 dnl since we don't need anything, I took the things we need
1764 dnl the copyright for them is:
1765 dnl >
1766 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
1767 dnl This Makefile.in is free software; the Free Software Foundation
1768 dnl gives unlimited permission to copy and/or distribute it,
1769 dnl with or without modifications, as long as this notice is preserved.
1771 dnl This program is distributed in the hope that it will be useful,
1772 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1773 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1774 dnl PARTICULAR PURPOSE.
1775 dnl >
1776 dnl for this file it is relicensed under LGPL
1778 AC_DEFUN(AM_KDE_WITH_NLS,
1779   [AC_MSG_CHECKING([whether NLS is requested])
1780     AC_LANG_CPLUSPLUS
1781     dnl Default is enabled NLS
1782     AC_ARG_ENABLE(nls,
1783       [  --disable-nls           do not use Native Language Support],
1784       USE_NLS=$enableval, USE_NLS=yes)
1785     AC_MSG_RESULT($USE_NLS)
1786     AC_SUBST(USE_NLS)
1788     dnl If we use NLS figure out what method
1789     if test "$USE_NLS" = "yes"; then
1790       AC_DEFINE(ENABLE_NLS)
1792       AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, 
1793          [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
1794       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1796       if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
1797         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
1798         GMSGFMT=":"
1799       fi
1800       MSGFMT=$GMSGFMT
1801       AC_SUBST(GMSGFMT)
1802       AC_SUBST(MSGFMT)
1804       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
1805         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1807       dnl Test whether we really found GNU xgettext.
1808       if test "$XGETTEXT" != ":"; then
1809         dnl If it is no GNU xgettext we define it as : so that the
1810         dnl Makefiles still can work.
1811         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1812           : ;
1813         else
1814           AC_MSG_RESULT(
1815             [found xgettext programs is not GNU xgettext; ignore it])
1816           XGETTEXT=":"
1817         fi
1818       fi
1819      AC_SUBST(XGETTEXT)
1820     fi
1822   ])
1824 # Search path for a program which passes the given test.
1825 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1827 # serial 1
1828 # Stephan Kulow: I appended a _KDE against name conflicts
1830 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
1831 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1832 AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
1833 [# Extract the first word of "$2", so it can be a program name with args.
1834 set dummy $2; ac_word=[$]2
1835 AC_MSG_CHECKING([for $ac_word])
1836 AC_CACHE_VAL(ac_cv_path_$1,
1837 [case "[$]$1" in
1838   /*)
1839   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1840   ;;
1841   *)
1842   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1843   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1844     test -z "$ac_dir" && ac_dir=.
1845     if test -f $ac_dir/$ac_word; then
1846       if [$3]; then
1847         ac_cv_path_$1="$ac_dir/$ac_word"
1848         break
1849       fi
1850     fi
1851   done
1852   IFS="$ac_save_ifs"
1853 dnl If no 4th arg is given, leave the cache variable unset,
1854 dnl so AC_PATH_PROGS will keep looking.
1855 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1856 ])dnl
1857   ;;
1858 esac])dnl
1859 $1="$ac_cv_path_$1"
1860 if test -n "[$]$1"; then
1861   AC_MSG_RESULT([$]$1)
1862 else
1863   AC_MSG_RESULT(no)
1865 AC_SUBST($1)dnl
1869 # Check whether LC_MESSAGES is available in <locale.h>.
1870 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1872 # serial 1
1874 AC_DEFUN(AM_LC_MESSAGES,
1875   [if test $ac_cv_header_locale_h = yes; then
1876     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1877       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1878        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1879     if test $am_cv_val_LC_MESSAGES = yes; then
1880       AC_DEFINE(HAVE_LC_MESSAGES)
1881     fi
1882   fi])
1884 dnl From Jim Meyering.
1885 dnl FIXME: migrate into libit.
1887 AC_DEFUN(AM_FUNC_OBSTACK,
1888 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
1889  [AC_TRY_LINK([#include "obstack.h"],
1890               [struct obstack *mem;obstack_free(mem,(char *) 0)],
1891               am_cv_func_obstack=yes,
1892               am_cv_func_obstack=no)])
1893  if test $am_cv_func_obstack = yes; then
1894    AC_DEFINE(HAVE_OBSTACK)
1895  else
1896    LIBOBJS="$LIBOBJS obstack.o"
1897  fi
1900 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
1901 dnl FIXME: Migrate into libit
1903 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
1904 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1905  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1906               am_cv_lib_error_at_line=yes,
1907               am_cv_lib_error_at_line=no)])
1908  if test $am_cv_lib_error_at_line = no; then
1909    LIBOBJS="$LIBOBJS error.o"
1910  fi
1911  AC_SUBST(LIBOBJS)dnl
1914 # Macro to add for using GNU gettext.
1915 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1917 # serial 1
1918 # Stephan Kulow: I put a KDE in it to avoid name conflicts
1920 AC_DEFUN(AM_KDE_GNU_GETTEXT,
1921   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1922    AC_REQUIRE([AC_PROG_RANLIB])dnl
1923    AC_REQUIRE([AC_HEADER_STDC])dnl
1924    AC_REQUIRE([AC_C_INLINE])dnl
1925    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1926    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1927    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1928    AC_REQUIRE([AC_FUNC_MMAP])dnl
1929    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
1930    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1931 unistd.h values.h alloca.h])
1932    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1933 __argz_count __argz_stringify __argz_next stpcpy])
1935    AM_LC_MESSAGES
1937    if test "x$CATOBJEXT" != "x"; then
1938      if test "x$ALL_LINGUAS" = "x"; then
1939        LINGUAS=
1940      else
1941        AC_MSG_CHECKING(for catalogs to be installed)
1942        NEW_LINGUAS=
1943        for lang in ${LINGUAS=$ALL_LINGUAS}; do
1944          case "$ALL_LINGUAS" in
1945           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1946          esac
1947        done
1948        LINGUAS=$NEW_LINGUAS
1949        AC_MSG_RESULT($LINGUAS)
1950      fi
1952      dnl Construct list of names of catalog files to be constructed.
1953      if test -n "$LINGUAS"; then
1954        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1955      fi
1956    fi
1958   ])
1960 AC_DEFUN(AC_HAVE_XPM,
1961  [AC_REQUIRE_CPP()dnl
1962   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1964  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
1965  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
1967  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
1968         xpm_test=$withval, xpm_test="yes")
1969  if test "x$xpm_test" = xno; then
1970    ac_cv_have_xpm=no
1971  else
1972    AC_MSG_CHECKING(for XPM)
1973    AC_CACHE_VAL(ac_cv_have_xpm,
1974    [
1975     AC_LANG_C
1976     ac_save_ldflags="$LDFLAGS"
1977     ac_save_cflags="$CFLAGS"
1978     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
1979     CFLAGS="$CFLAGS $X_INCLUDES"
1980     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
1981     AC_TRY_LINK([#include <X11/xpm.h>],[],
1982         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
1983     LDFLAGS="$ac_save_ldflags"
1984     CFLAGS="$ac_save_cflags"
1985    ])dnl
1987   if test "$ac_cv_have_xpm" = no; then
1988     AC_MSG_RESULT(no)
1989     XPM_LDFLAGS=""
1990     XPMINC=""
1991     $2
1992   else
1993     AC_DEFINE(HAVE_XPM)
1994     if test "$XPM_LDFLAGS" = ""; then
1995        XPMLIB="-lXpm"
1996     else
1997        XPMLIB="-L$XPM_LDFLAGS -lXpm"
1998     fi
1999     if test "$XPM_INCLUDE" = ""; then
2000        XPMINC=""
2001     else
2002        XPMINC="-I$XPM_INCLUDE"
2003     fi
2004     AC_MSG_RESULT(yes)
2005     $1
2006   fi
2007  fi
2008  AC_SUBST(XPMINC)
2009  AC_SUBST(XPMLIB)
2010 ]) 
2012 AC_DEFUN(AC_HAVE_GL,
2013  [AC_REQUIRE_CPP()dnl
2014   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2016  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
2017  test -z "$GL_INCLUDE" && GL_INCLUDE=
2019  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
2020         gl_test=$withval, gl_test="yes")
2021  if test "x$gl_test" = xno; then
2022    ac_cv_have_gl=no
2023  else
2024    AC_MSG_CHECKING(for GL)
2025    AC_CACHE_VAL(ac_cv_have_gl,
2026    [
2027     AC_LANG_C
2028     ac_save_ldflags="$LDFLAGS"
2029     ac_save_cflags="$CFLAGS"
2030     LDFLAGS="$LDFLAGS $GL_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
2031     CFLAGS="$CFLAGS $X_INCLUDES"
2032     test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
2033     AC_TRY_LINK([],[],
2034         ac_cv_have_gl="yes",ac_cv_have_gl="no")
2035     LDFLAGS="$ac_save_ldflags"
2036     CFLAGS="$ac_save_cflags"
2037    ])dnl
2039   if test "$ac_cv_have_gl" = no; then
2040     AC_MSG_RESULT(no)
2041     GL_LDFLAGS=""
2042     GLINC=""
2043     $2
2044   else
2045     AC_DEFINE(HAVE_GL)
2046     if test "$GL_LDFLAGS" = ""; then
2047        GLLIB="-lMesaGL -lMesaGLU"
2048     else
2049        GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU"
2050     fi
2051     if test "$GL_INCLUDE" = ""; then
2052        GLINC=""
2053     else
2054        GLINC="-I$GL_INCLUDE"
2055     fi
2056     AC_MSG_RESULT(yes)
2057     $1
2058   fi
2059  fi
2060  AC_SUBST(GLINC)
2061  AC_SUBST(GLLIB)
2062 ]) 
2064  dnl PAM pam
2066  dnl Should test for PAM (Pluggable Authentication Modules)
2067  AC_DEFUN(AC_PATH_PAM_DIRECT,
2069  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
2070  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
2072    for ac_dir in               \
2073                                \
2074      /usr/local/include        \
2075      /usr/include              \
2076      /usr/unsupported/include  \
2077      /opt/include              \
2078      /usr/pam/include          \
2079      /usr/local/pam/include    \
2080      /usr/lib/pam/include      \
2081                               \
2082      $extra_include            \
2083      ; \
2084    do
2085      if test -r "$ac_dir/$pam_direct_test_include"; then
2086        no_pam= ac_pam_includes=$ac_dir
2087        break
2088      fi
2089    done
2091  # First see if replacing the include by lib works.
2092  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
2093                            \
2094      /lib                  \
2095      /usr/lib              \
2096      /usr/local/lib        \
2097      /usr/unsupported/lib  \
2098      /lib/security         \
2099      /usr/security/lib     \
2100      $extra_lib            \
2101      ; \
2102  do
2103    for ac_extension in a so sl; do
2104      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
2105        no_pam= ac_pam_libraries=$ac_dir
2106        break 2
2107      fi
2108    done
2109  done
2112 AC_DEFUN(AC_PATH_PAM,
2114   AC_REQUIRE([KDE_CHECK_LIBDL])
2115   AC_REQUIRE_CPP()dnl
2117   AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"], [], [-lpam $LIBDL])
2119  AC_MSG_CHECKING(for PAM)
2120  AC_ARG_WITH(pam, 
2121 [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
2122   [
2123     if test "x$withval" = "xyes"; then
2124       no_pam=
2125       default_pam=yes
2126     elif test "x$withval" = "xno"; then
2127       no_pam=yes
2128     else
2129       no_pam=
2130       pam_service="$withval"
2131         if test -z "$pam_service"; then
2132         default_pam=yes
2133         else
2134         default_pam=
2135         fi 
2136       fi
2137   ], no_pam=yes
2140  if test ! "$no_pam" = yes; then
2142  AC_CACHE_VAL(ac_cv_path_pam,
2144  ac_pam_includes=NONE
2145  ac_pam_libraries=NONE
2146  if test -z "$pam_libraries"; then
2147    pam_libraries=NONE
2148  fi
2149  if test -z "$pam_includes"; then
2150    pam_includes=NONE
2151  fi
2153  AC_PATH_PAM_DIRECT
2155  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
2156  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
2158  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
2159    ac_pam_libs="-lpam $PAM_MISC_LIB $LIBDL"
2160    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
2161  else
2162    ac_cv_path_pam="no_pam=yes"
2163  fi
2164  ])
2166  eval "$ac_cv_path_pam"
2168  fi
2170  if test "$no_pam" = yes; then
2171    AC_MSG_RESULT(no)
2172  else
2173    AC_DEFINE(HAVE_PAM)
2174    PAMLIBS="$ac_pam_libs"
2175    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
2176    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
2177    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
2178  if test "$default_pam" = yes; then
2179    AC_MSG_RESULT(["default pam service name will be used"])
2180  else
2181    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service")
2182    AC_MSG_RESULT(["pam service name will be: " $pam_service])
2183  fi
2184 dnl test whether struct pam_message is const (Linux) or not (Sun)
2185    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
2186    AC_MSG_CHECKING(for const pam_message)
2187    AC_EGREP_HEADER([struct pam_message],
2188       $pam_appl_h,
2189       [ AC_EGREP_HEADER([const struct pam_message],
2190                         $pam_appl_h,
2191                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
2192                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
2193                         AC_DEFINE(PAM_MESSAGE_NONCONST)] 
2194                         )],
2195        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
2196        )
2197  fi
2199  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
2200      PAMLIBPATHS="-L$pam_libraries"
2201  fi
2202  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
2203      PAMINC="-I$pam_includes"
2204  fi
2206  AC_SUBST(PAMINC)
2207  AC_SUBST(PAMLIBS)
2208  AC_SUBST(PAMLIBPATHS)
2210 ]) 
2212 AC_DEFUN(KDE_CHECK_LIBDL,
2214 AC_CHECK_LIB(dl, dlopen, [
2215 LIBDL="-ldl"
2216 ac_cv_have_dlfcn=yes
2219 AC_CHECK_LIB(dld, shl_unload, [
2220 LIBDL="-ldld"
2221 ac_cv_have_shload=yes
2224 AC_SUBST(LIBDL)
2227 AC_DEFUN(KDE_CHECK_DLOPEN,
2229 KDE_CHECK_LIBDL
2230 AC_CHECK_HEADERS(dlfcn.h dl.h)
2231 if test "$ac_cv_header_dlfcn_h" = "no"; then
2232   ac_cv_have_dlfcn=no
2235 if test "$ac_cv_header_dl_h" = "no"; then
2236   ac_cv_have_shload=no
2239 enable_dlopen=no
2240 AC_ARG_ENABLE(dlopen,
2241 [  --disable-dlopen        link staticly [default=no]] ,
2242 [if test "$enableval" = yes; then
2243   enable_dlopen=yes
2244 fi],
2245 enable_dlopen=yes)
2247 # override the user's opinion, if we know it better ;)
2248 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
2249   enable_dlopen=no
2252 if test "$ac_cv_have_dlfcn" = "yes"; then
2253   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
2256 if test "$ac_cv_have_shload" = "yes"; then
2257   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
2260 if test "$enable_dlopen" = no ; then
2261   test -n "$1" && eval $1
2262 else
2263   test -n "$2" && eval $2
2268 AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
2270 KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
2271 KDE_PROG_LIBTOOL
2272 AC_MSG_CHECKING([dynamic loading])
2273 eval "`egrep '^build_libtool_libs=' libtool`"
2274 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
2275   dynamic_loading=yes
2276   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
2277 else
2278   dynamic_loading=no
2280 AC_MSG_RESULT($dynamic_loading)
2281 if test "$dynamic_loading" = "yes"; then
2282   $1
2283 else
2284   $2
2288 AC_DEFUN(KDE_ADD_INCLUDES,
2290 if test -z "$1"; then 
2291   test_include="Pix.h"
2292 else
2293   test_include="$1"
2296 AC_MSG_CHECKING([for libg++ ($test_include)])
2298 AC_CACHE_VAL(kde_cv_libgpp_includes,
2300 kde_cv_libgpp_includes=no
2302    for ac_dir in               \
2303                                \
2304      /usr/include/g++          \
2305      /usr/include              \
2306      /usr/unsupported/include  \
2307      /opt/include              \
2308      $extra_include            \
2309      ; \
2310    do
2311      if test -r "$ac_dir/$test_include"; then
2312        kde_cv_libgpp_includes=$ac_dir
2313        break
2314      fi
2315    done
2318 AC_MSG_RESULT($kde_cv_libgpp_includes)
2319 if test "$kde_cv_libgpp_includes" != "no"; then
2320   all_includes="-I$kde_cv_libgpp_includes $all_includes"
2326 AC_DEFUN(KDE_CHECK_MICO,
2328 AC_REQUIRE([KDE_CHECK_LIBDL])
2329 AC_REQUIRE([KDE_MISC_TESTS])
2330 AC_MSG_CHECKING(for MICO)
2332 if test -z "$MICODIR"; then
2333     kde_micodir=/usr/local
2334  else
2335     kde_micodir="$MICODIR"
2338 AC_ARG_WITH(micodir,
2339   [  --with-micodir=micodir  where mico is installed ],
2340   kde_micodir=$withval,
2341   kde_micodir=$kde_micodir
2344 AC_CACHE_VAL(kde_cv_mico_incdir,
2346   mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include"
2347 AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
2350 kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
2352 if test ! -r  $kde_micodir/include/CORBA.h; then
2353   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
2356 AC_MSG_RESULT($kde_micodir)
2358 MICO_INCLUDES=-I$kde_micodir/include
2359 AC_SUBST(MICO_INCLUDES)
2360 MICO_LDFLAGS=-L$kde_micodir/lib
2361 AC_SUBST(MICO_LDFLAGS)
2363 AC_MSG_CHECKING([for MICO version])
2364 AC_CACHE_VAL(kde_cv_mico_version,
2366 AC_LANG_C
2367 cat >conftest.$ac_ext <<EOF
2368 #include <stdio.h>
2369 #include <mico/version.h>
2370 int main() { 
2371     
2372    printf("MICO_VERSION=%s\n",MICO_VERSION); 
2373    return (0); 
2376 ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
2377 if AC_TRY_EVAL(ac_compile); then
2378   if eval `./conftest 2>&5`; then
2379     kde_cv_mico_version=$MICO_VERSION
2380   else
2381     AC_MSG_ERROR([your system is not able to execute a small application to
2382     find MICO version! Check $kde_micodir/include/mico/version.h])
2383   fi 
2384 else
2385   AC_MSG_ERROR([your system is not able to compile a small application to
2386   find MICO version! Check $kde_micodir/include/mico/version.h])
2390 dnl installed MICO version
2391 mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
2392 mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
2393 mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
2395 dnl required MICO version
2396 req_v_maj=`echo $1 | sed -e 's/^\(.*\)\..*\..*$/\1/'`
2397 req_v_mid=`echo $1 | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
2398 req_v_min=`echo $1 | sed -e 's/^.*\..*\.\(.*\)$/\1/'` 
2400 if test "$mico_v_maj" -lt "$req_v_maj" || \
2401    ( test "$mico_v_maj" -eq "$req_v_maj" && \
2402         test "$mico_v_mid" -lt "$req_v_mid" ) || \
2403    ( test "$mico_v_mid" -eq "$req_v_mid" && \
2404         test "$mico_v_min" -lt "$req_v_min" )
2406 then
2407   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $1 \
2408 at least is required. You should upgrade MICO.])
2409 else
2410   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $1, ok)])
2413 LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBDL"
2414 AC_SUBST(LIBMICO)
2415 IDL=$kde_micodir/bin/idl
2416 AC_SUBST(IDL)
2418 KDE_CHECK_MINI_STL
2420 if test "$kde_cv_have_mini_stl" = "yes"; then
2421   AC_MSG_ERROR([compile mico with --disable-mini-stl])
2424 idldir="\$(includedir)/idl"
2425 AC_SUBST(idldir)
2429 AC_DEFUN(KDE_CHECK_MINI_STL,
2431 AC_REQUIRE([KDE_CHECK_MICO])
2433 AC_MSG_CHECKING(if we use mico's mini-STL)
2434 AC_CACHE_VAL(kde_cv_have_mini_stl,
2436 AC_LANG_CPLUSPLUS
2437 kde_save_cxxflags="$CXXFLAGS"
2438 CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
2439 AC_TRY_COMPILE(
2441 #include <mico/config.h>
2444 #ifdef HAVE_MINI_STL
2445 #error "nothing"
2446 #endif
2448 kde_cv_have_mini_stl=no,
2449 kde_cv_have_mini_stl=yes)
2450 CXXFLAGS="$kde_save_cxxflags"
2454 AC_MSG_RESULT($kde_cv_have_mini_stl)
2460 AC_DEFUN(KDE_CHECK_LIBPTHREAD,
2462 AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= )
2463 AC_SUBST(LIBPTHREAD)
2466 AC_DEFUN(KDE_TRY_LINK_PYTHON,
2468 AC_CACHE_VAL(kde_cv_try_link_python_$1,
2470 kde_save_cxxflags="$CXXFLAGS"
2471 CXXFLAGS="$CXXFLAGS $PYTHONINC"
2472 kde_save_libs="$LIBS"
2473 LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
2474 kde_save_ldflags="$LDFLAGS"
2475 LDFLAGS="$LDFLAGS $PYTHONLIB"
2477 AC_TRY_LINK(
2479 #include <Python.h>
2481         PySys_SetArgv(1, 0);
2483         [kde_cv_try_link_python_$1=yes],
2484         [kde_cv_try_link_python_$1=no]
2486 CXXFLAGS="$kde_save_cxxflags"
2487 LIBS="$kde_save_libs"
2488 LDFLAGS="$kde_save_ldflags"
2491 if test "$kde_cv_try_link_python_$1" = "yes"; then
2492   $3
2493 else
2494   $4
2499 AC_DEFUN(KDE_CHECK_PYTHON,
2501 AC_REQUIRE([KDE_CHECK_LIBDL])
2502 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
2504 AC_MSG_CHECKING([for Python directory])
2506 AC_CACHE_VAL(kde_cv_pythondir,
2508   if test -z "$PYTHONDIR"; then
2509     kde_cv_pythondir=/usr/local
2510   else
2511     kde_cv_pythondir="$PYTHONDIR"
2512   fi
2515 AC_ARG_WITH(pythondir, 
2516 [  --with-pythondir=pythondir   use python installed in pythondir ],
2518   ac_python_dir=$withval
2519 ], ac_python_dir=$kde_cv_pythondir
2522 AC_MSG_RESULT($ac_python_dir)
2524 if test -z "$1"; then 
2525   version="1.5"
2526 else
2527   version="$1"
2530 AC_MSG_CHECKING([for Python$version])
2532 python_incdirs="$ac_python_dir/include/python$version /usr/include/python$version /usr/local/include/python$version /usr/local/include"
2533 AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
2534 if test ! -r $python_incdir/Python.h; then
2535   AC_MSG_ERROR(Python.h not found.)
2538 PYTHONINC=-I$python_incdir
2540 python_libdirs="$ac_python_dir/lib/python$version/config /usr/lib/python$version/config /usr/local/python$version/config /usr/lib"
2541 AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
2542 if test ! -r $python_libdir/libpython$version.a; then
2543   AC_MSG_ERROR(libpython$version.a not found.)
2546 PYTHONLIB=-L$python_libdir
2547 LIBPYTHON=-lpython$version
2549 AC_MSG_RESULT(header $python_incdir library $python_libdir)
2551 dnl Note: this test is very weak
2552 AC_MSG_CHECKING(if an Python application links)
2553 KDE_TRY_LINK_PYTHON(normal, "", 
2554 [AC_MSG_RESULT(yes)
2555  LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
2558     AC_MSG_RESULT(no)
2559     AC_MSG_CHECKING(if Python depends on -lpthread)
2560     KDE_TRY_LINK_PYTHON(pthread, "$LIBPTHREAD",
2561     [  
2562        AC_MSG_RESULT(yes)
2563        LIBPYTHON="$LIBPYTHON $LIBPTHREAD $LIBDL $LIBSOCKET"
2564     ],
2565     [
2566        AC_MSG_RESULT(no)
2567        AC_MSG_CHECKING(if Python depeds on -ltcl)
2568        KDE_TRY_LINK_PYTHON(tcl, "-ltcl",
2569        [
2570           AC_MSG_RESULT(yes)
2571           LIBPYTHON="$LIBPYTHON -ltcl $LIBDL $LIBSOCKET"
2572        ],
2573        [
2574           AC_MSG_RESULT(no)
2575         AC_MSG_WARN([it seems, Python depends on another library. 
2576     Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this
2577     and contact the authors to let them know about this problem])
2578         ])
2579     ])
2580  ]) 
2582 AC_SUBST(PYTHONINC)
2583 AC_SUBST(PYTHONLIB)
2584 AC_SUBST(LIBPYTHON)
2589 AC_DEFUN(KDE_CHECK_STL_SGI,
2591     AC_MSG_CHECKING([if STL implementation is SGI like])
2592     AC_CACHE_VAL(kde_cv_stl_type_sgi,
2593     [
2594       AC_TRY_COMPILE([
2595 #include <string>
2597   string astring="Hallo Welt.";
2598   astring.erase(0, 6); // now astring is "Welt"
2599   return 0;
2600 ], kde_cv_stl_type_sgi=yes,
2601    kde_cv_stl_type_sgi=no)
2604    AC_MSG_RESULT($kde_cv_stl_type_sgi)
2606    if test "$kde_cv_stl_type_sgi" = "yes"; then
2607         AC_DEFINE_UNQUOTED(HAVE_SGI_STL) 
2608    fi
2611 AC_DEFUN(KDE_CHECK_STL_HP,
2613     AC_MSG_CHECKING([if STL implementation is HP like])
2614     AC_CACHE_VAL(kde_cv_stl_type_hp,
2615     [
2616       AC_TRY_COMPILE([
2617 #include <string>
2619   string astring="Hello World";
2620   astring.remove(0, 6); // now astring is "World"
2621   return 0;
2622 ], kde_cv_stl_type_hp=yes,
2623    kde_cv_stl_type_hp=no)
2625    AC_MSG_RESULT($kde_cv_stl_type_hp)
2627    if test "$kde_cv_stl_type_hp" = "yes"; then
2628         AC_DEFINE_UNQUOTED(HAVE_HP_STL) 
2629    fi
2632 AC_DEFUN(KDE_CHECK_STL,
2634     KDE_CHECK_STL_SGI
2635     
2636     if test "$kde_cv_stl_type_sgi" = "no"; then
2637        KDE_CHECK_STL_HP
2639        if test "$kde_cv_stl_type_hp" = "no"; then
2640          AC_MSG_ERROR("no known STL type found")
2641        fi
2642     fi
2646 AC_DEFUN(AC_FIND_QIMGIO,
2647    [AC_REQUIRE([AC_FIND_JPEG])
2648 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2649 AC_MSG_CHECKING([for qimgio])
2650 AC_CACHE_VAL(ac_cv_lib_qimgio,
2652 AC_LANG_SAVE
2653 AC_LANG_CPLUSPLUS
2654 ac_save_LIBS="$LIBS"
2655 LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
2656 AC_TRY_LINK(dnl
2658 void qInitImageIO ();
2660             [qInitImageIO();],
2661             eval "ac_cv_lib_qimgio=yes",
2662             eval "ac_cv_lib_qimgio=no")
2663 LIBS="$ac_save_LIBS"
2664 AC_LANG_RESTORE
2665 ])dnl
2666 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
2667   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
2668   AC_MSG_RESULT(yes)
2669   AC_DEFINE_UNQUOTED(HAVE_QIMGIO)
2670   AC_SUBST(LIBQIMGIO)
2671 else
2672   AC_MSG_RESULT(not found)
2676 AC_DEFUN(KDE_CHECK_ANSI,
2680 AC_DEFUN(KDE_CHECK_INSURE,
2682   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
2683   [
2684   if test $enableval = "no"; dnl
2685         then ac_use_insure="no"
2686         else ac_use_insure="yes"
2687    fi
2688   ], [ac_use_insure="no"])
2690   AC_MSG_CHECKING(if we will use Insure++ to debug)
2691   AC_MSG_RESULT($ac_use_insure)
2692   if test "$ac_use_insure" = "yes"; dnl
2693        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
2694    fi
2695 ])          
2697 AC_DEFUN(AM_DISABLE_LIBRARIES,
2699     AC_PROVIDE([AM_ENABLE_STATIC])
2700     AC_PROVIDE([AM_ENABLE_SHARED])
2701     enable_static=no
2702     enable_shared=no
2706 AC_DEFUN(AC_CHECK_UTMP_FILE,
2708     AC_MSG_CHECKING([for utmp file])
2710     AC_CACHE_VAL(kde_cv_utmp_file,
2711     [
2712     kde_cv_utmp_file=no
2714     for ac_file in    \
2715                       \
2716         /var/run/utmp \
2717         /var/adm/utmp \
2718         /etc/utmp     \
2719      ; \
2720     do
2721      if test -r "$ac_file"; then
2722        kde_cv_utmp_file=$ac_file
2723        break
2724      fi
2725     done
2726     ])
2728     AC_MSG_RESULT($kde_cv_utmp_file)
2729     if test "$kde_cv_utmp_file" != "no"; then
2730         AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file")
2731     fi
2735 AC_DEFUN(KDE_CREATE_SUBDIRSLIST,
2738 DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
2740 if test ! -s $srcdir/inst-apps && test -s $srcdir/subdirs; then
2741  cp $srcdir/subdirs $srcdir/inst-apps
2744 if test ! -s $srcdir/inst-apps; then
2745   TOPSUBDIRS=""
2746   files=`cd $srcdir && ls -1`
2747   dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
2748   for i in $dirs; do 
2749     echo $i >> $srcdir/subdirs
2750   done
2751   cp $srcdir/subdirs $srcdir/inst-apps
2752 fi    
2754 if test -s $srcdir/inst-apps; then
2755   ac_topsubdirs="`cat $srcdir/inst-apps`"
2756 fi  
2758 for i in $ac_topsubdirs; do
2759   AC_MSG_CHECKING([if $i should be compiled])
2760   if test -d $srcdir/$i; then
2761     install_it="yes"
2762     for j in $DO_NOT_COMPILE; do 
2763       if test $i = $j; then
2764         install_it="no"
2765       fi
2766     done
2767   else
2768     install_it="no"
2769   fi
2770   AC_MSG_RESULT($install_it)
2771   if test $install_it = "yes"; then 
2772     TOPSUBDIRS="$TOPSUBDIRS $i"
2773   fi
2774 done
2776 AC_SUBST(TOPSUBDIRS)
2779 AC_DEFUN(KDE_CHECK_NAMESPACES,
2781 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
2782 AC_LANG_CPLUSPLUS
2783 AC_TRY_COMPILE([
2786 namespace Foo {
2787   extern int i;
2788   namespace Bar {
2789     extern int i;
2790   }
2793 int Foo::i = 0;
2794 int Foo::Bar::i = 1;
2796   AC_MSG_RESULT(yes)
2797   AC_DEFINE(HAVE_NAMESPACES)
2798 ], [
2799 AC_MSG_RESULT(no)
2803 AC_DEFUN(KDE_CHECK_NEWLIBS,
2808 dnl ------------------------------------------------------------------------
2809 dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
2810 dnl ------------------------------------------------------------------------
2812 AC_DEFUN(AC_CHECK_S_ISSOCK,
2814 AC_MSG_CHECKING(for S_ISSOCK)
2815 AC_CACHE_VAL(ac_cv_have_s_issock,
2817 AC_LANG_SAVE
2818 AC_LANG_C
2819 AC_TRY_LINK(
2821 #include <sys/stat.h>
2824 struct stat buff;
2825 int b = S_ISSOCK( buff.st_mode );
2827 ac_cv_have_s_issock=yes,
2828 ac_cv_have_s_issock=no)
2829 AC_LANG_RESTORE 
2831 AC_MSG_RESULT($ac_cv_have_s_issock)
2832 if test "$ac_cv_have_s_issock" = "yes"; then
2833   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK)
2836 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2837 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
2838 ## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
2840 ## This program is free software; you can redistribute it and/or modify
2841 ## it under the terms of the GNU General Public License as published by
2842 ## the Free Software Foundation; either version 2 of the License, or
2843 ## (at your option) any later version.
2845 ## This program is distributed in the hope that it will be useful, but
2846 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2847 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2848 ## General Public License for more details.
2850 ## You should have received a copy of the GNU General Public License
2851 ## along with this program; if not, write to the Free Software
2852 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2854 ## As a special exception to the GNU General Public License, if you
2855 ## distribute this file as part of a program that contains a
2856 ## configuration script generated by Autoconf, you may include it under
2857 ## the same distribution terms that you use for the rest of that program.
2859 # serial 35 AC_PROG_LIBTOOL
2860 AC_DEFUN(AC_PROG_LIBTOOL,
2861 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
2863 # Save cache, so that ltconfig can load it
2864 AC_CACHE_SAVE
2866 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
2867 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
2868 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
2869 DLLTOOL="$DLLTOOL" AS="$AS" \
2870 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
2871 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
2872 || AC_MSG_ERROR([libtool configure failed])
2874 # Reload cache, that may have been modified by ltconfig
2875 AC_CACHE_LOAD
2877 # This can be used to rebuild libtool when needed
2878 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
2880 # Always use our own libtool.
2881 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
2882 AC_SUBST(LIBTOOL)dnl
2884 # Redirect the config.log output again, so that the ltconfig log is not
2885 # clobbered by the next message.
2886 exec 5>>./config.log
2889 AC_DEFUN(AC_LIBTOOL_SETUP,
2890 [AC_PREREQ(2.13)dnl
2891 AC_REQUIRE([AC_ENABLE_SHARED])dnl
2892 AC_REQUIRE([AC_ENABLE_STATIC])dnl
2893 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
2894 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2895 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
2896 AC_REQUIRE([AC_PROG_RANLIB])dnl
2897 AC_REQUIRE([AC_PROG_CC])dnl
2898 AC_REQUIRE([AC_PROG_LD])dnl
2899 AC_REQUIRE([AC_PROG_NM])dnl
2900 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
2901 AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
2902 AC_REQUIRE([AC_PROG_LN_S])dnl
2905 # Check for any special flags to pass to ltconfig.
2906 libtool_flags="--cache-file=$cache_file"
2907 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
2908 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
2909 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
2910 test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
2911 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
2912 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
2913 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
2915 # Some flags need to be propagated to the compiler or linker for good
2916 # libtool support.
2917 case "$host" in
2918 *-*-irix6*)
2919   # Find out which ABI we are using.
2920   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
2921   if AC_TRY_EVAL(ac_compile); then
2922     case "`/usr/bin/file conftest.o`" in
2923     *32-bit*)
2924       LD="${LD-ld} -32"
2925       ;;
2926     *N32*)
2927       LD="${LD-ld} -n32"
2928       ;;
2929     *64-bit*)
2930       LD="${LD-ld} -64"
2931       ;;
2932     esac
2933   fi
2934   rm -rf conftest*
2935   ;;
2937 *-*-sco3.2v5*)
2938   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
2939   SAVE_CFLAGS="$CFLAGS"
2940   CFLAGS="$CFLAGS -belf"
2941   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
2942     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
2943   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
2944     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
2945     CFLAGS="$SAVE_CFLAGS"
2946   fi
2947   ;;
2949 *-*-cygwin*)
2950   AC_SYS_LIBTOOL_CYGWIN
2951   ;;
2953 esac
2955 # enable the --disable-libtool-lock switch
2957 AC_ARG_ENABLE(libtool-lock,
2958 [  --disable-libtool-lock  force libtool not to do file locking],
2959 need_locks=$enableval,
2960 need_locks=yes)
2962 if test x"$need_locks" = xno; then
2963   libtool_flags="$libtool_flags --disable-lock"
2967 # AC_LIBTOOL_DLOPEN - check for dlopen support
2968 AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
2970 # AC_ENABLE_SHARED - implement the --enable-shared flag
2971 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
2972 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2973 #   `yes'.
2974 AC_DEFUN(AC_ENABLE_SHARED,
2975 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
2976 AC_ARG_ENABLE(shared,
2977 changequote(<<, >>)dnl
2978 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
2979 changequote([, ])dnl
2980 [p=${PACKAGE-default}
2981 case "$enableval" in
2982 yes) enable_shared=yes ;;
2983 no) enable_shared=no ;;
2985   enable_shared=no
2986   # Look at the argument we got.  We use all the common list separators.
2987   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2988   for pkg in $enableval; do
2989     if test "X$pkg" = "X$p"; then
2990       enable_shared=yes
2991     fi
2992   done
2993   IFS="$ac_save_ifs"
2994   ;;
2995 esac],
2996 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
2999 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
3000 AC_DEFUN(AC_DISABLE_SHARED,
3001 [AC_ENABLE_SHARED(no)])
3003 # AC_ENABLE_STATIC - implement the --enable-static flag
3004 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
3005 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3006 #   `yes'.
3007 AC_DEFUN(AC_ENABLE_STATIC,
3008 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
3009 AC_ARG_ENABLE(static,
3010 changequote(<<, >>)dnl
3011 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
3012 changequote([, ])dnl
3013 [p=${PACKAGE-default}
3014 case "$enableval" in
3015 yes) enable_static=yes ;;
3016 no) enable_static=no ;;
3018   enable_static=no
3019   # Look at the argument we got.  We use all the common list separators.
3020   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
3021   for pkg in $enableval; do
3022     if test "X$pkg" = "X$p"; then
3023       enable_static=yes
3024     fi
3025   done
3026   IFS="$ac_save_ifs"
3027   ;;
3028 esac],
3029 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
3032 # AC_DISABLE_STATIC - set the default static flag to --disable-static
3033 AC_DEFUN(AC_DISABLE_STATIC,
3034 [AC_ENABLE_STATIC(no)])
3037 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
3038 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
3039 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3040 #   `yes'.
3041 AC_DEFUN(AC_ENABLE_FAST_INSTALL,
3042 [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
3043 AC_ARG_ENABLE(fast-install,
3044 changequote(<<, >>)dnl
3045 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
3046 changequote([, ])dnl
3047 [p=${PACKAGE-default}
3048 case "$enableval" in
3049 yes) enable_fast_install=yes ;;
3050 no) enable_fast_install=no ;;
3052   enable_fast_install=no
3053   # Look at the argument we got.  We use all the common list separators.
3054   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
3055   for pkg in $enableval; do
3056     if test "X$pkg" = "X$p"; then
3057       enable_fast_install=yes
3058     fi
3059   done
3060   IFS="$ac_save_ifs"
3061   ;;
3062 esac],
3063 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
3066 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
3067 AC_DEFUN(AC_DISABLE_FAST_INSTALL,
3068 [AC_ENABLE_FAST_INSTALL(no)])
3071 # AC_PROG_LD - find the path to the GNU or non-GNU linker
3072 AC_DEFUN(AC_PROG_LD,
3073 [AC_ARG_WITH(gnu-ld,
3074 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
3075 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
3076 AC_REQUIRE([AC_PROG_CC])dnl
3077 AC_REQUIRE([AC_CANONICAL_HOST])dnl
3078 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
3079 ac_prog=ld
3080 if test "$ac_cv_prog_gcc" = yes; then
3081   # Check if gcc -print-prog-name=ld gives a path.
3082   AC_MSG_CHECKING([for ld used by GCC])
3083   ac_prog=`($CC -print-prog-name=ld) 2>&5`
3084   case "$ac_prog" in
3085     # Accept absolute paths.
3086 changequote(,)dnl
3087     /* | [A-Za-z]:[\\/]*)
3088       re_direlt='/[^/][^/]*/\.\./'
3089 changequote([,])dnl
3090       # Canonicalize the path of ld
3091       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
3092       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
3093         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
3094       done
3095       test -z "$LD" && LD="$ac_prog"
3096       ;;
3097   "")
3098     # If it fails, then pretend we aren't using GCC.
3099     ac_prog=ld
3100     ;;
3101   *)
3102     # If it is relative, then search for the first ld in PATH.
3103     with_gnu_ld=unknown
3104     ;;
3105   esac
3106 elif test "$with_gnu_ld" = yes; then
3107   AC_MSG_CHECKING([for GNU ld])
3108 else
3109   AC_MSG_CHECKING([for non-GNU ld])
3111 AC_CACHE_VAL(ac_cv_path_LD,
3112 [if test -z "$LD"; then
3113   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
3114   for ac_dir in $PATH; do
3115     test -z "$ac_dir" && ac_dir=.
3116     if test -f "$ac_dir/$ac_prog"; then
3117       ac_cv_path_LD="$ac_dir/$ac_prog"
3118       # Check to see if the program is GNU ld.  I'd rather use --version,
3119       # but apparently some GNU ld's only accept -v.
3120       # Break only if it was the GNU/non-GNU ld that we prefer.
3121       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
3122         test "$with_gnu_ld" != no && break
3123       else
3124         test "$with_gnu_ld" != yes && break
3125       fi
3126     fi
3127   done
3128   IFS="$ac_save_ifs"
3129 else
3130   ac_cv_path_LD="$LD" # Let the user override the test with a path.
3131 fi])
3132 LD="$ac_cv_path_LD"
3133 if test -n "$LD"; then
3134   AC_MSG_RESULT($LD)
3135 else
3136   AC_MSG_RESULT(no)
3138 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
3139 AC_SUBST(LD)
3140 AC_PROG_LD_GNU
3143 AC_DEFUN(AC_PROG_LD_GNU,
3144 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
3145 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
3146 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
3147   ac_cv_prog_gnu_ld=yes
3148 else
3149   ac_cv_prog_gnu_ld=no
3150 fi])
3153 # AC_PROG_NM - find the path to a BSD-compatible name lister
3154 AC_DEFUN(AC_PROG_NM,
3155 [AC_MSG_CHECKING([for BSD-compatible nm])
3156 AC_CACHE_VAL(ac_cv_path_NM,
3157 [if test -n "$NM"; then
3158   # Let the user override the test.
3159   ac_cv_path_NM="$NM"
3160 else
3161   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
3162   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
3163     test -z "$ac_dir" && ac_dir=.
3164     if test -f $ac_dir/nm; then
3165       # Check to see if the nm accepts a BSD-compat flag.
3166       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
3167       #   nm: unknown option "B" ignored
3168       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
3169         ac_cv_path_NM="$ac_dir/nm -B"
3170         break
3171       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
3172         ac_cv_path_NM="$ac_dir/nm -p"
3173         break
3174       else
3175         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
3176         continue # so that we can try to find one that supports BSD flags
3177       fi
3178     fi
3179   done
3180   IFS="$ac_save_ifs"
3181   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
3182 fi])
3183 NM="$ac_cv_path_NM"
3184 AC_MSG_RESULT([$NM])
3185 AC_SUBST(NM)
3188 # AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
3189 # by C symbol name from nm.
3190 AC_DEFUN(AC_SYS_NM_PARSE,
3191 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
3192 AC_REQUIRE([AC_PROG_NM])dnl
3193 # Check for command to grab the raw symbol name followed by C symbol from nm.
3194 AC_MSG_CHECKING([command to parse $NM output])
3195 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
3196 [# These are sane defaults that work on at least a few old systems.
3197 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
3199 changequote(,)dnl
3200 # Character class describing NM global symbol codes.
3201 ac_symcode='[BCDEGRST]'
3203 # Regexp to match symbols that can be accessed directly from C.
3204 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
3206 # Transform the above into a raw symbol and a C symbol.
3207 ac_symxfrm='\1 \2\3 \3'
3209 # Transform an extracted symbol line into a proper C declaration
3210 ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
3212 # Define system-specific variables.
3213 case "$host_os" in
3214 aix*)
3215   ac_symcode='[BCDT]'
3216   ;;
3217 cygwin* | mingw*)
3218   ac_symcode='[ABCDGISTW]'
3219   ;;
3220 hpux*)
3221   ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
3222   ;;
3223 irix*)
3224   ac_symcode='[BCDEGRST]'
3225   ;;
3226 solaris*)
3227   ac_symcode='[BDT]'
3228   ;;
3229 esac
3231 # If we're using GNU nm, then use its standard symbol codes.
3232 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
3233   ac_symcode='[ABCDGISTW]'
3235 changequote([,])dnl
3237 # Try without a prefix undercore, then with it.
3238 for ac_symprfx in "" "_"; do
3240   ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[       ]\($ac_symcode\)[       ][      ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
3242   # Check to see that the pipe works correctly.
3243   ac_pipe_works=no
3244   rm -f conftest.$ac_ext
3245   cat > conftest.$ac_ext <<EOF
3246 #ifdef __cplusplus
3247 extern "C" {
3248 #endif
3249 char nm_test_var;
3250 void nm_test_func(){}
3251 #ifdef __cplusplus
3253 #endif
3254 int main(){nm_test_var='a';nm_test_func;return 0;}
3257   if AC_TRY_EVAL(ac_compile); then
3258     # Now try to grab the symbols.
3259     ac_nlist=conftest.nm
3260   
3261     if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
3263       # Try sorting and uniquifying the output.
3264       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
3265         mv -f "$ac_nlist"T "$ac_nlist"
3266       else
3267         rm -f "$ac_nlist"T
3268       fi
3270       # Make sure that we snagged all the symbols we need.
3271       if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
3272         if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
3273           cat <<EOF > conftest.c
3274 #ifdef __cplusplus
3275 extern "C" {
3276 #endif
3279           # Now generate the symbol file.
3280           eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
3282           cat <<EOF >> conftest.c
3283 #if defined (__STDC__) && __STDC__
3284 # define lt_ptr_t void *
3285 #else
3286 # define lt_ptr_t char *
3287 # define const
3288 #endif
3290 /* The mapping between symbol names and symbols. */
3291 const struct {
3292   const char *name;
3293   lt_ptr_t address;
3295 changequote(,)dnl
3296 lt_preloaded_symbols[] =
3297 changequote([,])dnl
3300         sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
3301         cat <<\EOF >> conftest.c
3302   {0, (lt_ptr_t) 0}
3305 #ifdef __cplusplus
3307 #endif
3309           # Now try linking the two files.
3310           mv conftest.$ac_objext conftestm.$ac_objext
3311           ac_save_LIBS="$LIBS"
3312           ac_save_CFLAGS="$CFLAGS"
3313           LIBS="conftestm.$ac_objext"
3314           CFLAGS="$CFLAGS$no_builtin_flag"
3315           if AC_TRY_EVAL(ac_link) && test -s conftest; then
3316             ac_pipe_works=yes
3317           else
3318             echo "configure: failed program was:" >&AC_FD_CC
3319             cat conftest.c >&AC_FD_CC
3320           fi
3321           LIBS="$ac_save_LIBS"
3322           CFLAGS="$ac_save_CFLAGS"
3323         else
3324           echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
3325         fi
3326       else
3327         echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
3328       fi
3329     else
3330       echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
3331     fi
3332   else
3333     echo "$progname: failed program was:" >&AC_FD_CC
3334     cat conftest.c >&AC_FD_CC
3335   fi
3336   rm -rf conftest*
3338   # Do not use the global_symbol_pipe unless it works.
3339   if test "$ac_pipe_works" = yes; then
3340     if test x"$ac_symprfx" = x"_"; then
3341       ac_cv_sys_symbol_underscore=yes
3342     else
3343       ac_cv_sys_symbol_underscore=no
3344     fi
3345     break
3346   else
3347     ac_cv_sys_global_symbol_pipe=
3348   fi
3349 done
3352 ac_result=yes
3353 if test -z "$ac_cv_sys_global_symbol_pipe"; then
3354    ac_result=no
3356 AC_MSG_RESULT($ac_result)
3359 # AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
3360 AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
3361 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
3362 AC_CHECK_TOOL(AS, as, false)
3365 # AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
3366 #                            with an underscore?
3367 AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
3368 [AC_REQUIRE([AC_PROG_NM])dnl
3369 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
3370 AC_MSG_CHECKING([for _ prefix in compiled symbols])
3371 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
3372 [ac_cv_sys_symbol_underscore=no
3373 cat > conftest.$ac_ext <<EOF
3374 void nm_test_func(){}
3375 int main(){nm_test_func;return 0;}
3377 if AC_TRY_EVAL(ac_compile); then
3378   # Now try to grab the symbols.
3379   ac_nlist=conftest.nm
3380   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
3381     # See whether the symbols have a leading underscore.
3382     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
3383       ac_cv_sys_symbol_underscore=yes
3384     else
3385       if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
3386         :
3387       else
3388         echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
3389       fi
3390     fi
3391   else
3392     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
3393   fi
3394 else
3395   echo "configure: failed program was:" >&AC_FD_CC
3396   cat conftest.c >&AC_FD_CC
3398 rm -rf conftest*
3400 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
3401 USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
3402 AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
3405 # AC_CHECK_LIBM - check for math library
3406 AC_DEFUN(AC_CHECK_LIBM,
3407 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
3408 case "$host" in
3409 *-*-beos* | *-*-cygwin*)
3410   # These system don't have libm
3411   ;;
3412 *-ncr-sysv4.3*)
3413   AC_CHECK_LIB(mw, _mwvalidcheckl)
3414   AC_CHECK_LIB(m, cos)
3415   ;;
3417   AC_CHECK_LIB(m, cos)
3418   ;;
3419 esac
3422 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
3423 # the libltdl convenience library, adds --enable-ltdl-convenience to
3424 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
3425 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
3426 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
3427 # '${top_builddir}/' (note the single quotes!) if your package is not
3428 # flat, and, if you're not using automake, define top_builddir as
3429 # appropriate in the Makefiles.
3430 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
3431   case "$enable_ltdl_convenience" in
3432   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
3433   "") enable_ltdl_convenience=yes
3434       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
3435   esac
3436   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
3439 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
3440 # the libltdl installable library, and adds --enable-ltdl-install to
3441 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
3442 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
3443 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
3444 # '${top_builddir}/' (note the single quotes!) if your package is not
3445 # flat, and, if you're not using automake, define top_builddir as
3446 # appropriate in the Makefiles.
3447 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
3448 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
3449   AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
3450     case "$enable_ltdl_install" in
3451     no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
3452     "") enable_ltdl_install=yes
3453         ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
3454     esac
3455   ])
3456   if test x"$enable_ltdl_install" != x"no"; then
3457     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
3458   fi
3461 dnl old names
3462 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
3463 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
3464 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
3465 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
3466 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
3467 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
3468 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
3469 AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
3470 AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
3471 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl
3473 AC_DEFUN(AC_LIBLTDL,
3475 AC_REQUIRE([AC_PROG_CC])
3476 AC_C_CONST
3477 AC_C_INLINE
3478 AC_REQUIRE([AM_PROG_LIBTOOL])
3479 AC_SUBST(LIBTOOL_DEPS)
3481 AC_CACHE_CHECK([which extension is used for shared libraries],
3482   libltdl_cv_shlibext, [dnl
3484   rm -f conftest
3485   ./libtool --config > conftest
3486   . ./conftest
3487   last=
3488   for spec in $library_names_spec; do
3489     last="$spec"
3490   done
3491   rm -f conftest
3492 changequote(, )
3493   echo "$last" | sed 's/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
3494 changequote([, ])
3496 libltdl_cv_shlibext=`cat conftest`
3497 rm -f conftest
3499 if test -n "$libltdl_cv_shlibext"; then
3500   AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
3501     [Define to the extension used for shared libraries, say, ".so". ])
3504 AC_CACHE_CHECK([which variable specifies run-time library path],
3505   libltdl_cv_shlibpath_var, [dnl
3507   rm -f conftest
3508   ./libtool --config > conftest
3509   . ./conftest
3510   rm -f conftest
3511   echo "$shlibpath_var" > conftest
3513 libltdl_cv_shlibpath_var=`cat conftest`
3514 rm -f conftest
3516 if test -n "$libltdl_cv_shlibpath_var"; then
3517   AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
3518     [Define to the name of the environment variable that determines the dynamic library search path. ])
3521 AC_CACHE_CHECK([for objdir],
3522   libltdl_cv_objdir, [dnl
3524   rm -f conftest
3525   ./libtool --config > conftest
3526   . ./conftest
3527   rm -f conftest
3528   echo "$objdir" > conftest
3530 libltdl_cv_objdir=`cat conftest`
3531 rm -f conftest
3533 test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
3534 AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
3535   [Define to the sub-directory in which libtool stores uninstalled libraries. ])
3537 AC_HEADER_STDC
3538 AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h)
3539 AC_CHECK_HEADERS(string.h strings.h, break)
3540 AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
3542 AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
3543        libltdl_cv_preloaded_symbols, [dnl
3544   (
3545     rm -f conftest
3546     ./libtool --config > conftest
3547     . ./conftest
3548     rm -f conftest
3549     if test -n "$global_symbol_pipe"; then
3550       echo yes > conftest
3551     else
3552       echo no > conftest
3553     fi
3554   )
3555   libltdl_cv_preloaded_symbols=`cat conftest`
3556   rm -f conftest
3558 if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
3559   AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
3560     [Define if libtool can extract symbol lists from object files. ])
3563 test_dlerror=no
3564 LIBADD_DL=
3565 AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
3566                           [Define if you have the libdl library or equivalent. ]) test_dlerror=yes],
3567   [AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
3568                                [Define if you have the libdl library. ]) dnl
3569                              LIBADD_DL="-ldl" test_dlerror=yes],
3570     [AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
3571                                     [Define if you have the GNU dld library. ]) dnl
3572                                   LIBADD_DL="-ldld"],
3573       [AC_CHECK_FUNCS(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
3574                                    [Define if you have the shl_load function. ])])]
3575     )]
3576   )]
3578 AC_SUBST(LIBADD_DL)
3580 if test "$test_dlerror" = yes; then
3581  LIBS_SAVE="$LIBS"
3582  LIBS="$LIBS $LIBADD_DL"
3583  AC_CHECK_FUNCS(dlerror)
3584  LIBS="$LIBS_SAVE"
3587 AC_SYS_SYMBOL_UNDERSCORE
3588 if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then
3589   if test x"$ac_cv_func_dlopen" = xyes ||
3590      test x"$ac_cv_lib_dl_dlopen" = xyes ; then
3591         AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
3592                 libltdl_cv_need_uscore, [dnl
3593                 AC_TRY_RUN([
3594 #if HAVE_DLFCN_H
3595 #include <dlfcn.h>
3596 #endif
3598 #include <stdio.h>
3600 #ifdef RTLD_GLOBAL
3601 # define LTDL_GLOBAL    RTLD_GLOBAL
3602 #else
3603 # ifdef DL_GLOBAL
3604 #  define LTDL_GLOBAL   DL_GLOBAL
3605 # else
3606 #  define LTDL_GLOBAL   0
3607 # endif
3608 #endif
3610 /* We may have to define LTDL_LAZY_OR_NOW in the command line if we
3611    find out it does not work in some platform. */
3612 #ifndef LTDL_LAZY_OR_NOW
3613 # ifdef RTLD_LAZY
3614 #  define LTDL_LAZY_OR_NOW      RTLD_LAZY
3615 # else
3616 #  ifdef DL_LAZY
3617 #   define LTDL_LAZY_OR_NOW     DL_LAZY
3618 #  else
3619 #   ifdef RTLD_NOW
3620 #    define LTDL_LAZY_OR_NOW    RTLD_NOW
3621 #   else
3622 #    ifdef DL_NOW
3623 #     define LTDL_LAZY_OR_NOW   DL_NOW
3624 #    else
3625 #     define LTDL_LAZY_OR_NOW   0
3626 #    endif
3627 #   endif
3628 #  endif
3629 # endif
3630 #endif
3632 fnord() { int i=42;}
3633 main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
3634     if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
3635                if(ptr1 && !ptr2) exit(0); } exit(1); } 
3636 ],      libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
3637         libltdl_cv_need_uscore=cross
3639   fi
3642 if test x"$libltdl_cv_need_uscore" = xyes; then
3643   AC_DEFINE(NEED_USCORE, 1,
3644     [Define if dlsym() requires a leading underscode in symbol names. ])