Solaris' ln needs -s -f instead of -sf.
[kdbg.git] / acinclude.m4
blobd076665a01840ab920dd85edbc775e59226c3a5c
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 dnl get KDE pathnames from kdelibs
136 AC_DEFUN(KDE_GET_KDE_1_X_PATHS,
139 AC_LANG_SAVE
140 AC_LANG_CPLUSPLUS
141 ac_cxxflags_safe="$CXXFLAGS"
142 ac_ldflags_safe="$LDFLAGS"
143 ac_libs_safe="$LIBS"
145 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
146 LDFLAGS="-L$qt_libdir $all_libraries"
147 LIBS="$LIBS $LIBQT -lkdecore"
149 cat > conftest.$ac_ext <<EOF
150 #include <stdio.h>
151 #include "confdefs.h"
152 #include <kapp.h>
154 int main() {
155     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
156     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
157     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
158     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
159     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
160     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
161     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
162     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
163     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
164     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
165     printf("kde_wallpaperdir=\\"%s\\"\n",
166         KApplication::kde_wallpaperdir().data());
167     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
168     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
169     return 0;
170     }
173 if AC_TRY_EVAL(ac_link) && test -s conftest; then
174   eval `KDEDIR= ./conftest 2>&5`
175   KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
176 else
177   AC_MSG_ERROR([your system is not able to compile a small KDE application!
178 Check, if you installed the KDE header and library files correctly.])
181 rm -f conftest*
182 CXXFLAGS="$ac_cxxflags_safe"
183 LDFLAGS="$ac_ldflags_safe"
184 LIBS="$ac_libs_safe"
185 AC_LANG_RESTORE
188 AC_DEFUN(AC_CREATE_KFSSTND,
190 AC_REQUIRE([AC_CHECK_RPATH])
191 AC_REQUIRE([AC_CHECK_BOOL])
192 AC_MSG_CHECKING([for KDE paths])
193 kde_result=""
195 dnl get paths from kde installed on netbsd
196 dnl until now it's only valid for KDE 1.x
197 if test "$kde_qtver" = "1"; then
198   case $host in                   dnl this *is* NetBSD specific
199      *-*-netbsd* )
200         KDE_GET_KDE_1_X_PATHS
201      ;;
202   esac
205 AC_CACHE_VAL(kde_cv_all_paths,
207   if test -z "$kde_htmldir"; then
208     kde_htmldir='\$(prefix)/share/doc/HTML'
209   fi
210   if test -z "$kde_appsdir"; then
211     kde_appsdir='\$(prefix)/share/applnk'
212   fi
213   if test -z "$kde_icondir"; then
214     kde_icondir='\$(prefix)/share/icons'
215   fi
216   if test -z "$kde_sounddir"; then
217     kde_sounddir='\$(prefix)/share/sounds'
218   fi
219   if test -z "$kde_datadir"; then
220     kde_datadir='\$(prefix)/share/apps'
221   fi
222   if test -z "$kde_locale"; then
223     kde_locale='\$(prefix)/share/locale'
224   fi
225   if test -z "$kde_cgidir"; then
226     kde_cgidir='\$(exec_prefix)/cgi-bin'
227   fi
228   if test -z "$kde_confdir"; then
229     kde_confdir='\$(prefix)/share/config'
230   fi
231   if test -z "$kde_mimedir"; then
232     kde_mimedir='\$(prefix)/share/mimelnk'
233   fi
234   if test -z "$kde_toolbardir"; then
235     kde_toolbardir='\$(prefix)/share/toolbar'
236   fi
237   if test -z "$kde_wallpaperdir"; then
238     kde_wallpaperdir='\$(prefix)/share/wallpapers'
239   fi
240   if test -z "$kde_bindir"; then
241     kde_bindir='\$(exec_prefix)/bin'
242   fi
243   if test -z "$kde_servicesdir"; then
244     kde_servicesdir='\$(prefix)/share/services'
245   fi
246   if test -z "$kde_servicetypesdir"; then
247     kde_servicetypesdir='\$(prefix)/share/servicetypes'
248   fi
250   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
251         kde_htmldir=\"$kde_htmldir\" \
252         kde_appsdir=\"$kde_appsdir\" \
253         kde_icondir=\"$kde_icondir\" \
254         kde_sounddir=\"$kde_sounddir\" \
255         kde_datadir=\"$kde_datadir\" \
256         kde_locale=\"$kde_locale\" \
257         kde_cgidir=\"$kde_cgidir\" \
258         kde_confdir=\"$kde_confdir\" \
259         kde_mimedir=\"$kde_mimedir\" \
260         kde_toolbardir=\"$kde_toolbardir\" \
261         kde_wallpaperdir=\"$kde_wallpaperdir\" \
262         kde_bindir=\"$kde_bindir\" \
263         kde_servicesdir=\"$kde_servicesdir\" \
264         kde_servicetypesdir=\"$kde_servicetypesdir\" \
265         kde_result=defaults"
269 eval "$kde_cv_all_paths"
271 if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
272    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
273    test -z "$kde_datadir" || test -z "$kde_locale"  ||
274    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
275    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
276    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
277    test -z "$kde_servicesdir" ||
278    test -z "$kde_servicetypesdir" || test "$kde_have_all_paths" != "yes"; then
279   kde_have_all_paths=no
280   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
281 Since it had compiled and linked before, it must be a strange problem on your system.
282 Look at config.log for details. If you are not able to fix this, look at
283 http://www.kde.org/faq/installation.html or any www.kde.org mirror.
284 (If you're using an egcs version on Linux, you may update binutils!)
286 else
287   rm -f conftest*
288   AC_MSG_RESULT($kde_result)
291 bindir=$kde_bindir
295 AC_DEFUN(AC_SUBST_KFSSTND,
297 AC_SUBST(kde_htmldir)
298 AC_SUBST(kde_appsdir)
299 AC_SUBST(kde_icondir)
300 AC_SUBST(kde_sounddir)
301 AC_SUBST(kde_datadir)
302 AC_SUBST(kde_locale)
303 AC_SUBST(kde_cgidir)
304 AC_SUBST(kde_confdir)
305 AC_SUBST(kde_mimedir)
306 AC_SUBST(kde_toolbardir)
307 AC_SUBST(kde_wallpaperdir)
308 AC_SUBST(kde_bindir)
309 AC_SUBST(kde_servicesdir)
310 AC_SUBST(kde_servicetypesdir)
313 AC_DEFUN(KDE_MISC_TESTS,
315    AC_LANG_C
316    dnl Checks for libraries. 
317    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
318    AC_SUBST(LIBCOMPAT)
319    kde_have_crypt=
320    AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
321       AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
322         AC_MSG_WARN([you have no crypt in either libcrypt or libc. 
323 You should install libcrypt from another source or configure with PAM
324 support])
325         kde_have_crypt=no
326       ]))
327    AC_SUBST(LIBCRYPT)
328    if test $kde_have_crypt = yes; then
329       AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
330    fi 
331    AC_CHECK_KSIZE_T
332    AC_LANG_C
333    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
334    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
335       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
336         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
337    fi
338    AC_CHECK_FUNC(inet_ntoa)
339    if test $ac_cv_func_inet_ntoa = no; then
340      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
341    fi
342    AC_CHECK_FUNC(connect)
343    if test $ac_cv_func_connect = no; then
344       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
345         $X_EXTRA_LIBS)
346    fi
348    AC_CHECK_FUNC(remove)
349    if test $ac_cv_func_remove = no; then
350       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
351    fi
353    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
354    AC_CHECK_FUNC(shmat)
355    if test $ac_cv_func_shmat = no; then
356      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
357    fi
359    LIBSOCKET="$X_EXTRA_LIBS"
360    AC_SUBST(LIBSOCKET)
361    AC_SUBST(X_EXTRA_LIBS)
362    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
363    AC_SUBST(LIBUCB)
365    case $host in  dnl this *is* LynxOS specific
366    *-*-lynxos* )
367         AC_MSG_CHECKING([LynxOS header file wrappers])
368         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
369         AC_MSG_RESULT(disabled)
370         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
371          ;;
372     esac
374    AC_REQUIRE([KDE_CHECK_LIBDL])
377 dnl ------------------------------------------------------------------------
378 dnl Find the header files and libraries for X-Windows. Extended the 
379 dnl macro AC_PATH_X
380 dnl ------------------------------------------------------------------------
382 AC_DEFUN(K_PATH_X,
384 AC_REQUIRE([AC_PROG_CPP])
385 AC_MSG_CHECKING(for X)
386 AC_LANG_SAVE
387 AC_LANG_C
388 AC_CACHE_VAL(ac_cv_have_x,
389 [# One or both of the vars are not set, and there is no cached value.
390 if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
391    kde_x_includes=NO
392 else
393    kde_x_includes=$x_includes
395 if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
396    kde_x_libraries=NO
397 else
398    kde_x_libraries=$x_libraries
401 # below we use the standard autoconf calls
402 ac_x_libraries=$kde_x_libraries
403 ac_x_includes=$kde_x_includes
405 AC_PATH_X_DIRECT
406 AC_PATH_X_XMKMF
407 if test -z "$ac_x_includes"; then
408 ac_x_includes="."
410 if test -z "$ac_x_libraries"; then
411 ac_x_libraries="/usr/lib"
413 #from now on we use our own again 
415 # when the user already gave --x-includes, we ignore
416 # what the standard autoconf macros told us.
417 if test "$kde_x_includes" = NO; then
418   kde_x_includes=$ac_x_includes  
421 if test "$kde_x_includes" = NO; then
422   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
425 if test "$ac_x_libraries" = NO; then
426   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
429 # Record where we found X for the cache.
430 ac_cv_have_x="have_x=yes \
431          kde_x_includes=$kde_x_includes ac_x_libraries=$ac_x_libraries"
432 ])dnl
433 eval "$ac_cv_have_x"
435 if test "$have_x" != yes; then
436   AC_MSG_RESULT($have_x)
437   no_x=yes
438 else
439   AC_MSG_RESULT([libraries $ac_x_libraries, headers $kde_x_includes])
442 if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
443   X_INCLUDES=""
444   x_includes="."; dnl better than nothing :-
445  else
446   x_includes=$kde_x_includes
447   X_INCLUDES="-I$x_includes"
450 if test -z "$ac_x_libraries" || test "x$ac_x_libraries" = xNONE; then
451   X_LDFLAGS=""
452   x_libraries="/usr/lib"; dnl better than nothing :-
453  else
454   x_libraries=$ac_x_libraries
455   X_LDFLAGS="-L$x_libraries"
457 all_includes="$all_includes $X_INCLUDES"  
458 all_libraries="$all_libraries $X_LDFLAGS"  
460 AC_SUBST(X_INCLUDES)
461 AC_SUBST(X_LDFLAGS)
462 AC_SUBST(x_libraries)
463 AC_SUBST(x_includes)
465 # Check for libraries that X11R6 Xt/Xaw programs need.
466 ac_save_LDFLAGS="$LDFLAGS"
467 test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
468 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
469 # check for ICE first), but we must link in the order -lSM -lICE or
470 # we get undefined symbols.  So assume we have SM if we have ICE.
471 # These have to be linked with before -lX11, unlike the other
472 # libraries we check for below, so use a different variable.
473 #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
474 AC_CHECK_LIB(ICE, IceConnectionNumber,
475   [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS)
476 LDFLAGS="$ac_save_LDFLAGS"
478 AC_SUBST(X_PRE_LIBS)
480 LIB_X11='-lX11 $(LIBSOCKET)'
481 AC_SUBST(LIB_X11)
483 AC_MSG_CHECKING(for libXext)
484 AC_CACHE_VAL(kde_cv_have_libXext,
486 kde_ldflags_safe="$LDFLAGS"
487 kde_libs_safe="$LIBS"
489 LDFLAGS="$X_LDFLAGS $USER_LDFLAGS"
490 LIBS="-lXext -lX11 $LIBSOCKET"
492 AC_TRY_LINK([
493 #include <stdio.h>
496 printf("hello Xext\n");
498 kde_cv_have_libXext=yes,
499 kde_cv_have_libXext=no
500    )
502 LDFLAGS=$kde_ldflags_safe
503 LIBS=$kde_libs_safe
504  ])
506 AC_MSG_RESULT($kde_cv_have_libXext)
508 if test "kde_cv_have_libXext" = "no"; then
509   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
510 can't find it itself, we stop here assuming that make wouldn't find
511 them either.])
516 AC_LANG_RESTORE
519 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
521 AC_REQUIRE([KDE_USE_QT])
522 cat > conftest.$ac_ext <<EOF
523 #include "confdefs.h"
524 #include <qglobal.h>
525 #include <qapplication.h>
526 #include <qapp.h>
527 #include <qobjcoll.h>
529 if test "$kde_qtver" = "2"; then
530 cat >> conftest.$ac_ext <<EOF
531 #include <qstyle.h>
535 echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
536 cat >> conftest.$ac_ext <<EOF
537 #error 1
538 #endif
540 int main() {
542 if test "$kde_qtver" = "2"; then
543 cat >> conftest.$ac_ext <<EOF
544     QStringList *t = new QStringList();
547 cat >> conftest.$ac_ext <<EOF
548     return 0;
553 AC_DEFUN(KDE_USE_QT,
555 if test -z "$1"; then
556   kde_qtver=2
557 else
558   kde_qtver=$1
561 if test -z "$2"; then
562   if test $kde_qtver = 2; then
563     kde_qt_minversion=">= 2.0"
564    else
565     kde_qt_minversion=">= 1.42 and < 2.0"
566   fi
567 else
568    kde_qt_minversion=$2
571 if test -z "$3"; then
572     if test $kde_qtver = 2; then
573     kde_qt_verstring="QT_VERSION >= 200"
574    else
575     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
576   fi
577 else
578    kde_qt_verstring=$3
582 AC_DEFUN(KDE_CHECK_QT_DIRECT,
584 AC_REQUIRE([KDE_USE_QT])
585 AC_MSG_CHECKING([if Qt compiles without flags])
586 AC_CACHE_VAL(kde_cv_qt_direct,
588 AC_LANG_SAVE
589 AC_LANG_CPLUSPLUS
590 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
591 ac_LIBRARY_PATH="$LIBRARY_PATH"
592 ac_cxxflags_safe="$CXXFLAGS"
593 ac_ldflags_safe="$LDFLAGS"
594 ac_libs_safe="$LIBS"
596 CXXFLAGS="$CXXFLAGS -I$qt_includes"
597 LDFLAGS="$X_LDFLAGS"
598 LIBS="-lqt -lXext -lX11 $LIBSOCKET"
599 LD_LIBRARY_PATH=
600 export LD_LIBRARY_PATH
601 LIBRARY_PATH=
602 export LIBRARY_PATH
604 KDE_PRINT_QT_PROGRAM
606 if AC_TRY_EVAL(ac_link) && test -s conftest; then
607   kde_cv_qt_direct="yes"
608 else
609   kde_cv_qt_direct="no"
610   echo "configure: failed program was:" >&AC_FD_CC
611   cat conftest.$ac_ext >&AC_FD_CC
614 rm -f conftest*
615 CXXFLAGS="$ac_cxxflags_safe"
616 LDFLAGS="$ac_ldflags_safe"
617 LIBS="$ac_libs_safe"
619 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
620 export LD_LIBRARY_PATH
621 LIBRARY_PATH="$ac_LIBRARY_PATH"
622 export LIBRARY_PATH
623 AC_LANG_RESTORE
626 if test "$kde_cv_qt_direct" = "yes"; then
627   AC_MSG_RESULT(yes)
628   $1
629 else
630   AC_MSG_RESULT(no)
631   $2
635 dnl ------------------------------------------------------------------------
636 dnl Try to find the Qt headers and libraries.
637 dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
638 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
639 dnl ------------------------------------------------------------------------
641 AC_DEFUN(AC_PATH_QT_1_3,
643 AC_REQUIRE([K_PATH_X])
644 AC_REQUIRE([KDE_USE_QT])
645 LIBQT="-lqt"
646 if test $kde_qtver = 2; then
647   
648   AC_REQUIRE([AC_FIND_PNG])
649   LIBQT="$LIBQT $LIBPNG"
651 AC_MSG_CHECKING([for Qt])
653 LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSOCKET"
654 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
655 qt_libraries=""
656 qt_includes=""
657 AC_ARG_WITH(qt-dir,
658     [  --with-qt-dir=DIR       where the root of Qt is installed ],
659     [  ac_qt_includes="$withval"/include
660        ac_qt_libraries="$withval"/lib
661        ac_qt_bindir="$withval"/bin
662     ])
664 AC_ARG_WITH(qt-includes,
665     [  --with-qt-includes=DIR  where the Qt includes are. ],
666     [  
667        ac_qt_includes="$withval"
668     ])
669     
670 kde_qt_libs_given=no
672 AC_ARG_WITH(qt-libraries,
673     [  --with-qt-libraries=DIR where the Qt library is installed.],
674     [  ac_qt_libraries="$withval"
675        kde_qt_libs_given=yes
676     ])
678 AC_CACHE_VAL(ac_cv_have_qt,
679 [#try to guess Qt locations
681 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 /usr/X11R6/include/qt $x_includes"
682 test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
683 qt_incdirs="$ac_qt_includes $qt_incdirs"
684 AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
685 ac_qt_includes="$qt_incdir"
687 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"
688 test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
689 if test ! "$ac_qt_libraries" = "NO"; then
690   qt_libdirs="$ac_qt_libraries $qt_libdirs"
693 test=NONE
694 qt_libdir=NONE
695 for dir in $qt_libdirs; do
696   try="ls -1 $dir/libqt*"
697   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
698 done
700 ac_qt_libraries="$qt_libdir"
702 AC_LANG_SAVE
703 AC_LANG_CPLUSPLUS
705 ac_cxxflags_safe="$CXXFLAGS"
706 ac_ldflags_safe="$LDFLAGS"
707 ac_libs_safe="$LIBS"
709 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
710 LDFLAGS="-L$qt_libdir $all_libraries"
711 LIBS="$LIBS $LIBQT"
713 KDE_PRINT_QT_PROGRAM
715 if AC_TRY_EVAL(ac_link) && test -s conftest; then
716   rm -f conftest*
717 else
718   echo "configure: failed program was:" >&AC_FD_CC
719   cat conftest.$ac_ext >&AC_FD_CC
720   ac_qt_libraries="NO"
722 rm -f conftest*
723 CXXFLAGS="$ac_cxxflags_safe"
724 LDFLAGS="$ac_ldflags_safe"
725 LIBS="$ac_libs_safe"
727 AC_LANG_RESTORE
728 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
729   ac_cv_have_qt="have_qt=no"
730   ac_qt_notfound=""
731   if test "$ac_qt_includes" = NO; then
732     if test "$ac_qt_libraries" = NO; then
733       ac_qt_notfound="(headers and libraries)";
734     else
735       ac_qt_notfound="(headers)";
736     fi
737   else
738     ac_qt_notfound="(libraries)";
739   fi
741   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! ]);
742 else
743   have_qt="yes"
747 eval "$ac_cv_have_qt"
749 if test "$have_qt" != yes; then
750   AC_MSG_RESULT([$have_qt]);
751 else
752   ac_cv_have_qt="have_qt=yes \
753     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
754   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
755   
756   qt_libraries="$ac_qt_libraries"
757   qt_includes="$ac_qt_includes"
760 if test ! "$kde_qt_libs_given" = "yes"; then
761 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
764 AC_SUBST(qt_libraries)
765 AC_SUBST(qt_includes)
767 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
768  QT_INCLUDES="";
769 else
770  QT_INCLUDES="-I$qt_includes"
771  all_includes="$QT_INCLUDES $all_includes"
774 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
775  QT_LDFLAGS=""
776 else
777  QT_LDFLAGS="-L$qt_libraries"
778  all_libraries="$QT_LDFLAGS $all_libraries"
781 AC_SUBST(QT_INCLUDES)
782 AC_SUBST(QT_LDFLAGS)
783 AC_PATH_QT_MOC
785 LIB_QT='-lqt $(LIBPNG) -lXext $(LIB_X11) $(X_PRE_LIBS)'
786 AC_SUBST(LIB_QT)
790 AC_DEFUN(AC_PATH_QT,
792 AC_PATH_QT_1_3
795 dnl ------------------------------------------------------------------------
796 dnl Now, the same with KDE
797 dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
798 dnl and $(kde_includes) will be the kdehdrlocation (if needed)
799 dnl ------------------------------------------------------------------------
801 AC_DEFUN(AC_BASE_PATH_KDE,
803 AC_PREREQ([2.13])
804 AC_REQUIRE([KDE_MISC_TESTS])
805 AC_REQUIRE([AC_PATH_QT])dnl
806 AC_CHECK_RPATH
807 AC_MSG_CHECKING([for KDE])
809 if test "${prefix}" != NONE; then
810   kde_includes=${prefix}/include
811   ac_kde_includes=$prefix/include
813   if test "${exec_prefix}" != NONE; then
814     kde_libraries=${exec_prefix}/lib
815     ac_kde_libraries=$exec_prefix/lib
816   else
817     kde_libraries=${prefix}/lib
818     ac_kde_libraries=$prefix/lib
819   fi
820 else
821   ac_kde_includes=
822   ac_kde_libraries=
823   kde_libraries=""
824   kde_includes=""
827 AC_CACHE_VAL(ac_cv_have_kde,
828 [#try to guess kde locations
830 if test -z "$1"; then
832 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"
833 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
834 kde_incdirs="$ac_kde_includes $kde_incdirs"
835 AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
836 ac_kde_includes="$kde_incdir"
838 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
839   AC_MSG_ERROR([
840 in the prefix, you've chosen, are no KDE headers installed. This will fail.
841 So, check this please and use another prefix!])
844 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"
845 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
846 kde_libdirs="$ac_kde_libraries $kde_libdirs"
847 AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
848 ac_kde_libraries="$kde_libdir"
850 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
851 AC_MSG_ERROR([
852 in the prefix, you've chosen, are no KDE libraries installed. This will fail.
853 So, check this please and use another prefix!])
855 ac_kde_libraries="$kde_libdir"
857 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
858   ac_cv_have_kde="have_kde=no"
859 else
860   ac_cv_have_kde="have_kde=yes \
861     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
864 else dnl test -z $1 
865   
866   ac_cv_have_kde="have_kde=no"
869 ])dnl
871 eval "$ac_cv_have_kde"
873 if test "$have_kde" != "yes"; then
874  if test "${prefix}" = NONE; then
875   ac_kde_prefix="$ac_default_prefix"
876  else
877   ac_kde_prefix="$prefix"
878  fi
879  if test "$exec_prefix" = NONE; then
880   ac_kde_exec_prefix="$ac_kde_prefix"
881   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
882  else
883   ac_kde_exec_prefix="$exec_prefix"
884   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
885  fi
887  kde_libraries="${ac_kde_exec_prefix}/lib"
888  kde_includes=${ac_kde_prefix}/include
890 else
891   ac_cv_have_kde="have_kde=yes \
892     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
893   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
894   
895   kde_libraries="$ac_kde_libraries"
896   kde_includes="$ac_kde_includes"
898 AC_SUBST(kde_libraries)
899 AC_SUBST(kde_includes)
901 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
902  KDE_INCLUDES=""
903 else
904  KDE_INCLUDES="-I$kde_includes"
905  all_includes="$KDE_INCLUDES $all_includes"
908 if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
909  KDE_LDFLAGS=""
910 else
911  KDE_LDFLAGS="-L$kde_libraries"
912  all_libraries="$KDE_LDFLAGS $all_libraries"
915 AC_SUBST(KDE_LDFLAGS)
916 AC_SUBST(KDE_INCLUDES)
918 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
920 AC_SUBST(all_includes)
921 AC_SUBST(all_libraries)
925 AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
927 AC_MSG_CHECKING(for extra includes)
928 AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
929                           adds non standard include paths], 
930   kde_use_extra_includes="$withval",
931   kde_use_extra_includes=NONE
933 kde_extra_includes=
934 if test -n "$kde_use_extra_includes" && \
935    test "$kde_use_extra_includes" != "NONE"; then
937    ac_save_ifs=$IFS
938    IFS=':'
939    for dir in $kde_use_extra_includes; do
940      kde_extra_includes="$kde_extra_includes $dir"
941      all_includes="$all_includes -I$dir"
942      USER_INCLUDES="$USER_INCLUDES -I$dir"
943    done
944    IFS=$ac_save_ifs
945    kde_use_extra_includes="added"
946 else
947    kde_use_extra_includes="no"
949 AC_SUBST(USER_INCLUDES)
951 AC_MSG_RESULT($kde_use_extra_includes)
953 kde_extra_libs=
954 AC_MSG_CHECKING(for extra libs)
955 AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths], 
956   kde_use_extra_libs=$withval,
957   kde_use_extra_libs=NONE
959 if test -n "$kde_use_extra_libs" && \
960    test "$kde_use_extra_libs" != "NONE"; then
962    ac_save_ifs=$IFS
963    IFS=':'
964    for dir in $kde_use_extra_libs; do
965      kde_extra_libs="$kde_extra_libs $dir"
966      all_libraries="$all_libraries -L$dir"
967      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
968      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
969    done
970    IFS=$ac_save_ifs
971    kde_use_extra_libs="added"
972 else
973    kde_use_extra_libs="no"
976 AC_SUBST(USER_LDFLAGS)
978 AC_MSG_RESULT($kde_use_extra_libs)
982 AC_DEFUN(KDE_CHECK_KIMGIO,
984    AC_REQUIRE([AC_BASE_PATH_KDE])
985    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
986    AC_REQUIRE([AC_FIND_TIFF])
987    AC_REQUIRE([AC_FIND_JPEG]) 
988    AC_REQUIRE([AC_FIND_PNG]) 
989    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
990    
991    if test "$1" = "existance"; then
992      AC_LANG_SAVE
993      AC_LANG_CPLUSPLUS
994      kde_save_LIBS="$LIBS"
995      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
996      AC_CHECK_LIB(kimgio, kimgioRegister, [
997       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
998       LIBS="$kde_save_LIBS"
999       AC_LANG_RESTORE   
1000    else
1001       LIBKIMGIO_EXISTS=yes
1002    fi
1004    if test "$LIBKIMGIO_EXISTS" = "yes"; then
1005      LIB_KIMGIO='-lkimgio'
1006    else
1007      LIB_KIMGIO=''
1008    fi
1009    AC_SUBST(LIB_KIMGIO)
1010    
1011    LIB_KHTML='-lkhtml'
1012    AC_SUBST(LIB_KHTML)
1015 AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
1017    AC_REQUIRE([KDE_MISC_TESTS])
1018    AC_REQUIRE([KDE_CHECK_LIBDL])
1019    AC_REQUIRE([K_PATH_X])
1021 if test $kde_qtver = 2; then
1022    LIB_KDECORE='-lkdecore'
1023    AC_SUBST(LIB_KDECORE)
1024    LIB_KDEUI='-lkdeui'
1025    AC_SUBST(LIB_KDEUI)
1026    LIB_KFORMULA='-lformula'
1027    AC_SUBST(LIB_KFORMULA)
1028    LIB_KIO='-lkio'
1029    AC_SUBST(LIB_KIO)
1030    LIB_SMB='-lsmb'
1031    AC_SUBST(LIB_SMB)
1032    LIB_KFILE='-lkfile'
1033    AC_SUBST(LIB_KFILE)
1034    LIB_KAB='-lkab'
1035    AC_SUBST(LIB_KAB)
1036    LIB_MEDIATOOL='-lmediatool'
1037    AC_SUBST(LIB_MEDIATOOL) 
1038 else
1039    LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
1040    AC_SUBST(LIB_KDECORE)
1041    LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
1042    AC_SUBST(LIB_KDEUI)
1043    LIB_KFM='-lkfm $(LIB_KDECORE)'
1044    AC_SUBST(LIB_KFM)
1045    LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
1046    AC_SUBST(LIB_KFILE)
1047    LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
1048    AC_SUBST(LIB_KAB)
1049    LIB_MEDIATOOL='-lmediatool $(LIB_KDECORE)'
1050    AC_SUBST(LIB_MEDIATOOL)
1054 AC_DEFUN(AC_PATH_KDE,
1056   AC_BASE_PATH_KDE
1057   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
1058   [
1059   if test "$enableval" = "no"; 
1060     then ac_use_path_checking="default"
1061     else ac_use_path_checking=""
1062   fi
1063   ], [ac_use_path_checking="default"]
1064   )
1066   AC_CREATE_KFSSTND($ac_use_path_checking)
1068   AC_SUBST_KFSSTND
1069   KDE_CREATE_LIBS_ALIASES
1072 dnl slightly changed version of AC_CHECK_FUNC(setenv)
1073 AC_DEFUN(AC_CHECK_SETENV,
1074 [AC_MSG_CHECKING([for setenv])
1075 AC_CACHE_VAL(ac_cv_func_setenv,
1076 [AC_LANG_C
1077 AC_TRY_LINK(
1078 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
1079 dnl which includes <sys/select.h> which contains a prototype for
1080 dnl select.  Similarly for bzero.
1081 [#include <assert.h>
1082 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
1083 extern "C"
1084 #endif
1085 ])dnl
1086 [/* We use char because int might match the return type of a gcc2
1087     builtin and then its argument prototype would still apply.  */
1088 #include <stdlib.h>
1089 ], [
1090 /* The GNU C library defines this for functions which it implements
1091     to always fail with ENOSYS.  Some functions are actually named
1092     something starting with __ and the normal name is an alias.  */
1093 #if defined (__stub_$1) || defined (__stub___$1)
1094 choke me
1095 #else
1096 setenv("TEST", "alle", 1);
1097 #endif
1098 ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
1100 if test "$ac_cv_func_setenv" = "yes"; then
1101   AC_MSG_RESULT(yes)
1102   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV, 1, [Define if you have setenv])
1103 else
1104   AC_MSG_RESULT(no)
1108 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
1110 AC_LANG_CPLUSPLUS
1111 save_CXXFLAGS="$CXXFLAGS"
1112 if test "$GCC" = "yes"; then
1113 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1115 AC_MSG_CHECKING(for getdomainname)
1116 AC_CACHE_VAL(ac_cv_func_getdomainname,
1118 AC_TRY_COMPILE([
1119 #include <stdlib.h>
1120 #include <unistd.h>
1123 char buffer[200];
1124 getdomainname(buffer, 200);
1126 ac_cv_func_getdomainname=yes,
1127 ac_cv_func_getdomainname=no)
1129 AC_MSG_RESULT($ac_cv_func_getdomainname)
1130 if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1131   AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname])
1133 CXXFLAGS="$save_CXXFLAGS"
1136 AC_DEFUN(AC_CHECK_GETHOSTNAME,
1138 AC_LANG_CPLUSPLUS
1139 save_CXXFLAGS="$CXXFLAGS"
1140 if test "$GCC" = "yes"; then
1141 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1144 AC_MSG_CHECKING([for gethostname])
1145 AC_CACHE_VAL(ac_cv_func_gethostname,
1147 AC_TRY_COMPILE([
1148 #include <stdlib.h>
1149 #include <unistd.h>
1152 char buffer[200];
1153 gethostname(buffer, 200);
1155 ac_cv_func_gethostname=yes,
1156 ac_cv_func_gethostname=no)
1158 AC_MSG_RESULT($ac_cv_func_gethostname)
1159 if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
1160   AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have getdomainname])
1162 CXXFLAGS="$save_CXXFLAGS"
1165 AC_DEFUN(AC_CHECK_USLEEP,
1167 AC_LANG_CPLUSPLUS
1169 AC_MSG_CHECKING([for usleep])
1170 AC_CACHE_VAL(ac_cv_func_usleep,
1172 ac_libs_safe="$LIBS"
1173 LIBS="$LIBS $LIBUCB"
1174 AC_TRY_LINK([
1175 #include <stdlib.h>
1176 #include <unistd.h>
1179 usleep(200);
1181 ac_cv_func_usleep=yes,
1182 ac_cv_func_usleep=no)
1184 AC_MSG_RESULT($ac_cv_func_usleep)
1185 if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then
1186   AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function])
1188 LIBS="$ac_libs_safe"
1191 AC_DEFUN(AC_CHECK_RANDOM,
1193 AC_LANG_CPLUSPLUS
1195 AC_MSG_CHECKING([for random])
1196 AC_CACHE_VAL(ac_cv_func_random,
1198 ac_libs_safe="$LIBS"
1199 LIBS="$LIBS $LIBUCB"
1200 AC_TRY_LINK([
1201 #include <stdlib.h>
1204 random();
1206 ac_cv_func_random=yes,
1207 ac_cv_func_random=no)
1209 AC_MSG_RESULT($ac_cv_func_random)
1210 if eval "test \"`echo $ac_cv_func_random`\" = yes"; then
1211   AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random])
1213 LIBS="$ac_libs_safe"
1216 AC_DEFUN(AC_CHECK_FGETPWENT,
1218 AC_LANG_CPLUSPLUS
1219 save_CXXFLAGS="$CXXFLAGS"
1220 if test "$GCC" = "yes"; then
1221 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1223 AC_MSG_CHECKING(for fgetpwent)
1224 AC_CACHE_VAL(ac_cv_func_fgetpwent,
1226 AC_TRY_COMPILE([
1227 #include <stdlib.h>
1228 #include <unistd.h>
1229 #include <pwd.h>
1232 passwd *p;
1233 FILE *f;
1234 p = fgetpwent(f);
1236 ac_cv_func_fgetpwent=yes,
1237 ac_cv_func_fgetpwent=no)
1239 AC_MSG_RESULT($ac_cv_func_fgetpwent)
1240 if eval "test \"`echo $ac_cv_func_fgetpwent`\" = yes"; then
1241   AC_DEFINE(HAVE_FGETPWENT)
1243 CXXFLAGS="$save_CXXFLAGS"
1246 AC_DEFUN(AC_CHECK_FGETGRENT,
1248 AC_LANG_CPLUSPLUS
1249 save_CXXFLAGS="$CXXFLAGS"
1250 if test "$GCC" = "yes"; then
1251 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1253 AC_MSG_CHECKING(for fgetgrent)
1254 AC_CACHE_VAL(ac_cv_func_fgetgrent,
1256 AC_TRY_COMPILE([
1257 #include <stdlib.h>
1258 #include <unistd.h>
1259 #include <grp.h>
1262 group *g;
1263 FILE *f;
1264 g = fgetgrent(f);
1266 ac_cv_func_fgetgrent=yes,
1267 ac_cv_func_fgetgrent=no)
1269 AC_MSG_RESULT($ac_cv_func_fgetgrent)
1270 if eval "test \"`echo $ac_cv_func_fgetgrent`\" = yes"; then
1271   AC_DEFINE(HAVE_FGETGRENT)
1273 CXXFLAGS="$save_CXXFLAGS"
1276 AC_DEFUN(AC_FIND_GIF,
1277    [AC_MSG_CHECKING([for giflib])
1278 AC_CACHE_VAL(ac_cv_lib_gif,
1279 [ac_save_LIBS="$LIBS"
1280 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
1281 AC_TRY_LINK(dnl
1283 #ifdef __cplusplus
1284 extern "C" {
1285 #endif
1286 int GifLastError(void);
1287 #ifdef __cplusplus
1289 #endif
1290 /* We use char because int might match the return type of a gcc2
1291     builtin and then its argument prototype would still apply.  */
1293             [return GifLastError();],
1294             eval "ac_cv_lib_gif=yes",
1295             eval "ac_cv_lib_gif=no")
1296 LIBS="$ac_save_LIBS"
1297 ])dnl
1298 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1299   AC_MSG_RESULT(yes)
1300   AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
1301 else
1302   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
1307 AC_DEFUN(KDE_FIND_JPEG_HELPER,
1309 AC_MSG_CHECKING([for libjpeg$2])
1310 AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
1312 AC_LANG_C
1313 ac_save_LIBS="$LIBS"
1314 LIBS="$all_libraries -ljpeg$2 -lm"
1315 AC_TRY_LINK(
1316 [/* Override any gcc2 internal prototype to avoid an error.  */
1317 struct jpeg_decompress_struct;
1318 typedef struct jpeg_decompress_struct * j_decompress_ptr;
1319 typedef int size_t;
1320 #ifdef __cplusplus
1321 extern "C" {
1322 #endif
1323     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1324                                     int version, size_t structsize);
1325 #ifdef __cplusplus
1327 #endif
1328 /* We use char because int might match the return type of a gcc2
1329     builtin and then its argument prototype would still apply.  */
1331             [jpeg_CreateDecompress(0L, 0, 0);],
1332             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
1333             eval "ac_cv_lib_jpeg_$1=no")
1334 LIBS="$ac_save_LIBS"
1337 if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
1338   LIBJPEG="$ac_cv_lib_jpeg_$1"
1339   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
1340 else
1341   AC_MSG_RESULT(no)
1342   $3
1347 AC_DEFUN(AC_FIND_JPEG,
1349 KDE_FIND_JPEG_HELPER(6b, 6b,
1350    KDE_FIND_JPEG_HELPER(normal, [],
1351     [
1352 dnl what to do, if the normal way fails:
1353         if test -f "$kde_libraries/libjpeg.so"; then
1354            test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
1355            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1356         else if test -f "$kde_libraries/libjpeg.sl"; then
1357            test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
1358            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"      
1359         else if test -f "$kde_libraries/libjpeg.a"; then
1360            test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
1361            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1362         else
1363           AC_MSG_ERROR([
1364 You need the development package of libjpeg6b. You can get
1365 a source package of libjpeg from http://www.ijg.org/
1367         fi
1368       fi
1369    fi
1371    LIBJPEG=$ac_cv_lib_jpeg
1374 AC_SUBST(LIBJPEG)
1375 AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
1379 AC_DEFUN(AC_FIND_ZLIB,
1381 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1382 AC_MSG_CHECKING([for libz])
1383 AC_CACHE_VAL(ac_cv_lib_z,
1385 AC_LANG_C
1386 kde_save_LIBS="$LIBS"
1387 LIBS="$all_libraries -lz $LIBSOCKET"
1388 kde_save_CFLAGS="$CFLAGS"
1389 CFLAGS="$CFLAGS $all_includes"
1390 AC_TRY_LINK(dnl
1392 #include<zlib.h>
1394             [return (zlibVersion() == ZLIB_VERSION); ],
1395             eval "ac_cv_lib_z='-lz'",
1396             eval "ac_cv_lib_z=no")
1397 LIBS="$kde_save_LIBS"
1398 CFLAGS="$kde_save_CFLAGS"
1399 ])dnl
1400 if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
1401   AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
1402   LIBZ="$ac_cv_lib_z"
1403   AC_SUBST(LIBZ)
1404   AC_MSG_RESULT($ac_cv_lib_z)
1405 else
1406   AC_MSG_RESULT(no)
1407   LIBZ=""
1408   AC_SUBST(LIBZ)
1412 AC_DEFUN(KDE_TRY_TIFFLIB,
1414 AC_MSG_CHECKING([for libtiff $1])
1416 AC_CACHE_VAL(kde_cv_libtiff_$1, 
1418 AC_LANG_C
1419 kde_save_LIBS="$LIBS"
1420 LIBS="$all_libraries -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
1421 kde_save_CFLAGS="$CFLAGS"
1422 CFLAGS="$CFLAGS $all_includes"
1424 AC_TRY_LINK(dnl
1426 #include<tiffio.h>
1428     [return (TIFFOpen( "", "r") == 0); ],
1430     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
1431 ], [
1432     kde_cv_libtiff_$1=no
1435 LIBS="$kde_save_LIBS"
1436 CFLAGS="$kde_save_CFLAGS"
1440 if test "$kde_cv_libtiff_$1" = "no"; then
1441     AC_MSG_RESULT(no)
1442     LIBTIFF=""
1443     $3
1444 else
1445     LIBTIFF="$kde_cv_libtiff_$1"
1446     AC_MSG_RESULT(yes)
1447     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
1448     $2
1453 AC_DEFUN(AC_FIND_TIFF,
1455 AC_REQUIRE([K_PATH_X])
1456 AC_REQUIRE([AC_FIND_ZLIB])
1457 AC_REQUIRE([AC_FIND_JPEG])
1458 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1460 KDE_TRY_TIFFLIB(tiff, [],
1461    KDE_TRY_TIFFLIB(tiff34))
1463 AC_SUBST(LIBTIFF)
1467 AC_DEFUN(AC_FIND_PNG,
1469 AC_REQUIRE([AC_FIND_ZLIB])
1470 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1471 AC_MSG_CHECKING([for libpng])
1472 AC_CACHE_VAL(ac_cv_lib_png,
1474 kde_save_LIBS="$LIBS"
1475 LIBS="$LIBS $all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
1476 kde_save_CFLAGS="$CFLAGS"
1477 CFLAGS="$CFLAGS $all_includes"
1478 AC_LANG_C
1479 AC_TRY_LINK(dnl
1480     [
1481     #include<png.h>
1482     ],
1483     [
1484     png_structp png_ptr = png_create_read_struct(  /* image ptr */
1485                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1486     return( png_ptr != 0 ); 
1487     ],
1488     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
1489     eval "ac_cv_lib_png=no"
1491 LIBS="$kde_save_LIBS"
1492 CFLAGS="$kde_save_CFLAGS"
1493 ])dnl
1494 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
1495   AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
1496   LIBPNG="$ac_cv_lib_png"
1497   AC_SUBST(LIBPNG)
1498   AC_MSG_RESULT($ac_cv_lib_png)
1499 else
1500   AC_MSG_RESULT(no)
1501   LIBPNG=""
1502   AC_SUBST(LIBPNG)
1506 AC_DEFUN(AC_CHECK_BOOL,
1508         AC_MSG_CHECKING([for bool])
1509         AC_CACHE_VAL(ac_cv_have_bool,
1510         [
1511                 AC_LANG_CPLUSPLUS
1512                 AC_TRY_COMPILE([],
1513                  [bool aBool = true;],
1514                  [ac_cv_have_bool="yes"],
1515                  [ac_cv_have_bool="no"])
1516         ]) dnl end AC_CHECK_VAL
1517         AC_MSG_RESULT($ac_cv_have_bool)
1518         if test "$ac_cv_have_bool" = "yes"; then
1519                 AC_DEFINE(HAVE_BOOL, 1, [Define if the C++ compiler supports BOOL])
1520         fi 
1523 AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
1525 AC_MSG_CHECKING(if you need GNU extensions)
1526 AC_CACHE_VAL(ac_cv_gnu_extensions,
1528 cat > conftest.c << EOF
1529 #include <features.h>
1531 #ifdef __GNU_LIBRARY__
1533 #endif
1536 if (eval "$ac_cpp conftest.c") 2>&5 |
1537   egrep "yes" >/dev/null 2>&1; then
1538   rm -rf conftest*
1539   ac_cv_gnu_extensions=yes
1540 else
1541   ac_cv_gnu_extensions=no
1545 AC_MSG_RESULT($ac_cv_gnu_extensions)
1546 if test "$ac_cv_gnu_extensions" = "yes"; then
1547   AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
1551 AC_DEFUN(AC_CHECK_COMPILERS,
1553   dnl this is somehow a fat lie, but prevents other macros from double checking
1554   AC_PROVIDE([AC_PROG_CC])
1555   AC_PROVIDE([AC_PROG_CPP])
1556   AC_ARG_ENABLE(debug,[  --enable-debug          creates debugging code [default=no]],
1557   [ 
1558    if test $enableval = "no"; dnl 
1559      then 
1560        kde_use_debug_code="no"
1561        kde_use_debug_define=yes
1562      else 
1563        kde_use_debug_code="yes"
1564        kde_use_debug_define=no
1565    fi
1566   ], [kde_use_debug_code="no"
1567       kde_use_debug_define=no
1568     ])
1570   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
1571    [ 
1572     if test $enableval = "no"; then 
1573          kde_use_strict_options="no"
1574        else 
1575          kde_use_strict_options="yes"
1576     fi
1577    ], [kde_use_strict_options="no"])
1579 dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
1580   AC_MSG_CHECKING(for a C-Compiler)
1581   dnl if there is one, print out. if not, don't matter
1582   AC_MSG_RESULT($CC) 
1584   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
1585   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
1586   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
1587   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
1589   AC_PROG_CC_WORKS
1590   AC_PROG_CC_GNU
1592   if test $ac_cv_prog_gcc = yes; then
1593     GCC=yes
1594   else
1595     GCC=
1596   fi
1598   if test -z "$CFLAGS"; then
1599     if test "$kde_use_debug_code" = "yes"; then
1600       AC_PROG_CC_G
1601       if test $ac_cv_prog_cc_g = yes; then
1602         CFLAGS="-g"
1603       fi
1604     else
1605       if test "$GCC" = "yes"; then
1606         CFLAGS="-O2"
1607       else
1608         CFLAGS=""
1609       fi
1610       if test "$kde_use_debug_define" = "yes"; then
1611          CFLAGS="$CFLAGS -DNDEBUG"
1612       fi
1613     fi
1615     if test "$GCC" = "yes"; then
1616      CFLAGS="$CFLAGS"
1618      if test "$kde_use_strict_options" = "yes"; then
1619         CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
1620      fi
1621     fi
1623   fi
1625   case "$host" in 
1626   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
1627   esac
1629   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
1630      LDFLAGS="-s"
1631   fi
1634 dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
1635 dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
1637   AC_MSG_CHECKING(how to run the C preprocessor)
1638   # On Suns, sometimes $CPP names a directory.
1639   if test -n "$CPP" && test -d "$CPP"; then
1640     CPP=
1641   fi
1642   if test -z "$CPP"; then
1643   AC_CACHE_VAL(ac_cv_prog_CPP,
1644   [  # This must be in double quotes, not single quotes, because CPP may get
1645     # substituted into the Makefile and "${CC-cc}" will confuse make.
1646     CPP="${CC-cc} -E"
1647     # On the NeXT, cc -E runs the code through the compiler's parser,
1648     # not just through cpp.
1649     dnl Use a header file that comes with gcc, so configuring glibc    
1650     dnl with a fresh cross-compiler works.
1651     AC_TRY_CPP([#include <assert.h>
1652     Syntax Error], ,
1653     CPP="${CC-cc} -E -traditional-cpp"
1654     AC_TRY_CPP([#include <assert.h>
1655     Syntax Error], , CPP=/lib/cpp))
1656     ac_cv_prog_CPP="$CPP"])dnl
1657     CPP="$ac_cv_prog_CPP"
1658   else
1659     ac_cv_prog_CPP="$CPP"
1660   fi
1661   AC_MSG_RESULT($CPP)
1662   AC_SUBST(CPP)dnl
1665   AC_MSG_CHECKING(for a C++-Compiler)
1666   dnl if there is one, print out. if not, don't matter
1667   AC_MSG_RESULT($CXX) 
1669   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
1670   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
1671   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
1672   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
1673   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
1675   AC_PROG_CXX_WORKS
1676   AC_PROG_CXX_GNU
1678   if test $ac_cv_prog_gxx = yes; then
1679     GXX=yes
1680   else
1681     AC_MSG_CHECKING(whether we are using SPARC CC)
1682     GXX=
1683     cat > conftest.C << EOF
1684 #ifdef __SUNPRO_CC
1685    yes;
1686 #endif
1689     ac_try="$CXX -E conftest.C"
1690     if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
1691       ac_cv_prog_CC=yes
1692     else
1693       ac_cv_prog_CC=no
1694     fi
1695     AC_MSG_RESULT($ac_cv_prog_CC)
1696     if test "$ac_cv_prog_CC" = "yes"; then
1697       AC_MSG_ERROR([Sparc CC doesn't work on KDE sources at least til version
1698 4.2. This compiler has several problems accepting legal C++ code 
1699 including the builtin C++ type bool. Since KDE is a freeware project,
1700 we decided, that we don't want to support that broken compilers. 
1702 If you really want to see support for Sparc CC within KDE, make reasonable
1703 patches and join the KDE project. More information about KDE can be found
1704 on www.kde.org])
1705     fi
1706   fi
1708   if test -z "$CXXFLAGS"; then 
1709     if test "$kde_use_debug_code" = "yes"; then
1710       AC_PROG_CXX_G
1711       if test $ac_cv_prog_cxx_g = yes; then
1712         CXXFLAGS="-g"
1713       fi
1714       if test "$ac_cv_prog_CC" = "yes"; then
1715         CXXFLAGS="$CXXFLAGS -pto"
1716       fi
1717     else
1718       if test "$GXX" = "yes"; then
1719          CXXFLAGS="-O2"
1720       else
1721          if test "$ac_cv_prog_CC" = "yes"; then
1722             CXXFLAGS="-pto -O2"
1723          else
1724             CXXFLAGS=""
1725          fi
1726       fi
1727       if test "$kde_use_debug_define" = "yes"; then
1728          CXXFLAGS="$CXXFLAGS -DNDEBUG"
1729       fi
1730     fi
1732     if test "$GXX" = "yes"; then
1733        CXXFLAGS="$CXXFLAGS"
1734        
1735        if test "$kde_use_debug_code" = "yes"; then
1736          CXXFLAGS="$CXXFLAGS -Wall -Wno-long-long -Wpointer-arith -Wmissing-prototypes"
1737        fi
1739        if test "$kde_use_strict_options" = "yes"; then
1740         CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align -Woverloaded-virtual"
1741        fi
1743        if test "$kde_very_strict" = "yes"; then
1744          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion"
1745        fi
1746     fi
1747   fi  
1749     case "$host" in
1750       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
1751     esac    
1752   
1753     AC_PROVIDE(AC_PROG_CXXCPP)
1755     AC_MSG_CHECKING(how to run the C++ preprocessor)
1756     if test -z "$CXXCPP"; then
1757       AC_CACHE_VAL(ac_cv_prog_CXXCPP,
1758       [
1759          AC_LANG_SAVE[]dnl
1760          AC_LANG_CPLUSPLUS[]dnl
1761          CXXCPP="${CXX-g++} -E"
1762          AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
1763          ac_cv_prog_CXXCPP="$CXXCPP"
1764          AC_LANG_RESTORE[]dnl
1765      ])dnl
1766      CXXCPP="$ac_cv_prog_CXXCPP"
1767      fi
1768     AC_MSG_RESULT($CXXCPP)
1769     AC_SUBST(CXXCPP)dnl
1772 dnl just a wrapper to clean up configure.in
1773 AC_DEFUN(KDE_PROG_LIBTOOL,
1775 AC_REQUIRE([AC_CHECK_COMPILERS])
1776 AC_REQUIRE([AC_ENABLE_SHARED])
1777 AC_REQUIRE([AC_ENABLE_STATIC])
1778 dnl libtool is only for C, so I must force him
1779 dnl to find the correct flags for C++
1780 kde_save_cc=$CC
1781 kde_save_cflags="$CFLAGS"
1782 CC=$CXX
1783 CFLAGS="$CXXFLAGS"
1784 AC_LANG_SAVE
1785 AC_LANG_C
1786 AM_PROG_LIBTOOL dnl for libraries
1787 AC_REQUIRE([AC_PROG_LIBTOOL]) dnl faking :=/
1788 LIBTOOL="$LIBTOOL --silent"
1789 dnl AC_SUBST(LIBTOOL)
1790 AC_LANG_RESTORE
1791 CC=$kde_save_cc
1792 CFLAGS="$kde_save_cflags"
1795 AC_DEFUN(KDE_DO_IT_ALL,
1797 AC_CANONICAL_SYSTEM 
1798 AC_ARG_PROGRAM 
1799 AM_INIT_AUTOMAKE($1, $2)
1800 AM_DISABLE_LIBRARIES
1801 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
1802 AC_CHECK_COMPILERS
1803 KDE_PROG_LIBTOOL
1804 AM_KDE_WITH_NLS
1805 AC_PATH_KDE
1808 AC_DEFUN(AC_CHECK_RPATH,
1810 AC_MSG_CHECKING(for rpath)
1811 AC_ARG_ENABLE(rpath,
1812       [  --disable-rpath         do not use the rpath feature of ld],
1813       USE_RPATH=$enableval, USE_RPATH=yes)
1815 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
1817   KDE_RPATH="-rpath \$(kde_libraries)"
1819   if test -n "$qt_libraries"; then
1820     KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)"
1821   fi
1822   dnl $x_libraries is set to /usr/lib in case
1823   if test -n "$X_LDFLAGS"; then 
1824     KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)"
1825   fi
1826   if test -n "$KDE_EXTRA_RPATH"; then
1827     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
1828   fi
1829 fi 
1830 AC_SUBST(KDE_EXTRA_RPATH)
1831 AC_SUBST(KDE_RPATH)
1832 AC_MSG_RESULT($USE_RPATH)
1835 dnl Check for the type of the third argument of getsockname
1836 AC_DEFUN(AC_CHECK_KSIZE_T,
1837 [AC_MSG_CHECKING(for the third argument of getsockname)  
1838 AC_CACHE_VAL(ac_cv_ksize_t,
1839 AC_LANG_SAVE
1840 AC_LANG_CPLUSPLUS
1841 [AC_TRY_COMPILE([
1842 #include <sys/types.h>
1843 #include <sys/socket.h>
1845 socklen_t a=0; 
1846 getsockname(0,(struct sockaddr*)0, &a);
1848 ac_cv_ksize_t=socklen_t,
1849 ac_cv_ksize_t=)
1850 if test -z "$ac_cv_ksize_t"; then
1851 ac_safe_cxxflags="$CXXFLAGS"
1852 if test "$GCC" = "yes"; then
1853   CXXFLAGS="-Werror $CXXFLAGS"
1855 AC_TRY_COMPILE([
1856 #include <sys/types.h>
1857 #include <sys/socket.h>
1859 int a=0; 
1860 getsockname(0,(struct sockaddr*)0, &a);
1862 ac_cv_ksize_t=int,
1863 ac_cv_ksize_t=size_t)
1864 CXXFLAGS="$ac_safe_cxxflags"
1866 AC_LANG_RESTORE
1869 if test -z "$ac_cv_ksize_t"; then
1870   ac_cv_ksize_t=int
1873 AC_MSG_RESULT($ac_cv_ksize_t)
1874 AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t, 
1875       [Define the type of the third argument for getsockname]
1880 dnl This is a merge of some macros out of the gettext aclocal.m4
1881 dnl since we don't need anything, I took the things we need
1882 dnl the copyright for them is:
1883 dnl >
1884 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
1885 dnl This Makefile.in is free software; the Free Software Foundation
1886 dnl gives unlimited permission to copy and/or distribute it,
1887 dnl with or without modifications, as long as this notice is preserved.
1889 dnl This program is distributed in the hope that it will be useful,
1890 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1891 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1892 dnl PARTICULAR PURPOSE.
1893 dnl >
1894 dnl for this file it is relicensed under LGPL
1896 AC_DEFUN(AM_KDE_WITH_NLS,
1897   [AC_MSG_CHECKING([whether NLS is requested])
1898     dnl Default is enabled NLS
1899     AC_ARG_ENABLE(nls,
1900       [  --disable-nls           do not use Native Language Support],
1901       USE_NLS=$enableval, USE_NLS=yes)
1902     AC_MSG_RESULT($USE_NLS)
1903     AC_SUBST(USE_NLS)
1905     dnl If we use NLS figure out what method
1906     if test "$USE_NLS" = "yes"; then
1907       AC_DEFINE(ENABLE_NLS, 1, [Define if NLS is requested])
1909       AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, 
1910          [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
1911       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1913       if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
1914         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
1915         GMSGFMT=":"
1916       fi
1917       MSGFMT=$GMSGFMT
1918       AC_SUBST(GMSGFMT)
1919       AC_SUBST(MSGFMT)
1921       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
1922         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1924       dnl Test whether we really found GNU xgettext.
1925       if test "$XGETTEXT" != ":"; then
1926         dnl If it is no GNU xgettext we define it as : so that the
1927         dnl Makefiles still can work.
1928         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1929           : ;
1930         else
1931           AC_MSG_RESULT(
1932             [found xgettext programs is not GNU xgettext; ignore it])
1933           XGETTEXT=":"
1934         fi
1935       fi
1936      AC_SUBST(XGETTEXT)
1937     fi
1939   ])
1941 # Search path for a program which passes the given test.
1942 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1944 # serial 1
1945 # Stephan Kulow: I appended a _KDE against name conflicts
1947 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
1948 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1949 AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
1950 [# Extract the first word of "$2", so it can be a program name with args.
1951 set dummy $2; ac_word=[$]2
1952 AC_MSG_CHECKING([for $ac_word])
1953 AC_CACHE_VAL(ac_cv_path_$1,
1954 [case "[$]$1" in
1955   /*)
1956   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1957   ;;
1958   *)
1959   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1960   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1961     test -z "$ac_dir" && ac_dir=.
1962     if test -f $ac_dir/$ac_word; then
1963       if [$3]; then
1964         ac_cv_path_$1="$ac_dir/$ac_word"
1965         break
1966       fi
1967     fi
1968   done
1969   IFS="$ac_save_ifs"
1970 dnl If no 4th arg is given, leave the cache variable unset,
1971 dnl so AC_PATH_PROGS will keep looking.
1972 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1973 ])dnl
1974   ;;
1975 esac])dnl
1976 $1="$ac_cv_path_$1"
1977 if test -n "[$]$1"; then
1978   AC_MSG_RESULT([$]$1)
1979 else
1980   AC_MSG_RESULT(no)
1982 AC_SUBST($1)dnl
1986 # Check whether LC_MESSAGES is available in <locale.h>.
1987 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1989 # serial 1
1991 AC_DEFUN(AM_LC_MESSAGES,
1992   [if test $ac_cv_header_locale_h = yes; then
1993     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1994       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1995        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1996     if test $am_cv_val_LC_MESSAGES = yes; then
1997       AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
1998     fi
1999   fi])
2001 dnl From Jim Meyering.
2002 dnl FIXME: migrate into libit.
2004 AC_DEFUN(AM_FUNC_OBSTACK,
2005 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
2006  [AC_TRY_LINK([#include "obstack.h"],
2007               [struct obstack *mem;obstack_free(mem,(char *) 0)],
2008               am_cv_func_obstack=yes,
2009               am_cv_func_obstack=no)])
2010  if test $am_cv_func_obstack = yes; then
2011    AC_DEFINE(HAVE_OBSTACK)
2012  else
2013    LIBOBJS="$LIBOBJS obstack.o"
2014  fi
2017 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
2018 dnl FIXME: Migrate into libit
2020 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
2021 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
2022  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
2023               am_cv_lib_error_at_line=yes,
2024               am_cv_lib_error_at_line=no)])
2025  if test $am_cv_lib_error_at_line = no; then
2026    LIBOBJS="$LIBOBJS error.o"
2027  fi
2028  AC_SUBST(LIBOBJS)dnl
2031 # Macro to add for using GNU gettext.
2032 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2034 # serial 1
2035 # Stephan Kulow: I put a KDE in it to avoid name conflicts
2037 AC_DEFUN(AM_KDE_GNU_GETTEXT,
2038   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2039    AC_REQUIRE([AC_PROG_RANLIB])dnl
2040    AC_REQUIRE([AC_HEADER_STDC])dnl
2041    AC_REQUIRE([AC_C_INLINE])dnl
2042    AC_REQUIRE([AC_TYPE_OFF_T])dnl
2043    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2044    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2045    AC_REQUIRE([AC_FUNC_MMAP])dnl
2046    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
2047    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2048 unistd.h values.h alloca.h])
2049    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2050 __argz_count __argz_stringify __argz_next])
2052    AC_MSG_CHECKING(for stpcpy)
2053    AC_CACHE_VAL(kde_cv_func_stpcpy,
2054    [
2055    kde_safe_cxxflags=$CXXFLAGS
2056    CXXFLAGS="-Wmissing-prototypes -Werror"
2057    AC_LANG_SAVE
2058    AC_LANG_CPLUSPLUS
2059    AC_TRY_COMPILE([
2060    #include <string.h>
2061    ],
2062    [
2063    char buffer[200];
2064    stpcpy(buffer, buffer);
2065    ],
2066    kde_cv_func_stpcpy=yes,
2067    kde_cv_func_stpcpy=no)
2068    AC_LANG_RESTORE
2069    CXXFLAGS=$kde_safe_cxxflags
2070    ])
2071    AC_MSG_RESULT($kde_cv_func_stpcpy)
2072    if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
2073      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
2074    fi
2076    AM_LC_MESSAGES
2078    if test "x$CATOBJEXT" != "x"; then
2079      if test "x$ALL_LINGUAS" = "x"; then
2080        LINGUAS=
2081      else
2082        AC_MSG_CHECKING(for catalogs to be installed)
2083        NEW_LINGUAS=
2084        for lang in ${LINGUAS=$ALL_LINGUAS}; do
2085          case "$ALL_LINGUAS" in
2086           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2087          esac
2088        done
2089        LINGUAS=$NEW_LINGUAS
2090        AC_MSG_RESULT($LINGUAS)
2091      fi
2093      dnl Construct list of names of catalog files to be constructed.
2094      if test -n "$LINGUAS"; then
2095        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2096      fi
2097    fi
2099   ])
2101 AC_DEFUN(AC_HAVE_XPM,
2102  [AC_REQUIRE_CPP()dnl
2103   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2105  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
2106  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
2108  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
2109         xpm_test=$withval, xpm_test="yes")
2110  if test "x$xpm_test" = xno; then
2111    ac_cv_have_xpm=no
2112  else
2113    AC_MSG_CHECKING(for XPM)
2114    AC_CACHE_VAL(ac_cv_have_xpm,
2115    [
2116     AC_LANG_C
2117     ac_save_ldflags="$LDFLAGS"
2118     ac_save_cflags="$CFLAGS"
2119     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
2120     CFLAGS="$CFLAGS $X_INCLUDES"
2121     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
2122     AC_TRY_LINK([#include <X11/xpm.h>],[],
2123         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
2124     LDFLAGS="$ac_save_ldflags"
2125     CFLAGS="$ac_save_cflags"
2126    ])dnl
2128   if test "$ac_cv_have_xpm" = no; then
2129     AC_MSG_RESULT(no)
2130     XPM_LDFLAGS=""
2131     XPMINC=""
2132     $2
2133   else
2134     AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
2135     if test "$XPM_LDFLAGS" = ""; then
2136        XPMLIB='-lXpm $(LIB_X11)'
2137     else
2138        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
2139     fi
2140     if test "$XPM_INCLUDE" = ""; then
2141        XPMINC=""
2142     else
2143        XPMINC="-I$XPM_INCLUDE"
2144     fi
2145     AC_MSG_RESULT(yes)
2146     $1
2147   fi
2148  fi
2149  AC_SUBST(XPMINC)
2150  AC_SUBST(XPMLIB)
2151 ]) 
2153 AC_DEFUN(KDE_CHECK_LIBDL,
2155 AC_CHECK_LIB(dl, dlopen, [
2156 LIBDL="-ldl"
2157 ac_cv_have_dlfcn=yes
2160 AC_CHECK_LIB(dld, shl_unload, [
2161 LIBDL="-ldld"
2162 ac_cv_have_shload=yes
2165 AC_SUBST(LIBDL)
2168 AC_DEFUN(KDE_CHECK_DLOPEN,
2170 KDE_CHECK_LIBDL
2171 AC_CHECK_HEADERS(dlfcn.h dl.h)
2172 if test "$ac_cv_header_dlfcn_h" = "no"; then
2173   ac_cv_have_dlfcn=no
2176 if test "$ac_cv_header_dl_h" = "no"; then
2177   ac_cv_have_shload=no
2180 enable_dlopen=no
2181 AC_ARG_ENABLE(dlopen,
2182 [  --disable-dlopen        link staticly [default=no]] ,
2183 [if test "$enableval" = yes; then
2184   enable_dlopen=yes
2185 fi],
2186 enable_dlopen=yes)
2188 # override the user's opinion, if we know it better ;)
2189 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
2190   enable_dlopen=no
2193 if test "$ac_cv_have_dlfcn" = "yes"; then
2194   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
2197 if test "$ac_cv_have_shload" = "yes"; then
2198   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
2201 if test "$enable_dlopen" = no ; then
2202   test -n "$1" && eval $1
2203 else
2204   test -n "$2" && eval $2
2209 AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
2211 KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
2212 KDE_PROG_LIBTOOL
2213 AC_MSG_CHECKING([dynamic loading])
2214 eval "`egrep '^build_libtool_libs=' libtool`"
2215 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
2216   dynamic_loading=yes
2217   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
2218 else
2219   dynamic_loading=no
2221 AC_MSG_RESULT($dynamic_loading)
2222 if test "$dynamic_loading" = "yes"; then
2223   $1
2224 else
2225   $2
2229 AC_DEFUN(KDE_ADD_INCLUDES,
2231 if test -z "$1"; then 
2232   test_include="Pix.h"
2233 else
2234   test_include="$1"
2237 AC_MSG_CHECKING([for libg++ ($test_include)])
2239 AC_CACHE_VAL(kde_cv_libgpp_includes,
2241 kde_cv_libgpp_includes=no
2243    for ac_dir in               \
2244                                \
2245      /usr/include/g++          \
2246      /usr/include              \
2247      /usr/unsupported/include  \
2248      /opt/include              \
2249      $extra_include            \
2250      ; \
2251    do
2252      if test -r "$ac_dir/$test_include"; then
2253        kde_cv_libgpp_includes=$ac_dir
2254        break
2255      fi
2256    done
2259 AC_MSG_RESULT($kde_cv_libgpp_includes)
2260 if test "$kde_cv_libgpp_includes" != "no"; then
2261   all_includes="-I$kde_cv_libgpp_includes $all_includes"
2271 AC_DEFUN(AC_FIND_QIMGIO,
2272    [AC_REQUIRE([AC_FIND_JPEG])
2273 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2274 AC_MSG_CHECKING([for qimgio])
2275 AC_CACHE_VAL(ac_cv_lib_qimgio,
2277 AC_LANG_SAVE
2278 AC_LANG_CPLUSPLUS
2279 ac_save_LIBS="$LIBS"
2280 ac_save_CXXFLAGS="$CXXFLAGS"
2281 LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
2282 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
2283 AC_TRY_RUN(dnl
2285 #include <qimageio.h>
2286 #include <qstring.h>
2287 int main() {
2288                 QString t = "hallo";
2289                 t.fill('t');
2290                 qInitImageIO();
2293             eval "ac_cv_lib_qimgio=yes",
2294             eval "ac_cv_lib_qimgio=no")
2295 LIBS="$ac_save_LIBS"
2296 CXXFLAGS="$ac_save_CXXFLAGS"
2297 AC_LANG_RESTORE
2298 ])dnl
2299 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
2300   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
2301   AC_MSG_RESULT(yes)
2302   AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
2303   AC_SUBST(LIBQIMGIO)
2304 else
2305   AC_MSG_RESULT(not found)
2309 AC_DEFUN(AM_DISABLE_LIBRARIES,
2311     AC_PROVIDE([AM_ENABLE_STATIC])
2312     AC_PROVIDE([AM_ENABLE_SHARED])
2313     enable_static=no
2314     enable_shared=yes
2319 AC_DEFUN(KDE_CHECK_NAMESPACES,
2321 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
2322 AC_LANG_SAVE
2323 AC_LANG_CPLUSPLUS
2324 AC_TRY_COMPILE([
2327 namespace Foo {
2328   extern int i;
2329   namespace Bar {
2330     extern int i;
2331   }
2334 int Foo::i = 0;
2335 int Foo::Bar::i = 1;
2337   AC_MSG_RESULT(yes)
2338   AC_DEFINE(HAVE_NAMESPACES)
2339 ], [
2340 AC_MSG_RESULT(no)
2342 AC_LANG_RESTORE
2345 AC_DEFUN(KDE_CHECK_NEWLIBS,
2350 dnl ------------------------------------------------------------------------
2351 dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
2352 dnl ------------------------------------------------------------------------
2354 AC_DEFUN(AC_CHECK_S_ISSOCK,
2356 AC_MSG_CHECKING(for S_ISSOCK)
2357 AC_CACHE_VAL(ac_cv_have_s_issock,
2359 AC_LANG_SAVE
2360 AC_LANG_C
2361 AC_TRY_LINK(
2363 #include <sys/stat.h>
2366 struct stat buff;
2367 int b = S_ISSOCK( buff.st_mode );
2369 ac_cv_have_s_issock=yes,
2370 ac_cv_have_s_issock=no)
2371 AC_LANG_RESTORE 
2373 AC_MSG_RESULT($ac_cv_have_s_issock)
2374 if test "$ac_cv_have_s_issock" = "yes"; then
2375   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
2379 dnl ------------------------------------------------------------------------
2380 dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
2381 dnl ------------------------------------------------------------------------
2383 AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
2385 AC_MSG_CHECKING(for MAXPATHLEN)
2386 AC_CACHE_VAL(ac_cv_maxpathlen,
2388 AC_LANG_C
2389 cat > conftest.$ac_ext <<EOF
2390 #include <stdio.h>
2391 #include <sys/param.h>
2392 #ifndef MAXPATHLEN
2393 #define MAXPATHLEN 1024
2394 #endif
2396 KDE_HELLO MAXPATHLEN
2400 ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
2402 if AC_TRY_EVAL(ac_try) && test -s conftest.out; then 
2403     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
2404 else
2405     ac_cv_maxpathlen=1024
2408 rm conftest.*
2411 AC_MSG_RESULT($ac_cv_maxpathlen)
2412 AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXLENPATH] )
2415 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2416 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
2417 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
2419 ## This program is free software; you can redistribute it and/or modify
2420 ## it under the terms of the GNU General Public License as published by
2421 ## the Free Software Foundation; either version 2 of the License, or
2422 ## (at your option) any later version.
2424 ## This program is distributed in the hope that it will be useful, but
2425 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2426 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2427 ## General Public License for more details.
2429 ## You should have received a copy of the GNU General Public License
2430 ## along with this program; if not, write to the Free Software
2431 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2433 ## As a special exception to the GNU General Public License, if you
2434 ## distribute this file as part of a program that contains a
2435 ## configuration script generated by Autoconf, you may include it under
2436 ## the same distribution terms that you use for the rest of that program.
2438 # serial 40 AC_PROG_LIBTOOL
2439 AC_DEFUN(AC_PROG_LIBTOOL,
2440 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
2442 # Save cache, so that ltconfig can load it
2443 AC_CACHE_SAVE
2445 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
2446 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
2447 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
2448 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
2449 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
2450 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
2451 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
2452 || AC_MSG_ERROR([libtool configure failed])
2454 # Reload cache, that may have been modified by ltconfig
2455 AC_CACHE_LOAD
2457 # This can be used to rebuild libtool when needed
2458 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
2460 # Use our own libtool, if env variable LIBTOOL isn't defined
2461 AC_MSG_CHECKING(for libtool)
2462 ac_save_LIBTOOL=${LIBTOOL:=no.LIBTOOL}
2463 if test -f $ac_save_LIBTOOL; then
2464   LIBTOOL="$ac_save_LIBTOOL $1"
2465 else
2466   LIBTOOL='$(SHELL) $(top_builddir)/libtool'
2468 AC_SUBST(LIBTOOL)dnl
2469 AC_MSG_RESULT($LIBTOOL)
2471 # Redirect the config.log output again, so that the ltconfig log is not
2472 # clobbered by the next message.
2473 exec 5>>./config.log
2476 AC_DEFUN(AC_LIBTOOL_SETUP,
2477 [AC_PREREQ(2.13)dnl
2478 AC_REQUIRE([AC_ENABLE_SHARED])dnl
2479 AC_REQUIRE([AC_ENABLE_STATIC])dnl
2480 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
2481 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2482 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
2483 AC_REQUIRE([AC_PROG_RANLIB])dnl
2484 AC_REQUIRE([AC_PROG_CC])dnl
2485 AC_REQUIRE([AC_PROG_LD])dnl
2486 AC_REQUIRE([AC_PROG_NM])dnl
2487 AC_REQUIRE([AC_PROG_LN_S])dnl
2490 # Check for any special flags to pass to ltconfig.
2491 libtool_flags="--cache-file=$cache_file"
2492 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
2493 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
2494 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
2495 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
2496 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
2497 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
2498 [libtool_flags="$libtool_flags --enable-dlopen"])
2499 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
2500 [libtool_flags="$libtool_flags --enable-win32-dll"])
2501 AC_ARG_ENABLE(libtool-lock,
2502   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
2503 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
2504 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
2506 # Some flags need to be propagated to the compiler or linker for good
2507 # libtool support.
2508 case "$host" in
2509 *-*-irix6*)
2510   # Find out which ABI we are using.
2511   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
2512   if AC_TRY_EVAL(ac_compile); then
2513     case "`/usr/bin/file conftest.o`" in
2514     *32-bit*)
2515       LD="${LD-ld} -32"
2516       ;;
2517     *N32*)
2518       LD="${LD-ld} -n32"
2519       ;;
2520     *64-bit*)
2521       LD="${LD-ld} -64"
2522       ;;
2523     esac
2524   fi
2525   rm -rf conftest*
2526   ;;
2528 *-*-sco3.2v5*)
2529   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
2530   SAVE_CFLAGS="$CFLAGS"
2531   CFLAGS="$CFLAGS -belf"
2532   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
2533     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
2534   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
2535     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
2536     CFLAGS="$SAVE_CFLAGS"
2537   fi
2538   ;;
2540 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
2541 [*-*-cygwin* | *-*-mingw*)
2542   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
2543   AC_CHECK_TOOL(AS, as, false)
2544   AC_CHECK_TOOL(OBJDUMP, objdump, false)
2545   ;;
2547 esac
2550 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
2551 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
2553 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
2554 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
2556 # AC_ENABLE_SHARED - implement the --enable-shared flag
2557 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
2558 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2559 #   `yes'.
2560 AC_DEFUN(AC_ENABLE_SHARED, [dnl
2561 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
2562 AC_ARG_ENABLE(shared,
2563 changequote(<<, >>)dnl
2564 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
2565 changequote([, ])dnl
2566 [p=${PACKAGE-default}
2567 case "$enableval" in
2568 yes) enable_shared=yes ;;
2569 no) enable_shared=no ;;
2571   enable_shared=no
2572   # Look at the argument we got.  We use all the common list separators.
2573   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2574   for pkg in $enableval; do
2575     if test "X$pkg" = "X$p"; then
2576       enable_shared=yes
2577     fi
2578   done
2579   IFS="$ac_save_ifs"
2580   ;;
2581 esac],
2582 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
2585 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
2586 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2587 AC_ENABLE_SHARED(no)])
2589 # AC_ENABLE_STATIC - implement the --enable-static flag
2590 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
2591 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2592 #   `yes'.
2593 AC_DEFUN(AC_ENABLE_STATIC, [dnl
2594 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
2595 AC_ARG_ENABLE(static,
2596 changequote(<<, >>)dnl
2597 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
2598 changequote([, ])dnl
2599 [p=${PACKAGE-default}
2600 case "$enableval" in
2601 yes) enable_static=yes ;;
2602 no) enable_static=no ;;
2604   enable_static=no
2605   # Look at the argument we got.  We use all the common list separators.
2606   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2607   for pkg in $enableval; do
2608     if test "X$pkg" = "X$p"; then
2609       enable_static=yes
2610     fi
2611   done
2612   IFS="$ac_save_ifs"
2613   ;;
2614 esac],
2615 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
2618 # AC_DISABLE_STATIC - set the default static flag to --disable-static
2619 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2620 AC_ENABLE_STATIC(no)])
2623 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
2624 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
2625 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
2626 #   `yes'.
2627 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
2628 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
2629 AC_ARG_ENABLE(fast-install,
2630 changequote(<<, >>)dnl
2631 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
2632 changequote([, ])dnl
2633 [p=${PACKAGE-default}
2634 case "$enableval" in
2635 yes) enable_fast_install=yes ;;
2636 no) enable_fast_install=no ;;
2638   enable_fast_install=no
2639   # Look at the argument we got.  We use all the common list separators.
2640   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
2641   for pkg in $enableval; do
2642     if test "X$pkg" = "X$p"; then
2643       enable_fast_install=yes
2644     fi
2645   done
2646   IFS="$ac_save_ifs"
2647   ;;
2648 esac],
2649 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
2652 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
2653 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2654 AC_ENABLE_FAST_INSTALL(no)])
2656 # AC_PROG_LD - find the path to the GNU or non-GNU linker
2657 AC_DEFUN(AC_PROG_LD,
2658 [AC_ARG_WITH(gnu-ld,
2659 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
2660 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2661 AC_REQUIRE([AC_PROG_CC])dnl
2662 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2663 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
2664 ac_prog=ld
2665 if test "$ac_cv_prog_gcc" = yes; then
2666   # Check if gcc -print-prog-name=ld gives a path.
2667   AC_MSG_CHECKING([for ld used by GCC])
2668   ac_prog=`($CC -print-prog-name=ld) 2>&5`
2669   case "$ac_prog" in
2670     # Accept absolute paths.
2671 changequote(,)dnl
2672     [\\/]* | [A-Za-z]:[\\/]*)
2673       re_direlt='/[^/][^/]*/\.\./'
2674 changequote([,])dnl
2675       # Canonicalize the path of ld
2676       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2677       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2678         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2679       done
2680       test -z "$LD" && LD="$ac_prog"
2681       ;;
2682   "")
2683     # If it fails, then pretend we aren't using GCC.
2684     ac_prog=ld
2685     ;;
2686   *)
2687     # If it is relative, then search for the first ld in PATH.
2688     with_gnu_ld=unknown
2689     ;;
2690   esac
2691 elif test "$with_gnu_ld" = yes; then
2692   AC_MSG_CHECKING([for GNU ld])
2693 else
2694   AC_MSG_CHECKING([for non-GNU ld])
2696 AC_CACHE_VAL(ac_cv_path_LD,
2697 [if test -z "$LD"; then
2698   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2699   for ac_dir in $PATH; do
2700     test -z "$ac_dir" && ac_dir=.
2701     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2702       ac_cv_path_LD="$ac_dir/$ac_prog"
2703       # Check to see if the program is GNU ld.  I'd rather use --version,
2704       # but apparently some GNU ld's only accept -v.
2705       # Break only if it was the GNU/non-GNU ld that we prefer.
2706       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2707         test "$with_gnu_ld" != no && break
2708       else
2709         test "$with_gnu_ld" != yes && break
2710       fi
2711     fi
2712   done
2713   IFS="$ac_save_ifs"
2714 else
2715   ac_cv_path_LD="$LD" # Let the user override the test with a path.
2716 fi])
2717 LD="$ac_cv_path_LD"
2718 if test -n "$LD"; then
2719   AC_MSG_RESULT($LD)
2720 else
2721   AC_MSG_RESULT(no)
2723 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2724 AC_SUBST(LD)
2725 AC_PROG_LD_GNU
2728 AC_DEFUN(AC_PROG_LD_GNU,
2729 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
2730 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2731 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2732   ac_cv_prog_gnu_ld=yes
2733 else
2734   ac_cv_prog_gnu_ld=no
2735 fi])
2738 # AC_PROG_NM - find the path to a BSD-compatible name lister
2739 AC_DEFUN(AC_PROG_NM,
2740 [AC_MSG_CHECKING([for BSD-compatible nm])
2741 AC_CACHE_VAL(ac_cv_path_NM,
2742 [if test -n "$NM"; then
2743   # Let the user override the test.
2744   ac_cv_path_NM="$NM"
2745 else
2746   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2747   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
2748     test -z "$ac_dir" && ac_dir=.
2749     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
2750       # Check to see if the nm accepts a BSD-compat flag.
2751       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
2752       #   nm: unknown option "B" ignored
2753       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
2754         ac_cv_path_NM="$ac_dir/nm -B"
2755         break
2756       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
2757         ac_cv_path_NM="$ac_dir/nm -p"
2758         break
2759       else
2760         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
2761         continue # so that we can try to find one that supports BSD flags
2762       fi
2763     fi
2764   done
2765   IFS="$ac_save_ifs"
2766   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
2767 fi])
2768 NM="$ac_cv_path_NM"
2769 AC_MSG_RESULT([$NM])
2770 AC_SUBST(NM)
2773 # AC_CHECK_LIBM - check for math library
2774 AC_DEFUN(AC_CHECK_LIBM,
2775 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
2776 LIBM=
2777 case "$host" in
2778 *-*-beos* | *-*-cygwin*)
2779   # These system don't have libm
2780   ;;
2781 *-ncr-sysv4.3*)
2782   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
2783   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
2784   ;;
2786   AC_CHECK_LIB(m, main, LIBM="-lm")
2787   ;;
2788 esac
2791 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
2792 # the libltdl convenience library, adds --enable-ltdl-convenience to
2793 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
2794 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
2795 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
2796 # '${top_builddir}/' (note the single quotes!) if your package is not
2797 # flat, and, if you're not using automake, define top_builddir as
2798 # appropriate in the Makefiles.
2799 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2800   case "$enable_ltdl_convenience" in
2801   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
2802   "") enable_ltdl_convenience=yes
2803       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
2804   esac
2805   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
2806   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
2809 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
2810 # the libltdl installable library, and adds --enable-ltdl-install to
2811 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
2812 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
2813 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
2814 # '${top_builddir}/' (note the single quotes!) if your package is not
2815 # flat, and, if you're not using automake, define top_builddir as
2816 # appropriate in the Makefiles.
2817 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
2818 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
2819   AC_CHECK_LIB(ltdl, main,
2820   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
2821   [if test x"$enable_ltdl_install" = xno; then
2822      AC_MSG_WARN([libltdl not installed, but installation disabled])
2823    else
2824      enable_ltdl_install=yes
2825    fi
2826   ])
2827   if test x"$enable_ltdl_install" = x"yes"; then
2828     ac_configure_args="$ac_configure_args --enable-ltdl-install"
2829     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
2830     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
2831   else
2832     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
2833     LIBLTDL="-lltdl"
2834     INCLTDL=
2835   fi
2838 dnl old names
2839 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
2840 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
2841 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
2842 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
2843 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
2844 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
2845 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
2847 dnl This is just to silence aclocal about the macro not being used
2848 ifelse([AC_DISABLE_FAST_INSTALL])dnl