home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 2001 January / CT_SW0101.ISO / pc / software / kommunik / ftp / kmago112.tgz / kmago112.tar / kmago-1.1.2 / aclocal.m4 < prev    next >
M4 Source File  |  2001-04-19  |  139KB  |  5,037 lines

  1. dnl aclocal.m4 generated automatically by aclocal 1.4
  2.  
  3. dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
  4. dnl This file is free software; the Free Software Foundation
  5. dnl gives unlimited permission to copy and/or distribute it,
  6. dnl with or without modifications, as long as this notice is preserved.
  7.  
  8. dnl This program is distributed in the hope that it will be useful,
  9. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  10. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11. dnl PARTICULAR PURPOSE.
  12.  
  13.  
  14. dnl    This file is part of the KDE libraries/packages
  15. dnl    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
  16. dnl              (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
  17.  
  18. dnl    This file is free software; you can redistribute it and/or
  19. dnl    modify it under the terms of the GNU Library General Public
  20. dnl    License as published by the Free Software Foundation; either
  21. dnl    version 2 of the License, or (at your option) any later version.
  22.  
  23. dnl    This library is distributed in the hope that it will be useful,
  24. dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  26. dnl    Library General Public License for more details.
  27.  
  28. dnl    You should have received a copy of the GNU Library General Public License
  29. dnl    along with this library; see the file COPYING.LIB.  If not, write to
  30. dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  31. dnl    Boston, MA 02111-1307, USA.
  32.  
  33. dnl IMPORTANT NOTE:
  34. dnl Please do not modify this file unless you expect your modifications to be
  35. dnl carried into every other module in the repository. If you decide that you
  36. dnl really want to modify it, contact coolo@kde.org mentioning that you have
  37. dnl and that the modified file should be committed to every module.
  38. dnl
  39. dnl Single-module modifications are best placed in configure.in for kdelibs
  40. dnl and kdebase or configure.in.in if present.
  41.  
  42.  
  43. dnl ------------------------------------------------------------------------
  44. dnl Find a file (or one of more files in a list of dirs)
  45. dnl ------------------------------------------------------------------------
  46. dnl
  47. AC_DEFUN(AC_FIND_FILE,
  48. [
  49. $3=NO
  50. for i in $2;
  51. do
  52.   for j in $1;
  53.   do
  54.     if test -r "$i/$j"; then
  55.       $3=$i
  56.       break 2
  57.     fi
  58.   done
  59. done
  60. ])
  61.  
  62. dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
  63. dnl    if-not-found, test-parameter)
  64. AC_DEFUN(KDE_FIND_PATH,
  65. [
  66.    AC_MSG_CHECKING([for $1])
  67.    if test -n "$$2"; then
  68.         kde_cv_path="$$2";
  69.    else
  70.         kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
  71.  
  72.         AC_CACHE_VAL(kde_cv_path_$kde_cache,
  73.         [
  74.         kde_cv_path="NONE"
  75.     dirs="$3"
  76.     kde_save_IFS=$IFS
  77.     IFS=':'
  78.     for dir in $PATH; do
  79.       dirs="$dirs $dir"
  80.         done
  81.     IFS=$kde_save_IFS
  82.  
  83.         for dir in $dirs; do
  84.       if test -x "$dir/$1"; then
  85.         if test -n "$5"
  86.         then
  87.               evalstr="$dir/$1 $5 2>&1 "
  88.           if eval $evalstr; then
  89.                 kde_cv_path="$dir/$1"
  90.                 break
  91.           fi
  92.             else
  93.         kde_cv_path="$dir/$1"
  94.                 break
  95.         fi
  96.           fi
  97.         done
  98.  
  99.         eval "kde_cv_path_$kde_cache=$kde_cv_path"
  100.  
  101.         ])
  102.  
  103.       eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
  104.  
  105.    fi
  106.  
  107.    if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
  108.       AC_MSG_RESULT(not found)
  109.       $4
  110.    else
  111.       AC_MSG_RESULT($kde_cv_path)
  112.       $2=$kde_cv_path
  113.  
  114.    fi
  115. ])
  116.  
  117. AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
  118. [
  119.     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
  120. Please check whether you installed Qt correctly.
  121. You need to have a running moc binary.
  122. configure tried to run $ac_cv_path_moc and the test didn't
  123. succeed. If configure shouldn't have tried this one, set
  124. the environment variable MOC to the right one before running
  125. configure.
  126. ])
  127. ])
  128.  
  129. AC_DEFUN(KDE_UIC_ERROR_MESSAGE,
  130. [
  131.     AC_MSG_WARN([No Qt ui compiler (uic) found!
  132. Please check whether you installed Qt correctly.
  133. You need to have a running uic binary.
  134. configure tried to run $ac_cv_path_uic and the test didn't
  135. succeed. If configure shouldn't have tried this one, set
  136. the environment variable UIC to the right one before running
  137. configure.
  138. ])
  139. ])
  140.  
  141. dnl ------------------------------------------------------------------------
  142. dnl Find the meta object compiler and the ui compiler in the PATH,
  143. dnl in $QTDIR/bin, and some more usual places
  144. dnl ------------------------------------------------------------------------
  145. dnl
  146. AC_DEFUN(AC_PATH_QT_MOC_UIC,
  147. [
  148.    qt_bindirs=""
  149.    for dir in $kde_qt_dirs; do
  150.       qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
  151.    done
  152.    qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
  153.    if test ! "$ac_qt_bindir" = "NO"; then
  154.       qt_bindirs="$ac_qt_bindir $qt_bindirs"
  155.    fi
  156.  
  157.    KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
  158.    if test -z "$UIC_NOT_NEEDED"; then
  159.      KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""])
  160.      if test -z "$UIC" ; then
  161.        KDE_UIC_ERROR_MESSAGE
  162.        exit 1
  163.      fi
  164.    else
  165.      UIC="echo uic not available: "
  166.    fi
  167.  
  168.    AC_SUBST(MOC)
  169.    AC_SUBST(UIC)
  170. ])
  171.  
  172. AC_DEFUN(KDE_1_CHECK_PATHS,
  173. [
  174.   KDE_1_CHECK_PATH_HEADERS
  175.  
  176.   KDE_TEST_RPATH=
  177.  
  178.   if test -n "$USE_RPATH"; then
  179.  
  180.      if test -n "$kde_libraries"; then
  181.        KDE_TEST_RPATH="-R $kde_libraries"
  182.      fi
  183.  
  184.      if test -n "$qt_libraries"; then
  185.        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
  186.      fi
  187.  
  188.      if test -n "$x_libraries"; then
  189.        KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
  190.      fi
  191.  
  192.      KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
  193.   fi
  194.  
  195. AC_MSG_CHECKING([for KDE libraries installed])
  196. 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'
  197.  
  198. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  199.   AC_MSG_RESULT(yes)
  200. else
  201.   AC_MSG_ERROR([your system fails at linking a small KDE application!
  202. Check, if your compiler is installed correctly and if you have used the
  203. same compiler to compile Qt and kdelibs as you did use now.
  204. For more details about this problem, look at the end of config.log.])
  205. fi
  206.  
  207. if eval `KDEDIR= ./conftest 2>&5`; then
  208.   kde_result=done
  209. else
  210.   kde_result=problems
  211. fi
  212.  
  213. KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
  214. kde_have_all_paths=yes
  215.  
  216. KDE_SET_PATHS($kde_result)
  217.  
  218. ])
  219.  
  220. AC_DEFUN(KDE_SET_PATHS,
  221. [
  222.   kde_cv_all_paths="kde_have_all_paths=\"yes\" \
  223.     kde_htmldir=\"$kde_htmldir\" \
  224.     kde_appsdir=\"$kde_appsdir\" \
  225.     kde_icondir=\"$kde_icondir\" \
  226.     kde_sounddir=\"$kde_sounddir\" \
  227.     kde_datadir=\"$kde_datadir\" \
  228.     kde_locale=\"$kde_locale\" \
  229.     kde_cgidir=\"$kde_cgidir\" \
  230.     kde_confdir=\"$kde_confdir\" \
  231.     kde_mimedir=\"$kde_mimedir\" \
  232.     kde_toolbardir=\"$kde_toolbardir\" \
  233.     kde_wallpaperdir=\"$kde_wallpaperdir\" \
  234.     kde_templatesdir=\"$kde_templatesdir\" \
  235.     kde_bindir=\"$kde_bindir\" \
  236.     kde_servicesdir=\"$kde_servicesdir\" \
  237.     kde_servicetypesdir=\"$kde_servicetypesdir\" \
  238.     kde_moduledir=\"$kde_moduledir\" \
  239.     kde_result=$1"
  240. ])
  241.  
  242. AC_DEFUN(KDE_SET_DEFAULT_PATHS,
  243. [
  244. if test "$1" = "default"; then
  245.  
  246.   if test -z "$kde_htmldir"; then
  247.     kde_htmldir='\${prefix}/share/doc/HTML'
  248.   fi
  249.   if test -z "$kde_appsdir"; then
  250.     kde_appsdir='\${prefix}/share/applnk'
  251.   fi
  252.   if test -z "$kde_icondir"; then
  253.     kde_icondir='\${prefix}/share/icons'
  254.   fi
  255.   if test -z "$kde_sounddir"; then
  256.     kde_sounddir='\${prefix}/share/sounds'
  257.   fi
  258.   if test -z "$kde_datadir"; then
  259.     kde_datadir='\${prefix}/share/apps'
  260.   fi
  261.   if test -z "$kde_locale"; then
  262.     kde_locale='\${prefix}/share/locale'
  263.   fi
  264.   if test -z "$kde_cgidir"; then
  265.     kde_cgidir='\${exec_prefix}/cgi-bin'
  266.   fi
  267.   if test -z "$kde_confdir"; then
  268.     kde_confdir='\${prefix}/share/config'
  269.   fi
  270.   if test -z "$kde_mimedir"; then
  271.     kde_mimedir='\${prefix}/share/mimelnk'
  272.   fi
  273.   if test -z "$kde_toolbardir"; then
  274.     kde_toolbardir='\${prefix}/share/toolbar'
  275.   fi
  276.   if test -z "$kde_wallpaperdir"; then
  277.     kde_wallpaperdir='\${prefix}/share/wallpapers'
  278.   fi
  279.   if test -z "$kde_templatesdir"; then
  280.     kde_templatesdir='\${prefix}/share/templates'
  281.   fi
  282.   if test -z "$kde_bindir"; then
  283.     kde_bindir='\${exec_prefix}/bin'
  284.   fi
  285.   if test -z "$kde_servicesdir"; then
  286.     kde_servicesdir='\${prefix}/share/services'
  287.   fi
  288.   if test -z "$kde_servicetypesdir"; then
  289.     kde_servicetypesdir='\${prefix}/share/servicetypes'
  290.   fi
  291.   if test -z "$kde_moduledir"; then
  292.     kde_moduledir='\${exec_prefix}/lib/kde2'
  293.   fi
  294.  
  295.   KDE_SET_PATHS(defaults)
  296.  
  297. else
  298.  
  299.   if test $kde_qtver = 1; then
  300.      AC_MSG_RESULT([compiling])
  301.      KDE_1_CHECK_PATHS
  302.   else
  303.      AC_MSG_ERROR([path checking not yet supported for KDE 2])
  304.   fi
  305.  
  306. fi
  307. ])
  308.  
  309. AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS,
  310. [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
  311.    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
  312.    test -z "$kde_datadir" || test -z "$kde_locale"  ||
  313.    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
  314.    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
  315.    test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
  316.    test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
  317.    test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
  318.    test "$kde_have_all_paths" != "yes"; then
  319.      kde_have_all_paths=no
  320.   fi
  321. ])
  322.  
  323. AC_DEFUN(KDE_MISSING_PROG_ERROR,
  324. [
  325.     AC_MSG_ERROR([The important program $1 was not found!
  326. Please check whether you installed KDE correctly.
  327. ])
  328. ])
  329.  
  330. AC_DEFUN(KDE_SUBST_PROGRAMS,
  331. [AC_REQUIRE([AC_CREATE_KFSSTND])dnl
  332.  
  333.         kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin"
  334.         if test -n "$KDEDIRS"; then
  335.            kde_save_IFS=$IFS
  336.            IFS=:
  337.            for dir in $KDEDIRS; do
  338.                 kde_default_bindirs="$dir/bin $kde_default_bindirs "
  339.            done
  340.            IFS=$kde_save_IFS
  341.         fi
  342.         kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
  343.         KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
  344.         KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
  345.         KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)])
  346.         KDE_FIND_PATH(kdb2html, KDB2HTML, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kdb2html)])
  347.         KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)])
  348.         KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs])
  349.  
  350.         DCOP_DEPENDENCIES='$(DCOPIDL)'
  351.         AC_SUBST(DCOPIDL)
  352.         AC_SUBST(DCOPIDL2CPP)
  353.         AC_SUBST(DCOP_DEPENDENCIES)
  354.         AC_SUBST(MCOPIDL)
  355.         AC_SUBST(KDB2HTML)
  356.         AC_SUBST(ARTSCCONFIG)
  357.         AC_SUBST(KDECONFIG)
  358.  
  359.         if test -x "$KDECONFIG"; then # it can be "compiled"
  360.           kde_libs_prefix=`$KDECONFIG --prefix`
  361.           if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
  362.                AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
  363.                           This means it has been moved since you installed it.
  364.                           This won't work. Please recompile kdelibs for the new prefix.
  365.                           ])
  366.            fi
  367.            kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
  368.         else
  369.            kde_libs_prefix='$(prefix)'
  370.            kde_libs_htmldir='$(kde_htmldir)'
  371.         fi
  372.         AC_SUBST(kde_libs_prefix)
  373.         AC_SUBST(kde_libs_htmldir)
  374. ])dnl
  375.  
  376. AC_DEFUN(AC_CREATE_KFSSTND,
  377. [
  378. AC_REQUIRE([AC_CHECK_RPATH])
  379.  
  380. AC_MSG_CHECKING([for KDE paths])
  381. kde_result=""
  382. kde_cached_paths=yes
  383. AC_CACHE_VAL(kde_cv_all_paths,
  384. [
  385.   KDE_SET_DEFAULT_PATHS($1)
  386.   kde_cached_paths=no
  387. ])
  388. eval "$kde_cv_all_paths"
  389. KDE_CHECK_PATHS_FOR_COMPLETENESS
  390. if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
  391.   # wrong values were cached, may be, we can set better ones
  392.   kde_result=
  393.   kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
  394.   kde_datadir= kde_locale=  kde_cgidir=  kde_confdir=
  395.   kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
  396.   kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
  397.   kde_have_all_paths=
  398.   KDE_SET_DEFAULT_PATHS($1)
  399.   eval "$kde_cv_all_paths"
  400.   KDE_CHECK_PATHS_FOR_COMPLETENESS
  401.   kde_result="$kde_result (cache overridden)"
  402. fi
  403. if test "$kde_have_all_paths" = "no"; then
  404.   AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
  405. Since it had compiled and linked before, it must be a strange problem on your system.
  406. Look at config.log for details. If you are not able to fix this, look at
  407. http://www.kde.org/faq/installation.html or any www.kde.org mirror.
  408. (If you're using an egcs version on Linux, you may update binutils!)
  409. ])
  410. else
  411.   rm -f conftest*
  412.   AC_MSG_RESULT($kde_result)
  413. fi
  414.  
  415. bindir=$kde_bindir
  416.  
  417. KDE_SUBST_PROGRAMS
  418.  
  419. ])
  420.  
  421. AC_DEFUN(AC_SUBST_KFSSTND,
  422. [
  423. AC_SUBST(kde_htmldir)
  424. AC_SUBST(kde_appsdir)
  425. AC_SUBST(kde_icondir)
  426. AC_SUBST(kde_sounddir)
  427. AC_SUBST(kde_datadir)
  428. AC_SUBST(kde_locale)
  429. AC_SUBST(kde_confdir)
  430. AC_SUBST(kde_mimedir)
  431. AC_SUBST(kde_wallpaperdir)
  432. AC_SUBST(kde_bindir)
  433. dnl for KDE 2
  434. AC_SUBST(kde_templatesdir)
  435. AC_SUBST(kde_servicesdir)
  436. AC_SUBST(kde_servicetypesdir)
  437. AC_SUBST(kde_moduledir)
  438. if test "$kde_qtver" = 1; then
  439.   kde_minidir="$kde_icondir/mini"
  440. else
  441. # for KDE 1 - this breaks KDE2 apps using minidir, but
  442. # that's the plan ;-/
  443.   kde_minidir="/dev/null"
  444. fi
  445. dnl AC_SUBST(kde_minidir)
  446. dnl AC_SUBST(kde_cgidir)
  447. dnl AC_SUBST(kde_toolbardir)
  448. ])
  449.  
  450. AC_DEFUN(KDE_MISC_TESTS,
  451. [
  452.    AC_LANG_C
  453.    dnl Checks for libraries.
  454.    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
  455.    AC_SUBST(LIBCOMPAT)
  456.    kde_have_crypt=
  457.    AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
  458.       AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
  459.         AC_MSG_WARN([you have no crypt in either libcrypt or libc.
  460. You should install libcrypt from another source or configure with PAM
  461. support])
  462.     kde_have_crypt=no
  463.       ]))
  464.    AC_SUBST(LIBCRYPT)
  465.    if test $kde_have_crypt = yes; then
  466.       AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
  467.    fi
  468.    AC_CHECK_KSIZE_T
  469.    AC_LANG_C
  470.    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  471.    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
  472.       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  473.         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  474.    fi
  475.    AC_CHECK_FUNC(inet_ntoa)
  476.    if test $ac_cv_func_inet_ntoa = no; then
  477.      AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
  478.    fi
  479.    AC_CHECK_FUNC(connect)
  480.    if test $ac_cv_func_connect = no; then
  481.       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
  482.         $X_EXTRA_LIBS)
  483.    fi
  484.  
  485.    AC_CHECK_FUNC(remove)
  486.    if test $ac_cv_func_remove = no; then
  487.       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
  488.    fi
  489.  
  490.    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
  491.    AC_CHECK_FUNC(shmat, ,
  492.      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
  493.    
  494.    # Solaris 2.6 needs -lresolv for res_init
  495.    AC_CHECK_FUNC(res_init, ,
  496.      AC_CHECK_LIB(resolv, res_init, X_EXTRA_LIBS="$X_EXTRA_LIBS -lresolv"))
  497.  
  498.    LIBSOCKET="$X_EXTRA_LIBS"
  499.    AC_SUBST(LIBSOCKET)
  500.    AC_SUBST(X_EXTRA_LIBS)
  501.    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
  502.    AC_SUBST(LIBUCB)
  503.  
  504.    case $host in  dnl this *is* LynxOS specific
  505.    *-*-lynxos* )
  506.         AC_MSG_CHECKING([LynxOS header file wrappers])
  507.         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
  508.         AC_MSG_RESULT(disabled)
  509.         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
  510.          ;;
  511.     esac
  512.  
  513.    KDE_CHECK_TYPES
  514.    KDE_CHECK_LIBDL
  515. ])
  516.  
  517. dnl ------------------------------------------------------------------------
  518. dnl Find the header files and libraries for X-Windows. Extended the
  519. dnl macro AC_PATH_X
  520. dnl ------------------------------------------------------------------------
  521. dnl
  522. AC_DEFUN(K_PATH_X,
  523. [
  524. AC_REQUIRE([AC_PROG_CPP])dnl
  525. AC_REQUIRE([KDE_MISC_TESTS])dnl
  526. AC_MSG_CHECKING(for X)
  527. AC_LANG_SAVE
  528. AC_LANG_C
  529. AC_CACHE_VAL(kde_cv_have_x,
  530. [# One or both of the vars are not set, and there is no cached value.
  531. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
  532.    kde_x_includes=NO
  533. else
  534.    kde_x_includes=$x_includes
  535. fi
  536. if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
  537.    kde_x_libraries=NO
  538. else
  539.    kde_x_libraries=$x_libraries
  540. fi
  541.  
  542. # below we use the standard autoconf calls
  543. ac_x_libraries=$kde_x_libraries
  544. ac_x_includes=$kde_x_includes
  545.  
  546. AC_PATH_X_DIRECT
  547. dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
  548. dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
  549. dnl location. The correct location is /usr/lib32 or an undefined value
  550. dnl (the linker is smart enough to pick the correct default library).
  551. dnl Things work just fine if you use just AC_PATH_X_DIRECT.
  552. case "$host" in
  553. mips-sgi-irix6*)
  554.   ;;
  555. *)
  556.   AC_PATH_X_XMKMF
  557.   if test -z "$ac_x_includes"; then
  558.     ac_x_includes="."
  559.   fi
  560.   if test -z "$ac_x_libraries"; then
  561.     ac_x_libraries="/usr/lib"
  562.   fi
  563. esac
  564. #from now on we use our own again
  565.  
  566. # when the user already gave --x-includes, we ignore
  567. # what the standard autoconf macros told us.
  568. if test "$kde_x_includes" = NO; then
  569.   kde_x_includes=$ac_x_includes
  570. fi
  571.  
  572. # for --x-libraries too
  573. if test "$kde_x_libraries" = NO; then
  574.   kde_x_libraries=$ac_x_libraries
  575. fi
  576.  
  577. if test "$kde_x_includes" = NO; then
  578.   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
  579. fi
  580.  
  581. if test "$kde_x_libraries" = NO; then
  582.   AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
  583. fi
  584.  
  585. # Record where we found X for the cache.
  586. kde_cv_have_x="have_x=yes \
  587.          kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
  588. ])dnl
  589. eval "$kde_cv_have_x"
  590.  
  591. if test "$have_x" != yes; then
  592.   AC_MSG_RESULT($have_x)
  593.   no_x=yes
  594. else
  595.   AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
  596. fi
  597.  
  598. if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
  599.   X_INCLUDES=""
  600.   x_includes="."; dnl better than nothing :-
  601.  else
  602.   x_includes=$kde_x_includes
  603.   X_INCLUDES="-I$x_includes"
  604. fi
  605.  
  606. if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
  607.   X_LDFLAGS=""
  608.   x_libraries="/usr/lib"; dnl better than nothing :-
  609.  else
  610.   x_libraries=$kde_x_libraries
  611.   X_LDFLAGS="-L$x_libraries"
  612. fi
  613. all_includes="$X_INCLUDES"
  614. all_libraries="$X_LDFLAGS"
  615.  
  616. AC_SUBST(X_INCLUDES)
  617. AC_SUBST(X_LDFLAGS)
  618. AC_SUBST(x_libraries)
  619. AC_SUBST(x_includes)
  620.  
  621. # Check for libraries that X11R6 Xt/Xaw programs need.
  622. ac_save_LDFLAGS="$LDFLAGS"
  623. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  624. # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
  625. # check for ICE first), but we must link in the order -lSM -lICE or
  626. # we get undefined symbols.  So assume we have SM if we have ICE.
  627. # These have to be linked with before -lX11, unlike the other
  628. # libraries we check for below, so use a different variable.
  629. #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
  630. AC_CHECK_LIB(ICE, IceConnectionNumber,
  631.   [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
  632. AC_SUBST(LIBSM)
  633. LDFLAGS="$ac_save_LDFLAGS"
  634.  
  635. AC_SUBST(X_PRE_LIBS)
  636.  
  637. LIB_X11='-lX11 $(LIBSOCKET)'
  638. AC_SUBST(LIB_X11)
  639.  
  640. AC_MSG_CHECKING(for libXext)
  641. AC_CACHE_VAL(kde_cv_have_libXext,
  642. [
  643. kde_ldflags_safe="$LDFLAGS"
  644. kde_libs_safe="$LIBS"
  645.  
  646. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
  647. LIBS="-lXext -lX11 $LIBSOCKET"
  648.  
  649. AC_TRY_LINK([
  650. #include <stdio.h>
  651. ],
  652. [
  653. printf("hello Xext\n");
  654. ],
  655. kde_cv_have_libXext=yes,
  656. kde_cv_have_libXext=no
  657.    )
  658.  
  659. LDFLAGS=$kde_ldflags_safe
  660. LIBS=$kde_libs_safe
  661.  ])
  662.  
  663. AC_MSG_RESULT($kde_cv_have_libXext)
  664.  
  665. if test "$kde_cv_have_libXext" = "no"; then
  666.   AC_MSG_ERROR([We need a working libXext to proceed. Since configure
  667. can't find it itself, we stop here assuming that make wouldn't find
  668. them either.])
  669. fi
  670.  
  671. ])
  672.  
  673. AC_LANG_RESTORE
  674. ])
  675.  
  676. AC_DEFUN(KDE_PRINT_QT_PROGRAM,
  677. [
  678. AC_REQUIRE([KDE_USE_QT])
  679. cat > conftest.$ac_ext <<EOF
  680. #include "confdefs.h"
  681. #include <qglobal.h>
  682. #include <qapplication.h>
  683. EOF
  684. if test "$kde_qtver" = "2"; then
  685. cat >> conftest.$ac_ext <<EOF
  686. #include <qevent.h>
  687. #include <qstring.h>
  688. #include <qstyle.h>
  689. EOF
  690.  
  691. if test $kde_qtsubver -gt 0; then
  692. cat >> conftest.$ac_ext <<EOF
  693. #include <qiconview.h>
  694. EOF
  695. fi
  696.  
  697. fi
  698.  
  699. echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
  700. cat >> conftest.$ac_ext <<EOF
  701. #error 1
  702. #endif
  703.  
  704. int main() {
  705. EOF
  706. if test "$kde_qtver" = "2"; then
  707. cat >> conftest.$ac_ext <<EOF
  708.     QStringList *t = new QStringList();
  709. EOF
  710. if test $kde_qtsubver -gt 0; then
  711. cat >> conftest.$ac_ext <<EOF
  712.     QIconView iv(0);
  713.     iv.setWordWrapIconText(false);
  714.     QString s;
  715.     s.setLatin1("Elvis is alive", 14);
  716.     int magnolia = QEvent::Speech; /* new in 2.2 beta2 */
  717. EOF
  718. fi
  719. fi
  720. cat >> conftest.$ac_ext <<EOF
  721.     return 0;
  722. }
  723. EOF
  724. ])
  725.  
  726. AC_DEFUN(KDE_USE_QT,
  727. [
  728.  
  729. if test -z "$1"; then
  730.   kde_qtver=2
  731.   kde_qtsubver=1
  732. else
  733.   kde_qtsubver=`echo "$1" | sed -e 's#[0-9]\+\.\([0-9]\+\).*#\1#'`
  734.   # following is the check if subversion isn¥t found in passed argument
  735.   if test "$kde_qtsubver" = "$1"; then
  736.     kde_qtsubver=1
  737.   fi
  738.   kde_qtver=`echo "$1" | sed -e 's#^\([0-9]\+\)\..*#\1#'`
  739.   if test "$kde_qtver" = "1"; then
  740.     kde_qtsubver=42
  741.   else
  742.    # this is the version number fallback to 2.1, unless major version is 1 or 2
  743.    if test "$kde_qtver" != "2"; then
  744.     kde_qtver=2
  745.     kde_qtsubver=1
  746.    fi
  747.   fi
  748. fi
  749.  
  750. if test -z "$2"; then
  751.   if test $kde_qtver = 2; then
  752.     if test $kde_qtsubver -gt 0; then
  753.       kde_qt_minversion=">= Qt 2.2.2"
  754.     else
  755.       kde_qt_minversion=">= Qt 2.0.2"
  756.     fi
  757.   else
  758.     kde_qt_minversion=">= 1.42 and < 2.0"
  759.   fi
  760. else
  761.    kde_qt_minversion=$2
  762. fi
  763.  
  764. if test -z "$3"; then
  765.    if test $kde_qtver = 2; then
  766.     if test $kde_qtsubver -gt 0; then
  767.       kde_qt_verstring="QT_VERSION >= 222"
  768.     else
  769.       kde_qt_verstring="QT_VERSION >= 200"
  770.     fi
  771.    else
  772.     kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
  773.   fi
  774. else
  775.    kde_qt_verstring=$3
  776. fi
  777.  
  778. if test $kde_qtver = 2; then
  779.    kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
  780. else
  781.    kde_qt_dirs="$QTDIR /usr/lib/qt"
  782. fi
  783. ])
  784.  
  785. AC_DEFUN(KDE_CHECK_QT_DIRECT,
  786. [
  787. AC_REQUIRE([KDE_USE_QT])
  788. AC_MSG_CHECKING([if Qt compiles without flags])
  789. AC_CACHE_VAL(kde_cv_qt_direct,
  790. [
  791. AC_LANG_SAVE
  792. AC_LANG_CPLUSPLUS
  793. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  794. ac_LIBRARY_PATH="$LIBRARY_PATH"
  795. ac_cxxflags_safe="$CXXFLAGS"
  796. ac_ldflags_safe="$LDFLAGS"
  797. ac_libs_safe="$LIBS"
  798.  
  799. CXXFLAGS="$CXXFLAGS -I$qt_includes"
  800. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  801. LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
  802. LD_LIBRARY_PATH=
  803. export LD_LIBRARY_PATH
  804. LIBRARY_PATH=
  805. export LIBRARY_PATH
  806.  
  807. KDE_PRINT_QT_PROGRAM
  808.  
  809. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  810.   kde_cv_qt_direct="yes"
  811. else
  812.   kde_cv_qt_direct="no"
  813.   echo "configure: failed program was:" >&AC_FD_CC
  814.   cat conftest.$ac_ext >&AC_FD_CC
  815. fi
  816.  
  817. rm -f conftest*
  818. CXXFLAGS="$ac_cxxflags_safe"
  819. LDFLAGS="$ac_ldflags_safe"
  820. LIBS="$ac_libs_safe"
  821.  
  822. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  823. export LD_LIBRARY_PATH
  824. LIBRARY_PATH="$ac_LIBRARY_PATH"
  825. export LIBRARY_PATH
  826. AC_LANG_RESTORE
  827. ])
  828.  
  829. if test "$kde_cv_qt_direct" = "yes"; then
  830.   AC_MSG_RESULT(yes)
  831.   $1
  832. else
  833.   AC_MSG_RESULT(no)
  834.   $2
  835. fi
  836. ])
  837.  
  838. dnl ------------------------------------------------------------------------
  839. dnl Try to find the Qt headers and libraries.
  840. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
  841. dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
  842. dnl ------------------------------------------------------------------------
  843. dnl
  844. AC_DEFUN(AC_PATH_QT_1_3,
  845. [
  846. AC_REQUIRE([K_PATH_X])
  847. AC_REQUIRE([KDE_USE_QT])
  848.  
  849. dnl ------------------------------------------------------------------------
  850. dnl Add configure flag to enable linking to MT version of Qt library.
  851. dnl ------------------------------------------------------------------------
  852.  
  853. AC_ARG_ENABLE(
  854.   mt,
  855.   [  --enable-mt             link to threaded Qt (experimental)],
  856.   kde_use_qt_mt=$enableval,
  857.   kde_use_qt_mt=no
  858. )
  859.  
  860. USING_QT_MT=""
  861.  
  862. dnl ------------------------------------------------------------------------
  863. dnl If we got --enable-qt-mt then adjust some vars for the host.
  864. dnl ------------------------------------------------------------------------
  865.  
  866. if test "x$kde_use_qt_mt" = "xyes"; then
  867.  
  868.   case $host in
  869.   *-*-linux-*)
  870.     if test "x$GCC" = "xyes"; then
  871.       CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread"
  872.       X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread"
  873.     else
  874.       AC_MSG_WARN([Compiler is not gcc. MT support disabled.])
  875.     fi
  876.     ;;
  877.   *)
  878.     AC_MSG_WARN([MT not yet supported on $host - disabled.])
  879.     ;;
  880.   esac
  881.  
  882. fi
  883.  
  884. kde_qt_was_given=yes
  885.  
  886. dnl ------------------------------------------------------------------------
  887. dnl If we haven't been told how to link to Qt, we work it out for ourselves.
  888. dnl ------------------------------------------------------------------------
  889.  
  890. if test -z "$LIBQT_GLOB"; then
  891.  
  892.   LIBQT_GLOB="libqt.*"
  893.  
  894. fi
  895.  
  896. if test -z "$LIBQT"; then
  897.  
  898.   LIBQT="-lqt"
  899.   kde_int_qt="-lqt"
  900.  
  901. dnl ------------------------------------------------------------------------
  902. dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
  903. dnl ------------------------------------------------------------------------
  904.  
  905.   if test "x$kde_use_qt_mt" = "xyes"; then
  906.  
  907.       case $host in
  908.       *-*-linux-*)
  909.         if test "x$GCC" = "xyes"; then
  910.           LIBQT="-lqt-mt"
  911.           kde_int_qt="-lqt-mt"
  912.           LIBQT_GLOB="libqt-mt.*"
  913.           USING_QT_MT="using -mt"
  914.         fi
  915.       ;;
  916.       esac
  917.   fi
  918.  
  919.   kde_qt_was_given=no
  920.  
  921. else
  922.   kde_int_qt="$LIBQT"
  923. fi
  924.  
  925. if test $kde_qtver = 2; then
  926.  
  927.   AC_REQUIRE([AC_FIND_PNG])
  928.   AC_REQUIRE([AC_FIND_JPEG])
  929.   LIBQT="$LIBQT $LIBPNG $LIBJPEG"
  930. fi
  931.  
  932. AC_MSG_CHECKING([for Qt])
  933.  
  934. LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
  935. ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
  936. qt_libraries=""
  937. qt_includes=""
  938. AC_ARG_WITH(qt-dir,
  939.     [  --with-qt-dir=DIR       where the root of Qt is installed ],
  940.     [  ac_qt_includes="$withval"/include
  941.        ac_qt_libraries="$withval"/lib
  942.        ac_qt_bindir="$withval"/bin
  943.     ])
  944.  
  945. AC_ARG_WITH(qt-includes,
  946.     [  --with-qt-includes=DIR  where the Qt includes are. ],
  947.     [
  948.        ac_qt_includes="$withval"
  949.     ])
  950.  
  951. kde_qt_libs_given=no
  952.  
  953. AC_ARG_WITH(qt-libraries,
  954.     [  --with-qt-libraries=DIR where the Qt library is installed.],
  955.     [  ac_qt_libraries="$withval"
  956.        kde_qt_libs_given=yes
  957.     ])
  958.  
  959. AC_CACHE_VAL(ac_cv_have_qt,
  960. [#try to guess Qt locations
  961.  
  962. qt_incdirs=""
  963. for dir in $kde_qt_dirs; do
  964.    qt_incdirs="$qt_incdirs $dir/include $dir"
  965. done
  966. 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 $x_includes"
  967. if test ! "$ac_qt_includes" = "NO"; then
  968.    qt_incdirs="$ac_qt_includes $qt_incdirs"
  969. fi
  970.  
  971. if test "$kde_qtver" = "2"; then
  972.   kde_qt_header=qstyle.h
  973. else
  974.   kde_qt_header=qglobal.h
  975. fi
  976.  
  977. AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
  978. ac_qt_includes="$qt_incdir"
  979.  
  980. qt_libdirs=""
  981. for dir in $kde_qt_dirs; do
  982.    qt_libdirs="$qt_libdirs $dir/lib $dir"
  983. done
  984. qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
  985. if test ! "$ac_qt_libraries" = "NO"; then
  986.   qt_libdir=$ac_qt_libraries
  987. else
  988.   qt_libdirs="$ac_qt_libraries $qt_libdirs"
  989.   # if the Qt was given, the chance is too big that libqt.* doesn't exist
  990.   qt_libdir=NONE
  991.   for dir in $qt_libdirs; do
  992.     try="ls -1 $dir/${LIBQT_GLOB}"
  993.     if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  994.   done
  995. fi
  996.  
  997. ac_qt_libraries="$qt_libdir"
  998.  
  999. AC_LANG_SAVE
  1000. AC_LANG_CPLUSPLUS
  1001.  
  1002. ac_cxxflags_safe="$CXXFLAGS"
  1003. ac_ldflags_safe="$LDFLAGS"
  1004. ac_libs_safe="$LIBS"
  1005.  
  1006. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  1007. LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS"
  1008. LIBS="$LIBS $LIBQT"
  1009.  
  1010. KDE_PRINT_QT_PROGRAM
  1011.  
  1012. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1013.   rm -f conftest*
  1014. else
  1015.   echo "configure: failed program was:" >&AC_FD_CC
  1016.   cat conftest.$ac_ext >&AC_FD_CC
  1017.   ac_qt_libraries="NO"
  1018. fi
  1019. rm -f conftest*
  1020. CXXFLAGS="$ac_cxxflags_safe"
  1021. LDFLAGS="$ac_ldflags_safe"
  1022. LIBS="$ac_libs_safe"
  1023.  
  1024. AC_LANG_RESTORE
  1025. if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
  1026.   ac_cv_have_qt="have_qt=no"
  1027.   ac_qt_notfound=""
  1028.   if test "$ac_qt_includes" = NO; then
  1029.     if test "$ac_qt_libraries" = NO; then
  1030.       ac_qt_notfound="(headers and libraries)";
  1031.     else
  1032.       ac_qt_notfound="(headers)";
  1033.     fi
  1034.   else
  1035.     ac_qt_notfound="(libraries)";
  1036.   fi
  1037.  
  1038.   AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
  1039. For more details about this problem, look at the end of config.log.])
  1040. else
  1041.   have_qt="yes"
  1042. fi
  1043. ])
  1044.  
  1045. eval "$ac_cv_have_qt"
  1046.  
  1047. if test "$have_qt" != yes; then
  1048.   AC_MSG_RESULT([$have_qt]);
  1049. else
  1050.   ac_cv_have_qt="have_qt=yes \
  1051.     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
  1052.   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
  1053.  
  1054.   qt_libraries="$ac_qt_libraries"
  1055.   qt_includes="$ac_qt_includes"
  1056. fi
  1057.  
  1058. if test ! "$kde_qt_libs_given" = "yes"; then
  1059. KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
  1060. fi
  1061.  
  1062. AC_SUBST(qt_libraries)
  1063. AC_SUBST(qt_includes)
  1064.  
  1065. if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
  1066.  QT_INCLUDES="";
  1067. else
  1068.  QT_INCLUDES="-I$qt_includes"
  1069.  all_includes="$QT_INCLUDES $all_includes"
  1070. fi
  1071.  
  1072. if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
  1073.  QT_LDFLAGS=""
  1074. else
  1075.  QT_LDFLAGS="-L$qt_libraries"
  1076.  all_libraries="$all_libraries $QT_LDFLAGS"
  1077. fi
  1078.  
  1079. AC_SUBST(QT_INCLUDES)
  1080. AC_SUBST(QT_LDFLAGS)
  1081. AC_PATH_QT_MOC_UIC
  1082.  
  1083. LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)'
  1084. AC_SUBST(LIB_QT)
  1085.  
  1086. ])
  1087.  
  1088. AC_DEFUN(AC_PATH_QT,
  1089. [
  1090. AC_PATH_QT_1_3
  1091. ])
  1092.  
  1093. AC_DEFUN(KDE_CHECK_FINAL,
  1094. [
  1095.   AC_ARG_ENABLE(final, [  --enable-final          build size optimized apps (experimental - needs lots of memory)],
  1096.     kde_use_final=$enableval, kde_use_final=no)
  1097.  
  1098.   KDE_COMPILER_REPO
  1099.   if test "x$kde_use_final" = "xyes"; then
  1100.       KDE_USE_FINAL_TRUE=""
  1101.       KDE_USE_FINAL_FALSE="#"
  1102.    else
  1103.       KDE_USE_FINAL_TRUE="#"
  1104.       KDE_USE_FINAL_FALSE=""
  1105.   fi
  1106.   AC_SUBST(KDE_USE_FINAL_TRUE)
  1107.   AC_SUBST(KDE_USE_FINAL_FALSE)
  1108.  
  1109.   AC_ARG_ENABLE(closure, [  --disable-closure       don't delay template instantiation],
  1110.       kde_use_closure=$enableval, kde_use_closure=yes)
  1111.  
  1112.   if test "x$kde_use_closure" = "xyes"; then
  1113.        KDE_USE_CLOSURE_TRUE=""
  1114.        KDE_USE_CLOSURE_FALSE="#"
  1115. #       CXXFLAGS="$CXXFLAGS $REPO"
  1116.   else
  1117.        KDE_USE_CLOSURE_TRUE="#"
  1118.        KDE_USE_CLOSURE_FALSE=""
  1119.   fi
  1120.   AC_SUBST(KDE_USE_CLOSURE_TRUE)
  1121.   AC_SUBST(KDE_USE_CLOSURE_FALSE)
  1122. ])
  1123.  
  1124. dnl ------------------------------------------------------------------------
  1125. dnl Now, the same with KDE
  1126. dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
  1127. dnl and $(kde_includes) will be the kdehdrlocation (if needed)
  1128. dnl ------------------------------------------------------------------------
  1129. dnl
  1130. AC_DEFUN(AC_BASE_PATH_KDE,
  1131. [
  1132. AC_PREREQ([2.13])
  1133. AC_REQUIRE([AC_PATH_QT])dnl
  1134. AC_CHECK_RPATH
  1135. AC_MSG_CHECKING([for KDE])
  1136.  
  1137. if test "${prefix}" != NONE; then
  1138.   kde_includes=${prefix}/include
  1139.   ac_kde_includes=$prefix/include
  1140.  
  1141.   if test "${exec_prefix}" != NONE; then
  1142.     kde_libraries=${exec_prefix}/lib
  1143.     ac_kde_libraries=$exec_prefix/lib
  1144.   else
  1145.     kde_libraries=${prefix}/lib
  1146.     ac_kde_libraries=$prefix/lib
  1147.   fi
  1148. else
  1149.   ac_kde_includes=
  1150.   ac_kde_libraries=
  1151.   kde_libraries=""
  1152.   kde_includes=""
  1153. fi
  1154.  
  1155. AC_CACHE_VAL(ac_cv_have_kde,
  1156. [#try to guess kde locations
  1157.  
  1158. if test "$kde_qtver" = 1; then
  1159.   kde_check_header="ksock.h"
  1160.   kde_check_lib="libkdecore.la"
  1161. else
  1162.   kde_check_header="ksharedptr.h"
  1163.   kde_check_lib="libkio.la"
  1164. fi
  1165.  
  1166. if test -z "$1"; then
  1167.  
  1168. kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes"
  1169. test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
  1170. kde_incdirs="$ac_kde_includes $kde_incdirs"
  1171. AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
  1172. ac_kde_includes="$kde_incdir"
  1173.  
  1174. if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
  1175.   AC_MSG_ERROR([
  1176. in the prefix, you've chosen, are no KDE headers installed. This will fail.
  1177. So, check this please and use another prefix!])
  1178. fi
  1179.  
  1180. kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib"
  1181. test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
  1182. kde_libdirs="$ac_kde_libraries $kde_libdirs"
  1183. AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
  1184. ac_kde_libraries="$kde_libdir"
  1185.  
  1186. if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
  1187. AC_MSG_ERROR([
  1188. in the prefix, you've chosen, are no KDE libraries installed. This will fail.
  1189. So, check this please and use another prefix!])
  1190. fi
  1191. ac_kde_libraries="$kde_libdir"
  1192.  
  1193. if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
  1194.   ac_cv_have_kde="have_kde=no"
  1195. else
  1196.   ac_cv_have_kde="have_kde=yes \
  1197.     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1198. fi
  1199.  
  1200. else dnl test -z $1
  1201.  
  1202.   ac_cv_have_kde="have_kde=no"
  1203.  
  1204. fi
  1205. ])dnl
  1206.  
  1207. eval "$ac_cv_have_kde"
  1208.  
  1209. if test "$have_kde" != "yes"; then
  1210.  if test "${prefix}" = NONE; then
  1211.   ac_kde_prefix="$ac_default_prefix"
  1212.  else
  1213.   ac_kde_prefix="$prefix"
  1214.  fi
  1215.  if test "$exec_prefix" = NONE; then
  1216.   ac_kde_exec_prefix="$ac_kde_prefix"
  1217.   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
  1218.  else
  1219.   ac_kde_exec_prefix="$exec_prefix"
  1220.   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
  1221.  fi
  1222.  
  1223.  kde_libraries="${ac_kde_exec_prefix}/lib"
  1224.  kde_includes=${ac_kde_prefix}/include
  1225.  
  1226. else
  1227.   ac_cv_have_kde="have_kde=yes \
  1228.     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1229.   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
  1230.  
  1231.   kde_libraries="$ac_kde_libraries"
  1232.   kde_includes="$ac_kde_includes"
  1233. fi
  1234. AC_SUBST(kde_libraries)
  1235. AC_SUBST(kde_includes)
  1236.  
  1237. if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
  1238.  KDE_INCLUDES=""
  1239. else
  1240.  KDE_INCLUDES="-I$kde_includes"
  1241.  all_includes="$KDE_INCLUDES $all_includes"
  1242. fi
  1243.  
  1244. KDE_LDFLAGS="-L$kde_libraries"
  1245. if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then 
  1246.  all_libraries="$all_libraries $KDE_LDFLAGS"
  1247. fi
  1248.  
  1249. AC_SUBST(KDE_LDFLAGS)
  1250. AC_SUBST(KDE_INCLUDES)
  1251.  
  1252. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1253.  
  1254. all_libraries="$all_libraries $USER_LDFLAGS"
  1255. all_includes="$all_includes $USER_INCLUDES"
  1256. AC_SUBST(all_includes)
  1257. AC_SUBST(all_libraries)
  1258.  
  1259. AC_SUBST(AUTODIRS)
  1260. ])
  1261.  
  1262. AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
  1263. [
  1264. AC_MSG_CHECKING(for extra includes)
  1265. AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
  1266.                           adds non standard include paths],
  1267.   kde_use_extra_includes="$withval",
  1268.   kde_use_extra_includes=NONE
  1269. )
  1270. kde_extra_includes=
  1271. if test -n "$kde_use_extra_includes" && \
  1272.    test "$kde_use_extra_includes" != "NONE"; then
  1273.  
  1274.    ac_save_ifs=$IFS
  1275.    IFS=':'
  1276.    for dir in $kde_use_extra_includes; do
  1277.      kde_extra_includes="$kde_extra_includes $dir"
  1278.      USER_INCLUDES="$USER_INCLUDES -I$dir"
  1279.    done
  1280.    IFS=$ac_save_ifs
  1281.    kde_use_extra_includes="added"
  1282. else
  1283.    kde_use_extra_includes="no"
  1284. fi
  1285. AC_SUBST(USER_INCLUDES)
  1286.  
  1287. AC_MSG_RESULT($kde_use_extra_includes)
  1288.  
  1289. kde_extra_libs=
  1290. AC_MSG_CHECKING(for extra libs)
  1291. AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths],
  1292.   kde_use_extra_libs=$withval,
  1293.   kde_use_extra_libs=NONE
  1294. )
  1295. if test -n "$kde_use_extra_libs" && \
  1296.    test "$kde_use_extra_libs" != "NONE"; then
  1297.  
  1298.    ac_save_ifs=$IFS
  1299.    IFS=':'
  1300.    for dir in $kde_use_extra_libs; do
  1301.      kde_extra_libs="$kde_extra_libs $dir"
  1302.      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
  1303.      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
  1304.    done
  1305.    IFS=$ac_save_ifs
  1306.    kde_use_extra_libs="added"
  1307. else
  1308.    kde_use_extra_libs="no"
  1309. fi
  1310.  
  1311. AC_SUBST(USER_LDFLAGS)
  1312.  
  1313. AC_MSG_RESULT($kde_use_extra_libs)
  1314.  
  1315. ])
  1316.  
  1317. AC_DEFUN(KDE_1_CHECK_PATH_HEADERS,
  1318. [
  1319.     AC_MSG_CHECKING([for KDE headers installed])
  1320.     AC_LANG_SAVE
  1321.     AC_LANG_CPLUSPLUS
  1322. cat > conftest.$ac_ext <<EOF
  1323. #include <stdio.h>
  1324. #include "confdefs.h"
  1325. #include <kapp.h>
  1326.  
  1327. int main() {
  1328.     printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
  1329.     printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
  1330.     printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
  1331.     printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
  1332.     printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
  1333.     printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
  1334.     printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
  1335.     printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
  1336.     printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
  1337.     printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
  1338.     printf("kde_wallpaperdir=\\"%s\\"\n",
  1339.     KApplication::kde_wallpaperdir().data());
  1340.     printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
  1341.     printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
  1342.     printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
  1343.     printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
  1344.     printf("kde_moduledir=\\"/tmp/dummy\\"\n");
  1345.     return 0;
  1346.     }
  1347. EOF
  1348.  
  1349.  ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
  1350.  if AC_TRY_EVAL(ac_compile); then
  1351.    AC_MSG_RESULT(yes)
  1352.  else
  1353.    AC_MSG_ERROR([your system is not able to compile a small KDE application!
  1354. Check, if you installed the KDE header files correctly.
  1355. For more details about this problem, look at the end of config.log.])
  1356.   fi
  1357.  
  1358.   AC_LANG_RESTORE
  1359. ])
  1360.  
  1361. AC_DEFUN(KDE_CHECK_KDEQTADDON,
  1362. [
  1363. AC_MSG_CHECKING(for kde-qt-addon)
  1364. AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
  1365. [
  1366.  kde_ldflags_safe="$LDFLAGS"
  1367.  kde_libs_safe="$LIBS"
  1368.  kde_cxxflags_safe="$CXXFLAGS"
  1369.  
  1370.  LIBS="-lkde-qt-addon $LIBQT $LIBS"
  1371.  CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
  1372.  LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
  1373.  
  1374.  AC_TRY_LINK([
  1375.    #include <qdom.h>
  1376.  ],
  1377.  [
  1378.    QDomDocument doc;
  1379.  ],
  1380.   kde_cv_have_kdeqtaddon=yes,
  1381.   kde_cv_have_kdeqtaddon=no
  1382.  )
  1383.  
  1384.  LDFLAGS=$kde_ldflags_safe
  1385.  LIBS=$kde_libs_safe
  1386.  kde_cxxflags_safe="$CXXFLAGS"
  1387. ])
  1388.  
  1389. AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
  1390.  
  1391. if test "$kde_cv_have_kdeqtaddon" = "no"; then
  1392.   AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
  1393. It is a separate package (and CVS module) named kde-qt-addon.])
  1394. fi
  1395. ])
  1396.  
  1397. AC_DEFUN(KDE_CHECK_KIMGIO,
  1398. [
  1399.    AC_REQUIRE([AC_BASE_PATH_KDE])
  1400.    AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1401.    AC_REQUIRE([AC_FIND_TIFF])
  1402.    AC_REQUIRE([AC_FIND_JPEG])
  1403.    AC_REQUIRE([AC_FIND_PNG])
  1404.    AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
  1405.  
  1406.    if test "$1" = "existance"; then
  1407.      AC_LANG_SAVE
  1408.      AC_LANG_CPLUSPLUS
  1409.      kde_save_LIBS="$LIBS"
  1410.      LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
  1411.      AC_CHECK_LIB(kimgio, kimgioRegister, [
  1412.       LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
  1413.       LIBS="$kde_save_LIBS"
  1414.       AC_LANG_RESTORE
  1415.    else
  1416.       LIBKIMGIO_EXISTS=yes
  1417.    fi
  1418.  
  1419.    if test "$LIBKIMGIO_EXISTS" = "yes"; then
  1420.      LIB_KIMGIO='-lkimgio'
  1421.    else
  1422.      LIB_KIMGIO=''
  1423.    fi
  1424.    AC_SUBST(LIB_KIMGIO)
  1425. ])
  1426.  
  1427. AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
  1428. [
  1429.    AC_REQUIRE([KDE_MISC_TESTS])
  1430.    AC_REQUIRE([KDE_CHECK_LIBDL])
  1431.    AC_REQUIRE([K_PATH_X])
  1432.  
  1433. if test $kde_qtver = 2; then
  1434.    LIB_KDECORE='-lkdecore'
  1435.    AC_SUBST(LIB_KDECORE)
  1436.    LIB_KDEUI='-lkdeui'
  1437.    AC_SUBST(LIB_KDEUI)
  1438.    LIB_KFORMULA='-lkformula'
  1439.    AC_SUBST(LIB_KFORMULA)
  1440.    LIB_KIO='-lkio'
  1441.    AC_SUBST(LIB_KIO)
  1442.    LIB_KSYCOCA='-lksycoca'
  1443.    AC_SUBST(LIB_KSYCOCA)
  1444.    LIB_SMB='-lsmb'
  1445.    AC_SUBST(LIB_SMB)
  1446.    LIB_KFILE='-lkfile'
  1447.    AC_SUBST(LIB_KFILE)
  1448.    LIB_KAB='-lkab'
  1449.    AC_SUBST(LIB_KAB)
  1450.    LIB_KHTML='-lkhtml'
  1451.    AC_SUBST(LIB_KHTML)
  1452.    LIB_KSPELL='-lkspell'
  1453.    AC_SUBST(LIB_KSPELL)
  1454.    LIB_KPARTS='-lkparts'
  1455.    AC_SUBST(LIB_KPARTS)
  1456.    LIB_KWRITE='-lkwrite'
  1457.    AC_SUBST(LIB_KWRITE)
  1458. else
  1459.    LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
  1460.    AC_SUBST(LIB_KDECORE)
  1461.    LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
  1462.    AC_SUBST(LIB_KDEUI)
  1463.    LIB_KFM='-lkfm $(LIB_KDECORE)'
  1464.    AC_SUBST(LIB_KFM)
  1465.    LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
  1466.    AC_SUBST(LIB_KFILE)
  1467.    LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
  1468.    AC_SUBST(LIB_KAB)
  1469. fi
  1470. ])
  1471.  
  1472. AC_DEFUN(AC_PATH_KDE,
  1473. [
  1474.   AC_BASE_PATH_KDE
  1475.   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
  1476.   [
  1477.   if test "$enableval" = "no";
  1478.     then ac_use_path_checking="default"
  1479.     else ac_use_path_checking=""
  1480.   fi
  1481.   ],
  1482.   [
  1483.   if test "$kde_qtver" = 1;
  1484.     then ac_use_path_checking=""
  1485.     else ac_use_path_checking="default"
  1486.   fi
  1487.   ]
  1488.   )
  1489.  
  1490.   AC_CREATE_KFSSTND($ac_use_path_checking)
  1491.  
  1492.   AC_SUBST_KFSSTND
  1493.   KDE_CREATE_LIBS_ALIASES
  1494. ])
  1495.  
  1496. dnl obsolete
  1497. AC_DEFUN(AC_CHECK_SETENV,
  1498. [
  1499.    AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl 
  1500.    AC_CHECK_FUNCS([setenv unsetenv])
  1501. ])
  1502.  
  1503. AC_DEFUN(AC_CHECK_GETDOMAINNAME,
  1504. [
  1505. AC_MSG_CHECKING(for getdomainname)
  1506. AC_CACHE_VAL(ac_cv_func_getdomainname,
  1507. [
  1508. AC_LANG_SAVE
  1509. AC_LANG_CPLUSPLUS
  1510. save_CXXFLAGS="$CXXFLAGS"
  1511. kde_safe_LIBS="$LIBS"
  1512. LIBS="$LIBS $X_EXTRA_LIBS"
  1513. if test "$GCC" = "yes"; then
  1514. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  1515. fi
  1516. AC_TRY_COMPILE([
  1517. #include <stdlib.h>
  1518. #include <unistd.h>
  1519. ],
  1520. [
  1521. char buffer[200];
  1522. getdomainname(buffer, 200);
  1523. ],
  1524. ac_cv_func_getdomainname=yes,
  1525. ac_cv_func_getdomainname=no)
  1526. CXXFLAGS="$save_CXXFLAGS"
  1527. LIBS=$kde_safe_LIBS
  1528. AC_LANG_RESTORE
  1529. ])
  1530. AC_MSG_RESULT($ac_cv_func_getdomainname)
  1531.  
  1532. AC_MSG_CHECKING([if getdomainname needs custom prototype])
  1533. AC_CACHE_VAL(ac_cv_proto_getdomainname,
  1534. [
  1535. AC_LANG_SAVE
  1536. AC_LANG_CPLUSPLUS
  1537. if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
  1538.   ac_cv_proto_getdomainname=no
  1539. else
  1540.   kde_safe_libs=$LIBS
  1541.   LIBS="$LIBS $X_EXTRA_LIBS"
  1542.   AC_TRY_LINK([
  1543. #include <stdlib.h>
  1544. #include <unistd.h>
  1545.  
  1546. extern "C" int getdomainname (char *, int);
  1547. ],
  1548. [
  1549. char buffer[200];
  1550. getdomainname(buffer, 200);
  1551. ],
  1552.   ac_cv_func_getdomainname=yes
  1553.   ac_cv_proto_getdomainname=yes,
  1554.   AC_MSG_RESULT([fatal error])
  1555.   AC_MSG_ERROR([getdomainname unavailable]))
  1556. fi
  1557. LIBS=$kde_safe_libs
  1558. AC_LANG_RESTORE
  1559. ])
  1560. AC_MSG_RESULT($ac_cv_proto_getdomainname)
  1561.  
  1562. if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
  1563.   AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname])
  1564. fi
  1565. if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then
  1566.   AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1,
  1567.   [Define if you have getdomainname prototype])
  1568. fi
  1569.  
  1570. ])
  1571.  
  1572. AC_DEFUN(AC_CHECK_GETHOSTNAME,
  1573. [
  1574.  
  1575. AC_MSG_CHECKING([for gethostname])
  1576. AC_CACHE_VAL(ac_cv_func_gethostname,
  1577. [
  1578. AC_LANG_SAVE
  1579. AC_LANG_CPLUSPLUS
  1580. save_CXXFLAGS="$CXXFLAGS"
  1581. if test "$GCC" = "yes"; then
  1582. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  1583. fi
  1584. AC_TRY_LINK([
  1585. #include <stdlib.h>
  1586. #include <unistd.h>
  1587. ],
  1588. [
  1589. char buffer[200];
  1590. gethostname(buffer, 200);
  1591. ],
  1592. ac_cv_func_gethostname=yes,
  1593. ac_cv_func_gethostname=no)
  1594. CXXFLAGS="$save_CXXFLAGS"
  1595. AC_LANG_RESTORE
  1596. ])
  1597. AC_MSG_RESULT($ac_cv_func_gethostname)
  1598.  
  1599. AC_MSG_CHECKING([if gethostname needs custom prototype])
  1600. AC_CACHE_VAL(ac_cv_proto_gethostname,
  1601. [
  1602. AC_LANG_SAVE
  1603. AC_LANG_CPLUSPLUS
  1604. if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
  1605.   ac_cv_proto_gethostname=no
  1606. else
  1607.   AC_TRY_LINK([
  1608. #include <stdlib.h>
  1609. #include <unistd.h>
  1610.  
  1611. extern "C" int gethostname (char *, int);
  1612. ],
  1613. [
  1614. char buffer[200];
  1615. gethostname(buffer, 200);
  1616. ],
  1617.   ac_cv_func_gethostname=yes
  1618.   ac_cv_proto_gethostname=yes,
  1619.   AC_MSG_RESULT([fatal error])
  1620.   AC_MSG_ERROR(gethostname unavailable))
  1621. fi
  1622. AC_LANG_RESTORE
  1623. ])
  1624. AC_MSG_RESULT($ac_cv_proto_gethostname)
  1625.  
  1626. if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then
  1627.   AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1,
  1628.   [Define if you have gethostname prototype])
  1629. fi
  1630. if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
  1631.   AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have getdomainname])
  1632. fi
  1633. ])
  1634.  
  1635. AC_DEFUN(AC_CHECK_USLEEP,
  1636. [
  1637. AC_MSG_CHECKING([for usleep])
  1638. AC_CACHE_VAL(ac_cv_func_usleep,
  1639. [
  1640. AC_LANG_SAVE
  1641. AC_LANG_CPLUSPLUS
  1642. ac_libs_safe="$LIBS"
  1643. LIBS="$LIBS $LIBUCB"
  1644. AC_TRY_LINK([
  1645. #include <stdlib.h>
  1646. #include <unistd.h>
  1647. ],
  1648. [
  1649. usleep(200);
  1650. ],
  1651. ac_cv_func_usleep=yes,
  1652. ac_cv_func_usleep=no)
  1653. LIBS="$ac_libs_safe"
  1654. AC_LANG_RESTORE
  1655. ])
  1656. AC_MSG_RESULT($ac_cv_func_usleep)
  1657. if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then
  1658.   AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function])
  1659. fi
  1660. ])
  1661.  
  1662. AC_DEFUN(AC_CHECK_RANDOM,
  1663. [
  1664. AC_MSG_CHECKING([for random])
  1665. AC_CACHE_VAL(ac_cv_func_random,
  1666. [
  1667. AC_LANG_SAVE
  1668. AC_LANG_CPLUSPLUS
  1669. ac_libs_safe="$LIBS"
  1670. LIBS="$LIBS $LIBUCB"
  1671. AC_TRY_LINK([
  1672. #include <stdlib.h>
  1673. ],
  1674. [
  1675. random();
  1676. ],
  1677. ac_cv_func_random=yes,
  1678. ac_cv_func_random=no)
  1679. LIBS="$ac_libs_safe"
  1680. AC_LANG_RESTORE
  1681. ])
  1682. AC_MSG_RESULT($ac_cv_func_random)
  1683. if eval "test \"`echo $ac_cv_func_random`\" = yes"; then
  1684.   AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random])
  1685. fi
  1686. ])
  1687.  
  1688. AC_DEFUN(AC_FIND_GIF,
  1689.    [AC_MSG_CHECKING([for giflib])
  1690. AC_CACHE_VAL(ac_cv_lib_gif,
  1691. [ac_save_LIBS="$LIBS"
  1692. LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
  1693. AC_TRY_LINK(dnl
  1694. [
  1695. #ifdef __cplusplus
  1696. extern "C" {
  1697. #endif
  1698. int GifLastError(void);
  1699. #ifdef __cplusplus
  1700. }
  1701. #endif
  1702. /* We use char because int might match the return type of a gcc2
  1703.     builtin and then its argument prototype would still apply.  */
  1704. ],
  1705.             [return GifLastError();],
  1706.             eval "ac_cv_lib_gif=yes",
  1707.             eval "ac_cv_lib_gif=no")
  1708. LIBS="$ac_save_LIBS"
  1709. ])dnl
  1710. if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
  1711.   AC_MSG_RESULT(yes)
  1712.   AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
  1713. else
  1714.   AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
  1715. fi
  1716. ])
  1717.  
  1718. AC_DEFUN(KDE_FIND_JPEG_HELPER,
  1719. [
  1720. AC_MSG_CHECKING([for libjpeg$2])
  1721. AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
  1722. [
  1723. AC_LANG_C
  1724. ac_save_LIBS="$LIBS"
  1725. LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
  1726. ac_save_CFLAGS="$CFLAGS"
  1727. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  1728. AC_TRY_LINK(
  1729. [/* Override any gcc2 internal prototype to avoid an error.  */
  1730. struct jpeg_decompress_struct;
  1731. typedef struct jpeg_decompress_struct * j_decompress_ptr;
  1732. typedef int size_t;
  1733. #ifdef __cplusplus
  1734. extern "C" {
  1735. #endif
  1736.     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
  1737.                                     int version, size_t structsize);
  1738. #ifdef __cplusplus
  1739. }
  1740. #endif
  1741. /* We use char because int might match the return type of a gcc2
  1742.     builtin and then its argument prototype would still apply.  */
  1743. ],
  1744.             [jpeg_CreateDecompress(0L, 0, 0);],
  1745.             eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
  1746.             eval "ac_cv_lib_jpeg_$1=no")
  1747. LIBS="$ac_save_LIBS"
  1748. CFLAGS="$ac_save_CFLAGS"
  1749. ])
  1750.  
  1751. if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
  1752.   LIBJPEG="$ac_cv_lib_jpeg_$1"
  1753.   AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
  1754. else
  1755.   AC_MSG_RESULT(no)
  1756.   $3
  1757. fi
  1758.  
  1759. ])
  1760.  
  1761. AC_DEFUN(AC_FIND_JPEG,
  1762. [
  1763. dnl first look for libraries
  1764. KDE_FIND_JPEG_HELPER(6b, 6b,
  1765.    KDE_FIND_JPEG_HELPER(normal, [],
  1766.     [
  1767. dnl what to do, if the normal way fails:
  1768.     if test -f "$kde_libraries/libjpeg.so"; then
  1769.        test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
  1770.        ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
  1771.     else if test -f "$kde_libraries/libjpeg.sl"; then
  1772.        test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
  1773.        ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"    
  1774.     else if test -f "$kde_libraries/libjpeg.a"; then
  1775.        test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
  1776.        ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
  1777.         else
  1778.       ac_cv_lib_jpeg=
  1779.     fi
  1780.       fi
  1781.    fi
  1782.  
  1783.    LIBJPEG=$ac_cv_lib_jpeg
  1784. ]))
  1785.  
  1786. dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
  1787. dnl requires system dependent includes loaded before it)
  1788. jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes"
  1789. AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
  1790. test "x$jpeg_incdir" = xNO && jpeg_incdir=
  1791.  
  1792. dnl if headers _and_ libraries are missing, this is no error, and we
  1793. dnl continue with a warning (the user will get no jpeg support in khtml)
  1794. dnl if only one is missing, it means a configuration error, but we still
  1795. dnl only warn
  1796. if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
  1797.   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
  1798. else
  1799.   if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
  1800.     AC_MSG_WARN([
  1801. There is an installation error in jpeg support. You seem to have only one
  1802. of either the headers _or_ the libraries installed. You may need to either
  1803. provide correct --with-extra-... options, or the development package of
  1804. libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
  1805. Disabling JPEG support.
  1806. ])
  1807.   else
  1808.     AC_MSG_WARN([libjpeg not found. disable JPEG support.])
  1809.   fi
  1810.   jpeg_incdir=
  1811.   LIBJPEG=
  1812. fi
  1813.  
  1814. AC_SUBST(LIBJPEG)
  1815. ])
  1816.  
  1817. AC_DEFUN(AC_FIND_ZLIB,
  1818. [
  1819. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1820. AC_MSG_CHECKING([for libz])
  1821. AC_CACHE_VAL(ac_cv_lib_z,
  1822. [
  1823. AC_LANG_C
  1824. kde_save_LIBS="$LIBS"
  1825. LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
  1826. kde_save_CFLAGS="$CFLAGS"
  1827. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  1828. AC_TRY_LINK(dnl
  1829. [
  1830. #include<zlib.h>
  1831. ],
  1832.             [return (zlibVersion() == ZLIB_VERSION); ],
  1833.             eval "ac_cv_lib_z='-lz'",
  1834.             eval "ac_cv_lib_z=no")
  1835. LIBS="$kde_save_LIBS"
  1836. CFLAGS="$kde_save_CFLAGS"
  1837. ])dnl
  1838. if test ! "$ac_cv_lib_z" = no; then
  1839.   AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
  1840.   LIBZ="$ac_cv_lib_z"
  1841.   AC_SUBST(LIBZ)
  1842.   AC_MSG_RESULT($ac_cv_lib_z)
  1843. else
  1844.   AC_MSG_ERROR(not found. Check your installation and look into config.log)
  1845.   LIBZ=""
  1846.   AC_SUBST(LIBZ)
  1847. fi
  1848. ])
  1849.  
  1850. AC_DEFUN(KDE_TRY_TIFFLIB,
  1851. [
  1852. AC_MSG_CHECKING([for libtiff $1])
  1853.  
  1854. AC_CACHE_VAL(kde_cv_libtiff_$1,
  1855. [
  1856. AC_LANG_SAVE
  1857. AC_LANG_CPLUSPLUS
  1858. kde_save_LIBS="$LIBS"
  1859. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
  1860. kde_save_CXXFLAGS="$CXXFLAGS"
  1861. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  1862.  
  1863. AC_TRY_LINK(dnl
  1864. [
  1865. #include<tiffio.h>
  1866. ],
  1867.     [return (TIFFOpen( "", "r") == 0); ],
  1868. [
  1869.     kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
  1870. ], [
  1871.     kde_cv_libtiff_$1=no
  1872. ])
  1873.  
  1874. LIBS="$kde_save_LIBS"
  1875. CXXFLAGS="$kde_save_CXXFLAGS"
  1876. AC_LANG_RESTORE
  1877. ])
  1878.  
  1879. if test "$kde_cv_libtiff_$1" = "no"; then
  1880.     AC_MSG_RESULT(no)
  1881.     LIBTIFF=""
  1882.     $3
  1883. else
  1884.     LIBTIFF="$kde_cv_libtiff_$1"
  1885.     AC_MSG_RESULT(yes)
  1886.     AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
  1887.     $2
  1888. fi
  1889.  
  1890. ])
  1891.  
  1892. AC_DEFUN(AC_FIND_TIFF,
  1893. [
  1894. AC_REQUIRE([K_PATH_X])
  1895. AC_REQUIRE([AC_FIND_ZLIB])
  1896. AC_REQUIRE([AC_FIND_JPEG])
  1897. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1898.  
  1899. KDE_TRY_TIFFLIB(tiff, [],
  1900.    KDE_TRY_TIFFLIB(tiff34))
  1901.  
  1902. AC_SUBST(LIBTIFF)
  1903. ])
  1904.  
  1905.  
  1906. AC_DEFUN(AC_FIND_PNG,
  1907. [
  1908. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1909. AC_REQUIRE([AC_FIND_ZLIB])
  1910. AC_MSG_CHECKING([for libpng])
  1911. AC_CACHE_VAL(ac_cv_lib_png,
  1912. [
  1913. kde_save_LIBS="$LIBS"
  1914. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
  1915. kde_save_CFLAGS="$CFLAGS"
  1916. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  1917. AC_LANG_C
  1918. AC_TRY_LINK(dnl
  1919.     [
  1920.     #include<png.h>
  1921.     ],
  1922.     [
  1923.     png_structp png_ptr = png_create_read_struct(  /* image ptr */
  1924.         PNG_LIBPNG_VER_STRING, 0, 0, 0 );
  1925.     return( png_ptr != 0 );
  1926.     ],
  1927.     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
  1928.     eval "ac_cv_lib_png=no"
  1929. )
  1930. LIBS="$kde_save_LIBS"
  1931. CFLAGS="$kde_save_CFLAGS"
  1932. ])dnl
  1933. if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
  1934.   AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
  1935.   LIBPNG="$ac_cv_lib_png"
  1936.   AC_SUBST(LIBPNG)
  1937.   AC_MSG_RESULT($ac_cv_lib_png)
  1938. else
  1939.   AC_MSG_RESULT(no)
  1940.   LIBPNG=""
  1941.   AC_SUBST(LIBPNG)
  1942. fi
  1943. ])
  1944.  
  1945. AC_DEFUN(AC_CHECK_BOOL,
  1946. [
  1947.   AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
  1948. ])
  1949.  
  1950. AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
  1951. [
  1952. AC_MSG_CHECKING(if you need GNU extensions)
  1953. AC_CACHE_VAL(ac_cv_gnu_extensions,
  1954. [
  1955. cat > conftest.c << EOF
  1956. #include <features.h>
  1957.  
  1958. #ifdef __GNU_LIBRARY__
  1959. yes
  1960. #endif
  1961. EOF
  1962.  
  1963. if (eval "$ac_cpp conftest.c") 2>&5 |
  1964.   egrep "yes" >/dev/null 2>&1; then
  1965.   rm -rf conftest*
  1966.   ac_cv_gnu_extensions=yes
  1967. else
  1968.   ac_cv_gnu_extensions=no
  1969. fi
  1970. ])
  1971.  
  1972. AC_MSG_RESULT($ac_cv_gnu_extensions)
  1973. if test "$ac_cv_gnu_extensions" = "yes"; then
  1974.   AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
  1975. fi
  1976. ])
  1977.  
  1978. AC_DEFUN(KDE_CHECK_COMPILER_FLAG,
  1979. [
  1980. AC_REQUIRE([AC_CHECK_COMPILERS])
  1981. AC_MSG_CHECKING(whether $CXX supports -$1)
  1982. kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'`
  1983. AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
  1984. [
  1985. echo 'int main() { return 0; }' >conftest.cc
  1986. eval "kde_cv_prog_cxx_$kde_cache=no"
  1987. if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then
  1988.   if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then
  1989.     eval "kde_cv_prog_cxx_$kde_cache=yes"
  1990.   fi
  1991. fi
  1992. rm -f conftest*
  1993. ])
  1994. if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
  1995.  AC_MSG_RESULT(yes)
  1996.  :
  1997.  $2
  1998. else
  1999.  AC_MSG_RESULT(no)
  2000.  :
  2001.  $3
  2002. fi
  2003. ])
  2004.  
  2005. AC_DEFUN(KDE_PROG_CC_PG,
  2006. [ AC_CACHE_CHECK(whether ${CC-cc} accepts -pg, kde_cv_prog_cc_pg,
  2007.   [echo 'void f(){}' > conftest.c
  2008.    if test -z "`${CC-cc} -pg -c conftest.c 2>&1`"; then
  2009.      kde_cv_prog_cc_pg=yes
  2010.    else
  2011.      kde_cv_prog_cc_pg=no
  2012.    fi
  2013.    rm -f conftest*
  2014. ])])
  2015.  
  2016. AC_DEFUN(KDE_PROG_CXX_PG,
  2017. [ AC_CACHE_CHECK(whether ${CXX-g++} accepts -pg, kde_cv_prog_cxx_pg,
  2018.   [echo 'void f(){}' > conftest.cc
  2019.    if test -z "`${CXX-g++} -pg -c conftest.cc 2>&1`"; then
  2020.      kde_cv_prog_cxx_pg=yes
  2021.    else
  2022.      kde_cv_prog_cxx_pg=no
  2023.    fi
  2024.   rm -f conftest*
  2025. ])])
  2026.  
  2027. dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
  2028. dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
  2029. dnl it's all white-space separated
  2030. AC_DEFUN(AC_REMOVE_FORBIDDEN,
  2031. [ __val=$$1
  2032.   __forbid=" $2 "
  2033.   if test -n "$__val"; then
  2034.     __new=""
  2035.     ac_save_IFS=$IFS
  2036.     IFS="     "
  2037.     for i in $__val; do
  2038.       case "$__forbid" in
  2039.         *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
  2040.     *) # Careful to not add spaces, where there were none, because otherwise
  2041.        # libtool gets confused, if we change e.g. CXX
  2042.        if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
  2043.       esac
  2044.     done
  2045.     IFS=$ac_save_IFS
  2046.     $1=$__new
  2047.   fi
  2048. ])
  2049.  
  2050. dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
  2051. AC_DEFUN(AC_VALIDIFY_CXXFLAGS,
  2052. [dnl
  2053.  AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
  2054.  AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
  2055. ])
  2056.  
  2057. AC_DEFUN(AC_CHECK_COMPILERS,
  2058. [
  2059.   dnl this is somehow a fat lie, but prevents other macros from double checking
  2060.   AC_PROVIDE([AC_PROG_CC])
  2061.   AC_PROVIDE([AC_PROG_CPP])
  2062.   AC_PROVIDE([AC_PROG_CXX])
  2063.   AC_PROVIDE([AC_PROG_CXXCPP])
  2064.  
  2065.   AC_ARG_ENABLE(debug,[  --enable-debug          enables debug symbols [default=no]],
  2066.   [
  2067.    if test $enableval = "no"; dnl
  2068.      then
  2069.        kde_use_debug_code="no"
  2070.        kde_use_debug_define=yes
  2071.      else
  2072.        kde_use_debug_code="yes"
  2073.        kde_use_debug_define=no
  2074.    fi
  2075.   ], [kde_use_debug_code="no"
  2076.       kde_use_debug_define=no
  2077.     ])
  2078.   dnl Just for configure --help
  2079.   AC_ARG_ENABLE(dummyoption,[  --disable-debug         disables debug output and debug symbols [default=no]],[],[])
  2080.  
  2081.   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
  2082.    [
  2083.     if test $enableval = "no"; then
  2084.          kde_use_strict_options="no"
  2085.        else
  2086.          kde_use_strict_options="yes"
  2087.     fi
  2088.    ], [kde_use_strict_options="no"])
  2089.  
  2090.   AC_ARG_ENABLE(profile,[  --enable-profile        creates profiling infos [default=no]],
  2091.      [kde_use_profiling=$enableval],
  2092.      [kde_use_profiling="no"]
  2093.   )
  2094.  
  2095. dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
  2096.   AC_MSG_CHECKING(for a C-Compiler)
  2097.   dnl if there is one, print out. if not, don't matter
  2098.   AC_MSG_RESULT($CC)
  2099.  
  2100.   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
  2101.   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
  2102.   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
  2103.   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
  2104.  
  2105.   AC_PROG_CC_WORKS
  2106.   AC_PROG_CC_GNU
  2107.  
  2108.   if test $ac_cv_prog_gcc = yes; then
  2109.     GCC=yes
  2110.   else
  2111.     GCC=
  2112.   fi
  2113.  
  2114.   USER_CFLAGS=$CFLAGS
  2115.   CFLAGS=
  2116.  
  2117.   if test -z "$CFLAGS"; then
  2118.     if test "$kde_use_debug_code" = "yes"; then
  2119.       AC_PROG_CC_G
  2120.       if test $ac_cv_prog_cc_g = yes; then
  2121.     CFLAGS="-g"
  2122.     case $host in
  2123.        *-*-linux-gnu)    
  2124.            CFLAGS="$CFLAGS -ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE -D_BSD_SOURCE"
  2125.          ;;
  2126.         esac
  2127.       fi
  2128.     else
  2129.       if test "$GCC" = "yes"; then
  2130.         CFLAGS="-O2"
  2131.       else
  2132.         CFLAGS=""
  2133.       fi
  2134.       if test "$kde_use_debug_define" = "yes"; then
  2135.         CFLAGS="$CFLAGS -DNDEBUG"
  2136.     dnl damn buggy compilers :-(
  2137.     dnl if test "$GCC" = "yes"; then
  2138.         dnl  CFLAGS="$CFLAGS -fomit-frame-pointer"
  2139.     dnl   CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
  2140.     dnl fi
  2141.       fi
  2142.     fi
  2143.  
  2144.     if test "$kde_use_profiling" = yes; then
  2145.       KDE_PROG_CC_PG
  2146.       if test "$kde_cv_prog_cc_pg" = yes; then
  2147.         CFLAGS="$CFLAGS -pg"
  2148.       fi
  2149.     fi
  2150.  
  2151.     if test "$GCC" = "yes"; then
  2152.      CFLAGS="$CFLAGS"
  2153.  
  2154.      if test "$kde_use_strict_options" = "yes"; then
  2155.     CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
  2156.      fi
  2157.     fi
  2158.  
  2159.   fi
  2160.  
  2161.   case "$host" in
  2162.   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
  2163.   *-*-sysv5uw7*) CFLAGS="$CFLAGS -D_UNIXWARE7";;
  2164.   esac
  2165.  
  2166.   if test -n "$USER_CFLAGS"; then
  2167.     CFLAGS="$CFLAGS $USER_CFLAGS"
  2168.   fi
  2169.  
  2170.   if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
  2171.      LDFLAGS=""
  2172.   fi
  2173.  
  2174.  
  2175. dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
  2176. dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
  2177.  
  2178.   AC_MSG_CHECKING(how to run the C preprocessor)
  2179.   # On Suns, sometimes $CPP names a directory.
  2180.   if test -n "$CPP" && test -d "$CPP"; then
  2181.     CPP=
  2182.   fi
  2183.   if test -z "$CPP"; then
  2184.   AC_CACHE_VAL(ac_cv_prog_CPP,
  2185.   [  # This must be in double quotes, not single quotes, because CPP may get
  2186.     # substituted into the Makefile and "${CC-cc}" will confuse make.
  2187.     CPP="${CC-cc} -E"
  2188.     # On the NeXT, cc -E runs the code through the compiler's parser,
  2189.     # not just through cpp.
  2190.     dnl Use a header file that comes with gcc, so configuring glibc
  2191.     dnl with a fresh cross-compiler works.
  2192.     AC_TRY_CPP([#include <assert.h>
  2193.     Syntax Error], ,
  2194.     CPP="${CC-cc} -E -traditional-cpp"
  2195.     AC_TRY_CPP([#include <assert.h>
  2196.     Syntax Error], , CPP=/lib/cpp))
  2197.     ac_cv_prog_CPP="$CPP"])dnl
  2198.     CPP="$ac_cv_prog_CPP"
  2199.   else
  2200.     ac_cv_prog_CPP="$CPP"
  2201.   fi
  2202.   AC_MSG_RESULT($CPP)
  2203.   AC_SUBST(CPP)dnl
  2204.  
  2205.  
  2206.   AC_MSG_CHECKING(for a C++-Compiler)
  2207.   dnl if there is one, print out. if not, don't matter
  2208.   AC_MSG_RESULT($CXX)
  2209.  
  2210.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
  2211.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
  2212.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
  2213.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
  2214.   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
  2215.  
  2216.   AC_PROG_CXX_WORKS
  2217.   AC_PROG_CXX_GNU
  2218.  
  2219.   if test $ac_cv_prog_gxx = yes; then
  2220.     GXX=yes
  2221.   fi
  2222.  
  2223.   USER_CXXFLAGS=$CXXFLAGS
  2224.   CXXFLAGS=""
  2225.  
  2226.   if test -z "$CXXFLAGS"; then
  2227.     if test "$kde_use_debug_code" = "yes"; then
  2228.       AC_PROG_CXX_G
  2229.       if test $ac_cv_prog_cxx_g = yes; then
  2230.         CXXFLAGS="-g"
  2231.     case $host in  dnl
  2232.        *-*-linux-gnu)
  2233.            CXXFLAGS="$CXXFLAGS -ansi -D_XOPEN_SOURCE -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion"
  2234.          ;;
  2235.         esac
  2236.       fi
  2237.     else
  2238.       if test "$GXX" = "yes"; then
  2239.          CXXFLAGS="-O2"
  2240.       fi
  2241.       if test "$kde_use_debug_define" = "yes"; then
  2242.          CXXFLAGS="$CXXFLAGS -DNDEBUG"
  2243.       fi
  2244.     fi
  2245.  
  2246.     if test "$kde_use_profiling" = yes; then
  2247.       KDE_PROG_CXX_PG
  2248.       if test "$kde_cv_prog_cxx_pg" = yes; then
  2249.         CXXFLAGS="$CXXFLAGS -pg"
  2250.       fi
  2251.     fi
  2252.     
  2253.     KDE_CHECK_COMPILER_FLAG(fno-exceptions,
  2254.     [
  2255.       CXXFLAGS="$CXXFLAGS -fno-exceptions"
  2256.     ])
  2257.       
  2258. dnl WABA: Nothing wrong with RTTI, keep it on.
  2259. dnl    KDE_CHECK_COMPILER_FLAG(fno-rtti,
  2260. dnl    [
  2261. dnl      CXXFLAGS="$CXXFLAGS -fno-rtti"
  2262. dnl    ])
  2263.  
  2264.     KDE_CHECK_COMPILER_FLAG(fno-check-new,
  2265.     [
  2266.       CXXFLAGS="$CXXFLAGS -fno-check-new"
  2267.     ])
  2268.  
  2269.     if test "$GXX" = "yes"; then
  2270.        CXXFLAGS="$CXXFLAGS"
  2271.  
  2272.        if test true || test "$kde_use_debug_code" = "yes"; then
  2273.      CXXFLAGS="$CXXFLAGS -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
  2274.  
  2275.          KDE_CHECK_COMPILER_FLAG(Wno-long-long,
  2276.      [
  2277.        CXXFLAGS="$CXXFLAGS -Wno-long-long"
  2278.      ])
  2279.          KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,
  2280.          [
  2281.            CXXFLAGS="$CXXFLAGS -Wnon-virtual-dtor"
  2282.          ])
  2283.          KDE_CHECK_COMPILER_FLAG(fno-builtin,
  2284.          [
  2285.            CXXFLAGS="$CXXFLAGS -fno-builtin"
  2286.          ])
  2287.     
  2288.        fi
  2289.  
  2290.        if test "$kde_use_strict_options" = "yes"; then
  2291.     CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align"
  2292.        fi
  2293.  
  2294.        if test "$kde_very_strict" = "yes"; then
  2295.          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion"
  2296.        fi
  2297.     fi
  2298.   fi
  2299.  
  2300.     KDE_CHECK_COMPILER_FLAG(fexceptions,
  2301.     [
  2302.       USE_EXCEPTIONS="-fexceptions"
  2303.     ],
  2304.       USE_EXCEPTIONS=
  2305.     )
  2306.     AC_SUBST(USE_EXCEPTIONS)
  2307.  
  2308.     KDE_CHECK_COMPILER_FLAG(frtti,
  2309.     [
  2310.       USE_RTTI="-frtti"
  2311.     ],
  2312.       USE_RTTI=
  2313.     )
  2314.     AC_SUBST(USE_RTTI)
  2315.  
  2316.     case "$host" in
  2317.       *-*-irix*)  test "$GXX" = yes && CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS" ;;
  2318.       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
  2319.       *-*-sysv5uw7*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE7";;
  2320.       *-*-solaris*) 
  2321.         if test "$GXX" = yes; then
  2322.           libstdcpp=`gcc -print-file-name=libstdc++.so`
  2323.           if test ! -f $libstdcpp; then
  2324.              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])
  2325.           fi
  2326.         fi
  2327.         ;;
  2328.     esac
  2329.  
  2330.     if test -n "$USER_CXXFLAGS"; then
  2331.        CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  2332.     fi
  2333.  
  2334.     AC_VALIDIFY_CXXFLAGS
  2335.  
  2336.     AC_MSG_CHECKING(how to run the C++ preprocessor)
  2337.     if test -z "$CXXCPP"; then
  2338.       AC_CACHE_VAL(ac_cv_prog_CXXCPP,
  2339.       [
  2340.          AC_LANG_SAVE[]dnl
  2341.          AC_LANG_CPLUSPLUS[]dnl
  2342.          CXXCPP="${CXX-g++} -E"
  2343.          AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
  2344.          ac_cv_prog_CXXCPP="$CXXCPP"
  2345.          AC_LANG_RESTORE[]dnl
  2346.      ])dnl
  2347.      CXXCPP="$ac_cv_prog_CXXCPP"
  2348.     fi
  2349.     AC_MSG_RESULT($CXXCPP)
  2350.     AC_SUBST(CXXCPP)dnl
  2351.  
  2352.     # the following is to allow programs, that are known to
  2353.     # have problems when compiled with -O2
  2354.     if test -n "$CXXFLAGS"; then
  2355.       kde_safe_IFS=$IFS
  2356.       IFS=" "
  2357.       NOOPT_CXXFLAGS=""
  2358.       for i in $CXXFLAGS; do
  2359.         case $i in
  2360.           -O*)
  2361.                 ;;
  2362.           *)
  2363.                 NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i"
  2364.                 ;;
  2365.         esac
  2366.       done
  2367.       IFS=$kde_safe_IFS
  2368.     fi
  2369.     AC_SUBST(NOOPT_CXXFLAGS)
  2370.  
  2371.     KDE_CHECK_FINAL
  2372.  
  2373.     ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
  2374.  
  2375.     KDE_CXXFLAGS=
  2376.     AC_SUBST(KDE_CXXFLAGS)
  2377. ])
  2378.  
  2379. AC_DEFUN(KDE_ADD_DEPENDENCIES,
  2380. [
  2381.    [A]M_DEPENDENCIES(CC)
  2382.    [A]M_DEPENDENCIES(CXX)
  2383. ])
  2384.  
  2385. dnl just a wrapper to clean up configure.in
  2386. AC_DEFUN(KDE_PROG_LIBTOOL,
  2387. [
  2388. AC_REQUIRE([AC_CHECK_COMPILERS])
  2389. AC_REQUIRE([AC_ENABLE_SHARED])
  2390. AC_REQUIRE([AC_ENABLE_STATIC])
  2391.  
  2392. AC_REQUIRE([AC_LIBTOOL_DLOPEN])
  2393.  
  2394. AC_LANG_SAVE
  2395. AC_LANG_C
  2396. AC_OBJEXT
  2397. AC_EXEEXT
  2398. AC_LANG_RESTORE
  2399.  
  2400. AM_PROG_LIBTOOL
  2401. AC_LIBTOOL_CXX
  2402.  
  2403. LIBTOOL_SHELL="/bin/sh ./libtool"
  2404. #  LIBTOOL="$LIBTOOL --silent"
  2405. KDE_PLUGIN="-avoid-version -module -no-undefined"
  2406. AC_SUBST(KDE_PLUGIN)
  2407. ])
  2408.  
  2409. AC_DEFUN(KDE_CHECK_TYPES,
  2410. [  AC_CHECK_SIZEOF(int, 4)dnl
  2411.   AC_CHECK_SIZEOF(long, 4)dnl
  2412.   AC_CHECK_SIZEOF(char *, 4)dnl
  2413. ])dnl
  2414.  
  2415. AC_DEFUN(KDE_DO_IT_ALL,
  2416. [
  2417. AC_CANONICAL_SYSTEM
  2418. AC_ARG_PROGRAM
  2419. AM_INIT_AUTOMAKE($1, $2)
  2420. AM_DISABLE_LIBRARIES
  2421. AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  2422. AC_CHECK_COMPILERS
  2423. KDE_PROG_LIBTOOL
  2424. AM_KDE_WITH_NLS
  2425. AC_PATH_KDE
  2426. ])
  2427.  
  2428. AC_DEFUN(AC_CHECK_RPATH,
  2429. [
  2430. AC_MSG_CHECKING(for rpath)
  2431. AC_ARG_ENABLE(rpath,
  2432.       [  --disable-rpath         do not use the rpath feature of ld],
  2433.       USE_RPATH=$enableval, USE_RPATH=yes)
  2434.  
  2435. if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
  2436.  
  2437.   KDE_RPATH="-R \$(kde_libraries)"
  2438.  
  2439.   if test -n "$qt_libraries"; then
  2440.     KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
  2441.   fi
  2442.   dnl $x_libraries is set to /usr/lib in case
  2443.   if test -n "$X_LDFLAGS"; then
  2444.     KDE_RPATH="$KDE_RPATH -R \$(x_libraries)"
  2445.   fi
  2446.   if test -n "$KDE_EXTRA_RPATH"; then
  2447.     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
  2448.   fi
  2449. fi
  2450. AC_SUBST(KDE_EXTRA_RPATH)
  2451. AC_SUBST(KDE_RPATH)
  2452. AC_MSG_RESULT($USE_RPATH)
  2453. ])
  2454.  
  2455. dnl Check for the type of the third argument of getsockname
  2456. AC_DEFUN(AC_CHECK_KSIZE_T,
  2457. [AC_MSG_CHECKING(for the third argument of getsockname)
  2458. AC_CACHE_VAL(ac_cv_ksize_t,
  2459. AC_LANG_SAVE
  2460. AC_LANG_CPLUSPLUS
  2461. [AC_TRY_COMPILE([
  2462. #include <sys/types.h>
  2463. #include <sys/socket.h>
  2464. ],[
  2465. socklen_t a=0;
  2466. getsockname(0,(struct sockaddr*)0, &a);
  2467. ],
  2468. ac_cv_ksize_t=socklen_t,
  2469. ac_cv_ksize_t=)
  2470. if test -z "$ac_cv_ksize_t"; then
  2471. ac_safe_cxxflags="$CXXFLAGS"
  2472. if test "$GCC" = "yes"; then
  2473.   CXXFLAGS="-Werror $CXXFLAGS"
  2474. fi
  2475. AC_TRY_COMPILE([
  2476. #include <sys/types.h>
  2477. #include <sys/socket.h>
  2478. ],[
  2479. int a=0;
  2480. getsockname(0,(struct sockaddr*)0, &a);
  2481. ],
  2482. ac_cv_ksize_t=int,
  2483. ac_cv_ksize_t=size_t)
  2484. CXXFLAGS="$ac_safe_cxxflags"
  2485. fi
  2486. AC_LANG_RESTORE
  2487. ])
  2488.  
  2489. if test -z "$ac_cv_ksize_t"; then
  2490.   ac_cv_ksize_t=int
  2491. fi
  2492.  
  2493. AC_MSG_RESULT($ac_cv_ksize_t)
  2494. AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t,
  2495.       [Define the type of the third argument for getsockname]
  2496. )
  2497.  
  2498. ])
  2499.  
  2500. dnl This is a merge of some macros out of the gettext aclocal.m4
  2501. dnl since we don't need anything, I took the things we need
  2502. dnl the copyright for them is:
  2503. dnl >
  2504. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  2505. dnl This Makefile.in is free software; the Free Software Foundation
  2506. dnl gives unlimited permission to copy and/or distribute it,
  2507. dnl with or without modifications, as long as this notice is preserved.
  2508.  
  2509. dnl This program is distributed in the hope that it will be useful,
  2510. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  2511. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  2512. dnl PARTICULAR PURPOSE.
  2513. dnl >
  2514. dnl for this file it is relicensed under LGPL
  2515.  
  2516. AC_DEFUN(AM_KDE_WITH_NLS,
  2517.   [
  2518.     dnl If we use NLS figure out what method
  2519.  
  2520.     AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
  2521.         [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
  2522.     AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  2523.  
  2524.      if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
  2525.         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
  2526.         GMSGFMT=":"
  2527.       fi
  2528.       MSGFMT=$GMSGFMT
  2529.       AC_SUBST(GMSGFMT)
  2530.       AC_SUBST(MSGFMT)
  2531.  
  2532.       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
  2533.     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  2534.  
  2535.       dnl Test whether we really found GNU xgettext.
  2536.       if test "$XGETTEXT" != ":"; then
  2537.     dnl If it is no GNU xgettext we define it as : so that the
  2538.     dnl Makefiles still can work.
  2539.     if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  2540.       : ;
  2541.     else
  2542.       AC_MSG_RESULT(
  2543.         [found xgettext programs is not GNU xgettext; ignore it])
  2544.       XGETTEXT=":"
  2545.     fi
  2546.       fi
  2547.      AC_SUBST(XGETTEXT)
  2548.  
  2549.   ])
  2550.  
  2551. # Search path for a program which passes the given test.
  2552. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  2553.  
  2554. # serial 1
  2555. # Stephan Kulow: I appended a _KDE against name conflicts
  2556.  
  2557. dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
  2558. dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  2559. AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
  2560. [# Extract the first word of "$2", so it can be a program name with args.
  2561. set dummy $2; ac_word=[$]2
  2562. AC_MSG_CHECKING([for $ac_word])
  2563. AC_CACHE_VAL(ac_cv_path_$1,
  2564. [case "[$]$1" in
  2565.   /*)
  2566.   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  2567.   ;;
  2568.   *)
  2569.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  2570.   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  2571.     test -z "$ac_dir" && ac_dir=.
  2572.     if test -f $ac_dir/$ac_word; then
  2573.       if [$3]; then
  2574.     ac_cv_path_$1="$ac_dir/$ac_word"
  2575.     break
  2576.       fi
  2577.     fi
  2578.   done
  2579.   IFS="$ac_save_ifs"
  2580. dnl If no 4th arg is given, leave the cache variable unset,
  2581. dnl so AC_PATH_PROGS will keep looking.
  2582. ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  2583. ])dnl
  2584.   ;;
  2585. esac])dnl
  2586. $1="$ac_cv_path_$1"
  2587. if test -n "[$]$1"; then
  2588.   AC_MSG_RESULT([$]$1)
  2589. else
  2590.   AC_MSG_RESULT(no)
  2591. fi
  2592. AC_SUBST($1)dnl
  2593. ])
  2594.  
  2595.  
  2596. # Check whether LC_MESSAGES is available in <locale.h>.
  2597. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  2598.  
  2599. # serial 1
  2600.  
  2601. AC_DEFUN(AM_LC_MESSAGES,
  2602.   [if test $ac_cv_header_locale_h = yes; then
  2603.     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  2604.       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  2605.        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  2606.     if test $am_cv_val_LC_MESSAGES = yes; then
  2607.       AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
  2608.     fi
  2609.   fi])
  2610.  
  2611. dnl From Jim Meyering.
  2612. dnl FIXME: migrate into libit.
  2613.  
  2614. AC_DEFUN(AM_FUNC_OBSTACK,
  2615. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  2616.  [AC_TRY_LINK([#include "obstack.h"],
  2617.           [struct obstack *mem;obstack_free(mem,(char *) 0)],
  2618.           am_cv_func_obstack=yes,
  2619.           am_cv_func_obstack=no)])
  2620.  if test $am_cv_func_obstack = yes; then
  2621.    AC_DEFINE(HAVE_OBSTACK)
  2622.  else
  2623.    LIBOBJS="$LIBOBJS obstack.o"
  2624.  fi
  2625. ])
  2626.  
  2627. dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
  2628. dnl FIXME: Migrate into libit
  2629.  
  2630. AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
  2631. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  2632.  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  2633.               am_cv_lib_error_at_line=yes,
  2634.           am_cv_lib_error_at_line=no)])
  2635.  if test $am_cv_lib_error_at_line = no; then
  2636.    LIBOBJS="$LIBOBJS error.o"
  2637.  fi
  2638.  AC_SUBST(LIBOBJS)dnl
  2639. ])
  2640.  
  2641. # Macro to add for using GNU gettext.
  2642. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  2643.  
  2644. # serial 1
  2645. # Stephan Kulow: I put a KDE in it to avoid name conflicts
  2646.  
  2647. AC_DEFUN(AM_KDE_GNU_GETTEXT,
  2648.   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  2649.    AC_REQUIRE([AC_PROG_RANLIB])dnl
  2650.    AC_REQUIRE([AC_HEADER_STDC])dnl
  2651.    AC_REQUIRE([AC_TYPE_OFF_T])dnl
  2652.    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  2653.    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  2654.    AC_REQUIRE([AC_FUNC_MMAP])dnl
  2655.    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
  2656.    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h])
  2657.    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
  2658. __argz_count __argz_stringify __argz_next])
  2659.  
  2660.    AC_MSG_CHECKING(for stpcpy)
  2661.    AC_CACHE_VAL(kde_cv_func_stpcpy,
  2662.    [
  2663.    kde_safe_cxxflags=$CXXFLAGS
  2664.    CXXFLAGS="-Wmissing-prototypes -Werror"
  2665.    AC_LANG_SAVE
  2666.    AC_LANG_CPLUSPLUS
  2667.    AC_TRY_COMPILE([
  2668.    #include <string.h>
  2669.    ],
  2670.    [
  2671.    char buffer[200];
  2672.    stpcpy(buffer, buffer);
  2673.    ],
  2674.    kde_cv_func_stpcpy=yes,
  2675.    kde_cv_func_stpcpy=no)
  2676.    AC_LANG_RESTORE
  2677.    CXXFLAGS=$kde_safe_cxxflags
  2678.    ])
  2679.    AC_MSG_RESULT($kde_cv_func_stpcpy)
  2680.    if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
  2681.      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
  2682.    fi
  2683.  
  2684.    AM_LC_MESSAGES
  2685.  
  2686.    if test "x$CATOBJEXT" != "x"; then
  2687.      if test "x$ALL_LINGUAS" = "x"; then
  2688.        LINGUAS=
  2689.      else
  2690.        AC_MSG_CHECKING(for catalogs to be installed)
  2691.        NEW_LINGUAS=
  2692.        for lang in ${LINGUAS=$ALL_LINGUAS}; do
  2693.          case "$ALL_LINGUAS" in
  2694.           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  2695.          esac
  2696.        done
  2697.        LINGUAS=$NEW_LINGUAS
  2698.        AC_MSG_RESULT($LINGUAS)
  2699.      fi
  2700.  
  2701.      dnl Construct list of names of catalog files to be constructed.
  2702.      if test -n "$LINGUAS"; then
  2703.        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  2704.      fi
  2705.    fi
  2706.  
  2707.   ])
  2708.  
  2709. AC_DEFUN(AC_HAVE_XPM,
  2710.  [AC_REQUIRE_CPP()dnl
  2711.   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2712.  
  2713.  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
  2714.  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
  2715.  
  2716.  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
  2717.     xpm_test=$withval, xpm_test="yes")
  2718.  if test "x$xpm_test" = xno; then
  2719.    ac_cv_have_xpm=no
  2720.  else
  2721.    AC_MSG_CHECKING(for XPM)
  2722.    AC_CACHE_VAL(ac_cv_have_xpm,
  2723.    [
  2724.     AC_LANG_C
  2725.     ac_save_ldflags="$LDFLAGS"
  2726.     ac_save_cflags="$CFLAGS"
  2727.     LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
  2728.     CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
  2729.     test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
  2730.     AC_TRY_LINK([#include <X11/xpm.h>],[],
  2731.     ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
  2732.     LDFLAGS="$ac_save_ldflags"
  2733.     CFLAGS="$ac_save_cflags"
  2734.    ])dnl
  2735.  
  2736.   if test "$ac_cv_have_xpm" = no; then
  2737.     AC_MSG_RESULT(no)
  2738.     XPM_LDFLAGS=""
  2739.     XPMINC=""
  2740.     $2
  2741.   else
  2742.     AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
  2743.     if test "$XPM_LDFLAGS" = ""; then
  2744.        XPMLIB='-lXpm $(LIB_X11)'
  2745.     else
  2746.        XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
  2747.     fi
  2748.     if test "$XPM_INCLUDE" = ""; then
  2749.        XPMINC=""
  2750.     else
  2751.        XPMINC="-I$XPM_INCLUDE"
  2752.     fi
  2753.     AC_MSG_RESULT(yes)
  2754.     $1
  2755.   fi
  2756.  fi
  2757.  AC_SUBST(XPMINC)
  2758.  AC_SUBST(XPMLIB)
  2759. ])
  2760.  
  2761. AC_DEFUN(AC_HAVE_DPMS,
  2762.  [AC_REQUIRE_CPP()dnl
  2763.   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2764.  
  2765.  test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
  2766.  test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
  2767.  DPMS_LIB=
  2768.  
  2769.  AC_ARG_WITH(dpms, [  --without-dpms          disable DPMS power saving],
  2770.     dpms_test=$withval, dpms_test="yes")
  2771.  if test "x$dpms_test" = xno; then
  2772.    ac_cv_have_dpms=no
  2773.  else
  2774.    AC_MSG_CHECKING(for DPMS)
  2775.    dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
  2776.    dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
  2777.    AC_CACHE_VAL(ac_cv_have_dpms,
  2778.    [
  2779.     AC_LANG_C
  2780.     ac_save_ldflags="$LDFLAGS"
  2781.     ac_save_cflags="$CFLAGS"
  2782.     ac_save_libs="$LIBS"
  2783.     LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
  2784.     CFLAGS="$CFLAGS $X_INCLUDES"
  2785.     test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  2786.     AC_TRY_LINK([
  2787.     #include <X11/Xproto.h>
  2788.     #include <X11/X.h>
  2789.     #include <X11/Xlib.h>
  2790.     #include <X11/extensions/dpms.h>
  2791.     int foo_test_dpms()
  2792.     { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  2793.     ac_cv_have_dpms="yes", [
  2794.             LDFLAGS="$ac_save_ldflags"
  2795.             CFLAGS="$ac_save_cflags"
  2796.             LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
  2797.             LIBS="$LIBS -lXdpms"
  2798.             CFLAGS="$CFLAGS $X_INCLUDES"
  2799.             test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  2800.             AC_TRY_LINK([
  2801.             #include <X11/Xproto.h>
  2802.             #include <X11/X.h>
  2803.             #include <X11/Xlib.h>
  2804.             #include <X11/extensions/dpms.h>
  2805.             int foo_test_dpms()
  2806.             { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  2807.             [
  2808.                 ac_cv_have_dpms="-lXdpms"
  2809.                 ],ac_cv_have_dpms="no")
  2810.             ])
  2811.     LDFLAGS="$ac_save_ldflags"
  2812.     CFLAGS="$ac_save_cflags"
  2813.     LIBS="$ac_save_libs"
  2814.    ])dnl
  2815.  
  2816.   if test "$ac_cv_have_dpms" = no; then
  2817.     AC_MSG_RESULT(no)
  2818.     DPMS_LDFLAGS=""
  2819.     DPMSINC=""
  2820.     $2
  2821.   else
  2822.     AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
  2823.     if test "$ac_cv_have_dpms" = "-lXdpms"; then
  2824.        DPMS_LIB="-lXdpms"
  2825.     fi
  2826.     if test "$DPMS_LDFLAGS" = ""; then
  2827.        DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
  2828.     else
  2829.        DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
  2830.     fi
  2831.     if test "$DPMS_INCLUDE" = ""; then
  2832.        DPMSINC=""
  2833.     else
  2834.        DPMSINC="-I$DPMS_INCLUDE"
  2835.     fi
  2836.     AC_MSG_RESULT(yes)
  2837.     $1
  2838.   fi
  2839.  fi
  2840.  AC_SUBST(DPMSINC)
  2841.  AC_SUBST(DPMSLIB)
  2842. ])
  2843.  
  2844. AC_DEFUN(AC_HAVE_GL,
  2845.  [AC_REQUIRE_CPP()dnl
  2846.   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2847.  
  2848.  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
  2849.  test -z "$GL_INCLUDE" && GL_INCLUDE=
  2850.  
  2851.  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
  2852.     gl_test=$withval, gl_test="yes")
  2853.  if test "x$gl_test" = xno; then
  2854.    ac_cv_have_gl=no
  2855.  else
  2856.    AC_MSG_CHECKING(for GL)
  2857.    AC_CACHE_VAL(ac_cv_have_gl,
  2858.    [
  2859.     AC_LANG_C
  2860.     ac_save_ldflags="$LDFLAGS"
  2861.     ac_save_cflags="$CFLAGS"
  2862.     LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
  2863.     CFLAGS="$CFLAGS $X_INCLUDES"
  2864.     test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  2865.     AC_TRY_LINK([#include <GL/gl.h>
  2866. #include <GL/glu.h>           
  2867. ], [],
  2868.     ac_cv_have_gl="mesa", ac_cv_have_gl="no")
  2869.     if test "x$ac_cv_have_gl" = "xno"; then
  2870.       LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET"
  2871.       CFLAGS="$ac_save_cflags $X_INCLUDES"
  2872.       test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  2873.       AC_TRY_LINK([#include <GL/gl.h>
  2874. #include <GL/glu.h>
  2875. ], [],
  2876.       ac_cv_have_gl="yes", ac_cv_have_gl="no")
  2877.     fi
  2878.     LDFLAGS="$ac_save_ldflags"
  2879.     CFLAGS="$ac_save_cflags"
  2880.    ])dnl
  2881.  
  2882.   if test "$ac_cv_have_gl" = "no"; then
  2883.     AC_MSG_RESULT(no)
  2884.     GL_LDFLAGS=""
  2885.     GLINC=""
  2886.     $2
  2887.   else
  2888.     AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
  2889.     if test "$GL_LDFLAGS" = ""; then
  2890.        if test "$ac_cv_have_gl" = "mesa"; then
  2891.           GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)'
  2892.        else
  2893.           GLLIB='-lGL -lGLU $(LIB_X11)'
  2894.        fi
  2895.     else
  2896.        if test "$ac_cv_have_gl" = "mesa"; then
  2897.           GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)'
  2898.        else
  2899.           GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)'
  2900.        fi
  2901.     fi
  2902.     if test "$GL_INCLUDE" = ""; then
  2903.        GLINC=""
  2904.     else
  2905.        GLINC="-I$GL_INCLUDE"
  2906.     fi
  2907.     AC_MSG_RESULT($ac_cv_have_gl)
  2908.     $1
  2909.   fi
  2910.  fi
  2911.  AC_SUBST(GLINC)
  2912.  AC_SUBST(GLLIB)
  2913. ])
  2914.  
  2915.  dnl PAM pam
  2916.  
  2917.  dnl Should test for PAM (Pluggable Authentication Modules)
  2918.  AC_DEFUN(AC_PATH_PAM_DIRECT,
  2919.  [
  2920.  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
  2921.  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
  2922.  
  2923.    for ac_dir in               \
  2924.                                \
  2925.      /usr/local/include        \
  2926.      /usr/include              \
  2927.      /usr/unsupported/include  \
  2928.      /opt/include              \
  2929.      /usr/pam/include          \
  2930.      /usr/local/pam/include    \
  2931.      /usr/lib/pam/include      \
  2932.                    \
  2933.      $extra_include            \
  2934.      ; \
  2935.    do
  2936.      if test -r "$ac_dir/$pam_direct_test_include"; then
  2937.        no_pam= ac_pam_includes=$ac_dir
  2938.        break
  2939.      fi
  2940.    done
  2941.  
  2942.  # First see if replacing the include by lib works.
  2943.  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
  2944.                            \
  2945.      /lib                  \
  2946.      /usr/lib              \
  2947.      /usr/local/lib        \
  2948.      /usr/unsupported/lib  \
  2949.      /lib/security         \
  2950.      /usr/security/lib     \
  2951.      $extra_lib            \
  2952.      ; \
  2953.  do
  2954.    for ac_extension in a so sl; do
  2955.      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
  2956.        no_pam= ac_pam_libraries=$ac_dir
  2957.        break 2
  2958.      fi
  2959.    done
  2960.  done
  2961. ])
  2962.  
  2963. AC_DEFUN(AC_PATH_PAM,
  2964.  [
  2965.   AC_REQUIRE([KDE_CHECK_LIBDL])
  2966.   AC_REQUIRE_CPP()dnl
  2967.  
  2968. dnl AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"
  2969. dnl              AC_DEFINE_UNQUOTED(HAVE_PAM_MISC, 1, [Define if you have a PAM implementation with the pam_misc library])], [], [-lpam $LIBDL])
  2970.  
  2971.  AC_MSG_CHECKING(for PAM)
  2972.  AC_ARG_WITH(pam,
  2973. [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
  2974.   [
  2975.     if test "x$withval" = "xyes"; then
  2976.       no_pam=
  2977.       default_pam=yes
  2978.     elif test "x$withval" = "xno"; then
  2979.       no_pam=yes
  2980.     else
  2981.       no_pam=
  2982.       pam_service="$withval"
  2983.         if test -z "$pam_service"; then
  2984.         default_pam=yes
  2985.         else
  2986.         default_pam=
  2987.         fi
  2988.       fi
  2989.   ], no_pam=yes
  2990.  )
  2991.  
  2992.  if test ! "$no_pam" = yes; then
  2993.  
  2994.  AC_CACHE_VAL(ac_cv_path_pam,
  2995.  [
  2996.  ac_pam_includes=NONE
  2997.  ac_pam_libraries=NONE
  2998.  if test -z "$pam_libraries"; then
  2999.    pam_libraries=NONE
  3000.  fi
  3001.  if test -z "$pam_includes"; then
  3002.    pam_includes=NONE
  3003.  fi
  3004.  
  3005.  AC_PATH_PAM_DIRECT
  3006.  
  3007.  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
  3008.  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
  3009.  
  3010.  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
  3011.    ac_pam_libs="-lpam $PAM_MISC_LIB $LIBDL"
  3012.    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
  3013.  else
  3014.    ac_cv_path_pam="no_pam=yes"
  3015.  fi
  3016.  ])
  3017.  
  3018.  eval "$ac_cv_path_pam"
  3019.  
  3020.  fi
  3021.  
  3022.  if test "$no_pam" = yes; then
  3023.    AC_MSG_RESULT(no)
  3024.  else
  3025.    AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules); Redhat-Users!])
  3026.    PAMLIBS="$ac_pam_libs"
  3027.    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
  3028.    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
  3029.    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
  3030.  if test "$default_pam" = yes; then
  3031.    AC_MSG_RESULT(["default pam service name will be used"])
  3032.  else
  3033.    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service", [Define to change the default name of the PAM service used by KDE])
  3034.    AC_MSG_RESULT(["pam service name will be: " $pam_service])
  3035.  fi
  3036. dnl test whether struct pam_message is const (Linux) or not (Sun)
  3037.    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
  3038.    AC_MSG_CHECKING(for const pam_message)
  3039.    AC_EGREP_HEADER([struct pam_message],
  3040.       $pam_appl_h,
  3041.       [ AC_EGREP_HEADER([const struct pam_message],
  3042.                         $pam_appl_h,
  3043.                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
  3044.                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
  3045.                         AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
  3046.                         )],
  3047.        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
  3048.        )
  3049.  fi
  3050.  
  3051.  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
  3052.      PAMLIBPATHS="-L$pam_libraries"
  3053.  fi
  3054.  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
  3055.      PAMINC="-I$pam_includes"
  3056.  fi
  3057.  
  3058.  AC_SUBST(PAMINC)
  3059.  AC_SUBST(PAMLIBS)
  3060.  AC_SUBST(PAMLIBPATHS)
  3061.  
  3062. ])
  3063.  
  3064. AC_DEFUN(KDE_CHECK_LIBDL,
  3065. [
  3066. AC_CHECK_LIB(dl, dlopen, [
  3067. LIBDL="-ldl"
  3068. ac_cv_have_dlfcn=yes
  3069. ])
  3070.  
  3071. AC_CHECK_LIB(dld, shl_unload, [
  3072. LIBDL="-ldld"
  3073. ac_cv_have_shload=yes
  3074. ])
  3075.  
  3076. AC_SUBST(LIBDL)
  3077. ])
  3078.  
  3079. AC_DEFUN(KDE_CHECK_DLOPEN,
  3080. [
  3081. KDE_CHECK_LIBDL
  3082. AC_CHECK_HEADERS(dlfcn.h dl.h)
  3083. if test "$ac_cv_header_dlfcn_h" = "no"; then
  3084.   ac_cv_have_dlfcn=no
  3085. fi
  3086.  
  3087. if test "$ac_cv_header_dl_h" = "no"; then
  3088.   ac_cv_have_shload=no
  3089. fi
  3090.  
  3091. dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
  3092. dnl (MM)
  3093. AC_ARG_ENABLE(dlopen,
  3094. [  --disable-dlopen        link statically [default=no]] ,
  3095. enable_dlopen=$enableval,
  3096. enable_dlopen=yes)
  3097.  
  3098. # override the user's opinion, if we know it better ;)
  3099. if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
  3100.   enable_dlopen=no
  3101. fi
  3102.  
  3103. if test "$ac_cv_have_dlfcn" = "yes"; then
  3104.   AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
  3105. fi
  3106.  
  3107. if test "$ac_cv_have_shload" = "yes"; then
  3108.   AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
  3109. fi
  3110.  
  3111. if test "$enable_dlopen" = no ; then
  3112.   test -n "$1" && eval $1
  3113. else
  3114.   test -n "$2" && eval $2
  3115. fi
  3116.  
  3117. ])
  3118.  
  3119. AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
  3120. [
  3121. KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
  3122. KDE_PROG_LIBTOOL
  3123. AC_MSG_CHECKING([dynamic loading])
  3124. eval "`egrep '^build_libtool_libs=' libtool`"
  3125. if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
  3126.   dynamic_loading=yes
  3127.   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
  3128. else
  3129.   dynamic_loading=no
  3130. fi
  3131. AC_MSG_RESULT($dynamic_loading)
  3132. if test "$dynamic_loading" = "yes"; then
  3133.   $1
  3134. else
  3135.   $2
  3136. fi
  3137. ])
  3138.  
  3139. AC_DEFUN(KDE_ADD_INCLUDES,
  3140. [
  3141. if test -z "$1"; then
  3142.   test_include="Pix.h"
  3143. else
  3144.   test_include="$1"
  3145. fi
  3146.  
  3147. AC_MSG_CHECKING([for libg++ ($test_include)])
  3148.  
  3149. AC_CACHE_VAL(kde_cv_libgpp_includes,
  3150. [
  3151. kde_cv_libgpp_includes=no
  3152.  
  3153.    for ac_dir in               \
  3154.                                \
  3155.      /usr/include/g++          \
  3156.      /usr/include              \
  3157.      /usr/unsupported/include  \
  3158.      /opt/include              \
  3159.      $extra_include            \
  3160.      ; \
  3161.    do
  3162.      if test -r "$ac_dir/$test_include"; then
  3163.        kde_cv_libgpp_includes=$ac_dir
  3164.        break
  3165.      fi
  3166.    done
  3167. ])
  3168.  
  3169. AC_MSG_RESULT($kde_cv_libgpp_includes)
  3170. if test "$kde_cv_libgpp_includes" != "no"; then
  3171.   all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
  3172. fi
  3173. ])
  3174. ])
  3175.  
  3176.  
  3177. AC_DEFUN(KDE_CHECK_MICO,
  3178. [
  3179. AC_REQUIRE([KDE_CHECK_LIBDL])
  3180. AC_REQUIRE([KDE_MISC_TESTS])
  3181. AC_MSG_CHECKING(for MICO)
  3182.  
  3183. if test -z "$MICODIR"; then
  3184.     kde_micodir=/usr/local
  3185.  else
  3186.     kde_micodir="$MICODIR"
  3187. fi
  3188.  
  3189. AC_ARG_WITH(micodir,
  3190.   [  --with-micodir=micodir  where mico is installed ],
  3191.   kde_micodir=$withval,
  3192.   kde_micodir=$kde_micodir
  3193. )
  3194.  
  3195. AC_CACHE_VAL(kde_cv_mico_incdir,
  3196. [
  3197.   mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes"
  3198. AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
  3199.  
  3200. ])
  3201. kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
  3202.  
  3203. if test ! -r  $kde_micodir/include/CORBA.h; then
  3204.   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
  3205. fi
  3206.  
  3207. AC_MSG_RESULT($kde_micodir)
  3208.  
  3209. MICO_INCLUDES=-I$kde_micodir/include
  3210. AC_SUBST(MICO_INCLUDES)
  3211. MICO_LDFLAGS=-L$kde_micodir/lib
  3212. AC_SUBST(MICO_LDFLAGS)
  3213. micodir=$kde_micodir
  3214. AC_SUBST(micodir)
  3215.  
  3216. AC_MSG_CHECKING([for MICO version])
  3217. AC_CACHE_VAL(kde_cv_mico_version,
  3218. [
  3219. AC_LANG_C
  3220. cat >conftest.$ac_ext <<EOF
  3221. #include <stdio.h>
  3222. #include <mico/version.h>
  3223. int main() {
  3224.  
  3225.    printf("MICO_VERSION=%s\n",MICO_VERSION);
  3226.    return (0);
  3227. }
  3228. EOF
  3229. ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
  3230. if AC_TRY_EVAL(ac_compile); then
  3231.   if eval `./conftest 2>&5`; then
  3232.     kde_cv_mico_version=$MICO_VERSION
  3233.   else
  3234.     AC_MSG_ERROR([your system is not able to execute a small application to
  3235.     find MICO version! Check $kde_micodir/include/mico/version.h])
  3236.   fi
  3237. else
  3238.   AC_MSG_ERROR([your system is not able to compile a small application to
  3239.   find MICO version! Check $kde_micodir/include/mico/version.h])
  3240. fi
  3241. ])
  3242.  
  3243. dnl installed MICO version
  3244. mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
  3245. mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
  3246. mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
  3247.  
  3248. if test "x$1" = "x"; then
  3249.  req_version="2.3.0"
  3250. else
  3251.  req_version=$1
  3252. fi
  3253.  
  3254. dnl required MICO version
  3255. req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
  3256. req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
  3257. req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
  3258.  
  3259. if test "$mico_v_maj" -lt "$req_v_maj" || \
  3260.    ( test "$mico_v_maj" -eq "$req_v_maj" && \
  3261.         test "$mico_v_mid" -lt "$req_v_mid" ) || \
  3262.    ( test "$mico_v_mid" -eq "$req_v_mid" && \
  3263.         test "$mico_v_min" -lt "$req_v_min" )
  3264.  
  3265. then
  3266.   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \
  3267. at least is required. You should upgrade MICO.])
  3268. else
  3269.   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)])
  3270. fi
  3271.  
  3272. LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL"
  3273. AC_SUBST(LIBMICO)
  3274. if test -z "$IDL"; then
  3275.   IDL='$(kde_bindir)/cuteidl'
  3276. fi
  3277. AC_SUBST(IDL)
  3278. IDL_DEPENDENCIES='$(kde_includes)/CUTE.h'
  3279. AC_SUBST(IDL_DEPENDENCIES)
  3280.  
  3281. idldir="\$(includedir)/idl"
  3282. AC_SUBST(idldir)
  3283.  
  3284. ])
  3285.  
  3286. AC_DEFUN(KDE_CHECK_MINI_STL,
  3287. [
  3288. AC_REQUIRE([KDE_CHECK_MICO])
  3289.  
  3290. AC_MSG_CHECKING(if we use mico's mini-STL)
  3291. AC_CACHE_VAL(kde_cv_have_mini_stl,
  3292. [
  3293. AC_LANG_SAVE
  3294. AC_LANG_CPLUSPLUS
  3295. kde_save_cxxflags="$CXXFLAGS"
  3296. CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
  3297. AC_TRY_COMPILE(
  3298. [
  3299. #include <mico/config.h>
  3300. ],
  3301. [
  3302. #ifdef HAVE_MINI_STL
  3303. #error "nothing"
  3304. #endif
  3305. ],
  3306. kde_cv_have_mini_stl=no,
  3307. kde_cv_have_mini_stl=yes)
  3308. CXXFLAGS="$kde_save_cxxflags"
  3309. AC_LANG_RESTORE
  3310. ])
  3311.  
  3312. if test "x$kde_cv_have_mini_stl" = "xyes"; then
  3313.    AC_MSG_RESULT(yes)
  3314.    $1
  3315. else
  3316.    AC_MSG_RESULT(no)
  3317.    $2
  3318. fi
  3319. ])
  3320.  
  3321. ])
  3322.  
  3323.  
  3324. AC_DEFUN(KDE_CHECK_LIBPTHREAD,
  3325. [
  3326. AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
  3327. AC_SUBST(LIBPTHREAD)
  3328. ])
  3329.  
  3330. AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
  3331. [
  3332.     AC_ARG_ENABLE(kernel-threads, [  --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.],
  3333.     kde_use_kernthreads=$enableval, kde_use_kernthreads=no)
  3334.  
  3335.     if test "$kde_use_kernthreads" = "yes"; then
  3336.       ac_save_CXXFLAGS="$CXXFLAGS"
  3337.       ac_save_CFLAGS="$CXXFLAGS"
  3338.       CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS"
  3339.       CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS"
  3340.       AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h)
  3341.       CXXFLAGS="$ac_save_CXXFLAGS"
  3342.       CFLAGS="$ac_save_CFLAGS"
  3343.       if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then
  3344.         kde_use_kernthreads=no
  3345.       else
  3346.         dnl Add proper -I and -l statements
  3347.         AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD
  3348.         if test "x$LIBPTHREAD" = "x"; then
  3349.           kde_use_kernthreads=no
  3350.         else
  3351.           USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads"
  3352.         fi
  3353.       fi
  3354.     else 
  3355.       USE_THREADS=""
  3356.       if test -z "$LIBPTHREAD"; then
  3357.         KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
  3358.       fi
  3359.     fi
  3360.  
  3361.     case $host_os in
  3362.      solaris*)
  3363.         KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
  3364.                 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS"
  3365.                 echo "Setting Solaris pthread compilation options"
  3366.             ;;
  3367.         freebsd*)
  3368.                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
  3369.                 echo "Setting FreeBSD pthread compilation options"
  3370.                 ;;
  3371.         aix*)
  3372.                 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
  3373.                 LIBPTHREAD="$LIBPTHREAD -lc_r"
  3374.                 echo "Setting AIX pthread compilation options"
  3375.                 ;;
  3376.         linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  3377.                 USE_THREADS="$USE_THREADS -DPIC -fPIC"
  3378.                 echo "Setting Linux pthread compilation options"
  3379.                 ;;
  3380.     *)
  3381.         ;;
  3382.     esac
  3383.     AC_SUBST(USE_THREADS)
  3384.     AC_SUBST(LIBPTHREAD)
  3385. ])
  3386.  
  3387. AC_DEFUN(KDE_CHECK_THREADING,
  3388. [
  3389.   AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  3390.   AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
  3391.   dnl default is yes if libpthread is found and no if no libpthread is available
  3392.   if test -z "$LIBPTHREAD"; then
  3393.     kde_check_threading_default=no
  3394.   else
  3395.     kde_check_threading_default=yes
  3396.   fi
  3397.   AC_ARG_ENABLE(threading, [  --disable-threading     disables threading even if libpthread found ],
  3398.    kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
  3399.  
  3400.   if test "x$kde_use_threading" = "xyes"; then
  3401.     AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
  3402.   fi
  3403. ])
  3404.  
  3405. AC_DEFUN(KDE_TRY_LINK_PYTHON,
  3406. [
  3407. if test "$kde_python_link_found" = no; then
  3408.  
  3409. if test "$1" = normal; then
  3410.   AC_MSG_CHECKING(if a Python application links)
  3411. else
  3412.   AC_MSG_CHECKING(if Python depends on $2)
  3413. fi
  3414.  
  3415. AC_CACHE_VAL(kde_cv_try_link_python_$1,
  3416. [
  3417. AC_LANG_SAVE
  3418. AC_LANG_C
  3419. kde_save_cflags="$CFLAGS"
  3420. CFLAGS="$CFLAGS $PYTHONINC"
  3421. kde_save_libs="$LIBS"
  3422. LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
  3423. kde_save_ldflags="$LDFLAGS"
  3424. LDFLAGS="$LDFLAGS $PYTHONLIB"
  3425.  
  3426. AC_TRY_LINK(
  3427. [
  3428. #include <Python.h>
  3429. ],[
  3430.     PySys_SetArgv(1, 0);
  3431. ],
  3432.     [kde_cv_try_link_python_$1=yes],
  3433.     [kde_cv_try_link_python_$1=no]
  3434. )
  3435. CFLAGS="$kde_save_cflags"
  3436. LIBS="$kde_save_libs"
  3437. LDFLAGS="$kde_save_ldflags"
  3438. ])
  3439.  
  3440. if test "$kde_cv_try_link_python_$1" = "yes"; then
  3441.   AC_MSG_RESULT(yes)
  3442.   kde_python_link_found=yes
  3443.   if test ! "$1" = normal; then
  3444.     LIBPYTHON="$LIBPYTHON $2"
  3445.   fi
  3446.   $3
  3447. else
  3448.   AC_MSG_RESULT(no)
  3449.   $4
  3450. fi
  3451. AC_LANG_RESTORE
  3452.  
  3453. fi
  3454.  
  3455. ])
  3456.  
  3457. AC_DEFUN(KDE_CHECK_PYTHON_DIR,
  3458. [
  3459. AC_MSG_CHECKING([for Python directory])
  3460.  
  3461. AC_CACHE_VAL(kde_cv_pythondir,
  3462. [
  3463.   if test -z "$PYTHONDIR"; then
  3464.     kde_cv_pythondir=/usr/local
  3465.   else
  3466.     kde_cv_pythondir="$PYTHONDIR"
  3467.   fi
  3468. ])
  3469.  
  3470. AC_ARG_WITH(pythondir,
  3471. [  --with-pythondir=pythondir   use python installed in pythondir ],
  3472. [
  3473.   ac_python_dir=$withval
  3474. ], ac_python_dir=$kde_cv_pythondir
  3475. )
  3476.  
  3477. AC_MSG_RESULT($ac_python_dir)
  3478. ])
  3479.  
  3480. AC_DEFUN(KDE_CHECK_PYTHON_INTERN,
  3481. [
  3482. AC_REQUIRE([KDE_CHECK_LIBDL])
  3483. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  3484. AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
  3485.  
  3486. if test -z "$1"; then
  3487.   version="1.5"
  3488. else
  3489.   version="$1"
  3490. fi
  3491.  
  3492. AC_MSG_CHECKING([for Python$version])
  3493.  
  3494. python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
  3495. AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
  3496. if test ! -r $python_incdir/Python.h; then
  3497.   AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
  3498.   python_incdir=$python_incdir/python$version
  3499.   if test ! -r $python_incdir/Python.h; then
  3500.     python_incdir=no
  3501.   fi
  3502. fi
  3503.  
  3504. PYTHONINC=-I$python_incdir
  3505.  
  3506. python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
  3507. AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
  3508. if test ! -r $python_libdir/libpython$version.a; then
  3509.   AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
  3510.   python_libdir=$python_libdir/python$version/config
  3511.   if test ! -r $python_libdir/libpython$version.a; then
  3512.     python_libdir=no
  3513.   fi
  3514. fi
  3515.  
  3516. PYTHONLIB=-L$python_libdir
  3517. kde_orig_LIBPYTHON=$LIBPYTHON
  3518. if test -z "$LIBPYTHON"; then
  3519.   LIBPYTHON=-lpython$version
  3520. fi
  3521.  
  3522. python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
  3523. AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
  3524. python_moddir=$python_moddir/python$version
  3525. if test ! -r $python_moddir/copy.py; then
  3526.   python_moddir=no
  3527. fi
  3528.  
  3529. PYTHONMODDIR=$python_moddir
  3530.  
  3531. AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
  3532.  
  3533. if test x$python_incdir = xno ||  test x$python_libdir = xno ||  test x$python_moddir = xno; then
  3534.    LIBPYTHON=$kde_orig_LIBPYTHON
  3535.    test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
  3536.    test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
  3537.    $2
  3538. else 
  3539.   dnl Note: this test is very weak
  3540.   kde_python_link_found=no
  3541.   KDE_TRY_LINK_PYTHON(normal)
  3542.   KDE_TRY_LINK_PYTHON(m, -lm)
  3543.   KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
  3544.   KDE_TRY_LINK_PYTHON(tcl, -ltcl)
  3545.   KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
  3546.   KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil], [],
  3547.     [AC_MSG_WARN([it seems, Python depends on another library.
  3548.     Pleae use \"make LIBPYTHON='-lpython$version -lotherlib'\" to fix this
  3549.     and contact the authors to let them know about this problem])
  3550.     ])
  3551.  
  3552.   LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
  3553.   AC_SUBST(PYTHONINC)
  3554.   AC_SUBST(PYTHONLIB)
  3555.   AC_SUBST(LIBPYTHON)
  3556.   AC_SUBST(PYTHONMODDIR)
  3557.   AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
  3558. fi
  3559.  
  3560. ])
  3561.  
  3562.  
  3563. AC_DEFUN(KDE_CHECK_PYTHON,
  3564. [
  3565.    KDE_CHECK_PYTHON_INTERN("2.0",
  3566.     [ KDE_CHECK_PYTHON_INTERN($1, $2) ])
  3567. ])
  3568.  
  3569. AC_DEFUN(KDE_CHECK_STL_SGI,
  3570. [
  3571.     AC_MSG_CHECKING([if STL implementation is SGI like])
  3572.     AC_CACHE_VAL(kde_cv_stl_type_sgi,
  3573.     [
  3574.       AC_TRY_COMPILE([
  3575. #include <string>
  3576. using namespace std;
  3577. ],[
  3578.   string astring="Hallo Welt.";
  3579.   astring.erase(0, 6); // now astring is "Welt"
  3580.   return 0;
  3581. ], kde_cv_stl_type_sgi=yes,
  3582.    kde_cv_stl_type_sgi=no)
  3583. ])
  3584.  
  3585.    AC_MSG_RESULT($kde_cv_stl_type_sgi)
  3586.  
  3587.    if test "$kde_cv_stl_type_sgi" = "yes"; then
  3588.     AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
  3589.    fi
  3590. ])
  3591.  
  3592. AC_DEFUN(KDE_CHECK_STL_HP,
  3593. [
  3594.     AC_MSG_CHECKING([if STL implementation is HP like])
  3595.     AC_CACHE_VAL(kde_cv_stl_type_hp,
  3596.     [
  3597.       AC_TRY_COMPILE([
  3598. #include <string>
  3599. using namespace std;
  3600. ],[
  3601.   string astring="Hello World";
  3602.   astring.remove(0, 6); // now astring is "World"
  3603.   return 0;
  3604. ], kde_cv_stl_type_hp=yes,
  3605.    kde_cv_stl_type_hp=no)
  3606. ])
  3607.    AC_MSG_RESULT($kde_cv_stl_type_hp)
  3608.  
  3609.    if test "$kde_cv_stl_type_hp" = "yes"; then
  3610.     AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP])
  3611.    fi
  3612. ])
  3613.  
  3614. AC_DEFUN(KDE_CHECK_STL,
  3615. [
  3616.     AC_LANG_SAVE
  3617.     AC_LANG_CPLUSPLUS
  3618.     ac_save_CXXFLAGS="$CXXFLAGS"
  3619.     CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
  3620.     KDE_CHECK_STL_SGI
  3621.  
  3622.     if test "$kde_cv_stl_type_sgi" = "no"; then
  3623.        KDE_CHECK_STL_HP
  3624.  
  3625.        if test "$kde_cv_stl_type_hp" = "no"; then
  3626.          AC_MSG_ERROR("no known STL type found")
  3627.        fi
  3628.     fi
  3629.  
  3630.     CXXFLAGS="$ac_save_CXXFLAGS"
  3631.     AC_LANG_RESTORE
  3632. ])
  3633.  
  3634. AC_DEFUN(AC_FIND_QIMGIO,
  3635.    [AC_REQUIRE([AC_FIND_JPEG])
  3636. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3637. AC_MSG_CHECKING([for qimgio])
  3638. AC_CACHE_VAL(ac_cv_lib_qimgio,
  3639. [
  3640. AC_LANG_SAVE
  3641. AC_LANG_CPLUSPLUS
  3642. ac_save_LIBS="$LIBS"
  3643. ac_save_CXXFLAGS="$CXXFLAGS"
  3644. LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
  3645. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  3646. AC_TRY_RUN(dnl
  3647. [
  3648. #include <qimageio.h>
  3649. #include <qstring.h>
  3650. int main() {
  3651.         QString t = "hallo";
  3652.         t.fill('t');
  3653.         qInitImageIO();
  3654. }
  3655. ],
  3656.             ac_cv_lib_qimgio=yes,
  3657.             ac_cv_lib_qimgio=no,
  3658.         ac_cv_lib_qimgio=no)
  3659. LIBS="$ac_save_LIBS"
  3660. CXXFLAGS="$ac_save_CXXFLAGS"
  3661. AC_LANG_RESTORE
  3662. ])dnl
  3663. if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
  3664.   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
  3665.   AC_MSG_RESULT(yes)
  3666.   AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
  3667.   AC_SUBST(LIBQIMGIO)
  3668. else
  3669.   AC_MSG_RESULT(not found)
  3670. fi
  3671. ])
  3672.  
  3673. AC_DEFUN(KDE_CHECK_ANSI,
  3674. [
  3675. ])
  3676.  
  3677. AC_DEFUN(KDE_CHECK_INSURE,
  3678. [
  3679.   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
  3680.   [
  3681.   if test $enableval = "no"; dnl
  3682.     then ac_use_insure="no"
  3683.     else ac_use_insure="yes"
  3684.    fi
  3685.   ], [ac_use_insure="no"])
  3686.  
  3687.   AC_MSG_CHECKING(if we will use Insure++ to debug)
  3688.   AC_MSG_RESULT($ac_use_insure)
  3689.   if test "$ac_use_insure" = "yes"; dnl
  3690.        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
  3691.    fi
  3692. ])
  3693.  
  3694. AC_DEFUN(AM_DISABLE_LIBRARIES,
  3695. [
  3696.     AC_PROVIDE([AM_ENABLE_STATIC])
  3697.     AC_PROVIDE([AM_ENABLE_SHARED])
  3698.     enable_static=no
  3699.     enable_shared=yes
  3700. ])
  3701.  
  3702.  
  3703. AC_DEFUN(AC_CHECK_UTMP_FILE,
  3704. [
  3705.     AC_MSG_CHECKING([for utmp file])
  3706.  
  3707.     AC_CACHE_VAL(kde_cv_utmp_file,
  3708.     [
  3709.     kde_cv_utmp_file=no
  3710.  
  3711.     for ac_file in    \
  3712.                       \
  3713.     /var/run/utmp \
  3714.     /var/adm/utmp \
  3715.     /etc/utmp     \
  3716.      ; \
  3717.     do
  3718.      if test -r "$ac_file"; then
  3719.        kde_cv_utmp_file=$ac_file
  3720.        break
  3721.      fi
  3722.     done
  3723.     ])
  3724.  
  3725.     if test "$kde_cv_utmp_file" != "no"; then
  3726.     AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
  3727.     $1
  3728.     AC_MSG_RESULT($kde_cv_utmp_file)
  3729.     else
  3730.         $2
  3731.     AC_MSG_RESULT([non found])
  3732.     fi
  3733. ])
  3734.  
  3735.  
  3736. AC_DEFUN(KDE_CREATE_SUBDIRSLIST,
  3737. [
  3738.  
  3739. DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
  3740.  
  3741. if test ! -s $srcdir/subdirs; then
  3742.   dnl Note: Makefile.common creates subdirs, so this is just a fallback
  3743.   TOPSUBDIRS=""
  3744.   files=`cd $srcdir && ls -1`
  3745.   dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
  3746.   for i in $dirs; do
  3747.     echo $i >> $srcdir/subdirs
  3748.   done
  3749. fi
  3750.  
  3751. if test -s $srcdir/inst-apps; then
  3752.   ac_topsubdirs="`cat $srcdir/inst-apps`"
  3753. else
  3754.   ac_topsubdirs="`cat $srcdir/subdirs`"
  3755. fi
  3756.  
  3757. for i in $ac_topsubdirs; do
  3758.   AC_MSG_CHECKING([if $i should be compiled])
  3759.   if test -d $srcdir/$i; then
  3760.     install_it="yes"
  3761.     for j in $DO_NOT_COMPILE; do
  3762.       if test $i = $j; then
  3763.         install_it="no"
  3764.       fi
  3765.     done
  3766.   else
  3767.     install_it="no"
  3768.   fi
  3769.   AC_MSG_RESULT($install_it)
  3770.   if test $install_it = "yes"; then
  3771.     TOPSUBDIRS="$TOPSUBDIRS $i"
  3772.   fi
  3773. done
  3774.  
  3775. AC_SUBST(TOPSUBDIRS)
  3776. ])
  3777.  
  3778. AC_DEFUN(KDE_CHECK_NAMESPACES,
  3779. [
  3780. AC_MSG_CHECKING(whether C++ compiler supports namespaces)
  3781. AC_LANG_SAVE
  3782. AC_LANG_CPLUSPLUS
  3783. AC_TRY_COMPILE([
  3784. ],
  3785. [
  3786. namespace Foo {
  3787.   extern int i;
  3788.   namespace Bar {
  3789.     extern int i;
  3790.   }
  3791. }
  3792.  
  3793. int Foo::i = 0;
  3794. int Foo::Bar::i = 1;
  3795. ],[
  3796.   AC_MSG_RESULT(yes)
  3797.   AC_DEFINE(HAVE_NAMESPACES)
  3798. ], [
  3799. AC_MSG_RESULT(no)
  3800. ])
  3801. AC_LANG_RESTORE
  3802. ])
  3803.  
  3804. AC_DEFUN(KDE_CHECK_NEWLIBS,
  3805. [
  3806.  
  3807. ])
  3808.  
  3809. dnl ------------------------------------------------------------------------
  3810. dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
  3811. dnl ------------------------------------------------------------------------
  3812. dnl
  3813. AC_DEFUN(AC_CHECK_S_ISSOCK,
  3814. [
  3815. AC_MSG_CHECKING(for S_ISSOCK)
  3816. AC_CACHE_VAL(ac_cv_have_s_issock,
  3817. [
  3818. AC_LANG_SAVE
  3819. AC_LANG_C
  3820. AC_TRY_LINK(
  3821. [
  3822. #include <sys/stat.h>
  3823. ],
  3824. [
  3825. struct stat buff;
  3826. int b = S_ISSOCK( buff.st_mode );
  3827. ],
  3828. ac_cv_have_s_issock=yes,
  3829. ac_cv_have_s_issock=no)
  3830. AC_LANG_RESTORE
  3831. ])
  3832. AC_MSG_RESULT($ac_cv_have_s_issock)
  3833. if test "$ac_cv_have_s_issock" = "yes"; then
  3834.   AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
  3835. fi
  3836. ])
  3837.  
  3838. dnl ------------------------------------------------------------------------
  3839. dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
  3840. dnl ------------------------------------------------------------------------
  3841. dnl
  3842. AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
  3843. [
  3844. AC_MSG_CHECKING(for MAXPATHLEN)
  3845. AC_CACHE_VAL(ac_cv_maxpathlen,
  3846. [
  3847. AC_LANG_C
  3848. cat > conftest.$ac_ext <<EOF
  3849. #include <stdio.h>
  3850. #include <sys/param.h>
  3851. #ifndef MAXPATHLEN
  3852. #define MAXPATHLEN 1024
  3853. #endif
  3854.  
  3855. KDE_HELLO MAXPATHLEN
  3856.  
  3857. EOF
  3858.  
  3859. ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
  3860.  
  3861. if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
  3862.     ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
  3863. else
  3864.     ac_cv_maxpathlen=1024
  3865. fi
  3866.  
  3867. rm conftest.*
  3868.  
  3869. ])
  3870. AC_MSG_RESULT($ac_cv_maxpathlen)
  3871. AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
  3872. ])
  3873.  
  3874. dnl -------------------------------------------------------------------------
  3875. dnl See if the compiler supports a template repository         bero@redhat.de
  3876. dnl -------------------------------------------------------------------------
  3877. AC_DEFUN(KDE_COMPILER_REPO,
  3878. [
  3879.   REPO=""
  3880.   NOREPO=""
  3881.  
  3882.   KDE_CHECK_COMPILER_FLAG(frepo,
  3883.    [
  3884.      REPO="-frepo"
  3885.      NOREPO="-fno-repo"
  3886.    ])
  3887.  
  3888.   if test -z "$REPO"; then
  3889.   KDE_CHECK_COMPILER_FLAG(instances=explicit,
  3890.   [
  3891.      REPO="-instances=explicit"
  3892.      NOREPO="-instances=extern"
  3893.   ])
  3894.   fi
  3895.  
  3896.   if test -n "$REPO"; then
  3897.      AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1,
  3898.         [C++ compiler supports template repository])
  3899.      $1
  3900.   fi
  3901.  
  3902.   AC_SUBST(REPO)
  3903.   AC_SUBST(NOREPO)
  3904. ])
  3905.  
  3906. AC_DEFUN(KDE_CHECK_HEADER,
  3907. [
  3908.    AC_LANG_SAVE
  3909.    kde_safe_cppflags=$CPPFLAGS
  3910.    CPPFLAGS="$CPPFLAGS $all_includes"
  3911.    AC_LANG_CPLUSPLUS
  3912.    AC_CHECK_HEADER($1, $2, $3)
  3913.    CPPFLAGS=$kde_safe_cppflags
  3914.    AC_LANG_RESTORE
  3915. ])
  3916.  
  3917. AC_DEFUN(KDE_CHECK_QWSPRITEFIELD,
  3918. [
  3919.   KDE_CHECK_HEADER(QwSpriteField.h, ,
  3920.   [
  3921.     AC_MSG_WARN([you don't have QwSpriteField.h somewhere. Please install
  3922.        QwSpriteField out of kdesupport.])
  3923.       $1
  3924.   ])
  3925. ])
  3926.  
  3927. AC_DEFUN(KDE_FAST_CONFIGURE,
  3928. [
  3929.   dnl makes configure fast (needs perl)
  3930.   AC_ARG_ENABLE(fast-perl, [  --disable-fast-perl     disable fast Makefile generation (needs perl)],
  3931.       with_fast_perl=$enableval, with_fast_perl=yes)
  3932. ])
  3933.  
  3934. AC_DEFUN(KDE_CONF_FILES,
  3935. [
  3936.   val=
  3937.   if test -f $srcdir/configure.files ; then
  3938.     val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
  3939.   fi
  3940.   CONF_FILES=
  3941.   if test -n "$val" ; then
  3942.     for i in $val ; do
  3943.       CONF_FILES="$CONF_FILES $i"
  3944.     done
  3945.   fi
  3946.   AC_SUBST(CONF_FILES)
  3947. ])dnl
  3948.  
  3949. AC_DEFUN(KDE_SET_PREFIX,
  3950. [
  3951.   unset CDPATH
  3952.   dnl make $KDEDIR the default for the installation
  3953.   AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  3954.  
  3955.   if test "x$prefix" = "xNONE"; then
  3956.     prefix=$ac_default_prefix
  3957.     ac_configure_args="$ac_configure_args --prefix $prefix"
  3958.   fi
  3959.   KDE_FAST_CONFIGURE
  3960.   KDE_CONF_FILES
  3961. ])
  3962.  
  3963. pushdef([AC_PROG_INSTALL],
  3964. [
  3965.   dnl our own version, testing for a -p flag
  3966.   popdef([AC_PROG_INSTALL])
  3967.   dnl as AC_PROG_INSTALL works as it works we first have
  3968.   dnl to save if the user didn't specify INSTALL, as the
  3969.   dnl autoconf one overwrites INSTALL and we have no chance to find
  3970.   dnl out afterwards
  3971.   test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
  3972.   test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
  3973.   test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
  3974.   AC_PROG_INSTALL
  3975.  
  3976.   if test -z "$kde_save_INSTALL_given" ; then
  3977.     # OK, user hasn't given any INSTALL, autoconf found one for us
  3978.     # now we test, if it supports the -p flag
  3979.     AC_MSG_CHECKING(for -p flag to install)
  3980.     rm -f confinst.$$.* > /dev/null 2>&1
  3981.     echo "Testtest" > confinst.$$.orig
  3982.     ac_res=no
  3983.     if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
  3984.       if test -f confinst.$$.new ; then
  3985.         # OK, -p seems to do no harm to install
  3986.     INSTALL="${INSTALL} -p"
  3987.     ac_res=yes
  3988.       fi
  3989.     fi
  3990.     rm -f confinst.$$.*
  3991.     AC_MSG_RESULT($ac_res)
  3992.   fi
  3993.   dnl the following tries to resolve some signs and wonders coming up
  3994.   dnl with different autoconf/automake versions
  3995.   dnl e.g.:
  3996.   dnl  *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
  3997.   dnl   and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
  3998.   dnl   it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
  3999.   dnl  *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
  4000.   dnl   INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
  4001.   dnl   install-@DIR@PROGRAMS targets to explicitly use that flag
  4002.   dnl  *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
  4003.   dnl   INSTALL_SCRIPT, which breaks with automake <= 1.4
  4004.   dnl  *autoconf >2.13 (since 10.Apr 1999) has not that failure
  4005.   dnl  *sometimes KDE does not use the install-@DIR@PROGRAM targets from
  4006.   dnl   automake (due to broken Makefile.am or whatever) to install programs,
  4007.   dnl   and so does not see the -s flag in automake > 1.4
  4008.   dnl to clean up that mess we:
  4009.   dnl  +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
  4010.   dnl   which cleans KDE's program with automake > 1.4;
  4011.   dnl  +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
  4012.   dnl   with automake<=1.4
  4013.   dnl  note that dues to this sometimes two '-s' flags are used (if KDE
  4014.   dnl   properly uses install-@DIR@PROGRAMS, but I don't care
  4015.   dnl
  4016.   dnl And to all this comes, that I even can't write in comments variable
  4017.   dnl  names used by automake, because it is so stupid to think I wanted to
  4018.   dnl  _use_ them, therefor I have written A_M_... instead of AM_
  4019.   dnl hmm, I wanted to say something ... ahh yes: Arghhh.
  4020.  
  4021.   if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
  4022.     INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
  4023.   fi
  4024.   if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
  4025.     INSTALL_SCRIPT='${INSTALL}'
  4026.   fi
  4027. ])dnl
  4028.  
  4029. AC_DEFUN(KDE_LANG_CPLUSPLUS,
  4030. [AC_LANG_CPLUSPLUS
  4031. ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
  4032. pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
  4033. ])
  4034.  
  4035. pushdef([AC_LANG_CPLUSPLUS],
  4036. [popdef([AC_LANG_CPLUSPLUS])
  4037. KDE_LANG_CPLUSPLUS
  4038. ])
  4039.  
  4040. AC_DEFUN(KDE_CHECK_LONG_LONG,
  4041. [
  4042. AC_MSG_CHECKING(for long long)
  4043. AC_CACHE_VAL(kde_cv_c_long_long,
  4044. [
  4045.   AC_LANG_SAVE
  4046.   AC_LANG_CPLUSPLUS
  4047.   AC_TRY_LINK([], [
  4048.   long long foo = 0;
  4049.   foo = foo+1;
  4050.   ],
  4051.   kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
  4052. ])
  4053. AC_MSG_RESULT($kde_cv_c_long_long)
  4054. if test "$kde_cv_c_long_long" = yes; then
  4055.    AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
  4056. fi
  4057. ])
  4058.  
  4059. AC_DEFUN(KDE_CHECK_LIB,
  4060. [
  4061.      kde_save_LIBS="$LIBS"
  4062.      LIBS="$LIBS $all_libraries"
  4063.      AC_CHECK_LIB($1, $2, $3, $4)
  4064.      LIBS="$kde_save_LIBS"
  4065. ])
  4066.  
  4067.  
  4068.  
  4069. # serial 46 AC_PROG_LIBTOOL
  4070. AC_DEFUN([AC_PROG_LIBTOOL],
  4071. [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
  4072. dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
  4073. dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
  4074.   AC_PROVIDE_IFELSE([AC_PROG_CXX],
  4075.     [AC_LIBTOOL_CXX],
  4076.     [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
  4077. ])])
  4078.  
  4079. dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
  4080. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
  4081. dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
  4082.   AC_PROVIDE_IFELSE([AC_PROG_GCJ],
  4083.     [AC_LIBTOOL_GCJ],
  4084.     [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
  4085.         [AC_LIBTOOL_GCJ],
  4086.     [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
  4087.       [AC_LIBTOOL_GCJ],
  4088.     [ifdef([AC_PROG_GCJ],
  4089.            [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
  4090. ])])
  4091.      ifdef([A][M_PROG_GCJ],
  4092.            [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
  4093. ])])
  4094.      ifdef([LT_AC_PROG_GCJ],
  4095.            [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
  4096. ])])])])])])
  4097.  
  4098. AC_DEFUN([_AC_PROG_LIBTOOL],
  4099. [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
  4100. AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
  4101. AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
  4102.  
  4103. # Save cache, so that ltconfig can load it
  4104. AC_CACHE_SAVE
  4105.  
  4106. # Actually configure libtool.  ac_aux_dir is where install-sh is found.
  4107. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
  4108. MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
  4109. LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
  4110. AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
  4111. objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
  4112. deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
  4113. ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
  4114. $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
  4115. || AC_MSG_ERROR([libtool configure failed])
  4116.  
  4117. # Reload cache, that may have been modified by ltconfig
  4118. AC_CACHE_LOAD
  4119.  
  4120. # This can be used to rebuild libtool when needed
  4121. LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
  4122.  
  4123. # Always use our own libtool.
  4124. LIBTOOL='$(SHELL) $(top_builddir)/libtool'
  4125. AC_SUBST(LIBTOOL)dnl
  4126.  
  4127. # Redirect the config.log output again, so that the ltconfig log is not
  4128. # clobbered by the next message.
  4129. exec 5>>./config.log
  4130. ])
  4131.  
  4132. AC_DEFUN([AC_LIBTOOL_SETUP],
  4133. [AC_PREREQ(2.13)dnl
  4134. AC_REQUIRE([AC_ENABLE_SHARED])dnl
  4135. AC_REQUIRE([AC_ENABLE_STATIC])dnl
  4136. AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
  4137. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  4138. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  4139. AC_REQUIRE([AC_PROG_CC])dnl
  4140. AC_REQUIRE([AC_PROG_LD])dnl
  4141. AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
  4142. AC_REQUIRE([AC_PROG_NM])dnl
  4143. AC_REQUIRE([AC_PROG_LN_S])dnl
  4144. AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
  4145. # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
  4146. AC_REQUIRE([AC_OBJEXT])dnl
  4147. AC_REQUIRE([AC_EXEEXT])dnl
  4148. dnl
  4149.  
  4150. # Only perform the check for file, if the check method requires it
  4151. case "$deplibs_check_method" in
  4152. file_magic*)
  4153.   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
  4154.     AC_PATH_MAGIC
  4155.   fi
  4156.   ;;
  4157. esac
  4158.  
  4159. AC_CHECK_TOOL(RANLIB, ranlib, :)
  4160. AC_CHECK_TOOL(STRIP, strip, :)
  4161.  
  4162. # Check for any special flags to pass to ltconfig.
  4163. libtool_flags="--cache-file=$cache_file"
  4164. test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
  4165. test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
  4166. test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
  4167. test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
  4168. test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
  4169. ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
  4170. [libtool_flags="$libtool_flags --enable-dlopen"])
  4171. ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
  4172. [libtool_flags="$libtool_flags --enable-win32-dll"])
  4173. AC_ARG_ENABLE(libtool-lock,
  4174.   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
  4175. test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
  4176. test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
  4177.  
  4178. AC_ARG_WITH(pic,
  4179.   [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
  4180.      pic_mode="$withval", pic_mode=default)
  4181. test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
  4182. test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
  4183.  
  4184. # Some flags need to be propagated to the compiler or linker for good
  4185. # libtool support.
  4186. case "$host" in
  4187. *-*-irix6*)
  4188.   # Find out which ABI we are using.
  4189.   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
  4190.   if AC_TRY_EVAL(ac_compile); then
  4191.     case "`/usr/bin/file conftest.$ac_objext`" in
  4192.     *32-bit*)
  4193.       LD="${LD-ld} -32"
  4194.       ;;
  4195.     *N32*)
  4196.       LD="${LD-ld} -n32"
  4197.       ;;
  4198.     *64-bit*)
  4199.       LD="${LD-ld} -64"
  4200.       ;;
  4201.     esac
  4202.   fi
  4203.   rm -rf conftest*
  4204.   ;;
  4205.  
  4206. *-*-sco3.2v5*)
  4207.   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  4208.   SAVE_CFLAGS="$CFLAGS"
  4209.   CFLAGS="$CFLAGS -belf"
  4210.   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
  4211.     [AC_LANG_SAVE
  4212.      AC_LANG_C
  4213.      AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
  4214.      AC_LANG_RESTORE])
  4215.   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
  4216.     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
  4217.     CFLAGS="$SAVE_CFLAGS"
  4218.   fi
  4219.   ;;
  4220.  
  4221. ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
  4222. [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
  4223.   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
  4224.   AC_CHECK_TOOL(AS, as, false)
  4225.   AC_CHECK_TOOL(OBJDUMP, objdump, false)
  4226.  
  4227.   # recent cygwin and mingw systems supply a stub DllMain which the user
  4228.   # can override, but on older systems we have to supply one
  4229.   AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
  4230.     [AC_TRY_LINK([],
  4231.       [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
  4232.       DllMain (0, 0, 0);],
  4233.       [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
  4234.  
  4235.   case "$host/$CC" in
  4236.   *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
  4237.     # old mingw systems require "-dll" to link a DLL, while more recent ones
  4238.     # require "-mdll"
  4239.     SAVE_CFLAGS="$CFLAGS"
  4240.     CFLAGS="$CFLAGS -mdll"
  4241.     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
  4242.       [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
  4243.     CFLAGS="$SAVE_CFLAGS" ;;
  4244.   *-*-cygwin* | *-*-pw32*)
  4245.     # cygwin systems need to pass --dll to the linker, and not link
  4246.     # crt.o which will require a WinMain@16 definition.
  4247.     lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
  4248.   esac
  4249.   ;;
  4250.   ])
  4251. esac
  4252. ])
  4253.  
  4254. # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
  4255. AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
  4256.  
  4257. # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
  4258. AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
  4259.  
  4260. # AC_ENABLE_SHARED - implement the --enable-shared flag
  4261. # Usage: AC_ENABLE_SHARED[(DEFAULT)]
  4262. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  4263. #   `yes'.
  4264. AC_DEFUN([AC_ENABLE_SHARED],
  4265. [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
  4266. AC_ARG_ENABLE(shared,
  4267. changequote(<<, >>)dnl
  4268. <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
  4269. changequote([, ])dnl
  4270. [p=${PACKAGE-default}
  4271. case "$enableval" in
  4272. yes) enable_shared=yes ;;
  4273. no) enable_shared=no ;;
  4274. *)
  4275.   enable_shared=no
  4276.   # Look at the argument we got.  We use all the common list separators.
  4277.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  4278.   for pkg in $enableval; do
  4279.     if test "X$pkg" = "X$p"; then
  4280.       enable_shared=yes
  4281.     fi
  4282.   done
  4283.   IFS="$ac_save_ifs"
  4284.   ;;
  4285. esac],
  4286. enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
  4287. ])
  4288.  
  4289. # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
  4290. AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  4291. AC_ENABLE_SHARED(no)])
  4292.  
  4293. # AC_ENABLE_STATIC - implement the --enable-static flag
  4294. # Usage: AC_ENABLE_STATIC[(DEFAULT)]
  4295. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  4296. #   `yes'.
  4297. AC_DEFUN([AC_ENABLE_STATIC],
  4298. [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
  4299. AC_ARG_ENABLE(static,
  4300. changequote(<<, >>)dnl
  4301. <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
  4302. changequote([, ])dnl
  4303. [p=${PACKAGE-default}
  4304. case "$enableval" in
  4305. yes) enable_static=yes ;;
  4306. no) enable_static=no ;;
  4307. *)
  4308.   enable_static=no
  4309.   # Look at the argument we got.  We use all the common list separators.
  4310.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  4311.   for pkg in $enableval; do
  4312.     if test "X$pkg" = "X$p"; then
  4313.       enable_static=yes
  4314.     fi
  4315.   done
  4316.   IFS="$ac_save_ifs"
  4317.   ;;
  4318. esac],
  4319. enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
  4320. ])
  4321.  
  4322. # AC_DISABLE_STATIC - set the default static flag to --disable-static
  4323. AC_DEFUN([AC_DISABLE_STATIC],
  4324. [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  4325. AC_ENABLE_STATIC(no)])
  4326.  
  4327.  
  4328. # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
  4329. # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
  4330. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  4331. #   `yes'.
  4332. AC_DEFUN([AC_ENABLE_FAST_INSTALL],
  4333. [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
  4334. AC_ARG_ENABLE(fast-install,
  4335. changequote(<<, >>)dnl
  4336. <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
  4337. changequote([, ])dnl
  4338. [p=${PACKAGE-default}
  4339. case "$enableval" in
  4340. yes) enable_fast_install=yes ;;
  4341. no) enable_fast_install=no ;;
  4342. *)
  4343.   enable_fast_install=no
  4344.   # Look at the argument we got.  We use all the common list separators.
  4345.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  4346.   for pkg in $enableval; do
  4347.     if test "X$pkg" = "X$p"; then
  4348.       enable_fast_install=yes
  4349.     fi
  4350.   done
  4351.   IFS="$ac_save_ifs"
  4352.   ;;
  4353. esac],
  4354. enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
  4355. ])
  4356.  
  4357. # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
  4358. AC_DEFUN([AC_DISABLE_FAST_INSTALL],
  4359. [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  4360. AC_ENABLE_FAST_INSTALL(no)])
  4361.  
  4362. # AC_LIBTOOL_PICMODE - implement the --with-pic flag
  4363. # Usage: AC_LIBTOOL_PICMODE[(MODE)]
  4364. #   Where MODE is either `yes' or `no'.  If omitted, it defaults to
  4365. #   `both'.
  4366. AC_DEFUN([AC_LIBTOOL_PICMODE],
  4367. [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  4368. pic_mode=ifelse($#,1,$1,default)])
  4369.  
  4370.  
  4371. # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
  4372. AC_DEFUN([AC_PATH_TOOL_PREFIX],
  4373. [AC_MSG_CHECKING([for $1])
  4374. AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
  4375. [case "$MAGIC_CMD" in
  4376.   /*)
  4377.   lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
  4378.   ;;
  4379.   ?:/*)
  4380.   lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
  4381.   ;;
  4382.   *)
  4383.   ac_save_MAGIC_CMD="$MAGIC_CMD"
  4384.   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
  4385. dnl $ac_dummy forces splitting on constant user-supplied paths.
  4386. dnl POSIX.2 word splitting is done only on the output of word expansions,
  4387. dnl not every word.  This closes a longstanding sh security hole.
  4388.   ac_dummy="ifelse([$2], , $PATH, [$2])"
  4389.   for ac_dir in $ac_dummy; do
  4390.     test -z "$ac_dir" && ac_dir=.
  4391.     if test -f $ac_dir/$1; then
  4392.       lt_cv_path_MAGIC_CMD="$ac_dir/$1"
  4393.       if test -n "$file_magic_test_file"; then
  4394.     case "$deplibs_check_method" in
  4395.     "file_magic "*)
  4396.       file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
  4397.       MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
  4398.       if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
  4399.         egrep "$file_magic_regex" > /dev/null; then
  4400.         :
  4401.       else
  4402.         cat <<EOF 1>&2
  4403.  
  4404. *** Warning: the command libtool uses to detect shared libraries,
  4405. *** $file_magic_cmd, produces output that libtool cannot recognize.
  4406. *** The result is that libtool may fail to recognize shared libraries
  4407. *** as such.  This will affect the creation of libtool libraries that
  4408. *** depend on shared libraries, but programs linked with such libtool
  4409. *** libraries will work regardless of this problem.  Nevertheless, you
  4410. *** may want to report the problem to your system manager and/or to
  4411. *** bug-libtool@gnu.org
  4412.  
  4413. EOF
  4414.       fi ;;
  4415.     esac
  4416.       fi
  4417.       break
  4418.     fi
  4419.   done
  4420.   IFS="$ac_save_ifs"
  4421.   MAGIC_CMD="$ac_save_MAGIC_CMD"
  4422.   ;;
  4423. esac])
  4424. MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
  4425. if test -n "$MAGIC_CMD"; then
  4426.   AC_MSG_RESULT($MAGIC_CMD)
  4427. else
  4428.   AC_MSG_RESULT(no)
  4429. fi
  4430. ])
  4431.  
  4432.  
  4433. # AC_PATH_MAGIC - find a file program which can recognise a shared library
  4434. AC_DEFUN([AC_PATH_MAGIC],
  4435. [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
  4436. AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
  4437. if test -z "$lt_cv_path_MAGIC_CMD"; then
  4438.   if test -n "$ac_tool_prefix"; then
  4439.     AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
  4440.   else
  4441.     MAGIC_CMD=:
  4442.   fi
  4443. fi
  4444. ])
  4445.  
  4446.  
  4447. # AC_PROG_LD - find the path to the GNU or non-GNU linker
  4448. AC_DEFUN([AC_PROG_LD],
  4449. [AC_ARG_WITH(gnu-ld,
  4450. [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
  4451. test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
  4452. AC_REQUIRE([AC_PROG_CC])dnl
  4453. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  4454. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  4455. ac_prog=ld
  4456. if test "$GCC" = yes; then
  4457.   # Check if gcc -print-prog-name=ld gives a path.
  4458.   AC_MSG_CHECKING([for ld used by GCC])
  4459.   case $host in
  4460.   *-*-mingw*)
  4461.     # gcc leaves a trailing carriage return which upsets mingw
  4462.     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
  4463.   *)
  4464.     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
  4465.   esac
  4466.   case "$ac_prog" in
  4467.     # Accept absolute paths.
  4468. changequote(,)dnl
  4469.     [\\/]* | [A-Za-z]:[\\/]*)
  4470.       re_direlt='/[^/][^/]*/\.\./'
  4471. changequote([,])dnl
  4472.       # Canonicalize the path of ld
  4473.       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
  4474.       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
  4475.     ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
  4476.       done
  4477.       test -z "$LD" && LD="$ac_prog"
  4478.       ;;
  4479.   "")
  4480.     # If it fails, then pretend we aren't using GCC.
  4481.     ac_prog=ld
  4482.     ;;
  4483.   *)
  4484.     # If it is relative, then search for the first ld in PATH.
  4485.     with_gnu_ld=unknown
  4486.     ;;
  4487.   esac
  4488. elif test "$with_gnu_ld" = yes; then
  4489.   AC_MSG_CHECKING([for GNU ld])
  4490. else
  4491.   AC_MSG_CHECKING([for non-GNU ld])
  4492. fi
  4493. AC_CACHE_VAL(lt_cv_path_LD,
  4494. [if test -z "$LD"; then
  4495.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  4496.   for ac_dir in $PATH; do
  4497.     test -z "$ac_dir" && ac_dir=.
  4498.     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
  4499.       lt_cv_path_LD="$ac_dir/$ac_prog"
  4500.       # Check to see if the program is GNU ld.  I'd rather use --version,
  4501.       # but apparently some GNU ld's only accept -v.
  4502.       # Break only if it was the GNU/non-GNU ld that we prefer.
  4503.       if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
  4504.     test "$with_gnu_ld" != no && break
  4505.       else
  4506.     test "$with_gnu_ld" != yes && break
  4507.       fi
  4508.     fi
  4509.   done
  4510.   IFS="$ac_save_ifs"
  4511. else
  4512.   lt_cv_path_LD="$LD" # Let the user override the test with a path.
  4513. fi])
  4514. LD="$lt_cv_path_LD"
  4515. if test -n "$LD"; then
  4516.   AC_MSG_RESULT($LD)
  4517. else
  4518.   AC_MSG_RESULT(no)
  4519. fi
  4520. test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
  4521. AC_PROG_LD_GNU
  4522. ])
  4523.  
  4524. AC_DEFUN([AC_PROG_LD_GNU],
  4525. [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
  4526. [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
  4527. if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
  4528.   lt_cv_prog_gnu_ld=yes
  4529. else
  4530.   lt_cv_prog_gnu_ld=no
  4531. fi])
  4532. with_gnu_ld=$lt_cv_prog_gnu_ld
  4533. ])
  4534.  
  4535. # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
  4536. #   -- PORTME Some linkers may need a different reload flag.
  4537. AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
  4538. [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
  4539. [lt_cv_ld_reload_flag='-r'])
  4540. reload_flag=$lt_cv_ld_reload_flag
  4541. test -n "$reload_flag" && reload_flag=" $reload_flag"
  4542. ])
  4543.  
  4544. # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
  4545. #  -- PORTME fill in with the dynamic library characteristics
  4546. AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
  4547. [AC_CACHE_CHECK([how to recognise dependant libraries],
  4548. lt_cv_deplibs_check_method,
  4549. [lt_cv_file_magic_cmd='$MAGIC_CMD'
  4550. lt_cv_file_magic_test_file=
  4551. lt_cv_deplibs_check_method='unknown'
  4552. # Need to set the preceding variable on all platforms that support
  4553. # interlibrary dependencies.
  4554. # 'none' -- dependencies not supported.
  4555. # `unknown' -- same as none, but documents that we really don't know.
  4556. # 'pass_all' -- all dependencies passed with no checks.
  4557. # 'test_compile' -- check by making test program.
  4558. # 'file_magic [regex]' -- check by looking for files in library path
  4559. # which responds to the $file_magic_cmd with a given egrep regex.
  4560. # If you have `file' or equivalent on your system and you're not sure
  4561. # whether `pass_all' will *always* work, you probably want this one.
  4562.  
  4563. case "$host_os" in
  4564. aix4*)
  4565.   lt_cv_deplibs_check_method=pass_all
  4566.   ;;
  4567.  
  4568. beos*)
  4569.   lt_cv_deplibs_check_method=pass_all
  4570.   ;;
  4571.  
  4572. bsdi4*)
  4573.   changequote(,)dnl
  4574.   lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
  4575.   changequote([, ])dnl
  4576.   lt_cv_file_magic_cmd='/usr/bin/file -L'
  4577.   lt_cv_file_magic_test_file=/shlib/libc.so
  4578.   ;;
  4579.  
  4580. cygwin* | mingw* |pw32*)
  4581.   lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
  4582.   lt_cv_file_magic_cmd='$OBJDUMP -f'
  4583.   ;;
  4584.  
  4585. darwin* | rhapsody*)
  4586.   lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
  4587.   lt_cv_file_magic_cmd=/usr/bin/file
  4588.   lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
  4589.   ;;
  4590.  
  4591. freebsd* )
  4592.   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  4593.     case "$host_cpu" in
  4594.     i*86 )
  4595.       # Not sure whether the presence of OpenBSD here was a mistake.
  4596.       # Let's accept both of them until this is cleared up.
  4597.       changequote(,)dnl
  4598.       lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
  4599.       changequote([, ])dnl
  4600.       lt_cv_file_magic_cmd=/usr/bin/file
  4601.       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
  4602.       ;;
  4603.     esac
  4604.   else
  4605.     lt_cv_deplibs_check_method=pass_all
  4606.   fi
  4607.   ;;
  4608.  
  4609. gnu*)
  4610.   lt_cv_deplibs_check_method=pass_all
  4611.   ;;
  4612.  
  4613. hpux10.20*|hpux11*)
  4614.   # TODO:  Does this work for hpux-11 too?
  4615.   changequote(,)dnl
  4616.   lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
  4617.   changequote([, ])dnl
  4618.   lt_cv_file_magic_cmd=/usr/bin/file
  4619.   lt_cv_file_magic_test_file=/usr/lib/libc.sl
  4620.   ;;
  4621.  
  4622. irix5* | irix6*)
  4623.   case "$host_os" in
  4624.   irix5*)
  4625.     # this will be overridden with pass_all, but let us keep it just in case
  4626.     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
  4627.     ;;
  4628.   *)
  4629.     case "$LD" in
  4630.     *-32|*"-32 ") libmagic=32-bit;;
  4631.     *-n32|*"-n32 ") libmagic=N32;;
  4632.     *-64|*"-64 ") libmagic=64-bit;;
  4633.     *) libmagic=never-match;;
  4634.     esac
  4635.     # this will be overridden with pass_all, but let us keep it just in case
  4636.     changequote(,)dnl
  4637.     lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
  4638.     changequote([, ])dnl
  4639.     ;;
  4640.   esac
  4641.   lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
  4642.   lt_cv_deplibs_check_method=pass_all
  4643.   ;;
  4644.  
  4645. # This must be Linux ELF.
  4646. linux-gnu*)
  4647.   case "$host_cpu" in
  4648.   alpha* | i*86 | powerpc* | sparc* | ia64* | s390* )
  4649.     lt_cv_deplibs_check_method=pass_all ;;
  4650.   *)
  4651.     # glibc up to 2.1.1 does not perform some relocations on ARM
  4652.     changequote(,)dnl
  4653.     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
  4654.     changequote([, ])dnl
  4655.   esac
  4656.   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
  4657.   ;;
  4658.  
  4659. netbsd*)
  4660.   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  4661.     [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library']
  4662.   else
  4663.     [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object']
  4664.   fi
  4665.   lt_cv_file_magic_cmd='/usr/bin/file -L'
  4666.   lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
  4667.   ;;
  4668.  
  4669. openbsd* )
  4670.   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  4671.     case "$host_cpu" in
  4672.     i*86 )
  4673.       changequote(,)dnl
  4674.       lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library'
  4675.       changequote([, ])dnl
  4676.       lt_cv_file_magic_cmd=/usr/bin/file
  4677.       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
  4678.       ;;
  4679.     esac
  4680.   else
  4681.     lt_cv_deplibs_check_method=pass_all
  4682.   fi
  4683.   ;;
  4684.  
  4685. newsos6)
  4686.   [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
  4687.   lt_cv_file_magic_cmd=/usr/bin/file
  4688.   lt_cv_file_magic_test_file=/usr/lib/libnls.so
  4689.   ;;
  4690.  
  4691. osf3* | osf4* | osf5*)
  4692.   # this will be overridden with pass_all, but let us keep it just in case
  4693.   lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
  4694.   lt_cv_file_magic_test_file=/shlib/libc.so
  4695.   lt_cv_deplibs_check_method=pass_all
  4696.   ;;
  4697.  
  4698. sco3.2v5*)
  4699.   lt_cv_deplibs_check_method=pass_all
  4700.   ;;
  4701.  
  4702. solaris*)
  4703.   lt_cv_deplibs_check_method=pass_all
  4704.   lt_cv_file_magic_test_file=/lib/libc.so
  4705.   ;;
  4706.  
  4707. sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
  4708.   case "$host_vendor" in
  4709.   ncr)
  4710.     lt_cv_deplibs_check_method=pass_all
  4711.     ;;
  4712.   motorola)
  4713.     changequote(,)dnl
  4714.     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
  4715.     changequote([, ])dnl
  4716.     lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
  4717.     ;;
  4718.   esac
  4719.   ;;
  4720. esac
  4721. ])
  4722. file_magic_cmd=$lt_cv_file_magic_cmd
  4723. deplibs_check_method=$lt_cv_deplibs_check_method
  4724. ])
  4725.  
  4726.  
  4727. # AC_PROG_NM - find the path to a BSD-compatible name lister
  4728. AC_DEFUN([AC_PROG_NM],
  4729. [AC_MSG_CHECKING([for BSD-compatible nm])
  4730. AC_CACHE_VAL(lt_cv_path_NM,
  4731. [if test -n "$NM"; then
  4732.   # Let the user override the test.
  4733.   lt_cv_path_NM="$NM"
  4734. else
  4735.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  4736.   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
  4737.     test -z "$ac_dir" && ac_dir=.
  4738.     tmp_nm=$ac_dir/${ac_tool_prefix}nm
  4739.     if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
  4740.       # Check to see if the nm accepts a BSD-compat flag.
  4741.       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
  4742.       #   nm: unknown option "B" ignored
  4743.       # Tru64's nm complains that /dev/null is an invalid object file
  4744.       if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
  4745.     lt_cv_path_NM="$tmp_nm -B"
  4746.     break
  4747.       elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
  4748.     lt_cv_path_NM="$tmp_nm -p"
  4749.     break
  4750.       else
  4751.     lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
  4752.     continue # so that we can try to find one that supports BSD flags
  4753.       fi
  4754.     fi
  4755.   done
  4756.   IFS="$ac_save_ifs"
  4757.   test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
  4758. fi])
  4759. NM="$lt_cv_path_NM"
  4760. AC_MSG_RESULT([$NM])
  4761. ])
  4762.  
  4763. # AC_CHECK_LIBM - check for math library
  4764. AC_DEFUN([AC_CHECK_LIBM],
  4765. [AC_REQUIRE([AC_CANONICAL_HOST])dnl
  4766. LIBM=
  4767. case "$host" in
  4768. *-*-beos* | *-*-cygwin* | *-*-pw32*)
  4769.   # These system don't have libm
  4770.   ;;
  4771. *-ncr-sysv4.3*)
  4772.   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
  4773.   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
  4774.   ;;
  4775. *)
  4776.   AC_CHECK_LIB(m, main, LIBM="-lm")
  4777.   ;;
  4778. esac
  4779. ])
  4780.  
  4781. # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
  4782. # the libltdl convenience library and INCLTDL to the include flags for
  4783. # the libltdl header and adds --enable-ltdl-convenience to the
  4784. # configure arguments.  Note that LIBLTDL and INCLTDL are not
  4785. # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
  4786. # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
  4787. # with '${top_builddir}/' and INCLTDL will be prefixed with
  4788. # '${top_srcdir}/' (note the single quotes!).  If your package is not
  4789. # flat and you're not using automake, define top_builddir and
  4790. # top_srcdir appropriately in the Makefiles.
  4791. AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
  4792. [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  4793.   case "$enable_ltdl_convenience" in
  4794.   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
  4795.   "") enable_ltdl_convenience=yes
  4796.       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
  4797.   esac
  4798.   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
  4799.   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
  4800. ])
  4801.  
  4802. # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
  4803. # the libltdl installable library and INCLTDL to the include flags for
  4804. # the libltdl header and adds --enable-ltdl-install to the configure
  4805. # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
  4806. # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
  4807. # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
  4808. # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
  4809. # with '${top_srcdir}/' (note the single quotes!).  If your package is
  4810. # not flat and you're not using automake, define top_builddir and
  4811. # top_srcdir appropriately in the Makefiles.
  4812. # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
  4813. AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
  4814. [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
  4815.   AC_CHECK_LIB(ltdl, main,
  4816.   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
  4817.   [if test x"$enable_ltdl_install" = xno; then
  4818.      AC_MSG_WARN([libltdl not installed, but installation disabled])
  4819.    else
  4820.      enable_ltdl_install=yes
  4821.    fi
  4822.   ])
  4823.   if test x"$enable_ltdl_install" = x"yes"; then
  4824.     ac_configure_args="$ac_configure_args --enable-ltdl-install"
  4825.     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
  4826.     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
  4827.   else
  4828.     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
  4829.     LIBLTDL="-lltdl"
  4830.     INCLTDL=
  4831.   fi
  4832. ])
  4833.  
  4834. # If this macro is not defined by Autoconf, define it here.
  4835. ifdef([AC_PROVIDE_IFELSE],
  4836.       [],
  4837.       [define([AC_PROVIDE_IFELSE],
  4838.               [ifdef([AC_PROVIDE_$1],
  4839.                      [$2], [$3])])])
  4840.  
  4841. # AC_LIBTOOL_CXX - enable support for C++ libraries
  4842. AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
  4843.  
  4844. AC_DEFUN([_AC_LIBTOOL_CXX],
  4845. [AC_REQUIRE([AC_PROG_CXX])
  4846. AC_REQUIRE([AC_PROG_CXXCPP])
  4847. LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
  4848. lt_save_CC="$CC"
  4849. lt_save_CFLAGS="$CFLAGS"
  4850. dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
  4851. dnl is set to the C++ compiler.
  4852. AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
  4853. MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
  4854. LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
  4855. AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
  4856. objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
  4857. deplibs_check_method="$deplibs_check_method" \
  4858. file_magic_cmd="$file_magic_cmd" \
  4859. ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
  4860. --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
  4861. || AC_MSG_ERROR([libtool tag configuration failed])
  4862. CC="$lt_save_CC"
  4863. CFLAGS="$lt_save_CFLAGS"
  4864.  
  4865. # Redirect the config.log output again, so that the ltconfig log is not
  4866. # clobbered by the next message.
  4867. exec 5>>./config.log
  4868. ])
  4869.  
  4870. # AC_LIBTOOL_GCJ - enable support for GCJ libraries
  4871. AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
  4872.  
  4873. AC_DEFUN([_AC_LIBTOOL_GCJ],
  4874. [AC_REQUIRE([AC_PROG_LIBTOOL])
  4875. AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
  4876.   [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
  4877.     [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
  4878.       [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
  4879.          [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
  4880.            [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
  4881. LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
  4882. lt_save_CC="$CC"
  4883. lt_save_CFLAGS="$CFLAGS"
  4884. dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
  4885. dnl is set to the C++ compiler.
  4886. AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
  4887. MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
  4888. LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
  4889. AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
  4890. objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
  4891. deplibs_check_method="$deplibs_check_method" \
  4892. file_magic_cmd="$file_magic_cmd" \
  4893. ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
  4894. --build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
  4895. || AC_MSG_ERROR([libtool tag configuration failed])
  4896. CC="$lt_save_CC"
  4897. CFLAGS="$lt_save_CFLAGS"
  4898.  
  4899. # Redirect the config.log output again, so that the ltconfig log is not
  4900. # clobbered by the next message.
  4901. exec 5>>./config.log
  4902. ])
  4903.  
  4904. dnl old names
  4905. AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
  4906. AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
  4907. AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
  4908. AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
  4909. AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
  4910. AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
  4911. AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
  4912.  
  4913. dnl This is just to silence aclocal about the macro not being used
  4914. ifelse([AC_DISABLE_FAST_INSTALL])dnl
  4915.  
  4916. AC_DEFUN([LT_AC_PROG_GCJ],
  4917. [AC_CHECK_TOOL(GCJ, gcj, no)
  4918.   test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
  4919.   AC_SUBST(GCJFLAGS)
  4920. ])
  4921.  
  4922. # Do all the work for Automake.  This macro actually does too much --
  4923. # some checks are only needed if your package does certain things.
  4924. # But this isn't really a big deal.
  4925.  
  4926. # serial 1
  4927.  
  4928. dnl Usage:
  4929. dnl AM_INIT_AUTOMAKE(package,version, [no-define])
  4930.  
  4931. AC_DEFUN(AM_INIT_AUTOMAKE,
  4932. [AC_REQUIRE([AC_PROG_INSTALL])
  4933. PACKAGE=[$1]
  4934. AC_SUBST(PACKAGE)
  4935. VERSION=[$2]
  4936. AC_SUBST(VERSION)
  4937. dnl test to see if srcdir already configured
  4938. if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  4939.   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  4940. fi
  4941. ifelse([$3],,
  4942. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  4943. AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
  4944. AC_REQUIRE([AM_SANITY_CHECK])
  4945. AC_REQUIRE([AC_ARG_PROGRAM])
  4946. dnl FIXME This is truly gross.
  4947. missing_dir=`cd $ac_aux_dir && pwd`
  4948. AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
  4949. AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
  4950. AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
  4951. AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
  4952. AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
  4953. AC_REQUIRE([AC_PROG_MAKE_SET])])
  4954.  
  4955. #
  4956. # Check to make sure that the build environment is sane.
  4957. #
  4958.  
  4959. AC_DEFUN(AM_SANITY_CHECK,
  4960. [AC_MSG_CHECKING([whether build environment is sane])
  4961. # Just in case
  4962. sleep 1
  4963. echo timestamp > conftestfile
  4964. # Do `set' in a subshell so we don't clobber the current shell's
  4965. # arguments.  Must try -L first in case configure is actually a
  4966. # symlink; some systems play weird games with the mod time of symlinks
  4967. # (eg FreeBSD returns the mod time of the symlink's containing
  4968. # directory).
  4969. if (
  4970.    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
  4971.    if test "[$]*" = "X"; then
  4972.       # -L didn't work.
  4973.       set X `ls -t $srcdir/configure conftestfile`
  4974.    fi
  4975.    if test "[$]*" != "X $srcdir/configure conftestfile" \
  4976.       && test "[$]*" != "X conftestfile $srcdir/configure"; then
  4977.  
  4978.       # If neither matched, then we have a broken ls.  This can happen
  4979.       # if, for instance, CONFIG_SHELL is bash and it inherits a
  4980.       # broken ls alias from the environment.  This has actually
  4981.       # happened.  Such a system could not be considered "sane".
  4982.       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
  4983. alias in your environment])
  4984.    fi
  4985.  
  4986.    test "[$]2" = conftestfile
  4987.    )
  4988. then
  4989.    # Ok.
  4990.    :
  4991. else
  4992.    AC_MSG_ERROR([newly created file is older than distributed files!
  4993. Check your system clock])
  4994. fi
  4995. rm -f conftest*
  4996. AC_MSG_RESULT(yes)])
  4997.  
  4998. dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
  4999. dnl The program must properly implement --version.
  5000. AC_DEFUN(AM_MISSING_PROG,
  5001. [AC_MSG_CHECKING(for working $2)
  5002. # Run test in a subshell; some versions of sh will print an error if
  5003. # an executable is not found, even if stderr is redirected.
  5004. # Redirect stdin to placate older versions of autoconf.  Sigh.
  5005. if ($2 --version) < /dev/null > /dev/null 2>&1; then
  5006.    $1=$2
  5007.    AC_MSG_RESULT(found)
  5008. else
  5009.    $1="$3/missing $2"
  5010.    AC_MSG_RESULT(missing)
  5011. fi
  5012. AC_SUBST($1)])
  5013.  
  5014. # Like AC_CONFIG_HEADER, but automatically create stamp file.
  5015.  
  5016. AC_DEFUN(AM_CONFIG_HEADER,
  5017. [AC_PREREQ([2.12])
  5018. AC_CONFIG_HEADER([$1])
  5019. dnl When config.status generates a header, we must update the stamp-h file.
  5020. dnl This file resides in the same directory as the config header
  5021. dnl that is generated.  We must strip everything past the first ":",
  5022. dnl and everything past the last "/".
  5023. AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
  5024. ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
  5025. <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
  5026. <<am_indx=1
  5027. for am_file in <<$1>>; do
  5028.   case " <<$>>CONFIG_HEADERS " in
  5029.   *" <<$>>am_file "*<<)>>
  5030.     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
  5031.     ;;
  5032.   esac
  5033.   am_indx=`expr "<<$>>am_indx" + 1`
  5034. done<<>>dnl>>)
  5035. changequote([,]))])
  5036.  
  5037.