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 / acinclude.m4 < prev    next >
Text File  |  2001-04-19  |  135KB  |  4,933 lines

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