Updated the README file with some contributor tips.
[basket4.git] / admin / acinclude.m4.in
bloba7c3e29cb94bdbbc4997a88e1e4a4e2bf734ff53
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., 51 Franklin Steet, Fifth Floor,
20 dnl    Boston, MA 02110-1301, 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.
25 dnl
26 dnl Single-module modifications are best placed in configure.in for kdelibs
27 dnl and kdebase or configure.in.in if present.
29 # KDE_PATH_X_DIRECT
30 dnl Internal subroutine of AC_PATH_X.
31 dnl Set ac_x_includes and/or ac_x_libraries.
32 AC_DEFUN([KDE_PATH_X_DIRECT],
34 AC_REQUIRE([KDE_CHECK_LIB64])
36 if test "$ac_x_includes" = NO; then
37   # Guess where to find include files, by looking for this one X11 .h file.
38   test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
40   # First, try using that file with no special directory specified.
41 AC_TRY_CPP([#include <$x_direct_test_include>],
42 [# We can compile using X headers with no special include directory.
43 ac_x_includes=],
44 [# Look for the header file in a standard set of common directories.
45 # Check X11 before X11Rn because it is often a symlink to the current release.
46   for ac_dir in               \
47     /usr/X11/include          \
48     /usr/X11R6/include        \
49     /usr/X11R5/include        \
50     /usr/X11R4/include        \
51                               \
52     /usr/include/X11          \
53     /usr/include/X11R6        \
54     /usr/include/X11R5        \
55     /usr/include/X11R4        \
56                               \
57     /usr/local/X11/include    \
58     /usr/local/X11R6/include  \
59     /usr/local/X11R5/include  \
60     /usr/local/X11R4/include  \
61                               \
62     /usr/local/include/X11    \
63     /usr/local/include/X11R6  \
64     /usr/local/include/X11R5  \
65     /usr/local/include/X11R4  \
66                               \
67     /usr/X386/include         \
68     /usr/x386/include         \
69     /usr/XFree86/include/X11  \
70                               \
71     /usr/include              \
72     /usr/local/include        \
73     /usr/unsupported/include  \
74     /usr/athena/include       \
75     /usr/local/x11r5/include  \
76     /usr/lpp/Xamples/include  \
77                               \
78     /usr/openwin/include      \
79     /usr/openwin/share/include \
80     ; \
81   do
82     if test -r "$ac_dir/$x_direct_test_include"; then
83       ac_x_includes=$ac_dir
84       break
85     fi
86   done])
87 fi # $ac_x_includes = NO
89 if test "$ac_x_libraries" = NO; then
90   # Check for the libraries.
92   test -z "$x_direct_test_library" && x_direct_test_library=Xt
93   test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
95   # See if we find them without any special options.
96   # Don't add to $LIBS permanently.
97   ac_save_LIBS="$LIBS"
98   LIBS="-l$x_direct_test_library $LIBS"
99 AC_TRY_LINK([#include <X11/Intrinsic.h>], [${x_direct_test_function}(1)],
100 [LIBS="$ac_save_LIBS"
101 # We can link X programs with no special library path.
102 ac_x_libraries=],
103 [LIBS="$ac_save_LIBS"
104 # First see if replacing the include by lib works.
105 # Check X11 before X11Rn because it is often a symlink to the current release.
106 for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \
107     /usr/X11/lib${kdelibsuff}           \
108     /usr/X11R6/lib${kdelibsuff}         \
109     /usr/X11R5/lib${kdelibsuff}         \
110     /usr/X11R4/lib${kdelibsuff}         \
111                                         \
112     /usr/lib${kdelibsuff}/X11           \
113     /usr/lib${kdelibsuff}/X11R6         \
114     /usr/lib${kdelibsuff}/X11R5         \
115     /usr/lib${kdelibsuff}/X11R4         \
116                                         \
117     /usr/local/X11/lib${kdelibsuff}     \
118     /usr/local/X11R6/lib${kdelibsuff}   \
119     /usr/local/X11R5/lib${kdelibsuff}   \
120     /usr/local/X11R4/lib${kdelibsuff}   \
121                                         \
122     /usr/local/lib${kdelibsuff}/X11     \
123     /usr/local/lib${kdelibsuff}/X11R6   \
124     /usr/local/lib${kdelibsuff}/X11R5   \
125     /usr/local/lib${kdelibsuff}/X11R4   \
126                                         \
127     /usr/X386/lib${kdelibsuff}          \
128     /usr/x386/lib${kdelibsuff}          \
129     /usr/XFree86/lib${kdelibsuff}/X11   \
130                                         \
131     /usr/lib${kdelibsuff}               \
132     /usr/local/lib${kdelibsuff}         \
133     /usr/unsupported/lib${kdelibsuff}   \
134     /usr/athena/lib${kdelibsuff}        \
135     /usr/local/x11r5/lib${kdelibsuff}   \
136     /usr/lpp/Xamples/lib${kdelibsuff}   \
137     /lib/usr/lib${kdelibsuff}/X11       \
138                                         \
139     /usr/openwin/lib${kdelibsuff}       \
140     /usr/openwin/share/lib${kdelibsuff} \
141     ; \
143 dnl Don't even attempt the hair of trying to link an X program!
144   for ac_extension in a so sl; do
145     if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
146       ac_x_libraries=$ac_dir
147       break 2
148     fi
149   done
150 done])
151 fi # $ac_x_libraries = NO
155 dnl ------------------------------------------------------------------------
156 dnl Find a file (or one of more files in a list of dirs)
157 dnl ------------------------------------------------------------------------
159 AC_DEFUN([AC_FIND_FILE],
161 $3=NO
162 for i in $2;
164   for j in $1;
165   do
166     echo "configure: __oline__: $i/$j" >&AC_FD_CC
167     if test -r "$i/$j"; then
168       echo "taking that" >&AC_FD_CC
169       $3=$i
170       break 2
171     fi
172   done
173 done
176 dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs,
177 dnl     if-not-found, test-parameter, prepend-path)
179 dnl Look for program-name in list-of-dirs+$PATH.
180 dnl If prepend-path is set, look in $PATH+list-of-dirs instead.
181 dnl If found, $variable-name is set. If not, if-not-found is evaluated.
182 dnl test-parameter: if set, the program is executed with this arg,
183 dnl                 and only a successful exit code is required.
184 AC_DEFUN([KDE_FIND_PATH],
186    AC_MSG_CHECKING([for $1])
187    if test -n "$$2"; then
188         kde_cv_path="$$2";
189    else
190         kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
192         AC_CACHE_VAL(kde_cv_path_$kde_cache,
193         [
194         kde_cv_path="NONE"
195         kde_save_IFS=$IFS
196         IFS=':'
197         dirs=""
198         for dir in $PATH; do
199           dirs="$dirs $dir"
200         done
201         if test -z "$6"; then  dnl Append dirs in PATH (default)
202           dirs="$3 $dirs"
203         else  dnl Prepend dirs in PATH (if 6th arg is set)
204           dirs="$dirs $3"
205         fi
206         IFS=$kde_save_IFS
208         for dir in $dirs; do
209           if test -x "$dir/$1"; then
210             if test -n "$5"
211             then
212               evalstr="$dir/$1 $5 2>&1 "
213               if eval $evalstr; then
214                 kde_cv_path="$dir/$1"
215                 break
216               fi
217             else
218                 kde_cv_path="$dir/$1"
219                 break
220             fi
221           fi
222         done
224         eval "kde_cv_path_$kde_cache=$kde_cv_path"
226         ])
228       eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
230    fi
232    if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
233       AC_MSG_RESULT(not found)
234       $4
235    else
236       AC_MSG_RESULT($kde_cv_path)
237       $2=$kde_cv_path
239    fi
242 AC_DEFUN([KDE_MOC_ERROR_MESSAGE],
244     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
245 Please check whether you installed Qt correctly.
246 You need to have a running moc binary.
247 configure tried to run $ac_cv_path_moc and the test didn't
248 succeed. If configure shouldn't have tried this one, set
249 the environment variable MOC to the right one before running
250 configure.
254 AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
256     AC_MSG_WARN([No Qt ui compiler (uic) found!
257 Please check whether you installed Qt correctly.
258 You need to have a running uic binary.
259 configure tried to run $ac_cv_path_uic and the test didn't
260 succeed. If configure shouldn't have tried this one, set
261 the environment variable UIC to the right one before running
262 configure.
267 AC_DEFUN([KDE_CHECK_UIC_FLAG],
269     AC_MSG_CHECKING([whether uic supports -$1 ])
270     kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
271     AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
272     [
273         cat >conftest.ui <<EOT
274         <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
276         ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null"
277         if AC_TRY_EVAL(ac_uic_testrun); then
278             eval "kde_cv_prog_uic_$kde_cache=yes"
279         else
280             eval "kde_cv_prog_uic_$kde_cache=no"
281         fi
282         rm -f conftest*
283     ])
285     if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
286         AC_MSG_RESULT([yes])
287         :
288         $3
289     else
290         AC_MSG_RESULT([no])
291         :
292         $4
293     fi
297 dnl ------------------------------------------------------------------------
298 dnl Find the meta object compiler and the ui compiler in the PATH,
299 dnl in $QTDIR/bin, and some more usual places
300 dnl ------------------------------------------------------------------------
302 AC_DEFUN([AC_PATH_QT_MOC_UIC],
304    AC_REQUIRE([KDE_CHECK_PERL])
305    qt_bindirs=""
306    for dir in $kde_qt_dirs; do
307       qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
308    done
309    qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
310    if test ! "$ac_qt_bindir" = "NO"; then
311       qt_bindirs="$ac_qt_bindir $qt_bindirs"
312    fi
314    KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
315    if test -z "$UIC_NOT_NEEDED"; then
316      KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""])
317      if test -z "$UIC_PATH" ; then
318        KDE_UIC_ERROR_MESSAGE
319        exit 1
320      else
321        UIC=$UIC_PATH
323        if test $kde_qtver = 3; then
324          KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
325          KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
327          if test x$ac_uic_supports_libpath = xyes; then
328              UIC="$UIC -L \$(kde_widgetdir)"
329          fi
330          if test x$ac_uic_supports_nounload = xyes; then
331              UIC="$UIC -nounload"
332          fi
333        fi
334      fi
335    else
336      UIC="echo uic not available: "
337    fi
339    AC_SUBST(MOC)
340    AC_SUBST(UIC)
342    UIC_TR="i18n"
343    if test $kde_qtver = 3; then
344      UIC_TR="tr2i18n"
345    fi
347    AC_SUBST(UIC_TR)
350 AC_DEFUN([KDE_1_CHECK_PATHS],
352   KDE_1_CHECK_PATH_HEADERS
354   KDE_TEST_RPATH=
356   if test -n "$USE_RPATH"; then
358      if test -n "$kde_libraries"; then
359        KDE_TEST_RPATH="-R $kde_libraries"
360      fi
362      if test -n "$qt_libraries"; then
363        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
364      fi
366      if test -n "$x_libraries"; then
367        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
368      fi
370      KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
371   fi
373 AC_MSG_CHECKING([for KDE libraries installed])
374 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'
376 if AC_TRY_EVAL(ac_link) && test -s conftest; then
377   AC_MSG_RESULT(yes)
378 else
379   AC_MSG_ERROR([your system fails at linking a small KDE application!
380 Check, if your compiler is installed correctly and if you have used the
381 same compiler to compile Qt and kdelibs as you did use now.
382 For more details about this problem, look at the end of config.log.])
385 if eval `KDEDIR= ./conftest 2>&5`; then
386   kde_result=done
387 else
388   kde_result=problems
391 KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
392 kde_have_all_paths=yes
394 KDE_SET_PATHS($kde_result)
398 AC_DEFUN([KDE_SET_PATHS],
400   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
401         kde_htmldir=\"$kde_htmldir\" \
402         kde_appsdir=\"$kde_appsdir\" \
403         kde_icondir=\"$kde_icondir\" \
404         kde_sounddir=\"$kde_sounddir\" \
405         kde_datadir=\"$kde_datadir\" \
406         kde_locale=\"$kde_locale\" \
407         kde_cgidir=\"$kde_cgidir\" \
408         kde_confdir=\"$kde_confdir\" \
409         kde_kcfgdir=\"$kde_kcfgdir\" \
410         kde_mimedir=\"$kde_mimedir\" \
411         kde_toolbardir=\"$kde_toolbardir\" \
412         kde_wallpaperdir=\"$kde_wallpaperdir\" \
413         kde_templatesdir=\"$kde_templatesdir\" \
414         kde_bindir=\"$kde_bindir\" \
415         kde_servicesdir=\"$kde_servicesdir\" \
416         kde_servicetypesdir=\"$kde_servicetypesdir\" \
417         kde_moduledir=\"$kde_moduledir\" \
418         kde_styledir=\"$kde_styledir\" \
419         kde_widgetdir=\"$kde_widgetdir\" \
420         xdg_appsdir=\"$xdg_appsdir\" \
421         xdg_menudir=\"$xdg_menudir\" \
422         xdg_directorydir=\"$xdg_directorydir\" \
423         kde_result=$1"
426 AC_DEFUN([KDE_SET_DEFAULT_PATHS],
428 if test "$1" = "default"; then
430   if test -z "$kde_htmldir"; then
431     kde_htmldir='\${datadir}/doc/HTML'
432   fi
433   if test -z "$kde_appsdir"; then
434     kde_appsdir='\${datadir}/applnk'
435   fi
436   if test -z "$kde_icondir"; then
437     kde_icondir='\${datadir}/icons'
438   fi
439   if test -z "$kde_sounddir"; then
440     kde_sounddir='\${datadir}/sounds'
441   fi
442   if test -z "$kde_datadir"; then
443     kde_datadir='\${datadir}/apps'
444   fi
445   if test -z "$kde_locale"; then
446     kde_locale='\${datadir}/locale'
447   fi
448   if test -z "$kde_cgidir"; then
449     kde_cgidir='\${exec_prefix}/cgi-bin'
450   fi
451   if test -z "$kde_confdir"; then
452     kde_confdir='\${datadir}/config'
453   fi
454   if test -z "$kde_kcfgdir"; then
455     kde_kcfgdir='\${datadir}/config.kcfg'
456   fi
457   if test -z "$kde_mimedir"; then
458     kde_mimedir='\${datadir}/mimelnk'
459   fi
460   if test -z "$kde_toolbardir"; then
461     kde_toolbardir='\${datadir}/toolbar'
462   fi
463   if test -z "$kde_wallpaperdir"; then
464     kde_wallpaperdir='\${datadir}/wallpapers'
465   fi
466   if test -z "$kde_templatesdir"; then
467     kde_templatesdir='\${datadir}/templates'
468   fi
469   if test -z "$kde_bindir"; then
470     kde_bindir='\${exec_prefix}/bin'
471   fi
472   if test -z "$kde_servicesdir"; then
473     kde_servicesdir='\${datadir}/services'
474   fi
475   if test -z "$kde_servicetypesdir"; then
476     kde_servicetypesdir='\${datadir}/servicetypes'
477   fi
478   if test -z "$kde_moduledir"; then
479     if test "$kde_qtver" = "2"; then
480       kde_moduledir='\${libdir}/kde2'
481     else
482       kde_moduledir='\${libdir}/kde3'
483     fi
484   fi
485   if test -z "$kde_styledir"; then
486     kde_styledir='\${libdir}/kde3/plugins/styles'
487   fi
488   if test -z "$kde_widgetdir"; then
489     kde_widgetdir='\${libdir}/kde3/plugins/designer'
490   fi
491   if test -z "$xdg_appsdir"; then
492     xdg_appsdir='\${datadir}/applications/kde'
493   fi
494   if test -z "$xdg_menudir"; then
495     xdg_menudir='\${sysconfdir}/xdg/menus'
496   fi
497   if test -z "$xdg_directorydir"; then
498     xdg_directorydir='\${datadir}/desktop-directories'
499   fi
501   KDE_SET_PATHS(defaults)
503 else
505   if test $kde_qtver = 1; then
506      AC_MSG_RESULT([compiling])
507      KDE_1_CHECK_PATHS
508   else
509      AC_MSG_ERROR([path checking not yet supported for KDE 2])
510   fi
515 AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS],
516 [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
517    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
518    test -z "$kde_datadir" || test -z "$kde_locale"  ||
519    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
520    test -z "$kde_kcfgdir" ||
521    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
522    test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
523    test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
524    test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
525    test -z "$kde_styledir" || test -z "kde_widgetdir" ||
526    test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" ||
527    test "x$kde_have_all_paths" != "xyes"; then
528      kde_have_all_paths=no
529   fi
532 AC_DEFUN([KDE_MISSING_PROG_ERROR],
534     AC_MSG_ERROR([The important program $1 was not found!
535 Please check whether you installed KDE correctly.
539 AC_DEFUN([KDE_MISSING_ARTS_ERROR],
541     AC_MSG_ERROR([The important program $1 was not found!
542 Please check whether you installed aRts correctly or use
543 --without-arts to compile without aRts support (this will remove functionality).
547 AC_DEFUN([KDE_SET_DEFAULT_BINDIRS],
549     kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
550     test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs"
551     if test -n "$KDEDIRS"; then
552        kde_save_IFS=$IFS
553        IFS=:
554        for dir in $KDEDIRS; do
555             kde_default_bindirs="$dir/bin $kde_default_bindirs "
556        done
557        IFS=$kde_save_IFS
558     fi
561 AC_DEFUN([KDE_SUBST_PROGRAMS],
563     AC_ARG_WITH(arts,
564         AC_HELP_STRING([--without-arts],[build without aRts [default=no]]),
565         [build_arts=$withval],
566         [build_arts=yes]
567     )
568     AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no")
569     if test "$build_arts" = "no"; then
570         AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts])
571     fi
573         KDE_SET_DEFAULT_BINDIRS
574         kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs"
575         KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
576         KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
577         if test "$build_arts" '!=' "no"; then
578           KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)])
579           KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
580         fi
581         KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
583         kde32ornewer=1
584         kde33ornewer=1
585         if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then
586             kde32ornewer=
587             kde33ornewer=
588         else
589             if test "$kde_qtver" = "3"; then
590               if test "$kde_qtsubver" -le 1; then
591                 kde32ornewer=
592               fi
593               if test "$kde_qtsubver" -le 2 -o `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then
594                 kde33ornewer=
595               fi
596             fi
597         fi
599         if test -n "$kde32ornewer"; then
600             KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)])
601             KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)])
602         fi
603         if test -n "$kde33ornewer"; then
604             KDE_FIND_PATH(makekdewidgets, MAKEKDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(makekdewidgets)])
605             AC_SUBST(MAKEKDEWIDGETS)
606         fi
607         KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""])
609         if test -n "$MEINPROC" -a "$MEINPROC" != "compiled"; then
610             kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
611             test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
612             AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
613             if test "$KDE_XSL_STYLESHEET" = "NO"; then
614                 KDE_XSL_STYLESHEET=""
615             else
616                 KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl"
617             fi
618         fi
620         DCOP_DEPENDENCIES='$(DCOPIDL)'
621         if test -n "$kde32ornewer"; then
622             KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)'
623             DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)'
624             AC_SUBST(KCONFIG_COMPILER)
625             AC_SUBST(KCFG_DEPENDENCIES)
626             AC_SUBST(DCOPIDLNG)
627         fi
628         AC_SUBST(DCOPIDL)
629         AC_SUBST(DCOPIDL2CPP)
630         AC_SUBST(DCOP_DEPENDENCIES)
631         AC_SUBST(MCOPIDL)
632         AC_SUBST(ARTSCCONFIG)
633         AC_SUBST(MEINPROC)
634         AC_SUBST(KDE_XSL_STYLESHEET)
635         AC_SUBST(XMLLINT)
636 ])dnl
638 AC_DEFUN([AC_CREATE_KFSSTND],
640 AC_REQUIRE([AC_CHECK_RPATH])
642 AC_MSG_CHECKING([for KDE paths])
643 kde_result=""
644 kde_cached_paths=yes
645 AC_CACHE_VAL(kde_cv_all_paths,
647   KDE_SET_DEFAULT_PATHS($1)
648   kde_cached_paths=no
650 eval "$kde_cv_all_paths"
651 KDE_CHECK_PATHS_FOR_COMPLETENESS
652 if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
653   # wrong values were cached, may be, we can set better ones
654   kde_result=
655   kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
656   kde_datadir= kde_locale=  kde_cgidir=  kde_confdir= kde_kcfgdir=
657   kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
658   kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
659   kde_have_all_paths=
660   kde_styledir=
661   kde_widgetdir=
662   xdg_appsdir = xdg_menudir= xdg_directorydir=
663   KDE_SET_DEFAULT_PATHS($1)
664   eval "$kde_cv_all_paths"
665   KDE_CHECK_PATHS_FOR_COMPLETENESS
666   kde_result="$kde_result (cache overridden)"
668 if test "$kde_have_all_paths" = "no"; then
669   AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
670 Since it had compiled and linked before, it must be a strange problem on your system.
671 Look at config.log for details. If you are not able to fix this, look at
672 http://www.kde.org/faq/installation.html or any www.kde.org mirror.
673 (If you're using an egcs version on Linux, you may update binutils!)
675 else
676   rm -f conftest*
677   AC_MSG_RESULT($kde_result)
680 bindir=$kde_bindir
682 KDE_SUBST_PROGRAMS
686 AC_DEFUN([AC_SUBST_KFSSTND],
688 AC_SUBST(kde_htmldir)
689 AC_SUBST(kde_appsdir)
690 AC_SUBST(kde_icondir)
691 AC_SUBST(kde_sounddir)
692 AC_SUBST(kde_datadir)
693 AC_SUBST(kde_locale)
694 AC_SUBST(kde_confdir)
695 AC_SUBST(kde_kcfgdir)
696 AC_SUBST(kde_mimedir)
697 AC_SUBST(kde_wallpaperdir)
698 AC_SUBST(kde_bindir)
699 dnl X Desktop Group standards
700 AC_SUBST(xdg_appsdir)
701 AC_SUBST(xdg_menudir)
702 AC_SUBST(xdg_directorydir)
703 dnl for KDE 2
704 AC_SUBST(kde_templatesdir)
705 AC_SUBST(kde_servicesdir)
706 AC_SUBST(kde_servicetypesdir)
707 AC_SUBST(kde_moduledir)
708 AC_SUBST(kdeinitdir, '$(kde_moduledir)')
709 AC_SUBST(kde_styledir)
710 AC_SUBST(kde_widgetdir)
711 if test "$kde_qtver" = 1; then
712   kde_minidir="$kde_icondir/mini"
713 else
714 # for KDE 1 - this breaks KDE2 apps using minidir, but
715 # that's the plan ;-/
716   kde_minidir="/dev/null"
718 dnl AC_SUBST(kde_minidir)
719 dnl AC_SUBST(kde_cgidir)
720 dnl AC_SUBST(kde_toolbardir)
723 AC_DEFUN([KDE_MISC_TESTS],
725    dnl Checks for libraries.
726    AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD
727    AC_SUBST(LIBUTIL)
728    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
729    AC_SUBST(LIBCOMPAT)
730    kde_have_crypt=
731    AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
732       AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
733         AC_MSG_WARN([you have no crypt in either libcrypt or libc.
734 You should install libcrypt from another source or configure with PAM
735 support])
736         kde_have_crypt=no
737       ]))
738    AC_SUBST(LIBCRYPT)
739    if test $kde_have_crypt = yes; then
740       AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
741    fi
742    AC_CHECK_SOCKLEN_T
743    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
744    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
745       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
746         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
747    fi
748    AC_CHECK_FUNC(inet_ntoa)
749    if test $ac_cv_func_inet_ntoa = no; then
750      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
751    fi
752    AC_CHECK_FUNC(connect)
753    if test $ac_cv_func_connect = no; then
754       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
755         $X_EXTRA_LIBS)
756    fi
758    AC_CHECK_FUNC(remove)
759    if test $ac_cv_func_remove = no; then
760       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
761    fi
763    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
764    AC_CHECK_FUNC(shmat, ,
765      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
767    # more headers that need to be explicitly included on darwin
768    AC_CHECK_HEADERS(sys/types.h stdint.h)
770    # sys/bitypes.h is needed for uint32_t and friends on Tru64
771    AC_CHECK_HEADERS(sys/bitypes.h)
773    # darwin requires a poll emulation library
774    AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll")
776    # for some image handling on Mac OS X
777    AC_CHECK_HEADERS(Carbon/Carbon.h)
779    # CoreAudio framework
780    AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [
781      AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API])
782      FRAMEWORK_COREAUDIO="-Xlinker -framework -Xlinker CoreAudio"
783    ])
785    AC_CHECK_RES_INIT
786    AC_SUBST(LIB_POLL)
787    AC_SUBST(FRAMEWORK_COREAUDIO)
788    LIBSOCKET="$X_EXTRA_LIBS"
789    AC_SUBST(LIBSOCKET)
790    AC_SUBST(X_EXTRA_LIBS)
791    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
792    AC_SUBST(LIBUCB)
794    case $host in  dnl this *is* LynxOS specific
795    *-*-lynxos* )
796         AC_MSG_CHECKING([LynxOS header file wrappers])
797         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
798         AC_MSG_RESULT(disabled)
799         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
800          ;;
801     esac
803    KDE_CHECK_TYPES
804    KDE_CHECK_LIBDL
805    KDE_CHECK_STRLCPY
807 # darwin needs this to initialize the environment
808 AC_CHECK_HEADERS(crt_externs.h)
809 AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
811 AH_VERBATIM(_DARWIN_ENVIRON,
813 #if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
814 # include <sys/time.h>
815 # include <crt_externs.h>
816 # define environ (*_NSGetEnviron())
817 #endif
820 AH_VERBATIM(_AIX_STRINGS_H_BZERO,
823  * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
824  * that defines bzero.
825  */
827 #if defined(_AIX)
828 #include <strings.h>
829 #endif
832 AC_CHECK_FUNCS([vsnprintf snprintf])
834 AH_VERBATIM(_TRU64,[
836  * On HP-UX, the declaration of vsnprintf() is needed every time !
837  */
839 #if !defined(HAVE_VSNPRINTF) || defined(hpux)
840 #if __STDC__
841 #include <stdarg.h>
842 #include <stdlib.h>
843 #else
844 #include <varargs.h>
845 #endif
846 #ifdef __cplusplus
847 extern "C"
848 #endif
849 int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
850 #ifdef __cplusplus
851 extern "C"
852 #endif
853 int snprintf(char *str, size_t n, char const *fmt, ...);
854 #endif
859 dnl ------------------------------------------------------------------------
860 dnl Find the header files and libraries for X-Windows. Extended the
861 dnl macro AC_PATH_X
862 dnl ------------------------------------------------------------------------
864 AC_DEFUN([K_PATH_X],
866 AC_REQUIRE([KDE_MISC_TESTS])dnl
867 AC_REQUIRE([KDE_CHECK_LIB64])
869 AC_ARG_ENABLE(
870   embedded,
871   AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]),
872   kde_use_qt_emb=$enableval,
873   kde_use_qt_emb=no
876 AC_ARG_ENABLE(
877   qtopia,
878   AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]),
879   kde_use_qt_emb_palm=$enableval,
880   kde_use_qt_emb_palm=no
883 AC_ARG_ENABLE(
884   mac,
885   AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]),
886   kde_use_qt_mac=$enableval,
887   kde_use_qt_mac=no
890 # used to disable x11-specific stuff on special platforms
891 AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no")
893 if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then
895 AC_MSG_CHECKING(for X)
897 AC_CACHE_VAL(kde_cv_have_x,
898 [# One or both of the vars are not set, and there is no cached value.
899 if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
900    kde_x_includes=NO
901 else
902    kde_x_includes=$x_includes
904 if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
905    kde_x_libraries=NO
906 else
907    kde_x_libraries=$x_libraries
910 # below we use the standard autoconf calls
911 ac_x_libraries=$kde_x_libraries
912 ac_x_includes=$kde_x_includes
914 KDE_PATH_X_DIRECT
915 dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
916 dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
917 dnl location. The correct location is /usr/lib32 or an undefined value
918 dnl (the linker is smart enough to pick the correct default library).
919 dnl Things work just fine if you use just AC_PATH_X_DIRECT.
920 dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
921 dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
922 dnl x_includes should be left alone.
923 case "$host" in
924 mips-sgi-irix6*)
925   ;;
926 *-*-solaris*)
927   ;;
929   _AC_PATH_X_XMKMF
930   if test -z "$ac_x_includes"; then
931     ac_x_includes="."
932   fi
933   if test -z "$ac_x_libraries"; then
934     ac_x_libraries="/usr/lib${kdelibsuff}"
935   fi
936 esac
937 #from now on we use our own again
939 # when the user already gave --x-includes, we ignore
940 # what the standard autoconf macros told us.
941 if test "$kde_x_includes" = NO; then
942   kde_x_includes=$ac_x_includes
945 # for --x-libraries too
946 if test "$kde_x_libraries" = NO; then
947   kde_x_libraries=$ac_x_libraries
950 if test "$kde_x_includes" = NO; then
951   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
954 if test "$kde_x_libraries" = NO; then
955   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
958 # Record where we found X for the cache.
959 kde_cv_have_x="have_x=yes \
960          kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
961 ])dnl
963 eval "$kde_cv_have_x"
965 if test "$have_x" != yes; then
966   AC_MSG_RESULT($have_x)
967   no_x=yes
968 else
969   AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
972 if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
973   X_INCLUDES=""
974   x_includes="."; dnl better than nothing :-
975  else
976   x_includes=$kde_x_includes
977   X_INCLUDES="-I$x_includes"
980 if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
981   X_LDFLAGS=""
982   x_libraries="/usr/lib"; dnl better than nothing :-
983  else
984   x_libraries=$kde_x_libraries
985   X_LDFLAGS="-L$x_libraries"
987 all_includes="$X_INCLUDES"
988 all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS"
990 # Check for libraries that X11R6 Xt/Xaw programs need.
991 ac_save_LDFLAGS="$LDFLAGS"
992 LDFLAGS="$LDFLAGS $X_LDFLAGS"
993 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
994 # check for ICE first), but we must link in the order -lSM -lICE or
995 # we get undefined symbols.  So assume we have SM if we have ICE.
996 # These have to be linked with before -lX11, unlike the other
997 # libraries we check for below, so use a different variable.
998 #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
999 AC_CHECK_LIB(ICE, IceConnectionNumber,
1000   [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
1001 LDFLAGS="$ac_save_LDFLAGS"
1003 LIB_X11='-lX11 $(LIBSOCKET)'
1005 AC_MSG_CHECKING(for libXext)
1006 AC_CACHE_VAL(kde_cv_have_libXext,
1008 kde_ldflags_safe="$LDFLAGS"
1009 kde_libs_safe="$LIBS"
1011 LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
1012 LIBS="-lXext -lX11 $LIBSOCKET"
1014 AC_TRY_LINK([
1015 #include <stdio.h>
1016 #ifdef STDC_HEADERS
1017 # include <stdlib.h>
1018 #endif
1021 printf("hello Xext\n");
1023 kde_cv_have_libXext=yes,
1024 kde_cv_have_libXext=no
1027 LDFLAGS=$kde_ldflags_safe
1028 LIBS=$kde_libs_safe
1031 AC_MSG_RESULT($kde_cv_have_libXext)
1033 if test "$kde_cv_have_libXext" = "no"; then
1034   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
1035 can't find it itself, we stop here assuming that make wouldn't find
1036 them either.])
1039 LIB_XEXT="-lXext"
1040 QTE_NORTTI=""
1042 elif test "$kde_use_qt_emb" = "yes"; then
1043   dnl We're using QT Embedded
1044   CPPFLAGS=-DQWS
1045   CXXFLAGS="$CXXFLAGS -fno-rtti"
1046   QTE_NORTTI="-fno-rtti -DQWS"
1047   X_PRE_LIBS=""
1048   LIB_X11=""
1049   LIB_XEXT=""
1050   LIB_XRENDER=""
1051   LIBSM=""
1052   X_INCLUDES=""
1053   X_LDFLAGS=""
1054   x_includes=""
1055   x_libraries=""
1056 elif test "$kde_use_qt_mac" = "yes"; then
1057   dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to
1058   dnl be included to get the information) --Sam
1059   CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
1060   CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
1061   X_PRE_LIBS=""
1062   LIB_X11=""
1063   LIB_XEXT=""
1064   LIB_XRENDER=""
1065   LIBSM=""
1066   X_INCLUDES=""
1067   X_LDFLAGS=""
1068   x_includes=""
1069   x_libraries=""
1071 AC_SUBST(X_PRE_LIBS)
1072 AC_SUBST(LIB_X11)
1073 AC_SUBST(LIB_XRENDER)
1074 AC_SUBST(LIBSM)
1075 AC_SUBST(X_INCLUDES)
1076 AC_SUBST(X_LDFLAGS)
1077 AC_SUBST(x_includes)
1078 AC_SUBST(x_libraries)
1079 AC_SUBST(QTE_NORTTI)
1080 AC_SUBST(LIB_XEXT)
1084 AC_DEFUN([KDE_PRINT_QT_PROGRAM],
1086 AC_REQUIRE([KDE_USE_QT])
1087 cat > conftest.$ac_ext <<EOF
1088 #include "confdefs.h"
1089 #include <qglobal.h>
1090 #include <qapplication.h>
1092 if test "$kde_qtver" = "2"; then
1093 cat >> conftest.$ac_ext <<EOF
1094 #include <qevent.h>
1095 #include <qstring.h>
1096 #include <qstyle.h>
1099 if test $kde_qtsubver -gt 0; then
1100 cat >> conftest.$ac_ext <<EOF
1101 #if QT_VERSION < 210
1102 #error 1
1103 #endif
1108 if test "$kde_qtver" = "3"; then
1109 cat >> conftest.$ac_ext <<EOF
1110 #include <qcursor.h>
1111 #include <qstylefactory.h>
1112 #include <private/qucomextra_p.h>
1116 echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
1117 cat >> conftest.$ac_ext <<EOF
1118 #error 1
1119 #endif
1121 int main() {
1123 if test "$kde_qtver" = "2"; then
1124 cat >> conftest.$ac_ext <<EOF
1125     QStringList *t = new QStringList();
1126     Q_UNUSED(t);
1128 if test $kde_qtsubver -gt 0; then
1129 cat >> conftest.$ac_ext <<EOF
1130     QString s;
1131     s.setLatin1("Elvis is alive", 14);
1135 if test "$kde_qtver" = "3"; then
1136 cat >> conftest.$ac_ext <<EOF
1137     (void)QStyleFactory::create(QString::null);
1138     QCursor c(Qt::WhatsThisCursor);
1141 cat >> conftest.$ac_ext <<EOF
1142     return 0;
1147 AC_DEFUN([KDE_USE_QT],
1149 if test -z "$1"; then
1150   # Current default Qt version: 3.3
1151   kde_qtver=3
1152   kde_qtsubver=3
1153 else
1154   kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
1155   # following is the check if subversion isnt found in passed argument
1156   if test "$kde_qtsubver" = "$1"; then
1157     kde_qtsubver=1
1158   fi
1159   kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
1160   if test "$kde_qtver" = "1"; then
1161     kde_qtsubver=42
1162   fi
1165 if test -z "$2"; then
1166   if test "$kde_qtver" = "2"; then
1167     if test $kde_qtsubver -gt 0; then
1168       kde_qt_minversion=">= Qt 2.2.2"
1169     else
1170       kde_qt_minversion=">= Qt 2.0.2"
1171     fi
1172   fi
1173   if test "$kde_qtver" = "3"; then
1174     if test $kde_qtsubver -gt 0; then
1175          if test $kde_qtsubver -gt 1; then
1176             if test $kde_qtsubver -gt 2; then
1177                 kde_qt_minversion=">= Qt 3.3 and < 4.0"
1178             else
1179                 kde_qt_minversion=">= Qt 3.2 and < 4.0"
1180             fi
1181          else
1182             kde_qt_minversion=">= Qt 3.1 (20021021) and < 4.0"
1183          fi
1184     else
1185       kde_qt_minversion=">= Qt 3.0 and < 4.0"
1186     fi
1187   fi
1188   if test "$kde_qtver" = "1"; then
1189     kde_qt_minversion=">= 1.42 and < 2.0"
1190   fi
1191 else
1192    kde_qt_minversion="$2"
1195 if test -z "$3"; then
1196    if test $kde_qtver = 3; then
1197      if test $kde_qtsubver -gt 0; then
1198        kde_qt_verstring="QT_VERSION >= 0x03@VER@00 && QT_VERSION < 0x040000"
1199        qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
1200        kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
1201      else
1202        kde_qt_verstring="QT_VERSION >= 300 && QT_VERSION < 0x040000"
1203      fi
1204    fi
1205    if test $kde_qtver = 2; then
1206      if test $kde_qtsubver -gt 0; then
1207        kde_qt_verstring="QT_VERSION >= 222"
1208      else
1209        kde_qt_verstring="QT_VERSION >= 200"
1210      fi
1211    fi
1212    if test $kde_qtver = 1; then
1213     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
1214    fi
1215 else
1216    kde_qt_verstring="$3"
1219 if test $kde_qtver = 4; then
1220   kde_qt_dirs="$QTDIR /usr/lib/qt4 /usr/lib/qt /usr/share/qt4"
1222 if test $kde_qtver = 3; then
1223   kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3"
1225 if test $kde_qtver = 2; then
1226    kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
1228 if test $kde_qtver = 1; then
1229    kde_qt_dirs="$QTDIR /usr/lib/qt"
1233 AC_DEFUN([KDE_CHECK_QT_DIRECT],
1235 AC_REQUIRE([KDE_USE_QT])
1236 AC_MSG_CHECKING([if Qt compiles without flags])
1237 AC_CACHE_VAL(kde_cv_qt_direct,
1239 AC_LANG_SAVE
1240 AC_LANG_CPLUSPLUS
1241 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
1242 ac_LIBRARY_PATH="$LIBRARY_PATH"
1243 ac_cxxflags_safe="$CXXFLAGS"
1244 ac_ldflags_safe="$LDFLAGS"
1245 ac_libs_safe="$LIBS"
1247 CXXFLAGS="$CXXFLAGS -I$qt_includes"
1248 LDFLAGS="$LDFLAGS $X_LDFLAGS"
1249 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1250 LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
1251 else
1252 LIBS="$LIBQT $LIBSOCKET"
1254 LD_LIBRARY_PATH=
1255 export LD_LIBRARY_PATH
1256 LIBRARY_PATH=
1257 export LIBRARY_PATH
1259 KDE_PRINT_QT_PROGRAM
1261 if AC_TRY_EVAL(ac_link) && test -s conftest; then
1262   kde_cv_qt_direct="yes"
1263 else
1264   kde_cv_qt_direct="no"
1265   echo "configure: failed program was:" >&AC_FD_CC
1266   cat conftest.$ac_ext >&AC_FD_CC
1269 rm -f conftest*
1270 CXXFLAGS="$ac_cxxflags_safe"
1271 LDFLAGS="$ac_ldflags_safe"
1272 LIBS="$ac_libs_safe"
1274 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
1275 export LD_LIBRARY_PATH
1276 LIBRARY_PATH="$ac_LIBRARY_PATH"
1277 export LIBRARY_PATH
1278 AC_LANG_RESTORE
1281 if test "$kde_cv_qt_direct" = "yes"; then
1282   AC_MSG_RESULT(yes)
1283   $1
1284 else
1285   AC_MSG_RESULT(no)
1286   $2
1290 dnl ------------------------------------------------------------------------
1291 dnl Try to find the Qt headers and libraries.
1292 dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
1293 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
1294 dnl ------------------------------------------------------------------------
1296 AC_DEFUN([AC_PATH_QT_1_3],
1298 AC_REQUIRE([K_PATH_X])
1299 AC_REQUIRE([KDE_USE_QT])
1300 AC_REQUIRE([KDE_CHECK_LIB64])
1302 dnl ------------------------------------------------------------------------
1303 dnl Add configure flag to enable linking to MT version of Qt library.
1304 dnl ------------------------------------------------------------------------
1306 AC_ARG_ENABLE(
1307   mt,
1308   AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]),
1309   kde_use_qt_mt=$enableval,
1310   [
1311     if test $kde_qtver = 3; then
1312       kde_use_qt_mt=yes
1313     else
1314       kde_use_qt_mt=no
1315     fi
1316   ]
1319 USING_QT_MT=""
1321 dnl ------------------------------------------------------------------------
1322 dnl If we not get --disable-qt-mt then adjust some vars for the host.
1323 dnl ------------------------------------------------------------------------
1325 KDE_MT_LDFLAGS=
1326 KDE_MT_LIBS=
1327 if test "x$kde_use_qt_mt" = "xyes"; then
1328   KDE_CHECK_THREADING
1329   if test "x$kde_use_threading" = "xyes"; then
1330     CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
1331     KDE_MT_LDFLAGS="$USE_THREADS"
1332     KDE_MT_LIBS="$LIBPTHREAD"
1333   else
1334     kde_use_qt_mt=no
1335   fi
1337 AC_SUBST(KDE_MT_LDFLAGS)
1338 AC_SUBST(KDE_MT_LIBS)
1340 kde_qt_was_given=yes
1342 dnl ------------------------------------------------------------------------
1343 dnl If we haven't been told how to link to Qt, we work it out for ourselves.
1344 dnl ------------------------------------------------------------------------
1345 if test -z "$LIBQT_GLOB"; then
1346   if test "x$kde_use_qt_emb" = "xyes"; then
1347     LIBQT_GLOB="libqte.*"
1348   else
1349     LIBQT_GLOB="libqt.*"
1350   fi
1353 if test -z "$LIBQT"; then
1354 dnl ------------------------------------------------------------
1355 dnl If we got --enable-embedded then adjust the Qt library name.
1356 dnl ------------------------------------------------------------
1357   if test "x$kde_use_qt_emb" = "xyes"; then
1358     qtlib="qte"
1359   else
1360     qtlib="qt"
1361   fi
1363   kde_int_qt="-l$qtlib"
1364 else
1365   kde_int_qt="$LIBQT"
1366   kde_lib_qt_set=yes
1369 if test -z "$LIBQPE"; then
1370 dnl ------------------------------------------------------------
1371 dnl If we got --enable-palmtop then add -lqpe to the link line
1372 dnl ------------------------------------------------------------
1373   if test "x$kde_use_qt_emb" = "xyes"; then
1374     if test "x$kde_use_qt_emb_palm" = "xyes"; then
1375       LIB_QPE="-lqpe"
1376     else
1377       LIB_QPE=""
1378     fi
1379   else
1380     LIB_QPE=""
1381   fi
1384 dnl ------------------------------------------------------------------------
1385 dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
1386 dnl ------------------------------------------------------------------------
1388 if test "x$kde_use_qt_mt" = "xyes"; then
1389   LIBQT="-l$qtlib-mt"
1390   kde_int_qt="-l$qtlib-mt"
1391   LIBQT_GLOB="lib$qtlib-mt.*"
1392   USING_QT_MT="using -mt"
1393 else
1394   LIBQT="-l$qtlib"
1397 if test $kde_qtver != 1; then
1399   AC_REQUIRE([AC_FIND_PNG])
1400   AC_REQUIRE([AC_FIND_JPEG])
1401   LIBQT="$LIBQT $LIBPNG $LIBJPEG"
1404 if test $kde_qtver = 3; then
1405   AC_REQUIRE([KDE_CHECK_LIBDL])
1406   LIBQT="$LIBQT $LIBDL"
1409 AC_MSG_CHECKING([for Qt])
1411 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1412 LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
1414 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
1415 qt_libraries=""
1416 qt_includes=""
1417 AC_ARG_WITH(qt-dir,
1418     AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]),
1419     [  ac_qt_includes="$withval"/include
1420        ac_qt_libraries="$withval"/lib${kdelibsuff}
1421        ac_qt_bindir="$withval"/bin
1422     ])
1424 AC_ARG_WITH(qt-includes,
1425     AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]),
1426     [
1427        ac_qt_includes="$withval"
1428     ])
1430 kde_qt_libs_given=no
1432 AC_ARG_WITH(qt-libraries,
1433     AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]),
1434     [  ac_qt_libraries="$withval"
1435        kde_qt_libs_given=yes
1436     ])
1438 AC_CACHE_VAL(ac_cv_have_qt,
1439 [#try to guess Qt locations
1441 qt_incdirs=""
1442 for dir in $kde_qt_dirs; do
1443    qt_incdirs="$qt_incdirs $dir/include $dir"
1444 done
1445 qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes"
1446 if test ! "$ac_qt_includes" = "NO"; then
1447    qt_incdirs="$ac_qt_includes $qt_incdirs"
1450 if test "$kde_qtver" != "1"; then
1451   kde_qt_header=qstyle.h
1452 else
1453   kde_qt_header=qglobal.h
1456 AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
1457 ac_qt_includes="$qt_incdir"
1459 qt_libdirs=""
1460 for dir in $kde_qt_dirs; do
1461    qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir"
1462 done
1463 qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
1464 if test ! "$ac_qt_libraries" = "NO"; then
1465   qt_libdir=$ac_qt_libraries
1466 else
1467   qt_libdirs="$ac_qt_libraries $qt_libdirs"
1468   # if the Qt was given, the chance is too big that libqt.* doesn't exist
1469   qt_libdir=NONE
1470   for dir in $qt_libdirs; do
1471     try="ls -1 $dir/${LIBQT_GLOB}"
1472     if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
1473   done
1475 for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
1476   if test -e "$a"; then
1477     LIBQT="$LIBQT ${kde_int_qt}_incremental"
1478     break
1479   fi
1480 done
1482 ac_qt_libraries="$qt_libdir"
1484 AC_LANG_SAVE
1485 AC_LANG_CPLUSPLUS
1487 ac_cxxflags_safe="$CXXFLAGS"
1488 ac_ldflags_safe="$LDFLAGS"
1489 ac_libs_safe="$LIBS"
1491 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
1492 LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
1493 LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
1495 KDE_PRINT_QT_PROGRAM
1497 if AC_TRY_EVAL(ac_link) && test -s conftest; then
1498   rm -f conftest*
1499 else
1500   echo "configure: failed program was:" >&AC_FD_CC
1501   cat conftest.$ac_ext >&AC_FD_CC
1502   ac_qt_libraries="NO"
1504 rm -f conftest*
1505 CXXFLAGS="$ac_cxxflags_safe"
1506 LDFLAGS="$ac_ldflags_safe"
1507 LIBS="$ac_libs_safe"
1509 AC_LANG_RESTORE
1510 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
1511   ac_cv_have_qt="have_qt=no"
1512   ac_qt_notfound=""
1513   missing_qt_mt=""
1514   if test "$ac_qt_includes" = NO; then
1515     if test "$ac_qt_libraries" = NO; then
1516       ac_qt_notfound="(headers and libraries)";
1517     else
1518       ac_qt_notfound="(headers)";
1519     fi
1520   else
1521     if test "x$kde_use_qt_mt" = "xyes"; then
1522        missing_qt_mt="
1523 Make sure that you have compiled Qt with thread support!"
1524        ac_qt_notfound="(library $qtlib-mt)";
1525     else
1526        ac_qt_notfound="(library $qtlib)";
1527     fi
1528   fi
1530   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
1531 For more details about this problem, look at the end of config.log.$missing_qt_mt])
1532 else
1533   have_qt="yes"
1537 eval "$ac_cv_have_qt"
1539 if test "$have_qt" != yes; then
1540   AC_MSG_RESULT([$have_qt]);
1541 else
1542   ac_cv_have_qt="have_qt=yes \
1543     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
1544   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
1546   qt_libraries="$ac_qt_libraries"
1547   qt_includes="$ac_qt_includes"
1550 if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
1551      KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
1554 AC_SUBST(qt_libraries)
1555 AC_SUBST(qt_includes)
1557 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
1558  QT_INCLUDES=""
1559 else
1560  QT_INCLUDES="-I$qt_includes"
1561  all_includes="$QT_INCLUDES $all_includes"
1564 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
1565  QT_LDFLAGS=""
1566 else
1567  QT_LDFLAGS="-L$qt_libraries"
1568  all_libraries="$QT_LDFLAGS $all_libraries"
1570 test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
1572 AC_SUBST(QT_INCLUDES)
1573 AC_SUBST(QT_LDFLAGS)
1574 AC_PATH_QT_MOC_UIC
1576 KDE_CHECK_QT_JPEG
1578 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1579 LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
1580 else
1581 LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
1583 test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
1584 for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
1585   if test -e "$a"; then
1586      LIB_QT="$LIB_QT ${kde_int_qt}_incremental"
1587      break
1588   fi
1589 done
1591 AC_SUBST(LIB_QT)
1592 AC_SUBST(LIB_QPE)
1594 AC_SUBST(kde_qtver)
1597 AC_DEFUN([AC_PATH_QT],
1599 AC_PATH_QT_1_3
1602 AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
1604 AC_REQUIRE([AC_PATH_QT_MOC_UIC])
1606 if test x$ac_uic_supports_libpath = xyes; then
1608 AC_MSG_CHECKING([if UIC has KDE plugins available])
1609 AC_CACHE_VAL(kde_cv_uic_plugins,
1611 cat > actest.ui << EOF
1612 <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
1613 <class>NewConnectionDialog</class>
1614 <widget class="QDialog">
1615    <widget class="KLineEdit">
1616         <property name="name">
1617            <cstring>testInput</cstring>
1618         </property>
1619    </widget>
1620 </widget>
1621 </UI>
1626 kde_cv_uic_plugins=no
1627 kde_line="$UIC_PATH -L $kde_widgetdir"
1628 if test x$ac_uic_supports_nounload = xyes; then
1629    kde_line="$kde_line -nounload"
1631 kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
1632 if AC_TRY_EVAL(kde_line); then
1633         # if you're trying to debug this check and think it's incorrect,
1634         # better check your installation. The check _is_ correct - your
1635         # installation is not.
1636         if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
1637                 kde_cv_uic_plugins=yes
1638         fi
1640 rm -f actest.ui actest.cpp
1643 AC_MSG_RESULT([$kde_cv_uic_plugins])
1644 if test "$kde_cv_uic_plugins" != yes; then
1645         AC_MSG_ERROR([
1646 you need to install kdelibs first.
1648 If you did install kdelibs, then the Qt version that is picked up by
1649 this configure is not the same version you used to compile kdelibs.
1650 The Qt Plugin installed by kdelibs is *ONLY* loadable if it is the
1651 _same Qt version_, compiled with the _same compiler_ and the same Qt
1652 configuration settings.
1658 AC_DEFUN([KDE_CHECK_FINAL],
1660   AC_ARG_ENABLE(final,
1661         AC_HELP_STRING([--enable-final],
1662                        [build size optimized apps (experimental - needs lots of memory)]),
1663         kde_use_final=$enableval, kde_use_final=no)
1665   if test "x$kde_use_final" = "xyes"; then
1666       KDE_USE_FINAL_TRUE=""
1667       KDE_USE_FINAL_FALSE="#"
1668    else
1669       KDE_USE_FINAL_TRUE="#"
1670       KDE_USE_FINAL_FALSE=""
1671   fi
1672   AC_SUBST(KDE_USE_FINAL_TRUE)
1673   AC_SUBST(KDE_USE_FINAL_FALSE)
1676 AC_DEFUN([KDE_CHECK_CLOSURE],
1678   AC_ARG_ENABLE(closure,
1679                 AC_HELP_STRING([--enable-closure],[delay template instantiation]),
1680         kde_use_closure=$enableval, kde_use_closure=no)
1682   KDE_NO_UNDEFINED=""
1683   if test "x$kde_use_closure" = "xyes"; then
1684        KDE_USE_CLOSURE_TRUE=""
1685        KDE_USE_CLOSURE_FALSE="#"
1686 #       CXXFLAGS="$CXXFLAGS $REPO"
1687   else
1688        KDE_USE_CLOSURE_TRUE="#"
1689        KDE_USE_CLOSURE_FALSE=""
1690        KDE_NO_UNDEFINED=""
1691        case $host in
1692          *-*-linux-gnu)
1693            KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
1694                 [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
1695                 [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
1696                 [KDE_NO_UNDEFINED=""])],
1697             [KDE_NO_UNDEFINED=""])
1698            ;;
1699        esac
1700   fi
1701   AC_SUBST(KDE_USE_CLOSURE_TRUE)
1702   AC_SUBST(KDE_USE_CLOSURE_FALSE)
1703   AC_SUBST(KDE_NO_UNDEFINED)
1706 dnl Check if the linker supports --enable-new-dtags and --as-needed
1707 AC_DEFUN([KDE_CHECK_NEW_LDFLAGS],
1709   AC_ARG_ENABLE(new_ldflags,
1710                 AC_HELP_STRING([--enable-new-ldflags],
1711                 [enable the new linker flags]),
1712         kde_use_new_ldflags=$enableval,
1713         kde_use_new_ldflags=no)
1715   LDFLAGS_AS_NEEDED=""
1716   LDFLAGS_NEW_DTAGS=""
1717   if test "x$kde_use_new_ldflags" = "xyes"; then
1718        LDFLAGS_NEW_DTAGS=""
1719        KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags],
1720                 [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],)
1722        KDE_CHECK_COMPILER_FLAG([Wl,--as-needed],
1723                 [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],)
1724   fi
1725   AC_SUBST(LDFLAGS_AS_NEEDED)
1726   AC_SUBST(LDFLAGS_NEW_DTAGS)
1729 AC_DEFUN([KDE_CHECK_NMCHECK],
1731   AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
1732         kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
1734   if test "$kde_use_nmcheck" = "yes"; then
1735       KDE_USE_NMCHECK_TRUE=""
1736       KDE_USE_NMCHECK_FALSE="#"
1737    else
1738       KDE_USE_NMCHECK_TRUE="#"
1739       KDE_USE_NMCHECK_FALSE=""
1740   fi
1741   AC_SUBST(KDE_USE_NMCHECK_TRUE)
1742   AC_SUBST(KDE_USE_NMCHECK_FALSE)
1745 AC_DEFUN([KDE_EXPAND_MAKEVAR], [
1746 savex=$exec_prefix
1747 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
1748 tmp=$$2
1749 while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
1750 exec_prefix=$savex
1753 dnl ------------------------------------------------------------------------
1754 dnl Now, the same with KDE
1755 dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
1756 dnl and $(kde_includes) will be the kdehdrlocation (if needed)
1757 dnl ------------------------------------------------------------------------
1759 AC_DEFUN([AC_BASE_PATH_KDE],
1761 AC_REQUIRE([KDE_CHECK_STL])
1762 AC_REQUIRE([AC_PATH_QT])dnl
1763 AC_REQUIRE([KDE_CHECK_LIB64])
1765 AC_CHECK_RPATH
1766 AC_MSG_CHECKING([for KDE])
1768 if test "${prefix}" != NONE; then
1769   kde_includes=${includedir}
1770   KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
1772   kde_libraries=${libdir}
1773   KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
1775 else
1776   ac_kde_includes=
1777   ac_kde_libraries=
1778   kde_libraries=""
1779   kde_includes=""
1782 AC_CACHE_VAL(ac_cv_have_kde,
1783 [#try to guess kde locations
1785 if test "$kde_qtver" = 1; then
1786   kde_check_header="ksock.h"
1787   kde_check_lib="libkdecore.la"
1788 else
1789   kde_check_header="ksharedptr.h"
1790   kde_check_lib="libkio.la"
1793 if test -z "$1"; then
1795 kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
1796 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
1797 kde_incdirs="$ac_kde_includes $kde_incdirs"
1798 AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
1799 ac_kde_includes="$kde_incdir"
1801 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
1802   AC_MSG_ERROR([
1803 in the prefix, you've chosen, are no KDE headers installed. This will fail.
1804 So, check this please and use another prefix!])
1807 kde_libdirs="$kde_libs_prefix/lib${kdelibsuff} /usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}"
1808 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
1809 kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
1810 AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
1811 ac_kde_libraries="$kde_libdir"
1813 kde_widgetdir=NO
1814 dnl this might be somewhere else
1815 AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
1817 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
1818 AC_MSG_ERROR([
1819 in the prefix, you've chosen, are no KDE libraries installed. This will fail.
1820 So, check this please and use another prefix!])
1823 if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then
1824 AC_MSG_ERROR([
1825 I can't find the designer plugins. These are required and should have been installed
1826 by kdelibs])
1829 if test -n "$kde_widgetdir"; then
1830     kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
1834 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
1835   ac_cv_have_kde="have_kde=no"
1836 else
1837   ac_cv_have_kde="have_kde=yes \
1838     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1841 else dnl test -z $1, e.g. from kdelibs
1843   ac_cv_have_kde="have_kde=no"
1846 ])dnl
1848 eval "$ac_cv_have_kde"
1850 if test "$have_kde" != "yes"; then
1851  if test "${prefix}" = NONE; then
1852   ac_kde_prefix="$ac_default_prefix"
1853  else
1854   ac_kde_prefix="$prefix"
1855  fi
1856  if test "$exec_prefix" = NONE; then
1857   ac_kde_exec_prefix="$ac_kde_prefix"
1858   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
1859  else
1860   ac_kde_exec_prefix="$exec_prefix"
1861   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
1862  fi
1864  kde_libraries="${libdir}"
1865  kde_includes="${includedir}"
1867 else
1868   ac_cv_have_kde="have_kde=yes \
1869     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1870   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
1872   kde_libraries="$ac_kde_libraries"
1873   kde_includes="$ac_kde_includes"
1875 AC_SUBST(kde_libraries)
1876 AC_SUBST(kde_includes)
1878 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes"  || test "$kde_includes" = "/usr/include"; then
1879  KDE_INCLUDES=""
1880 else
1881  KDE_INCLUDES="-I$kde_includes"
1882  all_includes="$KDE_INCLUDES $all_includes"
1885 KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION"
1887 KDE_LDFLAGS="-L$kde_libraries"
1888 if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
1889  all_libraries="$KDE_LDFLAGS $all_libraries"
1892 AC_SUBST(KDE_LDFLAGS)
1893 AC_SUBST(KDE_INCLUDES)
1895 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1897 all_libraries="$all_libraries $USER_LDFLAGS"
1898 all_includes="$all_includes $USER_INCLUDES"
1899 AC_SUBST(all_includes)
1900 AC_SUBST(all_libraries)
1902 if test -z "$1"; then
1903 KDE_CHECK_UIC_PLUGINS
1906 ac_kde_libraries="$kde_libdir"
1908 AC_SUBST(AUTODIRS)
1913 AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
1915 AC_MSG_CHECKING(for extra includes)
1916 AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]),
1917   kde_use_extra_includes="$withval",
1918   kde_use_extra_includes=NONE
1920 kde_extra_includes=
1921 if test -n "$kde_use_extra_includes" && \
1922    test "$kde_use_extra_includes" != "NONE"; then
1924    ac_save_ifs=$IFS
1925    IFS=':'
1926    for dir in $kde_use_extra_includes; do
1927      kde_extra_includes="$kde_extra_includes $dir"
1928      USER_INCLUDES="$USER_INCLUDES -I$dir"
1929    done
1930    IFS=$ac_save_ifs
1931    kde_use_extra_includes="added"
1932 else
1933    kde_use_extra_includes="no"
1935 AC_SUBST(USER_INCLUDES)
1937 AC_MSG_RESULT($kde_use_extra_includes)
1939 kde_extra_libs=
1940 AC_MSG_CHECKING(for extra libs)
1941 AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]),
1942   kde_use_extra_libs=$withval,
1943   kde_use_extra_libs=NONE
1945 if test -n "$kde_use_extra_libs" && \
1946    test "$kde_use_extra_libs" != "NONE"; then
1948    ac_save_ifs=$IFS
1949    IFS=':'
1950    for dir in $kde_use_extra_libs; do
1951      kde_extra_libs="$kde_extra_libs $dir"
1952      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
1953      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
1954    done
1955    IFS=$ac_save_ifs
1956    kde_use_extra_libs="added"
1957 else
1958    kde_use_extra_libs="no"
1961 AC_SUBST(USER_LDFLAGS)
1963 AC_MSG_RESULT($kde_use_extra_libs)
1967 AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
1969     AC_MSG_CHECKING([for KDE headers installed])
1970     AC_LANG_SAVE
1971     AC_LANG_CPLUSPLUS
1972 cat > conftest.$ac_ext <<EOF
1973 #ifdef STDC_HEADERS
1974 # include <stdlib.h>
1975 #endif
1976 #include <stdio.h>
1977 #include "confdefs.h"
1978 #include <kapp.h>
1980 int main() {
1981     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
1982     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
1983     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
1984     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
1985     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
1986     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
1987     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
1988     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
1989     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
1990     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
1991     printf("kde_wallpaperdir=\\"%s\\"\n",
1992         KApplication::kde_wallpaperdir().data());
1993     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
1994     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
1995     printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
1996     printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
1997     printf("kde_moduledir=\\"/tmp/dummy\\"\n");
1998     printf("kde_styledir=\\"/tmp/dummy\\"\n");
1999     printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
2000     printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
2001     printf("xdg_menudir=\\"/tmp/dummy\\"\n");
2002     printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
2003     printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
2004     return 0;
2005     }
2008  ac_save_CPPFLAGS=$CPPFLAGS
2009  CPPFLAGS="$all_includes $CPPFLAGS"
2010  if AC_TRY_EVAL(ac_compile); then
2011    AC_MSG_RESULT(yes)
2012  else
2013    AC_MSG_ERROR([your system is not able to compile a small KDE application!
2014 Check, if you installed the KDE header files correctly.
2015 For more details about this problem, look at the end of config.log.])
2016   fi
2017   CPPFLAGS=$ac_save_CPPFLAGS
2019   AC_LANG_RESTORE
2022 AC_DEFUN([KDE_CHECK_KDEQTADDON],
2024 AC_MSG_CHECKING(for kde-qt-addon)
2025 AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
2027  kde_ldflags_safe="$LDFLAGS"
2028  kde_libs_safe="$LIBS"
2029  kde_cxxflags_safe="$CXXFLAGS"
2031  LIBS="-lkde-qt-addon $LIBQT $LIBS"
2032  CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
2033  LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
2035  AC_TRY_LINK([
2036    #include <qdom.h>
2037  ],
2039    QDomDocument doc;
2040  ],
2041   kde_cv_have_kdeqtaddon=yes,
2042   kde_cv_have_kdeqtaddon=no
2045  LDFLAGS=$kde_ldflags_safe
2046  LIBS=$kde_libs_safe
2047  CXXFLAGS=$kde_cxxflags_safe
2050 AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
2052 if test "$kde_cv_have_kdeqtaddon" = "no"; then
2053   AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
2054 It is a separate package (and CVS module) named kde-qt-addon.])
2058 AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
2060    AC_REQUIRE([KDE_MISC_TESTS])
2061    AC_REQUIRE([KDE_CHECK_LIBDL])
2062    AC_REQUIRE([K_PATH_X])
2064 if test $build_arts = "yes"; then
2065    AC_SUBST(LIB_ARTSKDE, "-lartskde")
2068 if test $kde_qtver = 3; then
2069    AC_SUBST(LIB_KDECORE, "-lkdecore")
2070    AC_SUBST(LIB_KDEUI, "-lkdeui")
2071    AC_SUBST(LIB_KIO, "-lkio")
2072    AC_SUBST(LIB_KJS, "-lkjs")
2073    AC_SUBST(LIB_SMB, "-lsmb")
2074    AC_SUBST(LIB_KAB, "-lkab")
2075    AC_SUBST(LIB_KABC, "-lkabc")
2076    AC_SUBST(LIB_KHTML, "-lkhtml")
2077    AC_SUBST(LIB_KSPELL, "-lkspell")
2078    AC_SUBST(LIB_KPARTS, "-lkparts")
2079    AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
2080    AC_SUBST(LIB_KUTILS, "-lkutils")
2081    AC_SUBST(LIB_KDEPIM, "-lkdepim")
2082    AC_SUBST(LIB_KIMPROXY, "-lkimproxy")
2083    AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff")
2084    AC_SUBST(LIB_KDNSSD, "-lkdnssd")
2085    AC_SUBST(LIB_KUNITTEST, "-lkunittest")
2086 # these are for backward compatibility
2087    AC_SUBST(LIB_KSYCOCA, "-lkio")
2088    AC_SUBST(LIB_KFILE, "-lkio")
2089 elif test $kde_qtver = 2; then
2090    AC_SUBST(LIB_KDECORE, "-lkdecore")
2091    AC_SUBST(LIB_KDEUI, "-lkdeui")
2092    AC_SUBST(LIB_KIO, "-lkio")
2093    AC_SUBST(LIB_KSYCOCA, "-lksycoca")
2094    AC_SUBST(LIB_SMB, "-lsmb")
2095    AC_SUBST(LIB_KFILE, "-lkfile")
2096    AC_SUBST(LIB_KAB, "-lkab")
2097    AC_SUBST(LIB_KHTML, "-lkhtml")
2098    AC_SUBST(LIB_KSPELL, "-lkspell")
2099    AC_SUBST(LIB_KPARTS, "-lkparts")
2100    AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
2101 else
2102    AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)")
2103    AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)")
2104    AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)")
2105    AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)")
2106    AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")
2110 AC_DEFUN([AC_PATH_KDE],
2112   AC_BASE_PATH_KDE
2113   AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]),
2114   [
2115   if test "$enableval" = "no";
2116     then ac_use_path_checking="default"
2117     else ac_use_path_checking=""
2118   fi
2119   ],
2120   [
2121   if test "$kde_qtver" = 1;
2122     then ac_use_path_checking=""
2123     else ac_use_path_checking="default"
2124   fi
2125   ]
2126   )
2128   AC_CREATE_KFSSTND($ac_use_path_checking)
2130   AC_SUBST_KFSSTND
2131   KDE_CREATE_LIBS_ALIASES
2134 dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
2135 AC_DEFUN([KDE_CHECK_FUNC_EXT],
2137 AC_MSG_CHECKING(for $1)
2138 AC_CACHE_VAL(kde_cv_func_$1,
2140 AC_LANG_SAVE
2141 AC_LANG_CPLUSPLUS
2142 save_CXXFLAGS="$CXXFLAGS"
2143 kde_safe_LIBS="$LIBS"
2144 LIBS="$LIBS $X_EXTRA_LIBS"
2145 if test "$GXX" = "yes"; then
2146 CXXFLAGS="$CXXFLAGS -pedantic-errors"
2148 AC_TRY_COMPILE([
2154 kde_cv_func_$1=yes,
2155 kde_cv_func_$1=no)
2156 CXXFLAGS="$save_CXXFLAGS"
2157 LIBS="$kde_safe_LIBS"
2158 AC_LANG_RESTORE
2161 AC_MSG_RESULT($kde_cv_func_$1)
2163 AC_MSG_CHECKING([if $1 needs custom prototype])
2164 AC_CACHE_VAL(kde_cv_proto_$1,
2166 if test "x$kde_cv_func_$1" = xyes; then
2167   kde_cv_proto_$1=no
2168 else
2169   case "$1" in
2170         setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
2171                 kde_cv_proto_$1="yes - in libkdefakes"
2172                 ;;
2173         *)
2174                 kde_cv_proto_$1=unknown
2175                 ;;
2176   esac
2179 if test "x$kde_cv_proto_$1" = xunknown; then
2181 AC_LANG_SAVE
2182 AC_LANG_CPLUSPLUS
2183   kde_safe_libs=$LIBS
2184   LIBS="$LIBS $X_EXTRA_LIBS"
2185   AC_TRY_LINK([
2188 extern "C" $4;
2193 [ kde_cv_func_$1=yes
2194   kde_cv_proto_$1=yes ],
2195   [kde_cv_proto_$1="$1 unavailable"]
2197 LIBS=$kde_safe_libs
2198 AC_LANG_RESTORE
2201 AC_MSG_RESULT($kde_cv_proto_$1)
2203 if test "x$kde_cv_func_$1" = xyes; then
2204   AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
2205   $6
2207 if test "x$kde_cv_proto_$1" = xno; then
2208   AC_DEFINE(HAVE_$5_PROTO, 1,
2209   [Define if you have the $1 prototype])
2212 AH_VERBATIM([_HAVE_$5_PROTO],
2214 #if !defined(HAVE_$5_PROTO)
2215 #ifdef __cplusplus
2216 extern "C" {
2217 #endif
2219 #ifdef __cplusplus
2221 #endif
2222 #endif
2226 AC_DEFUN([AC_CHECK_SETENV],
2228         KDE_CHECK_FUNC_EXT(setenv, [
2229 #include <stdlib.h>
2231                 [setenv("VAR", "VALUE", 1);],
2232                 [int setenv (const char *, const char *, int)],
2233                 [SETENV])
2236 AC_DEFUN([AC_CHECK_UNSETENV],
2238         KDE_CHECK_FUNC_EXT(unsetenv, [
2239 #include <stdlib.h>
2241                 [unsetenv("VAR");],
2242                 [void unsetenv (const char *)],
2243                 [UNSETENV])
2246 AC_DEFUN([AC_CHECK_GETDOMAINNAME],
2248         KDE_CHECK_FUNC_EXT(getdomainname, [
2249 #include <stdlib.h>
2250 #include <unistd.h>
2251 #include <netdb.h>
2253                 [
2254 char buffer[200];
2255 getdomainname(buffer, 200);
2257                 [#include <sys/types.h>
2258                 int getdomainname (char *, size_t)],
2259                 [GETDOMAINNAME])
2262 AC_DEFUN([AC_CHECK_GETHOSTNAME],
2264         KDE_CHECK_FUNC_EXT(gethostname, [
2265 #include <stdlib.h>
2266 #include <unistd.h>
2268                 [
2269 char buffer[200];
2270 gethostname(buffer, 200);
2272                 [int gethostname (char *, unsigned int)],
2273                 [GETHOSTNAME])
2276 AC_DEFUN([AC_CHECK_USLEEP],
2278         KDE_CHECK_FUNC_EXT(usleep, [
2279 #include <unistd.h>
2281                 [
2282 usleep(200);
2284                 [int usleep (unsigned int)],
2285                 [USLEEP])
2289 AC_DEFUN([AC_CHECK_RANDOM],
2291         KDE_CHECK_FUNC_EXT(random, [
2292 #include <stdlib.h>
2294                 [
2295 random();
2297                 [long int random(void)],
2298                 [RANDOM])
2300         KDE_CHECK_FUNC_EXT(srandom, [
2301 #include <stdlib.h>
2303                 [
2304 srandom(27);
2306                 [void srandom(unsigned int)],
2307                 [SRANDOM])
2311 AC_DEFUN([AC_CHECK_INITGROUPS],
2313         KDE_CHECK_FUNC_EXT(initgroups, [
2314 #include <sys/types.h>
2315 #include <unistd.h>
2316 #include <grp.h>
2318         [
2319 char buffer[200];
2320 initgroups(buffer, 27);
2322         [int initgroups(const char *, gid_t)],
2323         [INITGROUPS])
2326 AC_DEFUN([AC_CHECK_MKSTEMPS],
2328         KDE_CHECK_FUNC_EXT(mkstemps, [
2329 #include <stdlib.h>
2330 #include <unistd.h>
2332         [
2333 mkstemps("/tmp/aaaXXXXXX", 6);
2335         [int mkstemps(char *, int)],
2336         [MKSTEMPS])
2339 AC_DEFUN([AC_CHECK_MKSTEMP],
2341         KDE_CHECK_FUNC_EXT(mkstemp, [
2342 #include <stdlib.h>
2343 #include <unistd.h>
2345         [
2346 mkstemp("/tmp/aaaXXXXXX");
2348         [int mkstemp(char *)],
2349         [MKSTEMP])
2352 AC_DEFUN([AC_CHECK_MKDTEMP],
2354         KDE_CHECK_FUNC_EXT(mkdtemp, [
2355 #include <stdlib.h>
2356 #include <unistd.h>
2358         [
2359 mkdtemp("/tmp/aaaXXXXXX");
2361         [char *mkdtemp(char *)],
2362         [MKDTEMP])
2366 AC_DEFUN([AC_CHECK_RES_INIT],
2368   AC_MSG_CHECKING([if res_init needs -lresolv])
2369   kde_libs_safe="$LIBS"
2370   LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
2371   AC_TRY_LINK(
2372     [
2373 #include <sys/types.h>
2374 #include <netinet/in.h>
2375 #include <arpa/nameser.h>
2376 #include <resolv.h>
2377     ],
2378     [
2379       res_init();
2380     ],
2381     [
2382       LIBRESOLV="-lresolv"
2383       AC_MSG_RESULT(yes)
2384       AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
2385     ],
2386     [ AC_MSG_RESULT(no) ]
2387   )
2388   LIBS=$kde_libs_safe
2389   AC_SUBST(LIBRESOLV)
2391   KDE_CHECK_FUNC_EXT(res_init,
2392     [
2393 #include <sys/types.h>
2394 #include <netinet/in.h>
2395 #include <arpa/nameser.h>
2396 #include <resolv.h>
2397     ],
2398     [res_init()],
2399     [int res_init(void)],
2400     [RES_INIT])
2403 AC_DEFUN([AC_CHECK_STRLCPY],
2405         KDE_CHECK_FUNC_EXT(strlcpy, [
2406 #include <string.h>
2408 [ char buf[20];
2409   strlcpy(buf, "KDE function test", sizeof(buf));
2411         [unsigned long strlcpy(char*, const char*, unsigned long)],
2412         [STRLCPY])
2415 AC_DEFUN([AC_CHECK_STRLCAT],
2417         KDE_CHECK_FUNC_EXT(strlcat, [
2418 #include <string.h>
2420 [ char buf[20];
2421   buf[0]='\0';
2422   strlcat(buf, "KDE function test", sizeof(buf));
2424         [unsigned long strlcat(char*, const char*, unsigned long)],
2425         [STRLCAT])
2428 AC_DEFUN([AC_CHECK_RES_QUERY],
2430         KDE_CHECK_FUNC_EXT(res_query, [
2431 #include <sys/types.h>
2432 #include <netinet/in.h>
2433 #include <arpa/nameser.h>
2434 #include <resolv.h>
2435 #include <netdb.h>
2438 res_query(NULL, 0, 0, NULL, 0);
2440         [int res_query(const char *, int, int, unsigned char *, int)],
2441         [RES_QUERY])
2444 AC_DEFUN([AC_CHECK_DN_SKIPNAME],
2446         KDE_CHECK_FUNC_EXT(dn_skipname, [
2447 #include <sys/types.h>
2448 #include <netinet/in.h>
2449 #include <arpa/nameser.h>
2450 #include <resolv.h>
2453 dn_skipname (NULL, NULL);
2455         [int dn_skipname (unsigned char *, unsigned char *)],
2456         [DN_SKIPNAME])
2460 AC_DEFUN([AC_FIND_GIF],
2461    [AC_MSG_CHECKING([for giflib])
2462 AC_CACHE_VAL(ac_cv_lib_gif,
2463 [ac_save_LIBS="$LIBS"
2464 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2465 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
2466 else
2467 LIBS="$all_libraries -lgif"
2469 AC_TRY_LINK(dnl
2471 #ifdef __cplusplus
2472 extern "C" {
2473 #endif
2474 int GifLastError(void);
2475 #ifdef __cplusplus
2477 #endif
2478 /* We use char because int might match the return type of a gcc2
2479     builtin and then its argument prototype would still apply.  */
2481             [return GifLastError();],
2482             eval "ac_cv_lib_gif=yes",
2483             eval "ac_cv_lib_gif=no")
2484 LIBS="$ac_save_LIBS"
2485 ])dnl
2486 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
2487   AC_MSG_RESULT(yes)
2488   AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
2489 else
2490   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
2494 AC_DEFUN([KDE_FIND_JPEG_HELPER],
2496 AC_MSG_CHECKING([for libjpeg$2])
2497 AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
2499 ac_save_LIBS="$LIBS"
2500 LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
2501 ac_save_CFLAGS="$CFLAGS"
2502 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2503 AC_TRY_LINK(
2504 [/* Override any gcc2 internal prototype to avoid an error.  */
2505 struct jpeg_decompress_struct;
2506 typedef struct jpeg_decompress_struct * j_decompress_ptr;
2507 typedef int size_t;
2508 #ifdef __cplusplus
2509 extern "C" {
2510 #endif
2511     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
2512                                     int version, size_t structsize);
2513 #ifdef __cplusplus
2515 #endif
2516 /* We use char because int might match the return type of a gcc2
2517     builtin and then its argument prototype would still apply.  */
2519             [jpeg_CreateDecompress(0L, 0, 0);],
2520             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
2521             eval "ac_cv_lib_jpeg_$1=no")
2522 LIBS="$ac_save_LIBS"
2523 CFLAGS="$ac_save_CFLAGS"
2526 if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
2527   LIBJPEG="$ac_cv_lib_jpeg_$1"
2528   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
2529 else
2530   AC_MSG_RESULT(no)
2531   $3
2536 AC_DEFUN([AC_FIND_JPEG],
2538 dnl first look for libraries
2539 KDE_FIND_JPEG_HELPER(6b, 6b,
2540    KDE_FIND_JPEG_HELPER(normal, [],
2541     [
2542        LIBJPEG=
2543     ]
2544    )
2547 dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
2548 dnl requires system dependent includes loaded before it)
2549 jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
2550 AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
2551 test "x$jpeg_incdir" = xNO && jpeg_incdir=
2553 dnl if headers _and_ libraries are missing, this is no error, and we
2554 dnl continue with a warning (the user will get no jpeg support in khtml)
2555 dnl if only one is missing, it means a configuration error, but we still
2556 dnl only warn
2557 if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
2558   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
2559 else
2560   if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
2561     AC_MSG_WARN([
2562 There is an installation error in jpeg support. You seem to have only one
2563 of either the headers _or_ the libraries installed. You may need to either
2564 provide correct --with-extra-... options, or the development package of
2565 libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
2566 Disabling JPEG support.
2568   else
2569     AC_MSG_WARN([libjpeg not found. disable JPEG support.])
2570   fi
2571   jpeg_incdir=
2572   LIBJPEG=
2575 AC_SUBST(LIBJPEG)
2576 AH_VERBATIM(_AC_CHECK_JPEG,
2578  * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
2579  * headers and I'm too lazy to write a configure test as long as only
2580  * unixware is related
2581  */
2582 #ifdef _UNIXWARE
2583 #define HAVE_BOOLEAN
2584 #endif
2588 AC_DEFUN([KDE_CHECK_QT_JPEG],
2590 if test -n "$LIBJPEG"; then
2591 AC_MSG_CHECKING([if Qt needs $LIBJPEG])
2592 AC_CACHE_VAL(kde_cv_qt_jpeg,
2594 AC_LANG_SAVE
2595 AC_LANG_CPLUSPLUS
2596 ac_save_LIBS="$LIBS"
2597 LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
2598 LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
2599 ac_save_CXXFLAGS="$CXXFLAGS"
2600 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2601 AC_TRY_LINK(
2602 [#include <qapplication.h>],
2603             [
2604             int argc;
2605             char** argv;
2606             QApplication app(argc, argv);],
2607             eval "kde_cv_qt_jpeg=no",
2608             eval "kde_cv_qt_jpeg=yes")
2609 LIBS="$ac_save_LIBS"
2610 CXXFLAGS="$ac_save_CXXFLAGS"
2611 AC_LANG_RESTORE
2615 if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
2616   AC_MSG_RESULT(yes)
2617   LIBJPEG_QT='$(LIBJPEG)'
2618 else
2619   AC_MSG_RESULT(no)
2620   LIBJPEG_QT=
2625 AC_DEFUN([AC_FIND_ZLIB],
2627 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2628 AC_MSG_CHECKING([for libz])
2629 AC_CACHE_VAL(ac_cv_lib_z,
2631 kde_save_LIBS="$LIBS"
2632 LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
2633 kde_save_CFLAGS="$CFLAGS"
2634 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2635 AC_TRY_LINK(dnl
2637 #include<zlib.h>
2640   char buf[42];
2641   gzFile f = (gzFile) 0;
2642   /* this would segfault.. but we only link, don't run */
2643   (void) gzgets(f, buf, sizeof(buf));
2645   return (zlibVersion() == ZLIB_VERSION);
2647             eval "ac_cv_lib_z='-lz'",
2648             eval "ac_cv_lib_z=no")
2649 LIBS="$kde_save_LIBS"
2650 CFLAGS="$kde_save_CFLAGS"
2651 ])dnl
2652 if test ! "$ac_cv_lib_z" = no; then
2653   AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
2654   LIBZ="$ac_cv_lib_z"
2655   AC_MSG_RESULT($ac_cv_lib_z)
2656 else
2657   AC_MSG_ERROR(not found.
2658           Possibly configure picks up an outdated version
2659           installed by XFree86. Remove it from your system.
2661           Check your installation and look into config.log)
2662   LIBZ=""
2664 AC_SUBST(LIBZ)
2667 AC_DEFUN([KDE_TRY_TIFFLIB],
2669 AC_MSG_CHECKING([for libtiff $1])
2671 AC_CACHE_VAL(kde_cv_libtiff_$1,
2673 AC_LANG_SAVE
2674 AC_LANG_CPLUSPLUS
2675 kde_save_LIBS="$LIBS"
2676 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2677 LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
2678 else
2679 LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
2681 kde_save_CXXFLAGS="$CXXFLAGS"
2682 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2684 AC_TRY_LINK(dnl
2686 #include<tiffio.h>
2688     [return (TIFFOpen( "", "r") == 0); ],
2690     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
2691 ], [
2692     kde_cv_libtiff_$1=no
2695 LIBS="$kde_save_LIBS"
2696 CXXFLAGS="$kde_save_CXXFLAGS"
2697 AC_LANG_RESTORE
2700 if test "$kde_cv_libtiff_$1" = "no"; then
2701     AC_MSG_RESULT(no)
2702     LIBTIFF=""
2703     $3
2704 else
2705     LIBTIFF="$kde_cv_libtiff_$1"
2706     AC_MSG_RESULT(yes)
2707     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
2708     $2
2713 AC_DEFUN([AC_FIND_TIFF],
2715 AC_REQUIRE([K_PATH_X])
2716 AC_REQUIRE([AC_FIND_ZLIB])
2717 AC_REQUIRE([AC_FIND_JPEG])
2718 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2720 KDE_TRY_TIFFLIB(tiff, [],
2721    KDE_TRY_TIFFLIB(tiff34))
2723 AC_SUBST(LIBTIFF)
2727 AC_DEFUN([AC_FIND_PNG],
2729 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2730 AC_REQUIRE([AC_FIND_ZLIB])
2731 AC_MSG_CHECKING([for libpng])
2732 AC_CACHE_VAL(ac_cv_lib_png,
2734 kde_save_LIBS="$LIBS"
2735 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2736 LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
2737 else
2738 LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
2740 kde_save_CFLAGS="$CFLAGS"
2741 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2743 AC_TRY_LINK(dnl
2744     [
2745     #include<png.h>
2746     ],
2747     [
2748     png_structp png_ptr = png_create_read_struct(  /* image ptr */
2749                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
2750     return( png_ptr != 0 );
2751     ],
2752     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
2753     eval "ac_cv_lib_png=no"
2755 LIBS="$kde_save_LIBS"
2756 CFLAGS="$kde_save_CFLAGS"
2757 ])dnl
2758 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
2759   AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
2760   LIBPNG="$ac_cv_lib_png"
2761   AC_SUBST(LIBPNG)
2762   AC_MSG_RESULT($ac_cv_lib_png)
2763 else
2764   AC_MSG_RESULT(no)
2765   LIBPNG=""
2766   AC_SUBST(LIBPNG)
2771 AC_DEFUN([AC_FIND_JASPER],
2773 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2774 AC_REQUIRE([AC_FIND_JPEG])
2775 AC_MSG_CHECKING([for jasper])
2776 AC_CACHE_VAL(ac_cv_jasper,
2778 kde_save_LIBS="$LIBS"
2779 LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
2780 kde_save_CFLAGS="$CFLAGS"
2781 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2783 AC_TRY_LINK(dnl
2784     [
2785     #include<jasper/jasper.h>
2786     ],
2787     [
2788     return( jas_init() );
2789     ],
2790     eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
2791     eval "ac_cv_jasper=no"
2793 LIBS="$kde_save_LIBS"
2794 CFLAGS="$kde_save_CFLAGS"
2795 ])dnl
2796 if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
2797   AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
2798   LIB_JASPER="$ac_cv_jasper"
2799   AC_MSG_RESULT($ac_cv_jasper)
2800 else
2801   AC_MSG_RESULT(no)
2802   LIB_JASPER=""
2804 AC_SUBST(LIB_JASPER)
2807 AC_DEFUN([AC_CHECK_BOOL],
2809   AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
2812 AC_DEFUN([AC_CHECK_GNU_EXTENSIONS],
2814 AC_MSG_CHECKING(if you need GNU extensions)
2815 AC_CACHE_VAL(ac_cv_gnu_extensions,
2817 cat > conftest.c << EOF
2818 #include <features.h>
2820 #ifdef __GNU_LIBRARY__
2822 #endif
2825 if (eval "$ac_cpp conftest.c") 2>&5 |
2826   egrep "yes" >/dev/null 2>&1; then
2827   rm -rf conftest*
2828   ac_cv_gnu_extensions=yes
2829 else
2830   ac_cv_gnu_extensions=no
2834 AC_MSG_RESULT($ac_cv_gnu_extensions)
2835 if test "$ac_cv_gnu_extensions" = "yes"; then
2836   AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
2840 AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
2842 AC_MSG_CHECKING([whether $CXX supports -$1])
2843 kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
2844 AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
2846   AC_LANG_SAVE
2847   AC_LANG_CPLUSPLUS
2848   save_CXXFLAGS="$CXXFLAGS"
2849   CXXFLAGS="$CXXFLAGS -$1"
2850   AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
2851   CXXFLAGS="$save_CXXFLAGS"
2852   AC_LANG_RESTORE
2854 if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
2855  AC_MSG_RESULT(yes)
2857  $2
2858 else
2859  AC_MSG_RESULT(no)
2861  $3
2865 AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG],
2867 AC_MSG_CHECKING([whether $CC supports -$1])
2868 kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
2869 AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache,
2871   AC_LANG_SAVE
2872   AC_LANG_C
2873   save_CFLAGS="$CFLAGS"
2874   CFLAGS="$CFLAGS -$1"
2875   AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], [])
2876   CFLAGS="$save_CFLAGS"
2877   AC_LANG_RESTORE
2879 if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then
2880  AC_MSG_RESULT(yes)
2882  $2
2883 else
2884  AC_MSG_RESULT(no)
2886  $3
2891 dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
2892 dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
2893 dnl it's all white-space separated
2894 AC_DEFUN([AC_REMOVE_FORBIDDEN],
2895 [ __val=$$1
2896   __forbid=" $2 "
2897   if test -n "$__val"; then
2898     __new=""
2899     ac_save_IFS=$IFS
2900     IFS="       "
2901     for i in $__val; do
2902       case "$__forbid" in
2903         *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
2904         *) # Careful to not add spaces, where there were none, because otherwise
2905            # libtool gets confused, if we change e.g. CXX
2906            if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
2907       esac
2908     done
2909     IFS=$ac_save_IFS
2910     $1=$__new
2911   fi
2915 AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER],
2917   AC_MSG_CHECKING([whether $CC is blacklisted])
2919   dnl In theory we have tu run this test against $CC and $CXX
2920   dnl in C and in C++ mode, because its perfectly legal for
2921   dnl the user to mix compiler versions, since C has a defined
2922   dnl ABI.
2923   dnl
2924   dnl For now, we assume the user is not on crack.
2926   AC_TRY_COMPILE([
2927 #ifdef __GNUC__
2928 #if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0
2929 choke me
2930 #endif
2931 #endif
2932 ], ,
2933   kde_bad_compiler=no,
2934   kde_bad_compiler=yes
2937   AC_MSG_RESULT($kde_bad_compiler)
2939 if test "$kde_bad_compiler" = "yes"; then
2940   AC_MSG_ERROR([
2942 This particular compiler version is blacklisted because it
2943 is known to miscompile KDE. Please use a newer version, or
2944 if that is not yet available, choose an older version.
2946 Please do not report a bug or bother us reporting this
2947 configure error. We know about it, and we introduced
2948 it by intention to avoid untraceable bugs or crashes in KDE.
2955 dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
2956 AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
2957 [dnl
2958 if test "x$kde_use_qt_emb" != "xyes"; then
2959  AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
2960  AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
2961 else
2962  AC_REMOVE_FORBIDDEN(CXX, [-rpath])
2963  AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
2967 AC_DEFUN([AC_CHECK_COMPILERS],
2969   AC_ARG_ENABLE(debug,
2970                 AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]),
2971   [
2972     case $enableval in
2973       yes)
2974         kde_use_debug_code="yes"
2975         kde_use_debug_define=no
2976         ;;
2977       full)
2978         kde_use_debug_code="full"
2979         kde_use_debug_define=no
2980         ;;
2981       *)
2982         kde_use_debug_code="no"
2983         kde_use_debug_define=yes
2984         ;;
2985     esac
2986   ],
2987     [kde_use_debug_code="no"
2988       kde_use_debug_define=no
2989   ])
2991   dnl Just for configure --help
2992   AC_ARG_ENABLE(dummyoption,
2993                 AC_HELP_STRING([--disable-debug],
2994                                [disables debug output and debug symbols [default=no]]),
2995                 [],[])
2997   AC_ARG_ENABLE(strict,
2998                 AC_HELP_STRING([--enable-strict],
2999                               [compiles with strict compiler options (may not work!)]),
3000    [
3001     if test $enableval = "no"; then
3002          kde_use_strict_options="no"
3003        else
3004          kde_use_strict_options="yes"
3005     fi
3006    ], [kde_use_strict_options="no"])
3008   AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]),
3009    [
3010     if test $enableval = "no"; then
3011          kde_use_warnings="no"
3012        else
3013          kde_use_warnings="yes"
3014     fi
3015    ], [kde_use_warnings="yes"])
3017   dnl enable warnings for debug build
3018   if test "$kde_use_debug_code" != "no"; then
3019     kde_use_warnings=yes
3020   fi
3022   AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]),
3023     [kde_use_profiling=$enableval],
3024     [kde_use_profiling="no"]
3025   )
3027   dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
3028   CFLAGS=" $CFLAGS"
3030   AC_PROG_CC
3032   AC_PROG_CPP
3034   if test "$GCC" = "yes"; then
3035     if test "$kde_use_debug_code" != "no"; then
3036       if test $kde_use_debug_code = "full"; then
3037         CFLAGS="-g3 -fno-inline $CFLAGS"
3038       else
3039         CFLAGS="-g -O2 $CFLAGS"
3040       fi
3041     else
3042       CFLAGS="-O2 $CFLAGS"
3043     fi
3044   fi
3046   if test "$kde_use_debug_define" = "yes"; then
3047     CFLAGS="-DNDEBUG $CFLAGS"
3048   fi
3051   case "$host" in
3052   *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
3053   *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
3054   esac
3056   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
3057      LDFLAGS=""
3058   fi
3060   CXXFLAGS=" $CXXFLAGS"
3062   AC_PROG_CXX
3064   KDE_CHECK_FOR_BAD_COMPILER
3066   if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
3067     if test "$kde_use_debug_code" != "no"; then
3068       if test "$CXX" = "KCC"; then
3069         CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
3070       else
3071         if test "$kde_use_debug_code" = "full"; then
3072           CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
3073         else
3074           CXXFLAGS="-g -O2 $CXXFLAGS"
3075         fi
3076       fi
3077       KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
3079       dnl convenience compiler flags
3080       KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
3081       AC_SUBST(WOVERLOADED_VIRTUAL)
3082     else
3083       if test "$CXX" = "KCC"; then
3084         CXXFLAGS="+K3 $CXXFLAGS"
3085       else
3086         CXXFLAGS="-O2 $CXXFLAGS"
3087       fi
3088     fi
3089   fi
3091   if test "$kde_use_debug_define" = "yes"; then
3092     CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
3093   fi
3095   if test "$kde_use_profiling" = "yes"; then
3096     KDE_CHECK_COMPILER_FLAG(pg,
3097     [
3098       CFLAGS="-pg $CFLAGS"
3099       CXXFLAGS="-pg $CXXFLAGS"
3100     ])
3101   fi
3103   if test "$kde_use_warnings" = "yes"; then
3104       if test "$GCC" = "yes"; then
3105         CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS"
3106         case $host in
3107           *-*-linux-gnu)
3108             CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
3109             CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS"
3110             KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
3111             KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
3112           ;;
3113         esac
3114         KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
3115         KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
3116         dnl ### FIXME: revert for KDE 4
3117         KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"])
3118      fi
3119   fi
3121   if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
3122     CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
3123   fi
3125   AC_ARG_ENABLE(pch,
3126      AC_HELP_STRING([--enable-pch],
3127                     [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]),
3128     [ kde_use_pch=$enableval ],[ kde_use_pch=no ])
3130   HAVE_GCC_VISIBILITY=0
3131   AC_SUBST([HAVE_GCC_VISIBILITY])
3133   if test "$GXX" = "yes"; then
3134     KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
3135     KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
3136     KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
3137     KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS=       )
3138     ENABLE_PERMISSIVE_FLAG="-fpermissive"
3140     if test "$kde_use_pch" = "yes"; then
3141         AC_MSG_CHECKING(whether gcc supports precompiling c header files)
3142         echo >conftest.h
3143         if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then
3144             kde_gcc_supports_pch=yes
3145             AC_MSG_RESULT(yes)
3146         else
3147             kde_gcc_supports_pch=no
3148             AC_MSG_RESULT(no)
3149         fi
3150         if test "$kde_gcc_supports_pch" = "yes"; then
3151             AC_MSG_CHECKING(whether gcc supports precompiling c++ header files)
3152             if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then
3153                 kde_gcc_supports_pch=yes
3154                 AC_MSG_RESULT(yes)
3155             else
3156                 kde_gcc_supports_pch=no
3157                 AC_MSG_RESULT(no)
3158             fi
3159         fi
3160         rm -f conftest.h conftest.h.gch
3161     fi
3162   fi
3163   AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes")
3164   if test "$CXX" = "KCC"; then
3165     dnl unfortunately we currently cannot disable exception support in KCC
3166     dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
3167     dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
3168     dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS=   )
3170     if test "$kde_use_pch" = "yes"; then
3171       dnl TODO: support --pch-dir!
3172       KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
3173       dnl the below works (but the dir must exist), but it's
3174       dnl useless for a whole package.
3175       dnl The are precompiled headers for each source file, so when compiling
3176       dnl from scratch, it doesn't make a difference, and they take up
3177       dnl around ~5Mb _per_ sourcefile.
3178       dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
3179       dnl   [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
3180     fi
3181     dnl this flag controls inlining. by default KCC inlines in optimisation mode
3182     dnl all implementations that are defined inside the class {} declaration.
3183     dnl because of templates-compatibility with broken gcc compilers, this
3184     dnl can cause excessive inlining. This flag limits it to a sane level
3185     KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
3186     KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
3187     KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
3188     KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
3189     dnl Some source files are shared between multiple executables
3190     dnl (or libraries) and some of those need template instantiations.
3191     dnl In that case KCC needs to compile those sources with
3192     dnl --one_instantiation_per_object.  To make it easy for us we compile
3193     dnl _all_ objects with that flag (--one_per is a shorthand).
3194     KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
3195   fi
3196   AC_SUBST(USE_EXCEPTIONS)
3197   dnl obsolete macro - provided to keep things going
3198   USE_RTTI=
3199   AC_SUBST(USE_RTTI)
3201   case "$host" in
3202       *-*-irix*)  test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
3203       *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
3204       *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
3205       *-*-solaris*)
3206         if test "$GXX" = yes; then
3207           libstdcpp=`$CXX -print-file-name=libstdc++.so`
3208           if test ! -f $libstdcpp; then
3209              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])
3210           fi
3211         fi
3212         ;;
3213   esac
3215   AC_VALIDIFY_CXXFLAGS
3217   AC_PROG_CXXCPP
3219   if test "$GCC" = yes; then
3220      NOOPT_CFLAGS=-O0
3221   fi
3222   KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
3224   AC_ARG_ENABLE(coverage,
3225     AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [
3226       if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then
3227         ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
3228         ac_coverage_linker="-lgcc"
3229       elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then
3230         ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
3231         ac_coverage_linker=""
3232       else
3233         AC_MSG_ERROR([coverage with your compiler is not supported])
3234       fi
3235       CFLAGS="$CFLAGS $ac_coverage_compiler"
3236       CXXFLAGS="$CXXFLAGS $ac_coverage_compiler"
3237       LDFLAGS="$LDFLAGS $ac_coverage_linker"
3238     ])
3240   AC_SUBST(NOOPT_CXXFLAGS)
3241   AC_SUBST(NOOPT_CFLAGS)
3242   AC_SUBST(ENABLE_PERMISSIVE_FLAG)
3244   KDE_CHECK_NEW_LDFLAGS
3245   KDE_CHECK_FINAL
3246   KDE_CHECK_CLOSURE
3247   KDE_CHECK_NMCHECK
3249   ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
3252 AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG],
3253   [
3254     AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug,
3255       [
3256         AC_LANG_SAVE
3257         AC_LANG_CPLUSPLUS
3259         safe_CXXFLAGS=$CXXFLAGS
3260         safe_LDFLAGS=$LDFLAGS
3261         CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0"
3262         LDFLAGS="$LDFLAGS -shared -fPIC"
3264         AC_TRY_LINK(
3265         [
3266           /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */
3267           #include <string>
3268           int some_function( void ) __attribute__ ((visibility("default")));
3269           int some_function( void )
3270           {
3271             std::string s("blafasel");
3272             return 0;
3273           }
3274         ], [/* elvis is alive */],
3275         kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes)
3277         CXXFLAGS=$safe_CXXFLAGS
3278         LDFLAGS=$safe_LDFLAGS
3279         AC_LANG_RESTORE
3280       ]
3281     )
3283     if test x$kde_cv_val_gcc_visibility_bug = xno; then
3284       CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
3285     fi
3286   ]
3289 AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY],
3291   AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
3293   if test "x$GXX" = "xyes"; then
3294     kde_have_gcc_visibility=no
3295     KDE_CHECK_COMPILER_FLAG(fvisibility=hidden,
3296     [
3297       kde_have_gcc_visibility=yes
3298       AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched,
3299         [
3300           AC_LANG_SAVE
3301           AC_LANG_CPLUSPLUS
3303           safe_CXXFLAGS=$CXXFLAGS
3304           CXXFLAGS="$CXXFLAGS $all_includes"
3306           AC_TRY_COMPILE(
3307           [
3308 #include <qglobal.h>
3309 #if Q_EXPORT - 0 != 0
3310 /* if this compiles, then Q_EXPORT is undefined */
3311 /* if Q_EXPORT is nonempty, this will break compilation */
3312 #endif
3313           ], [/* elvis is alive */],
3314           kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes)
3316           CXXFLAGS=$safe_CXXFLAGS
3317           AC_LANG_RESTORE
3318         ]
3319       )
3321       if test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
3322         CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
3323         KDE_CHECK_VISIBILITY_GCC_BUG
3324         HAVE_GCC_VISIBILITY=1
3325         AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
3326       fi
3327     ])
3328   fi
3331 AC_DEFUN([KDE_ADD_DEPENDENCIES],
3333    [A]M_DEPENDENCIES(CC)
3334    [A]M_DEPENDENCIES(CXX)
3337 dnl just a wrapper to clean up configure.in
3338 AC_DEFUN([KDE_PROG_LIBTOOL],
3340 AC_REQUIRE([AC_CHECK_COMPILERS])
3341 AC_REQUIRE([AC_ENABLE_SHARED])
3342 AC_REQUIRE([AC_ENABLE_STATIC])
3344 AC_REQUIRE([AC_LIBTOOL_DLOPEN])
3345 AC_REQUIRE([KDE_CHECK_LIB64])
3347 AC_OBJEXT
3348 AC_EXEEXT
3350 AM_PROG_LIBTOOL
3351 AC_LIBTOOL_CXX
3353 LIBTOOL_SHELL="/bin/sh ./libtool"
3354 #  LIBTOOL="$LIBTOOL --silent"
3355 KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
3356 AC_SUBST(KDE_PLUGIN)
3358 # we patch configure quite some so we better keep that consistent for incremental runs
3359 AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
3362 AC_DEFUN([KDE_CHECK_LIB64],
3364     kdelibsuff="$kde_libs_suffix"
3365     if test -z "$kdelibsuff"; then
3366        kdelibsuff=no
3367     fi
3368     AC_ARG_ENABLE(libsuffix,
3369         AC_HELP_STRING([--enable-libsuffix],
3370             [/lib directory suffix (64,32,none[=default])]),
3371             kdelibsuff=$enableval)
3372     # TODO: add an auto case that compiles a little C app to check
3373     # where the glibc is
3374     if test "$kdelibsuff" = "no"; then
3375        kdelibsuff=
3376     fi
3377     if test -z "$kdelibsuff"; then
3378         AC_MSG_RESULT([not using lib directory suffix])
3379         AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
3380     else
3381         if test "$libdir" = '${exec_prefix}/lib'; then
3382             libdir="$libdir${kdelibsuff}"
3383             AC_SUBST([libdir], ["$libdir"])  dnl ugly hack for lib64 platforms
3384         fi
3385         AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories)
3386         AC_MSG_RESULT([using lib directory suffix $kdelibsuff])
3387     fi
3390 AC_DEFUN([KDE_CHECK_TYPES],
3391 [  AC_CHECK_SIZEOF(int, 4)dnl
3392    AC_CHECK_SIZEOF(short)dnl
3393   AC_CHECK_SIZEOF(long, 4)dnl
3394   AC_CHECK_SIZEOF(char *, 4)dnl
3395 ])dnl
3397 dnl Not used - kept for compat only?
3398 AC_DEFUN([KDE_DO_IT_ALL],
3400 AC_CANONICAL_SYSTEM
3401 AC_ARG_PROGRAM
3402 AM_INIT_AUTOMAKE($1, $2)
3403 AM_DISABLE_LIBRARIES
3404 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
3405 AC_CHECK_COMPILERS
3406 KDE_PROG_LIBTOOL
3407 AM_KDE_WITH_NLS
3408 AC_PATH_KDE
3411 AC_DEFUN([AC_CHECK_RPATH],
3413 AC_MSG_CHECKING(for rpath)
3414 AC_ARG_ENABLE(rpath,
3415       AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]),
3416       USE_RPATH=$enableval, USE_RPATH=yes)
3418 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
3420   KDE_RPATH="-R \$(libdir)"
3422   if test "$kde_libraries" != "$libdir"; then
3423       KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)"
3424   fi
3426   if test -n "$qt_libraries"; then
3427     KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
3428   fi
3429   dnl $x_libraries is set to /usr/lib in case
3430   if test -n "$X_LDFLAGS"; then
3431     X_RPATH="-R \$(x_libraries)"
3432     KDE_RPATH="$KDE_RPATH $X_RPATH"
3433   fi
3434   if test -n "$KDE_EXTRA_RPATH"; then
3435     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
3436   fi
3438 AC_SUBST(KDE_EXTRA_RPATH)
3439 AC_SUBST(KDE_RPATH)
3440 AC_SUBST(X_RPATH)
3441 AC_MSG_RESULT($USE_RPATH)
3444 dnl Check for the type of the third argument of getsockname
3445 AC_DEFUN([AC_CHECK_SOCKLEN_T],
3447    AC_MSG_CHECKING(for socklen_t)
3448    AC_CACHE_VAL(kde_cv_socklen_t,
3449    [
3450       AC_LANG_PUSH(C++)
3451       kde_cv_socklen_t=no
3452       AC_TRY_COMPILE([
3453          #include <sys/types.h>
3454          #include <sys/socket.h>
3455       ],
3456       [
3457          socklen_t len;
3458          getpeername(0,0,&len);
3459       ],
3460       [
3461          kde_cv_socklen_t=yes
3462          kde_cv_socklen_t_equiv=socklen_t
3463       ])
3464       AC_LANG_POP(C++)
3465    ])
3466    AC_MSG_RESULT($kde_cv_socklen_t)
3467    if test $kde_cv_socklen_t = no; then
3468       AC_MSG_CHECKING([for socklen_t equivalent for socket functions])
3469       AC_CACHE_VAL(kde_cv_socklen_t_equiv,
3470       [
3471          kde_cv_socklen_t_equiv=int
3472          AC_LANG_PUSH(C++)
3473          for t in int size_t unsigned long "unsigned long"; do
3474             AC_TRY_COMPILE([
3475                #include <sys/types.h>
3476                #include <sys/socket.h>
3477             ],
3478             [
3479                $t len;
3480                getpeername(0,0,&len);
3481             ],
3482             [
3483                kde_cv_socklen_t_equiv="$t"
3484                break
3485             ])
3486          done
3487          AC_LANG_POP(C++)
3488       ])
3489       AC_MSG_RESULT($kde_cv_socklen_t_equiv)
3490    fi
3491    AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv,
3492                      [type to use in place of socklen_t if not defined])
3493    AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv,
3494                      [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)])
3497 dnl This is a merge of some macros out of the gettext aclocal.m4
3498 dnl since we don't need anything, I took the things we need
3499 dnl the copyright for them is:
3500 dnl >
3501 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3502 dnl This Makefile.in is free software; the Free Software Foundation
3503 dnl gives unlimited permission to copy and/or distribute it,
3504 dnl with or without modifications, as long as this notice is preserved.
3506 dnl This program is distributed in the hope that it will be useful,
3507 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
3508 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
3509 dnl PARTICULAR PURPOSE.
3510 dnl >
3511 dnl for this file it is relicensed under LGPL
3513 AC_DEFUN([AM_KDE_WITH_NLS],
3514   [
3515     dnl If we use NLS figure out what method
3517     AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
3518         [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
3519     AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3521      if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
3522         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
3523         GMSGFMT=":"
3524       fi
3525       MSGFMT=$GMSGFMT
3526       AC_SUBST(GMSGFMT)
3527       AC_SUBST(MSGFMT)
3529       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
3530         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
3532       dnl Test whether we really found GNU xgettext.
3533       if test "$XGETTEXT" != ":"; then
3534         dnl If it is no GNU xgettext we define it as : so that the
3535         dnl Makefiles still can work.
3536         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
3537           : ;
3538         else
3539           AC_MSG_RESULT(
3540             [found xgettext programs is not GNU xgettext; ignore it])
3541           XGETTEXT=":"
3542         fi
3543       fi
3544      AC_SUBST(XGETTEXT)
3546   ])
3548 # Search path for a program which passes the given test.
3549 # Ulrich Drepper <drepper@cygnus.com>, 1996.
3551 # serial 1
3552 # Stephan Kulow: I appended a _KDE against name conflicts
3554 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
3555 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3556 AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
3557 [# Extract the first word of "$2", so it can be a program name with args.
3558 set dummy $2; ac_word=[$]2
3559 AC_MSG_CHECKING([for $ac_word])
3560 AC_CACHE_VAL(ac_cv_path_$1,
3561 [case "[$]$1" in
3562   /*)
3563   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3564   ;;
3565   *)
3566   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
3567   for ac_dir in ifelse([$5], , $PATH, [$5]); do
3568     test -z "$ac_dir" && ac_dir=.
3569     if test -f $ac_dir/$ac_word; then
3570       if [$3]; then
3571         ac_cv_path_$1="$ac_dir/$ac_word"
3572         break
3573       fi
3574     fi
3575   done
3576   IFS="$ac_save_ifs"
3577 dnl If no 4th arg is given, leave the cache variable unset,
3578 dnl so AC_PATH_PROGS will keep looking.
3579 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3580 ])dnl
3581   ;;
3582 esac])dnl
3583 $1="$ac_cv_path_$1"
3584 if test -n "[$]$1"; then
3585   AC_MSG_RESULT([$]$1)
3586 else
3587   AC_MSG_RESULT(no)
3589 AC_SUBST($1)dnl
3593 # Check whether LC_MESSAGES is available in <locale.h>.
3594 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3596 # serial 1
3598 AC_DEFUN([AM_LC_MESSAGES],
3599   [if test $ac_cv_header_locale_h = yes; then
3600     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
3601       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
3602        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
3603     if test $am_cv_val_LC_MESSAGES = yes; then
3604       AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
3605     fi
3606   fi])
3608 dnl From Jim Meyering.
3609 dnl FIXME: migrate into libit.
3611 AC_DEFUN([AM_FUNC_OBSTACK],
3612 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
3613  [AC_TRY_LINK([#include "obstack.h"],
3614               [struct obstack *mem;obstack_free(mem,(char *) 0)],
3615               am_cv_func_obstack=yes,
3616               am_cv_func_obstack=no)])
3617  if test $am_cv_func_obstack = yes; then
3618    AC_DEFINE(HAVE_OBSTACK)
3619  else
3620    LIBOBJS="$LIBOBJS obstack.o"
3621  fi
3624 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
3625 dnl FIXME: Migrate into libit
3627 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
3628 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
3629  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
3630               am_cv_lib_error_at_line=yes,
3631               am_cv_lib_error_at_line=no)])
3632  if test $am_cv_lib_error_at_line = no; then
3633    LIBOBJS="$LIBOBJS error.o"
3634  fi
3635  AC_SUBST(LIBOBJS)dnl
3638 # Macro to add for using GNU gettext.
3639 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3641 # serial 1
3642 # Stephan Kulow: I put a KDE in it to avoid name conflicts
3644 AC_DEFUN([AM_KDE_GNU_GETTEXT],
3645   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3646    AC_REQUIRE([AC_PROG_RANLIB])dnl
3647    AC_REQUIRE([AC_HEADER_STDC])dnl
3648    AC_REQUIRE([AC_TYPE_OFF_T])dnl
3649    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
3650    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
3651    AC_REQUIRE([AC_FUNC_MMAP])dnl
3652    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
3653    AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
3654    AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
3655 __argz_count __argz_stringify __argz_next])
3657    AC_MSG_CHECKING(for stpcpy)
3658    AC_CACHE_VAL(kde_cv_func_stpcpy,
3659    [
3660    kde_safe_cxxflags=$CXXFLAGS
3661    CXXFLAGS="-Werror"
3662    AC_LANG_SAVE
3663    AC_LANG_CPLUSPLUS
3664    AC_TRY_COMPILE([
3665    #include <string.h>
3666    ],
3667    [
3668    char buffer[200];
3669    stpcpy(buffer, buffer);
3670    ],
3671    kde_cv_func_stpcpy=yes,
3672    kde_cv_func_stpcpy=no)
3673    AC_LANG_RESTORE
3674    CXXFLAGS=$kde_safe_cxxflags
3675    ])
3676    AC_MSG_RESULT($kde_cv_func_stpcpy)
3677    if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
3678      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
3679    fi
3681    AM_LC_MESSAGES
3683    if test "x$CATOBJEXT" != "x"; then
3684      if test "x$ALL_LINGUAS" = "x"; then
3685        LINGUAS=
3686      else
3687        AC_MSG_CHECKING(for catalogs to be installed)
3688        NEW_LINGUAS=
3689        for lang in ${LINGUAS=$ALL_LINGUAS}; do
3690          case "$ALL_LINGUAS" in
3691           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
3692          esac
3693        done
3694        LINGUAS=$NEW_LINGUAS
3695        AC_MSG_RESULT($LINGUAS)
3696      fi
3698      dnl Construct list of names of catalog files to be constructed.
3699      if test -n "$LINGUAS"; then
3700        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
3701      fi
3702    fi
3704   ])
3706 AC_DEFUN([AC_HAVE_XPM],
3707  [AC_REQUIRE_CPP()dnl
3708   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3710  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
3711  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
3713  AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]),
3714         xpm_test=$withval, xpm_test="yes")
3715  if test "x$xpm_test" = xno; then
3716    ac_cv_have_xpm=no
3717  else
3718    AC_MSG_CHECKING(for XPM)
3719    AC_CACHE_VAL(ac_cv_have_xpm,
3720    [
3721     ac_save_ldflags="$LDFLAGS"
3722     ac_save_cflags="$CFLAGS"
3723     if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
3724       LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
3725     else
3726       LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
3727     fi
3728     CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
3729     test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
3730     AC_TRY_LINK([#include <X11/xpm.h>],[],
3731         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
3732     LDFLAGS="$ac_save_ldflags"
3733     CFLAGS="$ac_save_cflags"
3734    ])dnl
3736   if test "$ac_cv_have_xpm" = no; then
3737     AC_MSG_RESULT(no)
3738     XPM_LDFLAGS=""
3739     XPMINC=""
3740     $2
3741   else
3742     AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
3743     if test "$XPM_LDFLAGS" = ""; then
3744        XPMLIB='-lXpm $(LIB_X11)'
3745     else
3746        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
3747     fi
3748     if test "$XPM_INCLUDE" = ""; then
3749        XPMINC=""
3750     else
3751        XPMINC="-I$XPM_INCLUDE"
3752     fi
3753     AC_MSG_RESULT(yes)
3754     $1
3755   fi
3756  fi
3757  AC_SUBST(XPMINC)
3758  AC_SUBST(XPMLIB)
3761 AC_DEFUN([AC_HAVE_DPMS],
3762  [AC_REQUIRE_CPP()dnl
3763   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3765  test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
3766  test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
3767  DPMS_LIB=
3769  AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]),
3770         dpms_test=$withval, dpms_test="yes")
3771  if test "x$dpms_test" = xno; then
3772    ac_cv_have_dpms=no
3773  else
3774    AC_MSG_CHECKING(for DPMS)
3775    dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
3776    dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
3777    AC_CACHE_VAL(ac_cv_have_dpms,
3778    [
3779     if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
3780       AC_MSG_RESULT(no)
3781       ac_cv_have_dpms="no"
3782     else
3783       ac_save_ldflags="$LDFLAGS"
3784       ac_save_cflags="$CFLAGS"
3785       ac_save_libs="$LIBS"
3786       LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries"
3787       LIBS="-lX11 -lXext $LIBSOCKET"
3788       CFLAGS="$CFLAGS $X_INCLUDES"
3789       test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3790       AC_TRY_LINK([
3791           #include <X11/Xproto.h>
3792           #include <X11/X.h>
3793           #include <X11/Xlib.h>
3794           #include <X11/extensions/dpms.h>
3795           int foo_test_dpms()
3796           { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3797           ac_cv_have_dpms="yes", [
3798               LIBS="-lXdpms $LIBS"
3799               AC_TRY_LINK([
3800                   #include <X11/Xproto.h>
3801                   #include <X11/X.h>
3802                   #include <X11/Xlib.h>
3803                   #include <X11/extensions/dpms.h>
3804                   int foo_test_dpms()
3805                   { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3806                   [
3807                   ac_cv_have_dpms="-lXdpms"
3808                   ],ac_cv_have_dpms="no")
3809               ])
3810       LDFLAGS="$ac_save_ldflags"
3811       CFLAGS="$ac_save_cflags"
3812       LIBS="$ac_save_libs"
3813     fi
3814    ])dnl
3816   if test "$ac_cv_have_dpms" = no; then
3817     AC_MSG_RESULT(no)
3818     DPMS_LDFLAGS=""
3819     DPMSINC=""
3820     $2
3821   else
3822     AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
3823     if test "$ac_cv_have_dpms" = "-lXdpms"; then
3824        DPMS_LIB="-lXdpms"
3825     fi
3826     if test "$DPMS_LDFLAGS" = ""; then
3827        DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
3828     else
3829        DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
3830     fi
3831     if test "$DPMS_INCLUDE" = ""; then
3832        DPMSINC=""
3833     else
3834        DPMSINC="-I$DPMS_INCLUDE"
3835     fi
3836     AC_MSG_RESULT(yes)
3837     $1
3838   fi
3839  fi
3840  ac_save_cflags="$CFLAGS"
3841  CFLAGS="$CFLAGS $X_INCLUDES"
3842  test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3843  AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
3844    [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
3845  AC_CHECK_DECL(DPMSCapable,
3846    AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
3847    [#include <X11/extensions/dpms.h>])
3848  AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
3849    [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
3850  AC_CHECK_DECL(DPMSInfo,
3851    AC_DEFINE(HAVE_DPMSINFO_PROTO),,
3852    [#include <X11/extensions/dpms.h>])
3853  CFLAGS="$ac_save_cflags"
3854  AC_SUBST(DPMSINC)
3855  AC_SUBST(DPMSLIB)
3858 AC_DEFUN([AC_HAVE_GL],
3859  [AC_REQUIRE_CPP()dnl
3860   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3862  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
3863  test -z "$GL_INCLUDE" && GL_INCLUDE=
3865  AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]),
3866         gl_test=$withval, gl_test="yes")
3867  if test "x$kde_use_qt_emb" = "xyes"; then
3868    # GL and Qt Embedded is a no-go for now.
3869    ac_cv_have_gl=no
3870  elif test "x$gl_test" = xno; then
3871    ac_cv_have_gl=no
3872  else
3873    AC_MSG_CHECKING(for GL)
3874    AC_CACHE_VAL(ac_cv_have_gl,
3875    [
3876     AC_LANG_SAVE
3877     AC_LANG_CPLUSPLUS
3878     ac_save_ldflags=$LDFLAGS
3879     ac_save_cxxflags=$CXXFLAGS
3880     ac_save_libs=$LIBS
3881     LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries"
3882     LIBS="$LIBS -lGL -lGLU"
3883     test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11"
3884     LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET"
3885     CXXFLAGS="$CFLAGS $X_INCLUDES"
3886     test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3887     AC_TRY_LINK([#include <GL/gl.h>
3888 #include <GL/glu.h>
3889 ], [],
3890         ac_cv_have_gl="yes", ac_cv_have_gl="no")
3891     AC_LANG_RESTORE
3892     LDFLAGS=$ac_save_ldflags
3893     CXXFLAGS=$ac_save_cxxflags
3894     LIBS=$ac_save_libs
3895    ])dnl
3897   if test "$ac_cv_have_gl" = "no"; then
3898     AC_MSG_RESULT(no)
3899     GL_LDFLAGS=""
3900     GLINC=""
3901     $2
3902   else
3903     AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
3904     if test "$GL_LDFLAGS" = ""; then
3905        GLLIB='-lGLU -lGL $(LIB_X11)'
3906     else
3907        GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
3908     fi
3909     if test "$GL_INCLUDE" = ""; then
3910        GLINC=""
3911     else
3912        GLINC="-I$GL_INCLUDE"
3913     fi
3914     AC_MSG_RESULT($ac_cv_have_gl)
3915     $1
3916   fi
3917  fi
3918  AC_SUBST(GLINC)
3919  AC_SUBST(GLLIB)
3923  dnl shadow password and PAM magic - maintained by ossi@kde.org
3925 AC_DEFUN([KDE_PAM], [
3926   AC_REQUIRE([KDE_CHECK_LIBDL])
3928   want_pam=
3929   AC_ARG_WITH(pam,
3930     AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]),
3931     [ if test "x$withval" = "xyes"; then
3932         want_pam=yes
3933         pam_service=kde
3934       elif test "x$withval" = "xno"; then
3935         want_pam=no
3936       else
3937         want_pam=yes
3938         pam_service=$withval
3939       fi
3940     ], [ pam_service=kde ])
3942   use_pam=
3943   PAMLIBS=
3944   if test "x$want_pam" != xno; then
3945     AC_CHECK_LIB(pam, pam_start, [
3946       AC_CHECK_HEADER(security/pam_appl.h,
3947         [ pam_header=security/pam_appl.h ],
3948         [ AC_CHECK_HEADER(pam/pam_appl.h,
3949             [ pam_header=pam/pam_appl.h ],
3950             [
3951     AC_MSG_WARN([PAM detected, but no headers found!
3952 Make sure you have the necessary development packages installed.])
3953             ]
3954           )
3955         ]
3956       )
3957     ], , $LIBDL)
3958     if test -z "$pam_header"; then
3959       if test "x$want_pam" = xyes; then
3960         AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
3961       fi
3962     else
3963       AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
3964       PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
3965       use_pam=yes
3967       dnl darwin claims to be something special
3968       if test "$pam_header" = "pam/pam_appl.h"; then
3969         AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
3970       fi
3972       dnl test whether struct pam_message is const (Linux) or not (Sun)
3973       AC_MSG_CHECKING(for const pam_message)
3974       AC_EGREP_HEADER([struct pam_message], $pam_header,
3975         [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
3976                           [AC_MSG_RESULT([const: Linux-type PAM])],
3977                           [AC_MSG_RESULT([nonconst: Sun-type PAM])
3978                           AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
3979                           )],
3980         [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
3981     fi
3982   fi
3984   AC_SUBST(PAMLIBS)
3987 dnl DEF_PAM_SERVICE(arg name, full name, define name)
3988 AC_DEFUN([DEF_PAM_SERVICE], [
3989   AC_ARG_WITH($1-pam,
3990     AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]),
3991     [ if test "x$use_pam" = xyes; then
3992         $3_PAM_SERVICE=$withval
3993       else
3994         AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
3995 You may want to enforce it by using --with-pam.])
3996       fi
3997     ],
3998     [ if test "x$use_pam" = xyes; then
3999         $3_PAM_SERVICE="$pam_service"
4000       fi
4001     ])
4002     if test -n "$$3_PAM_SERVICE"; then
4003       AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
4004       AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
4005     fi
4006     AC_SUBST($3_PAM_SERVICE)
4009 AC_DEFUN([KDE_SHADOWPASSWD], [
4010   AC_REQUIRE([KDE_PAM])
4012   AC_CHECK_LIB(shadow, getspent,
4013     [ LIBSHADOW="-lshadow"
4014       ac_use_shadow=yes
4015     ],
4016     [ dnl for UnixWare
4017       AC_CHECK_LIB(gen, getspent,
4018         [ LIBGEN="-lgen"
4019           ac_use_shadow=yes
4020         ],
4021         [ AC_CHECK_FUNC(getspent,
4022             [ ac_use_shadow=yes ],
4023             [ ac_use_shadow=no ])
4024         ])
4025     ])
4026   AC_SUBST(LIBSHADOW)
4027   AC_SUBST(LIBGEN)
4029   AC_MSG_CHECKING([for shadow passwords])
4031   AC_ARG_WITH(shadow,
4032     AC_HELP_STRING([--with-shadow],[If you want shadow password support]),
4033     [ if test "x$withval" != "xno"; then
4034         use_shadow=yes
4035       else
4036         use_shadow=no
4037       fi
4038     ], [
4039       use_shadow="$ac_use_shadow"
4040     ])
4042   if test "x$use_shadow" = xyes; then
4043     AC_MSG_RESULT(yes)
4044     AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
4045   else
4046     AC_MSG_RESULT(no)
4047     LIBSHADOW=
4048     LIBGEN=
4049   fi
4051   dnl finally make the relevant binaries setuid root, if we have shadow passwds.
4052   dnl this still applies, if we could use it indirectly through pam.
4053   if test "x$use_shadow" = xyes ||
4054      ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
4055       case $host in
4056       *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
4057         SETUIDFLAGS="-m 4755 -o root";;
4058       *)
4059         SETUIDFLAGS="-m 4755";;
4060       esac
4061   fi
4062   AC_SUBST(SETUIDFLAGS)
4066 AC_DEFUN([KDE_PASSWDLIBS], [
4067   AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
4068   AC_REQUIRE([KDE_PAM])
4069   AC_REQUIRE([KDE_SHADOWPASSWD])
4071   if test "x$use_pam" = "xyes"; then
4072     PASSWDLIBS="$PAMLIBS"
4073   else
4074     PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
4075   fi
4077   dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
4078   dnl /etc/master.passwd holds the actual passwords.  /etc/master.passwd requires
4079   dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
4080   dnl may need to read /etc/master.passwd).
4081   case $host in
4082   *-*-freebsd*)
4083     SETUIDFLAGS="-m 4755 -o root"
4084     ;;
4085   *)
4086     ;;
4087   esac
4089   AC_SUBST(PASSWDLIBS)
4092 AC_DEFUN([KDE_CHECK_LIBDL],
4094 AC_CHECK_LIB(dl, dlopen, [
4095 LIBDL="-ldl"
4096 ac_cv_have_dlfcn=yes
4099 AC_CHECK_LIB(dld, shl_unload, [
4100 LIBDL="-ldld"
4101 ac_cv_have_shload=yes
4104 AC_SUBST(LIBDL)
4107 AC_DEFUN([KDE_CHECK_DLOPEN],
4109 KDE_CHECK_LIBDL
4110 AC_CHECK_HEADERS(dlfcn.h dl.h)
4111 if test "$ac_cv_header_dlfcn_h" = "no"; then
4112   ac_cv_have_dlfcn=no
4115 if test "$ac_cv_header_dl_h" = "no"; then
4116   ac_cv_have_shload=no
4119 dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
4120 dnl (MM)
4121 AC_ARG_ENABLE(dlopen,
4122 AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]),
4123 enable_dlopen=$enableval,
4124 enable_dlopen=yes)
4126 # override the user's opinion, if we know it better ;)
4127 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
4128   enable_dlopen=no
4131 if test "$ac_cv_have_dlfcn" = "yes"; then
4132   AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
4135 if test "$ac_cv_have_shload" = "yes"; then
4136   AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
4139 if test "$enable_dlopen" = no ; then
4140   test -n "$1" && eval $1
4141 else
4142   test -n "$2" && eval $2
4147 AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
4149 KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
4150 KDE_PROG_LIBTOOL
4151 AC_MSG_CHECKING([dynamic loading])
4152 eval "`egrep '^build_libtool_libs=' libtool`"
4153 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
4154   dynamic_loading=yes
4155   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
4156 else
4157   dynamic_loading=no
4159 AC_MSG_RESULT($dynamic_loading)
4160 if test "$dynamic_loading" = "yes"; then
4161   $1
4162 else
4163   $2
4167 AC_DEFUN([KDE_ADD_INCLUDES],
4169 if test -z "$1"; then
4170   test_include="Pix.h"
4171 else
4172   test_include="$1"
4175 AC_MSG_CHECKING([for libg++ ($test_include)])
4177 AC_CACHE_VAL(kde_cv_libgpp_includes,
4179 kde_cv_libgpp_includes=no
4181    for ac_dir in               \
4182                                \
4183      /usr/include/g++          \
4184      /usr/include              \
4185      /usr/unsupported/include  \
4186      /opt/include              \
4187      $extra_include            \
4188      ; \
4189    do
4190      if test -r "$ac_dir/$test_include"; then
4191        kde_cv_libgpp_includes=$ac_dir
4192        break
4193      fi
4194    done
4197 AC_MSG_RESULT($kde_cv_libgpp_includes)
4198 if test "$kde_cv_libgpp_includes" != "no"; then
4199   all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
4204 AC_DEFUN([KDE_CHECK_LIBPTHREAD],
4206   dnl This code is here specifically to handle the
4207   dnl various flavors of threading library on FreeBSD
4208   dnl 4-, 5-, and 6-, and the (weird) rules around it.
4209   dnl There may be an environment PTHREAD_LIBS that
4210   dnl specifies what to use; otherwise, search for it.
4211   dnl -pthread is special cased and unsets LIBPTHREAD
4212   dnl below if found.
4213   LIBPTHREAD=""
4215   if test -n "$PTHREAD_LIBS"; then
4216     if test "x$PTHREAD_LIBS" = "x-pthread" ; then
4217       LIBPTHREAD="PTHREAD"
4218     else
4219       PTHREAD_LIBS_save="$PTHREAD_LIBS"
4220       PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
4221       AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS])
4222       KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [
4223           LIBPTHREAD="$PTHREAD_LIBS_save"])
4224       PTHREAD_LIBS="$PTHREAD_LIBS_save"
4225     fi
4226   fi
4228   dnl Is this test really needed, in the face of the Tru64 test below?
4229   if test -z "$LIBPTHREAD"; then
4230     AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"])
4231   fi
4233   dnl This is a special Tru64 check, see BR 76171 issue #18.
4234   if test -z "$LIBPTHREAD" ; then
4235     AC_MSG_CHECKING([for pthread_create in -lpthread])
4236     kde_safe_libs=$LIBS
4237     LIBS="$LIBS -lpthread"
4238     AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
4239         AC_MSG_RESULT(yes)
4240         LIBPTHREAD="-lpthread"],[
4241         AC_MSG_RESULT(no)])
4242     LIBS=$kde_safe_libs
4243   fi
4245   dnl Un-special-case for FreeBSD.
4246   if test "x$LIBPTHREAD" = "xPTHREAD" ; then
4247     LIBPTHREAD=""
4248   fi
4250   AC_SUBST(LIBPTHREAD)
4253 AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
4255       USE_THREADS=""
4256       if test -z "$LIBPTHREAD"; then
4257         KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
4258       fi
4260     AH_VERBATIM(__svr_define, [
4261 #if defined(__SVR4) && !defined(__svr4__)
4262 #define __svr4__ 1
4263 #endif
4265     case $host_os in
4266         solaris*)
4267                 KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
4268                 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
4269                 ;;
4270         freebsd*)
4271                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
4272                 ;;
4273         aix*)
4274                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
4275                 LIBPTHREAD="$LIBPTHREAD -lc_r"
4276                 ;;
4277         linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
4278                 if test "$CXX" = "KCC"; then
4279                   CXXFLAGS="$CXXFLAGS --thread_safe"
4280                   NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
4281                 fi
4282                 ;;
4283         *)
4284                 ;;
4285     esac
4286     AC_SUBST(USE_THREADS)
4287     AC_SUBST(LIBPTHREAD)
4290 AC_DEFUN([KDE_CHECK_THREADING],
4292   AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
4293   AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
4294   dnl default is yes if libpthread is found and no if no libpthread is available
4295   if test -z "$LIBPTHREAD"; then
4296     if test -z "$USE_THREADS"; then
4297       kde_check_threading_default=no
4298     else
4299       kde_check_threading_default=yes
4300     fi
4301   else
4302     kde_check_threading_default=yes
4303   fi
4304   AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]),
4305    kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
4306   if test "x$kde_use_threading" = "xyes"; then
4307     AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
4308   fi
4311 AC_DEFUN([KDE_TRY_LINK_PYTHON],
4313 if test "$kde_python_link_found" = no; then
4315 if test "$1" = normal; then
4316   AC_MSG_CHECKING(if a Python application links)
4317 else
4318   AC_MSG_CHECKING(if Python depends on $2)
4321 AC_CACHE_VAL(kde_cv_try_link_python_$1,
4323 kde_save_cflags="$CFLAGS"
4324 CFLAGS="$CFLAGS $PYTHONINC"
4325 kde_save_libs="$LIBS"
4326 LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
4327 kde_save_ldflags="$LDFLAGS"
4328 LDFLAGS="$LDFLAGS $PYTHONLIB"
4330 AC_TRY_LINK(
4332 #include <Python.h>
4334         PySys_SetArgv(1, 0);
4336         [kde_cv_try_link_python_$1=yes],
4337         [kde_cv_try_link_python_$1=no]
4339 CFLAGS="$kde_save_cflags"
4340 LIBS="$kde_save_libs"
4341 LDFLAGS="$kde_save_ldflags"
4344 if test "$kde_cv_try_link_python_$1" = "yes"; then
4345   AC_MSG_RESULT(yes)
4346   kde_python_link_found=yes
4347   if test ! "$1" = normal; then
4348     LIBPYTHON="$LIBPYTHON $2"
4349   fi
4350   $3
4351 else
4352   AC_MSG_RESULT(no)
4353   $4
4360 AC_DEFUN([KDE_CHECK_PYTHON_DIR],
4362 AC_MSG_CHECKING([for Python directory])
4364 AC_CACHE_VAL(kde_cv_pythondir,
4366   if test -z "$PYTHONDIR"; then
4367     kde_cv_pythondir=/usr/local
4368   else
4369     kde_cv_pythondir="$PYTHONDIR"
4370   fi
4373 AC_ARG_WITH(pythondir,
4374 AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]),
4376   ac_python_dir=$withval
4377 ], ac_python_dir=$kde_cv_pythondir
4380 AC_MSG_RESULT($ac_python_dir)
4383 AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
4385 AC_REQUIRE([KDE_CHECK_LIBDL])
4386 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
4387 AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
4389 if test -z "$1"; then
4390   version="1.5"
4391 else
4392   version="$1"
4395 AC_MSG_CHECKING([for Python$version])
4397 python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
4398 AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
4399 if test ! -r $python_incdir/Python.h; then
4400   AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
4401   python_incdir=$python_incdir/python$version
4402   if test ! -r $python_incdir/Python.h; then
4403     python_incdir=no
4404   fi
4407 PYTHONINC=-I$python_incdir
4409 python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs"
4410 AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
4411 if test ! -r $python_libdir/libpython$version.so; then
4412   AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
4413   if test ! -r $python_libdir/libpython$version.a; then
4414     AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
4415     python_libdir=$python_libdir/python$version/config
4416     if test ! -r $python_libdir/libpython$version.a; then
4417       python_libdir=no
4418     fi
4419   fi
4422 PYTHONLIB=-L$python_libdir
4423 kde_orig_LIBPYTHON=$LIBPYTHON
4424 if test -z "$LIBPYTHON"; then
4425   LIBPYTHON=-lpython$version
4428 AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
4429 python_moddir=$python_moddir/python$version
4430 if test ! -r $python_moddir/copy.py; then
4431   python_moddir=no
4434 PYTHONMODDIR=$python_moddir
4436 AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
4438 if test x$python_incdir = xno ||  test x$python_libdir = xno ||  test x$python_moddir = xno; then
4439    LIBPYTHON=$kde_orig_LIBPYTHON
4440    test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
4441    test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
4442    $2
4443 else
4444   dnl Note: this test is very weak
4445   kde_python_link_found=no
4446   KDE_TRY_LINK_PYTHON(normal)
4447   KDE_TRY_LINK_PYTHON(m, -lm)
4448   KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
4449   KDE_TRY_LINK_PYTHON(tcl, -ltcl)
4450   KDE_TRY_LINK_PYTHON(db2, -ldb2)
4451   KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
4452   KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
4453   KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
4454   KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
4455   KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
4456   KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
4457   KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
4458   KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
4459         [AC_MSG_WARN([it seems, Python depends on another library.
4460     Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
4461     and contact the authors to let them know about this problem])
4462         ])
4464   LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
4465   AC_SUBST(PYTHONINC)
4466   AC_SUBST(PYTHONLIB)
4467   AC_SUBST(LIBPYTHON)
4468   AC_SUBST(PYTHONMODDIR)
4469   AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
4475 AC_DEFUN([KDE_CHECK_PYTHON],
4477   KDE_CHECK_PYTHON_INTERN("2.4",
4478    [KDE_CHECK_PYTHON_INTERN("2.3",
4479      [KDE_CHECK_PYTHON_INTERN("2.2",
4480        [KDE_CHECK_PYTHON_INTERN("2.1",
4481          [KDE_CHECK_PYTHON_INTERN("2.0",
4482            [KDE_CHECK_PYTHON_INTERN($1, $2) ])
4483          ])
4484        ])
4485      ])
4486   ])
4489 AC_DEFUN([KDE_CHECK_STL],
4491     AC_LANG_SAVE
4492     AC_LANG_CPLUSPLUS
4493     ac_save_CXXFLAGS="$CXXFLAGS"
4494     CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
4496     AC_MSG_CHECKING([if C++ programs can be compiled])
4497     AC_CACHE_VAL(kde_cv_stl_works,
4498     [
4499       AC_TRY_COMPILE([
4500 #include <string>
4501 using namespace std;
4503   string astring="Hallo Welt.";
4504   astring.erase(0, 6); // now astring is "Welt"
4505   return 0;
4506 ], kde_cv_stl_works=yes,
4507    kde_cv_stl_works=no)
4510    AC_MSG_RESULT($kde_cv_stl_works)
4512    if test "$kde_cv_stl_works" = "yes"; then
4513      # back compatible
4514          AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
4515    else
4516          AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
4517 Check config.log for details - if you're using a Linux distribution you might miss
4518 a package named similar to libstdc++-dev.])
4519    fi
4521    CXXFLAGS="$ac_save_CXXFLAGS"
4522    AC_LANG_RESTORE
4525 AC_DEFUN([AC_FIND_QIMGIO],
4526    [AC_REQUIRE([AC_FIND_JPEG])
4527 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
4528 AC_MSG_CHECKING([for qimgio])
4529 AC_CACHE_VAL(ac_cv_lib_qimgio,
4531 AC_LANG_SAVE
4532 AC_LANG_CPLUSPLUS
4533 ac_save_LIBS="$LIBS"
4534 ac_save_CXXFLAGS="$CXXFLAGS"
4535 LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
4536 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
4537 AC_TRY_RUN(dnl
4539 #include <qimageio.h>
4540 #include <qstring.h>
4541 int main() {
4542                 QString t = "hallo";
4543                 t.fill('t');
4544                 qInitImageIO();
4547             ac_cv_lib_qimgio=yes,
4548             ac_cv_lib_qimgio=no,
4549             ac_cv_lib_qimgio=no)
4550 LIBS="$ac_save_LIBS"
4551 CXXFLAGS="$ac_save_CXXFLAGS"
4552 AC_LANG_RESTORE
4553 ])dnl
4554 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
4555   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
4556   AC_MSG_RESULT(yes)
4557   AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
4558   AC_SUBST(LIBQIMGIO)
4559 else
4560   AC_MSG_RESULT(not found)
4564 AC_DEFUN([AM_DISABLE_LIBRARIES],
4566     AC_PROVIDE([AM_ENABLE_STATIC])
4567     AC_PROVIDE([AM_ENABLE_SHARED])
4568     enable_static=no
4569     enable_shared=yes
4573 AC_DEFUN([AC_CHECK_UTMP_FILE],
4575     AC_MSG_CHECKING([for utmp file])
4577     AC_CACHE_VAL(kde_cv_utmp_file,
4578     [
4579     kde_cv_utmp_file=no
4581     for ac_file in    \
4582                       \
4583         /var/run/utmp \
4584         /var/adm/utmp \
4585         /etc/utmp     \
4586      ; \
4587     do
4588      if test -r "$ac_file"; then
4589        kde_cv_utmp_file=$ac_file
4590        break
4591      fi
4592     done
4593     ])
4595     if test "$kde_cv_utmp_file" != "no"; then
4596         AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
4597         $1
4598         AC_MSG_RESULT($kde_cv_utmp_file)
4599     else
4600         $2
4601         AC_MSG_RESULT([non found])
4602     fi
4606 AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
4609 DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
4610 TOPSUBDIRS=""
4612 if test ! -s $srcdir/subdirs; then
4613   dnl Note: Makefile.common creates subdirs, so this is just a fallback
4614   files=`cd $srcdir && ls -1`
4615   dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
4616   for i in $dirs; do
4617     echo $i >> $srcdir/subdirs
4618   done
4621 ac_topsubdirs=
4622 if test -s $srcdir/inst-apps; then
4623   ac_topsubdirs="`cat $srcdir/inst-apps`"
4624 elif test -s $srcdir/subdirs; then
4625   ac_topsubdirs="`cat $srcdir/subdirs`"
4628 for i in $ac_topsubdirs; do
4629   AC_MSG_CHECKING([if $i should be compiled])
4630   if test -d $srcdir/$i; then
4631     install_it="yes"
4632     for j in $DO_NOT_COMPILE; do
4633       if test $i = $j; then
4634         install_it="no"
4635       fi
4636     done
4637   else
4638     install_it="no"
4639   fi
4640   AC_MSG_RESULT($install_it)
4641   vari=`echo $i | sed -e 's,[[-+.@]],_,g'`
4642   if test $install_it = "yes"; then
4643     TOPSUBDIRS="$TOPSUBDIRS $i"
4644     eval "$vari""_SUBDIR_included=yes"
4645   else
4646     eval "$vari""_SUBDIR_included=no"
4647   fi
4648 done
4650 AC_SUBST(TOPSUBDIRS)
4653 AC_DEFUN([KDE_CHECK_NAMESPACES],
4655 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
4656 AC_LANG_SAVE
4657 AC_LANG_CPLUSPLUS
4658 AC_TRY_COMPILE([
4661 namespace Foo {
4662   extern int i;
4663   namespace Bar {
4664     extern int i;
4665   }
4668 int Foo::i = 0;
4669 int Foo::Bar::i = 1;
4671   AC_MSG_RESULT(yes)
4672   AC_DEFINE(HAVE_NAMESPACES)
4673 ], [
4674 AC_MSG_RESULT(no)
4676 AC_LANG_RESTORE
4679 dnl ------------------------------------------------------------------------
4680 dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
4681 dnl ------------------------------------------------------------------------
4683 AC_DEFUN([AC_CHECK_S_ISSOCK],
4685 AC_MSG_CHECKING(for S_ISSOCK)
4686 AC_CACHE_VAL(ac_cv_have_s_issock,
4688 AC_TRY_LINK(
4690 #include <sys/stat.h>
4693 struct stat buff;
4694 int b = S_ISSOCK( buff.st_mode );
4696 ac_cv_have_s_issock=yes,
4697 ac_cv_have_s_issock=no)
4699 AC_MSG_RESULT($ac_cv_have_s_issock)
4700 if test "$ac_cv_have_s_issock" = "yes"; then
4701   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
4704 AH_VERBATIM(_ISSOCK,
4706 #ifndef HAVE_S_ISSOCK
4707 #define HAVE_S_ISSOCK
4708 #define S_ISSOCK(mode) (1==0)
4709 #endif
4714 dnl ------------------------------------------------------------------------
4715 dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
4716 dnl ------------------------------------------------------------------------
4718 AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
4720 AC_MSG_CHECKING(for MAXPATHLEN)
4721 AC_CACHE_VAL(ac_cv_maxpathlen,
4723 cat > conftest.$ac_ext <<EOF
4724 #ifdef STDC_HEADERS
4725 # include <stdlib.h>
4726 #endif
4727 #include <stdio.h>
4728 #include <sys/param.h>
4729 #ifndef MAXPATHLEN
4730 #define MAXPATHLEN 1024
4731 #endif
4733 KDE_HELLO MAXPATHLEN
4737 ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
4739 if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
4740     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
4741 else
4742     ac_cv_maxpathlen=1024
4745 rm conftest.*
4748 AC_MSG_RESULT($ac_cv_maxpathlen)
4749 AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
4752 AC_DEFUN([KDE_CHECK_HEADER],
4754    kde_safe_cppflags=$CPPFLAGS
4755    CPPFLAGS="$CPPFLAGS $all_includes"
4756    AC_LANG_SAVE
4757    AC_LANG_CPLUSPLUS
4758    AC_CHECK_HEADER([$1], [$2], [$3], [$4])
4759    AC_LANG_RESTORE
4760    CPPFLAGS=$kde_safe_cppflags
4763 AC_DEFUN([KDE_CHECK_HEADERS],
4765    AH_CHECK_HEADERS([$1])
4766    AC_LANG_SAVE
4767    kde_safe_cppflags=$CPPFLAGS
4768    CPPFLAGS="$CPPFLAGS $all_includes"
4769    AC_LANG_CPLUSPLUS
4770    AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
4771    CPPFLAGS=$kde_safe_cppflags
4772    AC_LANG_RESTORE
4775 AC_DEFUN([KDE_FAST_CONFIGURE],
4777   dnl makes configure fast (needs perl)
4778   AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]),
4779       with_fast_perl=$enableval, with_fast_perl=yes)
4782 AC_DEFUN([KDE_CONF_FILES],
4784   val=
4785   if test -f $srcdir/configure.files ; then
4786     val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
4787   fi
4788   CONF_FILES=
4789   if test -n "$val" ; then
4790     for i in $val ; do
4791       CONF_FILES="$CONF_FILES $i"
4792     done
4793   fi
4794   AC_SUBST(CONF_FILES)
4795 ])dnl
4797 dnl This sets the prefix, for arts and kdelibs
4798 dnl Do NOT use in any other module.
4799 dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde
4800 AC_DEFUN([KDE_SET_PREFIX_CORE],
4802   unset CDPATH
4803   dnl make $KDEDIR the default for the installation
4804   AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
4806   if test "x$prefix" = "xNONE"; then
4807     prefix=$ac_default_prefix
4808     ac_configure_args="$ac_configure_args --prefix=$prefix"
4809   fi
4810   # And delete superfluous '/' to make compares easier
4811   prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4812   kde_libs_htmldir=$prefix/share/doc/HTML/
4813   exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4815   kde_libs_prefix='$(prefix)'
4816   kde_libs_htmldir='$(kde_htmldir)'
4817   AC_SUBST(kde_libs_prefix)
4818   AC_SUBST(kde_libs_htmldir)
4819   KDE_FAST_CONFIGURE
4820   KDE_CONF_FILES
4824 AC_DEFUN([KDE_SET_PREFIX],
4826   unset CDPATH
4827   dnl We can't give real code to that macro, only a value.
4828   dnl It only matters for --help, since we set the prefix in this function anyway.
4829   AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix})
4831   KDE_SET_DEFAULT_BINDIRS
4832   if test "x$prefix" = "xNONE"; then
4833     dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it
4834     KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
4835   else
4836     dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH
4837     kde_save_PATH="$PATH"
4838     PATH="$exec_prefix/bin:$prefix/bin:$PATH"
4839     KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
4840     PATH="$kde_save_PATH"
4841   fi
4843   kde_libs_prefix=`$KDECONFIG --prefix`
4844   if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
4845        AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
4846                     This means it has been moved since you installed it.
4847                     This won't work. Please recompile kdelibs for the new prefix.
4848                     ])
4849   fi
4850   kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
4851   kde_libs_suffix=`$KDECONFIG --libsuffix`
4853   AC_MSG_CHECKING([where to install])
4854   if test "x$prefix" = "xNONE"; then
4855     prefix=$kde_libs_prefix
4856     AC_MSG_RESULT([$prefix (as returned by kde-config)])
4857   else
4858     dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different
4859     given_prefix=$prefix
4860     AC_MSG_RESULT([$prefix (as requested)])
4861   fi
4863   # And delete superfluous '/' to make compares easier
4864   prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4865   exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4866   given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4868   AC_SUBST(KDECONFIG)
4869   AC_SUBST(kde_libs_prefix)
4870   AC_SUBST(kde_libs_htmldir)
4872   KDE_FAST_CONFIGURE
4873   KDE_CONF_FILES
4876 pushdef([AC_PROG_INSTALL],
4878   dnl our own version, testing for a -p flag
4879   popdef([AC_PROG_INSTALL])
4880   dnl as AC_PROG_INSTALL works as it works we first have
4881   dnl to save if the user didn't specify INSTALL, as the
4882   dnl autoconf one overwrites INSTALL and we have no chance to find
4883   dnl out afterwards
4884   test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
4885   test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
4886   test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
4887   AC_PROG_INSTALL
4889   if test -z "$kde_save_INSTALL_given" ; then
4890     # OK, user hasn't given any INSTALL, autoconf found one for us
4891     # now we test, if it supports the -p flag
4892     AC_MSG_CHECKING(for -p flag to install)
4893     rm -f confinst.$$.* > /dev/null 2>&1
4894     echo "Testtest" > confinst.$$.orig
4895     ac_res=no
4896     if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
4897       if test -f confinst.$$.new ; then
4898         # OK, -p seems to do no harm to install
4899         INSTALL="${INSTALL} -p"
4900         ac_res=yes
4901       fi
4902     fi
4903     rm -f confinst.$$.*
4904     AC_MSG_RESULT($ac_res)
4905   fi
4906   dnl the following tries to resolve some signs and wonders coming up
4907   dnl with different autoconf/automake versions
4908   dnl e.g.:
4909   dnl  *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
4910   dnl   and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
4911   dnl   it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
4912   dnl  *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
4913   dnl   INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
4914   dnl   install-@DIR@PROGRAMS targets to explicitly use that flag
4915   dnl  *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
4916   dnl   INSTALL_SCRIPT, which breaks with automake <= 1.4
4917   dnl  *autoconf >2.13 (since 10.Apr 1999) has not that failure
4918   dnl  *sometimes KDE does not use the install-@DIR@PROGRAM targets from
4919   dnl   automake (due to broken Makefile.am or whatever) to install programs,
4920   dnl   and so does not see the -s flag in automake > 1.4
4921   dnl to clean up that mess we:
4922   dnl  +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
4923   dnl   which cleans KDE's program with automake > 1.4;
4924   dnl  +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
4925   dnl   with automake<=1.4
4926   dnl  note that dues to this sometimes two '-s' flags are used (if KDE
4927   dnl   properly uses install-@DIR@PROGRAMS, but I don't care
4928   dnl
4929   dnl And to all this comes, that I even can't write in comments variable
4930   dnl  names used by automake, because it is so stupid to think I wanted to
4931   dnl  _use_ them, therefor I have written A_M_... instead of AM_
4932   dnl hmm, I wanted to say something ... ahh yes: Arghhh.
4934   if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
4935     INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
4936   fi
4937   if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
4938     INSTALL_SCRIPT='${INSTALL}'
4939   fi
4940 ])dnl
4942 AC_DEFUN([KDE_LANG_CPLUSPLUS],
4943 [AC_LANG_CPLUSPLUS
4944 ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
4945 pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
4948 pushdef([AC_LANG_CPLUSPLUS],
4949 [popdef([AC_LANG_CPLUSPLUS])
4950 KDE_LANG_CPLUSPLUS
4953 AC_DEFUN([KDE_CHECK_LONG_LONG],
4955 AC_MSG_CHECKING(for long long)
4956 AC_CACHE_VAL(kde_cv_c_long_long,
4958   AC_LANG_SAVE
4959   AC_LANG_CPLUSPLUS
4960   AC_TRY_LINK([], [
4961   long long foo = 0;
4962   foo = foo+1;
4963   ],
4964   kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
4965   AC_LANG_RESTORE
4967 AC_MSG_RESULT($kde_cv_c_long_long)
4968 if test "$kde_cv_c_long_long" = yes; then
4969    AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
4973 AC_DEFUN([KDE_CHECK_LIB],
4975      kde_save_LDFLAGS="$LDFLAGS"
4976      dnl AC_CHECK_LIB modifies LIBS, so save it here
4977      kde_save_LIBS="$LIBS"
4978      LDFLAGS="$LDFLAGS $all_libraries"
4979      case $host_os in
4980       aix*) LDFLAGS="-brtl $LDFLAGS"
4981         test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
4982         ;;
4983      esac
4984      AC_CHECK_LIB($1, $2, $3, $4, $5)
4985      LDFLAGS="$kde_save_LDFLAGS"
4986      LIBS="$kde_save_LIBS"
4989 AC_DEFUN([KDE_JAVA_PREFIX],
4991         dir=`dirname "$1"`
4992         base=`basename "$1"`
4993         list=`ls -1 $dir 2> /dev/null`
4994         for entry in $list; do
4995                 if test -d $dir/$entry/bin; then
4996                         case $entry in
4997                            $base)
4998                                 javadirs="$javadirs $dir/$entry/bin"
4999                                 ;;
5000                         esac
5001                 elif test -d $dir/$entry/jre/bin; then
5002                         case $entry in
5003                            $base)
5004                                 javadirs="$javadirs $dir/$entry/jre/bin"
5005                                 ;;
5006                         esac
5007                 fi
5008         done
5011 dnl KDE_CHEC_JAVA_DIR(onlyjre)
5012 AC_DEFUN([KDE_CHECK_JAVA_DIR],
5015 AC_ARG_WITH(java,
5016 AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]),
5017 [  ac_java_dir=$withval
5018 ], ac_java_dir=""
5021 AC_MSG_CHECKING([for Java])
5023 dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
5024 if test "x$ac_java_dir" = "xno"; then
5025    kde_java_bindir=no
5026    kde_java_includedir=no
5027    kde_java_libjvmdir=no
5028    kde_java_libgcjdir=no
5029    kde_java_libhpidir=no
5030 else
5031   if test "x$ac_java_dir" = "x"; then
5034       dnl No option set -> collect list of candidate paths
5035       if test -n "$JAVA_HOME"; then
5036         KDE_JAVA_PREFIX($JAVA_HOME)
5037       fi
5038       KDE_JAVA_PREFIX(/usr/j2se)
5039       KDE_JAVA_PREFIX(/usr/lib/j2se)
5040       KDE_JAVA_PREFIX(/usr/j*dk*)
5041       KDE_JAVA_PREFIX(/usr/lib/j*dk*)
5042       KDE_JAVA_PREFIX(/opt/j*sdk*)
5043       KDE_JAVA_PREFIX(/usr/lib/java*)
5044       KDE_JAVA_PREFIX(/usr/java*)
5045       KDE_JAVA_PREFIX(/usr/java/j*dk*)
5046       KDE_JAVA_PREFIX(/usr/java/j*re*)
5047       KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
5048       KDE_JAVA_PREFIX(/usr/lib/SunJava*)
5049       KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
5050       KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
5051       KDE_JAVA_PREFIX(/opt/java*)
5053       kde_cv_path="NONE"
5054       kde_save_IFS=$IFS
5055       IFS=':'
5056       for dir in $PATH; do
5057           if test -d "$dir"; then
5058               javadirs="$javadirs $dir"
5059           fi
5060       done
5061       IFS=$kde_save_IFS
5062       jredirs=
5064       dnl Now javadirs contains a list of paths that exist, all ending with bin/
5065       for dir in $javadirs; do
5066           dnl Check for the java executable
5067           if test -x "$dir/java"; then
5068               dnl And also check for a libjvm.so somewhere under there
5069               dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
5070               if test "$dir" != "/usr/bin"; then
5071                   libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
5072                   if test ! -f $libjvmdir/libjvm.so; then continue; fi
5073                   jredirs="$jredirs $dir"
5074               fi
5075           fi
5076       done
5078       dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
5079       JAVAC=
5080       JAVA=
5081       kde_java_bindir=no
5082       for dir in $jredirs; do
5083           JAVA="$dir/java"
5084           kde_java_bindir=$dir
5085           if test -x "$dir/javac"; then
5086                 JAVAC="$dir/javac"
5087                 break
5088           fi
5089       done
5091       if test -n "$JAVAC"; then
5092           dnl this substitution might not work - well, we test for jni.h below
5093           kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
5094       else
5095           kde_java_includedir=no
5096       fi
5097   else
5098     dnl config option set
5099     kde_java_bindir=$ac_java_dir/bin
5100     if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
5101         kde_java_includedir=no
5102     else
5103         kde_java_includedir=$ac_java_dir/include
5104     fi
5105   fi
5108 dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
5109 if test "x$kde_java_bindir" != "xno"; then
5111   dnl Look for libjvm.so
5112   kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
5113   dnl Look for libgcj.so
5114   kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
5115   dnl Look for libhpi.so and avoid green threads
5116   kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
5118   dnl Now check everything's fine under there
5119   dnl the include dir is our flag for having the JDK
5120   if test -d "$kde_java_includedir"; then
5121     if test ! -x "$kde_java_bindir/javac"; then
5122       AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
5123     fi
5124     if test ! -x "$kde_java_bindir/javah"; then
5125       AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
5126     fi
5127     if test ! -x "$kde_java_bindir/jar"; then
5128       AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
5129     fi
5130     if test ! -r "$kde_java_includedir/jni.h"; then
5131       AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
5132     fi
5134     jni_includes="-I$kde_java_includedir"
5135     dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
5136     dnl and under linux here..
5138     dnl not needed for gcj
5140     if test "x$kde_java_libgcjdir" = "x"; then
5141       test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
5142       test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
5143       test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
5144     fi
5146   else
5147     JAVAC=
5148     jni_includes=
5149   fi
5151   if test "x$kde_java_libgcjdir" = "x"; then
5152      if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
5153         AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
5154      fi
5155   else
5156      if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
5157         AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
5158      fi
5159   fi
5161   if test ! -x "$kde_java_bindir/java"; then
5162       AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
5163   fi
5165   dnl not needed for gcj compile
5167   if test "x$kde_java_libgcjdir" = "x"; then
5168       if test ! -r "$kde_java_libhpidir/libhpi.so"; then
5169         AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
5170       fi
5171   fi
5173   if test -n "$jni_includes"; then
5174     dnl Check for JNI version
5175     AC_LANG_SAVE
5176     AC_LANG_CPLUSPLUS
5177     ac_cxxflags_safe="$CXXFLAGS"
5178     CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
5180     AC_TRY_COMPILE([
5181   #include <jni.h>
5182               ],
5183               [
5184   #ifndef JNI_VERSION_1_2
5185   Syntax Error
5186   #endif
5187               ],[ kde_jni_works=yes ],
5188               [ kde_jni_works=no ])
5190     if test $kde_jni_works = no; then
5191       AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
5192                     You need to have Java Development Kit (JDK) version 1.2.
5194                     Use --with-java to specify another location.
5195                     Use --without-java to configure without java support.
5196                     Or download a newer JDK and try again.
5197                     See e.g. http://java.sun.com/products/jdk/1.2 ])
5198     fi
5200     CXXFLAGS="$ac_cxxflags_safe"
5201     AC_LANG_RESTORE
5203     dnl All tests ok, inform and subst the variables
5205     JAVAC=$kde_java_bindir/javac
5206     JAVAH=$kde_java_bindir/javah
5207     JAR=$kde_java_bindir/jar
5208     AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
5209     if test "x$kde_java_libgcjdir" = "x"; then
5210       JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
5211     else
5212       JVMLIBS="-L$kde_java_libgcjdir -lgcj"
5213     fi
5214     AC_MSG_RESULT([java JDK in $kde_java_bindir])
5216   else
5217       AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
5218       AC_MSG_RESULT([java JRE in $kde_java_bindir])
5219   fi
5220 elif test -d "/Library/Java/Home"; then
5221   kde_java_bindir="/Library/Java/Home/bin"
5222   jni_includes="-I/Library/Java/Home/include"
5224   JAVAC=$kde_java_bindir/javac
5225   JAVAH=$kde_java_bindir/javah
5226   JAR=$kde_java_bindir/jar
5227   JVMLIBS="-Xlinker -framework -Xlinker JavaVM"
5229   AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
5230   AC_MSG_RESULT([Apple Java Framework])
5231 else
5232   AC_MSG_RESULT([none found])
5235 AC_SUBST(JAVAC)
5236 AC_SUBST(JAVAH)
5237 AC_SUBST(JAR)
5238 AC_SUBST(JVMLIBS)
5239 AC_SUBST(jni_includes)
5241 # for backward compat
5242 kde_cv_java_includedir=$kde_java_includedir
5243 kde_cv_java_bindir=$kde_java_bindir
5246 dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
5247 dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
5248 dnl big packages, m4_foreach is dog-slow.  So use our own version of
5249 dnl it.  (matz@kde.org)
5250 m4_define([mm_foreach],
5251 [m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
5252 m4_define([mm_car], [[$1]])
5253 m4_define([mm_car2], [[$@]])
5254 m4_define([_mm_foreach],
5255 [m4_if(m4_quote($2), [], [],
5256        [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
5257                                                    mm_car2(m4_shift($2)),
5258                                                    [$3])])])
5259 m4_define([AC_FOREACH],
5260 [mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
5262 AC_DEFUN([KDE_NEED_FLEX],
5264 kde_libs_safe=$LIBS
5265 LIBS="$LIBS $USER_LDFLAGS"
5266 AM_PROG_LEX
5267 LIBS=$kde_libs_safe
5268 if test -z "$LEXLIB"; then
5269     AC_MSG_ERROR([You need to have flex installed.])
5271 AC_SUBST(LEXLIB)
5274 AC_DEFUN([AC_PATH_QTOPIA],
5276   dnl TODO: use AC_CACHE_VAL
5278   if test -z "$1"; then
5279     qtopia_minver_maj=1
5280     qtopia_minver_min=5
5281     qtopia_minver_pat=0
5282   else
5283     qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
5284     qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
5285     qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
5286   fi
5288   qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
5289   qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
5291   AC_REQUIRE([AC_PATH_QT])
5293   AC_MSG_CHECKING([for Qtopia])
5295   LIB_QTOPIA="-lqpe"
5296   AC_SUBST(LIB_QTOPIA)
5298   kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
5300   ac_qtopia_incdir=NO
5302   AC_ARG_WITH(qtopia-dir,
5303               AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]),
5304               [  ac_qtopia_incdir="$withval"/include] )
5306   qtopia_incdirs=""
5307   for dir in $kde_qtopia_dirs; do
5308     qtopia_incdirs="$qtopia_incdirs $dir/include"
5309   done
5311   if test ! "$ac_qtopia_incdir" = "NO"; then
5312     qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
5313   fi
5315   qtopia_incdir=""
5316   AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
5317   ac_qtopia_incdir="$qtopia_incdir"
5319   if test -z "$qtopia_incdir"; then
5320     AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
5321   fi
5323   qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
5324   qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
5325   qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
5327   qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
5328   qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
5329   if test "$qtopia_ver" -lt "$qtopia_minver"; then
5330     AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
5331 is required.])
5332   fi
5334   AC_LANG_SAVE
5335   AC_LANG_CPLUSPLUS
5337   ac_cxxflags_safe="$CXXFLAGS"
5338   ac_ldflags_safe="$LDFLAGS"
5339   ac_libs_safe="$LIBS"
5341   CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
5342   LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
5343   LIBS="$LIBS $LIB_QTOPIA $LIBQT"
5345   cat > conftest.$ac_ext <<EOF
5346 #include "confdefs.h"
5347 #include <qpe/qpeapplication.h>
5348 #include <qpe/version.h>
5350 int main( int argc, char **argv )
5352     QPEApplication app( argc, argv );
5353     return 0;
5357   if AC_TRY_EVAL(ac_link) && test -s conftest; then
5358     rm -f conftest*
5359   else
5360     rm -f conftest*
5361     AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
5362 the end of config.log])
5363   fi
5365   CXXFLAGS="$ac_cxxflags_safe"
5366   LDFLAGS="$ac_ldflags_safe"
5367   LIBS="$ac_libs_safe"
5369   AC_LANG_RESTORE
5371   QTOPIA_INCLUDES="-I$qtopia_incdir"
5372   AC_SUBST(QTOPIA_INCLUDES)
5374   AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
5378 AC_DEFUN([KDE_INIT_DOXYGEN],
5380 AC_MSG_CHECKING([for Qt docs])
5381 kde_qtdir=
5382 if test "${with_qt_dir+set}" = set; then
5383   kde_qtdir="$with_qt_dir"
5386 AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
5387 AC_MSG_RESULT($QTDOCDIR)
5389 AC_SUBST(QTDOCDIR)
5391 KDE_FIND_PATH(dot, DOT, [], [])
5392 if test -n "$DOT"; then
5393   KDE_HAVE_DOT="YES"
5394 else
5395   KDE_HAVE_DOT="NO"
5397 AC_SUBST(KDE_HAVE_DOT)
5398 KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
5399 AC_SUBST(DOXYGEN)
5401 DOXYGEN_PROJECT_NAME="$1"
5402 DOXYGEN_PROJECT_NUMBER="$2"
5403 AC_SUBST(DOXYGEN_PROJECT_NAME)
5404 AC_SUBST(DOXYGEN_PROJECT_NUMBER)
5406 KDE_HAS_DOXYGEN=no
5407 if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then
5408   KDE_HAS_DOXYGEN=yes
5410 AC_SUBST(KDE_HAS_DOXYGEN)
5415 AC_DEFUN([AC_FIND_BZIP2],
5417 AC_MSG_CHECKING([for bzDecompress in libbz2])
5418 AC_CACHE_VAL(ac_cv_lib_bzip2,
5420 AC_LANG_SAVE
5421 AC_LANG_CPLUSPLUS
5422 kde_save_LIBS="$LIBS"
5423 LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
5424 kde_save_CXXFLAGS="$CXXFLAGS"
5425 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
5426 AC_TRY_LINK(dnl
5428 #define BZ_NO_STDIO
5429 #include<bzlib.h>
5431             [ bz_stream s; (void) bzDecompress(&s); ],
5432             eval "ac_cv_lib_bzip2='-lbz2'",
5433             eval "ac_cv_lib_bzip2=no")
5434 LIBS="$kde_save_LIBS"
5435 CXXFLAGS="$kde_save_CXXFLAGS"
5436 AC_LANG_RESTORE
5437 ])dnl
5438 AC_MSG_RESULT($ac_cv_lib_bzip2)
5440 if test ! "$ac_cv_lib_bzip2" = no; then
5441   BZIP2DIR=bzip2
5443   LIBBZ2="$ac_cv_lib_bzip2"
5444   AC_SUBST(LIBBZ2)
5446 else
5448    cxx_shared_flag=
5449    ld_shared_flag=
5450    KDE_CHECK_COMPILER_FLAG(shared, [
5451         ld_shared_flag="-shared"
5452    ])
5453    KDE_CHECK_COMPILER_FLAG(fPIC, [
5454         cxx_shared_flag="-fPIC"
5455    ])
5457    AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
5458    AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
5459    [
5460    AC_LANG_SAVE
5461    AC_LANG_CPLUSPLUS
5462    kde_save_LIBS="$LIBS"
5463    LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
5464    kde_save_CXXFLAGS="$CXXFLAGS"
5465    CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
5467    AC_TRY_LINK(dnl
5468    [
5469    #define BZ_NO_STDIO
5470    #include<bzlib.h>
5471    ],
5472                [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
5473                eval "ac_cv_lib_bzip2_prefix='-lbz2'",
5474                eval "ac_cv_lib_bzip2_prefix=no")
5475    LIBS="$kde_save_LIBS"
5476    CXXFLAGS="$kde_save_CXXFLAGS"
5477    AC_LANG_RESTORE
5478    ])dnl
5480    AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
5482    if test ! "$ac_cv_lib_bzip2_prefix" = no; then
5483      BZIP2DIR=bzip2
5485      LIBBZ2="$ac_cv_lib_bzip2_prefix"
5486      AC_SUBST(LIBBZ2)
5488      AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
5489    dnl else, we just ignore this
5490    fi
5493 AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
5496 dnl ------------------------------------------------------------------------
5497 dnl Try to find the SSL headers and libraries.
5498 dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
5499 dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
5500 dnl ------------------------------------------------------------------------
5502 AC_DEFUN([KDE_CHECK_SSL],
5504 LIBSSL="-lssl -lcrypto"
5505 AC_REQUIRE([KDE_CHECK_LIB64])
5507 ac_ssl_includes=NO ac_ssl_libraries=NO
5508 ssl_libraries=""
5509 ssl_includes=""
5510 AC_ARG_WITH(ssl-dir,
5511     AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]),
5512     [  ac_ssl_includes="$withval"/include
5513        ac_ssl_libraries="$withval"/lib$kdelibsuff
5514     ])
5516 want_ssl=yes
5517 AC_ARG_WITH(ssl,
5518     AC_HELP_STRING([--without-ssl],[disable SSL checks]),
5519     [want_ssl=$withval])
5521 if test $want_ssl = yes; then
5523 AC_MSG_CHECKING(for OpenSSL)
5525 AC_CACHE_VAL(ac_cv_have_ssl,
5526 [#try to guess OpenSSL locations
5528   ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
5529   ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
5530   AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
5531   ac_ssl_includes="$ssl_incdir"
5533   ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs"
5534   if test ! "$ac_ssl_libraries" = "NO"; then
5535     ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
5536   fi
5538   test=NONE
5539   ssl_libdir=NONE
5540   for dir in $ssl_libdirs; do
5541     try="ls -1 $dir/libssl*"
5542     if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
5543   done
5545   ac_ssl_libraries="$ssl_libdir"
5547   ac_ldflags_safe="$LDFLAGS"
5548   ac_libs_safe="$LIBS"
5550   LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
5551   LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
5553   AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
5554   ac_ssl_rsaref="yes"
5555   ,
5556   ac_ssl_rsaref="no"
5557   )
5559   LDFLAGS="$ac_ldflags_safe"
5560   LIBS="$ac_libs_safe"
5562   if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
5563     have_ssl=no
5564   else
5565     have_ssl=yes;
5566   fi
5568   ])
5570   eval "$ac_cv_have_ssl"
5572   AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
5574   AC_MSG_CHECKING([whether OpenSSL uses rsaref])
5575   AC_MSG_RESULT($ac_ssl_rsaref)
5577   AC_MSG_CHECKING([for easter eggs])
5578   AC_MSG_RESULT([none found])
5580 else
5581   have_ssl=no
5584 if test "$have_ssl" = yes; then
5585   AC_MSG_CHECKING(for OpenSSL version)
5586   dnl Check for SSL version
5587   AC_CACHE_VAL(ac_cv_ssl_version,
5588   [
5590     cat >conftest.$ac_ext <<EOF
5591 #include <openssl/opensslv.h>
5592 #include <stdio.h>
5593     int main() {
5595 #ifndef OPENSSL_VERSION_NUMBER
5596       printf("ssl_version=\\"error\\"\n");
5597 #else
5598       if (OPENSSL_VERSION_NUMBER < 0x00906000)
5599         printf("ssl_version=\\"old\\"\n");
5600       else
5601         printf("ssl_version=\\"ok\\"\n");
5602 #endif
5603      return (0);
5604     }
5607     ac_save_CPPFLAGS=$CPPFLAGS
5608     if test "$ac_ssl_includes" != "/usr/include"; then
5609         CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
5610     fi
5612     if AC_TRY_EVAL(ac_link); then
5614       if eval `./conftest 2>&5`; then
5615         if test $ssl_version = error; then
5616           AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
5617         else
5618           if test $ssl_version = old; then
5619             AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
5620             have_ssl=no
5621           fi
5622         fi
5623         ac_cv_ssl_version="ssl_version=$ssl_version"
5624       else
5625         AC_MSG_ERROR([Your system couldn't run a small SSL test program.
5626         Check config.log, and if you can't figure it out, send a mail to
5627         David Faure <faure@kde.org>, attaching your config.log])
5628       fi
5630     else
5631       AC_MSG_ERROR([Your system couldn't link a small SSL test program.
5632       Check config.log, and if you can't figure it out, send a mail to
5633       David Faure <faure@kde.org>, attaching your config.log])
5634     fi
5635     CPPFLAGS=$ac_save_CPPFLAGS
5637   ])
5639   eval "$ac_cv_ssl_version"
5640   AC_MSG_RESULT($ssl_version)
5643 if test "$have_ssl" != yes; then
5644   LIBSSL="";
5645 else
5646   AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
5647   ac_cv_have_ssl="have_ssl=yes \
5648     ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
5651   ssl_libraries="$ac_ssl_libraries"
5652   ssl_includes="$ac_ssl_includes"
5654   if test "$ac_ssl_rsaref" = yes; then
5655     LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref"
5656   fi
5658   if test $ssl_version = "old"; then
5659     AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
5660   fi
5663 SSL_INCLUDES=
5665 if test "$ssl_includes" = "/usr/include"; then
5666   if test -f /usr/kerberos/include/krb5.h; then
5667         SSL_INCLUDES="-I/usr/kerberos/include"
5668   fi
5669 elif test  "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
5670   SSL_INCLUDES="-I$ssl_includes"
5673 if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
5674  SSL_LDFLAGS=""
5675 else
5676  SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
5679 AC_SUBST(SSL_INCLUDES)
5680 AC_SUBST(SSL_LDFLAGS)
5681 AC_SUBST(LIBSSL)
5684 AC_DEFUN([KDE_CHECK_STRLCPY],
5686   AC_REQUIRE([AC_CHECK_STRLCAT])
5687   AC_REQUIRE([AC_CHECK_STRLCPY])
5688   AC_CHECK_SIZEOF(size_t)
5689   AC_CHECK_SIZEOF(unsigned long)
5691   AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
5692   AC_TRY_COMPILE(,[
5693     #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
5694        choke me
5695     #endif
5696     ],AC_MSG_RESULT([yes]),[
5697       AC_MSG_RESULT(no)
5698       AC_MSG_ERROR([
5699        Apparently on your system our assumption sizeof size_t == sizeof unsigned long
5700        does not apply. Please mail kde-devel@kde.org with a description of your system!
5701       ])
5702   ])
5705 AC_DEFUN([KDE_CHECK_BINUTILS],
5707   AC_MSG_CHECKING([if ld supports unversioned version maps])
5709   kde_save_LDFLAGS="$LDFLAGS"
5710   LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
5711   echo "{ local: extern \"C++\" { foo }; };" > conftest.map
5712   AC_TRY_LINK([int foo;],
5714 #ifdef __INTEL_COMPILER
5715 icc apparently does not support libtools version-info and version-script
5716 at the same time. Dunno where the bug is, but until somebody figured out,
5717 better disable the optional version scripts.
5718 #endif
5720   foo = 42;
5721 ], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
5722   LDFLAGS="$kde_save_LDFLAGS"
5723   rm -f conftest.map
5724   AM_CONDITIONAL(include_VERSION_SCRIPT,
5725     [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
5727   AC_MSG_RESULT($kde_supports_versionmaps)
5730 AC_DEFUN([AM_PROG_OBJC],[
5731 AC_CHECK_PROGS(OBJC, gcc, gcc)
5732 test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
5733 if test "x${OBJCFLAGS-unset}" = xunset; then
5734    OBJCFLAGS="-g -O2"
5736 AC_SUBST(OBJCFLAGS)
5737 _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
5740 AC_DEFUN([KDE_CHECK_PERL],
5742         KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
5743                     AC_MSG_ERROR([No Perl found in your $PATH.
5744 We need perl to generate some code.])
5745         ])
5746     AC_SUBST(PERL)
5749 AC_DEFUN([KDE_CHECK_LARGEFILE],
5751 AC_SYS_LARGEFILE
5752 if test "$ac_cv_sys_file_offset_bits" != no; then
5753   CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5756 if test "x$ac_cv_sys_large_files" != "xno"; then
5757   CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1"
5762 dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in)
5763 dnl which allows to search for libs that get installed into the KDE prefix.
5765 dnl Syntax:  KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not)
5766 dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page
5767 dnl also defines KSTUFF_PKG_ERRORS on error
5768 AC_DEFUN([KDE_PKG_CHECK_MODULES], [
5770    PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
5771    if test "$prefix" != "$kde_libs_prefix"; then
5772        PKG_CONFIG_PATH="$kde_libs_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
5773    fi
5774    export PKG_CONFIG_PATH
5775    PKG_CHECK_MODULES($1,$2,$3,$4)