Merge with version 2.0.
[kdbg.git] / admin / acinclude.m4.in
blob033cd339b73565e82ead77a6769b050128679210
1 ##   -*- autoconf -*-
3 dnl    This file is part of the KDE libraries/packages
4 dnl    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
5 dnl              (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
7 dnl    This file is free software; you can redistribute it and/or
8 dnl    modify it under the terms of the GNU Library General Public
9 dnl    License as published by the Free Software Foundation; either
10 dnl    version 2 of the License, or (at your option) any later version.
12 dnl    This library is distributed in the hope that it will be useful,
13 dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 dnl    Library General Public License for more details.
17 dnl    You should have received a copy of the GNU Library General Public License
18 dnl    along with this library; see the file COPYING.LIB.  If not, write to
19 dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 dnl    Boston, MA 02111-1307, USA.
22 dnl IMPORTANT NOTE:
23 dnl Please do not modify this file unless you expect your modifications to be
24 dnl carried into every other module in the repository. 
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(, [${x_direct_test_function}()],
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(programm-name, variable-name, list of directories,
177 dnl     if-not-found, test-parameter)
178 AC_DEFUN([KDE_FIND_PATH],
180    AC_MSG_CHECKING([for $1])
181    if test -n "$$2"; then
182         kde_cv_path="$$2";
183    else
184         kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
186         AC_CACHE_VAL(kde_cv_path_$kde_cache,
187         [
188         kde_cv_path="NONE"
189         dirs="$3"
190         kde_save_IFS=$IFS
191         IFS=':'
192         for dir in $PATH; do
193           dirs="$dirs $dir"
194         done
195         IFS=$kde_save_IFS
197         for dir in $dirs; do
198           if test -x "$dir/$1"; then
199             if test -n "$5"
200             then
201               evalstr="$dir/$1 $5 2>&1 "
202               if eval $evalstr; then
203                 kde_cv_path="$dir/$1"
204                 break
205               fi
206             else
207                 kde_cv_path="$dir/$1"
208                 break
209             fi
210           fi
211         done
213         eval "kde_cv_path_$kde_cache=$kde_cv_path"
215         ])
217       eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
219    fi
221    if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
222       AC_MSG_RESULT(not found)
223       $4
224    else
225       AC_MSG_RESULT($kde_cv_path)
226       $2=$kde_cv_path
228    fi
231 AC_DEFUN([KDE_MOC_ERROR_MESSAGE],
233     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
234 Please check whether you installed Qt correctly.
235 You need to have a running moc binary.
236 configure tried to run $ac_cv_path_moc and the test didn't
237 succeed. If configure shouldn't have tried this one, set
238 the environment variable MOC to the right one before running
239 configure.
243 AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
245     AC_MSG_WARN([No Qt ui compiler (uic) found!
246 Please check whether you installed Qt correctly.
247 You need to have a running uic binary.
248 configure tried to run $ac_cv_path_uic and the test didn't
249 succeed. If configure shouldn't have tried this one, set
250 the environment variable UIC to the right one before running
251 configure.
256 AC_DEFUN([KDE_CHECK_UIC_FLAG],
258     AC_MSG_CHECKING([whether uic supports -$1 ])
259     kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
260     AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
261     [
262         cat >conftest.ui <<EOT
263         <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
265         ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null"
266         if AC_TRY_EVAL(ac_uic_testrun); then
267             eval "kde_cv_prog_uic_$kde_cache=yes"
268         else
269             eval "kde_cv_prog_uic_$kde_cache=no"
270         fi
271         rm -f conftest*
272     ])
274     if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
275         AC_MSG_RESULT([yes])
276         :
277         $3
278     else
279         AC_MSG_RESULT([no])
280         :
281         $4
282     fi
286 dnl ------------------------------------------------------------------------
287 dnl Find the meta object compiler and the ui compiler in the PATH,
288 dnl in $QTDIR/bin, and some more usual places
289 dnl ------------------------------------------------------------------------
291 AC_DEFUN([AC_PATH_QT_MOC_UIC],
293    AC_REQUIRE([KDE_CHECK_PERL])
294    qt_bindirs=""
295    for dir in $kde_qt_dirs; do
296       qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
297    done
298    qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
299    if test ! "$ac_qt_bindir" = "NO"; then
300       qt_bindirs="$ac_qt_bindir $qt_bindirs"
301    fi
303    KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
304    if test -z "$UIC_NOT_NEEDED"; then
305      KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""])
306      if test -z "$UIC_PATH" ; then
307        KDE_UIC_ERROR_MESSAGE
308        exit 1
309      else
310        UIC=$UIC_PATH
312        if test $kde_qtver = 3; then
313          KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
314          KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
316          if test x$ac_uic_supports_libpath = xyes; then
317              UIC="$UIC -L \$(kde_widgetdir)"
318          fi
319          if test x$ac_uic_supports_nounload = xyes; then
320              UIC="$UIC -nounload"
321          fi
322        fi
323      fi
324    else
325      UIC="echo uic not available: "
326    fi
328    AC_SUBST(MOC)
329    AC_SUBST(UIC)
331    UIC_TR="i18n"
332    if test $kde_qtver = 3; then
333      UIC_TR="tr2i18n"
334    fi
336    AC_SUBST(UIC_TR)
339 AC_DEFUN([KDE_1_CHECK_PATHS],
341   KDE_1_CHECK_PATH_HEADERS
343   KDE_TEST_RPATH=
345   if test -n "$USE_RPATH"; then
347      if test -n "$kde_libraries"; then
348        KDE_TEST_RPATH="-R $kde_libraries"
349      fi
351      if test -n "$qt_libraries"; then
352        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
353      fi
355      if test -n "$x_libraries"; then
356        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
357      fi
359      KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
360   fi
362 AC_MSG_CHECKING([for KDE libraries installed])
363 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'
365 if AC_TRY_EVAL(ac_link) && test -s conftest; then
366   AC_MSG_RESULT(yes)
367 else
368   AC_MSG_ERROR([your system fails at linking a small KDE application!
369 Check, if your compiler is installed correctly and if you have used the
370 same compiler to compile Qt and kdelibs as you did use now.
371 For more details about this problem, look at the end of config.log.])
374 if eval `KDEDIR= ./conftest 2>&5`; then
375   kde_result=done
376 else
377   kde_result=problems
380 KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
381 kde_have_all_paths=yes
383 KDE_SET_PATHS($kde_result)
387 AC_DEFUN([KDE_SET_PATHS],
389   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
390         kde_htmldir=\"$kde_htmldir\" \
391         kde_appsdir=\"$kde_appsdir\" \
392         kde_icondir=\"$kde_icondir\" \
393         kde_sounddir=\"$kde_sounddir\" \
394         kde_datadir=\"$kde_datadir\" \
395         kde_locale=\"$kde_locale\" \
396         kde_cgidir=\"$kde_cgidir\" \
397         kde_confdir=\"$kde_confdir\" \
398         kde_kcfgdir=\"$kde_kcfgdir\" \
399         kde_mimedir=\"$kde_mimedir\" \
400         kde_toolbardir=\"$kde_toolbardir\" \
401         kde_wallpaperdir=\"$kde_wallpaperdir\" \
402         kde_templatesdir=\"$kde_templatesdir\" \
403         kde_bindir=\"$kde_bindir\" \
404         kde_servicesdir=\"$kde_servicesdir\" \
405         kde_servicetypesdir=\"$kde_servicetypesdir\" \
406         kde_moduledir=\"$kde_moduledir\" \
407         kde_styledir=\"$kde_styledir\" \
408         kde_widgetdir=\"$kde_widgetdir\" \
409         xdg_appsdir=\"$xdg_appsdir\" \
410         xdg_menudir=\"$xdg_menudir\" \
411         xdg_directorydir=\"$xdg_directorydir\" \
412         kde_result=$1"
415 AC_DEFUN([KDE_SET_DEFAULT_PATHS],
417 if test "$1" = "default"; then
419   if test -z "$kde_htmldir"; then
420     kde_htmldir='\${datadir}/doc/HTML'
421   fi
422   if test -z "$kde_appsdir"; then
423     kde_appsdir='\${datadir}/applnk'
424   fi
425   if test -z "$kde_icondir"; then
426     kde_icondir='\${datadir}/icons'
427   fi
428   if test -z "$kde_sounddir"; then
429     kde_sounddir='\${datadir}/sounds'
430   fi
431   if test -z "$kde_datadir"; then
432     kde_datadir='\${datadir}/apps'
433   fi
434   if test -z "$kde_locale"; then
435     kde_locale='\${datadir}/locale'
436   fi
437   if test -z "$kde_cgidir"; then
438     kde_cgidir='\${exec_prefix}/cgi-bin'
439   fi
440   if test -z "$kde_confdir"; then
441     kde_confdir='\${datadir}/config'
442   fi
443   if test -z "$kde_kcfgdir"; then
444     kde_kcfgdir='\${datadir}/config.kcfg'
445   fi
446   if test -z "$kde_mimedir"; then
447     kde_mimedir='\${datadir}/mimelnk'
448   fi
449   if test -z "$kde_toolbardir"; then
450     kde_toolbardir='\${datadir}/toolbar'
451   fi
452   if test -z "$kde_wallpaperdir"; then
453     kde_wallpaperdir='\${datadir}/wallpapers'
454   fi
455   if test -z "$kde_templatesdir"; then
456     kde_templatesdir='\${datadir}/templates'
457   fi
458   if test -z "$kde_bindir"; then
459     kde_bindir='\${exec_prefix}/bin'
460   fi
461   if test -z "$kde_servicesdir"; then
462     kde_servicesdir='\${datadir}/services'
463   fi
464   if test -z "$kde_servicetypesdir"; then
465     kde_servicetypesdir='\${datadir}/servicetypes'
466   fi
467   if test -z "$kde_moduledir"; then
468     if test "$kde_qtver" = "2"; then
469       kde_moduledir='\${libdir}/kde2'
470     else
471       kde_moduledir='\${libdir}/kde3'
472     fi
473   fi
474   if test -z "$kde_styledir"; then
475     kde_styledir='\${libdir}/kde3/plugins/styles'
476   fi
477   if test -z "$kde_widgetdir"; then
478     kde_widgetdir='\${libdir}/kde3/plugins/designer'
479   fi
480   if test -z "$xdg_appsdir"; then
481     xdg_appsdir='\${datadir}/applications/kde'
482   fi
483   if test -z "$xdg_menudir"; then
484     xdg_menudir='\${sysconfdir}/xdg/menus'
485   fi
486   if test -z "$xdg_directorydir"; then
487     xdg_directorydir='\${datadir}/desktop-directories'
488   fi
490   KDE_SET_PATHS(defaults)
492 else
494   if test $kde_qtver = 1; then
495      AC_MSG_RESULT([compiling])
496      KDE_1_CHECK_PATHS
497   else
498      AC_MSG_ERROR([path checking not yet supported for KDE 2])
499   fi
504 AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS],
505 [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
506    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
507    test -z "$kde_datadir" || test -z "$kde_locale"  ||
508    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
509    test -z "$kde_kcfgdir" ||
510    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
511    test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
512    test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
513    test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
514    test -z "$kde_styledir" || test -z "kde_widgetdir" ||
515    test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" ||
516    test "x$kde_have_all_paths" != "xyes"; then
517      kde_have_all_paths=no
518   fi
521 AC_DEFUN([KDE_MISSING_PROG_ERROR],
523     AC_MSG_ERROR([The important program $1 was not found!
524 Please check whether you installed KDE correctly.
528 AC_DEFUN([KDE_MISSING_ARTS_ERROR],
530     AC_MSG_ERROR([The important program $1 was not found!
531 Please check whether you installed aRts correctly or use
532 --without-arts to compile without aRts support (this will remove functionality).
536 AC_DEFUN([KDE_SUBST_PROGRAMS],
538     AC_ARG_WITH(arts,
539         [  --without-arts          build without aRts [default=yes] ],
540         [build_arts=$withval],
541         [build_arts=yes]
542     )
543     AM_CONDITIONAL(include_ARTS, test "$build_arts" != "no")
545         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"
546         test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs"
547         if test -n "$KDEDIRS"; then
548            kde_save_IFS=$IFS
549            IFS=:
550            for dir in $KDEDIRS; do
551                 kde_default_bindirs="$dir/bin $kde_default_bindirs "
552            done
553            IFS=$kde_save_IFS
554         fi
555         kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
556         KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
557         KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
558         if test "$build_arts" != "no"; then
559           KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)])
560           KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
561         fi
562         KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs])
563         KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
565         kde32ornewer=1
566         if test "$kde_qtver" -lt 3; then
567             kde32ornewer=
568         else
569             if test "$kde_qtver" = "3" && test "$kde_qtsubver" -le 1; then
570                 kde32ornewer=
571             fi
572         fi
574         if test -n "$kde32ornewer"; then
575             KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)])
576             KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)])
577         fi
578         KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [XMLLINT=""])
580         if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then  
581             kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
582             test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
583             AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
584             if test "$KDE_XSL_STYLESHEET" = "NO"; then
585                 KDE_XSL_STYLESHEET=""
586             else
587                 KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl"
588             fi
589         fi
591         DCOP_DEPENDENCIES='$(DCOPIDL)'
592         if test -n "$kde32ornewer"; then
593             KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)'
594             DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)'
595             AC_SUBST(KCONFIG_COMPILER)
596             AC_SUBST(KCFG_DEPENDENCIES)
597             AC_SUBST(DCOPIDLNG)
598         fi
599         AC_SUBST(DCOPIDL)
600         AC_SUBST(DCOPIDL2CPP)
601         AC_SUBST(DCOP_DEPENDENCIES)
602         AC_SUBST(MCOPIDL)
603         AC_SUBST(ARTSCCONFIG)
604         AC_SUBST(KDECONFIG)
605         AC_SUBST(MEINPROC)
606         AC_SUBST(KDE_XSL_STYLESHEET)
607         AC_SUBST(XMLLINT)
609         if test -x "$KDECONFIG"; then # it can be "compiled"
610           kde_libs_prefix=`$KDECONFIG --prefix`
611           if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
612                AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
613                           This means it has been moved since you installed it.
614                           This won't work. Please recompile kdelibs for the new prefix.
615                           ])
616            fi
617            kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
618         else
619            kde_libs_prefix='$(prefix)'
620            kde_libs_htmldir='$(kde_htmldir)'
621         fi
622         AC_SUBST(kde_libs_prefix)
623         AC_SUBST(kde_libs_htmldir)
624 ])dnl
626 AC_DEFUN([AC_CREATE_KFSSTND],
628 AC_REQUIRE([AC_CHECK_RPATH])
630 AC_MSG_CHECKING([for KDE paths])
631 kde_result=""
632 kde_cached_paths=yes
633 AC_CACHE_VAL(kde_cv_all_paths,
635   KDE_SET_DEFAULT_PATHS($1)
636   kde_cached_paths=no
638 eval "$kde_cv_all_paths"
639 KDE_CHECK_PATHS_FOR_COMPLETENESS
640 if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
641   # wrong values were cached, may be, we can set better ones
642   kde_result=
643   kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
644   kde_datadir= kde_locale=  kde_cgidir=  kde_confdir= kde_kcfgdir=
645   kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
646   kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
647   kde_have_all_paths=
648   kde_styledir=
649   kde_widgetdir=
650   xdg_appsdir = xdg_menudir= xdg_directorydir= 
651   KDE_SET_DEFAULT_PATHS($1)
652   eval "$kde_cv_all_paths"
653   KDE_CHECK_PATHS_FOR_COMPLETENESS
654   kde_result="$kde_result (cache overridden)"
656 if test "$kde_have_all_paths" = "no"; then
657   AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
658 Since it had compiled and linked before, it must be a strange problem on your system.
659 Look at config.log for details. If you are not able to fix this, look at
660 http://www.kde.org/faq/installation.html or any www.kde.org mirror.
661 (If you're using an egcs version on Linux, you may update binutils!)
663 else
664   rm -f conftest*
665   AC_MSG_RESULT($kde_result)
668 bindir=$kde_bindir
670 KDE_SUBST_PROGRAMS
674 AC_DEFUN([AC_SUBST_KFSSTND],
676 AC_SUBST(kde_htmldir)
677 AC_SUBST(kde_appsdir)
678 AC_SUBST(kde_icondir)
679 AC_SUBST(kde_sounddir)
680 AC_SUBST(kde_datadir)
681 AC_SUBST(kde_locale)
682 AC_SUBST(kde_confdir)
683 AC_SUBST(kde_kcfgdir)
684 AC_SUBST(kde_mimedir)
685 AC_SUBST(kde_wallpaperdir)
686 AC_SUBST(kde_bindir)
687 dnl X Desktop Group standards
688 AC_SUBST(xdg_appsdir)
689 AC_SUBST(xdg_menudir)
690 AC_SUBST(xdg_directorydir)
691 dnl for KDE 2
692 AC_SUBST(kde_templatesdir)
693 AC_SUBST(kde_servicesdir)
694 AC_SUBST(kde_servicetypesdir)
695 AC_SUBST(kde_moduledir)
696 AC_SUBST(kdeinitdir, '$(kde_moduledir)')
697 AC_SUBST(kde_styledir)
698 AC_SUBST(kde_widgetdir)
699 if test "$kde_qtver" = 1; then
700   kde_minidir="$kde_icondir/mini"
701 else
702 # for KDE 1 - this breaks KDE2 apps using minidir, but
703 # that's the plan ;-/
704   kde_minidir="/dev/null"
706 dnl AC_SUBST(kde_minidir)
707 dnl AC_SUBST(kde_cgidir)
708 dnl AC_SUBST(kde_toolbardir)
711 AC_DEFUN([KDE_MISC_TESTS],
713    dnl Checks for libraries.
714    AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD 
715    AC_SUBST(LIBUTIL)
716    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
717    AC_SUBST(LIBCOMPAT)
718    kde_have_crypt=
719    AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
720       AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
721         AC_MSG_WARN([you have no crypt in either libcrypt or libc.
722 You should install libcrypt from another source or configure with PAM
723 support])
724         kde_have_crypt=no
725       ]))
726    AC_SUBST(LIBCRYPT)
727    if test $kde_have_crypt = yes; then
728       AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
729    fi
730    AC_CHECK_SOCKLEN_T
731    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
732    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
733       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
734         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
735    fi
736    AC_CHECK_FUNC(inet_ntoa)
737    if test $ac_cv_func_inet_ntoa = no; then
738      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
739    fi
740    AC_CHECK_FUNC(connect)
741    if test $ac_cv_func_connect = no; then
742       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
743         $X_EXTRA_LIBS)
744    fi
746    AC_CHECK_FUNC(remove)
747    if test $ac_cv_func_remove = no; then
748       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
749    fi
751    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
752    AC_CHECK_FUNC(shmat, ,
753      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
754    
755    # more headers that need to be explicitly included on darwin
756    AC_CHECK_HEADERS(sys/types.h stdint.h)
758    # darwin requires a poll emulation library
759    AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll")
761    # CoreAudio framework
762    AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [
763      AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API])
764      FRAMEWORK_COREAUDIO="-Xlinker -framework -Xlinker CoreAudio"
765    ])
767    AC_CHECK_RES_INIT
768    AC_SUBST(LIB_POLL)
769    AC_SUBST(FRAMEWORK_COREAUDIO)
770    LIBSOCKET="$X_EXTRA_LIBS"
771    AC_SUBST(LIBSOCKET)
772    AC_SUBST(X_EXTRA_LIBS)
773    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
774    AC_SUBST(LIBUCB)
776    case $host in  dnl this *is* LynxOS specific
777    *-*-lynxos* )
778         AC_MSG_CHECKING([LynxOS header file wrappers])
779         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
780         AC_MSG_RESULT(disabled)
781         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
782          ;;
783     esac
785    KDE_CHECK_TYPES
786    KDE_CHECK_LIBDL
787    KDE_CHECK_STRLCPY
789 # darwin needs this to initialize the environment
790 AC_CHECK_HEADERS(crt_externs.h)
791 AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
793 AH_VERBATIM(_DARWIN_ENVIRON,
795 #if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
796 # include <sys/time.h>
797 # include <crt_externs.h>
798 # define environ (*_NSGetEnviron())
799 #endif
802 AH_VERBATIM(_AIX_STRINGS_H_BZERO,
805  * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
806  * that defines bzero.
807  */
809 #if defined(_AIX)
810 #include <strings.h>
811 #endif
814 AC_CHECK_FUNCS([vsnprintf snprintf])
816 AH_VERBATIM(_TRU64,[
818  * On HP-UX, the declaration of vsnprintf() is needed every time !
819  */
821 #if !defined(HAVE_VSNPRINTF) || defined(hpux)
822 #if __STDC__
823 #include <stdarg.h>
824 #include <stdlib.h>
825 #else
826 #include <varargs.h>
827 #endif
828 #ifdef __cplusplus
829 extern "C"
830 #endif
831 int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
832 #ifdef __cplusplus
833 extern "C"
834 #endif
835 int snprintf(char *str, size_t n, char const *fmt, ...);
836 #endif
841 dnl ------------------------------------------------------------------------
842 dnl Find the header files and libraries for X-Windows. Extended the
843 dnl macro AC_PATH_X
844 dnl ------------------------------------------------------------------------
846 AC_DEFUN([K_PATH_X],
848 AC_REQUIRE([KDE_MISC_TESTS])dnl
849 AC_REQUIRE([KDE_CHECK_LIB64])
851 AC_ARG_ENABLE(
852   embedded,
853   [  --enable-embedded       link to Qt-embedded, don't use X],
854   kde_use_qt_emb=$enableval,
855   kde_use_qt_emb=no
858 AC_ARG_ENABLE(
859   qtopia,
860   [  --enable-qtopia         link to Qt-embedded, link to the Qtopia Environment],
861   kde_use_qt_emb_palm=$enableval,
862   kde_use_qt_emb_palm=no
865 AC_ARG_ENABLE(
866   mac,
867   [  --enable-mac            link to Qt/Mac (don't use X)],
868   kde_use_qt_mac=$enableval,
869   kde_use_qt_mac=no
872 if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then
874 AC_MSG_CHECKING(for X)
876 AC_CACHE_VAL(kde_cv_have_x,
877 [# One or both of the vars are not set, and there is no cached value.
878 if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
879    kde_x_includes=NO
880 else
881    kde_x_includes=$x_includes
883 if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
884    kde_x_libraries=NO
885 else
886    kde_x_libraries=$x_libraries
889 # below we use the standard autoconf calls
890 ac_x_libraries=$kde_x_libraries
891 ac_x_includes=$kde_x_includes
893 KDE_PATH_X_DIRECT
894 dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
895 dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
896 dnl location. The correct location is /usr/lib32 or an undefined value
897 dnl (the linker is smart enough to pick the correct default library).
898 dnl Things work just fine if you use just AC_PATH_X_DIRECT.
899 dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
900 dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
901 dnl x_includes should be left alone.
902 case "$host" in
903 mips-sgi-irix6*)
904   ;;
905 *-*-solaris*)
906   ;;
908   _AC_PATH_X_XMKMF
909   if test -z "$ac_x_includes"; then
910     ac_x_includes="."
911   fi
912   if test -z "$ac_x_libraries"; then
913     ac_x_libraries="/usr/lib${kdelibsuff}"
914   fi
915 esac
916 #from now on we use our own again
918 # when the user already gave --x-includes, we ignore
919 # what the standard autoconf macros told us.
920 if test "$kde_x_includes" = NO; then
921   kde_x_includes=$ac_x_includes
924 # for --x-libraries too
925 if test "$kde_x_libraries" = NO; then
926   kde_x_libraries=$ac_x_libraries
929 if test "$kde_x_includes" = NO; then
930   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
933 if test "$kde_x_libraries" = NO; then
934   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
937 # Record where we found X for the cache.
938 kde_cv_have_x="have_x=yes \
939          kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
940 ])dnl
942 eval "$kde_cv_have_x"
944 if test "$have_x" != yes; then
945   AC_MSG_RESULT($have_x)
946   no_x=yes
947 else
948   AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
951 if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
952   X_INCLUDES=""
953   x_includes="."; dnl better than nothing :-
954  else
955   x_includes=$kde_x_includes
956   X_INCLUDES="-I$x_includes"
959 if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
960   X_LDFLAGS=""
961   x_libraries="/usr/lib"; dnl better than nothing :-
962  else
963   x_libraries=$kde_x_libraries
964   X_LDFLAGS="-L$x_libraries"
966 all_includes="$X_INCLUDES"
967 all_libraries="$X_LDFLAGS"
969 # Check for libraries that X11R6 Xt/Xaw programs need.
970 ac_save_LDFLAGS="$LDFLAGS"
971 LDFLAGS="$LDFLAGS $X_LDFLAGS"
972 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
973 # check for ICE first), but we must link in the order -lSM -lICE or
974 # we get undefined symbols.  So assume we have SM if we have ICE.
975 # These have to be linked with before -lX11, unlike the other
976 # libraries we check for below, so use a different variable.
977 #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
978 AC_CHECK_LIB(ICE, IceConnectionNumber,
979   [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
980 LDFLAGS="$ac_save_LDFLAGS"
982 LIB_X11='-lX11 $(LIBSOCKET)'
984 AC_MSG_CHECKING(for libXext)
985 AC_CACHE_VAL(kde_cv_have_libXext,
987 kde_ldflags_safe="$LDFLAGS"
988 kde_libs_safe="$LIBS"
990 LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
991 LIBS="-lXext -lX11 $LIBSOCKET"
993 AC_TRY_LINK([
994 #include <stdio.h>
995 #ifdef STDC_HEADERS
996 # include <stdlib.h>
997 #endif
1000 printf("hello Xext\n");
1002 kde_cv_have_libXext=yes,
1003 kde_cv_have_libXext=no
1006 LDFLAGS=$kde_ldflags_safe
1007 LIBS=$kde_libs_safe
1010 AC_MSG_RESULT($kde_cv_have_libXext)
1012 if test "$kde_cv_have_libXext" = "no"; then
1013   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
1014 can't find it itself, we stop here assuming that make wouldn't find
1015 them either.])
1018 LIB_XEXT="-lXext"
1019 QTE_NORTTI=""
1021 elif test "$kde_use_qt_emb" = "yes"; then
1022   dnl We're using QT Embedded
1023   CPPFLAGS=-DQWS
1024   CXXFLAGS="$CXXFLAGS -fno-rtti"
1025   QTE_NORTTI="-fno-rtti -DQWS"
1026   X_PRE_LIBS=""
1027   LIB_X11=""
1028   LIB_XEXT=""
1029   LIB_XRENDER=""
1030   LIBSM=""
1031   X_INCLUDES=""
1032   X_LDFLAGS=""
1033   x_includes=""
1034   x_libraries=""
1035 elif test "$kde_use_qt_mac" = "yes"; then
1036   dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to
1037   dnl be included to get the information) --Sam
1038   CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
1039   CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
1040   X_PRE_LIBS=""
1041   LIB_X11=""
1042   LIB_XEXT=""
1043   LIB_XRENDER=""
1044   LIBSM=""
1045   X_INCLUDES=""
1046   X_LDFLAGS=""
1047   x_includes=""
1048   x_libraries=""
1050 AC_SUBST(X_PRE_LIBS)
1051 AC_SUBST(LIB_X11)
1052 AC_SUBST(LIB_XRENDER)
1053 AC_SUBST(LIBSM)
1054 AC_SUBST(X_INCLUDES)
1055 AC_SUBST(X_LDFLAGS)
1056 AC_SUBST(x_includes)
1057 AC_SUBST(x_libraries)
1058 AC_SUBST(QTE_NORTTI)
1059 AC_SUBST(LIB_XEXT)
1063 AC_DEFUN([KDE_PRINT_QT_PROGRAM],
1065 AC_REQUIRE([KDE_USE_QT])
1066 cat > conftest.$ac_ext <<EOF
1067 #include "confdefs.h"
1068 #include <qglobal.h>
1069 #include <qapplication.h>
1071 if test "$kde_qtver" = "2"; then
1072 cat >> conftest.$ac_ext <<EOF
1073 #include <qevent.h>
1074 #include <qstring.h>
1075 #include <qstyle.h>
1078 if test $kde_qtsubver -gt 0; then
1079 cat >> conftest.$ac_ext <<EOF
1080 #if QT_VERSION < 210
1081 #error 1
1082 #endif
1087 if test "$kde_qtver" = "3"; then
1088 cat >> conftest.$ac_ext <<EOF
1089 #include <qcursor.h>
1090 #include <qstylefactory.h>
1091 #include <private/qucomextra_p.h>
1095 echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
1096 cat >> conftest.$ac_ext <<EOF
1097 #error 1
1098 #endif
1100 int main() {
1102 if test "$kde_qtver" = "2"; then
1103 cat >> conftest.$ac_ext <<EOF
1104     QStringList *t = new QStringList();
1105     Q_UNUSED(t);
1107 if test $kde_qtsubver -gt 0; then
1108 cat >> conftest.$ac_ext <<EOF
1109     QString s;
1110     s.setLatin1("Elvis is alive", 14);
1114 if test "$kde_qtver" = "3"; then
1115 cat >> conftest.$ac_ext <<EOF
1116     (void)QStyleFactory::create(QString::null);
1117     QCursor c(Qt::WhatsThisCursor);
1120 cat >> conftest.$ac_ext <<EOF
1121     return 0;
1126 AC_DEFUN([KDE_USE_QT],
1128 if test -z "$1"; then
1129   # Current default Qt version: 3.2
1130   kde_qtver=3
1131   kde_qtsubver=2
1132 else
1133   kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
1134   # following is the check if subversion isnt found in passed argument
1135   if test "$kde_qtsubver" = "$1"; then
1136     kde_qtsubver=1
1137   fi
1138   kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
1139   if test "$kde_qtver" = "1"; then
1140     kde_qtsubver=42
1141   fi
1144 if test -z "$2"; then
1145   if test "$kde_qtver" = "2"; then
1146     if test $kde_qtsubver -gt 0; then
1147       kde_qt_minversion=">= Qt 2.2.2"
1148     else
1149       kde_qt_minversion=">= Qt 2.0.2"
1150     fi
1151   fi
1152   if test "$kde_qtver" = "3"; then
1153     if test $kde_qtsubver -gt 0; then
1154          if test $kde_qtsubver -gt 1; then
1155             kde_qt_minversion=">= Qt 3.2"
1156          else
1157             kde_qt_minversion=">= Qt 3.1 (20021021)"
1158          fi
1159     else
1160       kde_qt_minversion=">= Qt 3.0"
1161     fi
1162   fi
1163   if test "$kde_qtver" = "1"; then
1164     kde_qt_minversion=">= 1.42 and < 2.0"
1165   fi
1166 else
1167    kde_qt_minversion=$2
1170 if test -z "$3"; then
1171    if test $kde_qtver = 3; then
1172      if test $kde_qtsubver -gt 0; then
1173        kde_qt_verstring="QT_VERSION >= 0x03@VER@00"
1174        qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
1175        kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
1176      else
1177        kde_qt_verstring="QT_VERSION >= 300"
1178      fi
1179    fi
1180    if test $kde_qtver = 2; then
1181      if test $kde_qtsubver -gt 0; then
1182        kde_qt_verstring="QT_VERSION >= 222"
1183      else
1184        kde_qt_verstring="QT_VERSION >= 200"
1185      fi
1186    fi
1187    if test $kde_qtver = 1; then
1188     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
1189    fi
1190 else
1191    kde_qt_verstring=$3
1194 if test $kde_qtver = 3; then
1195   kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3"
1197 if test $kde_qtver = 2; then
1198    kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
1200 if test $kde_qtver = 1; then
1201    kde_qt_dirs="$QTDIR /usr/lib/qt"
1205 AC_DEFUN([KDE_CHECK_QT_DIRECT],
1207 AC_REQUIRE([KDE_USE_QT])
1208 AC_MSG_CHECKING([if Qt compiles without flags])
1209 AC_CACHE_VAL(kde_cv_qt_direct,
1211 AC_LANG_SAVE
1212 AC_LANG_CPLUSPLUS
1213 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
1214 ac_LIBRARY_PATH="$LIBRARY_PATH"
1215 ac_cxxflags_safe="$CXXFLAGS"
1216 ac_ldflags_safe="$LDFLAGS"
1217 ac_libs_safe="$LIBS"
1219 CXXFLAGS="$CXXFLAGS -I$qt_includes"
1220 LDFLAGS="$LDFLAGS $X_LDFLAGS"
1221 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1222 LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
1223 else
1224 LIBS="$LIBQT $LIBSOCKET"
1226 LD_LIBRARY_PATH=
1227 export LD_LIBRARY_PATH
1228 LIBRARY_PATH=
1229 export LIBRARY_PATH
1231 KDE_PRINT_QT_PROGRAM
1233 if AC_TRY_EVAL(ac_link) && test -s conftest; then
1234   kde_cv_qt_direct="yes"
1235 else
1236   kde_cv_qt_direct="no"
1237   echo "configure: failed program was:" >&AC_FD_CC
1238   cat conftest.$ac_ext >&AC_FD_CC
1241 rm -f conftest*
1242 CXXFLAGS="$ac_cxxflags_safe"
1243 LDFLAGS="$ac_ldflags_safe"
1244 LIBS="$ac_libs_safe"
1246 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
1247 export LD_LIBRARY_PATH
1248 LIBRARY_PATH="$ac_LIBRARY_PATH"
1249 export LIBRARY_PATH
1250 AC_LANG_RESTORE
1253 if test "$kde_cv_qt_direct" = "yes"; then
1254   AC_MSG_RESULT(yes)
1255   $1
1256 else
1257   AC_MSG_RESULT(no)
1258   $2
1262 dnl ------------------------------------------------------------------------
1263 dnl Try to find the Qt headers and libraries.
1264 dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
1265 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
1266 dnl ------------------------------------------------------------------------
1268 AC_DEFUN([AC_PATH_QT_1_3],
1270 AC_REQUIRE([K_PATH_X])
1271 AC_REQUIRE([KDE_USE_QT])
1272 AC_REQUIRE([KDE_CHECK_LIB64])
1274 dnl ------------------------------------------------------------------------
1275 dnl Add configure flag to enable linking to MT version of Qt library.
1276 dnl ------------------------------------------------------------------------
1278 AC_ARG_ENABLE(
1279   mt,
1280   [  --disable-mt            link to non-threaded Qt (deprecated)],
1281   kde_use_qt_mt=$enableval,
1282   [
1283     if test $kde_qtver = 3; then
1284       kde_use_qt_mt=yes
1285     else
1286       kde_use_qt_mt=no
1287     fi
1288   ]
1291 USING_QT_MT=""
1293 dnl ------------------------------------------------------------------------
1294 dnl If we not get --disable-qt-mt then adjust some vars for the host.
1295 dnl ------------------------------------------------------------------------
1297 KDE_MT_LDFLAGS=
1298 KDE_MT_LIBS=
1299 if test "x$kde_use_qt_mt" = "xyes"; then
1300   KDE_CHECK_THREADING
1301   if test "x$kde_use_threading" = "xyes"; then
1302     CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
1303     KDE_MT_LDFLAGS="$USE_THREADS"
1304     KDE_MT_LIBS="$LIBPTHREAD"
1305   else
1306     kde_use_qt_mt=no
1307   fi
1309 AC_SUBST(KDE_MT_LDFLAGS)
1310 AC_SUBST(KDE_MT_LIBS)
1312 kde_qt_was_given=yes
1314 dnl ------------------------------------------------------------------------
1315 dnl If we haven't been told how to link to Qt, we work it out for ourselves.
1316 dnl ------------------------------------------------------------------------
1317 if test -z "$LIBQT_GLOB"; then
1318   if test "x$kde_use_qt_emb" = "xyes"; then
1319     LIBQT_GLOB="libqte.*"
1320   else
1321     LIBQT_GLOB="libqt.*"
1322   fi
1325 if test -z "$LIBQT"; then
1326 dnl ------------------------------------------------------------
1327 dnl If we got --enable-embedded then adjust the Qt library name.
1328 dnl ------------------------------------------------------------
1329   if test "x$kde_use_qt_emb" = "xyes"; then
1330     qtlib="qte"
1331   else
1332     qtlib="qt"
1333   fi
1335   kde_int_qt="-l$qtlib"
1336 else
1337   kde_int_qt="$LIBQT"
1338   kde_lib_qt_set=yes
1341 if test -z "$LIBQPE"; then
1342 dnl ------------------------------------------------------------
1343 dnl If we got --enable-palmtop then add -lqpe to the link line
1344 dnl ------------------------------------------------------------
1345   if test "x$kde_use_qt_emb" = "xyes"; then
1346     if test "x$kde_use_qt_emb_palm" = "xyes"; then
1347       LIB_QPE="-lqpe"
1348     else
1349       LIB_QPE=""
1350     fi
1351   else
1352     LIB_QPE=""
1353   fi
1356 dnl ------------------------------------------------------------------------
1357 dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
1358 dnl ------------------------------------------------------------------------
1360 if test "x$kde_use_qt_mt" = "xyes"; then
1361   if test -z "$LIBQT"; then
1362     LIBQT="-l$qtlib-mt"
1363     kde_int_qt="-l$qtlib-mt"
1364   else
1365     LIBQT="$qtlib-mt"
1366     kde_int_qt="$qtlib-mt"
1367   fi
1368   LIBQT_GLOB="lib$qtlib-mt.*"
1369   USING_QT_MT="using -mt"
1370 else
1371   LIBQT="-l$qtlib"
1374 if test $kde_qtver != 1; then
1376   AC_REQUIRE([AC_FIND_PNG])
1377   AC_REQUIRE([AC_FIND_JPEG])
1378   LIBQT="$LIBQT $LIBPNG $LIBJPEG"
1381 if test $kde_qtver = 3; then
1382   AC_REQUIRE([KDE_CHECK_LIBDL])
1383   LIBQT="$LIBQT $LIBDL"
1386 AC_MSG_CHECKING([for Qt])
1388 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1389 LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
1391 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
1392 qt_libraries=""
1393 qt_includes=""
1394 AC_ARG_WITH(qt-dir,
1395     [  --with-qt-dir=DIR       where the root of Qt is installed ],
1396     [  ac_qt_includes="$withval"/include
1397        ac_qt_libraries="$withval"/lib${kdelibsuff}
1398        ac_qt_bindir="$withval"/bin
1399     ])
1401 AC_ARG_WITH(qt-includes,
1402     [  --with-qt-includes=DIR  where the Qt includes are. ],
1403     [
1404        ac_qt_includes="$withval"
1405     ])
1407 kde_qt_libs_given=no
1409 AC_ARG_WITH(qt-libraries,
1410     [  --with-qt-libraries=DIR where the Qt library is installed.],
1411     [  ac_qt_libraries="$withval"
1412        kde_qt_libs_given=yes
1413     ])
1415 AC_CACHE_VAL(ac_cv_have_qt,
1416 [#try to guess Qt locations
1418 qt_incdirs=""
1419 for dir in $kde_qt_dirs; do
1420    qt_incdirs="$qt_incdirs $dir/include $dir"
1421 done
1422 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"
1423 if test ! "$ac_qt_includes" = "NO"; then
1424    qt_incdirs="$ac_qt_includes $qt_incdirs"
1427 if test "$kde_qtver" != "1"; then
1428   kde_qt_header=qstyle.h
1429 else
1430   kde_qt_header=qglobal.h
1433 AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
1434 ac_qt_includes="$qt_incdir"
1436 qt_libdirs=""
1437 for dir in $kde_qt_dirs; do
1438    qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir"
1439 done
1440 qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
1441 if test ! "$ac_qt_libraries" = "NO"; then
1442   qt_libdir=$ac_qt_libraries
1443 else
1444   qt_libdirs="$ac_qt_libraries $qt_libdirs"
1445   # if the Qt was given, the chance is too big that libqt.* doesn't exist
1446   qt_libdir=NONE
1447   for dir in $qt_libdirs; do
1448     try="ls -1 $dir/${LIBQT_GLOB}"
1449     if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
1450   done
1452 for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
1453   if test -e "$a"; then
1454     LIBQT="$LIBQT ${kde_int_qt}_incremental"
1455     break
1456   fi
1457 done
1459 ac_qt_libraries="$qt_libdir"
1461 AC_LANG_SAVE
1462 AC_LANG_CPLUSPLUS
1464 ac_cxxflags_safe="$CXXFLAGS"
1465 ac_ldflags_safe="$LDFLAGS"
1466 ac_libs_safe="$LIBS"
1468 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
1469 LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
1470 LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
1472 KDE_PRINT_QT_PROGRAM
1474 if AC_TRY_EVAL(ac_link) && test -s conftest; then
1475   rm -f conftest*
1476 else
1477   echo "configure: failed program was:" >&AC_FD_CC
1478   cat conftest.$ac_ext >&AC_FD_CC
1479   ac_qt_libraries="NO"
1481 rm -f conftest*
1482 CXXFLAGS="$ac_cxxflags_safe"
1483 LDFLAGS="$ac_ldflags_safe"
1484 LIBS="$ac_libs_safe"
1486 AC_LANG_RESTORE
1487 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
1488   ac_cv_have_qt="have_qt=no"
1489   ac_qt_notfound=""
1490   missing_qt_mt=""
1491   if test "$ac_qt_includes" = NO; then
1492     if test "$ac_qt_libraries" = NO; then
1493       ac_qt_notfound="(headers and libraries)";
1494     else
1495       ac_qt_notfound="(headers)";
1496     fi
1497   else
1498     if test "x$kde_use_qt_mt" = "xyes"; then
1499        missing_qt_mt="
1500 Make sure that you have compiled Qt with thread support!"
1501        ac_qt_notfound="(library $qtlib-mt)";
1502     else
1503        ac_qt_notfound="(library $qtlib)";
1504     fi
1505   fi
1507   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
1508 For more details about this problem, look at the end of config.log.$missing_qt_mt])
1509 else
1510   have_qt="yes"
1514 eval "$ac_cv_have_qt"
1516 if test "$have_qt" != yes; then
1517   AC_MSG_RESULT([$have_qt]);
1518 else
1519   ac_cv_have_qt="have_qt=yes \
1520     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
1521   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
1523   qt_libraries="$ac_qt_libraries"
1524   qt_includes="$ac_qt_includes"
1527 if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
1528      KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
1531 AC_SUBST(qt_libraries)
1532 AC_SUBST(qt_includes)
1534 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
1535  QT_INCLUDES=""
1536 else
1537  QT_INCLUDES="-I$qt_includes"
1538  all_includes="$QT_INCLUDES $all_includes"
1541 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
1542  QT_LDFLAGS=""
1543 else
1544  QT_LDFLAGS="-L$qt_libraries"
1545  all_libraries="$all_libraries $QT_LDFLAGS"
1547 test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
1549 AC_SUBST(QT_INCLUDES)
1550 AC_SUBST(QT_LDFLAGS)
1551 AC_PATH_QT_MOC_UIC
1553 KDE_CHECK_QT_JPEG
1555 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1556 LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
1557 else
1558 LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
1560 test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
1561 for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
1562   if test -e "$a"; then
1563      LIB_QT="$LIB_QT ${kde_int_qt}_incremental"
1564      break
1565   fi
1566 done
1568 AC_SUBST(LIB_QT)
1569 AC_SUBST(LIB_QPE)
1571 AC_SUBST(kde_qtver)
1574 AC_DEFUN([AC_PATH_QT],
1576 AC_PATH_QT_1_3
1579 AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
1581 AC_REQUIRE([AC_PATH_QT_MOC_UIC])
1583 if test x$ac_uic_supports_libpath = xyes; then
1585 AC_MSG_CHECKING([if UIC has KDE plugins available])
1586 AC_CACHE_VAL(kde_cv_uic_plugins,
1588 cat > actest.ui << EOF
1589 <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
1590 <class>NewConnectionDialog</class>
1591 <widget class="QDialog">
1592    <widget class="KLineEdit">
1593         <property name="name">
1594            <cstring>testInput</cstring>
1595         </property>
1596    </widget>
1597 </widget>
1598 </UI>
1600        
1603 kde_cv_uic_plugins=no
1604 kde_line="$UIC_PATH -L $kde_widgetdir"
1605 if test x$ac_uic_supports_nounload = xyes; then
1606    kde_line="$kde_line -nounload"
1608 kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
1609 if AC_TRY_EVAL(kde_line); then
1610         # if you're trying to debug this check and think it's incorrect,
1611         # better check your installation. The check _is_ correct - your
1612         # installation is not.
1613         if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
1614                 kde_cv_uic_plugins=yes
1615         fi
1617 rm -f actest.ui actest.cpp
1620 AC_MSG_RESULT([$kde_cv_uic_plugins])
1621 if test "$kde_cv_uic_plugins" != yes; then
1622         AC_MSG_ERROR([you need to install kdelibs first.])
1627 AC_DEFUN([KDE_CHECK_FINAL],
1629   AC_ARG_ENABLE(final, [  --enable-final          build size optimized apps (experimental - needs lots of memory)],
1630         kde_use_final=$enableval, kde_use_final=no)
1632   if test "x$kde_use_final" = "xyes"; then
1633       KDE_USE_FINAL_TRUE=""
1634       KDE_USE_FINAL_FALSE="#"
1635    else
1636       KDE_USE_FINAL_TRUE="#"
1637       KDE_USE_FINAL_FALSE=""
1638   fi
1639   AC_SUBST(KDE_USE_FINAL_TRUE)
1640   AC_SUBST(KDE_USE_FINAL_FALSE)
1643 AC_DEFUN([KDE_CHECK_CLOSURE],
1645   AC_ARG_ENABLE(closure, [  --enable-closure        delay template instantiation],
1646         kde_use_closure=$enableval, kde_use_closure=no)
1648   KDE_NO_UNDEFINED=""
1649   if test "x$kde_use_closure" = "xyes"; then
1650        KDE_USE_CLOSURE_TRUE=""
1651        KDE_USE_CLOSURE_FALSE="#"
1652 #       CXXFLAGS="$CXXFLAGS $REPO"
1653   else
1654        KDE_USE_CLOSURE_TRUE="#"
1655        KDE_USE_CLOSURE_FALSE=""
1656        KDE_NO_UNDEFINED=""
1657        case $host in 
1658          *-*-linux-gnu)
1659            KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
1660                 [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
1661                 [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
1662                 [KDE_NO_UNDEFINED=""])],
1663             [KDE_NO_UNDEFINED=""])
1664            ;;
1665        esac
1666   fi
1667   AC_SUBST(KDE_USE_CLOSURE_TRUE)
1668   AC_SUBST(KDE_USE_CLOSURE_FALSE)
1669   AC_SUBST(KDE_NO_UNDEFINED)
1672 AC_DEFUN([KDE_CHECK_NMCHECK],
1674   AC_ARG_ENABLE(nmcheck, [  --enable-nmcheck        enable automatic namespace cleanness check],
1675         kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
1677   if test "$kde_use_nmcheck" = "yes"; then
1678       KDE_USE_NMCHECK_TRUE=""
1679       KDE_USE_NMCHECK_FALSE="#"
1680    else
1681       KDE_USE_NMCHECK_TRUE="#"
1682       KDE_USE_NMCHECK_FALSE=""
1683   fi
1684   AC_SUBST(KDE_USE_NMCHECK_TRUE)
1685   AC_SUBST(KDE_USE_NMCHECK_FALSE)
1688 AC_DEFUN([KDE_EXPAND_MAKEVAR], [
1689 savex=$exec_prefix
1690 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
1691 tmp=$$2
1692 while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
1693 exec_prefix=$savex
1696 dnl ------------------------------------------------------------------------
1697 dnl Now, the same with KDE
1698 dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
1699 dnl and $(kde_includes) will be the kdehdrlocation (if needed)
1700 dnl ------------------------------------------------------------------------
1702 AC_DEFUN([AC_BASE_PATH_KDE],
1704 AC_REQUIRE([KDE_CHECK_STL])
1705 AC_REQUIRE([AC_PATH_QT])dnl
1706 AC_REQUIRE([KDE_CHECK_LIB64])
1708 AC_CHECK_RPATH
1709 AC_MSG_CHECKING([for KDE])
1711 if test "${prefix}" != NONE; then
1712   kde_includes=${includedir}
1713   KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
1715   kde_libraries=${libdir}
1716   KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
1718 else
1719   ac_kde_includes=
1720   ac_kde_libraries=
1721   kde_libraries=""
1722   kde_includes=""
1725 AC_CACHE_VAL(ac_cv_have_kde,
1726 [#try to guess kde locations
1728 if test "$kde_qtver" = 1; then
1729   kde_check_header="ksock.h"
1730   kde_check_lib="libkdecore.la"
1731 else
1732   kde_check_header="ksharedptr.h"
1733   kde_check_lib="libkio.la"
1736 if test -z "$1"; then
1738 kde_incdirs="/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"
1739 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
1740 kde_incdirs="$ac_kde_includes $kde_incdirs"
1741 AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
1742 ac_kde_includes="$kde_incdir"
1744 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
1745   AC_MSG_ERROR([
1746 in the prefix, you've chosen, are no KDE headers installed. This will fail.
1747 So, check this please and use another prefix!])
1750 kde_libdirs="/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}"
1751 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
1752 kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
1753 AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
1754 ac_kde_libraries="$kde_libdir"
1756 kde_widgetdir=NO
1757 dnl this might be somewhere else
1758 AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
1760 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
1761 AC_MSG_ERROR([
1762 in the prefix, you've chosen, are no KDE libraries installed. This will fail.
1763 So, check this please and use another prefix!])
1766 if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then
1767 AC_MSG_ERROR([
1768 I can't find the designer plugins. These are required and should have been installed
1769 by kdelibs])
1772 if test -n "$kde_widgetdir"; then
1773     kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
1777 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
1778   ac_cv_have_kde="have_kde=no"
1779 else
1780   ac_cv_have_kde="have_kde=yes \
1781     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1784 else dnl test -z $1
1786   ac_cv_have_kde="have_kde=no"
1789 ])dnl
1791 eval "$ac_cv_have_kde"
1793 if test "$have_kde" != "yes"; then
1794  if test "${prefix}" = NONE; then
1795   ac_kde_prefix="$ac_default_prefix"
1796  else
1797   ac_kde_prefix="$prefix"
1798  fi
1799  if test "$exec_prefix" = NONE; then
1800   ac_kde_exec_prefix="$ac_kde_prefix"
1801   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
1802  else
1803   ac_kde_exec_prefix="$exec_prefix"
1804   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
1805  fi
1807  kde_libraries="${libdir}"
1808  kde_includes="${includedir}"
1810 else
1811   ac_cv_have_kde="have_kde=yes \
1812     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1813   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
1815   kde_libraries="$ac_kde_libraries"
1816   kde_includes="$ac_kde_includes"
1818 AC_SUBST(kde_libraries)
1819 AC_SUBST(kde_includes)
1821 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes"  || test "$kde_includes" = "/usr/include"; then
1822  KDE_INCLUDES=""
1823 else
1824  KDE_INCLUDES="-I$kde_includes"
1825  all_includes="$KDE_INCLUDES $all_includes"
1828 KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION"
1830 KDE_LDFLAGS="-L$kde_libraries"
1831 if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then 
1832  all_libraries="$all_libraries $KDE_LDFLAGS"
1835 AC_SUBST(KDE_LDFLAGS)
1836 AC_SUBST(KDE_INCLUDES)
1838 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1840 all_libraries="$all_libraries $USER_LDFLAGS"
1841 all_includes="$all_includes $USER_INCLUDES"
1842 AC_SUBST(all_includes)
1843 AC_SUBST(all_libraries)
1845 if test -z "$1"; then
1846 KDE_CHECK_UIC_PLUGINS
1849 ac_kde_libraries="$kde_libdir"
1851 AC_SUBST(AUTODIRS)
1856 AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
1858 AC_MSG_CHECKING(for extra includes)
1859 AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
1860                           adds non standard include paths],
1861   kde_use_extra_includes="$withval",
1862   kde_use_extra_includes=NONE
1864 kde_extra_includes=
1865 if test -n "$kde_use_extra_includes" && \
1866    test "$kde_use_extra_includes" != "NONE"; then
1868    ac_save_ifs=$IFS
1869    IFS=':'
1870    for dir in $kde_use_extra_includes; do
1871      kde_extra_includes="$kde_extra_includes $dir"
1872      USER_INCLUDES="$USER_INCLUDES -I$dir"
1873    done
1874    IFS=$ac_save_ifs
1875    kde_use_extra_includes="added"
1876 else
1877    kde_use_extra_includes="no"
1879 AC_SUBST(USER_INCLUDES)
1881 AC_MSG_RESULT($kde_use_extra_includes)
1883 kde_extra_libs=
1884 AC_MSG_CHECKING(for extra libs)
1885 AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths],
1886   kde_use_extra_libs=$withval,
1887   kde_use_extra_libs=NONE
1889 if test -n "$kde_use_extra_libs" && \
1890    test "$kde_use_extra_libs" != "NONE"; then
1892    ac_save_ifs=$IFS
1893    IFS=':'
1894    for dir in $kde_use_extra_libs; do
1895      kde_extra_libs="$kde_extra_libs $dir"
1896      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
1897      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
1898    done
1899    IFS=$ac_save_ifs
1900    kde_use_extra_libs="added"
1901 else
1902    kde_use_extra_libs="no"
1905 AC_SUBST(USER_LDFLAGS)
1907 AC_MSG_RESULT($kde_use_extra_libs)
1911 AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
1913     AC_MSG_CHECKING([for KDE headers installed])
1914     AC_LANG_SAVE
1915     AC_LANG_CPLUSPLUS
1916 cat > conftest.$ac_ext <<EOF
1917 #ifdef STDC_HEADERS
1918 # include <stdlib.h>
1919 #endif
1920 #include <stdio.h>
1921 #include "confdefs.h"
1922 #include <kapp.h>
1924 int main() {
1925     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
1926     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
1927     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
1928     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
1929     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
1930     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
1931     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
1932     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
1933     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
1934     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
1935     printf("kde_wallpaperdir=\\"%s\\"\n",
1936         KApplication::kde_wallpaperdir().data());
1937     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
1938     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
1939     printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
1940     printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
1941     printf("kde_moduledir=\\"/tmp/dummy\\"\n");
1942     printf("kde_styledir=\\"/tmp/dummy\\"\n");
1943     printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
1944     printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
1945     printf("xdg_menudir=\\"/tmp/dummy\\"\n");
1946     printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
1947     printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
1948     return 0;
1949     }
1952  ac_save_CPPFLAGS=$CPPFLAGS
1953  CPPFLAGS="$all_includes $CPPFLAGS"
1954  if AC_TRY_EVAL(ac_compile); then
1955    AC_MSG_RESULT(yes)
1956  else
1957    AC_MSG_ERROR([your system is not able to compile a small KDE application!
1958 Check, if you installed the KDE header files correctly.
1959 For more details about this problem, look at the end of config.log.])
1960   fi
1961   CPPFLAGS=$ac_save_CPPFLAGS
1963   AC_LANG_RESTORE
1966 AC_DEFUN([KDE_CHECK_KDEQTADDON],
1968 AC_MSG_CHECKING(for kde-qt-addon)
1969 AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
1971  kde_ldflags_safe="$LDFLAGS"
1972  kde_libs_safe="$LIBS"
1973  kde_cxxflags_safe="$CXXFLAGS"
1975  LIBS="-lkde-qt-addon $LIBQT $LIBS"
1976  CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
1977  LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
1979  AC_TRY_LINK([
1980    #include <qdom.h>
1981  ],
1983    QDomDocument doc;
1984  ],
1985   kde_cv_have_kdeqtaddon=yes,
1986   kde_cv_have_kdeqtaddon=no
1989  LDFLAGS=$kde_ldflags_safe
1990  LIBS=$kde_libs_safe
1991  CXXFLAGS=$kde_cxxflags_safe
1994 AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
1996 if test "$kde_cv_have_kdeqtaddon" = "no"; then
1997   AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
1998 It is a separate package (and CVS module) named kde-qt-addon.])
2002 AC_DEFUN([KDE_CHECK_KIMGIO],
2004    AC_REQUIRE([AC_BASE_PATH_KDE])
2005    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2006    AC_REQUIRE([AC_FIND_TIFF])
2007    AC_REQUIRE([AC_FIND_JPEG])
2008    AC_REQUIRE([AC_FIND_PNG])
2009    AC_REQUIRE([AC_FIND_JASPER])
2010    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
2012    if test "$1" = "existence"; then
2013      AC_LANG_SAVE
2014      AC_LANG_CPLUSPLUS
2015      kde_save_LIBS="$LIBS"
2016      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
2017      AC_CHECK_LIB(kimgio, kimgioRegister, [
2018       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
2019      LIBS="$kde_save_LIBS"
2020      AC_LANG_RESTORE
2021    else
2022      LIBKIMGIO_EXISTS=yes
2023    fi
2025    if test "$LIBKIMGIO_EXISTS" = "yes"; then
2026      LIB_KIMGIO='-lkimgio'
2027    else
2028      LIB_KIMGIO=''
2029    fi
2030    AC_SUBST(LIB_KIMGIO)
2033 AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
2035    AC_REQUIRE([KDE_MISC_TESTS])
2036    AC_REQUIRE([KDE_CHECK_LIBDL])
2037    AC_REQUIRE([K_PATH_X])
2039 if test $kde_qtver = 3; then
2040    AC_SUBST(LIB_KDECORE, "-lkdecore")
2041    AC_SUBST(LIB_KDEUI, "-lkdeui")
2042    AC_SUBST(LIB_KIO, "-lkio")
2043    AC_SUBST(LIB_SMB, "-lsmb")
2044    AC_SUBST(LIB_KAB, "-lkab")
2045    AC_SUBST(LIB_KABC, "-lkabc")
2046    AC_SUBST(LIB_KHTML, "-lkhtml")
2047    AC_SUBST(LIB_KSPELL, "-lkspell")
2048    AC_SUBST(LIB_KPARTS, "-lkparts")
2049    AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
2050    AC_SUBST(LIB_KUTILS, "-lkutils")
2051    AC_SUBST(LIB_KDEPIM, "-lkdepim")
2052 # these are for backward compatibility
2053    AC_SUBST(LIB_KSYCOCA, "-lkio")
2054    AC_SUBST(LIB_KFILE, "-lkio")
2055 elif test $kde_qtver = 2; then
2056    AC_SUBST(LIB_KDECORE, "-lkdecore")
2057    AC_SUBST(LIB_KDEUI, "-lkdeui")
2058    AC_SUBST(LIB_KIO, "-lkio")
2059    AC_SUBST(LIB_KSYCOCA, "-lksycoca")
2060    AC_SUBST(LIB_SMB, "-lsmb")
2061    AC_SUBST(LIB_KFILE, "-lkfile")
2062    AC_SUBST(LIB_KAB, "-lkab")
2063    AC_SUBST(LIB_KHTML, "-lkhtml")
2064    AC_SUBST(LIB_KSPELL, "-lkspell")
2065    AC_SUBST(LIB_KPARTS, "-lkparts")
2066    AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
2067 else
2068    AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)")
2069    AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)")
2070    AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)")
2071    AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)")
2072    AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")
2076 AC_DEFUN([AC_PATH_KDE],
2078   AC_BASE_PATH_KDE
2079   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
2080   [
2081   if test "$enableval" = "no";
2082     then ac_use_path_checking="default"
2083     else ac_use_path_checking=""
2084   fi
2085   ],
2086   [
2087   if test "$kde_qtver" = 1;
2088     then ac_use_path_checking=""
2089     else ac_use_path_checking="default"
2090   fi
2091   ]
2092   )
2094   AC_CREATE_KFSSTND($ac_use_path_checking)
2096   AC_SUBST_KFSSTND
2097   KDE_CREATE_LIBS_ALIASES
2100 dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
2101 AC_DEFUN([KDE_CHECK_FUNC_EXT],
2103 AC_MSG_CHECKING(for $1)
2104 AC_CACHE_VAL(kde_cv_func_$1,
2106 AC_LANG_SAVE
2107 AC_LANG_CPLUSPLUS
2108 save_CXXFLAGS="$CXXFLAGS"
2109 kde_safe_LIBS="$LIBS"
2110 LIBS="$LIBS $X_EXTRA_LIBS"
2111 if test "$GXX" = "yes"; then
2112 CXXFLAGS="$CXXFLAGS -pedantic-errors"
2114 AC_TRY_COMPILE([
2120 kde_cv_func_$1=yes,
2121 kde_cv_func_$1=no)
2122 CXXFLAGS="$save_CXXFLAGS"
2123 LIBS="$kde_safe_LIBS"
2124 AC_LANG_RESTORE
2127 AC_MSG_RESULT($kde_cv_func_$1)
2129 AC_MSG_CHECKING([if $1 needs custom prototype])
2130 AC_CACHE_VAL(kde_cv_proto_$1,
2132 if test "x$kde_cv_func_$1" = xyes; then
2133   kde_cv_proto_$1=no
2134 else
2135   case "$1" in
2136         setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
2137                 kde_cv_proto_$1="yes - in libkdefakes"
2138                 ;;
2139         *)
2140                 kde_cv_proto_$1=unknown
2141                 ;;
2142   esac
2145 if test "x$kde_cv_proto_$1" = xunknown; then
2147 AC_LANG_SAVE
2148 AC_LANG_CPLUSPLUS
2149   kde_safe_libs=$LIBS
2150   LIBS="$LIBS $X_EXTRA_LIBS"
2151   AC_TRY_LINK([
2154 extern "C" $4;
2159 [ kde_cv_func_$1=yes
2160   kde_cv_proto_$1=yes ],
2161   [kde_cv_proto_$1="$1 unavailable"]
2163 LIBS=$kde_safe_libs
2164 AC_LANG_RESTORE
2167 AC_MSG_RESULT($kde_cv_proto_$1)
2169 if test "x$kde_cv_func_$1" = xyes; then
2170   AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
2171   $6
2173 if test "x$kde_cv_proto_$1" = xno; then
2174   AC_DEFINE(HAVE_$5_PROTO, 1,
2175   [Define if you have the $1 prototype])
2178 AH_VERBATIM([_HAVE_$5_PROTO],
2180 #if !defined(HAVE_$5_PROTO)
2181 #ifdef __cplusplus
2182 extern "C" {
2183 #endif
2185 #ifdef __cplusplus
2187 #endif
2188 #endif
2192 AC_DEFUN([AC_CHECK_SETENV],
2194         KDE_CHECK_FUNC_EXT(setenv, [
2195 #include <stdlib.h>
2196 ], 
2197                 [setenv("VAR", "VALUE", 1);],
2198                 [int setenv (const char *, const char *, int)],
2199                 [SETENV])
2202 AC_DEFUN([AC_CHECK_UNSETENV],
2204         KDE_CHECK_FUNC_EXT(unsetenv, [
2205 #include <stdlib.h>
2206 ], 
2207                 [unsetenv("VAR");],
2208                 [void unsetenv (const char *)],
2209                 [UNSETENV])
2212 AC_DEFUN([AC_CHECK_GETDOMAINNAME],
2214         KDE_CHECK_FUNC_EXT(getdomainname, [
2215 #include <stdlib.h>
2216 #include <unistd.h>
2217 #include <netdb.h>
2218 ], 
2219                 [
2220 char buffer[200];
2221 getdomainname(buffer, 200);
2222 ],      
2223                 [#include <sys/types.h>
2224                 int getdomainname (char *, size_t)],
2225                 [GETDOMAINNAME])
2228 AC_DEFUN([AC_CHECK_GETHOSTNAME],
2230         KDE_CHECK_FUNC_EXT(gethostname, [
2231 #include <stdlib.h>
2232 #include <unistd.h>
2233 ], 
2234                 [
2235 char buffer[200];
2236 gethostname(buffer, 200);
2237 ],      
2238                 [int gethostname (char *, unsigned int)],
2239                 [GETHOSTNAME])
2242 AC_DEFUN([AC_CHECK_USLEEP],
2244         KDE_CHECK_FUNC_EXT(usleep, [
2245 #include <unistd.h>
2246 ], 
2247                 [
2248 usleep(200);
2249 ],      
2250                 [int usleep (unsigned int)],
2251                 [USLEEP])
2255 AC_DEFUN([AC_CHECK_RANDOM],
2257         KDE_CHECK_FUNC_EXT(random, [
2258 #include <stdlib.h>
2259 ], 
2260                 [
2261 random();
2262 ],      
2263                 [long int random(void)],
2264                 [RANDOM])
2266         KDE_CHECK_FUNC_EXT(srandom, [
2267 #include <stdlib.h>
2268 ], 
2269                 [
2270 srandom(27);
2271 ],      
2272                 [void srandom(unsigned int)],
2273                 [SRANDOM])
2277 AC_DEFUN([AC_CHECK_INITGROUPS],
2279         KDE_CHECK_FUNC_EXT(initgroups, [
2280 #include <sys/types.h>
2281 #include <unistd.h>
2282 #include <grp.h>
2284         [
2285 char buffer[200];
2286 initgroups(buffer, 27);
2288         [int initgroups(const char *, gid_t)],
2289         [INITGROUPS])
2292 AC_DEFUN([AC_CHECK_MKSTEMPS],
2294         KDE_CHECK_FUNC_EXT(mkstemps, [
2295 #include <stdlib.h>
2296 #include <unistd.h>
2298         [
2299 mkstemps("/tmp/aaaXXXXXX", 6);
2301         [int mkstemps(char *, int)],
2302         [MKSTEMPS])
2305 AC_DEFUN([AC_CHECK_MKDTEMP],
2307         KDE_CHECK_FUNC_EXT(mkdtemp, [
2308 #include <stdlib.h>
2309 #include <unistd.h>
2311         [
2312 mkdtemp("/tmp/aaaXXXXXX");
2314         [char *mkdtemp(char *)],
2315         [MKDTEMP])
2319 AC_DEFUN([AC_CHECK_RES_INIT],
2321   AC_MSG_CHECKING([if res_init needs -lresolv])
2322   kde_libs_safe="$LIBS"
2323   LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
2324   AC_TRY_LINK(
2325     [
2326 #include <sys/types.h>
2327 #include <netinet/in.h>
2328 #include <arpa/nameser.h>
2329 #include <resolv.h>
2330     ],
2331     [
2332       res_init(); 
2333     ],
2334     [
2335       LIBRESOLV="-lresolv"
2336       AC_MSG_RESULT(yes)
2337       AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
2338     ],
2339     [ AC_MSG_RESULT(no) ]
2340   )
2341   LIBS=$kde_libs_safe
2342   AC_SUBST(LIBRESOLV)
2344   AC_MSG_CHECKING([if res_init is available])
2345   AC_TRY_COMPILE(
2346     [
2347 #include <sys/types.h>
2348 #include <netinet/in.h>
2349 #include <arpa/nameser.h>
2350 #include <resolv.h>
2351     ],
2352     [
2353       res_init();
2354     ],
2355     [
2356       AC_MSG_RESULT(yes)
2357       AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
2358     ],
2359     [ AC_MSG_RESULT(no) ]
2360   )
2363 AC_DEFUN([AC_CHECK_STRLCPY],
2365         KDE_CHECK_FUNC_EXT(strlcpy, [
2366 #include <string.h>
2368 [ char buf[20];
2369   strlcpy(buf, "KDE function test", sizeof(buf));
2371         [unsigned long strlcpy(char*, const char*, unsigned long)],
2372         [STRLCPY])
2375 AC_DEFUN([AC_CHECK_STRLCAT],
2377         KDE_CHECK_FUNC_EXT(strlcat, [
2378 #include <string.h>
2380 [ char buf[20];
2381   buf[0]='\0';
2382   strlcat(buf, "KDE function test", sizeof(buf));
2384         [unsigned long strlcat(char*, const char*, unsigned long)],
2385         [STRLCAT])
2388 AC_DEFUN([AC_FIND_GIF],
2389    [AC_MSG_CHECKING([for giflib])
2390 AC_CACHE_VAL(ac_cv_lib_gif,
2391 [ac_save_LIBS="$LIBS"
2392 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2393 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
2394 else
2395 LIBS="$all_libraries -lgif"
2397 AC_TRY_LINK(dnl
2399 #ifdef __cplusplus
2400 extern "C" {
2401 #endif
2402 int GifLastError(void);
2403 #ifdef __cplusplus
2405 #endif
2406 /* We use char because int might match the return type of a gcc2
2407     builtin and then its argument prototype would still apply.  */
2409             [return GifLastError();],
2410             eval "ac_cv_lib_gif=yes",
2411             eval "ac_cv_lib_gif=no")
2412 LIBS="$ac_save_LIBS"
2413 ])dnl
2414 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
2415   AC_MSG_RESULT(yes)
2416   AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
2417 else
2418   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
2422 AC_DEFUN([KDE_FIND_JPEG_HELPER],
2424 AC_MSG_CHECKING([for libjpeg$2])
2425 AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
2427 ac_save_LIBS="$LIBS"
2428 LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
2429 ac_save_CFLAGS="$CFLAGS"
2430 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2431 AC_TRY_LINK(
2432 [/* Override any gcc2 internal prototype to avoid an error.  */
2433 struct jpeg_decompress_struct;
2434 typedef struct jpeg_decompress_struct * j_decompress_ptr;
2435 typedef int size_t;
2436 #ifdef __cplusplus
2437 extern "C" {
2438 #endif
2439     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
2440                                     int version, size_t structsize);
2441 #ifdef __cplusplus
2443 #endif
2444 /* We use char because int might match the return type of a gcc2
2445     builtin and then its argument prototype would still apply.  */
2447             [jpeg_CreateDecompress(0L, 0, 0);],
2448             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
2449             eval "ac_cv_lib_jpeg_$1=no")
2450 LIBS="$ac_save_LIBS"
2451 CFLAGS="$ac_save_CFLAGS"
2454 if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
2455   LIBJPEG="$ac_cv_lib_jpeg_$1"
2456   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
2457 else
2458   AC_MSG_RESULT(no)
2459   $3
2464 AC_DEFUN([AC_FIND_JPEG],
2466 dnl first look for libraries
2467 KDE_FIND_JPEG_HELPER(6b, 6b,
2468    KDE_FIND_JPEG_HELPER(normal, [],
2469     [
2470        LIBJPEG=
2471     ]
2472    )
2475 dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
2476 dnl requires system dependent includes loaded before it)
2477 jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
2478 AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
2479 test "x$jpeg_incdir" = xNO && jpeg_incdir=
2481 dnl if headers _and_ libraries are missing, this is no error, and we
2482 dnl continue with a warning (the user will get no jpeg support in khtml)
2483 dnl if only one is missing, it means a configuration error, but we still
2484 dnl only warn
2485 if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
2486   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
2487 else
2488   if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
2489     AC_MSG_WARN([
2490 There is an installation error in jpeg support. You seem to have only one
2491 of either the headers _or_ the libraries installed. You may need to either
2492 provide correct --with-extra-... options, or the development package of
2493 libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
2494 Disabling JPEG support.
2496   else
2497     AC_MSG_WARN([libjpeg not found. disable JPEG support.])
2498   fi
2499   jpeg_incdir=
2500   LIBJPEG=
2503 AC_SUBST(LIBJPEG)
2504 AH_VERBATIM(_AC_CHECK_JPEG,
2506  * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
2507  * headers and I'm too lazy to write a configure test as long as only
2508  * unixware is related
2509  */
2510 #ifdef _UNIXWARE
2511 #define HAVE_BOOLEAN
2512 #endif
2516 AC_DEFUN([KDE_CHECK_QT_JPEG],
2518 if test -n "$LIBJPEG"; then
2519 AC_MSG_CHECKING([if Qt needs $LIBJPEG])
2520 AC_CACHE_VAL(kde_cv_qt_jpeg,
2522 AC_LANG_SAVE
2523 AC_LANG_CPLUSPLUS
2524 ac_save_LIBS="$LIBS"
2525 LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
2526 LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
2527 ac_save_CXXFLAGS="$CXXFLAGS"
2528 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2529 AC_TRY_LINK(
2530 [#include <qapplication.h>],
2531             [
2532             int argc;
2533             char** argv;
2534             QApplication app(argc, argv);],
2535             eval "kde_cv_qt_jpeg=no",
2536             eval "kde_cv_qt_jpeg=yes")
2537 LIBS="$ac_save_LIBS"
2538 CXXFLAGS="$ac_save_CXXFLAGS"
2539 AC_LANG_RESTORE
2543 if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
2544   AC_MSG_RESULT(yes)
2545   LIBJPEG_QT='$(LIBJPEG)'
2546 else
2547   AC_MSG_RESULT(no)
2548   LIBJPEG_QT=
2553 AC_DEFUN([AC_FIND_ZLIB],
2555 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2556 AC_MSG_CHECKING([for libz])
2557 AC_CACHE_VAL(ac_cv_lib_z,
2559 kde_save_LIBS="$LIBS"
2560 LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
2561 kde_save_CFLAGS="$CFLAGS"
2562 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2563 AC_TRY_LINK(dnl
2565 #include<zlib.h>
2568   char buf[42];
2569   gzFile f = (gzFile) 0;
2570   /* this would segfault.. but we only link, don't run */
2571   (void) gzgets(f, buf, sizeof(buf));
2573   return (zlibVersion() == ZLIB_VERSION); 
2575             eval "ac_cv_lib_z='-lz'",
2576             eval "ac_cv_lib_z=no")
2577 LIBS="$kde_save_LIBS"
2578 CFLAGS="$kde_save_CFLAGS"
2579 ])dnl
2580 if test ! "$ac_cv_lib_z" = no; then
2581   AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
2582   LIBZ="$ac_cv_lib_z"
2583   AC_MSG_RESULT($ac_cv_lib_z)
2584 else
2585   AC_MSG_ERROR(not found. 
2586           Possibly configure picks up an outdated version
2587           installed by XFree86. Remove it from your system.
2589           Check your installation and look into config.log)
2590   LIBZ=""
2592 AC_SUBST(LIBZ)
2595 AC_DEFUN([KDE_TRY_TIFFLIB],
2597 AC_MSG_CHECKING([for libtiff $1])
2599 AC_CACHE_VAL(kde_cv_libtiff_$1,
2601 AC_LANG_SAVE
2602 AC_LANG_CPLUSPLUS
2603 kde_save_LIBS="$LIBS"
2604 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2605 LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
2606 else
2607 LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
2609 kde_save_CXXFLAGS="$CXXFLAGS"
2610 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2612 AC_TRY_LINK(dnl
2614 #include<tiffio.h>
2616     [return (TIFFOpen( "", "r") == 0); ],
2618     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
2619 ], [
2620     kde_cv_libtiff_$1=no
2623 LIBS="$kde_save_LIBS"
2624 CXXFLAGS="$kde_save_CXXFLAGS"
2625 AC_LANG_RESTORE
2628 if test "$kde_cv_libtiff_$1" = "no"; then
2629     AC_MSG_RESULT(no)
2630     LIBTIFF=""
2631     $3
2632 else
2633     LIBTIFF="$kde_cv_libtiff_$1"
2634     AC_MSG_RESULT(yes)
2635     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
2636     $2
2641 AC_DEFUN([AC_FIND_TIFF],
2643 AC_REQUIRE([K_PATH_X])
2644 AC_REQUIRE([AC_FIND_ZLIB])
2645 AC_REQUIRE([AC_FIND_JPEG])
2646 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2648 KDE_TRY_TIFFLIB(tiff, [],
2649    KDE_TRY_TIFFLIB(tiff34))
2651 AC_SUBST(LIBTIFF)
2655 AC_DEFUN([AC_FIND_PNG],
2657 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2658 AC_REQUIRE([AC_FIND_ZLIB])
2659 AC_MSG_CHECKING([for libpng])
2660 AC_CACHE_VAL(ac_cv_lib_png,
2662 kde_save_LIBS="$LIBS"
2663 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2664 LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
2665 else
2666 LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
2668 kde_save_CFLAGS="$CFLAGS"
2669 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2671 AC_TRY_LINK(dnl
2672     [
2673     #include<png.h>
2674     ],
2675     [
2676     png_structp png_ptr = png_create_read_struct(  /* image ptr */
2677                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
2678     return( png_ptr != 0 );
2679     ],
2680     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
2681     eval "ac_cv_lib_png=no"
2683 LIBS="$kde_save_LIBS"
2684 CFLAGS="$kde_save_CFLAGS"
2685 ])dnl
2686 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
2687   AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
2688   LIBPNG="$ac_cv_lib_png"
2689   AC_SUBST(LIBPNG)
2690   AC_MSG_RESULT($ac_cv_lib_png)
2691 else
2692   AC_MSG_RESULT(no)
2693   LIBPNG=""
2694   AC_SUBST(LIBPNG)
2699 AC_DEFUN([AC_FIND_JASPER],
2701 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2702 AC_REQUIRE([AC_FIND_JPEG])
2703 AC_MSG_CHECKING([for jasper])
2704 AC_CACHE_VAL(ac_cv_jasper,
2706 kde_save_LIBS="$LIBS"
2707 LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
2708 kde_save_CFLAGS="$CFLAGS"
2709 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2711 AC_TRY_LINK(dnl
2712     [
2713     #include<jasper/jasper.h>
2714     ],
2715     [
2716     return( jas_init() );
2717     ],
2718     eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
2719     eval "ac_cv_jasper=no"
2721 LIBS="$kde_save_LIBS"
2722 CFLAGS="$kde_save_CFLAGS"
2723 ])dnl
2724 if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
2725   AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
2726   LIB_JASPER="$ac_cv_jasper"
2727   AC_MSG_RESULT($ac_cv_jasper)
2728 else
2729   AC_MSG_RESULT(no)
2730   LIB_JASPER=""
2732 AC_SUBST(LIB_JASPER)
2735 AC_DEFUN([AC_CHECK_BOOL],
2737   AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
2740 AC_DEFUN([AC_CHECK_GNU_EXTENSIONS],
2742 AC_MSG_CHECKING(if you need GNU extensions)
2743 AC_CACHE_VAL(ac_cv_gnu_extensions,
2745 cat > conftest.c << EOF
2746 #include <features.h>
2748 #ifdef __GNU_LIBRARY__
2750 #endif
2753 if (eval "$ac_cpp conftest.c") 2>&5 |
2754   egrep "yes" >/dev/null 2>&1; then
2755   rm -rf conftest*
2756   ac_cv_gnu_extensions=yes
2757 else
2758   ac_cv_gnu_extensions=no
2762 AC_MSG_RESULT($ac_cv_gnu_extensions)
2763 if test "$ac_cv_gnu_extensions" = "yes"; then
2764   AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
2768 AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
2770 AC_MSG_CHECKING([whether $CXX supports -$1])
2771 kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
2772 AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
2774   AC_LANG_SAVE
2775   AC_LANG_CPLUSPLUS
2776   save_CXXFLAGS="$CXXFLAGS"
2777   CXXFLAGS="$CXXFLAGS -$1"
2778   AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
2779   CXXFLAGS="$save_CXXFLAGS"
2780   AC_LANG_RESTORE
2782 if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
2783  AC_MSG_RESULT(yes)
2785  $2
2786 else
2787  AC_MSG_RESULT(no)
2789  $3
2793 AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG],
2795 AC_MSG_CHECKING([whether $CC supports -$1])
2796 kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
2797 AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache,
2799   AC_LANG_SAVE
2800   AC_LANG_C
2801   save_CFLAGS="$CFLAGS"
2802   CFLAGS="$CFLAGS -$1"
2803   AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], [])
2804   CFLAGS="$save_CFLAGS"
2805   AC_LANG_RESTORE
2807 if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then
2808  AC_MSG_RESULT(yes)
2810  $2
2811 else
2812  AC_MSG_RESULT(no)
2814  $3
2819 dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
2820 dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
2821 dnl it's all white-space separated
2822 AC_DEFUN([AC_REMOVE_FORBIDDEN],
2823 [ __val=$$1
2824   __forbid=" $2 "
2825   if test -n "$__val"; then
2826     __new=""
2827     ac_save_IFS=$IFS
2828     IFS="       "
2829     for i in $__val; do
2830       case "$__forbid" in
2831         *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
2832         *) # Careful to not add spaces, where there were none, because otherwise
2833            # libtool gets confused, if we change e.g. CXX
2834            if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
2835       esac
2836     done
2837     IFS=$ac_save_IFS
2838     $1=$__new
2839   fi
2842 dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
2843 AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
2844 [dnl
2845 if test "x$kde_use_qt_emb" != "xyes"; then
2846  AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
2847  AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
2848 else
2849  AC_REMOVE_FORBIDDEN(CXX, [-rpath])
2850  AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
2854 AC_DEFUN([AC_CHECK_COMPILERS],
2856   AC_ARG_ENABLE(debug,[  --enable-debug[=ARG]      enables debug symbols (yes|no|full) [default=no]],
2857   [
2858     case $enableval in
2859       yes)
2860         kde_use_debug_code="yes"
2861         kde_use_debug_define=no
2862         ;;
2863       full)
2864         kde_use_debug_code="full"
2865         kde_use_debug_define=no
2866         ;;
2867       *)
2868         kde_use_debug_code="no"
2869         kde_use_debug_define=yes
2870         ;;
2871     esac
2872   ], 
2873     [kde_use_debug_code="no"
2874       kde_use_debug_define=no
2875   ])
2877   dnl Just for configure --help
2878   AC_ARG_ENABLE(dummyoption,[  --disable-debug         disables debug output and debug symbols [default=no]],[],[])
2880   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
2881    [
2882     if test $enableval = "no"; then
2883          kde_use_strict_options="no"
2884        else
2885          kde_use_strict_options="yes"
2886     fi
2887    ], [kde_use_strict_options="no"])
2889   AC_ARG_ENABLE(warnings,[  --disable-warnings      disables compilation with -Wall and similiar],
2890    [
2891     if test $enableval = "no"; then
2892          kde_use_warnings="no"
2893        else
2894          kde_use_warnings="yes"
2895     fi
2896    ], [kde_use_warnings="yes"])
2898   dnl enable warnings for debug build
2899   if test "$kde_use_debug_code" != "no"; then
2900     kde_use_warnings=yes
2901   fi
2903   AC_ARG_ENABLE(profile,[  --enable-profile        creates profiling infos [default=no]],
2904     [kde_use_profiling=$enableval],
2905     [kde_use_profiling="no"]
2906   )
2908   dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
2909   CFLAGS=" $CFLAGS"
2911   AC_PROG_CC 
2913   AC_PROG_CPP
2915   if test "$GCC" = "yes"; then
2916     if test "$kde_use_debug_code" != "no"; then
2917       if test $kde_use_debug_code = "full"; then
2918         CFLAGS="-g3 -fno-inline $CFLAGS"
2919       else
2920         CFLAGS="-g -O2 $CFLAGS"
2921       fi
2922     else
2923       CFLAGS="-O2 $CFLAGS"
2924     fi
2925   fi
2927   if test "$kde_use_debug_define" = "yes"; then
2928     CFLAGS="-DNDEBUG $CFLAGS"
2929   fi
2932   case "$host" in
2933   *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
2934   *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
2935   esac
2937   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
2938      LDFLAGS=""
2939   fi
2941   CXXFLAGS=" $CXXFLAGS"
2943   AC_PROG_CXX
2945   if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
2946     if test "$kde_use_debug_code" != "no"; then
2947       if test "$CXX" = "KCC"; then
2948         CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
2949       else
2950         if test "$kde_use_debug_code" = "full"; then
2951           CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
2952         else
2953           CXXFLAGS="-g -O2 $CXXFLAGS"
2954         fi
2955       fi
2956       KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
2958       dnl convenience compiler flags
2959       KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
2960       AC_SUBST(WOVERLOADED_VIRTUAL)
2961     else
2962       if test "$CXX" = "KCC"; then
2963         CXXFLAGS="+K3 $CXXFLAGS"
2964       else
2965         CXXFLAGS="-O2 $CXXFLAGS"
2966       fi  
2967     fi
2968   fi
2970   if test "$kde_use_debug_define" = "yes"; then
2971     CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
2972   fi  
2974   if test "$kde_use_profiling" = "yes"; then
2975     KDE_CHECK_COMPILER_FLAG(pg,
2976     [
2977       CFLAGS="-pg $CFLAGS"
2978       CXXFLAGS="-pg $CXXFLAGS"
2979     ])
2980   fi
2982   if test "$kde_use_warnings" = "yes"; then
2983       if test "$GCC" = "yes"; then
2984         CXXFLAGS="-Wall -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
2985         case $host in
2986           *-*-linux-gnu)        
2987             CFLAGS="-ansi -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
2988             CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS"
2989             KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
2990             KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
2991           ;;
2992         esac
2993         KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
2994         KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
2995         KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"])
2996      fi
2997   fi
2999   if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
3000     CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
3001   fi
3002     
3003   if test "$GXX" = "yes"; then
3004     KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
3005     KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
3006     KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
3007     KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS=       )
3008   fi
3009   if test "$CXX" = "KCC"; then
3010     dnl unfortunately we currently cannot disable exception support in KCC
3011     dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
3012     dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
3013     dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS=   )
3015     AC_ARG_ENABLE(pch,[  --enable-pch            enables precompiled header support (currently only KCC) [default=no]],
3016     [
3017       kde_use_pch=$enableval
3018     ],[kde_use_pch=no])
3020     if test "$kde_use_pch" = "yes"; then
3021       dnl TODO: support --pch-dir!
3022       KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
3023       dnl the below works (but the dir must exist), but it's
3024       dnl useless for a whole package.
3025       dnl The are precompiled headers for each source file, so when compiling
3026       dnl from scratch, it doesn't make a difference, and they take up
3027       dnl around ~5Mb _per_ sourcefile.
3028       dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
3029       dnl   [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
3030     fi
3031     dnl this flag controls inlining. by default KCC inlines in optimisation mode
3032     dnl all implementations that are defined inside the class {} declaration. 
3033     dnl because of templates-compatibility with broken gcc compilers, this
3034     dnl can cause excessive inlining. This flag limits it to a sane level
3035     KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
3036     KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
3037     KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
3038     KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
3039     dnl Some source files are shared between multiple executables
3040     dnl (or libraries) and some of those need template instantiations.
3041     dnl In that case KCC needs to compile those sources with
3042     dnl --one_instantiation_per_object.  To make it easy for us we compile
3043     dnl _all_ objects with that flag (--one_per is a shorthand).
3044     KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
3045   fi
3046   AC_SUBST(USE_EXCEPTIONS)
3047   dnl obsolete macro - provided to keep things going
3048   USE_RTTI=
3049   AC_SUBST(USE_RTTI)
3051   case "$host" in
3052       *-*-irix*)  test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
3053       *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
3054       *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
3055       *-*-solaris*) 
3056         if test "$GXX" = yes; then
3057           libstdcpp=`$CXX -print-file-name=libstdc++.so`
3058           if test ! -f $libstdcpp; then
3059              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])
3060           fi
3061         fi
3062         ;;
3063   esac
3065   AC_VALIDIFY_CXXFLAGS
3067   AC_PROG_CXXCPP
3069   if test "$GCC" = yes; then
3070      NOOPT_CFLAGS=-O0
3071   fi
3072   KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
3074   AC_SUBST(NOOPT_CXXFLAGS)
3075   AC_SUBST(NOOPT_CFLAGS)
3077   KDE_CHECK_FINAL
3078   KDE_CHECK_CLOSURE
3079   KDE_CHECK_NMCHECK
3081   ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
3084 AC_DEFUN([KDE_ADD_DEPENDENCIES],
3086    [A]M_DEPENDENCIES(CC)
3087    [A]M_DEPENDENCIES(CXX)
3090 dnl just a wrapper to clean up configure.in
3091 AC_DEFUN([KDE_PROG_LIBTOOL],
3093 AC_REQUIRE([AC_CHECK_COMPILERS])
3094 AC_REQUIRE([AC_ENABLE_SHARED])
3095 AC_REQUIRE([AC_ENABLE_STATIC])
3097 AC_REQUIRE([AC_LIBTOOL_DLOPEN])
3098 AC_REQUIRE([KDE_CHECK_LIB64])
3100 AC_OBJEXT
3101 AC_EXEEXT
3103 AM_PROG_LIBTOOL
3104 AC_LIBTOOL_CXX
3106 LIBTOOL_SHELL="/bin/sh ./libtool"
3107 #  LIBTOOL="$LIBTOOL --silent"
3108 KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
3109 AC_SUBST(KDE_PLUGIN)
3111 # we patch configure quite some so we better keep that consistent for incremental runs 
3112 AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
3115 AC_DEFUN([KDE_CHECK_LIB64],
3117     kdelibsuff=no
3118     AC_ARG_ENABLE(libsuffix,
3119         AC_HELP_STRING([--enable-libsuffix],
3120             [/lib directory suffix (64,32,none[=default])]),
3121             kdelibsuff=$enableval)
3122     # TODO: add an auto case that compiles a little C app to check
3123     # where the glibc is
3124     if test "$kdelibsuff" = "no"; then
3125        kdelibsuff=
3126     fi
3127     if test -z "$kdelibsuff"; then
3128         AC_MSG_RESULT([not using lib directory suffix])
3129         AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
3130     else
3131         if test "$libdir" = '${exec_prefix}/lib'; then
3132             libdir="$libdir${kdelibsuff}"
3133             AC_SUBST([libdir], ["$libdir"])  dnl ugly hack for lib64 platforms
3134         fi
3135         AC_DEFINE_UNQUOTED(KDELIBSUFF, ["\"${kdelibsuff}\""], Suffix for lib directories)
3136         AC_MSG_RESULT([using lib directory suffix $kdelibsuff])
3137     fi
3140 AC_DEFUN([KDE_CHECK_TYPES],
3141 [  AC_CHECK_SIZEOF(int, 4)dnl
3142    AC_CHECK_SIZEOF(short)dnl
3143   AC_CHECK_SIZEOF(long, 4)dnl
3144   AC_CHECK_SIZEOF(char *, 4)dnl
3145 ])dnl
3147 AC_DEFUN([KDE_DO_IT_ALL],
3149 AC_CANONICAL_SYSTEM
3150 AC_ARG_PROGRAM
3151 AM_INIT_AUTOMAKE($1, $2)
3152 AM_DISABLE_LIBRARIES
3153 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
3154 AC_CHECK_COMPILERS
3155 KDE_PROG_LIBTOOL
3156 AM_KDE_WITH_NLS
3157 AC_PATH_KDE
3160 AC_DEFUN([AC_CHECK_RPATH],
3162 AC_MSG_CHECKING(for rpath)
3163 AC_ARG_ENABLE(rpath,
3164       [  --disable-rpath         do not use the rpath feature of ld],
3165       USE_RPATH=$enableval, USE_RPATH=yes)
3167 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
3169   KDE_RPATH="-R \$(kde_libraries)"
3171   if test -n "$qt_libraries"; then
3172     KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
3173   fi
3174   dnl $x_libraries is set to /usr/lib in case
3175   if test -n "$X_LDFLAGS"; then
3176     X_RPATH="-R \$(x_libraries)"
3177     KDE_RPATH="$KDE_RPATH $X_RPATH"
3178   fi
3179   if test -n "$KDE_EXTRA_RPATH"; then
3180     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
3181   fi
3183 AC_SUBST(KDE_EXTRA_RPATH)
3184 AC_SUBST(KDE_RPATH)
3185 AC_SUBST(X_RPATH)
3186 AC_MSG_RESULT($USE_RPATH)
3189 dnl Check for the type of the third argument of getsockname
3190 AC_DEFUN([AC_CHECK_SOCKLEN_T], [
3191   AC_MSG_CHECKING(for socklen_t)
3192   AC_CACHE_VAL(ac_cv_socklen_t, [
3193     AC_LANG_SAVE
3194     AC_LANG_CPLUSPLUS
3195     AC_TRY_COMPILE([
3196 #include <sys/types.h>
3197 #include <sys/socket.h>
3198       ],[
3199 socklen_t a=0;
3200 getsockname(0,(struct sockaddr*)0, &a);
3201       ],
3202       ac_cv_socklen_t=socklen_t,
3203       AC_TRY_COMPILE([
3204 #include <sys/types.h>
3205 #include <sys/socket.h>
3206         ],[
3207 int a=0;
3208 getsockname(0,(struct sockaddr*)0, &a);
3209         ],
3210         ac_cv_socklen_t=int,
3211         ac_cv_socklen_t=size_t
3212       )
3213     )
3214     AC_LANG_RESTORE
3215   ])
3217   AC_MSG_RESULT($ac_cv_socklen_t)
3218   if test "$ac_cv_socklen_t" != "socklen_t"; then
3219     AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t,
3220         [Define the real type of socklen_t])
3221   fi
3222   AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define])
3226 dnl This is a merge of some macros out of the gettext aclocal.m4
3227 dnl since we don't need anything, I took the things we need
3228 dnl the copyright for them is:
3229 dnl >
3230 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3231 dnl This Makefile.in is free software; the Free Software Foundation
3232 dnl gives unlimited permission to copy and/or distribute it,
3233 dnl with or without modifications, as long as this notice is preserved.
3235 dnl This program is distributed in the hope that it will be useful,
3236 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
3237 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
3238 dnl PARTICULAR PURPOSE.
3239 dnl >
3240 dnl for this file it is relicensed under LGPL
3242 AC_DEFUN([AM_KDE_WITH_NLS],
3243   [
3244     dnl If we use NLS figure out what method
3246     AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
3247         [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
3248     AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3250      if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
3251         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
3252         GMSGFMT=":"
3253       fi
3254       MSGFMT=$GMSGFMT
3255       AC_SUBST(GMSGFMT)
3256       AC_SUBST(MSGFMT)
3258       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
3259         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
3261       dnl Test whether we really found GNU xgettext.
3262       if test "$XGETTEXT" != ":"; then
3263         dnl If it is no GNU xgettext we define it as : so that the
3264         dnl Makefiles still can work.
3265         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
3266           : ;
3267         else
3268           AC_MSG_RESULT(
3269             [found xgettext programs is not GNU xgettext; ignore it])
3270           XGETTEXT=":"
3271         fi
3272       fi
3273      AC_SUBST(XGETTEXT)
3275   ])
3277 # Search path for a program which passes the given test.
3278 # Ulrich Drepper <drepper@cygnus.com>, 1996.
3280 # serial 1
3281 # Stephan Kulow: I appended a _KDE against name conflicts
3283 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
3284 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3285 AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
3286 [# Extract the first word of "$2", so it can be a program name with args.
3287 set dummy $2; ac_word=[$]2
3288 AC_MSG_CHECKING([for $ac_word])
3289 AC_CACHE_VAL(ac_cv_path_$1,
3290 [case "[$]$1" in
3291   /*)
3292   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3293   ;;
3294   *)
3295   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
3296   for ac_dir in ifelse([$5], , $PATH, [$5]); do
3297     test -z "$ac_dir" && ac_dir=.
3298     if test -f $ac_dir/$ac_word; then
3299       if [$3]; then
3300         ac_cv_path_$1="$ac_dir/$ac_word"
3301         break
3302       fi
3303     fi
3304   done
3305   IFS="$ac_save_ifs"
3306 dnl If no 4th arg is given, leave the cache variable unset,
3307 dnl so AC_PATH_PROGS will keep looking.
3308 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3309 ])dnl
3310   ;;
3311 esac])dnl
3312 $1="$ac_cv_path_$1"
3313 if test -n "[$]$1"; then
3314   AC_MSG_RESULT([$]$1)
3315 else
3316   AC_MSG_RESULT(no)
3318 AC_SUBST($1)dnl
3322 # Check whether LC_MESSAGES is available in <locale.h>.
3323 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3325 # serial 1
3327 AC_DEFUN([AM_LC_MESSAGES],
3328   [if test $ac_cv_header_locale_h = yes; then
3329     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
3330       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
3331        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
3332     if test $am_cv_val_LC_MESSAGES = yes; then
3333       AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
3334     fi
3335   fi])
3337 dnl From Jim Meyering.
3338 dnl FIXME: migrate into libit.
3340 AC_DEFUN([AM_FUNC_OBSTACK],
3341 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
3342  [AC_TRY_LINK([#include "obstack.h"],
3343               [struct obstack *mem;obstack_free(mem,(char *) 0)],
3344               am_cv_func_obstack=yes,
3345               am_cv_func_obstack=no)])
3346  if test $am_cv_func_obstack = yes; then
3347    AC_DEFINE(HAVE_OBSTACK)
3348  else
3349    LIBOBJS="$LIBOBJS obstack.o"
3350  fi
3353 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
3354 dnl FIXME: Migrate into libit
3356 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
3357 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
3358  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
3359               am_cv_lib_error_at_line=yes,
3360               am_cv_lib_error_at_line=no)])
3361  if test $am_cv_lib_error_at_line = no; then
3362    LIBOBJS="$LIBOBJS error.o"
3363  fi
3364  AC_SUBST(LIBOBJS)dnl
3367 # Macro to add for using GNU gettext.
3368 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3370 # serial 1
3371 # Stephan Kulow: I put a KDE in it to avoid name conflicts
3373 AC_DEFUN([AM_KDE_GNU_GETTEXT],
3374   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3375    AC_REQUIRE([AC_PROG_RANLIB])dnl
3376    AC_REQUIRE([AC_HEADER_STDC])dnl
3377    AC_REQUIRE([AC_TYPE_OFF_T])dnl
3378    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
3379    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
3380    AC_REQUIRE([AC_FUNC_MMAP])dnl
3381    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
3382    AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
3383    AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
3384 __argz_count __argz_stringify __argz_next])
3386    AC_MSG_CHECKING(for stpcpy)
3387    AC_CACHE_VAL(kde_cv_func_stpcpy,
3388    [
3389    kde_safe_cxxflags=$CXXFLAGS
3390    CXXFLAGS="-Werror"
3391    AC_LANG_SAVE
3392    AC_LANG_CPLUSPLUS
3393    AC_TRY_COMPILE([
3394    #include <string.h>
3395    ],
3396    [
3397    char buffer[200];
3398    stpcpy(buffer, buffer);
3399    ],
3400    kde_cv_func_stpcpy=yes,
3401    kde_cv_func_stpcpy=no)
3402    AC_LANG_RESTORE
3403    CXXFLAGS=$kde_safe_cxxflags
3404    ])
3405    AC_MSG_RESULT($kde_cv_func_stpcpy)
3406    if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
3407      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
3408    fi
3410    AM_LC_MESSAGES
3412    if test "x$CATOBJEXT" != "x"; then
3413      if test "x$ALL_LINGUAS" = "x"; then
3414        LINGUAS=
3415      else
3416        AC_MSG_CHECKING(for catalogs to be installed)
3417        NEW_LINGUAS=
3418        for lang in ${LINGUAS=$ALL_LINGUAS}; do
3419          case "$ALL_LINGUAS" in
3420           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
3421          esac
3422        done
3423        LINGUAS=$NEW_LINGUAS
3424        AC_MSG_RESULT($LINGUAS)
3425      fi
3427      dnl Construct list of names of catalog files to be constructed.
3428      if test -n "$LINGUAS"; then
3429        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
3430      fi
3431    fi
3433   ])
3435 AC_DEFUN([AC_HAVE_XPM],
3436  [AC_REQUIRE_CPP()dnl
3437   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3439  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
3440  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
3442  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
3443         xpm_test=$withval, xpm_test="yes")
3444  if test "x$xpm_test" = xno; then
3445    ac_cv_have_xpm=no
3446  else
3447    AC_MSG_CHECKING(for XPM)
3448    AC_CACHE_VAL(ac_cv_have_xpm,
3449    [
3450     ac_save_ldflags="$LDFLAGS"
3451     ac_save_cflags="$CFLAGS"
3452     if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
3453       LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
3454     else
3455       LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
3456     fi
3457     CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
3458     test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
3459     AC_TRY_LINK([#include <X11/xpm.h>],[],
3460         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
3461     LDFLAGS="$ac_save_ldflags"
3462     CFLAGS="$ac_save_cflags"
3463    ])dnl
3465   if test "$ac_cv_have_xpm" = no; then
3466     AC_MSG_RESULT(no)
3467     XPM_LDFLAGS=""
3468     XPMINC=""
3469     $2
3470   else
3471     AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
3472     if test "$XPM_LDFLAGS" = ""; then
3473        XPMLIB='-lXpm $(LIB_X11)'
3474     else
3475        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
3476     fi
3477     if test "$XPM_INCLUDE" = ""; then
3478        XPMINC=""
3479     else
3480        XPMINC="-I$XPM_INCLUDE"
3481     fi
3482     AC_MSG_RESULT(yes)
3483     $1
3484   fi
3485  fi
3486  AC_SUBST(XPMINC)
3487  AC_SUBST(XPMLIB)
3490 AC_DEFUN([AC_HAVE_DPMS],
3491  [AC_REQUIRE_CPP()dnl
3492   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3494  test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
3495  test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
3496  DPMS_LIB=
3498  AC_ARG_WITH(dpms, [  --without-dpms          disable DPMS power saving],
3499         dpms_test=$withval, dpms_test="yes")
3500  if test "x$dpms_test" = xno; then
3501    ac_cv_have_dpms=no
3502  else
3503    AC_MSG_CHECKING(for DPMS)
3504    dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
3505    dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
3506    AC_CACHE_VAL(ac_cv_have_dpms,
3507    [
3508     if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
3509       AC_MSG_RESULT(no)
3510       ac_cv_have_dpms="no"
3511     else
3512       ac_save_ldflags="$LDFLAGS"
3513       ac_save_cflags="$CFLAGS"
3514       ac_save_libs="$LIBS"
3515       LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
3516       CFLAGS="$CFLAGS $X_INCLUDES"
3517       test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3518       AC_TRY_LINK([
3519           #include <X11/Xproto.h>
3520           #include <X11/X.h>
3521           #include <X11/Xlib.h>
3522           #include <X11/extensions/dpms.h>
3523           int foo_test_dpms()
3524           { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3525           ac_cv_have_dpms="yes", [
3526               LDFLAGS="$ac_save_ldflags"
3527               CFLAGS="$ac_save_cflags"
3528               LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
3529               LIBS="$LIBS -lXdpms"
3530               CFLAGS="$CFLAGS $X_INCLUDES"
3531               test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3532               AC_TRY_LINK([
3533                   #include <X11/Xproto.h>
3534                   #include <X11/X.h>
3535                   #include <X11/Xlib.h>
3536                   #include <X11/extensions/dpms.h>
3537                   int foo_test_dpms()
3538                   { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3539                   [
3540                   ac_cv_have_dpms="-lXdpms"
3541                   ],ac_cv_have_dpms="no")
3542               ])
3543       LDFLAGS="$ac_save_ldflags"
3544       CFLAGS="$ac_save_cflags"
3545       LIBS="$ac_save_libs"
3546     fi
3547    ])dnl
3549   if test "$ac_cv_have_dpms" = no; then
3550     AC_MSG_RESULT(no)
3551     DPMS_LDFLAGS=""
3552     DPMSINC=""
3553     $2
3554   else
3555     AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
3556     if test "$ac_cv_have_dpms" = "-lXdpms"; then
3557        DPMS_LIB="-lXdpms"
3558     fi
3559     if test "$DPMS_LDFLAGS" = ""; then
3560        DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
3561     else
3562        DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
3563     fi
3564     if test "$DPMS_INCLUDE" = ""; then
3565        DPMSINC=""
3566     else
3567        DPMSINC="-I$DPMS_INCLUDE"
3568     fi
3569     AC_MSG_RESULT(yes)
3570     $1
3571   fi
3572  fi
3573  ac_save_cflags="$CFLAGS"
3574  CFLAGS="$CFLAGS $X_INCLUDES"
3575  test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3576  AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
3577    [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
3578  AC_CHECK_DECL(DPMSCapable,
3579    AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
3580    [#include <X11/extensions/dpms.h>])
3581  AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
3582    [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
3583  AC_CHECK_DECL(DPMSInfo,
3584    AC_DEFINE(HAVE_DPMSINFO_PROTO),,
3585    [#include <X11/extensions/dpms.h>])
3586  CFLAGS="$ac_save_cflags"
3587  AC_SUBST(DPMSINC)
3588  AC_SUBST(DPMSLIB)
3591 AC_DEFUN([AC_HAVE_GL],
3592  [AC_REQUIRE_CPP()dnl
3593   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3595  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
3596  test -z "$GL_INCLUDE" && GL_INCLUDE=
3598  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
3599         gl_test=$withval, gl_test="yes")
3600  if test "x$kde_use_qt_emb" = "xyes"; then
3601    # GL and Qt Embedded is a no-go for now.
3602    ac_cv_have_gl=no
3603  elif test "x$gl_test" = xno; then
3604    ac_cv_have_gl=no
3605  else
3606    AC_MSG_CHECKING(for GL)
3607    AC_CACHE_VAL(ac_cv_have_gl,
3608    [
3609     AC_LANG_SAVE
3610     AC_LANG_CPLUSPLUS
3611     ac_save_ldflags="$LDFLAGS"
3612     ac_save_cxxflags="$CXXFLAGS"
3613     LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU"
3614     test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11"
3615     LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET"
3616     CXXFLAGS="$CFLAGS $X_INCLUDES"
3617     test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3618     AC_TRY_LINK([#include <GL/gl.h>
3619 #include <GL/glu.h>
3620 ], [],
3621         ac_cv_have_gl="mesa", ac_cv_have_gl="no")
3622     if test "x$ac_cv_have_gl" = "xno"; then
3623       LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGLU -lGL"
3624       test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11"
3625       LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET"
3626       CXXFLAGS="$ac_save_cflags $X_INCLUDES"
3627       test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3628       AC_TRY_LINK([#include <GL/gl.h>
3629 #include <GL/glu.h>
3630 ], [],
3631           ac_cv_have_gl="yes", ac_cv_have_gl="no")
3632     fi
3633     AC_LANG_RESTORE
3634     LDFLAGS="$ac_save_ldflags"
3635     CXXFLAGS="$ac_save_cxxflags"
3636    ])dnl
3638   if test "$ac_cv_have_gl" = "no"; then
3639     AC_MSG_RESULT(no)
3640     GL_LDFLAGS=""
3641     GLINC=""
3642     $2
3643   else
3644     AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
3645     if test "$GL_LDFLAGS" = ""; then
3646        if test "$ac_cv_have_gl" = "mesa"; then
3647           GLLIB='-lMesaGLU -lMesaGL $(LIB_X11)'
3648        else
3649           GLLIB='-lGLU -lGL $(LIB_X11)'
3650        fi
3651     else
3652        if test "$ac_cv_have_gl" = "mesa"; then
3653           GLLIB="$GL_LDFLAGS -lMesaGLU -lMesaGL "'$(LIB_X11)'
3654        else
3655           GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
3656        fi
3657     fi
3658     if test "$GL_INCLUDE" = ""; then
3659        GLINC=""
3660     else
3661        GLINC="-I$GL_INCLUDE"
3662     fi
3663     AC_MSG_RESULT($ac_cv_have_gl)
3664     $1
3665   fi
3666  fi
3667  AC_SUBST(GLINC)
3668  AC_SUBST(GLLIB)
3672  dnl shadow password and PAM magic - maintained by ossi@kde.org
3674 AC_DEFUN([KDE_PAM], [
3675   AC_REQUIRE([KDE_CHECK_LIBDL])
3677   want_pam=
3678   AC_ARG_WITH(pam,
3679     [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
3680     [ if test "x$withval" = "xyes"; then
3681         want_pam=yes
3682         pam_service=kde
3683       elif test "x$withval" = "xno"; then
3684         want_pam=no
3685       else
3686         want_pam=yes
3687         pam_service=$withval
3688       fi
3689     ], [ pam_service=kde ])
3691   use_pam=
3692   PAMLIBS=
3693   if test "x$want_pam" != xno; then
3694     AC_CHECK_LIB(pam, pam_start, [
3695       AC_CHECK_HEADER(security/pam_appl.h,
3696         [ pam_header=security/pam_appl.h ],
3697         [ AC_CHECK_HEADER(pam/pam_appl.h,
3698             [ pam_header=pam/pam_appl.h ],
3699             [
3700     AC_MSG_WARN([PAM detected, but no headers found!
3701 Make sure you have the necessary development packages installed.])
3702             ]
3703           )
3704         ]
3705       )
3706     ], , $LIBDL)
3707     if test -z "$pam_header"; then
3708       if test "x$want_pam" = xyes; then
3709         AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
3710       fi
3711     else
3712       AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
3713       PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
3714       use_pam=yes
3716       dnl darwin claims to be something special
3717       if test "$pam_header" = "pam/pam_appl.h"; then
3718         AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
3719       fi
3721       dnl test whether struct pam_message is const (Linux) or not (Sun)
3722       AC_MSG_CHECKING(for const pam_message)
3723       AC_EGREP_HEADER([struct pam_message], $pam_header,
3724         [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
3725                           [AC_MSG_RESULT([const: Linux-type PAM])],
3726                           [AC_MSG_RESULT([nonconst: Sun-type PAM])
3727                           AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
3728                           )],
3729         [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
3730     fi
3731   fi
3733   AC_SUBST(PAMLIBS)
3736 dnl DEF_PAM_SERVICE(arg name, full name, define name)
3737 AC_DEFUN([DEF_PAM_SERVICE], [
3738   AC_ARG_WITH($1-pam,
3739     [  --with-$1-pam=[val]    override PAM service from --with-pam for $2],
3740     [ if test "x$use_pam" = xyes; then
3741         $3_PAM_SERVICE=$withval
3742       else
3743         AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
3744 You may want to enforce it by using --with-pam.])
3745       fi
3746     ], 
3747     [ if test "x$use_pam" = xyes; then
3748         $3_PAM_SERVICE="$pam_service"
3749       fi
3750     ])
3751     if test -n "$$3_PAM_SERVICE"; then
3752       AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
3753       AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
3754     fi
3755     AC_SUBST($3_PAM_SERVICE)
3758 AC_DEFUN([KDE_SHADOWPASSWD], [
3759   AC_REQUIRE([KDE_PAM])
3761   AC_CHECK_LIB(shadow, getspent,
3762     [ LIBSHADOW="-lshadow"
3763       ac_use_shadow=yes
3764     ],
3765     [ dnl for UnixWare
3766       AC_CHECK_LIB(gen, getspent, 
3767         [ LIBGEN="-lgen"
3768           ac_use_shadow=yes
3769         ], 
3770         [ AC_CHECK_FUNC(getspent, 
3771             [ ac_use_shadow=yes ],
3772             [ ac_use_shadow=no ])
3773         ])
3774     ])
3775   AC_SUBST(LIBSHADOW)
3776   AC_SUBST(LIBGEN)
3777   
3778   AC_MSG_CHECKING([for shadow passwords])
3780   AC_ARG_WITH(shadow,
3781     [  --with-shadow              If you want shadow password support ],
3782     [ if test "x$withval" != "xno"; then
3783         use_shadow=yes
3784       else
3785         use_shadow=no
3786       fi
3787     ], [
3788       use_shadow="$ac_use_shadow"
3789     ])
3791   if test "x$use_shadow" = xyes; then
3792     AC_MSG_RESULT(yes)
3793     AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
3794   else
3795     AC_MSG_RESULT(no)
3796     LIBSHADOW=
3797     LIBGEN=
3798   fi
3800   dnl finally make the relevant binaries setuid root, if we have shadow passwds.
3801   dnl this still applies, if we could use it indirectly through pam.
3802   if test "x$use_shadow" = xyes || 
3803      ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
3804       case $host in
3805       *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
3806         SETUIDFLAGS="-m 4755 -o root";;
3807       *)
3808         SETUIDFLAGS="-m 4755";;
3809       esac
3810   fi
3811   AC_SUBST(SETUIDFLAGS)
3815 AC_DEFUN([KDE_PASSWDLIBS], [
3816   AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
3817   AC_REQUIRE([KDE_PAM])
3818   AC_REQUIRE([KDE_SHADOWPASSWD])
3820   if test "x$use_pam" = "xyes"; then 
3821     PASSWDLIBS="$PAMLIBS"
3822   else
3823     PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
3824   fi
3826   dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
3827   dnl /etc/master.passwd holds the actual passwords.  /etc/master.passwd requires
3828   dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
3829   dnl may need to read /etc/master.passwd).
3830   case $host in
3831   *-*-freebsd*)
3832     SETUIDFLAGS="-m 4755 -o root"
3833     ;;
3834   *)
3835     ;;
3836   esac
3838   AC_SUBST(PASSWDLIBS)
3841 AC_DEFUN([KDE_CHECK_LIBDL],
3843 AC_CHECK_LIB(dl, dlopen, [
3844 LIBDL="-ldl"
3845 ac_cv_have_dlfcn=yes
3848 AC_CHECK_LIB(dld, shl_unload, [
3849 LIBDL="-ldld"
3850 ac_cv_have_shload=yes
3853 AC_SUBST(LIBDL)
3856 AC_DEFUN([KDE_CHECK_DLOPEN],
3858 KDE_CHECK_LIBDL
3859 AC_CHECK_HEADERS(dlfcn.h dl.h)
3860 if test "$ac_cv_header_dlfcn_h" = "no"; then
3861   ac_cv_have_dlfcn=no
3864 if test "$ac_cv_header_dl_h" = "no"; then
3865   ac_cv_have_shload=no
3868 dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
3869 dnl (MM)
3870 AC_ARG_ENABLE(dlopen,
3871 [  --disable-dlopen        link statically [default=no]] ,
3872 enable_dlopen=$enableval,
3873 enable_dlopen=yes)
3875 # override the user's opinion, if we know it better ;)
3876 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
3877   enable_dlopen=no
3880 if test "$ac_cv_have_dlfcn" = "yes"; then
3881   AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
3884 if test "$ac_cv_have_shload" = "yes"; then
3885   AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
3888 if test "$enable_dlopen" = no ; then
3889   test -n "$1" && eval $1
3890 else
3891   test -n "$2" && eval $2
3896 AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
3898 KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
3899 KDE_PROG_LIBTOOL
3900 AC_MSG_CHECKING([dynamic loading])
3901 eval "`egrep '^build_libtool_libs=' libtool`"
3902 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
3903   dynamic_loading=yes
3904   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
3905 else
3906   dynamic_loading=no
3908 AC_MSG_RESULT($dynamic_loading)
3909 if test "$dynamic_loading" = "yes"; then
3910   $1
3911 else
3912   $2
3916 AC_DEFUN([KDE_ADD_INCLUDES],
3918 if test -z "$1"; then
3919   test_include="Pix.h"
3920 else
3921   test_include="$1"
3924 AC_MSG_CHECKING([for libg++ ($test_include)])
3926 AC_CACHE_VAL(kde_cv_libgpp_includes,
3928 kde_cv_libgpp_includes=no
3930    for ac_dir in               \
3931                                \
3932      /usr/include/g++          \
3933      /usr/include              \
3934      /usr/unsupported/include  \
3935      /opt/include              \
3936      $extra_include            \
3937      ; \
3938    do
3939      if test -r "$ac_dir/$test_include"; then
3940        kde_cv_libgpp_includes=$ac_dir
3941        break
3942      fi
3943    done
3946 AC_MSG_RESULT($kde_cv_libgpp_includes)
3947 if test "$kde_cv_libgpp_includes" != "no"; then
3948   all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
3952 AC_DEFUN([KDE_CHECK_LIBPTHREAD],
3954   LIBPTHREAD=""
3956   if test -n "$PTHREAD_LIBS"; then
3957     PTHREAD_LIBS_save="$PTHREAD_LIBS"
3958     PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
3959     KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [LIBPTHREAD="$PTHREAD_LIBS_save"] )
3960     PTHREAD_LIBS="$PTHREAD_LIBS_save"
3961   fi
3963   if test -z "$LIBPTHREAD"; then
3964     AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
3965   fi
3967   AC_SUBST(LIBPTHREAD)
3970 AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
3972       USE_THREADS=""
3973       if test -z "$LIBPTHREAD"; then
3974         KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
3975       fi
3977     AH_VERBATIM(__svr_define, [
3978 #if defined(__SVR4) && !defined(__svr4__)
3979 #define __svr4__ 1
3980 #endif
3982     case $host_os in
3983         solaris*)
3984                 KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
3985                 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
3986                 ;;
3987         freebsd*)
3988                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
3989                 ;;
3990         aix*)
3991                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3992                 LIBPTHREAD="$LIBPTHREAD -lc_r"
3993                 ;;
3994         linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
3995                 if test "$CXX" = "KCC"; then
3996                   CXXFLAGS="$CXXFLAGS --thread_safe"
3997                   NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
3998                 fi
3999                 ;;
4000         *)
4001                 ;;
4002     esac
4003     AC_SUBST(USE_THREADS)
4004     AC_SUBST(LIBPTHREAD)
4007 AC_DEFUN([KDE_CHECK_THREADING],
4009   AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
4010   AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
4011   dnl default is yes if libpthread is found and no if no libpthread is available
4012   if test -z "$LIBPTHREAD"; then
4013     if test -z "$USE_THREADS"; then
4014       kde_check_threading_default=no
4015     else
4016       kde_check_threading_default=yes
4017     fi
4018   else
4019     kde_check_threading_default=yes
4020   fi
4021   AC_ARG_ENABLE(threading, [  --disable-threading     disables threading even if libpthread found ],
4022    kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
4023   if test "x$kde_use_threading" = "xyes"; then
4024     AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
4025   fi
4028 AC_DEFUN([KDE_TRY_LINK_PYTHON],
4030 if test "$kde_python_link_found" = no; then
4032 if test "$1" = normal; then
4033   AC_MSG_CHECKING(if a Python application links)
4034 else
4035   AC_MSG_CHECKING(if Python depends on $2)
4038 AC_CACHE_VAL(kde_cv_try_link_python_$1,
4040 kde_save_cflags="$CFLAGS"
4041 CFLAGS="$CFLAGS $PYTHONINC"
4042 kde_save_libs="$LIBS"
4043 LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
4044 kde_save_ldflags="$LDFLAGS"
4045 LDFLAGS="$LDFLAGS $PYTHONLIB"
4047 AC_TRY_LINK(
4049 #include <Python.h>
4051         PySys_SetArgv(1, 0);
4053         [kde_cv_try_link_python_$1=yes],
4054         [kde_cv_try_link_python_$1=no]
4056 CFLAGS="$kde_save_cflags"
4057 LIBS="$kde_save_libs"
4058 LDFLAGS="$kde_save_ldflags"
4061 if test "$kde_cv_try_link_python_$1" = "yes"; then
4062   AC_MSG_RESULT(yes)
4063   kde_python_link_found=yes
4064   if test ! "$1" = normal; then
4065     LIBPYTHON="$LIBPYTHON $2"
4066   fi
4067   $3
4068 else
4069   AC_MSG_RESULT(no)
4070   $4
4077 AC_DEFUN([KDE_CHECK_PYTHON_DIR],
4079 AC_MSG_CHECKING([for Python directory])
4081 AC_CACHE_VAL(kde_cv_pythondir,
4083   if test -z "$PYTHONDIR"; then
4084     kde_cv_pythondir=/usr/local
4085   else
4086     kde_cv_pythondir="$PYTHONDIR"
4087   fi
4090 AC_ARG_WITH(pythondir,
4091 [  --with-pythondir=pythondir   use python installed in pythondir ],
4093   ac_python_dir=$withval
4094 ], ac_python_dir=$kde_cv_pythondir
4097 AC_MSG_RESULT($ac_python_dir)
4100 AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
4102 AC_REQUIRE([KDE_CHECK_LIBDL])
4103 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
4104 AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
4106 if test -z "$1"; then
4107   version="1.5"
4108 else
4109   version="$1"
4112 AC_MSG_CHECKING([for Python$version])
4114 python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
4115 AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
4116 if test ! -r $python_incdir/Python.h; then
4117   AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
4118   python_incdir=$python_incdir/python$version
4119   if test ! -r $python_incdir/Python.h; then
4120     python_incdir=no
4121   fi
4124 PYTHONINC=-I$python_incdir
4126 python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs"
4127 AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
4128 if test ! -r $python_libdir/libpython$version.so; then
4129   AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
4130   if test ! -r $python_libdir/libpython$version.a; then
4131     AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
4132     python_libdir=$python_libdir/python$version/config
4133     if test ! -r $python_libdir/libpython$version.a; then
4134       python_libdir=no
4135     fi
4136   fi
4139 PYTHONLIB=-L$python_libdir
4140 kde_orig_LIBPYTHON=$LIBPYTHON
4141 if test -z "$LIBPYTHON"; then
4142   LIBPYTHON=-lpython$version
4145 AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
4146 python_moddir=$python_moddir/python$version
4147 if test ! -r $python_moddir/copy.py; then
4148   python_moddir=no
4151 PYTHONMODDIR=$python_moddir
4153 AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
4155 if test x$python_incdir = xno ||  test x$python_libdir = xno ||  test x$python_moddir = xno; then
4156    LIBPYTHON=$kde_orig_LIBPYTHON
4157    test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
4158    test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
4159    $2
4160 else 
4161   dnl Note: this test is very weak
4162   kde_python_link_found=no
4163   KDE_TRY_LINK_PYTHON(normal)
4164   KDE_TRY_LINK_PYTHON(m, -lm)
4165   KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
4166   KDE_TRY_LINK_PYTHON(tcl, -ltcl)
4167   KDE_TRY_LINK_PYTHON(db2, -ldb2)
4168   KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
4169   KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
4170   KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
4171   KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
4172   KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
4173   KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
4174   KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
4175   KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
4176         [AC_MSG_WARN([it seems, Python depends on another library.
4177     Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
4178     and contact the authors to let them know about this problem])
4179         ])
4181   LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
4182   AC_SUBST(PYTHONINC)
4183   AC_SUBST(PYTHONLIB)
4184   AC_SUBST(LIBPYTHON)
4185   AC_SUBST(PYTHONMODDIR)
4186   AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
4192 AC_DEFUN([KDE_CHECK_PYTHON],
4194   KDE_CHECK_PYTHON_INTERN("2.3", 
4195    [KDE_CHECK_PYTHON_INTERN("2.2", 
4196      [KDE_CHECK_PYTHON_INTERN("2.1", 
4197        [KDE_CHECK_PYTHON_INTERN("2.0", 
4198          [KDE_CHECK_PYTHON_INTERN($1, $2) ])
4199        ])
4200      ])
4201    ])
4204 AC_DEFUN([KDE_CHECK_STL],
4206     AC_LANG_SAVE
4207     AC_LANG_CPLUSPLUS
4208     ac_save_CXXFLAGS="$CXXFLAGS"
4209     CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
4211     AC_MSG_CHECKING([if C++ programs can be compiled])
4212     AC_CACHE_VAL(kde_cv_stl_works,
4213     [
4214       AC_TRY_COMPILE([
4215 #include <string>
4216 using namespace std;
4218   string astring="Hallo Welt.";
4219   astring.erase(0, 6); // now astring is "Welt"
4220   return 0;
4221 ], kde_cv_stl_works=yes,
4222    kde_cv_stl_works=no)
4225    AC_MSG_RESULT($kde_cv_stl_works)
4227    if test "$kde_cv_stl_works" = "yes"; then
4228      # back compatible
4229          AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
4230    else
4231          AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
4232 Check config.log for details - if you're using a Linux distribution you might miss
4233 a package named similiar to libstd++-dev.])
4234    fi
4236    CXXFLAGS="$ac_save_CXXFLAGS"
4237    AC_LANG_RESTORE
4240 AC_DEFUN([AC_FIND_QIMGIO],
4241    [AC_REQUIRE([AC_FIND_JPEG])
4242 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
4243 AC_MSG_CHECKING([for qimgio])
4244 AC_CACHE_VAL(ac_cv_lib_qimgio,
4246 AC_LANG_SAVE
4247 AC_LANG_CPLUSPLUS
4248 ac_save_LIBS="$LIBS"
4249 ac_save_CXXFLAGS="$CXXFLAGS"
4250 LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
4251 CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
4252 AC_TRY_RUN(dnl
4254 #include <qimageio.h>
4255 #include <qstring.h>
4256 int main() {
4257                 QString t = "hallo";
4258                 t.fill('t');
4259                 qInitImageIO();
4262             ac_cv_lib_qimgio=yes,
4263             ac_cv_lib_qimgio=no,
4264             ac_cv_lib_qimgio=no)
4265 LIBS="$ac_save_LIBS"
4266 CXXFLAGS="$ac_save_CXXFLAGS"
4267 AC_LANG_RESTORE
4268 ])dnl
4269 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
4270   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
4271   AC_MSG_RESULT(yes)
4272   AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
4273   AC_SUBST(LIBQIMGIO)
4274 else
4275   AC_MSG_RESULT(not found)
4279 AC_DEFUN([AM_DISABLE_LIBRARIES],
4281     AC_PROVIDE([AM_ENABLE_STATIC])
4282     AC_PROVIDE([AM_ENABLE_SHARED])
4283     enable_static=no
4284     enable_shared=yes
4288 AC_DEFUN([AC_CHECK_UTMP_FILE],
4290     AC_MSG_CHECKING([for utmp file])
4292     AC_CACHE_VAL(kde_cv_utmp_file,
4293     [
4294     kde_cv_utmp_file=no
4296     for ac_file in    \
4297                       \
4298         /var/run/utmp \
4299         /var/adm/utmp \
4300         /etc/utmp     \
4301      ; \
4302     do
4303      if test -r "$ac_file"; then
4304        kde_cv_utmp_file=$ac_file
4305        break
4306      fi
4307     done
4308     ])
4310     if test "$kde_cv_utmp_file" != "no"; then
4311         AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
4312         $1
4313         AC_MSG_RESULT($kde_cv_utmp_file)
4314     else
4315         $2
4316         AC_MSG_RESULT([non found])
4317     fi
4321 AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
4324 DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
4326 if test ! -s $srcdir/subdirs; then
4327   dnl Note: Makefile.common creates subdirs, so this is just a fallback
4328   TOPSUBDIRS=""
4329   files=`cd $srcdir && ls -1`
4330   dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
4331   for i in $dirs; do
4332     echo $i >> $srcdir/subdirs
4333   done
4336 ac_topsubdirs=
4337 if test -s $srcdir/inst-apps; then
4338   ac_topsubdirs="`cat $srcdir/inst-apps`"
4339 elif test -s $srcdir/subdirs; then
4340   ac_topsubdirs="`cat $srcdir/subdirs`"
4343 for i in $ac_topsubdirs; do
4344   AC_MSG_CHECKING([if $i should be compiled])
4345   if test -d $srcdir/$i; then
4346     install_it="yes"
4347     for j in $DO_NOT_COMPILE; do
4348       if test $i = $j; then
4349         install_it="no"
4350       fi
4351     done
4352   else
4353     install_it="no"
4354   fi
4355   AC_MSG_RESULT($install_it)
4356   vari=`echo $i | sed -e 's,[[-+.]],_,g'`
4357   if test $install_it = "yes"; then
4358     TOPSUBDIRS="$TOPSUBDIRS $i"
4359     eval "$vari""_SUBDIR_included=yes"
4360   else
4361     eval "$vari""_SUBDIR_included=no"
4362   fi
4363 done
4365 AC_SUBST(TOPSUBDIRS)
4368 AC_DEFUN([KDE_CHECK_NAMESPACES],
4370 AC_MSG_CHECKING(whether C++ compiler supports namespaces)
4371 AC_LANG_SAVE
4372 AC_LANG_CPLUSPLUS
4373 AC_TRY_COMPILE([
4376 namespace Foo {
4377   extern int i;
4378   namespace Bar {
4379     extern int i;
4380   }
4383 int Foo::i = 0;
4384 int Foo::Bar::i = 1;
4386   AC_MSG_RESULT(yes)
4387   AC_DEFINE(HAVE_NAMESPACES)
4388 ], [
4389 AC_MSG_RESULT(no)
4391 AC_LANG_RESTORE
4394 dnl ------------------------------------------------------------------------
4395 dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
4396 dnl ------------------------------------------------------------------------
4398 AC_DEFUN([AC_CHECK_S_ISSOCK],
4400 AC_MSG_CHECKING(for S_ISSOCK)
4401 AC_CACHE_VAL(ac_cv_have_s_issock,
4403 AC_TRY_LINK(
4405 #include <sys/stat.h>
4408 struct stat buff;
4409 int b = S_ISSOCK( buff.st_mode );
4411 ac_cv_have_s_issock=yes,
4412 ac_cv_have_s_issock=no)
4414 AC_MSG_RESULT($ac_cv_have_s_issock)
4415 if test "$ac_cv_have_s_issock" = "yes"; then
4416   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
4419 AH_VERBATIM(_ISSOCK,
4421 #ifndef HAVE_S_ISSOCK
4422 #define HAVE_S_ISSOCK
4423 #define S_ISSOCK(mode) (1==0)
4424 #endif
4429 dnl ------------------------------------------------------------------------
4430 dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
4431 dnl ------------------------------------------------------------------------
4433 AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
4435 AC_MSG_CHECKING(for MAXPATHLEN)
4436 AC_CACHE_VAL(ac_cv_maxpathlen,
4438 cat > conftest.$ac_ext <<EOF
4439 #ifdef STDC_HEADERS
4440 # include <stdlib.h>
4441 #endif
4442 #include <stdio.h>
4443 #include <sys/param.h>
4444 #ifndef MAXPATHLEN
4445 #define MAXPATHLEN 1024
4446 #endif
4448 KDE_HELLO MAXPATHLEN
4452 ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
4454 if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
4455     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
4456 else
4457     ac_cv_maxpathlen=1024
4460 rm conftest.*
4463 AC_MSG_RESULT($ac_cv_maxpathlen)
4464 AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
4467 AC_DEFUN([KDE_CHECK_HEADER],
4469    AC_LANG_SAVE
4470    kde_safe_cppflags=$CPPFLAGS
4471    CPPFLAGS="$CPPFLAGS $all_includes"
4472    AC_LANG_CPLUSPLUS
4473    AC_CHECK_HEADER([$1], [$2], [$3], [$4])
4474    CPPFLAGS=$kde_safe_cppflags
4475    AC_LANG_RESTORE
4478 AC_DEFUN([KDE_CHECK_HEADERS],
4480    AH_CHECK_HEADERS([$1])
4481    AC_LANG_SAVE
4482    kde_safe_cppflags=$CPPFLAGS
4483    CPPFLAGS="$CPPFLAGS $all_includes"
4484    AC_LANG_CPLUSPLUS
4485    AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
4486    CPPFLAGS=$kde_safe_cppflags
4487    AC_LANG_RESTORE
4490 AC_DEFUN([KDE_FAST_CONFIGURE],
4492   dnl makes configure fast (needs perl)
4493   AC_ARG_ENABLE(fast-perl, [  --disable-fast-perl     disable fast Makefile generation (needs perl)],
4494       with_fast_perl=$enableval, with_fast_perl=yes)
4497 AC_DEFUN([KDE_CONF_FILES],
4499   val=
4500   if test -f $srcdir/configure.files ; then
4501     val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
4502   fi
4503   CONF_FILES=
4504   if test -n "$val" ; then
4505     for i in $val ; do
4506       CONF_FILES="$CONF_FILES $i"
4507     done
4508   fi
4509   AC_SUBST(CONF_FILES)
4510 ])dnl
4512 AC_DEFUN([KDE_SET_PREFIX],
4514   unset CDPATH
4515   dnl make $KDEDIR the default for the installation
4516   AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
4518   if test "x$prefix" = "xNONE"; then
4519     prefix=$ac_default_prefix
4520     ac_configure_args="$ac_configure_args --prefix=$prefix"
4521   fi
4522   # And delete superfluous '/' to make compares easier
4523   prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4524   exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4525   KDE_FAST_CONFIGURE
4526   KDE_CONF_FILES
4529 pushdef([AC_PROG_INSTALL],
4531   dnl our own version, testing for a -p flag
4532   popdef([AC_PROG_INSTALL])
4533   dnl as AC_PROG_INSTALL works as it works we first have
4534   dnl to save if the user didn't specify INSTALL, as the
4535   dnl autoconf one overwrites INSTALL and we have no chance to find
4536   dnl out afterwards
4537   test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
4538   test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
4539   test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
4540   AC_PROG_INSTALL
4542   if test -z "$kde_save_INSTALL_given" ; then
4543     # OK, user hasn't given any INSTALL, autoconf found one for us
4544     # now we test, if it supports the -p flag
4545     AC_MSG_CHECKING(for -p flag to install)
4546     rm -f confinst.$$.* > /dev/null 2>&1
4547     echo "Testtest" > confinst.$$.orig
4548     ac_res=no
4549     if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
4550       if test -f confinst.$$.new ; then
4551         # OK, -p seems to do no harm to install
4552         INSTALL="${INSTALL} -p"
4553         ac_res=yes
4554       fi
4555     fi
4556     rm -f confinst.$$.*
4557     AC_MSG_RESULT($ac_res)
4558   fi
4559   dnl the following tries to resolve some signs and wonders coming up
4560   dnl with different autoconf/automake versions
4561   dnl e.g.:
4562   dnl  *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
4563   dnl   and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
4564   dnl   it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
4565   dnl  *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
4566   dnl   INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
4567   dnl   install-@DIR@PROGRAMS targets to explicitly use that flag
4568   dnl  *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
4569   dnl   INSTALL_SCRIPT, which breaks with automake <= 1.4
4570   dnl  *autoconf >2.13 (since 10.Apr 1999) has not that failure
4571   dnl  *sometimes KDE does not use the install-@DIR@PROGRAM targets from
4572   dnl   automake (due to broken Makefile.am or whatever) to install programs,
4573   dnl   and so does not see the -s flag in automake > 1.4
4574   dnl to clean up that mess we:
4575   dnl  +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
4576   dnl   which cleans KDE's program with automake > 1.4;
4577   dnl  +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
4578   dnl   with automake<=1.4
4579   dnl  note that dues to this sometimes two '-s' flags are used (if KDE
4580   dnl   properly uses install-@DIR@PROGRAMS, but I don't care
4581   dnl
4582   dnl And to all this comes, that I even can't write in comments variable
4583   dnl  names used by automake, because it is so stupid to think I wanted to
4584   dnl  _use_ them, therefor I have written A_M_... instead of AM_
4585   dnl hmm, I wanted to say something ... ahh yes: Arghhh.
4587   if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
4588     INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
4589   fi
4590   if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
4591     INSTALL_SCRIPT='${INSTALL}'
4592   fi
4593 ])dnl
4595 AC_DEFUN([KDE_LANG_CPLUSPLUS],
4596 [AC_LANG_CPLUSPLUS
4597 ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
4598 pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
4601 pushdef([AC_LANG_CPLUSPLUS],
4602 [popdef([AC_LANG_CPLUSPLUS])
4603 KDE_LANG_CPLUSPLUS
4606 AC_DEFUN([KDE_CHECK_LONG_LONG],
4608 AC_MSG_CHECKING(for long long)
4609 AC_CACHE_VAL(kde_cv_c_long_long,
4611   AC_LANG_SAVE
4612   AC_LANG_CPLUSPLUS
4613   AC_TRY_LINK([], [
4614   long long foo = 0;
4615   foo = foo+1;
4616   ],
4617   kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
4618   AC_LANG_RESTORE
4620 AC_MSG_RESULT($kde_cv_c_long_long)
4621 if test "$kde_cv_c_long_long" = yes; then
4622    AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
4626 AC_DEFUN([KDE_CHECK_LIB],
4628      kde_save_LDFLAGS="$LDFLAGS"
4629      dnl AC_CHECK_LIB modifies LIBS, so save it here
4630      kde_save_LIBS="$LIBS"
4631      LDFLAGS="$LDFLAGS $all_libraries"
4632      case $host_os in
4633       aix*) LDFLAGS="-brtl $LDFLAGS"
4634         test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
4635         ;;
4636      esac
4637      AC_CHECK_LIB($1, $2, $3, $4, $5)
4638      LDFLAGS="$kde_save_LDFLAGS"
4639      LIBS="$kde_save_LIBS"
4642 AC_DEFUN([KDE_JAVA_PREFIX],
4644         dir=`dirname "$1"`
4645         base=`basename "$1"`
4646         list=`ls -1 $dir 2> /dev/null`
4647         for entry in $list; do 
4648                 if test -d $dir/$entry/bin; then
4649                         case $entry in
4650                            $base)
4651                                 javadirs="$javadirs $dir/$entry/bin"
4652                                 ;;
4653                         esac
4654                 elif test -d $dir/$entry/jre/bin; then
4655                         case $entry in
4656                            $base)
4657                                 javadirs="$javadirs $dir/$entry/jre/bin"
4658                                 ;;
4659                         esac
4660                 fi
4661         done
4664 dnl KDE_CHEC_JAVA_DIR(onlyjre)
4665 AC_DEFUN([KDE_CHECK_JAVA_DIR],
4668 AC_ARG_WITH(java,
4669 [  --with-java=javadir     use java installed in javadir, --without-java disables ],
4670 [  ac_java_dir=$withval
4671 ], ac_java_dir=""
4674 AC_MSG_CHECKING([for Java])
4676 dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
4677 if test "x$ac_java_dir" = "xno"; then
4678    kde_java_bindir=no
4679    kde_java_includedir=no
4680    kde_java_libjvmdir=no
4681    kde_java_libgcjdir=no
4682    kde_java_libhpidir=no
4683 else
4684   if test "x$ac_java_dir" = "x"; then
4685      
4686      
4687       dnl No option set -> collect list of candidate paths
4688       if test -n "$JAVA_HOME"; then
4689         KDE_JAVA_PREFIX($JAVA_HOME)
4690       fi
4691       KDE_JAVA_PREFIX(/usr/j2se)
4692       KDE_JAVA_PREFIX(/usr/lib/j2se)
4693       KDE_JAVA_PREFIX(/usr/j*dk*)
4694       KDE_JAVA_PREFIX(/usr/lib/j*dk*)
4695       KDE_JAVA_PREFIX(/opt/j*sdk*)
4696       KDE_JAVA_PREFIX(/usr/lib/java*)
4697       KDE_JAVA_PREFIX(/usr/java*)
4698       KDE_JAVA_PREFIX(/usr/java/j*dk*)
4699       KDE_JAVA_PREFIX(/usr/java/j*re*)
4700       KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
4701       KDE_JAVA_PREFIX(/usr/lib/SunJava*)
4702       KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
4703       KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
4704       KDE_JAVA_PREFIX(/opt/java*)
4706       kde_cv_path="NONE"
4707       kde_save_IFS=$IFS
4708       IFS=':'
4709       for dir in $PATH; do
4710           if test -d "$dir"; then
4711               javadirs="$javadirs $dir"
4712           fi
4713       done
4714       IFS=$kde_save_IFS
4715       jredirs=
4717       dnl Now javadirs contains a list of paths that exist, all ending with bin/
4718       for dir in $javadirs; do
4719           dnl Check for the java executable
4720           if test -x "$dir/java"; then
4721               dnl And also check for a libjvm.so somewhere under there
4722               dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
4723               if test "$dir" != "/usr/bin"; then
4724                   libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
4725                   if test ! -f $libjvmdir/libjvm.so; then continue; fi
4726                   jredirs="$jredirs $dir"
4727               fi
4728           fi
4729       done
4731       dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
4732       JAVAC=
4733       JAVA=
4734       kde_java_bindir=no
4735       for dir in $jredirs; do
4736           JAVA="$dir/java"
4737           kde_java_bindir=$dir
4738           if test -x "$dir/javac"; then
4739                 JAVAC="$dir/javac"
4740                 break
4741           fi
4742       done
4744       if test -n "$JAVAC"; then
4745           dnl this substitution might not work - well, we test for jni.h below
4746           kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
4747       else
4748           kde_java_includedir=no
4749       fi
4750   else
4751     dnl config option set
4752     kde_java_bindir=$ac_java_dir/bin
4753     if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
4754         kde_java_includedir=no
4755     else
4756         kde_java_includedir=$ac_java_dir/include
4757     fi
4758   fi
4761 dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
4762 if test "x$kde_java_bindir" != "xno"; then
4764   dnl Look for libjvm.so
4765   kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
4766   dnl Look for libgcj.so
4767   kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
4768   dnl Look for libhpi.so and avoid green threads
4769   kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
4771   dnl Now check everything's fine under there
4772   dnl the include dir is our flag for having the JDK
4773   if test -d "$kde_java_includedir"; then
4774     if test ! -x "$kde_java_bindir/javac"; then
4775       AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
4776     fi
4777     if test ! -x "$kde_java_bindir/javah"; then
4778       AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
4779     fi
4780     if test ! -x "$kde_java_bindir/jar"; then
4781       AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
4782     fi
4783     if test ! -r "$kde_java_includedir/jni.h"; then
4784       AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
4785     fi
4787     jni_includes="-I$kde_java_includedir"
4788     dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
4789     dnl and under linux here.. 
4790     
4791     dnl not needed for gcj
4793     if test "x$kde_java_libgcjdir" = "x"; then 
4794       test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
4795       test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
4796       test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
4797     fi
4799   else
4800     JAVAC=
4801     jni_includes=
4802   fi
4804   if test "x$kde_java_libgcjdir" = "x"; then 
4805      if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
4806         AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
4807      fi 
4808   else
4809      if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
4810         AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
4811      fi 
4812   fi
4814   if test ! -x "$kde_java_bindir/java"; then
4815       AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
4816   fi
4818   dnl not needed for gcj compile
4820   if test "x$kde_java_libgcjdir" = "x"; then 
4821       if test ! -r "$kde_java_libhpidir/libhpi.so"; then
4822         AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
4823       fi
4824   fi
4826   if test -n "$jni_includes"; then
4827     dnl Check for JNI version
4828     AC_LANG_SAVE
4829     AC_LANG_CPLUSPLUS
4830     ac_cxxflags_safe="$CXXFLAGS"
4831     CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
4833     AC_TRY_COMPILE([
4834   #include <jni.h>
4835               ],
4836               [
4837   #ifndef JNI_VERSION_1_2
4838   Syntax Error
4839   #endif
4840               ],[ kde_jni_works=yes ],
4841               [ kde_jni_works=no ])
4843     if test $kde_jni_works = no; then
4844       AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
4845                     You need to have Java Development Kit (JDK) version 1.2. 
4847                     Use --with-java to specify another location.
4848                     Use --without-java to configure without java support.
4849                     Or download a newer JDK and try again. 
4850                     See e.g. http://java.sun.com/products/jdk/1.2 ])
4851     fi
4853     CXXFLAGS="$ac_cxxflags_safe"    
4854     AC_LANG_RESTORE
4856     dnl All tests ok, inform and subst the variables
4858     JAVAC=$kde_java_bindir/javac
4859     JAVAH=$kde_java_bindir/javah
4860     JAR=$kde_java_bindir/jar
4861     AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
4862     if test "x$kde_java_libgcjdir" = "x"; then 
4863       JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
4864     else
4865       JVMLIBS="-L$kde_java_libgcjdir -lgcj"
4866     fi
4867     AC_MSG_RESULT([java JDK in $kde_java_bindir])
4869   else
4870       AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
4871       AC_MSG_RESULT([java JRE in $kde_java_bindir])
4872   fi
4873 elif test -d "/Library/Java/Home"; then
4874   kde_java_bindir="/Library/Java/Home/bin"
4875   jni_includes="-I/Library/Java/Home/include"
4877   JAVAC=$kde_java_bindir/javac
4878   JAVAH=$kde_java_bindir/javah
4879   JAR=$kde_java_bindir/jar
4880   JVMLIBS="-Xlinker -framework -Xlinker JavaVM"
4882   AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
4883   AC_MSG_RESULT([Apple Java Framework])
4884 else
4885   AC_MSG_RESULT([none found])
4888 AC_SUBST(JAVAC)
4889 AC_SUBST(JAVAH)
4890 AC_SUBST(JAR)
4891 AC_SUBST(JVMLIBS)
4892 AC_SUBST(jni_includes)
4894 # for backward compat
4895 kde_cv_java_includedir=$kde_java_includedir
4896 kde_cv_java_bindir=$kde_java_bindir
4899 dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
4900 dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
4901 dnl big packages, m4_foreach is dog-slow.  So use our own version of
4902 dnl it.  (matz@kde.org)
4903 m4_define([mm_foreach],
4904 [m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
4905 m4_define([mm_car], [[$1]])
4906 m4_define([mm_car2], [[$@]])
4907 m4_define([_mm_foreach],
4908 [m4_if(m4_quote($2), [], [],
4909        [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
4910                                                    mm_car2(m4_shift($2)),
4911                                                    [$3])])])
4912 m4_define([AC_FOREACH],
4913 [mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
4915 AC_DEFUN([KDE_NEED_FLEX],
4917 kde_libs_safe=$LIBS
4918 LIBS="$LIBS $USER_LDFLAGS"
4919 AM_PROG_LEX
4920 LIBS=$kde_libs_safe
4921 if test -z "$LEXLIB"; then
4922     AC_MSG_ERROR([You need to have flex installed.])
4924 AC_SUBST(LEXLIB)
4927 AC_DEFUN([AC_PATH_QTOPIA],
4929   dnl TODO: use AC_CACHE_VAL
4931   if test -z "$1"; then
4932     qtopia_minver_maj=1
4933     qtopia_minver_min=5
4934     qtopia_minver_pat=0
4935   else
4936     qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
4937     qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
4938     qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
4939   fi
4941   qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
4942   qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
4944   AC_REQUIRE([AC_PATH_QT])
4946   AC_MSG_CHECKING([for Qtopia])
4948   LIB_QTOPIA="-lqpe"
4949   AC_SUBST(LIB_QTOPIA)
4951   kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
4953   ac_qtopia_incdir=NO
4955   AC_ARG_WITH(qtopia-dir,
4956               [  --with-qtopia-dir=DIR   where the root of Qtopia is installed ],
4957               [  ac_qtopia_incdir="$withval"/include] ) 
4958   
4959   qtopia_incdirs=""
4960   for dir in $kde_qtopia_dirs; do
4961     qtopia_incdirs="$qtopia_incdirs $dir/include"
4962   done
4964   if test ! "$ac_qtopia_incdir" = "NO"; then
4965     qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
4966   fi
4968   qtopia_incdir=""
4969   AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
4970   ac_qtopia_incdir="$qtopia_incdir"
4972   if test -z "$qtopia_incdir"; then
4973     AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
4974   fi
4976   qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
4977   qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
4978   qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
4980   qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
4981   qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
4982   if test "$qtopia_ver" -lt "$qtopia_minver"; then
4983     AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
4984 is required.])
4985   fi
4987   AC_LANG_SAVE
4988   AC_LANG_CPLUSPLUS
4990   ac_cxxflags_safe="$CXXFLAGS"
4991   ac_ldflags_safe="$LDFLAGS"
4992   ac_libs_safe="$LIBS"
4994   CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
4995   LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
4996   LIBS="$LIBS $LIB_QTOPIA $LIBQT"
4998   cat > conftest.$ac_ext <<EOF
4999 #include "confdefs.h"
5000 #include <qpe/qpeapplication.h>
5001 #include <qpe/version.h>
5003 int main( int argc, char **argv )
5005     QPEApplication app( argc, argv );
5006     return 0;
5010   if AC_TRY_EVAL(ac_link) && test -s conftest; then
5011     rm -f conftest*
5012   else
5013     rm -f conftest*
5014     AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
5015 the end of config.log])
5016   fi
5018   CXXFLAGS="$ac_cxxflags_safe"
5019   LDFLAGS="$ac_ldflags_safe"
5020   LIBS="$ac_libs_safe"
5022   AC_LANG_RESTORE
5024   QTOPIA_INCLUDES="-I$qtopia_incdir"
5025   AC_SUBST(QTOPIA_INCLUDES)
5027   AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
5031 AC_DEFUN([KDE_INIT_DOXYGEN],
5033 AC_MSG_CHECKING([for Qt docs])
5034 kde_qtdir=
5035 if test "${with_qt_dir+set}" = set; then
5036   kde_qtdir="$with_qt_dir"
5039 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)
5040 AC_MSG_RESULT($QTDOCDIR)
5042 AC_SUBST(QTDOCDIR)
5044 KDE_FIND_PATH(dot, DOT, [], [])
5045 if test -n "$DOT"; then
5046   KDE_HAVE_DOT="YES"
5047 else
5048   KDE_HAVE_DOT="NO"
5050 AC_SUBST(KDE_HAVE_DOT)
5051 KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
5052 AC_SUBST(DOXYGEN)
5054 DOXYGEN_PROJECT_NAME="$1"
5055 DOXYGEN_PROJECT_NUMBER="$2"
5056 AC_SUBST(DOXYGEN_PROJECT_NAME)
5057 AC_SUBST(DOXYGEN_PROJECT_NUMBER)
5059 KDE_HAS_DOXYGEN=no
5060 if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then
5061   KDE_HAS_DOXYGEN=yes
5063 AC_SUBST(KDE_HAS_DOXYGEN)
5068 AC_DEFUN([AC_FIND_BZIP2],
5070 AC_MSG_CHECKING([for bzDecompress in libbz2])
5071 AC_CACHE_VAL(ac_cv_lib_bzip2,
5073 AC_LANG_SAVE
5074 AC_LANG_CPLUSPLUS
5075 kde_save_LIBS="$LIBS"
5076 LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
5077 kde_save_CXXFLAGS="$CXXFLAGS"
5078 CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
5079 AC_TRY_LINK(dnl
5081 #define BZ_NO_STDIO
5082 #include<bzlib.h>
5084             [ bz_stream s; (void) bzDecompress(&s); ],
5085             eval "ac_cv_lib_bzip2='-lbz2'",
5086             eval "ac_cv_lib_bzip2=no")
5087 LIBS="$kde_save_LIBS"
5088 CXXFLAGS="$kde_save_CXXFLAGS"
5089 AC_LANG_RESTORE
5090 ])dnl
5091 AC_MSG_RESULT($ac_cv_lib_bzip2)
5093 if test ! "$ac_cv_lib_bzip2" = no; then
5094   BZIP2DIR=bzip2
5096   LIBBZ2="$ac_cv_lib_bzip2"
5097   AC_SUBST(LIBBZ2)
5099 else
5101    cxx_shared_flag=
5102    ld_shared_flag=
5103    KDE_CHECK_COMPILER_FLAG(shared, [
5104         ld_shared_flag="-shared"
5105    ])
5106    KDE_CHECK_COMPILER_FLAG(fPIC, [
5107         cxx_shared_flag="-fPIC"
5108    ])
5110    AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
5111    AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
5112    [
5113    AC_LANG_SAVE
5114    AC_LANG_CPLUSPLUS
5115    kde_save_LIBS="$LIBS"
5116    LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
5117    kde_save_CXXFLAGS="$CXXFLAGS"
5118    CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
5120    AC_TRY_LINK(dnl
5121    [
5122    #define BZ_NO_STDIO
5123    #include<bzlib.h>
5124    ],
5125                [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
5126                eval "ac_cv_lib_bzip2_prefix='-lbz2'",
5127                eval "ac_cv_lib_bzip2_prefix=no")
5128    LIBS="$kde_save_LIBS"
5129    CXXFLAGS="$kde_save_CXXFLAGS"
5130    AC_LANG_RESTORE
5131    ])dnl
5133    AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
5134    
5135    if test ! "$ac_cv_lib_bzip2_prefix" = no; then
5136      BZIP2DIR=bzip2
5137     
5138      LIBBZ2="$ac_cv_lib_bzip2_prefix"
5139      AC_SUBST(LIBBZ2)
5141      AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
5142    dnl else, we just ignore this
5143    fi
5146 AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
5149 dnl ------------------------------------------------------------------------
5150 dnl Try to find the SSL headers and libraries.
5151 dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
5152 dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
5153 dnl ------------------------------------------------------------------------
5155 AC_DEFUN([KDE_CHECK_SSL],
5157 LIBSSL="-lssl -lcrypto"
5158 AC_REQUIRE([KDE_CHECK_LIB64])
5160 ac_ssl_includes=NO ac_ssl_libraries=NO
5161 ssl_libraries=""
5162 ssl_includes=""
5163 AC_ARG_WITH(ssl-dir,
5164     [  --with-ssl-dir=DIR      where the root of OpenSSL is installed],
5165     [  ac_ssl_includes="$withval"/include
5166        ac_ssl_libraries="$withval"/lib$kdelibsuff
5167     ])
5169 want_ssl=yes
5170 AC_ARG_WITH(ssl,
5171     [  --without-ssl           disable SSL checks],
5172     [want_ssl=$withval])
5174 if test $want_ssl = yes; then
5176 AC_MSG_CHECKING(for OpenSSL)
5178 AC_CACHE_VAL(ac_cv_have_ssl,
5179 [#try to guess OpenSSL locations
5180   
5181   ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
5182   ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
5183   AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
5184   ac_ssl_includes="$ssl_incdir"
5186   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"
5187   if test ! "$ac_ssl_libraries" = "NO"; then
5188     ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
5189   fi
5191   test=NONE
5192   ssl_libdir=NONE
5193   for dir in $ssl_libdirs; do
5194     try="ls -1 $dir/libssl*"
5195     if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
5196   done
5198   ac_ssl_libraries="$ssl_libdir"
5200   ac_ldflags_safe="$LDFLAGS"
5201   ac_libs_safe="$LIBS"
5203   LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
5204   LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
5206   AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
5207   ac_ssl_rsaref="yes"
5208   ,
5209   ac_ssl_rsaref="no"
5210   )
5212   LDFLAGS="$ac_ldflags_safe"
5213   LIBS="$ac_libs_safe"
5215   if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
5216     have_ssl=no
5217   else
5218     have_ssl=yes;
5219   fi
5221   ])
5223   eval "$ac_cv_have_ssl"
5225   AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
5227   AC_MSG_CHECKING([whether OpenSSL uses rsaref])
5228   AC_MSG_RESULT($ac_ssl_rsaref)
5230   AC_MSG_CHECKING([for easter eggs])
5231   AC_MSG_RESULT([none found])
5233 else
5234   have_ssl=no
5237 if test "$have_ssl" = yes; then
5238   AC_MSG_CHECKING(for OpenSSL version)
5239   dnl Check for SSL version
5240   AC_CACHE_VAL(ac_cv_ssl_version,
5241   [
5243     cat >conftest.$ac_ext <<EOF
5244 #include <openssl/opensslv.h>
5245 #include <stdio.h>
5246     int main() {
5248 #ifndef OPENSSL_VERSION_NUMBER
5249       printf("ssl_version=\\"error\\"\n");
5250 #else
5251       if (OPENSSL_VERSION_NUMBER < 0x00906000)
5252         printf("ssl_version=\\"old\\"\n");
5253       else
5254         printf("ssl_version=\\"ok\\"\n");
5255 #endif
5256      return (0);
5257     }
5260     ac_save_CPPFLAGS=$CPPFLAGS
5261     if test "$ac_ssl_includes" != "/usr/include"; then
5262         CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
5263     fi
5265     if AC_TRY_EVAL(ac_link); then 
5267       if eval `./conftest 2>&5`; then
5268         if test $ssl_version = error; then
5269           AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
5270         else
5271           if test $ssl_version = old; then
5272             AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
5273             have_ssl=no
5274           fi
5275         fi
5276         ac_cv_ssl_version="ssl_version=$ssl_version"
5277       else
5278         AC_MSG_ERROR([Your system couldn't run a small SSL test program.
5279         Check config.log, and if you can't figure it out, send a mail to 
5280         David Faure <faure@kde.org>, attaching your config.log])
5281       fi
5283     else
5284       AC_MSG_ERROR([Your system couldn't link a small SSL test program.
5285       Check config.log, and if you can't figure it out, send a mail to 
5286       David Faure <faure@kde.org>, attaching your config.log])
5287     fi 
5288     CPPFLAGS=$ac_save_CPPFLAGS
5290   ])
5292   eval "$ac_cv_ssl_version"
5293   AC_MSG_RESULT($ssl_version)
5296 if test "$have_ssl" != yes; then
5297   LIBSSL="";
5298 else
5299   AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
5300   ac_cv_have_ssl="have_ssl=yes \
5301     ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
5302   
5303   
5304   ssl_libraries="$ac_ssl_libraries"
5305   ssl_includes="$ac_ssl_includes"
5307   if test "$ac_ssl_rsaref" = yes; then
5308     LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" 
5309   fi
5311   if test $ssl_version = "old"; then
5312     AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
5313   fi
5316 SSL_INCLUDES=
5318 if test "$ssl_includes" = "/usr/include"; then
5319   if test -f /usr/kerberos/include/krb5.h; then
5320         SSL_INCLUDES="-I/usr/kerberos/include"
5321   fi
5322 elif test  "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
5323   SSL_INCLUDES="-I$ssl_includes"
5326 if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
5327  SSL_LDFLAGS=""
5328 else
5329  SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
5332 AC_SUBST(SSL_INCLUDES)
5333 AC_SUBST(SSL_LDFLAGS)
5334 AC_SUBST(LIBSSL)
5337 AC_DEFUN([KDE_CHECK_STRLCPY],
5339   AC_REQUIRE([AC_CHECK_STRLCAT])
5340   AC_REQUIRE([AC_CHECK_STRLCPY])
5341   AC_CHECK_SIZEOF(size_t)
5342   AC_CHECK_SIZEOF(unsigned long)
5344   AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
5345   AC_TRY_COMPILE(,[
5346     #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
5347        choke me
5348     #endif
5349     ],AC_MSG_RESULT([yes]),[
5350       AC_MSG_RESULT(no)
5351       AC_MSG_ERROR([
5352        Apparently on your system our assumption sizeof size_t == sizeof unsigned long 
5353        does not apply. Please mail kde-devel@kde.org with a description of your system!
5354       ])
5355   ])
5358 AC_DEFUN([KDE_CHECK_BINUTILS],
5360   AC_MSG_CHECKING([if ld supports unversioned version maps])
5362   kde_save_LDFLAGS="$LDFLAGS"
5363   LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
5364   echo "{ local: extern \"C++\" { foo }; };" > conftest.map
5365   AC_TRY_LINK([int foo;],
5367 #ifdef __INTEL_COMPILER
5368 icc apparently does not support libtools version-info and version-script
5369 at the same time. Dunno where the bug is, but until somebody figured out,
5370 better disable the optional version scripts.
5371 #endif
5373   foo = 42;
5374 ], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
5375   LDFLAGS="$kde_save_LDFLAGS"
5376   rm -f conftest.map
5377   AM_CONDITIONAL(include_VERSION_SCRIPT, 
5378     [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
5380   AC_MSG_RESULT($kde_supports_versionmaps)
5383 AC_DEFUN([AM_PROG_OBJC],[
5384 AC_CHECK_PROGS(OBJC, gcc, gcc)
5385 test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
5386 if test "x${OBJCFLAGS-unset}" = xunset; then
5387    OBJCFLAGS="-g -O2"
5389 AC_SUBST(OBJCFLAGS)
5390 _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
5393 AC_DEFUN([KDE_CHECK_PERL],
5395         KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
5396                     AC_MSG_ERROR([No Perl found in your $PATH.
5397 We need perl to generate some code.])
5398         ])
5399     AC_SUBST(PERL)