Implemented decimal conversion.
[kdbg.git] / acinclude.m4
blob32fe069f38ae4a708c13be49ed30314255330026
1 ##   -*- autoconf -*-
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 /usr/lib/qt2/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(AC_CREATE_KFSSTND,
137 AC_REQUIRE([AC_CHECK_RPATH])
138 AC_REQUIRE([AC_CHECK_BOOL])
139 AC_MSG_CHECKING([for KDE paths])
140 kde_result=""
142 AC_CACHE_VAL(kde_cv_all_paths,
144   if test -z "$kde_htmldir"; then
145     kde_htmldir='\$(prefix)/share/doc/HTML'
146   fi
147   if test -z "$kde_appsdir"; then
148     kde_appsdir='\$(prefix)/share/applnk'
149   fi
150   if test -z "$kde_icondir"; then
151     kde_icondir='\$(prefix)/share/icons'
152   fi
153   if test -z "$kde_sounddir"; then
154     kde_sounddir='\$(prefix)/share/sounds'
155   fi
156   if test -z "$kde_datadir"; then
157     kde_datadir='\$(prefix)/share/apps'
158   fi
159   if test -z "$kde_locale"; then
160     kde_locale='\$(prefix)/share/locale'
161   fi
162   if test -z "$kde_cgidir"; then
163     kde_cgidir='\$(exec_prefix)/cgi-bin'
164   fi
165   if test -z "$kde_confdir"; then
166     kde_confdir='\$(prefix)/share/config'
167   fi
168   if test -z "$kde_mimedir"; then
169     kde_mimedir='\$(prefix)/share/mimelnk'
170   fi
171   if test -z "$kde_toolbardir"; then
172     kde_toolbardir='\$(prefix)/share/toolbar'
173   fi
174   if test -z "$kde_wallpaperdir"; then
175     kde_wallpaperdir='\$(prefix)/share/wallpapers'
176   fi
177   if test -z "$kde_bindir"; then
178     kde_bindir='\$(exec_prefix)/bin'
179   fi
180   if test -z "$kde_servicesdir"; then
181     kde_servicesdir='\$(prefix)/share/services'
182   fi
183   if test -z "$kde_servicetypesdir"; then
184     kde_servicetypesdir='\$(prefix)/share/servicetypes'
185   fi
187   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
188         kde_htmldir=\"$kde_htmldir\" \
189         kde_appsdir=\"$kde_appsdir\" \
190         kde_icondir=\"$kde_icondir\" \
191         kde_sounddir=\"$kde_sounddir\" \
192         kde_datadir=\"$kde_datadir\" \
193         kde_locale=\"$kde_locale\" \
194         kde_cgidir=\"$kde_cgidir\" \
195         kde_confdir=\"$kde_confdir\" \
196         kde_mimedir=\"$kde_mimedir\" \
197         kde_toolbardir=\"$kde_toolbardir\" \
198         kde_wallpaperdir=\"$kde_wallpaperdir\" \
199         kde_bindir=\"$kde_bindir\" \
200         kde_servicesdir=\"$kde_servicesdir\" \
201         kde_servicetypesdir=\"$kde_servicetypesdir\" \
202         kde_result=defaults"
206 eval "$kde_cv_all_paths"
208 if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
209    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
210    test -z "$kde_datadir" || test -z "$kde_locale"  ||
211    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
212    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
213    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
214    test -z "$kde_servicesdir" ||
215    test -z "$kde_servicetypesdir" || test "$kde_have_all_paths" != "yes"; then
216   kde_have_all_paths=no
217   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
218 Since it had compiled and linked before, it must be a strange problem on your system.
219 Look at config.log for details. If you are not able to fix this, look at
220 http://www.kde.org/faq/installation.html or any www.kde.org mirror.
221 (If you're using an egcs version on Linux, you may update binutils!)
223 else
224   rm -f conftest*
225   AC_MSG_RESULT($kde_result)
228 bindir=$kde_bindir
232 AC_DEFUN(AC_SUBST_KFSSTND,
234 AC_SUBST(kde_htmldir)
235 AC_SUBST(kde_appsdir)
236 AC_SUBST(kde_icondir)
237 AC_SUBST(kde_sounddir)
238 AC_SUBST(kde_datadir)
239 AC_SUBST(kde_locale)
240 AC_SUBST(kde_cgidir)
241 AC_SUBST(kde_confdir)
242 AC_SUBST(kde_mimedir)
243 AC_SUBST(kde_toolbardir)
244 AC_SUBST(kde_wallpaperdir)
245 AC_SUBST(kde_bindir)
246 AC_SUBST(kde_servicesdir)
247 AC_SUBST(kde_servicetypesdir)
250 AC_DEFUN(KDE_MISC_TESTS,
252    AC_LANG_C
253    dnl Checks for libraries. 
254    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
255    AC_SUBST(LIBCOMPAT)
256    kde_have_crypt=
257    AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
258       AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
259         AC_MSG_WARN([you have no crypt in either libcrypt or libc. 
260 You should install libcrypt from another source or configure with PAM
261 support])
262         kde_have_crypt=no
263       ]))
264    AC_SUBST(LIBCRYPT)
265    if test $kde_have_crypt = yes; then
266       AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
267    fi 
268    AC_CHECK_KSIZE_T
269    AC_LANG_C
270    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
271    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
272       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
273         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
274    fi
275    AC_CHECK_FUNC(inet_ntoa)
276    if test $ac_cv_func_inet_ntoa = no; then
277      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
278    fi
279    AC_CHECK_FUNC(connect)
280    if test $ac_cv_func_connect = no; then
281       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
282         $X_EXTRA_LIBS)
283    fi
285    AC_CHECK_FUNC(remove)
286    if test $ac_cv_func_remove = no; then
287       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
288    fi
290    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
291    AC_CHECK_FUNC(shmat)
292    if test $ac_cv_func_shmat = no; then
293      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
294    fi
296    LIBSOCKET="$X_EXTRA_LIBS"
297    AC_SUBST(LIBSOCKET)
298    AC_SUBST(X_EXTRA_LIBS)
299    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
300    AC_SUBST(LIBUCB)
302    case $host in  dnl this *is* LynxOS specific
303    *-*-lynxos* )
304         AC_MSG_CHECKING([LynxOS header file wrappers])
305         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
306         AC_MSG_RESULT(disabled)
307         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
308          ;;
309     esac
311    AC_REQUIRE([KDE_CHECK_LIBDL])
314 dnl ------------------------------------------------------------------------
315 dnl Find the header files and libraries for X-Windows. Extended the 
316 dnl macro AC_PATH_X
317 dnl ------------------------------------------------------------------------
319 AC_DEFUN(K_PATH_X,
321 AC_REQUIRE([AC_PROG_CPP])
322 AC_MSG_CHECKING(for X)
323 AC_LANG_SAVE
324 AC_LANG_C
325 AC_CACHE_VAL(ac_cv_have_x,
326 [# One or both of the vars are not set, and there is no cached value.
327 if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
328    kde_x_includes=NO
329 else
330    kde_x_includes=$x_includes
332 if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
333    kde_x_libraries=NO
334 else
335    kde_x_libraries=$x_libraries
338 # below we use the standard autoconf calls
339 ac_x_libraries=$kde_x_libraries
340 ac_x_includes=$kde_x_includes
342 AC_PATH_X_DIRECT
343 AC_PATH_X_XMKMF
344 if test -z "$ac_x_includes"; then
345 ac_x_includes="."
347 if test -z "$ac_x_libraries"; then
348 ac_x_libraries="/usr/lib"
350 #from now on we use our own again 
352 # when the user already gave --x-includes, we ignore
353 # what the standard autoconf macros told us.
354 if test "$kde_x_includes" = NO; then
355   kde_x_includes=$ac_x_includes  
358 if test "$kde_x_includes" = NO; then
359   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
362 if test "$ac_x_libraries" = NO; then
363   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
366 # Record where we found X for the cache.
367 ac_cv_have_x="have_x=yes \
368          kde_x_includes=$kde_x_includes ac_x_libraries=$ac_x_libraries"
369 ])dnl
370 eval "$ac_cv_have_x"
372 if test "$have_x" != yes; then
373   AC_MSG_RESULT($have_x)
374   no_x=yes
375 else
376   AC_MSG_RESULT([libraries $ac_x_libraries, headers $kde_x_includes])
379 if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
380   X_INCLUDES=""
381   x_includes="."; dnl better than nothing :-
382  else
383   x_includes=$kde_x_includes
384   X_INCLUDES="-I$x_includes"
387 if test -z "$ac_x_libraries" || test "x$ac_x_libraries" = xNONE; then
388   X_LDFLAGS=""
389   x_libraries="/usr/lib"; dnl better than nothing :-
390  else
391   x_libraries=$ac_x_libraries
392   X_LDFLAGS="-L$x_libraries"
394 all_includes="$all_includes $X_INCLUDES"  
395 all_libraries="$all_libraries $X_LDFLAGS"  
397 AC_SUBST(X_INCLUDES)
398 AC_SUBST(X_LDFLAGS)
399 AC_SUBST(x_libraries)
400 AC_SUBST(x_includes)
402 # Check for libraries that X11R6 Xt/Xaw programs need.
403 ac_save_LDFLAGS="$LDFLAGS"
404 test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
405 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
406 # check for ICE first), but we must link in the order -lSM -lICE or
407 # we get undefined symbols.  So assume we have SM if we have ICE.
408 # These have to be linked with before -lX11, unlike the other
409 # libraries we check for below, so use a different variable.
410 #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
411 AC_CHECK_LIB(ICE, IceConnectionNumber,
412   [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS)
413 LDFLAGS="$ac_save_LDFLAGS"
415 AC_SUBST(X_PRE_LIBS)
417 LIB_X11='-lX11 $(LIBSOCKET)'
418 AC_SUBST(LIB_X11)
420 AC_MSG_CHECKING(for libXext)
421 AC_CACHE_VAL(kde_cv_have_libXext,
423 kde_ldflags_safe="$LDFLAGS"
424 kde_libs_safe="$LIBS"
426 LDFLAGS="$X_LDFLAGS $USER_LDFLAGS"
427 LIBS="-lXext -lX11 $LIBSOCKET"
429 AC_TRY_LINK([
430 #include <stdio.h>
433 printf("hello Xext\n");
435 kde_cv_have_libXext=yes,
436 kde_cv_have_libXext=no
437    )
439 LDFLAGS=$kde_ldflags_safe
440 LIBS=$kde_libs_safe
441  ])
443 AC_MSG_RESULT($kde_cv_have_libXext)
445 if test "kde_cv_have_libXext" = "no"; then
446   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
447 can't find it itself, we stop here assuming that make wouldn't find
448 them either.])
453 AC_LANG_RESTORE
456 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
458 AC_REQUIRE([KDE_USE_QT])
459 cat > conftest.$ac_ext <<EOF
460 #include "confdefs.h"
461 #include <qglobal.h>
462 #include <qapplication.h>
463 #include <qapp.h>
464 #include <qobjcoll.h>
466 if test "$kde_qtver" = "2"; then
467 cat >> conftest.$ac_ext <<EOF
468 #include <qstyle.h>
472 echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
473 cat >> conftest.$ac_ext <<EOF
474 #error 1
475 #endif
477 int main() {
479 if test "$kde_qtver" = "2"; then
480 cat >> conftest.$ac_ext <<EOF
481     QStringList *t = new QStringList();
484 cat >> conftest.$ac_ext <<EOF
485     return 0;
490 AC_DEFUN(KDE_USE_QT,
492 if test -z "$1"; then
493   kde_qtver=2
494 else
495   kde_qtver=$1
498 if test -z "$2"; then
499   if test $kde_qtver = 2; then
500     kde_qt_minversion=">= 2.0"
501    else
502     kde_qt_minversion=">= 1.42 and < 2.0"
503   fi
504 else
505    kde_qt_minversion=$2
508 if test -z "$3"; then
509     if test $kde_qtver = 2; then
510     kde_qt_verstring="QT_VERSION >= 200"
511    else
512     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
513   fi
514 else
515    kde_qt_verstring=$3
519 AC_DEFUN(KDE_CHECK_QT_DIRECT,
521 AC_REQUIRE([KDE_USE_QT])
522 AC_MSG_CHECKING([if Qt compiles without flags])
523 AC_CACHE_VAL(kde_cv_qt_direct,
525 AC_LANG_SAVE
526 AC_LANG_CPLUSPLUS
527 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
528 ac_LIBRARY_PATH="$LIBRARY_PATH"
529 ac_cxxflags_safe="$CXXFLAGS"
530 ac_ldflags_safe="$LDFLAGS"
531 ac_libs_safe="$LIBS"
533 CXXFLAGS="$CXXFLAGS -I$qt_includes"
534 LDFLAGS="$X_LDFLAGS"
535 LIBS="-lqt -lXext -lX11 $LIBSOCKET"
536 LD_LIBRARY_PATH=
537 export LD_LIBRARY_PATH
538 LIBRARY_PATH=
539 export LIBRARY_PATH
541 KDE_PRINT_QT_PROGRAM
543 if AC_TRY_EVAL(ac_link) && test -s conftest; then
544   kde_cv_qt_direct="yes"
545 else
546   kde_cv_qt_direct="no"
547   echo "configure: failed program was:" >&AC_FD_CC
548   cat conftest.$ac_ext >&AC_FD_CC
551 rm -f conftest*
552 CXXFLAGS="$ac_cxxflags_safe"
553 LDFLAGS="$ac_ldflags_safe"
554 LIBS="$ac_libs_safe"
556 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
557 export LD_LIBRARY_PATH
558 LIBRARY_PATH="$ac_LIBRARY_PATH"
559 export LIBRARY_PATH
560 AC_LANG_RESTORE
563 if test "$kde_cv_qt_direct" = "yes"; then
564   AC_MSG_RESULT(yes)
565   $1
566 else
567   AC_MSG_RESULT(no)
568   $2
572 dnl ------------------------------------------------------------------------
573 dnl Try to find the Qt headers and libraries.
574 dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
575 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
576 dnl ------------------------------------------------------------------------
578 AC_DEFUN(AC_PATH_QT_1_3,
580 AC_REQUIRE([K_PATH_X])
581 AC_REQUIRE([KDE_USE_QT])
582 LIBQT="-lqt"
583 if test $kde_qtver = 2; then
584   
585   AC_REQUIRE([AC_FIND_PNG])
586   LIBQT="$LIBQT $LIBPNG"
588 AC_MSG_CHECKING([for Qt])
590 LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSOCKET"
591 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
592 qt_libraries=""
593 qt_includes=""
594 AC_ARG_WITH(qt-dir,
595     [  --with-qt-dir=DIR       where the root of Qt is installed ],
596     [  ac_qt_includes="$withval"/include
597        ac_qt_libraries="$withval"/lib
598        ac_qt_bindir="$withval"/bin
599     ])
601 AC_ARG_WITH(qt-includes,
602     [  --with-qt-includes=DIR  where the Qt includes are. ],
603     [  
604        ac_qt_includes="$withval"
605     ])
606     
607 kde_qt_libs_given=no
609 AC_ARG_WITH(qt-libraries,
610     [  --with-qt-libraries=DIR where the Qt library is installed.],
611     [  ac_qt_libraries="$withval"
612        kde_qt_libs_given=yes
613     ])
615 AC_CACHE_VAL(ac_cv_have_qt,
616 [#try to guess Qt locations
618 qt_incdirs="$QTINC /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/lib/qt2/include /usr/X11R6/include/X11/qt $x_includes"
619 test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
620 qt_incdirs="$ac_qt_includes $qt_incdirs"
621 AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
622 ac_qt_includes="$qt_incdir"
624 qt_libdirs="$QTLIB /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt /usr/lib/qt2/lib $x_libraries"
625 test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
626 if test ! "$ac_qt_libraries" = "NO"; then
627   qt_libdirs="$ac_qt_libraries $qt_libdirs"
630 test=NONE
631 qt_libdir=NONE
632 for dir in $qt_libdirs; do
633   try="ls -1 $dir/libqt*"
634   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
635 done
637 ac_qt_libraries="$qt_libdir"
639 AC_LANG_SAVE
640 AC_LANG_CPLUSPLUS
642 ac_cxxflags_safe="$CXXFLAGS"
643 ac_ldflags_safe="$LDFLAGS"
644 ac_libs_safe="$LIBS"
646 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
647 LDFLAGS="-L$qt_libdir $all_libraries"
648 LIBS="$LIBS $LIBQT"
650 KDE_PRINT_QT_PROGRAM
652 if AC_TRY_EVAL(ac_link) && test -s conftest; then
653   rm -f conftest*
654 else
655   echo "configure: failed program was:" >&AC_FD_CC
656   cat conftest.$ac_ext >&AC_FD_CC
657   ac_qt_libraries="NO"
659 rm -f conftest*
660 CXXFLAGS="$ac_cxxflags_safe"
661 LDFLAGS="$ac_ldflags_safe"
662 LIBS="$ac_libs_safe"
664 AC_LANG_RESTORE
665 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
666   ac_cv_have_qt="have_qt=no"
667   ac_qt_notfound=""
668   if test "$ac_qt_includes" = NO; then
669     if test "$ac_qt_libraries" = NO; then
670       ac_qt_notfound="(headers and libraries)";
671     else
672       ac_qt_notfound="(headers)";
673     fi
674   else
675     ac_qt_notfound="(libraries)";
676   fi
678   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! ]);
679 else
680   have_qt="yes"
684 eval "$ac_cv_have_qt"
686 if test "$have_qt" != yes; then
687   AC_MSG_RESULT([$have_qt]);
688 else
689   ac_cv_have_qt="have_qt=yes \
690     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
691   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
692   
693   qt_libraries="$ac_qt_libraries"
694   qt_includes="$ac_qt_includes"
697 if test ! "$kde_qt_libs_given" = "yes"; then
698 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
701 AC_SUBST(qt_libraries)
702 AC_SUBST(qt_includes)
704 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
705  QT_INCLUDES="";
706 else
707  QT_INCLUDES="-I$qt_includes"
708  all_includes="$QT_INCLUDES $all_includes"
711 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
712  QT_LDFLAGS=""
713 else
714  QT_LDFLAGS="-L$qt_libraries"
715  all_libraries="$QT_LDFLAGS $all_libraries"
718 AC_SUBST(QT_INCLUDES)
719 AC_SUBST(QT_LDFLAGS)
720 AC_PATH_QT_MOC
722 LIB_QT='-lqt $(LIBPNG) -lXext $(LIB_X11) $(X_PRE_LIBS)'
723 AC_SUBST(LIB_QT)
727 AC_DEFUN(AC_PATH_QT,
729 AC_PATH_QT_1_3
732 dnl ------------------------------------------------------------------------
733 dnl Now, the same with KDE
734 dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
735 dnl and $(kde_includes) will be the kdehdrlocation (if needed)
736 dnl ------------------------------------------------------------------------
738 AC_DEFUN(AC_BASE_PATH_KDE,
740 AC_PREREQ([2.13])
741 AC_REQUIRE([KDE_MISC_TESTS])
742 AC_REQUIRE([AC_PATH_QT])dnl
743 AC_CHECK_RPATH
744 AC_MSG_CHECKING([for KDE])
746 if test "${prefix}" != NONE; then
747   kde_includes=${prefix}/include
748   ac_kde_includes=$prefix/include
750   if test "${exec_prefix}" != NONE; then
751     kde_libraries=${exec_prefix}/lib
752     ac_kde_libraries=$exec_prefix/lib
753   else
754     kde_libraries=${prefix}/lib
755     ac_kde_libraries=$prefix/lib
756   fi
757 else
758   ac_kde_includes=
759   ac_kde_libraries=
760   kde_libraries=""
761   kde_includes=""
764 AC_CACHE_VAL(ac_cv_have_kde,
765 [#try to guess kde locations
767 if test -z "$1"; then
769 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"
770 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
771 kde_incdirs="$ac_kde_includes $kde_incdirs"
772 AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
773 ac_kde_includes="$kde_incdir"
775 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
776   AC_MSG_ERROR([
777 in the prefix, you've chosen, are no KDE headers installed. This will fail.
778 So, check this please and use another prefix!])
781 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"
782 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
783 kde_libdirs="$ac_kde_libraries $kde_libdirs"
784 AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
785 ac_kde_libraries="$kde_libdir"
787 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
788 AC_MSG_ERROR([
789 in the prefix, you've chosen, are no KDE libraries installed. This will fail.
790 So, check this please and use another prefix!])
792 ac_kde_libraries="$kde_libdir"
794 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
795   ac_cv_have_kde="have_kde=no"
796 else
797   ac_cv_have_kde="have_kde=yes \
798     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
801 else dnl test -z $1 
802   
803   ac_cv_have_kde="have_kde=no"
806 ])dnl
808 eval "$ac_cv_have_kde"
810 if test "$have_kde" != "yes"; then
811  if test "${prefix}" = NONE; then
812   ac_kde_prefix="$ac_default_prefix"
813  else
814   ac_kde_prefix="$prefix"
815  fi
816  if test "$exec_prefix" = NONE; then
817   ac_kde_exec_prefix="$ac_kde_prefix"
818   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
819  else
820   ac_kde_exec_prefix="$exec_prefix"
821   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
822  fi
824  kde_libraries="${ac_kde_exec_prefix}/lib"
825  kde_includes=${ac_kde_prefix}/include
827 else
828   ac_cv_have_kde="have_kde=yes \
829     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
830   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
831   
832   kde_libraries="$ac_kde_libraries"
833   kde_includes="$ac_kde_includes"
835 AC_SUBST(kde_libraries)
836 AC_SUBST(kde_includes)
838 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
839  KDE_INCLUDES=""
840 else
841  KDE_INCLUDES="-I$kde_includes"
842  all_includes="$KDE_INCLUDES $all_includes"
845 if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
846  KDE_LDFLAGS=""
847 else
848  KDE_LDFLAGS="-L$kde_libraries"
849  all_libraries="$KDE_LDFLAGS $all_libraries"
852 AC_SUBST(KDE_LDFLAGS)
853 AC_SUBST(KDE_INCLUDES)
855 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
857 AC_SUBST(all_includes)
858 AC_SUBST(all_libraries)
862 AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
864 AC_MSG_CHECKING(for extra includes)
865 AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
866                           adds non standard include paths], 
867   kde_use_extra_includes="$withval",
868   kde_use_extra_includes=NONE
870 kde_extra_includes=
871 if test -n "$kde_use_extra_includes" && \
872    test "$kde_use_extra_includes" != "NONE"; then
874    ac_save_ifs=$IFS
875    IFS=':'
876    for dir in $kde_use_extra_includes; do
877      kde_extra_includes="$kde_extra_includes $dir"
878      all_includes="$all_includes -I$dir"
879      USER_INCLUDES="$USER_INCLUDES -I$dir"
880    done
881    IFS=$ac_save_ifs
882    kde_use_extra_includes="added"
883 else
884    kde_use_extra_includes="no"
886 AC_SUBST(USER_INCLUDES)
888 AC_MSG_RESULT($kde_use_extra_includes)
890 kde_extra_libs=
891 AC_MSG_CHECKING(for extra libs)
892 AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths], 
893   kde_use_extra_libs=$withval,
894   kde_use_extra_libs=NONE
896 if test -n "$kde_use_extra_libs" && \
897    test "$kde_use_extra_libs" != "NONE"; then
899    ac_save_ifs=$IFS
900    IFS=':'
901    for dir in $kde_use_extra_libs; do
902      kde_extra_libs="$kde_extra_libs $dir"
903      all_libraries="$all_libraries -L$dir"
904      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
905      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
906    done
907    IFS=$ac_save_ifs
908    kde_use_extra_libs="added"
909 else
910    kde_use_extra_libs="no"
913 AC_SUBST(USER_LDFLAGS)
915 AC_MSG_RESULT($kde_use_extra_libs)
919 AC_DEFUN(KDE_CHECK_KIMGIO,
921    AC_REQUIRE([AC_BASE_PATH_KDE])
922    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
923    AC_REQUIRE([AC_FIND_TIFF])
924    AC_REQUIRE([AC_FIND_JPEG]) 
925    AC_REQUIRE([AC_FIND_PNG]) 
926    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
927    
928    if test "$1" = "existance"; then
929      AC_LANG_SAVE
930      AC_LANG_CPLUSPLUS
931      kde_save_LIBS="$LIBS"
932      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
933      AC_CHECK_LIB(kimgio, kimgioRegister, [
934       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
935       LIBS="$kde_save_LIBS"
936       AC_LANG_RESTORE   
937    else
938       LIBKIMGIO_EXISTS=yes
939    fi
941    if test "$LIBKIMGIO_EXISTS" = "yes"; then
942      LIB_KIMGIO='-lkimgio'
943    else
944      LIB_KIMGIO=''
945    fi
946    AC_SUBST(LIB_KIMGIO)
947    
948    LIB_KHTML='-lkhtml'
949    AC_SUBST(LIB_KHTML)
952 AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
954    AC_REQUIRE([KDE_MISC_TESTS])
955    AC_REQUIRE([KDE_CHECK_LIBDL])
956    AC_REQUIRE([K_PATH_X])
958 if test $kde_qtver = 2; then
959    LIB_KDECORE='-lkdecore'
960    AC_SUBST(LIB_KDECORE)
961    LIB_KDEUI='-lkdeui'
962    AC_SUBST(LIB_KDEUI)
963    LIB_KFORMULA='-lformula'
964    AC_SUBST(LIB_KFORMULA)
965    LIB_KIO='-lkio'
966    AC_SUBST(LIB_KIO)
967    LIB_SMB='-lsmb'
968    AC_SUBST(LIB_SMB)
969    LIB_KFILE='-lkfile'
970    AC_SUBST(LIB_KFILE)
971    LIB_KAB='-lkab'
972    AC_SUBST(LIB_KAB)
973    LIB_MEDIATOOL='-lmediatool'
974    AC_SUBST(LIB_MEDIATOOL) 
975 else
976    LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
977    AC_SUBST(LIB_KDECORE)
978    LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
979    AC_SUBST(LIB_KDEUI)
980    LIB_KFM='-lkfm $(LIB_KDECORE)'
981    AC_SUBST(LIB_KFM)
982    LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
983    AC_SUBST(LIB_KFILE)
984    LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
985    AC_SUBST(LIB_KAB)
986    LIB_MEDIATOOL='-lmediatool $(LIB_KDECORE)'
987    AC_SUBST(LIB_MEDIATOOL)
991 AC_DEFUN(AC_PATH_KDE,
993   AC_BASE_PATH_KDE
994   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
995   [
996   if test "$enableval" = "no"; 
997     then ac_use_path_checking="default"
998     else ac_use_path_checking=""
999   fi
1000   ], [ac_use_path_checking="default"]
1001   )
1003   AC_CREATE_KFSSTND($ac_use_path_checking)
1005   AC_SUBST_KFSSTND
1006   KDE_CREATE_LIBS_ALIASES
1009 dnl slightly changed version of AC_CHECK_FUNC(setenv)
1010 AC_DEFUN(AC_CHECK_SETENV,
1011 [AC_MSG_CHECKING([for setenv])
1012 AC_CACHE_VAL(ac_cv_func_setenv,
1013 [AC_LANG_C
1014 AC_TRY_LINK(
1015 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
1016 dnl which includes <sys/select.h> which contains a prototype for
1017 dnl select.  Similarly for bzero.
1018 [#include <assert.h>
1019 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
1020 extern "C"
1021 #endif
1022 ])dnl
1023 [/* We use char because int might match the return type of a gcc2
1024     builtin and then its argument prototype would still apply.  */
1025 #include <stdlib.h>
1026 ], [
1027 /* The GNU C library defines this for functions which it implements
1028     to always fail with ENOSYS.  Some functions are actually named
1029     something starting with __ and the normal name is an alias.  */
1030 #if defined (__stub_$1) || defined (__stub___$1)
1031 choke me
1032 #else
1033 setenv("TEST", "alle", 1);
1034 #endif
1035 ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
1037 if test "$ac_cv_func_setenv" = "yes"; then
1038   AC_MSG_RESULT(yes)
1039   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV, 1, [Define if you have setenv])
1040 else
1041   AC_MSG_RESULT(no)
1045 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
1047 AC_LANG_CPLUSPLUS
1048 save_CXXFLAGS="$CXXFLAGS"
1049 if test "$GCC" = "yes"; then
1050 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1052 AC_MSG_CHECKING(for getdomainname)
1053 AC_CACHE_VAL(ac_cv_func_getdomainname,
1055 AC_TRY_COMPILE([
1056 #include <stdlib.h>
1057 #include <unistd.h>
1060 char buffer[200];
1061 getdomainname(buffer, 200);
1063 ac_cv_func_getdomainname=yes,
1064 ac_cv_func_getdomainname=no)
1066 AC_MSG_RESULT($ac_cv_func_getdomainname)
1067 if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1068   AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname])
1070 CXXFLAGS="$save_CXXFLAGS"
1073 AC_DEFUN(AC_CHECK_GETHOSTNAME,
1075 AC_LANG_CPLUSPLUS
1076 save_CXXFLAGS="$CXXFLAGS"
1077 if test "$GCC" = "yes"; then
1078 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1081 AC_MSG_CHECKING([for gethostname])
1082 AC_CACHE_VAL(ac_cv_func_gethostname,
1084 AC_TRY_COMPILE([
1085 #include <stdlib.h>
1086 #include <unistd.h>
1089 char buffer[200];
1090 gethostname(buffer, 200);
1092 ac_cv_func_gethostname=yes,
1093 ac_cv_func_gethostname=no)
1095 AC_MSG_RESULT($ac_cv_func_gethostname)
1096 if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
1097   AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have getdomainname])
1099 CXXFLAGS="$save_CXXFLAGS"
1102 AC_DEFUN(AC_CHECK_USLEEP,
1104 AC_LANG_CPLUSPLUS
1106 AC_MSG_CHECKING([for usleep])
1107 AC_CACHE_VAL(ac_cv_func_usleep,
1109 ac_libs_safe="$LIBS"
1110 LIBS="$LIBS $LIBUCB"
1111 AC_TRY_LINK([
1112 #include <stdlib.h>
1113 #include <unistd.h>
1116 usleep(200);
1118 ac_cv_func_usleep=yes,
1119 ac_cv_func_usleep=no)
1121 AC_MSG_RESULT($ac_cv_func_usleep)
1122 if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then
1123   AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function])
1125 LIBS="$ac_libs_safe"
1128 AC_DEFUN(AC_CHECK_RANDOM,
1130 AC_LANG_CPLUSPLUS
1132 AC_MSG_CHECKING([for random])
1133 AC_CACHE_VAL(ac_cv_func_random,
1135 ac_libs_safe="$LIBS"
1136 LIBS="$LIBS $LIBUCB"
1137 AC_TRY_LINK([
1138 #include <stdlib.h>
1141 random();
1143 ac_cv_func_random=yes,
1144 ac_cv_func_random=no)
1146 AC_MSG_RESULT($ac_cv_func_random)
1147 if eval "test \"`echo $ac_cv_func_random`\" = yes"; then
1148   AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random])
1150 LIBS="$ac_libs_safe"
1153 AC_DEFUN(AC_CHECK_FGETPWENT,
1155 AC_LANG_CPLUSPLUS
1156 save_CXXFLAGS="$CXXFLAGS"
1157 if test "$GCC" = "yes"; then
1158 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1160 AC_MSG_CHECKING(for fgetpwent)
1161 AC_CACHE_VAL(ac_cv_func_fgetpwent,
1163 AC_TRY_COMPILE([
1164 #include <stdlib.h>
1165 #include <unistd.h>
1166 #include <pwd.h>
1169 passwd *p;
1170 FILE *f;
1171 p = fgetpwent(f);
1173 ac_cv_func_fgetpwent=yes,
1174 ac_cv_func_fgetpwent=no)
1176 AC_MSG_RESULT($ac_cv_func_fgetpwent)
1177 if eval "test \"`echo $ac_cv_func_fgetpwent`\" = yes"; then
1178   AC_DEFINE(HAVE_FGETPWENT)
1180 CXXFLAGS="$save_CXXFLAGS"
1183 AC_DEFUN(AC_CHECK_FGETGRENT,
1185 AC_LANG_CPLUSPLUS
1186 save_CXXFLAGS="$CXXFLAGS"
1187 if test "$GCC" = "yes"; then
1188 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1190 AC_MSG_CHECKING(for fgetgrent)
1191 AC_CACHE_VAL(ac_cv_func_fgetgrent,
1193 AC_TRY_COMPILE([
1194 #include <stdlib.h>
1195 #include <unistd.h>
1196 #include <grp.h>
1199 group *g;
1200 FILE *f;
1201 g = fgetgrent(f);
1203 ac_cv_func_fgetgrent=yes,
1204 ac_cv_func_fgetgrent=no)
1206 AC_MSG_RESULT($ac_cv_func_fgetgrent)
1207 if eval "test \"`echo $ac_cv_func_fgetgrent`\" = yes"; then
1208   AC_DEFINE(HAVE_FGETGRENT)
1210 CXXFLAGS="$save_CXXFLAGS"
1213 AC_DEFUN(AC_FIND_GIF,
1214    [AC_MSG_CHECKING([for giflib])
1215 AC_CACHE_VAL(ac_cv_lib_gif,
1216 [ac_save_LIBS="$LIBS"
1217 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
1218 AC_TRY_LINK(dnl
1220 #ifdef __cplusplus
1221 extern "C" {
1222 #endif
1223 int GifLastError(void);
1224 #ifdef __cplusplus
1226 #endif
1227 /* We use char because int might match the return type of a gcc2
1228     builtin and then its argument prototype would still apply.  */
1230             [return GifLastError();],
1231             eval "ac_cv_lib_gif=yes",
1232             eval "ac_cv_lib_gif=no")
1233 LIBS="$ac_save_LIBS"
1234 ])dnl
1235 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1236   AC_MSG_RESULT(yes)
1237   AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
1238 else
1239   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
1243 AC_DEFUN(KDE_FIND_JPEG_HELPER,
1245 AC_MSG_CHECKING([for libjpeg$2])
1246 AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
1248 AC_LANG_C
1249 ac_save_LIBS="$LIBS"
1250 LIBS="$all_libraries -ljpeg$2 -lm"
1251 AC_TRY_LINK(
1252 [/* Override any gcc2 internal prototype to avoid an error.  */
1253 struct jpeg_decompress_struct;
1254 typedef struct jpeg_decompress_struct * j_decompress_ptr;
1255 typedef int size_t;
1256 #ifdef __cplusplus
1257 extern "C" {
1258 #endif
1259     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1260                                     int version, size_t structsize);
1261 #ifdef __cplusplus
1263 #endif
1264 /* We use char because int might match the return type of a gcc2
1265     builtin and then its argument prototype would still apply.  */
1267             [jpeg_CreateDecompress(0L, 0, 0);],
1268             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
1269             eval "ac_cv_lib_jpeg_$1=no")
1270 LIBS="$ac_save_LIBS"
1273 if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
1274   LIBJPEG="$ac_cv_lib_jpeg_$1"
1275   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
1276 else
1277   AC_MSG_RESULT(no)
1278   $3
1283 AC_DEFUN(AC_FIND_JPEG,
1285 KDE_FIND_JPEG_HELPER(6b, 6b,
1286    KDE_FIND_JPEG_HELPER(normal, [],
1287     [
1288 dnl what to do, if the normal way fails:
1289         if test -f "$kde_libraries/libjpeg.so"; then
1290            test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
1291            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1292         else if test -f "$kde_libraries/libjpeg.sl"; then
1293            test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
1294            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"      
1295         else if test -f "$kde_libraries/libjpeg.a"; then
1296            test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
1297            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1298         else
1299           AC_MSG_ERROR([
1300 You need the development package of libjpeg6b. You can get
1301 a source package of libjpeg from http://www.ijg.org/
1303         fi
1304       fi
1305    fi
1307    LIBJPEG=$ac_cv_lib_jpeg
1310 AC_SUBST(LIBJPEG)
1311 AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
1315 AC_DEFUN(AC_FIND_ZLIB,
1317 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1318 AC_MSG_CHECKING([for libz])
1319 AC_CACHE_VAL(ac_cv_lib_z,
1321 AC_LANG_C
1322 kde_save_LIBS="$LIBS"
1323 LIBS="$all_libraries -lz $LIBSOCKET"
1324 kde_save_CFLAGS="$CFLAGS"
1325 CFLAGS="$CFLAGS $all_includes"
1326 AC_TRY_LINK(dnl
1328 #include<zlib.h>
1330             [return (zlibVersion() == ZLIB_VERSION); ],
1331             eval "ac_cv_lib_z='-lz'",
1332             eval "ac_cv_lib_z=no")
1333 LIBS="$kde_save_LIBS"
1334 CFLAGS="$kde_save_CFLAGS"
1335 ])dnl
1336 if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
1337   AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
1338   LIBZ="$ac_cv_lib_z"
1339   AC_SUBST(LIBZ)
1340   AC_MSG_RESULT($ac_cv_lib_z)
1341 else
1342   AC_MSG_RESULT(no)
1343   LIBZ=""
1344   AC_SUBST(LIBZ)
1348 AC_DEFUN(KDE_TRY_TIFFLIB,
1350 AC_MSG_CHECKING([for libtiff $1])
1352 AC_CACHE_VAL(kde_cv_libtiff_$1, 
1354 AC_LANG_C
1355 kde_save_LIBS="$LIBS"
1356 LIBS="$all_libraries -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
1357 kde_save_CFLAGS="$CFLAGS"
1358 CFLAGS="$CFLAGS $all_includes"
1360 AC_TRY_LINK(dnl
1362 #include<tiffio.h>
1364     [return (TIFFOpen( "", "r") == 0); ],
1366     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
1367 ], [
1368     kde_cv_libtiff_$1=no
1371 LIBS="$kde_save_LIBS"
1372 CFLAGS="$kde_save_CFLAGS"
1376 if test "$kde_cv_libtiff_$1" = "no"; then
1377     AC_MSG_RESULT(no)
1378     LIBTIFF=""
1379     $3
1380 else
1381     LIBTIFF="$kde_cv_libtiff_$1"
1382     AC_MSG_RESULT(yes)
1383     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
1384     $2
1389 AC_DEFUN(AC_FIND_TIFF,
1391 AC_REQUIRE([K_PATH_X])
1392 AC_REQUIRE([AC_FIND_ZLIB])
1393 AC_REQUIRE([AC_FIND_JPEG])
1394 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1396 KDE_TRY_TIFFLIB(tiff, [],
1397    KDE_TRY_TIFFLIB(tiff34))
1399 AC_SUBST(LIBTIFF)
1403 AC_DEFUN(AC_FIND_PNG,
1405 AC_REQUIRE([AC_FIND_ZLIB])
1406 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1407 AC_MSG_CHECKING([for libpng])
1408 AC_CACHE_VAL(ac_cv_lib_png,
1410 kde_save_LIBS="$LIBS"
1411 LIBS="$LIBS $all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
1412 kde_save_CFLAGS="$CFLAGS"
1413 CFLAGS="$CFLAGS $all_includes"
1414 AC_LANG_C
1415 AC_TRY_LINK(dnl
1416     [
1417     #include<png.h>
1418     ],
1419     [
1420     png_structp png_ptr = png_create_read_struct(  /* image ptr */
1421                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1422     return( png_ptr != 0 ); 
1423     ],
1424     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
1425     eval "ac_cv_lib_png=no"
1427 LIBS="$kde_save_LIBS"
1428 CFLAGS="$kde_save_CFLAGS"
1429 ])dnl
1430 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
1431   AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
1432   LIBPNG="$ac_cv_lib_png"
1433   AC_SUBST(LIBPNG)
1434   AC_MSG_RESULT($ac_cv_lib_png)
1435 else
1436   AC_MSG_RESULT(no)
1437   LIBPNG=""
1438   AC_SUBST(LIBPNG)
1442 AC_DEFUN(AC_CHECK_BOOL,
1444         AC_MSG_CHECKING([for bool])
1445         AC_CACHE_VAL(ac_cv_have_bool,
1446         [
1447                 AC_LANG_CPLUSPLUS
1448                 AC_TRY_COMPILE([],
1449                  [bool aBool = true;],
1450                  [ac_cv_have_bool="yes"],
1451                  [ac_cv_have_bool="no"])
1452         ]) dnl end AC_CHECK_VAL
1453         AC_MSG_RESULT($ac_cv_have_bool)
1454         if test "$ac_cv_have_bool" = "yes"; then
1455                 AC_DEFINE(HAVE_BOOL, 1, [Define if the C++ compiler supports BOOL])
1456         fi 
1459 AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
1461 AC_MSG_CHECKING(if you need GNU extensions)
1462 AC_CACHE_VAL(ac_cv_gnu_extensions,
1464 cat > conftest.c << EOF
1465 #include <features.h>
1467 #ifdef __GNU_LIBRARY__
1469 #endif
1472 if (eval "$ac_cpp conftest.c") 2>&5 |
1473   egrep "yes" >/dev/null 2>&1; then
1474   rm -rf conftest*
1475   ac_cv_gnu_extensions=yes
1476 else
1477   ac_cv_gnu_extensions=no
1481 AC_MSG_RESULT($ac_cv_gnu_extensions)
1482 if test "$ac_cv_gnu_extensions" = "yes"; then
1483   AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
1487 AC_DEFUN(AC_CHECK_COMPILERS,
1489   dnl this is somehow a fat lie, but prevents other macros from double checking
1490   AC_PROVIDE([AC_PROG_CC])
1491   AC_PROVIDE([AC_PROG_CPP])
1492   AC_ARG_ENABLE(debug,[  --enable-debug          creates debugging code [default=no]],
1493   [ 
1494    if test $enableval = "no"; dnl 
1495      then 
1496        kde_use_debug_code="no"
1497        kde_use_debug_define=yes
1498      else 
1499        kde_use_debug_code="yes"
1500        kde_use_debug_define=no
1501    fi
1502   ], [kde_use_debug_code="no"
1503       kde_use_debug_define=no
1504     ])
1506   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
1507    [ 
1508     if test $enableval = "no"; then 
1509          kde_use_strict_options="no"
1510        else 
1511          kde_use_strict_options="yes"
1512     fi
1513    ], [kde_use_strict_options="no"])
1515 dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
1516   AC_MSG_CHECKING(for a C-Compiler)
1517   dnl if there is one, print out. if not, don't matter
1518   AC_MSG_RESULT($CC) 
1520   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
1521   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
1522   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
1523   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
1525   AC_PROG_CC_WORKS
1526   AC_PROG_CC_GNU
1528   if test $ac_cv_prog_gcc = yes; then
1529     GCC=yes
1530   else
1531     GCC=
1532   fi
1534   if test -z "$CFLAGS"; then
1535     if test "$kde_use_debug_code" = "yes"; then
1536       AC_PROG_CC_G
1537       if test $ac_cv_prog_cc_g = yes; then
1538         CFLAGS="-g"
1539       fi
1540     else
1541       if test "$GCC" = "yes"; then
1542         CFLAGS="-O2"
1543       else
1544         CFLAGS=""
1545       fi
1546       if test "$kde_use_debug_define" = "yes"; then
1547          CFLAGS="$CFLAGS -DNDEBUG"
1548       fi
1549     fi
1551     if test "$GCC" = "yes"; then
1552      CFLAGS="$CFLAGS"
1554      if test "$kde_use_strict_options" = "yes"; then
1555         CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
1556      fi
1557     fi
1559   fi
1561   case "$host" in 
1562   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
1563   esac
1565   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
1566      LDFLAGS="-s"
1567   fi
1570 dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
1571 dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
1573   AC_MSG_CHECKING(how to run the C preprocessor)
1574   # On Suns, sometimes $CPP names a directory.
1575   if test -n "$CPP" && test -d "$CPP"; then
1576     CPP=
1577   fi
1578   if test -z "$CPP"; then
1579   AC_CACHE_VAL(ac_cv_prog_CPP,
1580   [  # This must be in double quotes, not single quotes, because CPP may get
1581     # substituted into the Makefile and "${CC-cc}" will confuse make.
1582     CPP="${CC-cc} -E"
1583     # On the NeXT, cc -E runs the code through the compiler's parser,
1584     # not just through cpp.
1585     dnl Use a header file that comes with gcc, so configuring glibc    
1586     dnl with a fresh cross-compiler works.
1587     AC_TRY_CPP([#include <assert.h>
1588     Syntax Error], ,
1589     CPP="${CC-cc} -E -traditional-cpp"
1590     AC_TRY_CPP([#include <assert.h>
1591     Syntax Error], , CPP=/lib/cpp))
1592     ac_cv_prog_CPP="$CPP"])dnl
1593     CPP="$ac_cv_prog_CPP"
1594   else
1595     ac_cv_prog_CPP="$CPP"
1596   fi
1597   AC_MSG_RESULT($CPP)
1598   AC_SUBST(CPP)dnl
1601   AC_MSG_CHECKING(for a C++-Compiler)
1602   dnl if there is one, print out. if not, don't matter
1603   AC_MSG_RESULT($CXX) 
1605   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
1606   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
1607   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
1608   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
1609   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
1611   AC_PROG_CXX_WORKS
1612   AC_PROG_CXX_GNU
1614   if test $ac_cv_prog_gxx = yes; then
1615     GXX=yes
1616   else
1617     AC_MSG_CHECKING(whether we are using SPARC CC)
1618     GXX=
1619     cat > conftest.C << EOF
1620 #ifdef __SUNPRO_CC
1621    yes;
1622 #endif
1625     ac_try="$CXX -E conftest.C"
1626     if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
1627       ac_cv_prog_CC=yes
1628     else
1629       ac_cv_prog_CC=no
1630     fi
1631     AC_MSG_RESULT($ac_cv_prog_CC)
1632     if test "$ac_cv_prog_CC" = "yes"; then
1633       AC_MSG_ERROR([Sparc CC doesn't work on KDE sources at least til version
1634 4.2. This compiler has several problems accepting legal C++ code 
1635 including the builtin C++ type bool. Since KDE is a freeware project,
1636 we decided, that we don't want to support that broken compilers. 
1638 If you really want to see support for Sparc CC within KDE, make reasonable
1639 patches and join the KDE project. More information about KDE can be found
1640 on www.kde.org])
1641     fi
1642   fi
1644   if test -z "$CXXFLAGS"; then 
1645     if test "$kde_use_debug_code" = "yes"; then
1646       AC_PROG_CXX_G
1647       if test $ac_cv_prog_cxx_g = yes; then
1648         CXXFLAGS="-g"
1649       fi
1650       if test "$ac_cv_prog_CC" = "yes"; then
1651         CXXFLAGS="$CXXFLAGS -pto"
1652       fi
1653     else
1654       if test "$GXX" = "yes"; then
1655          CXXFLAGS="-O2"
1656       else
1657          if test "$ac_cv_prog_CC" = "yes"; then
1658             CXXFLAGS="-pto -O2"
1659          else
1660             CXXFLAGS=""
1661          fi
1662       fi
1663       if test "$kde_use_debug_define" = "yes"; then
1664          CXXFLAGS="$CXXFLAGS -DNDEBUG"
1665       fi
1666     fi
1668     if test "$GXX" = "yes"; then
1669        CXXFLAGS="$CXXFLAGS"
1670        
1671        if test "$kde_use_debug_code" = "yes"; then
1672          CXXFLAGS="$CXXFLAGS -Wall -Wno-long-long -Wpointer-arith -Wmissing-prototypes"
1673        fi
1675        if test "$kde_use_strict_options" = "yes"; then
1676         CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align -Woverloaded-virtual"
1677        fi
1679        if test "$kde_very_strict" = "yes"; then
1680          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion"
1681        fi
1682     fi
1683   fi  
1685     case "$host" in
1686       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
1687     esac    
1688   
1689     AC_PROVIDE(AC_PROG_CXXCPP)
1691     AC_MSG_CHECKING(how to run the C++ preprocessor)
1692     if test -z "$CXXCPP"; then
1693       AC_CACHE_VAL(ac_cv_prog_CXXCPP,
1694       [
1695          AC_LANG_SAVE[]dnl
1696          AC_LANG_CPLUSPLUS[]dnl
1697          CXXCPP="${CXX-g++} -E"
1698          AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
1699          ac_cv_prog_CXXCPP="$CXXCPP"
1700          AC_LANG_RESTORE[]dnl
1701      ])dnl
1702      CXXCPP="$ac_cv_prog_CXXCPP"
1703      fi
1704     AC_MSG_RESULT($CXXCPP)
1705     AC_SUBST(CXXCPP)dnl
1708 dnl just a wrapper to clean up configure.in
1709 AC_DEFUN(KDE_PROG_LIBTOOL,
1711 AC_REQUIRE([AC_CHECK_COMPILERS])
1712 AC_REQUIRE([AC_ENABLE_SHARED])
1713 AC_REQUIRE([AC_ENABLE_STATIC])
1714 dnl libtool is only for C, so I must force him
1715 dnl to find the correct flags for C++
1716 kde_save_cc=$CC
1717 kde_save_cflags="$CFLAGS"
1718 CC=$CXX
1719 CFLAGS="$CXXFLAGS"
1720 AC_LANG_SAVE
1721 AC_LANG_C
1722 AM_PROG_LIBTOOL dnl for libraries
1723 AC_REQUIRE([AC_PROG_LIBTOOL]) dnl faking :=/
1724 LIBTOOL="$LIBTOOL --silent"
1725 dnl AC_SUBST(LIBTOOL)
1726 AC_LANG_RESTORE
1727 CC=$kde_save_cc
1728 CFLAGS="$kde_save_cflags"
1731 AC_DEFUN(KDE_DO_IT_ALL,
1733 AC_CANONICAL_SYSTEM 
1734 AC_ARG_PROGRAM 
1735 AM_INIT_AUTOMAKE($1, $2)
1736 AM_DISABLE_LIBRARIES
1737 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
1738 AC_CHECK_COMPILERS
1739 KDE_PROG_LIBTOOL
1740 AM_KDE_WITH_NLS
1741 AC_PATH_KDE
1744 AC_DEFUN(AC_CHECK_RPATH,
1746 AC_MSG_CHECKING(for rpath)
1747 AC_ARG_ENABLE(rpath,
1748       [  --disable-rpath         do not use the rpath feature of ld],
1749       USE_RPATH=$enableval, USE_RPATH=yes)
1751 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
1753   KDE_RPATH="-rpath \$(kde_libraries)"
1755   if test -n "$qt_libraries"; then
1756     KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)"
1757   fi
1758   dnl $x_libraries is set to /usr/lib in case
1759   if test -n "$X_LDFLAGS"; then 
1760     KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)"
1761   fi
1762   if test -n "$KDE_EXTRA_RPATH"; then
1763     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
1764   fi
1765 fi 
1766 AC_SUBST(KDE_EXTRA_RPATH)
1767 AC_SUBST(KDE_RPATH)
1768 AC_MSG_RESULT($USE_RPATH)
1771 dnl Check for the type of the third argument of getsockname
1772 AC_DEFUN(AC_CHECK_KSIZE_T,
1773 [AC_MSG_CHECKING(for the third argument of getsockname)  
1774 AC_CACHE_VAL(ac_cv_ksize_t,
1775 AC_LANG_SAVE
1776 AC_LANG_CPLUSPLUS
1777 [AC_TRY_COMPILE([
1778 #include <sys/types.h>
1779 #include <sys/socket.h>
1781 socklen_t a=0; 
1782 getsockname(0,(struct sockaddr*)0, &a);
1784 ac_cv_ksize_t=socklen_t,
1785 ac_cv_ksize_t=)
1786 if test -z "$ac_cv_ksize_t"; then
1787 ac_safe_cxxflags="$CXXFLAGS"
1788 if test "$GCC" = "yes"; then
1789   CXXFLAGS="-Werror $CXXFLAGS"
1791 AC_TRY_COMPILE([
1792 #include <sys/types.h>
1793 #include <sys/socket.h>
1795 int a=0; 
1796 getsockname(0,(struct sockaddr*)0, &a);
1798 ac_cv_ksize_t=int,
1799 ac_cv_ksize_t=size_t)
1800 CXXFLAGS="$ac_safe_cxxflags"
1802 AC_LANG_RESTORE
1805 if test -z "$ac_cv_ksize_t"; then
1806   ac_cv_ksize_t=int
1809 AC_MSG_RESULT($ac_cv_ksize_t)
1810 AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t, 
1811       [Define the type of the third argument for getsockname]
1816 dnl This is a merge of some macros out of the gettext aclocal.m4
1817 dnl since we don't need anything, I took the things we need
1818 dnl the copyright for them is:
1819 dnl >
1820 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
1821 dnl This Makefile.in is free software; the Free Software Foundation
1822 dnl gives unlimited permission to copy and/or distribute it,
1823 dnl with or without modifications, as long as this notice is preserved.
1825 dnl This program is distributed in the hope that it will be useful,
1826 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1827 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1828 dnl PARTICULAR PURPOSE.
1829 dnl >
1830 dnl for this file it is relicensed under LGPL
1832 AC_DEFUN(AM_KDE_WITH_NLS,
1833   [AC_MSG_CHECKING([whether NLS is requested])
1834     dnl Default is enabled NLS
1835     AC_ARG_ENABLE(nls,
1836       [  --disable-nls           do not use Native Language Support],
1837       USE_NLS=$enableval, USE_NLS=yes)
1838     AC_MSG_RESULT($USE_NLS)
1839     AC_SUBST(USE_NLS)
1841     dnl If we use NLS figure out what method
1842     if test "$USE_NLS" = "yes"; then
1843       AC_DEFINE(ENABLE_NLS, 1, [Define if NLS is requested])
1845       AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, 
1846          [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
1847       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1849       if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
1850         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
1851         GMSGFMT=":"
1852       fi
1853       MSGFMT=$GMSGFMT
1854       AC_SUBST(GMSGFMT)
1855       AC_SUBST(MSGFMT)
1857       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
1858         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1860       dnl Test whether we really found GNU xgettext.
1861       if test "$XGETTEXT" != ":"; then
1862         dnl If it is no GNU xgettext we define it as : so that the
1863         dnl Makefiles still can work.
1864         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1865           : ;
1866         else
1867           AC_MSG_RESULT(
1868             [found xgettext programs is not GNU xgettext; ignore it])
1869           XGETTEXT=":"
1870         fi
1871       fi
1872      AC_SUBST(XGETTEXT)
1873     fi
1875   ])
1877 # Search path for a program which passes the given test.
1878 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1880 # serial 1
1881 # Stephan Kulow: I appended a _KDE against name conflicts
1883 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
1884 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1885 AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
1886 [# Extract the first word of "$2", so it can be a program name with args.
1887 set dummy $2; ac_word=[$]2
1888 AC_MSG_CHECKING([for $ac_word])
1889 AC_CACHE_VAL(ac_cv_path_$1,
1890 [case "[$]$1" in
1891   /*)
1892   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1893   ;;
1894   *)
1895   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1896   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1897     test -z "$ac_dir" && ac_dir=.
1898     if test -f $ac_dir/$ac_word; then
1899       if [$3]; then
1900         ac_cv_path_$1="$ac_dir/$ac_word"
1901         break
1902       fi
1903     fi
1904   done
1905   IFS="$ac_save_ifs"
1906 dnl If no 4th arg is given, leave the cache variable unset,
1907 dnl so AC_PATH_PROGS will keep looking.
1908 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1909 ])dnl
1910   ;;
1911 esac])dnl
1912 $1="$ac_cv_path_$1"
1913 if test -n "[$]$1"; then
1914   AC_MSG_RESULT([$]$1)
1915 else
1916   AC_MSG_RESULT(no)
1918 AC_SUBST($1)dnl
1922 # Check whether LC_MESSAGES is available in <locale.h>.
1923 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1925 # serial 1
1927 AC_DEFUN(AM_LC_MESSAGES,
1928   [if test $ac_cv_header_locale_h = yes; then
1929     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1930       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1931        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1932     if test $am_cv_val_LC_MESSAGES = yes; then
1933       AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
1934     fi
1935   fi])
1937 dnl From Jim Meyering.
1938 dnl FIXME: migrate into libit.
1940 AC_DEFUN(AM_FUNC_OBSTACK,
1941 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
1942  [AC_TRY_LINK([#include "obstack.h"],
1943               [struct obstack *mem;obstack_free(mem,(char *) 0)],
1944               am_cv_func_obstack=yes,
1945               am_cv_func_obstack=no)])
1946  if test $am_cv_func_obstack = yes; then
1947    AC_DEFINE(HAVE_OBSTACK)
1948  else
1949    LIBOBJS="$LIBOBJS obstack.o"
1950  fi
1953 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
1954 dnl FIXME: Migrate into libit
1956 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
1957 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1958  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1959               am_cv_lib_error_at_line=yes,
1960               am_cv_lib_error_at_line=no)])
1961  if test $am_cv_lib_error_at_line = no; then
1962    LIBOBJS="$LIBOBJS error.o"
1963  fi
1964  AC_SUBST(LIBOBJS)dnl
1967 # Macro to add for using GNU gettext.
1968 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1970 # serial 1
1971 # Stephan Kulow: I put a KDE in it to avoid name conflicts
1973 AC_DEFUN(AM_KDE_GNU_GETTEXT,
1974   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1975    AC_REQUIRE([AC_PROG_RANLIB])dnl
1976    AC_REQUIRE([AC_HEADER_STDC])dnl
1977    AC_REQUIRE([AC_C_INLINE])dnl
1978    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1979    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1980    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1981    AC_REQUIRE([AC_FUNC_MMAP])dnl
1982    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
1983    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1984 unistd.h values.h alloca.h])
1985    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1986 __argz_count __argz_stringify __argz_next])
1988    AC_MSG_CHECKING(for stpcpy)
1989    AC_CACHE_VAL(kde_cv_func_stpcpy,
1990    [
1991    kde_safe_cxxflags=$CXXFLAGS
1992    CXXFLAGS="-Wmissing-prototypes -Werror"
1993    AC_LANG_SAVE
1994    AC_LANG_CPLUSPLUS
1995    AC_TRY_COMPILE([
1996    #include <string.h>
1997    ],
1998    [
1999    char buffer[200];
2000    stpcpy(buffer, buffer);
2001    ],
2002    kde_cv_func_stpcpy=yes,
2003    kde_cv_func_stpcpy=no)
2004    AC_LANG_RESTORE
2005    CXXFLAGS=$kde_safe_cxxflags
2006    ])
2007    AC_MSG_RESULT($kde_cv_func_stpcpy)
2008    if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
2009      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
2010    fi
2012    AM_LC_MESSAGES
2014    if test "x$CATOBJEXT" != "x"; then
2015      if test "x$ALL_LINGUAS" = "x"; then
2016        LINGUAS=
2017      else
2018        AC_MSG_CHECKING(for catalogs to be installed)
2019        NEW_LINGUAS=
2020        for lang in ${LINGUAS=$ALL_LINGUAS}; do
2021          case "$ALL_LINGUAS" in
2022           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2023          esac
2024        done
2025        LINGUAS=$NEW_LINGUAS
2026        AC_MSG_RESULT($LINGUAS)
2027      fi
2029      dnl Construct list of names of catalog files to be constructed.
2030      if test -n "$LINGUAS"; then
2031        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2032      fi
2033    fi
2035   ])
2037 AC_DEFUN(AC_HAVE_XPM,
2038  [AC_REQUIRE_CPP()dnl
2039   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2041  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
2042  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
2044  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
2045         xpm_test=$withval, xpm_test="yes")
2046  if test "x$xpm_test" = xno; then
2047    ac_cv_have_xpm=no
2048  else
2049    AC_MSG_CHECKING(for XPM)
2050    AC_CACHE_VAL(ac_cv_have_xpm,
2051    [
2052     AC_LANG_C
2053     ac_save_ldflags="$LDFLAGS"
2054     ac_save_cflags="$CFLAGS"
2055     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
2056     CFLAGS="$CFLAGS $X_INCLUDES"
2057     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
2058     AC_TRY_LINK([#include <X11/xpm.h>],[],
2059         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
2060     LDFLAGS="$ac_save_ldflags"
2061     CFLAGS="$ac_save_cflags"
2062    ])dnl
2064   if test "$ac_cv_have_xpm" = no; then
2065     AC_MSG_RESULT(no)
2066     XPM_LDFLAGS=""
2067     XPMINC=""
2068     $2
2069   else
2070     AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
2071     if test "$XPM_LDFLAGS" = ""; then
2072        XPMLIB='-lXpm $(LIB_X11)'
2073     else
2074        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
2075     fi
2076     if test "$XPM_INCLUDE" = ""; then
2077        XPMINC=""
2078     else
2079        XPMINC="-I$XPM_INCLUDE"
2080     fi
2081     AC_MSG_RESULT(yes)
2082     $1
2083   fi
2084  fi
2085  AC_SUBST(XPMINC)
2086  AC_SUBST(XPMLIB)
2087 ]) 
2089 AC_DEFUN(KDE_CHECK_LIBDL,
2091 AC_CHECK_LIB(dl, dlopen, [
2092 LIBDL="-ldl"
2093 ac_cv_have_dlfcn=yes
2096 AC_CHECK_LIB(dld, shl_unload, [
2097 LIBDL="-ldld"
2098 ac_cv_have_shload=yes
2101 AC_SUBST(LIBDL)
2104 AC_DEFUN(KDE_CHECK_DLOPEN,
2106 KDE_CHECK_LIBDL
2107 AC_CHECK_HEADERS(dlfcn.h dl.h)
2108 if test "$ac_cv_header_dlfcn_h" = "no"; then
2109   ac_cv_have_dlfcn=no
2112 if test "$ac_cv_header_dl_h" = "no"; then
2113   ac_cv_have_shload=no
2116 enable_dlopen=no
2117 AC_ARG_ENABLE(dlopen,
2118 [  --disable-dlopen        link staticly [default=no]] ,
2119 [if test "$enableval" = yes; then
2120   enable_dlopen=yes
2121 fi],
2122 enable_dlopen=yes)
2124 # override the user's opinion, if we know it better ;)
2125 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
2126   enable_dlopen=no
2129 if test "$ac_cv_have_dlfcn" = "yes"; then
2130   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
2133 if test "$ac_cv_have_shload" = "yes"; then
2134   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
2137 if test "$enable_dlopen" = no ; then
2138   test -n "$1" && eval $1
2139 else
2140   test -n "$2" && eval $2
2145 AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
2147 KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
2148 KDE_PROG_LIBTOOL
2149 AC_MSG_CHECKING([dynamic loading])
2150 eval "`egrep '^build_libtool_libs=' libtool`"
2151 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
2152   dynamic_loading=yes
2153   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
2154 else
2155   dynamic_loading=no
2157 AC_MSG_RESULT($dynamic_loading)
2158 if test "$dynamic_loading" = "yes"; then
2159   $1
2160 else
2161   $2
2165 AC_DEFUN(KDE_ADD_INCLUDES,
2167 if test -z "$1"; then 
2168   test_include="Pix.h"
2169 else
2170   test_include="$1"
2173 AC_MSG_CHECKING([for libg++ ($test_include)])
2175 AC_CACHE_VAL(kde_cv_libgpp_includes,
2177 kde_cv_libgpp_includes=no
2179    for ac_dir in               \
2180                                \
2181      /usr/include/g++          \
2182      /usr/include              \
2183      /usr/unsupported/include  \
2184      /opt/include              \
2185      $extra_include            \
2186      ; \
2187    do
2188      if test -r "$ac_dir/$test_include"; then
2189        kde_cv_libgpp_includes=$ac_dir
2190        break
2191      fi
2192    done
2195 AC_MSG_RESULT($kde_cv_libgpp_includes)
2196 if test "$kde_cv_libgpp_includes" != "no"; then
2197   all_includes="-I$kde_cv_libgpp_includes $all_includes"
2207 AC_DEFUN(AC_FIND_QIMGIO,
2208    [AC_REQUIRE([AC_FIND_JPEG])
2209 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2210 AC_MSG_CHECKING([for qimgio])
2211 AC_CACHE_VAL(ac_cv_lib_qimgio,
2213 AC_LANG_SAVE
2214 AC_LANG_CPLUSPLUS
2215 ac_save_LIBS="$LIBS"
2216 ac_save_CXXFLAGS="$CXXFLAGS"
2217 LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
2218 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
2219 AC_TRY_RUN(dnl
2221 #include <qimageio.h>
2222 #include <qstring.h>
2223 int main() {
2224                 QString t = "hallo";
2225                 t.fill('t');
2226                 qInitImageIO();
2229             eval "ac_cv_lib_qimgio=yes",
2230             eval "ac_cv_lib_qimgio=no")
2231 LIBS="$ac_save_LIBS"
2232 CXXFLAGS="$ac_save_CXXFLAGS"
2233 AC_LANG_RESTORE
2234 ])dnl
2235 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
2236   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
2237   AC_MSG_RESULT(yes)
2238   AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
2239   AC_SUBST(LIBQIMGIO)
2240 else
2241   AC_MSG_RESULT(not found)
2245 AC_DEFUN(AM_DISABLE_LIBRARIES,
2247     AC_PROVIDE([AM_ENABLE_STATIC])
2248     AC_PROVIDE([AM_ENABLE_SHARED])
2249     enable_static=no
2250     enable_shared=yes
2255 AC_DEFUN(KDE_CHECK_NAMESPACES,
2257 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
2258 AC_LANG_SAVE
2259 AC_LANG_CPLUSPLUS
2260 AC_TRY_COMPILE([
2263 namespace Foo {
2264   extern int i;
2265   namespace Bar {
2266     extern int i;
2267   }
2270 int Foo::i = 0;
2271 int Foo::Bar::i = 1;
2273   AC_MSG_RESULT(yes)
2274   AC_DEFINE(HAVE_NAMESPACES)
2275 ], [
2276 AC_MSG_RESULT(no)
2278 AC_LANG_RESTORE
2281 AC_DEFUN(KDE_CHECK_NEWLIBS,
2286 dnl ------------------------------------------------------------------------
2287 dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
2288 dnl ------------------------------------------------------------------------
2290 AC_DEFUN(AC_CHECK_S_ISSOCK,
2292 AC_MSG_CHECKING(for S_ISSOCK)
2293 AC_CACHE_VAL(ac_cv_have_s_issock,
2295 AC_LANG_SAVE
2296 AC_LANG_C
2297 AC_TRY_LINK(
2299 #include <sys/stat.h>
2302 struct stat buff;
2303 int b = S_ISSOCK( buff.st_mode );
2305 ac_cv_have_s_issock=yes,
2306 ac_cv_have_s_issock=no)
2307 AC_LANG_RESTORE 
2309 AC_MSG_RESULT($ac_cv_have_s_issock)
2310 if test "$ac_cv_have_s_issock" = "yes"; then
2311   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
2315 dnl ------------------------------------------------------------------------
2316 dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
2317 dnl ------------------------------------------------------------------------
2319 AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
2321 AC_MSG_CHECKING(for MAXPATHLEN)
2322 AC_CACHE_VAL(ac_cv_maxpathlen,
2324 AC_LANG_C
2325 cat > conftest.$ac_ext <<EOF
2326 #include <stdio.h>
2327 #include <sys/param.h>
2328 #ifndef MAXPATHLEN
2329 #define MAXPATHLEN 1024
2330 #endif
2332 KDE_HELLO MAXPATHLEN
2336 ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
2338 if AC_TRY_EVAL(ac_try) && test -s conftest.out; then 
2339     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
2340 else
2341     ac_cv_maxpathlen=1024
2344 rm conftest.*
2347 AC_MSG_RESULT($ac_cv_maxpathlen)
2348 AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXLENPATH] )
2351 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2352 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
2353 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
2355 ## This program is free software; you can redistribute it and/or modify
2356 ## it under the terms of the GNU General Public License as published by
2357 ## the Free Software Foundation; either version 2 of the License, or
2358 ## (at your option) any later version.
2360 ## This program is distributed in the hope that it will be useful, but
2361 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2362 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2363 ## General Public License for more details.
2365 ## You should have received a copy of the GNU General Public License
2366 ## along with this program; if not, write to the Free Software
2367 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2369 ## As a special exception to the GNU General Public License, if you
2370 ## distribute this file as part of a program that contains a
2371 ## configuration script generated by Autoconf, you may include it under
2372 ## the same distribution terms that you use for the rest of that program.
2374 # serial 40 AC_PROG_LIBTOOL
2375 AC_DEFUN(AC_PROG_LIBTOOL,
2376 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
2378 # Save cache, so that ltconfig can load it
2379 AC_CACHE_SAVE
2381 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
2382 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
2383 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
2384 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
2385 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
2386 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
2387 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
2388 || AC_MSG_ERROR([libtool configure failed])
2390 # Reload cache, that may have been modified by ltconfig
2391 AC_CACHE_LOAD
2393 # This can be used to rebuild libtool when needed
2394 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
2396 # Always use our own libtool.
2397 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
2398 AC_SUBST(LIBTOOL)dnl
2400 # Redirect the config.log output again, so that the ltconfig log is not
2401 # clobbered by the next message.
2402 exec 5>>./config.log
2405 AC_DEFUN(AC_LIBTOOL_SETUP,
2406 [AC_PREREQ(2.13)dnl
2407 AC_REQUIRE([AC_ENABLE_SHARED])dnl
2408 AC_REQUIRE([AC_ENABLE_STATIC])dnl
2409 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
2410 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2411 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
2412 AC_REQUIRE([AC_PROG_RANLIB])dnl
2413 AC_REQUIRE([AC_PROG_CC])dnl
2414 AC_REQUIRE([AC_PROG_LD])dnl
2415 AC_REQUIRE([AC_PROG_NM])dnl
2416 AC_REQUIRE([AC_PROG_LN_S])dnl
2419 # Check for any special flags to pass to ltconfig.
2420 libtool_flags="--cache-file=$cache_file"
2421 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
2422 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
2423 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
2424 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
2425 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
2426 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
2427 [libtool_flags="$libtool_flags --enable-dlopen"])
2428 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
2429 [libtool_flags="$libtool_flags --enable-win32-dll"])
2430 AC_ARG_ENABLE(libtool-lock,
2431   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
2432 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
2433 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
2435 # Some flags need to be propagated to the compiler or linker for good
2436 # libtool support.
2437 case "$host" in
2438 *-*-irix6*)
2439   # Find out which ABI we are using.
2440   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
2441   if AC_TRY_EVAL(ac_compile); then
2442     case "`/usr/bin/file conftest.o`" in
2443     *32-bit*)
2444       LD="${LD-ld} -32"
2445       ;;
2446     *N32*)
2447       LD="${LD-ld} -n32"
2448       ;;
2449     *64-bit*)
2450       LD="${LD-ld} -64"
2451       ;;
2452     esac
2453   fi
2454   rm -rf conftest*
2455   ;;
2457 *-*-sco3.2v5*)
2458   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
2459   SAVE_CFLAGS="$CFLAGS"
2460   CFLAGS="$CFLAGS -belf"
2461   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
2462     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
2463   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
2464     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
2465     CFLAGS="$SAVE_CFLAGS"
2466   fi
2467   ;;
2469 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
2470 [*-*-cygwin* | *-*-mingw*)
2471   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
2472   AC_CHECK_TOOL(AS, as, false)
2473   AC_CHECK_TOOL(OBJDUMP, objdump, false)
2474   ;;
2476 esac
2479 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
2480 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
2482 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
2483 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
2485 # AC_ENABLE_SHARED - implement the --enable-shared flag
2486 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
2487 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2488 #   `yes'.
2489 AC_DEFUN(AC_ENABLE_SHARED, [dnl
2490 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
2491 AC_ARG_ENABLE(shared,
2492 changequote(<<, >>)dnl
2493 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
2494 changequote([, ])dnl
2495 [p=${PACKAGE-default}
2496 case "$enableval" in
2497 yes) enable_shared=yes ;;
2498 no) enable_shared=no ;;
2500   enable_shared=no
2501   # Look at the argument we got.  We use all the common list separators.
2502   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2503   for pkg in $enableval; do
2504     if test "X$pkg" = "X$p"; then
2505       enable_shared=yes
2506     fi
2507   done
2508   IFS="$ac_save_ifs"
2509   ;;
2510 esac],
2511 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
2514 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
2515 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2516 AC_ENABLE_SHARED(no)])
2518 # AC_ENABLE_STATIC - implement the --enable-static flag
2519 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
2520 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2521 #   `yes'.
2522 AC_DEFUN(AC_ENABLE_STATIC, [dnl
2523 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
2524 AC_ARG_ENABLE(static,
2525 changequote(<<, >>)dnl
2526 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
2527 changequote([, ])dnl
2528 [p=${PACKAGE-default}
2529 case "$enableval" in
2530 yes) enable_static=yes ;;
2531 no) enable_static=no ;;
2533   enable_static=no
2534   # Look at the argument we got.  We use all the common list separators.
2535   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2536   for pkg in $enableval; do
2537     if test "X$pkg" = "X$p"; then
2538       enable_static=yes
2539     fi
2540   done
2541   IFS="$ac_save_ifs"
2542   ;;
2543 esac],
2544 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
2547 # AC_DISABLE_STATIC - set the default static flag to --disable-static
2548 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2549 AC_ENABLE_STATIC(no)])
2552 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
2553 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
2554 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2555 #   `yes'.
2556 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
2557 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
2558 AC_ARG_ENABLE(fast-install,
2559 changequote(<<, >>)dnl
2560 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
2561 changequote([, ])dnl
2562 [p=${PACKAGE-default}
2563 case "$enableval" in
2564 yes) enable_fast_install=yes ;;
2565 no) enable_fast_install=no ;;
2567   enable_fast_install=no
2568   # Look at the argument we got.  We use all the common list separators.
2569   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2570   for pkg in $enableval; do
2571     if test "X$pkg" = "X$p"; then
2572       enable_fast_install=yes
2573     fi
2574   done
2575   IFS="$ac_save_ifs"
2576   ;;
2577 esac],
2578 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
2581 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
2582 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2583 AC_ENABLE_FAST_INSTALL(no)])
2585 # AC_PROG_LD - find the path to the GNU or non-GNU linker
2586 AC_DEFUN(AC_PROG_LD,
2587 [AC_ARG_WITH(gnu-ld,
2588 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
2589 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2590 AC_REQUIRE([AC_PROG_CC])dnl
2591 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2592 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
2593 ac_prog=ld
2594 if test "$ac_cv_prog_gcc" = yes; then
2595   # Check if gcc -print-prog-name=ld gives a path.
2596   AC_MSG_CHECKING([for ld used by GCC])
2597   ac_prog=`($CC -print-prog-name=ld) 2>&5`
2598   case "$ac_prog" in
2599     # Accept absolute paths.
2600 changequote(,)dnl
2601     [\\/]* | [A-Za-z]:[\\/]*)
2602       re_direlt='/[^/][^/]*/\.\./'
2603 changequote([,])dnl
2604       # Canonicalize the path of ld
2605       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2606       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2607         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2608       done
2609       test -z "$LD" && LD="$ac_prog"
2610       ;;
2611   "")
2612     # If it fails, then pretend we aren't using GCC.
2613     ac_prog=ld
2614     ;;
2615   *)
2616     # If it is relative, then search for the first ld in PATH.
2617     with_gnu_ld=unknown
2618     ;;
2619   esac
2620 elif test "$with_gnu_ld" = yes; then
2621   AC_MSG_CHECKING([for GNU ld])
2622 else
2623   AC_MSG_CHECKING([for non-GNU ld])
2625 AC_CACHE_VAL(ac_cv_path_LD,
2626 [if test -z "$LD"; then
2627   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2628   for ac_dir in $PATH; do
2629     test -z "$ac_dir" && ac_dir=.
2630     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2631       ac_cv_path_LD="$ac_dir/$ac_prog"
2632       # Check to see if the program is GNU ld.  I'd rather use --version,
2633       # but apparently some GNU ld's only accept -v.
2634       # Break only if it was the GNU/non-GNU ld that we prefer.
2635       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2636         test "$with_gnu_ld" != no && break
2637       else
2638         test "$with_gnu_ld" != yes && break
2639       fi
2640     fi
2641   done
2642   IFS="$ac_save_ifs"
2643 else
2644   ac_cv_path_LD="$LD" # Let the user override the test with a path.
2645 fi])
2646 LD="$ac_cv_path_LD"
2647 if test -n "$LD"; then
2648   AC_MSG_RESULT($LD)
2649 else
2650   AC_MSG_RESULT(no)
2652 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2653 AC_SUBST(LD)
2654 AC_PROG_LD_GNU
2657 AC_DEFUN(AC_PROG_LD_GNU,
2658 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
2659 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2660 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2661   ac_cv_prog_gnu_ld=yes
2662 else
2663   ac_cv_prog_gnu_ld=no
2664 fi])
2667 # AC_PROG_NM - find the path to a BSD-compatible name lister
2668 AC_DEFUN(AC_PROG_NM,
2669 [AC_MSG_CHECKING([for BSD-compatible nm])
2670 AC_CACHE_VAL(ac_cv_path_NM,
2671 [if test -n "$NM"; then
2672   # Let the user override the test.
2673   ac_cv_path_NM="$NM"
2674 else
2675   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2676   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
2677     test -z "$ac_dir" && ac_dir=.
2678     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
2679       # Check to see if the nm accepts a BSD-compat flag.
2680       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
2681       #   nm: unknown option "B" ignored
2682       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
2683         ac_cv_path_NM="$ac_dir/nm -B"
2684         break
2685       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
2686         ac_cv_path_NM="$ac_dir/nm -p"
2687         break
2688       else
2689         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
2690         continue # so that we can try to find one that supports BSD flags
2691       fi
2692     fi
2693   done
2694   IFS="$ac_save_ifs"
2695   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
2696 fi])
2697 NM="$ac_cv_path_NM"
2698 AC_MSG_RESULT([$NM])
2699 AC_SUBST(NM)
2702 # AC_CHECK_LIBM - check for math library
2703 AC_DEFUN(AC_CHECK_LIBM,
2704 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
2705 LIBM=
2706 case "$host" in
2707 *-*-beos* | *-*-cygwin*)
2708   # These system don't have libm
2709   ;;
2710 *-ncr-sysv4.3*)
2711   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
2712   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
2713   ;;
2715   AC_CHECK_LIB(m, main, LIBM="-lm")
2716   ;;
2717 esac
2720 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
2721 # the libltdl convenience library, adds --enable-ltdl-convenience to
2722 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
2723 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
2724 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
2725 # '${top_builddir}/' (note the single quotes!) if your package is not
2726 # flat, and, if you're not using automake, define top_builddir as
2727 # appropriate in the Makefiles.
2728 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2729   case "$enable_ltdl_convenience" in
2730   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
2731   "") enable_ltdl_convenience=yes
2732       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
2733   esac
2734   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
2735   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
2738 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
2739 # the libltdl installable library, and adds --enable-ltdl-install to
2740 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
2741 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
2742 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
2743 # '${top_builddir}/' (note the single quotes!) if your package is not
2744 # flat, and, if you're not using automake, define top_builddir as
2745 # appropriate in the Makefiles.
2746 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
2747 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2748   AC_CHECK_LIB(ltdl, main,
2749   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
2750   [if test x"$enable_ltdl_install" = xno; then
2751      AC_MSG_WARN([libltdl not installed, but installation disabled])
2752    else
2753      enable_ltdl_install=yes
2754    fi
2755   ])
2756   if test x"$enable_ltdl_install" = x"yes"; then
2757     ac_configure_args="$ac_configure_args --enable-ltdl-install"
2758     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
2759     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
2760   else
2761     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
2762     LIBLTDL="-lltdl"
2763     INCLTDL=
2764   fi
2767 dnl old names
2768 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
2769 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
2770 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
2771 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
2772 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
2773 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
2774 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
2776 dnl This is just to silence aclocal about the macro not being used
2777 ifelse([AC_DISABLE_FAST_INSTALL])dnl