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.
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.
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 ------------------------------------------------------------------------
36 AC_DEFUN(AC_FIND_FILE,
43 if test -r "$i/$j"; then
51 AC_DEFUN(KDE_FIND_PATH,
53 AC_MSG_CHECKING([for $1])
54 AC_CACHE_VAL(kde_cv_path_$1,
57 if test -n "$$2"; then
69 if test -x "$dir/$1"; then
72 evalstr="$dir/$1 $5 2>&1 "
73 if eval $evalstr; then
74 kde_cv_path_$1="$dir/$1"
78 kde_cv_path_$1="$dir/$1"
88 if test -z "$kde_cv_path_$1" || test "$kde_cv_path_$1" = "NONE"; then
89 AC_MSG_RESULT(not found)
92 AC_MSG_RESULT($kde_cv_path_$1)
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
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"`
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
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])
142 AC_CACHE_VAL(kde_cv_all_paths,
144 if test -z "$kde_htmldir"; then
145 kde_htmldir='\$(prefix)/share/doc/HTML'
147 if test -z "$kde_appsdir"; then
148 kde_appsdir='\$(prefix)/share/applnk'
150 if test -z "$kde_icondir"; then
151 kde_icondir='\$(prefix)/share/icons'
153 if test -z "$kde_sounddir"; then
154 kde_sounddir='\$(prefix)/share/sounds'
156 if test -z "$kde_datadir"; then
157 kde_datadir='\$(prefix)/share/apps'
159 if test -z "$kde_locale"; then
160 kde_locale='\$(prefix)/share/locale'
162 if test -z "$kde_cgidir"; then
163 kde_cgidir='\$(exec_prefix)/cgi-bin'
165 if test -z "$kde_confdir"; then
166 kde_confdir='\$(prefix)/share/config'
168 if test -z "$kde_mimedir"; then
169 kde_mimedir='\$(prefix)/share/mimelnk'
171 if test -z "$kde_toolbardir"; then
172 kde_toolbardir='\$(prefix)/share/toolbar'
174 if test -z "$kde_wallpaperdir"; then
175 kde_wallpaperdir='\$(prefix)/share/wallpapers'
177 if test -z "$kde_bindir"; then
178 kde_bindir='\$(exec_prefix)/bin'
180 if test -z "$kde_servicesdir"; then
181 kde_servicesdir='\$(prefix)/share/services'
183 if test -z "$kde_servicetypesdir"; then
184 kde_servicetypesdir='\$(prefix)/share/servicetypes'
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\" \
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!)
225 AC_MSG_RESULT($kde_result)
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)
241 AC_SUBST(kde_confdir)
242 AC_SUBST(kde_mimedir)
243 AC_SUBST(kde_toolbardir)
244 AC_SUBST(kde_wallpaperdir)
246 AC_SUBST(kde_servicesdir)
247 AC_SUBST(kde_servicetypesdir)
250 AC_DEFUN(KDE_MISC_TESTS,
253 dnl Checks for libraries.
254 AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
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
265 if test $kde_have_crypt = yes; then
266 AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
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"])
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")
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", ,
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")
290 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
292 if test $ac_cv_func_shmat = no; then
293 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
296 LIBSOCKET="$X_EXTRA_LIBS"
298 AC_SUBST(X_EXTRA_LIBS)
299 AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
302 case $host in dnl this *is* LynxOS specific
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
311 AC_REQUIRE([KDE_CHECK_LIBDL])
314 dnl ------------------------------------------------------------------------
315 dnl Find the header files and libraries for X-Windows. Extended the
317 dnl ------------------------------------------------------------------------
321 AC_REQUIRE([AC_PROG_CPP])
322 AC_MSG_CHECKING(for X)
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
330 kde_x_includes=$x_includes
332 if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
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
344 if test -z "$ac_x_includes"; then
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"
372 if test "$have_x" != yes; then
373 AC_MSG_RESULT($have_x)
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
381 x_includes="."; dnl better than nothing :-
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
389 x_libraries="/usr/lib"; dnl better than nothing :-
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"
399 AC_SUBST(x_libraries)
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"
417 LIB_X11='-lX11 $(LIBSOCKET)'
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"
433 printf("hello Xext\n");
435 kde_cv_have_libXext=yes,
436 kde_cv_have_libXext=no
439 LDFLAGS=$kde_ldflags_safe
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
456 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
458 AC_REQUIRE([KDE_USE_QT])
459 cat > conftest.$ac_ext <<EOF
460 #include "confdefs.h"
462 #include <qapplication.h>
464 #include <qobjcoll.h>
466 if test "$kde_qtver" = "2"; then
467 cat >> conftest.$ac_ext <<EOF
472 echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
473 cat >> conftest.$ac_ext <<EOF
479 if test "$kde_qtver" = "2"; then
480 cat >> conftest.$ac_ext <<EOF
481 QStringList *t = new QStringList();
484 cat >> conftest.$ac_ext <<EOF
492 if test -z "$1"; then
498 if test -z "$2"; then
499 if test $kde_qtver = 2; then
500 kde_qt_minversion=">= 2.0"
502 kde_qt_minversion=">= 1.42 and < 2.0"
508 if test -z "$3"; then
509 if test $kde_qtver = 2; then
510 kde_qt_verstring="QT_VERSION >= 200"
512 kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
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,
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"
533 CXXFLAGS="$CXXFLAGS -I$qt_includes"
535 LIBS="-lqt -lXext -lX11 $LIBSOCKET"
537 export LD_LIBRARY_PATH
543 if AC_TRY_EVAL(ac_link) && test -s conftest; then
544 kde_cv_qt_direct="yes"
546 kde_cv_qt_direct="no"
547 echo "configure: failed program was:" >&AC_FD_CC
548 cat conftest.$ac_ext >&AC_FD_CC
552 CXXFLAGS="$ac_cxxflags_safe"
553 LDFLAGS="$ac_ldflags_safe"
556 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
557 export LD_LIBRARY_PATH
558 LIBRARY_PATH="$ac_LIBRARY_PATH"
563 if test "$kde_cv_qt_direct" = "yes"; then
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])
583 if test $kde_qtver = 2; then
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
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
601 AC_ARG_WITH(qt-includes,
602 [ --with-qt-includes=DIR where the Qt includes are. ],
604 ac_qt_includes="$withval"
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
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"
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
637 ac_qt_libraries="$qt_libdir"
642 ac_cxxflags_safe="$CXXFLAGS"
643 ac_ldflags_safe="$LDFLAGS"
646 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
647 LDFLAGS="-L$qt_libdir $all_libraries"
652 if AC_TRY_EVAL(ac_link) && test -s conftest; then
655 echo "configure: failed program was:" >&AC_FD_CC
656 cat conftest.$ac_ext >&AC_FD_CC
660 CXXFLAGS="$ac_cxxflags_safe"
661 LDFLAGS="$ac_ldflags_safe"
665 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
666 ac_cv_have_qt="have_qt=no"
668 if test "$ac_qt_includes" = NO; then
669 if test "$ac_qt_libraries" = NO; then
670 ac_qt_notfound="(headers and libraries)";
672 ac_qt_notfound="(headers)";
675 ac_qt_notfound="(libraries)";
678 AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! ]);
684 eval "$ac_cv_have_qt"
686 if test "$have_qt" != yes; then
687 AC_MSG_RESULT([$have_qt]);
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])
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
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
714 QT_LDFLAGS="-L$qt_libraries"
715 all_libraries="$QT_LDFLAGS $all_libraries"
718 AC_SUBST(QT_INCLUDES)
722 LIB_QT='-lqt $(LIBPNG) -lXext $(LIB_X11) $(X_PRE_LIBS)'
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,
741 AC_REQUIRE([KDE_MISC_TESTS])
742 AC_REQUIRE([AC_PATH_QT])dnl
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
754 kde_libraries=${prefix}/lib
755 ac_kde_libraries=$prefix/lib
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
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
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"
797 ac_cv_have_kde="have_kde=yes \
798 ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
803 ac_cv_have_kde="have_kde=no"
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"
814 ac_kde_prefix="$prefix"
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])
820 ac_kde_exec_prefix="$exec_prefix"
821 AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
824 kde_libraries="${ac_kde_exec_prefix}/lib"
825 kde_includes=${ac_kde_prefix}/include
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])
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
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
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
871 if test -n "$kde_use_extra_includes" && \
872 test "$kde_use_extra_includes" != "NONE"; then
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"
882 kde_use_extra_includes="added"
884 kde_use_extra_includes="no"
886 AC_SUBST(USER_INCLUDES)
888 AC_MSG_RESULT($kde_use_extra_includes)
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
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"
908 kde_use_extra_libs="added"
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])
928 if test "$1" = "existance"; then
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"
941 if test "$LIBKIMGIO_EXISTS" = "yes"; then
942 LIB_KIMGIO='-lkimgio'
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)
963 LIB_KFORMULA='-lformula'
964 AC_SUBST(LIB_KFORMULA)
973 LIB_MEDIATOOL='-lmediatool'
974 AC_SUBST(LIB_MEDIATOOL)
976 LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
977 AC_SUBST(LIB_KDECORE)
978 LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
980 LIB_KFM='-lkfm $(LIB_KDECORE)'
982 LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
984 LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
986 LIB_MEDIATOOL='-lmediatool $(LIB_KDECORE)'
987 AC_SUBST(LIB_MEDIATOOL)
991 AC_DEFUN(AC_PATH_KDE,
994 AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install],
996 if test "$enableval" = "no";
997 then ac_use_path_checking="default"
998 else ac_use_path_checking=""
1000 ], [ac_use_path_checking="default"]
1003 AC_CREATE_KFSSTND($ac_use_path_checking)
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,
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
1023 [/* We use char because int might match the return type of a gcc2
1024 builtin and then its argument prototype would still apply. */
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)
1033 setenv("TEST", "alle", 1);
1035 ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
1037 if test "$ac_cv_func_setenv" = "yes"; then
1039 AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV, 1, [Define if you have setenv])
1045 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
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,
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,
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,
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,
1106 AC_MSG_CHECKING([for usleep])
1107 AC_CACHE_VAL(ac_cv_func_usleep,
1109 ac_libs_safe="$LIBS"
1110 LIBS="$LIBS $LIBUCB"
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,
1132 AC_MSG_CHECKING([for random])
1133 AC_CACHE_VAL(ac_cv_func_random,
1135 ac_libs_safe="$LIBS"
1136 LIBS="$LIBS $LIBUCB"
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,
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,
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,
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,
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"
1223 int GifLastError(void);
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"
1235 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1237 AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
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,
1249 ac_save_LIBS="$LIBS"
1250 LIBS="$all_libraries -ljpeg$2 -lm"
1252 [/* Override any gcc2 internal prototype to avoid an error. */
1253 struct jpeg_decompress_struct;
1254 typedef struct jpeg_decompress_struct * j_decompress_ptr;
1259 void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1260 int version, size_t structsize);
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)
1283 AC_DEFUN(AC_FIND_JPEG,
1285 KDE_FIND_JPEG_HELPER(6b, 6b,
1286 KDE_FIND_JPEG_HELPER(normal, [],
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"
1300 You need the development package of libjpeg6b. You can get
1301 a source package of libjpeg from http://www.ijg.org/
1307 LIBJPEG=$ac_cv_lib_jpeg
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,
1322 kde_save_LIBS="$LIBS"
1323 LIBS="$all_libraries -lz $LIBSOCKET"
1324 kde_save_CFLAGS="$CFLAGS"
1325 CFLAGS="$CFLAGS $all_includes"
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"
1336 if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
1337 AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
1340 AC_MSG_RESULT($ac_cv_lib_z)
1348 AC_DEFUN(KDE_TRY_TIFFLIB,
1350 AC_MSG_CHECKING([for libtiff $1])
1352 AC_CACHE_VAL(kde_cv_libtiff_$1,
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"
1364 [return (TIFFOpen( "", "r") == 0); ],
1366 kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
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
1381 LIBTIFF="$kde_cv_libtiff_$1"
1383 AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
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))
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"
1420 png_structp png_ptr = png_create_read_struct( /* image ptr */
1421 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1422 return( png_ptr != 0 );
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"
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"
1434 AC_MSG_RESULT($ac_cv_lib_png)
1442 AC_DEFUN(AC_CHECK_BOOL,
1444 AC_MSG_CHECKING([for bool])
1445 AC_CACHE_VAL(ac_cv_have_bool,
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])
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__
1472 if (eval "$ac_cpp conftest.c") 2>&5 |
1473 egrep "yes" >/dev/null 2>&1; then
1475 ac_cv_gnu_extensions=yes
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]],
1494 if test $enableval = "no"; dnl
1496 kde_use_debug_code="no"
1497 kde_use_debug_define=yes
1499 kde_use_debug_code="yes"
1500 kde_use_debug_define=no
1502 ], [kde_use_debug_code="no"
1503 kde_use_debug_define=no
1506 AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)],
1508 if test $enableval = "no"; then
1509 kde_use_strict_options="no"
1511 kde_use_strict_options="yes"
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
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])
1528 if test $ac_cv_prog_gcc = yes; then
1534 if test -z "$CFLAGS"; then
1535 if test "$kde_use_debug_code" = "yes"; then
1537 if test $ac_cv_prog_cc_g = yes; then
1541 if test "$GCC" = "yes"; then
1546 if test "$kde_use_debug_define" = "yes"; then
1547 CFLAGS="$CFLAGS -DNDEBUG"
1551 if test "$GCC" = "yes"; then
1554 if test "$kde_use_strict_options" = "yes"; then
1555 CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
1562 *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
1565 if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
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
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.
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>
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"
1595 ac_cv_prog_CPP="$CPP"
1601 AC_MSG_CHECKING(for a C++-Compiler)
1602 dnl if there is one, print out. if not, don't matter
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])
1614 if test $ac_cv_prog_gxx = yes; then
1617 AC_MSG_CHECKING(whether we are using SPARC CC)
1619 cat > conftest.C << EOF
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
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
1644 if test -z "$CXXFLAGS"; then
1645 if test "$kde_use_debug_code" = "yes"; then
1647 if test $ac_cv_prog_cxx_g = yes; then
1650 if test "$ac_cv_prog_CC" = "yes"; then
1651 CXXFLAGS="$CXXFLAGS -pto"
1654 if test "$GXX" = "yes"; then
1657 if test "$ac_cv_prog_CC" = "yes"; then
1663 if test "$kde_use_debug_define" = "yes"; then
1664 CXXFLAGS="$CXXFLAGS -DNDEBUG"
1668 if test "$GXX" = "yes"; then
1669 CXXFLAGS="$CXXFLAGS"
1671 if test "$kde_use_debug_code" = "yes"; then
1672 CXXFLAGS="$CXXFLAGS -Wall -Wno-long-long -Wpointer-arith -Wmissing-prototypes"
1675 if test "$kde_use_strict_options" = "yes"; then
1676 CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align -Woverloaded-virtual"
1679 if test "$kde_very_strict" = "yes"; then
1680 CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion"
1686 *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
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,
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
1702 CXXCPP="$ac_cv_prog_CXXCPP"
1704 AC_MSG_RESULT($CXXCPP)
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++
1717 kde_save_cflags="$CFLAGS"
1722 AM_PROG_LIBTOOL dnl for libraries
1723 AC_REQUIRE([AC_PROG_LIBTOOL]) dnl faking :=/
1724 LIBTOOL="$LIBTOOL --silent"
1725 dnl AC_SUBST(LIBTOOL)
1728 CFLAGS="$kde_save_cflags"
1731 AC_DEFUN(KDE_DO_IT_ALL,
1735 AM_INIT_AUTOMAKE($1, $2)
1736 AM_DISABLE_LIBRARIES
1737 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/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)"
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)"
1762 if test -n "$KDE_EXTRA_RPATH"; then
1763 KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
1766 AC_SUBST(KDE_EXTRA_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,
1778 #include <sys/types.h>
1779 #include <sys/socket.h>
1782 getsockname(0,(struct sockaddr*)0, &a);
1784 ac_cv_ksize_t=socklen_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"
1792 #include <sys/types.h>
1793 #include <sys/socket.h>
1796 getsockname(0,(struct sockaddr*)0, &a);
1799 ac_cv_ksize_t=size_t)
1800 CXXFLAGS="$ac_safe_cxxflags"
1805 if test -z "$ac_cv_ksize_t"; then
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:
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.
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
1836 [ --disable-nls do not use Native Language Support],
1837 USE_NLS=$enableval, USE_NLS=yes)
1838 AC_MSG_RESULT($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])
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
1868 [found xgettext programs is not GNU xgettext; ignore it])
1877 # Search path for a program which passes the given test.
1878 # Ulrich Drepper <drepper@cygnus.com>, 1996.
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,
1892 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
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
1900 ac_cv_path_$1="$ac_dir/$ac_word"
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"
1913 if test -n "[$]$1"; then
1914 AC_MSG_RESULT([$]$1)
1922 # Check whether LC_MESSAGES is available in <locale.h>.
1923 # Ulrich Drepper <drepper@cygnus.com>, 1995.
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])
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)
1949 LIBOBJS="$LIBOBJS obstack.o"
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"
1964 AC_SUBST(LIBOBJS)dnl
1967 # Macro to add for using GNU gettext.
1968 # Ulrich Drepper <drepper@cygnus.com>, 1995.
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,
1991 kde_safe_cxxflags=$CXXFLAGS
1992 CXXFLAGS="-Wmissing-prototypes -Werror"
2000 stpcpy(buffer, buffer);
2002 kde_cv_func_stpcpy=yes,
2003 kde_cv_func_stpcpy=no)
2005 CXXFLAGS=$kde_safe_cxxflags
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])
2014 if test "x$CATOBJEXT" != "x"; then
2015 if test "x$ALL_LINGUAS" = "x"; then
2018 AC_MSG_CHECKING(for catalogs to be installed)
2020 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2021 case "$ALL_LINGUAS" in
2022 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2025 LINGUAS=$NEW_LINGUAS
2026 AC_MSG_RESULT($LINGUAS)
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
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
2049 AC_MSG_CHECKING(for XPM)
2050 AC_CACHE_VAL(ac_cv_have_xpm,
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"
2064 if test "$ac_cv_have_xpm" = no; then
2070 AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
2071 if test "$XPM_LDFLAGS" = ""; then
2072 XPMLIB='-lXpm $(LIB_X11)'
2074 XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
2076 if test "$XPM_INCLUDE" = ""; then
2079 XPMINC="-I$XPM_INCLUDE"
2089 AC_DEFUN(KDE_CHECK_LIBDL,
2091 AC_CHECK_LIB(dl, dlopen, [
2093 ac_cv_have_dlfcn=yes
2096 AC_CHECK_LIB(dld, shl_unload, [
2098 ac_cv_have_shload=yes
2104 AC_DEFUN(KDE_CHECK_DLOPEN,
2107 AC_CHECK_HEADERS(dlfcn.h dl.h)
2108 if test "$ac_cv_header_dlfcn_h" = "no"; then
2112 if test "$ac_cv_header_dl_h" = "no"; then
2113 ac_cv_have_shload=no
2117 AC_ARG_ENABLE(dlopen,
2118 [ --disable-dlopen link staticly [default=no]] ,
2119 [if test "$enableval" = yes; then
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
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
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)
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
2153 AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
2157 AC_MSG_RESULT($dynamic_loading)
2158 if test "$dynamic_loading" = "yes"; then
2165 AC_DEFUN(KDE_ADD_INCLUDES,
2167 if test -z "$1"; then
2168 test_include="Pix.h"
2173 AC_MSG_CHECKING([for libg++ ($test_include)])
2175 AC_CACHE_VAL(kde_cv_libgpp_includes,
2177 kde_cv_libgpp_includes=no
2183 /usr/unsupported/include \
2188 if test -r "$ac_dir/$test_include"; then
2189 kde_cv_libgpp_includes=$ac_dir
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,
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"
2221 #include <qimageio.h>
2222 #include <qstring.h>
2224 QString t = "hallo";
2229 eval "ac_cv_lib_qimgio=yes",
2230 eval "ac_cv_lib_qimgio=no")
2231 LIBS="$ac_save_LIBS"
2232 CXXFLAGS="$ac_save_CXXFLAGS"
2235 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
2236 LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
2238 AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
2241 AC_MSG_RESULT(not found)
2245 AC_DEFUN(AM_DISABLE_LIBRARIES,
2247 AC_PROVIDE([AM_ENABLE_STATIC])
2248 AC_PROVIDE([AM_ENABLE_SHARED])
2255 AC_DEFUN(KDE_CHECK_NAMESPACES,
2257 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
2271 int Foo::Bar::i = 1;
2274 AC_DEFINE(HAVE_NAMESPACES)
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,
2299 #include <sys/stat.h>
2303 int b = S_ISSOCK( buff.st_mode );
2305 ac_cv_have_s_issock=yes,
2306 ac_cv_have_s_issock=no)
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,
2325 cat > conftest.$ac_ext <<EOF
2327 #include <sys/param.h>
2329 #define MAXPATHLEN 1024
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`
2341 ac_cv_maxpathlen=1024
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
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
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,
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
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
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"
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)
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
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 ;;
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
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
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 ;;
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
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
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
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
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`
2599 # Accept absolute paths.
2601 [\\/]* | [A-Za-z]:[\\/]*)
2602 re_direlt='/[^/][^/]*/\.\./'
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%/%"`
2609 test -z "$LD" && LD="$ac_prog"
2612 # If it fails, then pretend we aren't using GCC.
2616 # If it is relative, then search for the first ld in PATH.
2620 elif test "$with_gnu_ld" = yes; then
2621 AC_MSG_CHECKING([for GNU ld])
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
2638 test "$with_gnu_ld" != yes && break
2644 ac_cv_path_LD="$LD" # Let the user override the test with a path.
2647 if test -n "$LD"; then
2652 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
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
2663 ac_cv_prog_gnu_ld=no
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.
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"
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"
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
2695 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
2698 AC_MSG_RESULT([$NM])
2702 # AC_CHECK_LIBM - check for math library
2703 AC_DEFUN(AC_CHECK_LIBM,
2704 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
2707 *-*-beos* | *-*-cygwin*)
2708 # These system don't have libm
2711 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
2712 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
2715 AC_CHECK_LIB(m, main, LIBM="-lm")
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" ;;
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])
2753 enable_ltdl_install=yes
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'])
2761 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
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