Avoid trigraphs.
[kdbg.git] / admin / acinclude.m4.in
bloba09936fa98a2fe30f3fa27d4a25df6a134e693b2
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 dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
52 dnl     if-not-found, test-parameter)
53 AC_DEFUN(KDE_FIND_PATH,
55    AC_MSG_CHECKING([for $1])
56    if test -n "$$2"; then
57         kde_cv_path="$$2";
58    else
59         kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
61         AC_CACHE_VAL(kde_cv_path_$kde_cache,
62         [
63         kde_cv_path="NONE"
64         dirs="$3"
65         kde_save_IFS=$IFS
66         IFS=':'
67         for dir in $PATH; do
68           dirs="$dirs $dir"
69         done
70         IFS=$kde_save_IFS
72         for dir in $dirs; do
73           if test -x "$dir/$1"; then
74             if test -n "$5"
75             then
76               evalstr="$dir/$1 $5 2>&1 "
77               if eval $evalstr; then
78                 kde_cv_path="$dir/$1"
79                 break
80               fi
81             else
82                 kde_cv_path="$dir/$1"
83                 break
84             fi
85           fi
86         done
88         eval "kde_cv_path_$kde_cache=$kde_cv_path"
90         ])
92       eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
94    fi
96    if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
97       AC_MSG_RESULT(not found)
98       $4
99    else
100       AC_MSG_RESULT($kde_cv_path)
101       $2=$kde_cv_path
103    fi
106 AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
108     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
109 Please check whether you installed Qt correctly.
110 You need to have a running moc binary.
111 configure tried to run $ac_cv_path_moc and the test didn't
112 succeed. If configure shouldn't have tried this one, set
113 the environment variable MOC to the right one before running
114 configure.
118 AC_DEFUN(KDE_UIC_ERROR_MESSAGE,
120     AC_MSG_WARN([No Qt ui compiler (uic) found!
121 Please check whether you installed Qt correctly.
122 You need to have a running uic binary.
123 configure tried to run $ac_cv_path_uic and the test didn't
124 succeed. If configure shouldn't have tried this one, set
125 the environment variable UIC to the right one before running
126 configure.
130 dnl ------------------------------------------------------------------------
131 dnl Find the meta object compiler and the ui compiler in the PATH,
132 dnl in $QTDIR/bin, and some more usual places
133 dnl ------------------------------------------------------------------------
135 AC_DEFUN(AC_PATH_QT_MOC_UIC,
137    qt_bindirs=""
138    for dir in $kde_qt_dirs; do
139       qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
140    done
141    qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
142    if test ! "$ac_qt_bindir" = "NO"; then
143       qt_bindirs="$ac_qt_bindir $qt_bindirs"
144    fi
146    KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
147    KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC="" ; KDE_UIC_ERROR_MESSAGE])
148    if test -z "$UIC" ; then
149      if test -z "$UIC_NOT_NEEDED" ; then
150        exit 1
151      else
152        UIC="echo uic not available: "
153      fi
154    fi
155    AC_SUBST(MOC)
156    AC_SUBST(UIC)
159 AC_DEFUN(KDE_1_CHECK_PATHS,
161   KDE_1_CHECK_PATH_HEADERS
163   KDE_TEST_RPATH=
165   if test -n "$USE_RPATH"; then
167      if test -n "$kde_libraries"; then
168        KDE_TEST_RPATH="-R $kde_libraries"
169      fi
171      if test -n "$qt_libraries"; then
172        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
173      fi
175      if test -n "$x_libraries"; then
176        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
177      fi
179      KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
180   fi
182 AC_MSG_CHECKING([for KDE libraries installed])
183 ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5'
185 if AC_TRY_EVAL(ac_link) && test -s conftest; then
186   AC_MSG_RESULT(yes)
187 else
188   AC_MSG_ERROR([your system fails at linking a small KDE application!
189 Check, if your compiler is installed correctly and if you have used the
190 same compiler to compile Qt and kdelibs as you did use now.
191 For more details about this problem, look at the end of config.log.])
194 if eval `KDEDIR= ./conftest 2>&5`; then
195   kde_result=done
196 else
197   kde_result=problems
200 KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
201 kde_have_all_paths=yes
203 KDE_SET_PATHS($kde_result)
207 AC_DEFUN(KDE_SET_PATHS,
209   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
210         kde_htmldir=\"$kde_htmldir\" \
211         kde_appsdir=\"$kde_appsdir\" \
212         kde_icondir=\"$kde_icondir\" \
213         kde_sounddir=\"$kde_sounddir\" \
214         kde_datadir=\"$kde_datadir\" \
215         kde_locale=\"$kde_locale\" \
216         kde_cgidir=\"$kde_cgidir\" \
217         kde_confdir=\"$kde_confdir\" \
218         kde_mimedir=\"$kde_mimedir\" \
219         kde_toolbardir=\"$kde_toolbardir\" \
220         kde_wallpaperdir=\"$kde_wallpaperdir\" \
221         kde_templatesdir=\"$kde_templatesdir\" \
222         kde_bindir=\"$kde_bindir\" \
223         kde_servicesdir=\"$kde_servicesdir\" \
224         kde_servicetypesdir=\"$kde_servicetypesdir\" \
225         kde_moduledir=\"$kde_moduledir\" \
226         kde_result=$1"
229 AC_DEFUN(KDE_SET_DEFAULT_PATHS,
231 if test "$1" = "default"; then
233   if test -z "$kde_htmldir"; then
234     kde_htmldir='\${prefix}/share/doc/HTML'
235   fi
236   if test -z "$kde_appsdir"; then
237     kde_appsdir='\${prefix}/share/applnk'
238   fi
239   if test -z "$kde_icondir"; then
240     kde_icondir='\${prefix}/share/icons'
241   fi
242   if test -z "$kde_sounddir"; then
243     kde_sounddir='\${prefix}/share/sounds'
244   fi
245   if test -z "$kde_datadir"; then
246     kde_datadir='\${prefix}/share/apps'
247   fi
248   if test -z "$kde_locale"; then
249     kde_locale='\${prefix}/share/locale'
250   fi
251   if test -z "$kde_cgidir"; then
252     kde_cgidir='\${exec_prefix}/cgi-bin'
253   fi
254   if test -z "$kde_confdir"; then
255     kde_confdir='\${prefix}/share/config'
256   fi
257   if test -z "$kde_mimedir"; then
258     kde_mimedir='\${prefix}/share/mimelnk'
259   fi
260   if test -z "$kde_toolbardir"; then
261     kde_toolbardir='\${prefix}/share/toolbar'
262   fi
263   if test -z "$kde_wallpaperdir"; then
264     kde_wallpaperdir='\${prefix}/share/wallpapers'
265   fi
266   if test -z "$kde_templatesdir"; then
267     kde_templatesdir='\${prefix}/share/templates'
268   fi
269   if test -z "$kde_bindir"; then
270     kde_bindir='\${exec_prefix}/bin'
271   fi
272   if test -z "$kde_servicesdir"; then
273     kde_servicesdir='\${prefix}/share/services'
274   fi
275   if test -z "$kde_servicetypesdir"; then
276     kde_servicetypesdir='\${prefix}/share/servicetypes'
277   fi
278   if test -z "$kde_moduledir"; then
279     kde_moduledir='\${prefix}/lib/kde2'
280   fi
282   KDE_SET_PATHS(defaults)
284 else
286   if test $kde_qtver = 1; then
287      AC_MSG_RESULT([compiling])
288      KDE_1_CHECK_PATHS
289   else
290      AC_MSG_ERROR([path checking not yet supported for KDE 2])
291   fi
296 AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS,
297 [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
298    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
299    test -z "$kde_datadir" || test -z "$kde_locale"  ||
300    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
301    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
302    test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
303    test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
304    test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
305    test "$kde_have_all_paths" != "yes"; then
306      kde_have_all_paths=no
307   fi
310 AC_DEFUN(KDE_MISSING_PROG_ERROR,
312     AC_MSG_ERROR([The important program $1 was not found!
313 Please check whether you installed KDE correctly.
317 AC_DEFUN(KDE_SUBST_PROGRAMS,
318 [AC_REQUIRE([AC_CREATE_KFSSTND])dnl
320         kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin"
321         if test -n "$KDEDIRS"; then
322            kde_save_IFS=$IFS
323            IFS=:
324            for dir in $KDEDIRS; do
325                 kde_default_bindirs="$dir/bin $kde_default_bindirs "
326            done
327            IFS=$kde_save_IFS
328         fi
329         kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
330         KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
331         KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
332         KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)])
333         KDE_FIND_PATH(kdb2html, KDB2HTML, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kdb2html)])
334         KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)])
335         KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)])
337         DCOP_DEPENDENCIES='$(DCOPIDL)'
338         AC_SUBST(DCOPIDL)
339         AC_SUBST(DCOPIDL2CPP)
340         AC_SUBST(DCOP_DEPENDENCIES)
341         AC_SUBST(MCOPIDL)
342         AC_SUBST(KDB2HTML)
343         AC_SUBST(ARTSCCONFIG)
344         AC_SUBST(KDECONFIG)
346         if test -x "$KDECONFIG"; then # it can be "compiled"
347           kde_libs_prefix=`$KDECONFIG --prefix`
348           if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
349                AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
350                           This means it has been moved since you installed it.
351                           This won't work. Please recompile kdelibs for the new prefix.
352                           ])
353            fi
354            kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
355         else
356            kde_libs_prefix='$(prefix)'
357            kde_libs_htmldir='$(kde_htmldir)'
358         fi
359         AC_SUBST(kde_libs_prefix)
360         AC_SUBST(kde_libs_htmldir)
361 ])dnl
363 AC_DEFUN(AC_CREATE_KFSSTND,
365 AC_REQUIRE([AC_CHECK_RPATH])
367 AC_MSG_CHECKING([for KDE paths])
368 kde_result=""
369 kde_cached_paths=yes
370 AC_CACHE_VAL(kde_cv_all_paths,
372   KDE_SET_DEFAULT_PATHS($1)
373   kde_cached_paths=no
375 eval "$kde_cv_all_paths"
376 KDE_CHECK_PATHS_FOR_COMPLETENESS
377 if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
378   # wrong values were cached, may be, we can set better ones
379   kde_result=
380   kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
381   kde_datadir= kde_locale=  kde_cgidir=  kde_confdir=
382   kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
383   kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
384   kde_have_all_paths=
385   KDE_SET_DEFAULT_PATHS($1)
386   eval "$kde_cv_all_paths"
387   KDE_CHECK_PATHS_FOR_COMPLETENESS
388   kde_result="$kde_result (cache overridden)"
390 if test "$kde_have_all_paths" = "no"; then
391   AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
392 Since it had compiled and linked before, it must be a strange problem on your system.
393 Look at config.log for details. If you are not able to fix this, look at
394 http://www.kde.org/faq/installation.html or any www.kde.org mirror.
395 (If you're using an egcs version on Linux, you may update binutils!)
397 else
398   rm -f conftest*
399   AC_MSG_RESULT($kde_result)
402 bindir=$kde_bindir
404 KDE_SUBST_PROGRAMS
408 AC_DEFUN(AC_SUBST_KFSSTND,
410 AC_SUBST(kde_htmldir)
411 AC_SUBST(kde_appsdir)
412 AC_SUBST(kde_icondir)
413 AC_SUBST(kde_sounddir)
414 AC_SUBST(kde_datadir)
415 AC_SUBST(kde_locale)
416 AC_SUBST(kde_confdir)
417 AC_SUBST(kde_mimedir)
418 AC_SUBST(kde_wallpaperdir)
419 AC_SUBST(kde_bindir)
420 dnl for KDE 2
421 AC_SUBST(kde_templatesdir)
422 AC_SUBST(kde_servicesdir)
423 AC_SUBST(kde_servicetypesdir)
424 AC_SUBST(kde_moduledir)
425 if test "$kde_qtver" = 1; then
426   kde_minidir="$kde_icondir/mini"
427 else
428 # for KDE 1 - this breaks KDE2 apps using minidir, but
429 # that's the plan ;-/
430   kde_minidir="/dev/null"
432 dnl AC_SUBST(kde_minidir)
433 dnl AC_SUBST(kde_cgidir)
434 dnl AC_SUBST(kde_toolbardir)
437 AC_DEFUN(KDE_MISC_TESTS,
439    AC_LANG_C
440    dnl Checks for libraries.
441    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
442    AC_SUBST(LIBCOMPAT)
443    kde_have_crypt=
444    AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
445       AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
446         AC_MSG_WARN([you have no crypt in either libcrypt or libc.
447 You should install libcrypt from another source or configure with PAM
448 support])
449         kde_have_crypt=no
450       ]))
451    AC_SUBST(LIBCRYPT)
452    if test $kde_have_crypt = yes; then
453       AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
454    fi
455    AC_CHECK_KSIZE_T
456    AC_LANG_C
457    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
458    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
459       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
460         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
461    fi
462    AC_CHECK_FUNC(inet_ntoa)
463    if test $ac_cv_func_inet_ntoa = no; then
464      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
465    fi
466    AC_CHECK_FUNC(connect)
467    if test $ac_cv_func_connect = no; then
468       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
469         $X_EXTRA_LIBS)
470    fi
472    AC_CHECK_FUNC(remove)
473    if test $ac_cv_func_remove = no; then
474       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
475    fi
477    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
478    AC_CHECK_FUNC(shmat, ,
479      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
480    
481    # Solaris 2.6 needs -lresolv for res_init
482    AC_CHECK_FUNC(res_init, ,
483      AC_CHECK_LIB(resolv, res_init, X_EXTRA_LIBS="$X_EXTRA_LIBS -lresolv"))
485    LIBSOCKET="$X_EXTRA_LIBS"
486    AC_SUBST(LIBSOCKET)
487    AC_SUBST(X_EXTRA_LIBS)
488    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
489    AC_SUBST(LIBUCB)
491    case $host in  dnl this *is* LynxOS specific
492    *-*-lynxos* )
493         AC_MSG_CHECKING([LynxOS header file wrappers])
494         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
495         AC_MSG_RESULT(disabled)
496         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
497          ;;
498     esac
500    KDE_CHECK_TYPES
501    KDE_CHECK_LIBDL
504 dnl ------------------------------------------------------------------------
505 dnl Find the header files and libraries for X-Windows. Extended the
506 dnl macro AC_PATH_X
507 dnl ------------------------------------------------------------------------
509 AC_DEFUN(K_PATH_X,
511 AC_REQUIRE([AC_PROG_CPP])dnl
512 AC_REQUIRE([KDE_MISC_TESTS])dnl
513 AC_MSG_CHECKING(for X)
514 AC_LANG_SAVE
515 AC_LANG_C
516 AC_CACHE_VAL(kde_cv_have_x,
517 [# One or both of the vars are not set, and there is no cached value.
518 if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
519    kde_x_includes=NO
520 else
521    kde_x_includes=$x_includes
523 if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
524    kde_x_libraries=NO
525 else
526    kde_x_libraries=$x_libraries
529 # below we use the standard autoconf calls
530 ac_x_libraries=$kde_x_libraries
531 ac_x_includes=$kde_x_includes
533 AC_PATH_X_DIRECT
534 dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
535 dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
536 dnl location. The correct location is /usr/lib32 or an undefined value
537 dnl (the linker is smart enough to pick the correct default library).
538 dnl Things work just fine if you use just AC_PATH_X_DIRECT.
539 case "$host" in
540 mips-sgi-irix6*)
541   ;;
543   AC_PATH_X_XMKMF
544   if test -z "$ac_x_includes"; then
545     ac_x_includes="."
546   fi
547   if test -z "$ac_x_libraries"; then
548     ac_x_libraries="/usr/lib"
549   fi
550 esac
551 #from now on we use our own again
553 # when the user already gave --x-includes, we ignore
554 # what the standard autoconf macros told us.
555 if test "$kde_x_includes" = NO; then
556   kde_x_includes=$ac_x_includes
559 # for --x-libraries too
560 if test "$kde_x_libraries" = NO; then
561   kde_x_libraries=$ac_x_libraries
564 if test "$kde_x_includes" = NO; then
565   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
568 if test "$kde_x_libraries" = NO; then
569   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
572 # Record where we found X for the cache.
573 kde_cv_have_x="have_x=yes \
574          kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
575 ])dnl
576 eval "$kde_cv_have_x"
578 if test "$have_x" != yes; then
579   AC_MSG_RESULT($have_x)
580   no_x=yes
581 else
582   AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
585 if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
586   X_INCLUDES=""
587   x_includes="."; dnl better than nothing :-
588  else
589   x_includes=$kde_x_includes
590   X_INCLUDES="-I$x_includes"
593 if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
594   X_LDFLAGS=""
595   x_libraries="/usr/lib"; dnl better than nothing :-
596  else
597   x_libraries=$kde_x_libraries
598   X_LDFLAGS="-L$x_libraries"
600 all_includes="$X_INCLUDES"
601 all_libraries="$X_LDFLAGS"
603 AC_SUBST(X_INCLUDES)
604 AC_SUBST(X_LDFLAGS)
605 AC_SUBST(x_libraries)
606 AC_SUBST(x_includes)
608 # Check for libraries that X11R6 Xt/Xaw programs need.
609 ac_save_LDFLAGS="$LDFLAGS"
610 LDFLAGS="$LDFLAGS $X_LDFLAGS"
611 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
612 # check for ICE first), but we must link in the order -lSM -lICE or
613 # we get undefined symbols.  So assume we have SM if we have ICE.
614 # These have to be linked with before -lX11, unlike the other
615 # libraries we check for below, so use a different variable.
616 #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
617 AC_CHECK_LIB(ICE, IceConnectionNumber,
618   [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
619 AC_SUBST(LIBSM)
620 LDFLAGS="$ac_save_LDFLAGS"
622 AC_SUBST(X_PRE_LIBS)
624 LIB_X11='-lX11 $(LIBSOCKET)'
625 AC_SUBST(LIB_X11)
627 AC_MSG_CHECKING(for libXext)
628 AC_CACHE_VAL(kde_cv_have_libXext,
630 kde_ldflags_safe="$LDFLAGS"
631 kde_libs_safe="$LIBS"
633 LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
634 LIBS="-lXext -lX11 $LIBSOCKET"
636 AC_TRY_LINK([
637 #include <stdio.h>
640 printf("hello Xext\n");
642 kde_cv_have_libXext=yes,
643 kde_cv_have_libXext=no
644    )
646 LDFLAGS=$kde_ldflags_safe
647 LIBS=$kde_libs_safe
648  ])
650 AC_MSG_RESULT($kde_cv_have_libXext)
652 if test "$kde_cv_have_libXext" = "no"; then
653   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
654 can't find it itself, we stop here assuming that make wouldn't find
655 them either.])
660 AC_LANG_RESTORE
663 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
665 AC_REQUIRE([KDE_USE_QT])
666 cat > conftest.$ac_ext <<EOF
667 #include "confdefs.h"
668 #include <qglobal.h>
669 #include <qapplication.h>
670 #include <qapp.h>
671 #include <qobjcoll.h>
673 if test "$kde_qtver" = "2"; then
674 cat >> conftest.$ac_ext <<EOF
675 #include <qevent.h>
676 #include <qstring.h>
677 #include <qstyle.h>
680 if test $kde_qtsubver -gt 0; then
681 cat >> conftest.$ac_ext <<EOF
682 #include <qiconview.h>
688 echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
689 cat >> conftest.$ac_ext <<EOF
690 #error 1
691 #endif
693 int main() {
695 if test "$kde_qtver" = "2"; then
696 cat >> conftest.$ac_ext <<EOF
697     QStringList *t = new QStringList();
699 if test $kde_qtsubver -gt 0; then
700 cat >> conftest.$ac_ext <<EOF
701     QIconView iv(0);
702     iv.setWordWrapIconText(false);
703     QString s;
704     s.setLatin1("Elvis is alive", 14);
705     int magnolia = QEvent::Speech; /* new in 2.2 beta2 */
709 cat >> conftest.$ac_ext <<EOF
710     return 0;
715 AC_DEFUN(KDE_USE_QT,
718 if test -z "$1"; then
719   kde_qtver=2
720   kde_qtsubver=1
721 else
722   kde_qtsubver=`echo "$1" | sed -e 's#[0-9]\+\.\([0-9]\+\).*#\1#'`
723   # following is the check if subversion isn´t found in passed argument
724   if test "$kde_qtsubver" = "$1"; then
725     kde_qtsubver=1
726   fi
727   kde_qtver=`echo "$1" | sed -e 's#^\([0-9]\+\)\..*#\1#'`
728   if test "$kde_qtver" = "1"; then
729     kde_qtsubver=42
730   else
731    # this is the version number fallback to 2.1, unless major version is 1 or 2
732    if test "$kde_qtver" != "2"; then
733     kde_qtver=2
734     kde_qtsubver=1
735    fi
736   fi
739 if test -z "$2"; then
740   if test $kde_qtver = 2; then
741     if test $kde_qtsubver -gt 0; then
742       kde_qt_minversion=">= Qt 2.2.2"
743     else
744       kde_qt_minversion=">= Qt 2.0.2"
745     fi
746   else
747     kde_qt_minversion=">= 1.42 and < 2.0"
748   fi
749 else
750    kde_qt_minversion=$2
753 if test -z "$3"; then
754    if test $kde_qtver = 2; then
755     if test $kde_qtsubver -gt 0; then
756       kde_qt_verstring="QT_VERSION >= 222"
757     else
758       kde_qt_verstring="QT_VERSION >= 200"
759     fi
760    else
761     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
762   fi
763 else
764    kde_qt_verstring=$3
767 if test $kde_qtver = 2; then
768    kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
769 else
770    kde_qt_dirs="$QTDIR /usr/lib/qt"
774 AC_DEFUN(KDE_CHECK_QT_DIRECT,
776 AC_REQUIRE([KDE_USE_QT])
777 AC_MSG_CHECKING([if Qt compiles without flags])
778 AC_CACHE_VAL(kde_cv_qt_direct,
780 AC_LANG_SAVE
781 AC_LANG_CPLUSPLUS
782 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
783 ac_LIBRARY_PATH="$LIBRARY_PATH"
784 ac_cxxflags_safe="$CXXFLAGS"
785 ac_ldflags_safe="$LDFLAGS"
786 ac_libs_safe="$LIBS"
788 CXXFLAGS="$CXXFLAGS -I$qt_includes"
789 LDFLAGS="$LDFLAGS $X_LDFLAGS"
790 LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
791 LD_LIBRARY_PATH=
792 export LD_LIBRARY_PATH
793 LIBRARY_PATH=
794 export LIBRARY_PATH
796 KDE_PRINT_QT_PROGRAM
798 if AC_TRY_EVAL(ac_link) && test -s conftest; then
799   kde_cv_qt_direct="yes"
800 else
801   kde_cv_qt_direct="no"
802   echo "configure: failed program was:" >&AC_FD_CC
803   cat conftest.$ac_ext >&AC_FD_CC
806 rm -f conftest*
807 CXXFLAGS="$ac_cxxflags_safe"
808 LDFLAGS="$ac_ldflags_safe"
809 LIBS="$ac_libs_safe"
811 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
812 export LD_LIBRARY_PATH
813 LIBRARY_PATH="$ac_LIBRARY_PATH"
814 export LIBRARY_PATH
815 AC_LANG_RESTORE
818 if test "$kde_cv_qt_direct" = "yes"; then
819   AC_MSG_RESULT(yes)
820   $1
821 else
822   AC_MSG_RESULT(no)
823   $2
827 dnl ------------------------------------------------------------------------
828 dnl Try to find the Qt headers and libraries.
829 dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
830 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
831 dnl ------------------------------------------------------------------------
833 AC_DEFUN(AC_PATH_QT_1_3,
835 AC_REQUIRE([K_PATH_X])
836 AC_REQUIRE([KDE_USE_QT])
838 dnl ------------------------------------------------------------------------
839 dnl Add configure flag to enable linking to MT version of Qt library.
840 dnl ------------------------------------------------------------------------
842 AC_ARG_ENABLE(
843   mt,
844   [  --enable-mt             link to threaded Qt (experimental)],
845   kde_use_qt_mt=$enableval,
846   kde_use_qt_mt=no
849 USING_QT_MT=""
851 dnl ------------------------------------------------------------------------
852 dnl If we got --enable-qt-mt then adjust some vars for the host.
853 dnl ------------------------------------------------------------------------
855 if test "x$kde_use_qt_mt" = "xyes"; then
857   case $host in
858   *-*-linux-*)
859     if test "x$GCC" = "xyes"; then
860       CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread"
861       X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread"
862     else
863       AC_MSG_WARN([Compiler is not gcc. MT support disabled.])
864     fi
865     ;;
866   *)
867     AC_MSG_WARN([MT not yet supported on $host - disabled.])
868     ;;
869   esac
873 kde_qt_was_given=yes
875 dnl ------------------------------------------------------------------------
876 dnl If we haven't been told how to link to Qt, we work it out for ourselves.
877 dnl ------------------------------------------------------------------------
879 if test -z "$LIBQT_GLOB"; then
881   LIBQT_GLOB="libqt.*"
885 if test -z "$LIBQT"; then
887   LIBQT="-lqt"
888   kde_int_qt="-lqt"
890 dnl ------------------------------------------------------------------------
891 dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
892 dnl ------------------------------------------------------------------------
894   if test "x$kde_use_qt_mt" = "xyes"; then
896       case $host in
897       *-*-linux-*)
898         if test "x$GCC" = "xyes"; then
899           LIBQT="-lqt-mt"
900           kde_int_qt="-lqt-mt"
901           LIBQT_GLOB="libqt-mt.*"
902           USING_QT_MT="using -mt"
903         fi
904       ;;
905       esac
906   fi
908   kde_qt_was_given=no
910 else
911   kde_int_qt="$LIBQT"
914 if test $kde_qtver = 2; then
916   AC_REQUIRE([AC_FIND_PNG])
917   AC_REQUIRE([AC_FIND_JPEG])
918   LIBQT="$LIBQT $LIBPNG $LIBJPEG"
921 AC_MSG_CHECKING([for Qt])
923 LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
924 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
925 qt_libraries=""
926 qt_includes=""
927 AC_ARG_WITH(qt-dir,
928     [  --with-qt-dir=DIR       where the root of Qt is installed ],
929     [  ac_qt_includes="$withval"/include
930        ac_qt_libraries="$withval"/lib
931        ac_qt_bindir="$withval"/bin
932     ])
934 AC_ARG_WITH(qt-includes,
935     [  --with-qt-includes=DIR  where the Qt includes are. ],
936     [
937        ac_qt_includes="$withval"
938     ])
940 kde_qt_libs_given=no
942 AC_ARG_WITH(qt-libraries,
943     [  --with-qt-libraries=DIR where the Qt library is installed.],
944     [  ac_qt_libraries="$withval"
945        kde_qt_libs_given=yes
946     ])
948 AC_CACHE_VAL(ac_cv_have_qt,
949 [#try to guess Qt locations
951 qt_incdirs=""
952 for dir in $kde_qt_dirs; do
953    qt_incdirs="$qt_incdirs $dir/include $dir"
954 done
955 qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt $x_includes"
956 if test ! "$ac_qt_includes" = "NO"; then
957    qt_incdirs="$ac_qt_includes $qt_incdirs"
960 if test "$kde_qtver" = "2"; then
961   kde_qt_header=qstyle.h
962 else
963   kde_qt_header=qglobal.h
966 AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
967 ac_qt_includes="$qt_incdir"
969 qt_libdirs=""
970 for dir in $kde_qt_dirs; do
971    qt_libdirs="$qt_libdirs $dir/lib $dir"
972 done
973 qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
974 if test ! "$ac_qt_libraries" = "NO"; then
975   qt_libdir=$ac_qt_libraries
976 else
977   qt_libdirs="$ac_qt_libraries $qt_libdirs"
978   # if the Qt was given, the chance is too big that libqt.* doesn't exist
979   qt_libdir=NONE
980   for dir in $qt_libdirs; do
981     try="ls -1 $dir/${LIBQT_GLOB}"
982     if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
983   done
986 ac_qt_libraries="$qt_libdir"
988 AC_LANG_SAVE
989 AC_LANG_CPLUSPLUS
991 ac_cxxflags_safe="$CXXFLAGS"
992 ac_ldflags_safe="$LDFLAGS"
993 ac_libs_safe="$LIBS"
995 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
996 LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS"
997 LIBS="$LIBS $LIBQT"
999 KDE_PRINT_QT_PROGRAM
1001 if AC_TRY_EVAL(ac_link) && test -s conftest; then
1002   rm -f conftest*
1003 else
1004   echo "configure: failed program was:" >&AC_FD_CC
1005   cat conftest.$ac_ext >&AC_FD_CC
1006   ac_qt_libraries="NO"
1008 rm -f conftest*
1009 CXXFLAGS="$ac_cxxflags_safe"
1010 LDFLAGS="$ac_ldflags_safe"
1011 LIBS="$ac_libs_safe"
1013 AC_LANG_RESTORE
1014 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
1015   ac_cv_have_qt="have_qt=no"
1016   ac_qt_notfound=""
1017   if test "$ac_qt_includes" = NO; then
1018     if test "$ac_qt_libraries" = NO; then
1019       ac_qt_notfound="(headers and libraries)";
1020     else
1021       ac_qt_notfound="(headers)";
1022     fi
1023   else
1024     ac_qt_notfound="(libraries)";
1025   fi
1027   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
1028 For more details about this problem, look at the end of config.log.])
1029 else
1030   have_qt="yes"
1034 eval "$ac_cv_have_qt"
1036 if test "$have_qt" != yes; then
1037   AC_MSG_RESULT([$have_qt]);
1038 else
1039   ac_cv_have_qt="have_qt=yes \
1040     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
1041   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
1043   qt_libraries="$ac_qt_libraries"
1044   qt_includes="$ac_qt_includes"
1047 if test ! "$kde_qt_libs_given" = "yes"; then
1048 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
1051 AC_SUBST(qt_libraries)
1052 AC_SUBST(qt_includes)
1054 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
1055  QT_INCLUDES="";
1056 else
1057  QT_INCLUDES="-I$qt_includes"
1058  all_includes="$QT_INCLUDES $all_includes"
1061 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
1062  QT_LDFLAGS=""
1063 else
1064  QT_LDFLAGS="-L$qt_libraries"
1065  all_libraries="$all_libraries $QT_LDFLAGS"
1068 AC_SUBST(QT_INCLUDES)
1069 AC_SUBST(QT_LDFLAGS)
1070 AC_PATH_QT_MOC_UIC
1072 LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)'
1073 AC_SUBST(LIB_QT)
1077 AC_DEFUN(AC_PATH_QT,
1079 AC_PATH_QT_1_3
1082 AC_DEFUN(KDE_CHECK_FINAL,
1084   AC_ARG_ENABLE(final, [  --enable-final          build size optimized apps (experimental - needs lots of memory)],
1085         kde_use_final=$enableval, kde_use_final=no)
1087   KDE_COMPILER_REPO
1088   if test "x$kde_use_final" = "xyes"; then
1089       KDE_USE_FINAL_TRUE=""
1090       KDE_USE_FINAL_FALSE="#"
1091    else
1092       KDE_USE_FINAL_TRUE="#"
1093       KDE_USE_FINAL_FALSE=""
1094   fi
1095   AC_SUBST(KDE_USE_FINAL_TRUE)
1096   AC_SUBST(KDE_USE_FINAL_FALSE)
1098   AC_ARG_ENABLE(closure, [  --disable-closure       don't delay template instantiation],
1099         kde_use_closure=$enableval, kde_use_closure=yes)
1101   if test "x$kde_use_closure" = "xyes"; then
1102        KDE_USE_CLOSURE_TRUE=""
1103        KDE_USE_CLOSURE_FALSE="#"
1104 #       CXXFLAGS="$CXXFLAGS $REPO"
1105   else
1106        KDE_USE_CLOSURE_TRUE="#"
1107        KDE_USE_CLOSURE_FALSE=""
1108   fi
1109   AC_SUBST(KDE_USE_CLOSURE_TRUE)
1110   AC_SUBST(KDE_USE_CLOSURE_FALSE)
1113 dnl ------------------------------------------------------------------------
1114 dnl Now, the same with KDE
1115 dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
1116 dnl and $(kde_includes) will be the kdehdrlocation (if needed)
1117 dnl ------------------------------------------------------------------------
1119 AC_DEFUN(AC_BASE_PATH_KDE,
1121 AC_PREREQ([2.13])
1122 AC_REQUIRE([AC_PATH_QT])dnl
1123 AC_CHECK_RPATH
1124 AC_MSG_CHECKING([for KDE])
1126 if test "${prefix}" != NONE; then
1127   kde_includes=${prefix}/include
1128   ac_kde_includes=$prefix/include
1130   if test "${exec_prefix}" != NONE; then
1131     kde_libraries=${exec_prefix}/lib
1132     ac_kde_libraries=$exec_prefix/lib
1133   else
1134     kde_libraries=${prefix}/lib
1135     ac_kde_libraries=$prefix/lib
1136   fi
1137 else
1138   ac_kde_includes=
1139   ac_kde_libraries=
1140   kde_libraries=""
1141   kde_includes=""
1144 AC_CACHE_VAL(ac_cv_have_kde,
1145 [#try to guess kde locations
1147 if test "$kde_qtver" = 1; then
1148   kde_check_header="ksock.h"
1149   kde_check_lib="libkdecore.la"
1150 else
1151   kde_check_header="ksharedptr.h"
1152   kde_check_lib="libkio.la"
1155 if test -z "$1"; then
1157 kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes"
1158 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
1159 kde_incdirs="$ac_kde_includes $kde_incdirs"
1160 AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
1161 ac_kde_includes="$kde_incdir"
1163 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
1164   AC_MSG_ERROR([
1165 in the prefix, you've chosen, are no KDE headers installed. This will fail.
1166 So, check this please and use another prefix!])
1169 kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib"
1170 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
1171 kde_libdirs="$ac_kde_libraries $kde_libdirs"
1172 AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
1173 ac_kde_libraries="$kde_libdir"
1175 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
1176 AC_MSG_ERROR([
1177 in the prefix, you've chosen, are no KDE libraries installed. This will fail.
1178 So, check this please and use another prefix!])
1180 ac_kde_libraries="$kde_libdir"
1182 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
1183   ac_cv_have_kde="have_kde=no"
1184 else
1185   ac_cv_have_kde="have_kde=yes \
1186     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1189 else dnl test -z $1
1191   ac_cv_have_kde="have_kde=no"
1194 ])dnl
1196 eval "$ac_cv_have_kde"
1198 if test "$have_kde" != "yes"; then
1199  if test "${prefix}" = NONE; then
1200   ac_kde_prefix="$ac_default_prefix"
1201  else
1202   ac_kde_prefix="$prefix"
1203  fi
1204  if test "$exec_prefix" = NONE; then
1205   ac_kde_exec_prefix="$ac_kde_prefix"
1206   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
1207  else
1208   ac_kde_exec_prefix="$exec_prefix"
1209   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
1210  fi
1212  kde_libraries="${ac_kde_exec_prefix}/lib"
1213  kde_includes=${ac_kde_prefix}/include
1215 else
1216   ac_cv_have_kde="have_kde=yes \
1217     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1218   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
1220   kde_libraries="$ac_kde_libraries"
1221   kde_includes="$ac_kde_includes"
1223 AC_SUBST(kde_libraries)
1224 AC_SUBST(kde_includes)
1226 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
1227  KDE_INCLUDES=""
1228 else
1229  KDE_INCLUDES="-I$kde_includes"
1230  all_includes="$KDE_INCLUDES $all_includes"
1233 KDE_LDFLAGS="-L$kde_libraries"
1234 if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then 
1235  all_libraries="$all_libraries $KDE_LDFLAGS"
1238 AC_SUBST(KDE_LDFLAGS)
1239 AC_SUBST(KDE_INCLUDES)
1241 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1243 all_libraries="$all_libraries $USER_LDFLAGS"
1244 all_includes="$all_includes $USER_INCLUDES"
1245 AC_SUBST(all_includes)
1246 AC_SUBST(all_libraries)
1248 AC_SUBST(AUTODIRS)
1251 AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
1253 AC_MSG_CHECKING(for extra includes)
1254 AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
1255                           adds non standard include paths],
1256   kde_use_extra_includes="$withval",
1257   kde_use_extra_includes=NONE
1259 kde_extra_includes=
1260 if test -n "$kde_use_extra_includes" && \
1261    test "$kde_use_extra_includes" != "NONE"; then
1263    ac_save_ifs=$IFS
1264    IFS=':'
1265    for dir in $kde_use_extra_includes; do
1266      kde_extra_includes="$kde_extra_includes $dir"
1267      USER_INCLUDES="$USER_INCLUDES -I$dir"
1268    done
1269    IFS=$ac_save_ifs
1270    kde_use_extra_includes="added"
1271 else
1272    kde_use_extra_includes="no"
1274 AC_SUBST(USER_INCLUDES)
1276 AC_MSG_RESULT($kde_use_extra_includes)
1278 kde_extra_libs=
1279 AC_MSG_CHECKING(for extra libs)
1280 AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths],
1281   kde_use_extra_libs=$withval,
1282   kde_use_extra_libs=NONE
1284 if test -n "$kde_use_extra_libs" && \
1285    test "$kde_use_extra_libs" != "NONE"; then
1287    ac_save_ifs=$IFS
1288    IFS=':'
1289    for dir in $kde_use_extra_libs; do
1290      kde_extra_libs="$kde_extra_libs $dir"
1291      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
1292      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
1293    done
1294    IFS=$ac_save_ifs
1295    kde_use_extra_libs="added"
1296 else
1297    kde_use_extra_libs="no"
1300 AC_SUBST(USER_LDFLAGS)
1302 AC_MSG_RESULT($kde_use_extra_libs)
1306 AC_DEFUN(KDE_1_CHECK_PATH_HEADERS,
1308     AC_MSG_CHECKING([for KDE headers installed])
1309     AC_LANG_SAVE
1310     AC_LANG_CPLUSPLUS
1311 cat > conftest.$ac_ext <<EOF
1312 #include <stdio.h>
1313 #include "confdefs.h"
1314 #include <kapp.h>
1316 int main() {
1317     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
1318     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
1319     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
1320     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
1321     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
1322     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
1323     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
1324     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
1325     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
1326     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
1327     printf("kde_wallpaperdir=\\"%s\\"\n",
1328         KApplication::kde_wallpaperdir().data());
1329     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
1330     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
1331     printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
1332     printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
1333     printf("kde_moduledir=\\"/tmp/dummy\\"\n");
1334     return 0;
1335     }
1338  ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
1339  if AC_TRY_EVAL(ac_compile); then
1340    AC_MSG_RESULT(yes)
1341  else
1342    AC_MSG_ERROR([your system is not able to compile a small KDE application!
1343 Check, if you installed the KDE header files correctly.
1344 For more details about this problem, look at the end of config.log.])
1345   fi
1347   AC_LANG_RESTORE
1350 AC_DEFUN(KDE_CHECK_KDEQTADDON,
1352 AC_MSG_CHECKING(for kde-qt-addon)
1353 AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
1355  kde_ldflags_safe="$LDFLAGS"
1356  kde_libs_safe="$LIBS"
1357  kde_cxxflags_safe="$CXXFLAGS"
1359  LIBS="-lkde-qt-addon $LIBQT $LIBS"
1360  CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
1361  LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
1363  AC_TRY_LINK([
1364    #include <qdom.h>
1365  ],
1367    QDomDocument doc;
1368  ],
1369   kde_cv_have_kdeqtaddon=yes,
1370   kde_cv_have_kdeqtaddon=no
1373  LDFLAGS=$kde_ldflags_safe
1374  LIBS=$kde_libs_safe
1375  kde_cxxflags_safe="$CXXFLAGS"
1378 AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
1380 if test "$kde_cv_have_kdeqtaddon" = "no"; then
1381   AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
1382 It is a separate package (and CVS module) named kde-qt-addon.])
1386 AC_DEFUN(KDE_CHECK_KIMGIO,
1388    AC_REQUIRE([AC_BASE_PATH_KDE])
1389    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1390    AC_REQUIRE([AC_FIND_TIFF])
1391    AC_REQUIRE([AC_FIND_JPEG])
1392    AC_REQUIRE([AC_FIND_PNG])
1393    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
1395    if test "$1" = "existance"; then
1396      AC_LANG_SAVE
1397      AC_LANG_CPLUSPLUS
1398      kde_save_LIBS="$LIBS"
1399      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
1400      AC_CHECK_LIB(kimgio, kimgioRegister, [
1401       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
1402       LIBS="$kde_save_LIBS"
1403       AC_LANG_RESTORE
1404    else
1405       LIBKIMGIO_EXISTS=yes
1406    fi
1408    if test "$LIBKIMGIO_EXISTS" = "yes"; then
1409      LIB_KIMGIO='-lkimgio'
1410    else
1411      LIB_KIMGIO=''
1412    fi
1413    AC_SUBST(LIB_KIMGIO)
1416 AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
1418    AC_REQUIRE([KDE_MISC_TESTS])
1419    AC_REQUIRE([KDE_CHECK_LIBDL])
1420    AC_REQUIRE([K_PATH_X])
1422 if test $kde_qtver = 2; then
1423    LIB_KDECORE='-lkdecore'
1424    AC_SUBST(LIB_KDECORE)
1425    LIB_KDEUI='-lkdeui'
1426    AC_SUBST(LIB_KDEUI)
1427    LIB_KFORMULA='-lkformula'
1428    AC_SUBST(LIB_KFORMULA)
1429    LIB_KIO='-lkio'
1430    AC_SUBST(LIB_KIO)
1431    LIB_KSYCOCA='-lksycoca'
1432    AC_SUBST(LIB_KSYCOCA)
1433    LIB_SMB='-lsmb'
1434    AC_SUBST(LIB_SMB)
1435    LIB_KFILE='-lkfile'
1436    AC_SUBST(LIB_KFILE)
1437    LIB_KAB='-lkab'
1438    AC_SUBST(LIB_KAB)
1439    LIB_KHTML='-lkhtml'
1440    AC_SUBST(LIB_KHTML)
1441    LIB_KSPELL='-lkspell'
1442    AC_SUBST(LIB_KSPELL)
1443    LIB_KPARTS='-lkparts'
1444    AC_SUBST(LIB_KPARTS)
1445    LIB_KWRITE='-lkwrite'
1446    AC_SUBST(LIB_KWRITE)
1447 else
1448    LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
1449    AC_SUBST(LIB_KDECORE)
1450    LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
1451    AC_SUBST(LIB_KDEUI)
1452    LIB_KFM='-lkfm $(LIB_KDECORE)'
1453    AC_SUBST(LIB_KFM)
1454    LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
1455    AC_SUBST(LIB_KFILE)
1456    LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
1457    AC_SUBST(LIB_KAB)
1461 AC_DEFUN(AC_PATH_KDE,
1463   AC_BASE_PATH_KDE
1464   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
1465   [
1466   if test "$enableval" = "no";
1467     then ac_use_path_checking="default"
1468     else ac_use_path_checking=""
1469   fi
1470   ],
1471   [
1472   if test "$kde_qtver" = 1;
1473     then ac_use_path_checking=""
1474     else ac_use_path_checking="default"
1475   fi
1476   ]
1477   )
1479   AC_CREATE_KFSSTND($ac_use_path_checking)
1481   AC_SUBST_KFSSTND
1482   KDE_CREATE_LIBS_ALIASES
1485 dnl obsolete
1486 AC_DEFUN(AC_CHECK_SETENV,
1488    AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl 
1489    AC_CHECK_FUNCS([setenv unsetenv])
1492 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
1494 AC_MSG_CHECKING(for getdomainname)
1495 AC_CACHE_VAL(ac_cv_func_getdomainname,
1497 AC_LANG_SAVE
1498 AC_LANG_CPLUSPLUS
1499 save_CXXFLAGS="$CXXFLAGS"
1500 kde_safe_LIBS="$LIBS"
1501 LIBS="$LIBS $X_EXTRA_LIBS"
1502 if test "$GCC" = "yes"; then
1503 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1505 AC_TRY_COMPILE([
1506 #include <stdlib.h>
1507 #include <unistd.h>
1510 char buffer[200];
1511 getdomainname(buffer, 200);
1513 ac_cv_func_getdomainname=yes,
1514 ac_cv_func_getdomainname=no)
1515 CXXFLAGS="$save_CXXFLAGS"
1516 LIBS=$kde_safe_LIBS
1517 AC_LANG_RESTORE
1519 AC_MSG_RESULT($ac_cv_func_getdomainname)
1521 AC_MSG_CHECKING([if getdomainname needs custom prototype])
1522 AC_CACHE_VAL(ac_cv_proto_getdomainname,
1524 AC_LANG_SAVE
1525 AC_LANG_CPLUSPLUS
1526 if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1527   ac_cv_proto_getdomainname=no
1528 else
1529   kde_safe_libs=$LIBS
1530   LIBS="$LIBS $X_EXTRA_LIBS"
1531   AC_TRY_LINK([
1532 #include <stdlib.h>
1533 #include <unistd.h>
1535 extern "C" int getdomainname (char *, int);
1538 char buffer[200];
1539 getdomainname(buffer, 200);
1541   ac_cv_func_getdomainname=yes
1542   ac_cv_proto_getdomainname=yes,
1543   AC_MSG_RESULT([fatal error])
1544   AC_MSG_ERROR([getdomainname unavailable]))
1546 LIBS=$kde_safe_libs
1547 AC_LANG_RESTORE
1549 AC_MSG_RESULT($ac_cv_proto_getdomainname)
1551 if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1552   AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname])
1554 if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then
1555   AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1,
1556   [Define if you have getdomainname prototype])
1561 AC_DEFUN(AC_CHECK_GETHOSTNAME,
1564 AC_MSG_CHECKING([for gethostname])
1565 AC_CACHE_VAL(ac_cv_func_gethostname,
1567 AC_LANG_SAVE
1568 AC_LANG_CPLUSPLUS
1569 save_CXXFLAGS="$CXXFLAGS"
1570 if test "$GCC" = "yes"; then
1571 CXXFLAGS="$CXXFLAGS -pedantic-errors"
1573 AC_TRY_LINK([
1574 #include <stdlib.h>
1575 #include <unistd.h>
1578 char buffer[200];
1579 gethostname(buffer, 200);
1581 ac_cv_func_gethostname=yes,
1582 ac_cv_func_gethostname=no)
1583 CXXFLAGS="$save_CXXFLAGS"
1584 AC_LANG_RESTORE
1586 AC_MSG_RESULT($ac_cv_func_gethostname)
1588 AC_MSG_CHECKING([if gethostname needs custom prototype])
1589 AC_CACHE_VAL(ac_cv_proto_gethostname,
1591 AC_LANG_SAVE
1592 AC_LANG_CPLUSPLUS
1593 if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
1594   ac_cv_proto_gethostname=no
1595 else
1596   AC_TRY_LINK([
1597 #include <stdlib.h>
1598 #include <unistd.h>
1600 extern "C" int gethostname (char *, int);
1603 char buffer[200];
1604 gethostname(buffer, 200);
1606   ac_cv_func_gethostname=yes
1607   ac_cv_proto_gethostname=yes,
1608   AC_MSG_RESULT([fatal error])
1609   AC_MSG_ERROR(gethostname unavailable))
1611 AC_LANG_RESTORE
1613 AC_MSG_RESULT($ac_cv_proto_gethostname)
1615 if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then
1616   AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1,
1617   [Define if you have gethostname prototype])
1619 if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
1620   AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have getdomainname])
1624 AC_DEFUN(AC_CHECK_USLEEP,
1626 AC_MSG_CHECKING([for usleep])
1627 AC_CACHE_VAL(ac_cv_func_usleep,
1629 AC_LANG_SAVE
1630 AC_LANG_CPLUSPLUS
1631 ac_libs_safe="$LIBS"
1632 LIBS="$LIBS $LIBUCB"
1633 AC_TRY_LINK([
1634 #include <stdlib.h>
1635 #include <unistd.h>
1638 usleep(200);
1640 ac_cv_func_usleep=yes,
1641 ac_cv_func_usleep=no)
1642 LIBS="$ac_libs_safe"
1643 AC_LANG_RESTORE
1645 AC_MSG_RESULT($ac_cv_func_usleep)
1646 if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then
1647   AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function])
1651 AC_DEFUN(AC_CHECK_RANDOM,
1653 AC_MSG_CHECKING([for random])
1654 AC_CACHE_VAL(ac_cv_func_random,
1656 AC_LANG_SAVE
1657 AC_LANG_CPLUSPLUS
1658 ac_libs_safe="$LIBS"
1659 LIBS="$LIBS $LIBUCB"
1660 AC_TRY_LINK([
1661 #include <stdlib.h>
1664 random();
1666 ac_cv_func_random=yes,
1667 ac_cv_func_random=no)
1668 LIBS="$ac_libs_safe"
1669 AC_LANG_RESTORE
1671 AC_MSG_RESULT($ac_cv_func_random)
1672 if eval "test \"`echo $ac_cv_func_random`\" = yes"; then
1673   AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random])
1677 AC_DEFUN(AC_FIND_GIF,
1678    [AC_MSG_CHECKING([for giflib])
1679 AC_CACHE_VAL(ac_cv_lib_gif,
1680 [ac_save_LIBS="$LIBS"
1681 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
1682 AC_TRY_LINK(dnl
1684 #ifdef __cplusplus
1685 extern "C" {
1686 #endif
1687 int GifLastError(void);
1688 #ifdef __cplusplus
1690 #endif
1691 /* We use char because int might match the return type of a gcc2
1692     builtin and then its argument prototype would still apply.  */
1694             [return GifLastError();],
1695             eval "ac_cv_lib_gif=yes",
1696             eval "ac_cv_lib_gif=no")
1697 LIBS="$ac_save_LIBS"
1698 ])dnl
1699 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1700   AC_MSG_RESULT(yes)
1701   AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
1702 else
1703   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
1707 AC_DEFUN(KDE_FIND_JPEG_HELPER,
1709 AC_MSG_CHECKING([for libjpeg$2])
1710 AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
1712 AC_LANG_C
1713 ac_save_LIBS="$LIBS"
1714 LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
1715 ac_save_CFLAGS="$CFLAGS"
1716 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
1717 AC_TRY_LINK(
1718 [/* Override any gcc2 internal prototype to avoid an error.  */
1719 struct jpeg_decompress_struct;
1720 typedef struct jpeg_decompress_struct * j_decompress_ptr;
1721 typedef int size_t;
1722 #ifdef __cplusplus
1723 extern "C" {
1724 #endif
1725     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1726                                     int version, size_t structsize);
1727 #ifdef __cplusplus
1729 #endif
1730 /* We use char because int might match the return type of a gcc2
1731     builtin and then its argument prototype would still apply.  */
1733             [jpeg_CreateDecompress(0L, 0, 0);],
1734             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
1735             eval "ac_cv_lib_jpeg_$1=no")
1736 LIBS="$ac_save_LIBS"
1737 CFLAGS="$ac_save_CFLAGS"
1740 if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
1741   LIBJPEG="$ac_cv_lib_jpeg_$1"
1742   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
1743 else
1744   AC_MSG_RESULT(no)
1745   $3
1750 AC_DEFUN(AC_FIND_JPEG,
1752 dnl first look for libraries
1753 KDE_FIND_JPEG_HELPER(6b, 6b,
1754    KDE_FIND_JPEG_HELPER(normal, [],
1755     [
1756 dnl what to do, if the normal way fails:
1757         if test -f "$kde_libraries/libjpeg.so"; then
1758            test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
1759            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1760         else if test -f "$kde_libraries/libjpeg.sl"; then
1761            test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
1762            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"      
1763         else if test -f "$kde_libraries/libjpeg.a"; then
1764            test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
1765            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1766         else
1767           ac_cv_lib_jpeg=
1768         fi
1769       fi
1770    fi
1772    LIBJPEG=$ac_cv_lib_jpeg
1775 dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
1776 dnl requires system dependent includes loaded before it)
1777 jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes"
1778 AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
1779 test "x$jpeg_incdir" = xNO && jpeg_incdir=
1781 dnl if headers _and_ libraries are missing, this is no error, and we
1782 dnl continue with a warning (the user will get no jpeg support in khtml)
1783 dnl if only one is missing, it means a configuration error, but we still
1784 dnl only warn
1785 if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
1786   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
1787 else
1788   if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
1789     AC_MSG_WARN([
1790 There is an installation error in jpeg support. You seem to have only one
1791 of either the headers _or_ the libraries installed. You may need to either
1792 provide correct --with-extra-... options, or the development package of
1793 libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
1794 Disabling JPEG support.
1796   else
1797     AC_MSG_WARN([libjpeg not found. disable JPEG support.])
1798   fi
1799   jpeg_incdir=
1800   LIBJPEG=
1803 AC_SUBST(LIBJPEG)
1806 AC_DEFUN(AC_FIND_ZLIB,
1808 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1809 AC_MSG_CHECKING([for libz])
1810 AC_CACHE_VAL(ac_cv_lib_z,
1812 AC_LANG_C
1813 kde_save_LIBS="$LIBS"
1814 LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
1815 kde_save_CFLAGS="$CFLAGS"
1816 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
1817 AC_TRY_LINK(dnl
1819 #include<zlib.h>
1821             [return (zlibVersion() == ZLIB_VERSION); ],
1822             eval "ac_cv_lib_z='-lz'",
1823             eval "ac_cv_lib_z=no")
1824 LIBS="$kde_save_LIBS"
1825 CFLAGS="$kde_save_CFLAGS"
1826 ])dnl
1827 if test ! "$ac_cv_lib_z" = no; then
1828   AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
1829   LIBZ="$ac_cv_lib_z"
1830   AC_SUBST(LIBZ)
1831   AC_MSG_RESULT($ac_cv_lib_z)
1832 else
1833   AC_MSG_ERROR(not found. Check your installation and look into config.log)
1834   LIBZ=""
1835   AC_SUBST(LIBZ)
1839 AC_DEFUN(KDE_TRY_TIFFLIB,
1841 AC_MSG_CHECKING([for libtiff $1])
1843 AC_CACHE_VAL(kde_cv_libtiff_$1,
1845 AC_LANG_SAVE
1846 AC_LANG_CPLUSPLUS
1847 kde_save_LIBS="$LIBS"
1848 LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
1849 kde_save_CXXFLAGS="$CXXFLAGS"
1850 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
1852 AC_TRY_LINK(dnl
1854 #include<tiffio.h>
1856     [return (TIFFOpen( "", "r") == 0); ],
1858     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
1859 ], [
1860     kde_cv_libtiff_$1=no
1863 LIBS="$kde_save_LIBS"
1864 CXXFLAGS="$kde_save_CXXFLAGS"
1865 AC_LANG_RESTORE
1868 if test "$kde_cv_libtiff_$1" = "no"; then
1869     AC_MSG_RESULT(no)
1870     LIBTIFF=""
1871     $3
1872 else
1873     LIBTIFF="$kde_cv_libtiff_$1"
1874     AC_MSG_RESULT(yes)
1875     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
1876     $2
1881 AC_DEFUN(AC_FIND_TIFF,
1883 AC_REQUIRE([K_PATH_X])
1884 AC_REQUIRE([AC_FIND_ZLIB])
1885 AC_REQUIRE([AC_FIND_JPEG])
1886 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1888 KDE_TRY_TIFFLIB(tiff, [],
1889    KDE_TRY_TIFFLIB(tiff34))
1891 AC_SUBST(LIBTIFF)
1895 AC_DEFUN(AC_FIND_PNG,
1897 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1898 AC_REQUIRE([AC_FIND_ZLIB])
1899 AC_MSG_CHECKING([for libpng])
1900 AC_CACHE_VAL(ac_cv_lib_png,
1902 kde_save_LIBS="$LIBS"
1903 LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
1904 kde_save_CFLAGS="$CFLAGS"
1905 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
1906 AC_LANG_C
1907 AC_TRY_LINK(dnl
1908     [
1909     #include<png.h>
1910     ],
1911     [
1912     png_structp png_ptr = png_create_read_struct(  /* image ptr */
1913                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1914     return( png_ptr != 0 );
1915     ],
1916     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
1917     eval "ac_cv_lib_png=no"
1919 LIBS="$kde_save_LIBS"
1920 CFLAGS="$kde_save_CFLAGS"
1921 ])dnl
1922 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
1923   AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
1924   LIBPNG="$ac_cv_lib_png"
1925   AC_SUBST(LIBPNG)
1926   AC_MSG_RESULT($ac_cv_lib_png)
1927 else
1928   AC_MSG_RESULT(no)
1929   LIBPNG=""
1930   AC_SUBST(LIBPNG)
1934 AC_DEFUN(AC_CHECK_BOOL,
1936   AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
1939 AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
1941 AC_MSG_CHECKING(if you need GNU extensions)
1942 AC_CACHE_VAL(ac_cv_gnu_extensions,
1944 cat > conftest.c << EOF
1945 #include <features.h>
1947 #ifdef __GNU_LIBRARY__
1949 #endif
1952 if (eval "$ac_cpp conftest.c") 2>&5 |
1953   egrep "yes" >/dev/null 2>&1; then
1954   rm -rf conftest*
1955   ac_cv_gnu_extensions=yes
1956 else
1957   ac_cv_gnu_extensions=no
1961 AC_MSG_RESULT($ac_cv_gnu_extensions)
1962 if test "$ac_cv_gnu_extensions" = "yes"; then
1963   AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
1967 AC_DEFUN(KDE_CHECK_COMPILER_FLAG,
1969 AC_REQUIRE([AC_CHECK_COMPILERS])
1970 AC_MSG_CHECKING(whether $CXX supports -$1)
1971 kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'`
1972 AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
1974 echo 'int main() { return 0; }' >conftest.cc
1975 eval "kde_cv_prog_cxx_$kde_cache=no"
1976 if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then
1977   if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then
1978     eval "kde_cv_prog_cxx_$kde_cache=yes"
1979   fi
1981 rm -f conftest*
1983 if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
1984  AC_MSG_RESULT(yes)
1986  $2
1987 else
1988  AC_MSG_RESULT(no)
1990  $3
1994 AC_DEFUN(KDE_PROG_CC_PG,
1995 [ AC_CACHE_CHECK(whether ${CC-cc} accepts -pg, kde_cv_prog_cc_pg,
1996   [echo 'void f(){}' > conftest.c
1997    if test -z "`${CC-cc} -pg -c conftest.c 2>&1`"; then
1998      kde_cv_prog_cc_pg=yes
1999    else
2000      kde_cv_prog_cc_pg=no
2001    fi
2002    rm -f conftest*
2003 ])])
2005 AC_DEFUN(KDE_PROG_CXX_PG,
2006 [ AC_CACHE_CHECK(whether ${CXX-g++} accepts -pg, kde_cv_prog_cxx_pg,
2007   [echo 'void f(){}' > conftest.cc
2008    if test -z "`${CXX-g++} -pg -c conftest.cc 2>&1`"; then
2009      kde_cv_prog_cxx_pg=yes
2010    else
2011      kde_cv_prog_cxx_pg=no
2012    fi
2013   rm -f conftest*
2014 ])])
2016 dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
2017 dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
2018 dnl it's all white-space separated
2019 AC_DEFUN(AC_REMOVE_FORBIDDEN,
2020 [ __val=$$1
2021   __forbid=" $2 "
2022   if test -n "$__val"; then
2023     __new=""
2024     ac_save_IFS=$IFS
2025     IFS="       "
2026     for i in $__val; do
2027       case "$__forbid" in
2028         *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
2029         *) # Careful to not add spaces, where there were none, because otherwise
2030            # libtool gets confused, if we change e.g. CXX
2031            if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
2032       esac
2033     done
2034     IFS=$ac_save_IFS
2035     $1=$__new
2036   fi
2039 dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
2040 AC_DEFUN(AC_VALIDIFY_CXXFLAGS,
2041 [dnl
2042  AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
2043  AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
2046 AC_DEFUN(AC_CHECK_COMPILERS,
2048   dnl this is somehow a fat lie, but prevents other macros from double checking
2049   AC_PROVIDE([AC_PROG_CC])
2050   AC_PROVIDE([AC_PROG_CPP])
2051   AC_PROVIDE([AC_PROG_CXX])
2052   AC_PROVIDE([AC_PROG_CXXCPP])
2054   AC_ARG_ENABLE(debug,[  --enable-debug          enables debug symbols [default=no]],
2055   [
2056    if test $enableval = "no"; dnl
2057      then
2058        kde_use_debug_code="no"
2059        kde_use_debug_define=yes
2060      else
2061        kde_use_debug_code="yes"
2062        kde_use_debug_define=no
2063    fi
2064   ], [kde_use_debug_code="no"
2065       kde_use_debug_define=no
2066     ])
2067   dnl Just for configure --help
2068   AC_ARG_ENABLE(dummyoption,[  --disable-debug         disables debug output and debug symbols [default=no]],[],[])
2070   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
2071    [
2072     if test $enableval = "no"; then
2073          kde_use_strict_options="no"
2074        else
2075          kde_use_strict_options="yes"
2076     fi
2077    ], [kde_use_strict_options="no"])
2079   AC_ARG_ENABLE(profile,[  --enable-profile        creates profiling infos [default=no]],
2080      [kde_use_profiling=$enableval],
2081      [kde_use_profiling="no"]
2082   )
2084 dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
2085   AC_MSG_CHECKING(for a C-Compiler)
2086   dnl if there is one, print out. if not, don't matter
2087   AC_MSG_RESULT($CC)
2089   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
2090   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
2091   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
2092   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
2094   AC_PROG_CC_WORKS
2095   AC_PROG_CC_GNU
2097   if test $ac_cv_prog_gcc = yes; then
2098     GCC=yes
2099   else
2100     GCC=
2101   fi
2103   USER_CFLAGS=$CFLAGS
2104   CFLAGS=
2106   if test -z "$CFLAGS"; then
2107     if test "$kde_use_debug_code" = "yes"; then
2108       AC_PROG_CC_G
2109       if test $ac_cv_prog_cc_g = yes; then
2110         CFLAGS="-g"
2111         case $host in
2112         *-*-linux-gnu)  
2113            CFLAGS="$CFLAGS -ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE -D_BSD_SOURCE"
2114          ;;
2115         esac
2116       fi
2117     else
2118       if test "$GCC" = "yes"; then
2119         CFLAGS="-O2"
2120       else
2121         CFLAGS=""
2122       fi
2123       if test "$kde_use_debug_define" = "yes"; then
2124         CFLAGS="$CFLAGS -DNDEBUG"
2125         dnl damn buggy compilers :-(
2126         dnl if test "$GCC" = "yes"; then
2127         dnl  CFLAGS="$CFLAGS -fomit-frame-pointer"
2128         dnl   CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
2129         dnl fi
2130       fi
2131     fi
2133     if test "$kde_use_profiling" = yes; then
2134       KDE_PROG_CC_PG
2135       if test "$kde_cv_prog_cc_pg" = yes; then
2136         CFLAGS="$CFLAGS -pg"
2137       fi
2138     fi
2140     if test "$GCC" = "yes"; then
2141      CFLAGS="$CFLAGS"
2143      if test "$kde_use_strict_options" = "yes"; then
2144         CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
2145      fi
2146     fi
2148   fi
2150   case "$host" in
2151   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
2152   *-*-sysv5uw7*) CFLAGS="$CFLAGS -D_UNIXWARE7";;
2153   esac
2155   if test -n "$USER_CFLAGS"; then
2156     CFLAGS="$CFLAGS $USER_CFLAGS"
2157   fi
2159   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
2160      LDFLAGS=""
2161   fi
2164 dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
2165 dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
2167   AC_MSG_CHECKING(how to run the C preprocessor)
2168   # On Suns, sometimes $CPP names a directory.
2169   if test -n "$CPP" && test -d "$CPP"; then
2170     CPP=
2171   fi
2172   if test -z "$CPP"; then
2173   AC_CACHE_VAL(ac_cv_prog_CPP,
2174   [  # This must be in double quotes, not single quotes, because CPP may get
2175     # substituted into the Makefile and "${CC-cc}" will confuse make.
2176     CPP="${CC-cc} -E"
2177     # On the NeXT, cc -E runs the code through the compiler's parser,
2178     # not just through cpp.
2179     dnl Use a header file that comes with gcc, so configuring glibc
2180     dnl with a fresh cross-compiler works.
2181     AC_TRY_CPP([#include <assert.h>
2182     Syntax Error], ,
2183     CPP="${CC-cc} -E -traditional-cpp"
2184     AC_TRY_CPP([#include <assert.h>
2185     Syntax Error], , CPP=/lib/cpp))
2186     ac_cv_prog_CPP="$CPP"])dnl
2187     CPP="$ac_cv_prog_CPP"
2188   else
2189     ac_cv_prog_CPP="$CPP"
2190   fi
2191   AC_MSG_RESULT($CPP)
2192   AC_SUBST(CPP)dnl
2195   AC_MSG_CHECKING(for a C++-Compiler)
2196   dnl if there is one, print out. if not, don't matter
2197   AC_MSG_RESULT($CXX)
2199   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
2200   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
2201   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
2202   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
2203   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
2205   AC_PROG_CXX_WORKS
2206   AC_PROG_CXX_GNU
2208   if test $ac_cv_prog_gxx = yes; then
2209     GXX=yes
2210   fi
2212   USER_CXXFLAGS=$CXXFLAGS
2213   CXXFLAGS=""
2215   if test -z "$CXXFLAGS"; then
2216     if test "$kde_use_debug_code" = "yes"; then
2217       AC_PROG_CXX_G
2218       if test $ac_cv_prog_cxx_g = yes; then
2219         CXXFLAGS="-g"
2220         case $host in  dnl
2221         *-*-linux-gnu)
2222            CXXFLAGS="$CXXFLAGS -ansi -D_XOPEN_SOURCE -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion"
2223          ;;
2224         esac
2225       fi
2226     else
2227       if test "$GXX" = "yes"; then
2228          CXXFLAGS="-O2"
2229       fi
2230       if test "$kde_use_debug_define" = "yes"; then
2231          CXXFLAGS="$CXXFLAGS -DNDEBUG"
2232       fi
2233     fi
2235     if test "$kde_use_profiling" = yes; then
2236       KDE_PROG_CXX_PG
2237       if test "$kde_cv_prog_cxx_pg" = yes; then
2238         CXXFLAGS="$CXXFLAGS -pg"
2239       fi
2240     fi
2241     
2242     KDE_CHECK_COMPILER_FLAG(fno-exceptions,
2243     [
2244       CXXFLAGS="$CXXFLAGS -fno-exceptions"
2245     ])
2246       
2247 dnl WABA: Nothing wrong with RTTI, keep it on.
2248 dnl    KDE_CHECK_COMPILER_FLAG(fno-rtti,
2249 dnl     [
2250 dnl       CXXFLAGS="$CXXFLAGS -fno-rtti"
2251 dnl     ])
2253     KDE_CHECK_COMPILER_FLAG(fno-check-new,
2254         [
2255           CXXFLAGS="$CXXFLAGS -fno-check-new"
2256         ])
2258     if test "$GXX" = "yes"; then
2259        CXXFLAGS="$CXXFLAGS"
2261        if test true || test "$kde_use_debug_code" = "yes"; then
2262          CXXFLAGS="$CXXFLAGS -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
2264          KDE_CHECK_COMPILER_FLAG(Wno-long-long,
2265          [
2266            CXXFLAGS="$CXXFLAGS -Wno-long-long"
2267          ])
2268          KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,
2269          [
2270            CXXFLAGS="$CXXFLAGS -Wnon-virtual-dtor"
2271          ])
2272          KDE_CHECK_COMPILER_FLAG(fno-builtin,
2273          [
2274            CXXFLAGS="$CXXFLAGS -fno-builtin"
2275          ])
2276         
2277        fi
2279        if test "$kde_use_strict_options" = "yes"; then
2280         CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align"
2281        fi
2283        if test "$kde_very_strict" = "yes"; then
2284          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion"
2285        fi
2286     fi
2287   fi
2289     KDE_CHECK_COMPILER_FLAG(fexceptions,
2290         [
2291           USE_EXCEPTIONS="-fexceptions"
2292         ],
2293           USE_EXCEPTIONS=
2294         )
2295     AC_SUBST(USE_EXCEPTIONS)
2297     KDE_CHECK_COMPILER_FLAG(frtti,
2298         [
2299           USE_RTTI="-frtti"
2300         ],
2301           USE_RTTI=
2302         )
2303     AC_SUBST(USE_RTTI)
2305     case "$host" in
2306       *-*-irix*)  test "$GXX" = yes && CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS" ;;
2307       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
2308       *-*-sysv5uw7*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE7";;
2309       *-*-solaris*) 
2310         if test "$GXX" = yes; then
2311           libstdcpp=`gcc -print-file-name=libstdc++.so`
2312           if test ! -f $libstdcpp; then
2313              AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
2314           fi
2315         fi
2316         ;;
2317     esac
2319     if test -n "$USER_CXXFLAGS"; then
2320        CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
2321     fi
2323     AC_VALIDIFY_CXXFLAGS
2325     AC_MSG_CHECKING(how to run the C++ preprocessor)
2326     if test -z "$CXXCPP"; then
2327       AC_CACHE_VAL(ac_cv_prog_CXXCPP,
2328       [
2329          AC_LANG_SAVE[]dnl
2330          AC_LANG_CPLUSPLUS[]dnl
2331          CXXCPP="${CXX-g++} -E"
2332          AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
2333          ac_cv_prog_CXXCPP="$CXXCPP"
2334          AC_LANG_RESTORE[]dnl
2335      ])dnl
2336      CXXCPP="$ac_cv_prog_CXXCPP"
2337     fi
2338     AC_MSG_RESULT($CXXCPP)
2339     AC_SUBST(CXXCPP)dnl
2341     # the following is to allow programs, that are known to
2342     # have problems when compiled with -O2
2343     if test -n "$CXXFLAGS"; then
2344       kde_safe_IFS=$IFS
2345       IFS=" "
2346       NOOPT_CXXFLAGS=""
2347       for i in $CXXFLAGS; do
2348         case $i in
2349           -O*)
2350                 ;;
2351           *)
2352                 NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i"
2353                 ;;
2354         esac
2355       done
2356       IFS=$kde_safe_IFS
2357     fi
2358     AC_SUBST(NOOPT_CXXFLAGS)
2360     KDE_CHECK_FINAL
2362     ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
2364     KDE_CXXFLAGS=
2365     AC_SUBST(KDE_CXXFLAGS)
2368 AC_DEFUN(KDE_ADD_DEPENDENCIES,
2370    [A]M_DEPENDENCIES(CC)
2371    [A]M_DEPENDENCIES(CXX)
2374 dnl just a wrapper to clean up configure.in
2375 AC_DEFUN(KDE_PROG_LIBTOOL,
2377 AC_REQUIRE([AC_CHECK_COMPILERS])
2378 AC_REQUIRE([AC_ENABLE_SHARED])
2379 AC_REQUIRE([AC_ENABLE_STATIC])
2381 AC_REQUIRE([AC_LIBTOOL_DLOPEN])
2383 AC_LANG_SAVE
2384 AC_LANG_C
2385 AC_OBJEXT
2386 AC_EXEEXT
2387 AC_LANG_RESTORE
2389 AM_PROG_LIBTOOL
2390 AC_LIBTOOL_CXX
2392 LIBTOOL_SHELL="/bin/sh ./libtool"
2393 #  LIBTOOL="$LIBTOOL --silent"
2394 KDE_PLUGIN="-avoid-version -module -no-undefined"
2395 AC_SUBST(KDE_PLUGIN)
2398 AC_DEFUN(KDE_CHECK_TYPES,
2399 [  AC_CHECK_SIZEOF(int, 4)dnl
2400   AC_CHECK_SIZEOF(long, 4)dnl
2401   AC_CHECK_SIZEOF(char *, 4)dnl
2402 ])dnl
2404 AC_DEFUN(KDE_DO_IT_ALL,
2406 AC_CANONICAL_SYSTEM
2407 AC_ARG_PROGRAM
2408 AM_INIT_AUTOMAKE($1, $2)
2409 AM_DISABLE_LIBRARIES
2410 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
2411 AC_CHECK_COMPILERS
2412 KDE_PROG_LIBTOOL
2413 AM_KDE_WITH_NLS
2414 AC_PATH_KDE
2417 AC_DEFUN(AC_CHECK_RPATH,
2419 AC_MSG_CHECKING(for rpath)
2420 AC_ARG_ENABLE(rpath,
2421       [  --disable-rpath         do not use the rpath feature of ld],
2422       USE_RPATH=$enableval, USE_RPATH=yes)
2424 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
2426   KDE_RPATH="-R \$(kde_libraries)"
2428   if test -n "$qt_libraries"; then
2429     KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
2430   fi
2431   dnl $x_libraries is set to /usr/lib in case
2432   if test -n "$X_LDFLAGS"; then
2433     KDE_RPATH="$KDE_RPATH -R \$(x_libraries)"
2434   fi
2435   if test -n "$KDE_EXTRA_RPATH"; then
2436     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
2437   fi
2439 AC_SUBST(KDE_EXTRA_RPATH)
2440 AC_SUBST(KDE_RPATH)
2441 AC_MSG_RESULT($USE_RPATH)
2444 dnl Check for the type of the third argument of getsockname
2445 AC_DEFUN(AC_CHECK_KSIZE_T,
2446 [AC_MSG_CHECKING(for the third argument of getsockname)
2447 AC_CACHE_VAL(ac_cv_ksize_t,
2448 AC_LANG_SAVE
2449 AC_LANG_CPLUSPLUS
2450 [AC_TRY_COMPILE([
2451 #include <sys/types.h>
2452 #include <sys/socket.h>
2454 socklen_t a=0;
2455 getsockname(0,(struct sockaddr*)0, &a);
2457 ac_cv_ksize_t=socklen_t,
2458 ac_cv_ksize_t=)
2459 if test -z "$ac_cv_ksize_t"; then
2460 ac_safe_cxxflags="$CXXFLAGS"
2461 if test "$GCC" = "yes"; then
2462   CXXFLAGS="-Werror $CXXFLAGS"
2464 AC_TRY_COMPILE([
2465 #include <sys/types.h>
2466 #include <sys/socket.h>
2468 int a=0;
2469 getsockname(0,(struct sockaddr*)0, &a);
2471 ac_cv_ksize_t=int,
2472 ac_cv_ksize_t=size_t)
2473 CXXFLAGS="$ac_safe_cxxflags"
2475 AC_LANG_RESTORE
2478 if test -z "$ac_cv_ksize_t"; then
2479   ac_cv_ksize_t=int
2482 AC_MSG_RESULT($ac_cv_ksize_t)
2483 AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t,
2484       [Define the type of the third argument for getsockname]
2489 dnl This is a merge of some macros out of the gettext aclocal.m4
2490 dnl since we don't need anything, I took the things we need
2491 dnl the copyright for them is:
2492 dnl >
2493 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
2494 dnl This Makefile.in is free software; the Free Software Foundation
2495 dnl gives unlimited permission to copy and/or distribute it,
2496 dnl with or without modifications, as long as this notice is preserved.
2498 dnl This program is distributed in the hope that it will be useful,
2499 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
2500 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2501 dnl PARTICULAR PURPOSE.
2502 dnl >
2503 dnl for this file it is relicensed under LGPL
2505 AC_DEFUN(AM_KDE_WITH_NLS,
2506   [
2507     dnl If we use NLS figure out what method
2509     AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
2510         [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
2511     AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2513      if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
2514         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
2515         GMSGFMT=":"
2516       fi
2517       MSGFMT=$GMSGFMT
2518       AC_SUBST(GMSGFMT)
2519       AC_SUBST(MSGFMT)
2521       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
2522         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2524       dnl Test whether we really found GNU xgettext.
2525       if test "$XGETTEXT" != ":"; then
2526         dnl If it is no GNU xgettext we define it as : so that the
2527         dnl Makefiles still can work.
2528         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2529           : ;
2530         else
2531           AC_MSG_RESULT(
2532             [found xgettext programs is not GNU xgettext; ignore it])
2533           XGETTEXT=":"
2534         fi
2535       fi
2536      AC_SUBST(XGETTEXT)
2538   ])
2540 # Search path for a program which passes the given test.
2541 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2543 # serial 1
2544 # Stephan Kulow: I appended a _KDE against name conflicts
2546 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
2547 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2548 AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
2549 [# Extract the first word of "$2", so it can be a program name with args.
2550 set dummy $2; ac_word=[$]2
2551 AC_MSG_CHECKING([for $ac_word])
2552 AC_CACHE_VAL(ac_cv_path_$1,
2553 [case "[$]$1" in
2554   /*)
2555   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2556   ;;
2557   *)
2558   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2559   for ac_dir in ifelse([$5], , $PATH, [$5]); do
2560     test -z "$ac_dir" && ac_dir=.
2561     if test -f $ac_dir/$ac_word; then
2562       if [$3]; then
2563         ac_cv_path_$1="$ac_dir/$ac_word"
2564         break
2565       fi
2566     fi
2567   done
2568   IFS="$ac_save_ifs"
2569 dnl If no 4th arg is given, leave the cache variable unset,
2570 dnl so AC_PATH_PROGS will keep looking.
2571 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2572 ])dnl
2573   ;;
2574 esac])dnl
2575 $1="$ac_cv_path_$1"
2576 if test -n "[$]$1"; then
2577   AC_MSG_RESULT([$]$1)
2578 else
2579   AC_MSG_RESULT(no)
2581 AC_SUBST($1)dnl
2585 # Check whether LC_MESSAGES is available in <locale.h>.
2586 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2588 # serial 1
2590 AC_DEFUN(AM_LC_MESSAGES,
2591   [if test $ac_cv_header_locale_h = yes; then
2592     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2593       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2594        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2595     if test $am_cv_val_LC_MESSAGES = yes; then
2596       AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
2597     fi
2598   fi])
2600 dnl From Jim Meyering.
2601 dnl FIXME: migrate into libit.
2603 AC_DEFUN(AM_FUNC_OBSTACK,
2604 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
2605  [AC_TRY_LINK([#include "obstack.h"],
2606               [struct obstack *mem;obstack_free(mem,(char *) 0)],
2607               am_cv_func_obstack=yes,
2608               am_cv_func_obstack=no)])
2609  if test $am_cv_func_obstack = yes; then
2610    AC_DEFINE(HAVE_OBSTACK)
2611  else
2612    LIBOBJS="$LIBOBJS obstack.o"
2613  fi
2616 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
2617 dnl FIXME: Migrate into libit
2619 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
2620 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
2621  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
2622               am_cv_lib_error_at_line=yes,
2623               am_cv_lib_error_at_line=no)])
2624  if test $am_cv_lib_error_at_line = no; then
2625    LIBOBJS="$LIBOBJS error.o"
2626  fi
2627  AC_SUBST(LIBOBJS)dnl
2630 # Macro to add for using GNU gettext.
2631 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2633 # serial 1
2634 # Stephan Kulow: I put a KDE in it to avoid name conflicts
2636 AC_DEFUN(AM_KDE_GNU_GETTEXT,
2637   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2638    AC_REQUIRE([AC_PROG_RANLIB])dnl
2639    AC_REQUIRE([AC_HEADER_STDC])dnl
2640    AC_REQUIRE([AC_TYPE_OFF_T])dnl
2641    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2642    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2643    AC_REQUIRE([AC_FUNC_MMAP])dnl
2644    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
2645    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h])
2646    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2647 __argz_count __argz_stringify __argz_next])
2649    AC_MSG_CHECKING(for stpcpy)
2650    AC_CACHE_VAL(kde_cv_func_stpcpy,
2651    [
2652    kde_safe_cxxflags=$CXXFLAGS
2653    CXXFLAGS="-Wmissing-prototypes -Werror"
2654    AC_LANG_SAVE
2655    AC_LANG_CPLUSPLUS
2656    AC_TRY_COMPILE([
2657    #include <string.h>
2658    ],
2659    [
2660    char buffer[200];
2661    stpcpy(buffer, buffer);
2662    ],
2663    kde_cv_func_stpcpy=yes,
2664    kde_cv_func_stpcpy=no)
2665    AC_LANG_RESTORE
2666    CXXFLAGS=$kde_safe_cxxflags
2667    ])
2668    AC_MSG_RESULT($kde_cv_func_stpcpy)
2669    if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
2670      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
2671    fi
2673    AM_LC_MESSAGES
2675    if test "x$CATOBJEXT" != "x"; then
2676      if test "x$ALL_LINGUAS" = "x"; then
2677        LINGUAS=
2678      else
2679        AC_MSG_CHECKING(for catalogs to be installed)
2680        NEW_LINGUAS=
2681        for lang in ${LINGUAS=$ALL_LINGUAS}; do
2682          case "$ALL_LINGUAS" in
2683           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2684          esac
2685        done
2686        LINGUAS=$NEW_LINGUAS
2687        AC_MSG_RESULT($LINGUAS)
2688      fi
2690      dnl Construct list of names of catalog files to be constructed.
2691      if test -n "$LINGUAS"; then
2692        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2693      fi
2694    fi
2696   ])
2698 AC_DEFUN(AC_HAVE_XPM,
2699  [AC_REQUIRE_CPP()dnl
2700   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2702  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
2703  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
2705  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
2706         xpm_test=$withval, xpm_test="yes")
2707  if test "x$xpm_test" = xno; then
2708    ac_cv_have_xpm=no
2709  else
2710    AC_MSG_CHECKING(for XPM)
2711    AC_CACHE_VAL(ac_cv_have_xpm,
2712    [
2713     AC_LANG_C
2714     ac_save_ldflags="$LDFLAGS"
2715     ac_save_cflags="$CFLAGS"
2716     LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
2717     CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
2718     test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
2719     AC_TRY_LINK([#include <X11/xpm.h>],[],
2720         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
2721     LDFLAGS="$ac_save_ldflags"
2722     CFLAGS="$ac_save_cflags"
2723    ])dnl
2725   if test "$ac_cv_have_xpm" = no; then
2726     AC_MSG_RESULT(no)
2727     XPM_LDFLAGS=""
2728     XPMINC=""
2729     $2
2730   else
2731     AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
2732     if test "$XPM_LDFLAGS" = ""; then
2733        XPMLIB='-lXpm $(LIB_X11)'
2734     else
2735        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
2736     fi
2737     if test "$XPM_INCLUDE" = ""; then
2738        XPMINC=""
2739     else
2740        XPMINC="-I$XPM_INCLUDE"
2741     fi
2742     AC_MSG_RESULT(yes)
2743     $1
2744   fi
2745  fi
2746  AC_SUBST(XPMINC)
2747  AC_SUBST(XPMLIB)
2750 AC_DEFUN(AC_HAVE_DPMS,
2751  [AC_REQUIRE_CPP()dnl
2752   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2754  test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
2755  test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
2756  DPMS_LIB=
2758  AC_ARG_WITH(dpms, [  --without-dpms          disable DPMS power saving],
2759         dpms_test=$withval, dpms_test="yes")
2760  if test "x$dpms_test" = xno; then
2761    ac_cv_have_dpms=no
2762  else
2763    AC_MSG_CHECKING(for DPMS)
2764    dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
2765    dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
2766    AC_CACHE_VAL(ac_cv_have_dpms,
2767    [
2768     AC_LANG_C
2769     ac_save_ldflags="$LDFLAGS"
2770     ac_save_cflags="$CFLAGS"
2771     ac_save_libs="$LIBS"
2772     LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
2773     CFLAGS="$CFLAGS $X_INCLUDES"
2774     test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
2775     AC_TRY_LINK([
2776         #include <X11/Xproto.h>
2777         #include <X11/X.h>
2778         #include <X11/Xlib.h>
2779         #include <X11/extensions/dpms.h>
2780         int foo_test_dpms()
2781         { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
2782         ac_cv_have_dpms="yes", [
2783             LDFLAGS="$ac_save_ldflags"
2784             CFLAGS="$ac_save_cflags"
2785             LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
2786             LIBS="$LIBS -lXdpms"
2787             CFLAGS="$CFLAGS $X_INCLUDES"
2788             test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
2789             AC_TRY_LINK([
2790                 #include <X11/Xproto.h>
2791                 #include <X11/X.h>
2792                 #include <X11/Xlib.h>
2793                 #include <X11/extensions/dpms.h>
2794                 int foo_test_dpms()
2795                 { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
2796                 [
2797                 ac_cv_have_dpms="-lXdpms"
2798                 ],ac_cv_have_dpms="no")
2799             ])
2800     LDFLAGS="$ac_save_ldflags"
2801     CFLAGS="$ac_save_cflags"
2802     LIBS="$ac_save_libs"
2803    ])dnl
2805   if test "$ac_cv_have_dpms" = no; then
2806     AC_MSG_RESULT(no)
2807     DPMS_LDFLAGS=""
2808     DPMSINC=""
2809     $2
2810   else
2811     AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
2812     if test "$ac_cv_have_dpms" = "-lXdpms"; then
2813        DPMS_LIB="-lXdpms"
2814     fi
2815     if test "$DPMS_LDFLAGS" = ""; then
2816        DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
2817     else
2818        DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
2819     fi
2820     if test "$DPMS_INCLUDE" = ""; then
2821        DPMSINC=""
2822     else
2823        DPMSINC="-I$DPMS_INCLUDE"
2824     fi
2825     AC_MSG_RESULT(yes)
2826     $1
2827   fi
2828  fi
2829  AC_SUBST(DPMSINC)
2830  AC_SUBST(DPMSLIB)
2833 AC_DEFUN(AC_HAVE_GL,
2834  [AC_REQUIRE_CPP()dnl
2835   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2837  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
2838  test -z "$GL_INCLUDE" && GL_INCLUDE=
2840  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
2841         gl_test=$withval, gl_test="yes")
2842  if test "x$gl_test" = xno; then
2843    ac_cv_have_gl=no
2844  else
2845    AC_MSG_CHECKING(for GL)
2846    AC_CACHE_VAL(ac_cv_have_gl,
2847    [
2848     AC_LANG_C
2849     ac_save_ldflags="$LDFLAGS"
2850     ac_save_cflags="$CFLAGS"
2851     LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
2852     CFLAGS="$CFLAGS $X_INCLUDES"
2853     test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
2854     AC_TRY_LINK([#include <GL/gl.h>
2855 #include <GL/glu.h>           
2856 ], [],
2857         ac_cv_have_gl="mesa", ac_cv_have_gl="no")
2858     if test "x$ac_cv_have_gl" = "xno"; then
2859       LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET"
2860       CFLAGS="$ac_save_cflags $X_INCLUDES"
2861       test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
2862       AC_TRY_LINK([#include <GL/gl.h>
2863 #include <GL/glu.h>
2864 ], [],
2865           ac_cv_have_gl="yes", ac_cv_have_gl="no")
2866     fi
2867     LDFLAGS="$ac_save_ldflags"
2868     CFLAGS="$ac_save_cflags"
2869    ])dnl
2871   if test "$ac_cv_have_gl" = "no"; then
2872     AC_MSG_RESULT(no)
2873     GL_LDFLAGS=""
2874     GLINC=""
2875     $2
2876   else
2877     AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
2878     if test "$GL_LDFLAGS" = ""; then
2879        if test "$ac_cv_have_gl" = "mesa"; then
2880           GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)'
2881        else
2882           GLLIB='-lGL -lGLU $(LIB_X11)'
2883        fi
2884     else
2885        if test "$ac_cv_have_gl" = "mesa"; then
2886           GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)'
2887        else
2888           GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)'
2889        fi
2890     fi
2891     if test "$GL_INCLUDE" = ""; then
2892        GLINC=""
2893     else
2894        GLINC="-I$GL_INCLUDE"
2895     fi
2896     AC_MSG_RESULT($ac_cv_have_gl)
2897     $1
2898   fi
2899  fi
2900  AC_SUBST(GLINC)
2901  AC_SUBST(GLLIB)
2904  dnl PAM pam
2906  dnl Should test for PAM (Pluggable Authentication Modules)
2907  AC_DEFUN(AC_PATH_PAM_DIRECT,
2909  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
2910  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
2912    for ac_dir in               \
2913                                \
2914      /usr/local/include        \
2915      /usr/include              \
2916      /usr/unsupported/include  \
2917      /opt/include              \
2918      /usr/pam/include          \
2919      /usr/local/pam/include    \
2920      /usr/lib/pam/include      \
2921                               \
2922      $extra_include            \
2923      ; \
2924    do
2925      if test -r "$ac_dir/$pam_direct_test_include"; then
2926        no_pam= ac_pam_includes=$ac_dir
2927        break
2928      fi
2929    done
2931  # First see if replacing the include by lib works.
2932  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
2933                            \
2934      /lib                  \
2935      /usr/lib              \
2936      /usr/local/lib        \
2937      /usr/unsupported/lib  \
2938      /lib/security         \
2939      /usr/security/lib     \
2940      $extra_lib            \
2941      ; \
2942  do
2943    for ac_extension in a so sl; do
2944      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
2945        no_pam= ac_pam_libraries=$ac_dir
2946        break 2
2947      fi
2948    done
2949  done
2952 AC_DEFUN(AC_PATH_PAM,
2954   AC_REQUIRE([KDE_CHECK_LIBDL])
2955   AC_REQUIRE_CPP()dnl
2957 dnl AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"
2958 dnl              AC_DEFINE_UNQUOTED(HAVE_PAM_MISC, 1, [Define if you have a PAM implementation with the pam_misc library])], [], [-lpam $LIBDL])
2960  AC_MSG_CHECKING(for PAM)
2961  AC_ARG_WITH(pam,
2962 [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
2963   [
2964     if test "x$withval" = "xyes"; then
2965       no_pam=
2966       default_pam=yes
2967     elif test "x$withval" = "xno"; then
2968       no_pam=yes
2969     else
2970       no_pam=
2971       pam_service="$withval"
2972         if test -z "$pam_service"; then
2973         default_pam=yes
2974         else
2975         default_pam=
2976         fi
2977       fi
2978   ], no_pam=yes
2981  if test ! "$no_pam" = yes; then
2983  AC_CACHE_VAL(ac_cv_path_pam,
2985  ac_pam_includes=NONE
2986  ac_pam_libraries=NONE
2987  if test -z "$pam_libraries"; then
2988    pam_libraries=NONE
2989  fi
2990  if test -z "$pam_includes"; then
2991    pam_includes=NONE
2992  fi
2994  AC_PATH_PAM_DIRECT
2996  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
2997  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
2999  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
3000    ac_pam_libs="-lpam $PAM_MISC_LIB $LIBDL"
3001    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
3002  else
3003    ac_cv_path_pam="no_pam=yes"
3004  fi
3005  ])
3007  eval "$ac_cv_path_pam"
3009  fi
3011  if test "$no_pam" = yes; then
3012    AC_MSG_RESULT(no)
3013  else
3014    AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules); Redhat-Users!])
3015    PAMLIBS="$ac_pam_libs"
3016    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
3017    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
3018    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
3019  if test "$default_pam" = yes; then
3020    AC_MSG_RESULT(["default pam service name will be used"])
3021  else
3022    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service", [Define to change the default name of the PAM service used by KDE])
3023    AC_MSG_RESULT(["pam service name will be: " $pam_service])
3024  fi
3025 dnl test whether struct pam_message is const (Linux) or not (Sun)
3026    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
3027    AC_MSG_CHECKING(for const pam_message)
3028    AC_EGREP_HEADER([struct pam_message],
3029       $pam_appl_h,
3030       [ AC_EGREP_HEADER([const struct pam_message],
3031                         $pam_appl_h,
3032                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
3033                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
3034                         AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
3035                         )],
3036        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
3037        )
3038  fi
3040  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
3041      PAMLIBPATHS="-L$pam_libraries"
3042  fi
3043  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
3044      PAMINC="-I$pam_includes"
3045  fi
3047  AC_SUBST(PAMINC)
3048  AC_SUBST(PAMLIBS)
3049  AC_SUBST(PAMLIBPATHS)
3053 AC_DEFUN(KDE_CHECK_LIBDL,
3055 AC_CHECK_LIB(dl, dlopen, [
3056 LIBDL="-ldl"
3057 ac_cv_have_dlfcn=yes
3060 AC_CHECK_LIB(dld, shl_unload, [
3061 LIBDL="-ldld"
3062 ac_cv_have_shload=yes
3065 AC_SUBST(LIBDL)
3068 AC_DEFUN(KDE_CHECK_DLOPEN,
3070 KDE_CHECK_LIBDL
3071 AC_CHECK_HEADERS(dlfcn.h dl.h)
3072 if test "$ac_cv_header_dlfcn_h" = "no"; then
3073   ac_cv_have_dlfcn=no
3076 if test "$ac_cv_header_dl_h" = "no"; then
3077   ac_cv_have_shload=no
3080 dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
3081 dnl (MM)
3082 AC_ARG_ENABLE(dlopen,
3083 [  --disable-dlopen        link statically [default=no]] ,
3084 enable_dlopen=$enableval,
3085 enable_dlopen=yes)
3087 # override the user's opinion, if we know it better ;)
3088 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
3089   enable_dlopen=no
3092 if test "$ac_cv_have_dlfcn" = "yes"; then
3093   AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
3096 if test "$ac_cv_have_shload" = "yes"; then
3097   AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
3100 if test "$enable_dlopen" = no ; then
3101   test -n "$1" && eval $1
3102 else
3103   test -n "$2" && eval $2
3108 AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
3110 KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
3111 KDE_PROG_LIBTOOL
3112 AC_MSG_CHECKING([dynamic loading])
3113 eval "`egrep '^build_libtool_libs=' libtool`"
3114 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
3115   dynamic_loading=yes
3116   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
3117 else
3118   dynamic_loading=no
3120 AC_MSG_RESULT($dynamic_loading)
3121 if test "$dynamic_loading" = "yes"; then
3122   $1
3123 else
3124   $2
3128 AC_DEFUN(KDE_ADD_INCLUDES,
3130 if test -z "$1"; then
3131   test_include="Pix.h"
3132 else
3133   test_include="$1"
3136 AC_MSG_CHECKING([for libg++ ($test_include)])
3138 AC_CACHE_VAL(kde_cv_libgpp_includes,
3140 kde_cv_libgpp_includes=no
3142    for ac_dir in               \
3143                                \
3144      /usr/include/g++          \
3145      /usr/include              \
3146      /usr/unsupported/include  \
3147      /opt/include              \
3148      $extra_include            \
3149      ; \
3150    do
3151      if test -r "$ac_dir/$test_include"; then
3152        kde_cv_libgpp_includes=$ac_dir
3153        break
3154      fi
3155    done
3158 AC_MSG_RESULT($kde_cv_libgpp_includes)
3159 if test "$kde_cv_libgpp_includes" != "no"; then
3160   all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
3166 AC_DEFUN(KDE_CHECK_MICO,
3168 AC_REQUIRE([KDE_CHECK_LIBDL])
3169 AC_REQUIRE([KDE_MISC_TESTS])
3170 AC_MSG_CHECKING(for MICO)
3172 if test -z "$MICODIR"; then
3173     kde_micodir=/usr/local
3174  else
3175     kde_micodir="$MICODIR"
3178 AC_ARG_WITH(micodir,
3179   [  --with-micodir=micodir  where mico is installed ],
3180   kde_micodir=$withval,
3181   kde_micodir=$kde_micodir
3184 AC_CACHE_VAL(kde_cv_mico_incdir,
3186   mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes"
3187 AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
3190 kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
3192 if test ! -r  $kde_micodir/include/CORBA.h; then
3193   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
3196 AC_MSG_RESULT($kde_micodir)
3198 MICO_INCLUDES=-I$kde_micodir/include
3199 AC_SUBST(MICO_INCLUDES)
3200 MICO_LDFLAGS=-L$kde_micodir/lib
3201 AC_SUBST(MICO_LDFLAGS)
3202 micodir=$kde_micodir
3203 AC_SUBST(micodir)
3205 AC_MSG_CHECKING([for MICO version])
3206 AC_CACHE_VAL(kde_cv_mico_version,
3208 AC_LANG_C
3209 cat >conftest.$ac_ext <<EOF
3210 #include <stdio.h>
3211 #include <mico/version.h>
3212 int main() {
3214    printf("MICO_VERSION=%s\n",MICO_VERSION);
3215    return (0);
3218 ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
3219 if AC_TRY_EVAL(ac_compile); then
3220   if eval `./conftest 2>&5`; then
3221     kde_cv_mico_version=$MICO_VERSION
3222   else
3223     AC_MSG_ERROR([your system is not able to execute a small application to
3224     find MICO version! Check $kde_micodir/include/mico/version.h])
3225   fi
3226 else
3227   AC_MSG_ERROR([your system is not able to compile a small application to
3228   find MICO version! Check $kde_micodir/include/mico/version.h])
3232 dnl installed MICO version
3233 mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3234 mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3235 mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3237 if test "x$1" = "x"; then
3238  req_version="2.3.0"
3239 else
3240  req_version=$1
3243 dnl required MICO version
3244 req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3245 req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3246 req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3248 if test "$mico_v_maj" -lt "$req_v_maj" || \
3249    ( test "$mico_v_maj" -eq "$req_v_maj" && \
3250         test "$mico_v_mid" -lt "$req_v_mid" ) || \
3251    ( test "$mico_v_mid" -eq "$req_v_mid" && \
3252         test "$mico_v_min" -lt "$req_v_min" )
3254 then
3255   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \
3256 at least is required. You should upgrade MICO.])
3257 else
3258   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)])
3261 LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL"
3262 AC_SUBST(LIBMICO)
3263 if test -z "$IDL"; then
3264   IDL='$(kde_bindir)/cuteidl'
3266 AC_SUBST(IDL)
3267 IDL_DEPENDENCIES='$(kde_includes)/CUTE.h'
3268 AC_SUBST(IDL_DEPENDENCIES)
3270 idldir="\$(includedir)/idl"
3271 AC_SUBST(idldir)
3275 AC_DEFUN(KDE_CHECK_MINI_STL,
3277 AC_REQUIRE([KDE_CHECK_MICO])
3279 AC_MSG_CHECKING(if we use mico's mini-STL)
3280 AC_CACHE_VAL(kde_cv_have_mini_stl,
3282 AC_LANG_SAVE
3283 AC_LANG_CPLUSPLUS
3284 kde_save_cxxflags="$CXXFLAGS"
3285 CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
3286 AC_TRY_COMPILE(
3288 #include <mico/config.h>
3291 #ifdef HAVE_MINI_STL
3292 #error "nothing"
3293 #endif
3295 kde_cv_have_mini_stl=no,
3296 kde_cv_have_mini_stl=yes)
3297 CXXFLAGS="$kde_save_cxxflags"
3298 AC_LANG_RESTORE
3301 if test "x$kde_cv_have_mini_stl" = "xyes"; then
3302    AC_MSG_RESULT(yes)
3303    $1
3304 else
3305    AC_MSG_RESULT(no)
3306    $2
3313 AC_DEFUN(KDE_CHECK_LIBPTHREAD,
3315 AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
3316 AC_SUBST(LIBPTHREAD)
3319 AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
3321     AC_ARG_ENABLE(kernel-threads, [  --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.],
3322         kde_use_kernthreads=$enableval, kde_use_kernthreads=no)
3324     if test "$kde_use_kernthreads" = "yes"; then
3325       ac_save_CXXFLAGS="$CXXFLAGS"
3326       ac_save_CFLAGS="$CXXFLAGS"
3327       CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS"
3328       CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS"
3329       AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h)
3330       CXXFLAGS="$ac_save_CXXFLAGS"
3331       CFLAGS="$ac_save_CFLAGS"
3332       if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then
3333         kde_use_kernthreads=no
3334       else
3335         dnl Add proper -I and -l statements
3336         AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD
3337         if test "x$LIBPTHREAD" = "x"; then
3338           kde_use_kernthreads=no
3339         else
3340           USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads"
3341         fi
3342       fi
3343     else 
3344       USE_THREADS=""
3345       if test -z "$LIBPTHREAD"; then
3346         KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
3347       fi
3348     fi
3350     case $host_os in
3351         solaris*)
3352                 KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
3353                 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS"
3354                 echo "Setting Solaris pthread compilation options"
3355                 ;;
3356         freebsd*)
3357                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3358                 echo "Setting FreeBSD pthread compilation options"
3359                 ;;
3360         aix*)
3361                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3362                 LIBPTHREAD="$LIBPTHREAD -lc_r"
3363                 echo "Setting AIX pthread compilation options"
3364                 ;;
3365         linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
3366                 USE_THREADS="$USE_THREADS -DPIC -fPIC"
3367                 echo "Setting Linux pthread compilation options"
3368                 ;;
3369         *)
3370                 ;;
3371     esac
3372     AC_SUBST(USE_THREADS)
3373     AC_SUBST(LIBPTHREAD)
3376 AC_DEFUN(KDE_CHECK_THREADING,
3378   AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3379   AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
3380   dnl default is yes if libpthread is found and no if no libpthread is available
3381   if test -z "$LIBPTHREAD"; then
3382     kde_check_threading_default=no
3383   else
3384     kde_check_threading_default=yes
3385   fi
3386   AC_ARG_ENABLE(threading, [  --disable-threading     disables threading even if libpthread found ],
3387    kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
3389   if test "x$kde_use_threading" = "xyes"; then
3390     AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
3391   fi
3394 AC_DEFUN(KDE_TRY_LINK_PYTHON,
3396 if test "$kde_python_link_found" = no; then
3398 if test "$1" = normal; then
3399   AC_MSG_CHECKING(if a Python application links)
3400 else
3401   AC_MSG_CHECKING(if Python depends on $2)
3404 AC_CACHE_VAL(kde_cv_try_link_python_$1,
3406 AC_LANG_SAVE
3407 AC_LANG_C
3408 kde_save_cflags="$CFLAGS"
3409 CFLAGS="$CFLAGS $PYTHONINC"
3410 kde_save_libs="$LIBS"
3411 LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
3412 kde_save_ldflags="$LDFLAGS"
3413 LDFLAGS="$LDFLAGS $PYTHONLIB"
3415 AC_TRY_LINK(
3417 #include <Python.h>
3419         PySys_SetArgv(1, 0);
3421         [kde_cv_try_link_python_$1=yes],
3422         [kde_cv_try_link_python_$1=no]
3424 CFLAGS="$kde_save_cflags"
3425 LIBS="$kde_save_libs"
3426 LDFLAGS="$kde_save_ldflags"
3429 if test "$kde_cv_try_link_python_$1" = "yes"; then
3430   AC_MSG_RESULT(yes)
3431   kde_python_link_found=yes
3432   if test ! "$1" = normal; then
3433     LIBPYTHON="$LIBPYTHON $2"
3434   fi
3435   $3
3436 else
3437   AC_MSG_RESULT(no)
3438   $4
3440 AC_LANG_RESTORE
3446 AC_DEFUN(KDE_CHECK_PYTHON,
3448 AC_REQUIRE([KDE_CHECK_LIBDL])
3449 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3451 AC_MSG_CHECKING([for Python directory])
3453 AC_CACHE_VAL(kde_cv_pythondir,
3455   if test -z "$PYTHONDIR"; then
3456     kde_cv_pythondir=/usr/local
3457   else
3458     kde_cv_pythondir="$PYTHONDIR"
3459   fi
3462 AC_ARG_WITH(pythondir,
3463 [  --with-pythondir=pythondir   use python installed in pythondir ],
3465   ac_python_dir=$withval
3466 ], ac_python_dir=$kde_cv_pythondir
3469 AC_MSG_RESULT($ac_python_dir)
3471 if test -z "$1"; then
3472   version="1.5"
3473 else
3474   version="$1"
3477 AC_MSG_CHECKING([for Python$version])
3479 python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
3480 AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
3481 if test ! -r $python_incdir/Python.h; then
3482   AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
3483   python_incdir=$python_incdir/python$version
3484   if test ! -r $python_incdir/Python.h; then
3485     AC_MSG_ERROR(Python.h not found.)
3486   fi
3489 PYTHONINC=-I$python_incdir
3491 python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
3492 AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
3493 if test ! -r $python_libdir/libpython$version.a; then
3494   AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
3495   python_libdir=$python_libdir/python$version/config
3496   if test ! -r $python_libdir/libpython$version.a; then
3497     AC_MSG_ERROR(libpython$version.a not found.)
3498   fi
3501 PYTHONLIB=-L$python_libdir
3502 if test -z "$LIBPYTHON"; then
3503 LIBPYTHON=-lpython$version
3506 python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
3507 AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
3508 python_moddir=$python_moddir/python$version
3509 if test ! -r $python_moddir/copy.py; then
3510   AC_MSG_ERROR(python module directory not found.)
3513 PYTHONMODDIR=$python_moddir
3515 AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
3517 dnl Note: this test is very weak
3518 kde_python_link_found=no
3519 KDE_TRY_LINK_PYTHON(normal)
3520 KDE_TRY_LINK_PYTHON(m, -lm)
3521 KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
3522 KDE_TRY_LINK_PYTHON(tcl, -ltcl)
3523 KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm], [],
3524         [AC_MSG_WARN([it seems, Python depends on another library.
3525     Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this
3526     and contact the authors to let them know about this problem])
3527         ])
3529 LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
3530 AC_SUBST(PYTHONINC)
3531 AC_SUBST(PYTHONLIB)
3532 AC_SUBST(LIBPYTHON)
3533 AC_SUBST(PYTHONMODDIR)
3538 AC_DEFUN(KDE_CHECK_STL_SGI,
3540     AC_MSG_CHECKING([if STL implementation is SGI like])
3541     AC_CACHE_VAL(kde_cv_stl_type_sgi,
3542     [
3543       AC_TRY_COMPILE([
3544 #include <string>
3545 using namespace std;
3547   string astring="Hallo Welt.";
3548   astring.erase(0, 6); // now astring is "Welt"
3549   return 0;
3550 ], kde_cv_stl_type_sgi=yes,
3551    kde_cv_stl_type_sgi=no)
3554    AC_MSG_RESULT($kde_cv_stl_type_sgi)
3556    if test "$kde_cv_stl_type_sgi" = "yes"; then
3557         AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
3558    fi
3561 AC_DEFUN(KDE_CHECK_STL_HP,
3563     AC_MSG_CHECKING([if STL implementation is HP like])
3564     AC_CACHE_VAL(kde_cv_stl_type_hp,
3565     [
3566       AC_TRY_COMPILE([
3567 #include <string>
3568 using namespace std;
3570   string astring="Hello World";
3571   astring.remove(0, 6); // now astring is "World"
3572   return 0;
3573 ], kde_cv_stl_type_hp=yes,
3574    kde_cv_stl_type_hp=no)
3576    AC_MSG_RESULT($kde_cv_stl_type_hp)
3578    if test "$kde_cv_stl_type_hp" = "yes"; then
3579         AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by SGI])
3580    fi
3583 AC_DEFUN(KDE_CHECK_STL,
3585     AC_LANG_SAVE
3586     AC_LANG_CPLUSPLUS
3587     ac_save_CXXFLAGS="$CXXFLAGS"
3588     CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
3589     KDE_CHECK_STL_SGI
3591     if test "$kde_cv_stl_type_sgi" = "no"; then
3592        KDE_CHECK_STL_HP
3594        if test "$kde_cv_stl_type_hp" = "no"; then
3595          AC_MSG_ERROR("no known STL type found")
3596        fi
3597     fi
3599     CXXFLAGS="$ac_save_CXXFLAGS"
3600     AC_LANG_RESTORE
3603 AC_DEFUN(AC_FIND_QIMGIO,
3604    [AC_REQUIRE([AC_FIND_JPEG])
3605 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3606 AC_MSG_CHECKING([for qimgio])
3607 AC_CACHE_VAL(ac_cv_lib_qimgio,
3609 AC_LANG_SAVE
3610 AC_LANG_CPLUSPLUS
3611 ac_save_LIBS="$LIBS"
3612 ac_save_CXXFLAGS="$CXXFLAGS"
3613 LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
3614 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
3615 AC_TRY_RUN(dnl
3617 #include <qimageio.h>
3618 #include <qstring.h>
3619 int main() {
3620                 QString t = "hallo";
3621                 t.fill('t');
3622                 qInitImageIO();
3625             ac_cv_lib_qimgio=yes,
3626             ac_cv_lib_qimgio=no,
3627             ac_cv_lib_qimgio=no)
3628 LIBS="$ac_save_LIBS"
3629 CXXFLAGS="$ac_save_CXXFLAGS"
3630 AC_LANG_RESTORE
3631 ])dnl
3632 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
3633   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
3634   AC_MSG_RESULT(yes)
3635   AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
3636   AC_SUBST(LIBQIMGIO)
3637 else
3638   AC_MSG_RESULT(not found)
3642 AC_DEFUN(KDE_CHECK_ANSI,
3646 AC_DEFUN(KDE_CHECK_INSURE,
3648   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
3649   [
3650   if test $enableval = "no"; dnl
3651         then ac_use_insure="no"
3652         else ac_use_insure="yes"
3653    fi
3654   ], [ac_use_insure="no"])
3656   AC_MSG_CHECKING(if we will use Insure++ to debug)
3657   AC_MSG_RESULT($ac_use_insure)
3658   if test "$ac_use_insure" = "yes"; dnl
3659        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
3660    fi
3663 AC_DEFUN(AM_DISABLE_LIBRARIES,
3665     AC_PROVIDE([AM_ENABLE_STATIC])
3666     AC_PROVIDE([AM_ENABLE_SHARED])
3667     enable_static=no
3668     enable_shared=yes
3672 AC_DEFUN(AC_CHECK_UTMP_FILE,
3674     AC_MSG_CHECKING([for utmp file])
3676     AC_CACHE_VAL(kde_cv_utmp_file,
3677     [
3678     kde_cv_utmp_file=no
3680     for ac_file in    \
3681                       \
3682         /var/run/utmp \
3683         /var/adm/utmp \
3684         /etc/utmp     \
3685      ; \
3686     do
3687      if test -r "$ac_file"; then
3688        kde_cv_utmp_file=$ac_file
3689        break
3690      fi
3691     done
3692     ])
3694     if test "$kde_cv_utmp_file" != "no"; then
3695         AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
3696         $1
3697         AC_MSG_RESULT($kde_cv_utmp_file)
3698     else
3699         $2
3700         AC_MSG_RESULT([non found])
3701     fi
3705 AC_DEFUN(KDE_CREATE_SUBDIRSLIST,
3708 DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
3710 if test ! -s $srcdir/subdirs; then
3711   dnl Note: Makefile.common creates subdirs, so this is just a fallback
3712   TOPSUBDIRS=""
3713   files=`cd $srcdir && ls -1`
3714   dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
3715   for i in $dirs; do
3716     echo $i >> $srcdir/subdirs
3717   done
3720 if test -s $srcdir/inst-apps; then
3721   ac_topsubdirs="`cat $srcdir/inst-apps`"
3722 else
3723   ac_topsubdirs="`cat $srcdir/subdirs`"
3726 for i in $ac_topsubdirs; do
3727   AC_MSG_CHECKING([if $i should be compiled])
3728   if test -d $srcdir/$i; then
3729     install_it="yes"
3730     for j in $DO_NOT_COMPILE; do
3731       if test $i = $j; then
3732         install_it="no"
3733       fi
3734     done
3735   else
3736     install_it="no"
3737   fi
3738   AC_MSG_RESULT($install_it)
3739   if test $install_it = "yes"; then
3740     TOPSUBDIRS="$TOPSUBDIRS $i"
3741   fi
3742 done
3744 AC_SUBST(TOPSUBDIRS)
3747 AC_DEFUN(KDE_CHECK_NAMESPACES,
3749 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
3750 AC_LANG_SAVE
3751 AC_LANG_CPLUSPLUS
3752 AC_TRY_COMPILE([
3755 namespace Foo {
3756   extern int i;
3757   namespace Bar {
3758     extern int i;
3759   }
3762 int Foo::i = 0;
3763 int Foo::Bar::i = 1;
3765   AC_MSG_RESULT(yes)
3766   AC_DEFINE(HAVE_NAMESPACES)
3767 ], [
3768 AC_MSG_RESULT(no)
3770 AC_LANG_RESTORE
3773 AC_DEFUN(KDE_CHECK_NEWLIBS,
3778 dnl ------------------------------------------------------------------------
3779 dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
3780 dnl ------------------------------------------------------------------------
3782 AC_DEFUN(AC_CHECK_S_ISSOCK,
3784 AC_MSG_CHECKING(for S_ISSOCK)
3785 AC_CACHE_VAL(ac_cv_have_s_issock,
3787 AC_LANG_SAVE
3788 AC_LANG_C
3789 AC_TRY_LINK(
3791 #include <sys/stat.h>
3794 struct stat buff;
3795 int b = S_ISSOCK( buff.st_mode );
3797 ac_cv_have_s_issock=yes,
3798 ac_cv_have_s_issock=no)
3799 AC_LANG_RESTORE
3801 AC_MSG_RESULT($ac_cv_have_s_issock)
3802 if test "$ac_cv_have_s_issock" = "yes"; then
3803   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
3807 dnl ------------------------------------------------------------------------
3808 dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
3809 dnl ------------------------------------------------------------------------
3811 AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
3813 AC_MSG_CHECKING(for MAXPATHLEN)
3814 AC_CACHE_VAL(ac_cv_maxpathlen,
3816 AC_LANG_C
3817 cat > conftest.$ac_ext <<EOF
3818 #include <stdio.h>
3819 #include <sys/param.h>
3820 #ifndef MAXPATHLEN
3821 #define MAXPATHLEN 1024
3822 #endif
3824 KDE_HELLO MAXPATHLEN
3828 ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
3830 if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
3831     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
3832 else
3833     ac_cv_maxpathlen=1024
3836 rm conftest.*
3839 AC_MSG_RESULT($ac_cv_maxpathlen)
3840 AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
3843 dnl -------------------------------------------------------------------------
3844 dnl See if the compiler supports a template repository         bero@redhat.de
3845 dnl -------------------------------------------------------------------------
3846 AC_DEFUN(KDE_COMPILER_REPO,
3848   REPO=""
3849   NOREPO=""
3851   KDE_CHECK_COMPILER_FLAG(frepo,
3852    [
3853      REPO="-frepo"
3854      NOREPO="-fno-repo"
3855    ])
3857   if test -z "$REPO"; then
3858   KDE_CHECK_COMPILER_FLAG(instances=explicit,
3859   [
3860      REPO="-instances=explicit"
3861      NOREPO="-instances=extern"
3862   ])
3863   fi
3865   if test -n "$REPO"; then
3866      AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1,
3867                 [C++ compiler supports template repository])
3868      $1
3869   fi
3871   AC_SUBST(REPO)
3872   AC_SUBST(NOREPO)
3875 AC_DEFUN(KDE_CHECK_HEADER,
3877    AC_LANG_SAVE
3878    kde_safe_cppflags=$CPPFLAGS
3879    CPPFLAGS="$CPPFLAGS $all_includes"
3880    AC_LANG_CPLUSPLUS
3881    AC_CHECK_HEADER($1, $2, $3)
3882    CPPFLAGS=$kde_safe_cppflags
3883    AC_LANG_RESTORE
3886 AC_DEFUN(KDE_CHECK_QWSPRITEFIELD,
3888   KDE_CHECK_HEADER(QwSpriteField.h, ,
3889   [
3890     AC_MSG_WARN([you don't have QwSpriteField.h somewhere. Please install
3891        QwSpriteField out of kdesupport.])
3892       $1
3893   ])
3896 AC_DEFUN(KDE_FAST_CONFIGURE,
3898   dnl makes configure fast (needs perl)
3899   AC_ARG_ENABLE(fast-perl, [  --disable-fast-perl     disable fast Makefile generation (needs perl)],
3900       with_fast_perl=$enableval, with_fast_perl=yes)
3903 AC_DEFUN(KDE_CONF_FILES,
3905   val=
3906   if test -f $srcdir/configure.files ; then
3907     val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
3908   fi
3909   CONF_FILES=
3910   if test -n "$val" ; then
3911     for i in $val ; do
3912       CONF_FILES="$CONF_FILES $i"
3913     done
3914   fi
3915   AC_SUBST(CONF_FILES)
3916 ])dnl
3918 AC_DEFUN(KDE_SET_PREFIX,
3920   unset CDPATH
3921   dnl make $KDEDIR the default for the installation
3922   AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
3924   if test "x$prefix" = "xNONE"; then
3925     prefix=$ac_default_prefix
3926     ac_configure_args="$ac_configure_args --prefix $prefix"
3927   fi
3928   KDE_FAST_CONFIGURE
3929   KDE_CONF_FILES
3932 pushdef([AC_PROG_INSTALL],
3934   dnl our own version, testing for a -p flag
3935   popdef([AC_PROG_INSTALL])
3936   dnl as AC_PROG_INSTALL works as it works we first have
3937   dnl to save if the user didn't specify INSTALL, as the
3938   dnl autoconf one overwrites INSTALL and we have no chance to find
3939   dnl out afterwards
3940   test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
3941   test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
3942   test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
3943   AC_PROG_INSTALL
3945   if test -z "$kde_save_INSTALL_given" ; then
3946     # OK, user hasn't given any INSTALL, autoconf found one for us
3947     # now we test, if it supports the -p flag
3948     AC_MSG_CHECKING(for -p flag to install)
3949     rm -f confinst.$$.* > /dev/null 2>&1
3950     echo "Testtest" > confinst.$$.orig
3951     ac_res=no
3952     if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
3953       if test -f confinst.$$.new ; then
3954         # OK, -p seems to do no harm to install
3955         INSTALL="${INSTALL} -p"
3956         ac_res=yes
3957       fi
3958     fi
3959     rm -f confinst.$$.*
3960     AC_MSG_RESULT($ac_res)
3961   fi
3962   dnl the following tries to resolve some signs and wonders coming up
3963   dnl with different autoconf/automake versions
3964   dnl e.g.:
3965   dnl  *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
3966   dnl   and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
3967   dnl   it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
3968   dnl  *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
3969   dnl   INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
3970   dnl   install-@DIR@PROGRAMS targets to explicitly use that flag
3971   dnl  *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
3972   dnl   INSTALL_SCRIPT, which breaks with automake <= 1.4
3973   dnl  *autoconf >2.13 (since 10.Apr 1999) has not that failure
3974   dnl  *sometimes KDE does not use the install-@DIR@PROGRAM targets from
3975   dnl   automake (due to broken Makefile.am or whatever) to install programs,
3976   dnl   and so does not see the -s flag in automake > 1.4
3977   dnl to clean up that mess we:
3978   dnl  +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
3979   dnl   which cleans KDE's program with automake > 1.4;
3980   dnl  +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
3981   dnl   with automake<=1.4
3982   dnl  note that dues to this sometimes two '-s' flags are used (if KDE
3983   dnl   properly uses install-@DIR@PROGRAMS, but I don't care
3984   dnl
3985   dnl And to all this comes, that I even can't write in comments variable
3986   dnl  names used by automake, because it is so stupid to think I wanted to
3987   dnl  _use_ them, therefor I have written A_M_... instead of AM_
3988   dnl hmm, I wanted to say something ... ahh yes: Arghhh.
3990   if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
3991     INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
3992   fi
3993   if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
3994     INSTALL_SCRIPT='${INSTALL}'
3995   fi
3996 ])dnl
3998 AC_DEFUN(KDE_LANG_CPLUSPLUS,
3999 [AC_LANG_CPLUSPLUS
4000 ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
4001 pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
4004 pushdef([AC_LANG_CPLUSPLUS],
4005 [popdef([AC_LANG_CPLUSPLUS])
4006 KDE_LANG_CPLUSPLUS
4009 AC_DEFUN(KDE_CHECK_LONG_LONG,
4011 AC_MSG_CHECKING(for long long)
4012 AC_CACHE_VAL(kde_cv_c_long_long,
4014   AC_LANG_SAVE
4015   AC_LANG_CPLUSPLUS
4016   AC_TRY_LINK([], [
4017   long long foo = 0;
4018   foo = foo+1;
4019   ],
4020   kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
4022 AC_MSG_RESULT($kde_cv_c_long_long)
4023 if test "$kde_cv_c_long_long" = yes; then
4024    AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])