acinclude.m4
上传用户:shtangtang
上传日期:2007-01-04
资源大小:167k
文件大小:75k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. ##    -*- shell-script -*-
  2. ##    This file is part of the KDE libraries/packages
  3. ##    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
  4. ##              (C) 1997 Stephan Kulow (coolo@kde.org)
  5. ##    This file is free software; you can redistribute it and/or
  6. ##    modify it under the terms of the GNU Library General Public
  7. ##    License as published by the Free Software Foundation; either
  8. ##    version 2 of the License, or (at your option) any later version.
  9. ##    This library is distributed in the hope that it will be useful,
  10. ##    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. ##    Library General Public License for more details.
  13. ##    You should have received a copy of the GNU Library General Public License
  14. ##    along with this library; see the file COPYING.LIB.  If not, write to
  15. ##    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  16. ##    Boston, MA 02111-1307, USA.        
  17. ## IMPORTANT NOTE:
  18. ## Please do not modify this file unless you expect your modifications to be
  19. ## carried into every other module in the repository. If you decide that you
  20. ## really want to modify it, contact coolo@kde.org mentioning that you have
  21. ## and that the modified file should be committed to every module.
  22. ##
  23. ## Single-module modifications are best placed in configure.in for kdelibs
  24. ## and kdebase or configure.in.1 if present.
  25. ## ------------------------------------------------------------------------
  26. ## Find a file (or one of more files in a list of dirs)
  27. ## ------------------------------------------------------------------------
  28. ##
  29. AC_DEFUN(AC_FIND_FILE,
  30. [
  31. $3=NO
  32. for i in $2;
  33. do
  34.   for j in $1;
  35.   do
  36.     if test -r "$i/$j"; then
  37.       $3=$i
  38.       break 2
  39.     fi
  40.   done
  41. done
  42. ])
  43. ## ------------------------------------------------------------------------
  44. ## Find the meta object compiler in the PATH, in $QTDIR/bin, and some
  45. ## more usual places
  46. ## ------------------------------------------------------------------------
  47. ##
  48. AC_DEFUN(AC_PATH_QT_MOC,
  49. [
  50. AC_PATH_PROG(MOC, moc, $QTDIR/bin/moc,
  51.  $ac_qt_bindir $QTDIR/bin $PATH /usr/bin /usr/X11R6/bin /usr/lib/qt/bin /usr/local/qt/bin)
  52. ])
  53. AC_DEFUN(KDE_REPLACE_ROOT,
  54.   $1=`echo "$$1" | sed -e "s#^/#${install_root}/#"`
  55. )
  56. AC_DEFUN(AC_CREATE_KFSSTND,
  57. [
  58. AC_REQUIRE([AC_CHECK_RPATH])
  59. AC_REQUIRE([AC_CHECK_BOOL])
  60. if test "$1" = "default"; then
  61.   AC_MSG_CHECKING(for KDE paths)
  62.   if test -z "$kde_htmldir"; then
  63.     kde_htmldir="$(prefix)/share/doc/HTML"
  64.   fi
  65.   if test -z "$kde_appsdir"; then
  66.     kde_appsdir="$(prefix)/share/applnk"
  67.   fi
  68.   if test -z "$kde_icondir"; then
  69.     kde_icondir="$(prefix)/share/icons"
  70.   fi
  71.   if test -z "$kde_sounddir"; then
  72.     kde_sounddir="$(prefix)/share/sounds"
  73.   fi
  74.   if test -z "$kde_datadir"; then
  75.     kde_datadir="$(prefix)/share/apps"
  76.   fi
  77.   if test -z "$kde_locale"; then
  78.     kde_locale="$(prefix)/share/locale"
  79.   fi
  80.   if test -z "$kde_cgidir"; then
  81.     kde_cgidir="$(exec_prefix)/cgi-bin"
  82.   fi
  83.   if test -z "$kde_confdir"; then
  84.     kde_confdir="$(prefix)/share/config"
  85.   fi
  86.   if test -z "$kde_mimedir"; then
  87.     kde_mimedir="$(prefix)/share/mimelnk"
  88.   fi
  89.   if test -z "$kde_toolbardir"; then
  90.     kde_toolbardir="$(prefix)/share/toolbar"
  91.   fi
  92.   if test -z "$kde_wallpaperdir"; then
  93.     kde_wallpaperdir="$(prefix)/share/wallpapers"
  94.   fi
  95.   if test -z "$kde_bindir"; then
  96.     kde_bindir="$(exec_prefix)/bin"
  97.   fi
  98.   if test -z "$kde_partsdir"; then
  99.     kde_partsdir="$(exec_prefix)/parts"
  100.   fi
  101.   AC_MSG_RESULT(defaults)
  102. else 
  103. AC_CACHE_VAL(kde_cv_all_paths,
  104. [
  105. AC_MSG_CHECKING([for kde headers installed])
  106. AC_LANG_CPLUSPLUS
  107. cat > conftest.$ac_ext <<EOF
  108. #include <stdio.h>
  109. #include "confdefs.h"
  110. #include "config.h.bot"
  111. #include <kapp.h>
  112. int main() {
  113. printf("kde_htmldir=\"%s\"n", KApplication::kde_htmldir().data());
  114. printf("kde_appsdir=\"%s\"n", KApplication::kde_appsdir().data());
  115. printf("kde_icondir=\"%s\"n", KApplication::kde_icondir().data());
  116. printf("kde_sounddir=\"%s\"n", KApplication::kde_sounddir().data());
  117. printf("kde_datadir=\"%s\"n", KApplication::kde_datadir().data());
  118. printf("kde_locale=\"%s\"n", KApplication::kde_localedir().data());
  119. printf("kde_cgidir=\"%s\"n", KApplication::kde_cgidir().data());
  120. printf("kde_confdir=\"%s\"n", KApplication::kde_configdir().data());
  121. printf("kde_mimedir=\"%s\"n", KApplication::kde_mimedir().data());
  122. printf("kde_toolbardir=\"%s\"n", KApplication::kde_toolbardir().data());
  123. printf("kde_wallpaperdir=\"%s\"n", KApplication::kde_wallpaperdir().data());
  124. printf("kde_bindir=\"%s\"n", KApplication::kde_bindir().data());
  125. printf("kde_partsdir=\"%s\"n", KApplication::kde_partsdir().data());
  126. return 0;
  127. }
  128. EOF
  129. if test -n "$kde_libraries"; then
  130.   KDE_TEST_RPATH="-rpath $kde_libraries"
  131. fi
  132. if test -n "$qt_libraries"; then
  133.   KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries"
  134. fi
  135. if test -n "$x_libraries"; then
  136.   KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries"
  137. fi
  138. KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
  139. ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
  140. if AC_TRY_EVAL(ac_compile); then
  141.   AC_MSG_RESULT(yes)
  142. else
  143.   AC_MSG_ERROR([your system is not able to compile a small KDE application!
  144. Check, if you installed the KDE header files correctly.])
  145. fi
  146. AC_MSG_CHECKING([for kde libraries installed])
  147. ac_link='/bin/sh ./libtool --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore -lqt -lXext -lX11 $LIBSOCKET $KDE_TEST_RPATH 1>&5'
  148. if AC_TRY_EVAL(ac_link) && test -s conftest; then 
  149.   AC_MSG_RESULT(yes)
  150. else
  151.   AC_MSG_ERROR([your system fails at linking a small KDE application!
  152. Check, if your compiler is installed correctly and if you have used the
  153. same compiler to compile Qt and kdelibs as you did use now])
  154. fi
  155. AC_MSG_CHECKING([for KDE paths])
  156. if eval `./conftest 2>&5`; then
  157.   AC_MSG_RESULT(done)
  158. else
  159.   AC_MSG_RESULT(problems)
  160. fi
  161. ./conftest 2> /dev/null >&5 # make an echo for config.log
  162. kde_have_all_paths=yes
  163. AC_LANG_CPLUSPLUS
  164. if test "$kde_have_all_paths" = "yes"; then
  165. kde_cv_all_paths="kde_have_all_paths="yes" 
  166. kde_htmldir="$kde_htmldir" 
  167. kde_appsdir="$kde_appsdir" 
  168. kde_icondir="$kde_icondir" 
  169. kde_sounddir="$kde_sounddir" 
  170. kde_datadir="$kde_datadir" 
  171. kde_locale="$kde_locale" 
  172. kde_cgidir="$kde_cgidir" 
  173. kde_confdir="$kde_confdir" 
  174. kde_mimedir="$kde_mimedir" 
  175. kde_toolbardir="$kde_toolbardir" 
  176. kde_wallpaperdir="$kde_wallpaperdir" 
  177. kde_bindir="$kde_bindir" 
  178. kde_partsdir="$kde_partsdir""
  179. fi
  180. rm -fr conftest*
  181. ])
  182. eval "$kde_cv_all_paths"
  183. if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
  184.    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
  185.    test -z "$kde_datadir" || test -z "$kde_locale"  ||
  186.    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
  187.    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
  188.    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
  189.    test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then
  190.   kde_have_all_paths=no
  191.   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
  192. Since it had compiled and linked before, it must be a strange problem on your system.
  193. Look at config.log for details. If you are not able to fix this, please contact Stephan Kulow <coolo@kde.org>.])
  194. fi
  195. if test -n "$install_root"; then
  196.   KDE_REPLACE_ROOT(kde_htmldir)
  197.   KDE_REPLACE_ROOT(kde_appsdir)
  198.   KDE_REPLACE_ROOT(kde_icondir)
  199.   KDE_REPLACE_ROOT(kde_sounddir)
  200.   KDE_REPLACE_ROOT(kde_datadir)
  201.   KDE_REPLACE_ROOT(kde_locale)
  202.   KDE_REPLACE_ROOT(kde_cgidir)
  203.   KDE_REPLACE_ROOT(kde_confdir)
  204.   KDE_REPLACE_ROOT(kde_mimedir)
  205.   KDE_REPLACE_ROOT(kde_toolbardir)
  206.   KDE_REPLACE_ROOT(kde_wallpaperdir)
  207.   KDE_REPLACE_ROOT(kde_bindir)
  208.   KDE_REPLACE_ROOT(kde_partsdir)
  209.   AC_SUBST(install_root)
  210. fi
  211. fi
  212. bindir=$kde_bindir
  213. ])
  214. AC_DEFUN(AC_SUBST_KFSSTND,
  215. [
  216. AC_SUBST(kde_htmldir)
  217. AC_SUBST(kde_appsdir)
  218. AC_SUBST(kde_icondir)
  219. AC_SUBST(kde_sounddir)
  220. kde_minidir="$kde_icondir/mini"
  221. AC_SUBST(kde_minidir)
  222. AC_SUBST(kde_datadir)
  223. AC_SUBST(kde_locale)
  224. AC_SUBST(kde_cgidir)
  225. AC_SUBST(kde_confdir)
  226. AC_SUBST(kde_mimedir)
  227. AC_SUBST(kde_toolbardir)
  228. AC_SUBST(kde_wallpaperdir)
  229. AC_SUBST(kde_bindir)
  230. AC_SUBST(kde_partsdir)
  231. ])
  232. AC_DEFUN(KDE_MISC_TESTS,
  233. [
  234.    AC_LANG_C
  235.    dnl Checks for libraries. 
  236.    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
  237.    AC_SUBST(LIBCOMPAT)
  238.    AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD
  239.    AC_SUBST(LIBCRYPT)
  240.    AC_CHECK_KSIZE_T
  241.    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  242.    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
  243.       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  244.         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  245.    fi
  246.    AC_CHECK_FUNC(gethostbyname)
  247.    if test $ac_cv_func_gethostbyname = no; then
  248.      AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
  249.    fi
  250.    AC_CHECK_FUNC(connect)
  251.    if test $ac_cv_func_connect = no; then
  252.       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
  253.         $X_EXTRA_LIBS)
  254.    fi
  255.    AC_CHECK_FUNC(remove)
  256.    if test $ac_cv_func_remove = no; then
  257.       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
  258.    fi
  259.  
  260.    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
  261.    AC_CHECK_FUNC(shmat)
  262.    if test $ac_cv_func_shmat = no; then
  263.      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
  264.    fi
  265.    LIBSOCKET=$X_EXTRA_LIBS
  266.    AC_SUBST(LIBSOCKET)
  267.    AC_SUBST(X_EXTRA_LIBS)
  268.    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
  269.    AC_SUBST(LIBUCB)
  270.    case $host in  dnl this *is* LynxOS specific
  271.    *-*-lynxos* )
  272.         AC_MSG_CHECKING([LynxOS header file wrappers])
  273.         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
  274.         AC_MSG_RESULT(disabled)
  275.         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
  276.          ;;
  277.     esac
  278. ])
  279. ## ------------------------------------------------------------------------
  280. ## Find the header files and libraries for X-Windows. Extended the 
  281. ## macro AC_PATH_X
  282. ## ------------------------------------------------------------------------
  283. ##
  284. AC_DEFUN(K_PATH_X,
  285. [
  286. AC_MSG_CHECKING(for X)
  287. AC_CACHE_VAL(ac_cv_have_x,
  288. [# One or both of the vars are not set, and there is no cached value.
  289. ac_x_includes=NO ac_x_libraries=NO
  290. AC_PATH_X_DIRECT
  291. AC_PATH_X_XMKMF
  292. if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
  293.   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
  294. else
  295.   # Record where we found X for the cache.
  296.   ac_cv_have_x="have_x=yes 
  297.                 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
  298. fi])dnl
  299. eval "$ac_cv_have_x"
  300.  
  301. if test "$have_x" != yes; then
  302.   AC_MSG_RESULT($have_x)
  303.   no_x=yes
  304. else
  305.   # If each of the values was on the command line, it overrides each guess.
  306.   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
  307.   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
  308.   # Update the cache value to reflect the command line values.
  309.   ac_cv_have_x="have_x=yes 
  310.                 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
  311.   AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
  312. fi
  313. if test -z "$x_includes" || test "x$x_includes" = xNONE; then
  314.   X_INCLUDES=""
  315.   x_includes="."; dnl better than nothing :-
  316.  else
  317.   X_INCLUDES="-I$x_includes"
  318. fi
  319. if test -z "$x_libraries" || test "x$x_libraries" = xNONE; then
  320.   X_LDFLAGS=""
  321.   x_libraries="/usr/lib"; dnl better than nothing :-
  322.  else
  323.   X_LDFLAGS="-L$x_libraries"
  324. fi
  325. all_includes="$all_includes $X_INCLUDES"  
  326. all_libraries="$all_libraries $X_LDFLAGS"  
  327. AC_SUBST(X_INCLUDES)
  328. AC_SUBST(X_LDFLAGS)
  329. AC_SUBST(x_libraries)
  330. AC_SUBST(x_includes)
  331. ])
  332. AC_DEFUN(KDE_PRINT_QT_PROGRAM,
  333. [
  334. AC_LANG_CPLUSPLUS
  335. cat > conftest.$ac_ext <<EOF
  336. #include "confdefs.h"
  337. #include <qstring.h>
  338. #include <qapplication.h>
  339. int main() {
  340.   QChar c;
  341.   c = 'a';
  342.   return 0;
  343. }
  344. EOF
  345. ])
  346. AC_DEFUN(KDE_CHECK_QT_DIRECT,
  347. [
  348. AC_MSG_CHECKING([if Qt compiles without flags])
  349. AC_CACHE_VAL(kde_cv_qt_direct,
  350. [
  351. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  352. ac_LIBRARY_PATH="$LIBRARY_PATH"
  353. ac_cxxflags_safe="$CXXFLAGS"
  354. ac_ldflags_safe="$LDFLAGS"
  355. ac_libs_safe="$LIBS"
  356. CXXFLAGS="$CXXFLAGS -I$qt_includes"
  357. LDFLAGS="$X_LDFLAGS"
  358. LIBS="-lqt -lXext -lX11 $LIBSOCKET"
  359. LD_LIBRARY_PATH=
  360. export LD_LIBRARY_PATH
  361. LIBRARY_PATH=
  362. export LIBRARY_PATH
  363. KDE_PRINT_QT_PROGRAM
  364. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  365.   kde_cv_qt_direct="yes"
  366. else
  367.   kde_cv_qt_direct="no"
  368.   echo "configure: failed program was:" >&AC_FD_CC
  369.   cat conftest.$ac_ext >&AC_FD_CC
  370. fi
  371. rm -f conftest*
  372. CXXFLAGS="$ac_cxxflags_safe"
  373. LDFLAGS="$ac_ldflags_safe"
  374. LIBS="$ac_libs_safe"
  375. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  376. export LD_LIBRARY_PATH
  377. LIBRARY_PATH="$ac_LIBRARY_PATH"
  378. export LIBRARY_PATH
  379. ])
  380. if test "$kde_cv_qt_direct" = "yes"; then
  381.   AC_MSG_RESULT(yes)
  382.   $1
  383. else
  384.   AC_MSG_RESULT(no)
  385.   $2
  386. fi
  387. ])
  388. ## ------------------------------------------------------------------------
  389. ## Try to find the Qt headers and libraries.
  390. ## $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
  391. ## and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
  392. ## ------------------------------------------------------------------------
  393. ##
  394. AC_DEFUN(AC_PATH_QT_2,
  395. [
  396. AC_REQUIRE([K_PATH_X])
  397. AC_MSG_CHECKING([for Qt])
  398. ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
  399. qt_libraries=""
  400. qt_includes=""
  401. AC_ARG_WITH(qt-dir,
  402.     [  --with-qt-dir           where the root of qt is installed ],
  403.     [  ac_qt_includes="$withval"/include
  404.        ac_qt_libraries="$withval"/lib
  405.        ac_qt_bindir="$withval"/bin
  406.     ])
  407. AC_ARG_WITH(qt-includes,
  408.     [  --with-qt-includes      where the Qt includes are. ],
  409.     [  
  410.        ac_qt_includes="$withval"
  411.     ])
  412.     
  413. kde_qt_libs_given=no
  414. AC_ARG_WITH(qt-libraries,
  415.     [  --with-qt-libraries     where the Qt library is installed.],
  416.     [  ac_qt_libraries="$withval"
  417.        kde_qt_libs_given=yes
  418.     ])
  419. if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
  420. AC_CACHE_VAL(ac_cv_have_qt,
  421. [#try to guess Qt locations
  422. qt_incdirs="$ac_qt_includes /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC"
  423. test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
  424. AC_FIND_FILE(qnamespace.h, $qt_incdirs, qt_incdir)
  425. ac_qt_includes="$qt_incdir"
  426. if test ! "$ac_qt_libraries" = "NO"; then
  427.   qt_libdirs="$ac_qt_libraries"
  428. fi
  429. qt_libdirs="$qt_libdirs /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries $QTLIB"
  430. test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
  431. test=NONE
  432. qt_libdir=NONE
  433. for dir in $qt_libdirs; do
  434.   try="ls -1 $dir/libqt*"
  435.   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  436. done
  437. dnl AC_FIND_FILE(libqt.so libqt.so.2.00 libqt.so.2.0 libqt.so.2 libqt.a libqt.sl, $qt_libdirs, qt_libdir)
  438. ac_qt_libraries="$qt_libdir"
  439. ac_cxxflags_safe="$CXXFLAGS"
  440. ac_ldflags_safe="$LDFLAGS"
  441. ac_libs_safe="$LIBS"
  442. CXXFLAGS="$CXXFLAGS -I$qt_incdir"
  443. LDFLAGS="-L$qt_libdir $X_LDFLAGS"
  444. LIBS="$LIBS -lpq++ -lqt -lkdb -lXext -lX11 $LIBSOCKET"
  445. KDE_PRINT_QT_PROGRAM
  446. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  447.   rm -f conftest*
  448. else
  449.   echo "configure: failed program was:" >&AC_FD_CC
  450.   cat conftest.$ac_ext >&AC_FD_CC
  451.   ac_qt_libraries="NO"
  452. fi
  453. rm -f conftest*
  454. CXXFLAGS="$ac_cxxflags_safe"
  455. LDFLAGS="$ac_ldflags_safe"
  456. LIBS="$ac_libs_safe"
  457. if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
  458.   ac_cv_have_qt="have_qt=no"
  459.   ac_qt_notfound=""
  460.   if test "$ac_qt_includes" = NO; then
  461.     if test "$ac_qt_libraries" = NO; then
  462.       ac_qt_notfound="(headers and libraries)";
  463.     else
  464.       ac_qt_notfound="(headers)";
  465.     fi
  466.   else
  467.     ac_qt_notfound="(libraries)";
  468.   fi
  469.   AC_MSG_ERROR([Qt-2.0 $ac_qt_notfound not found. Please check your installation! ]);
  470. else
  471.   have_qt="yes"
  472. fi
  473. ])
  474. else
  475.   have_qt="yes"
  476. fi
  477. eval "$ac_cv_have_qt"
  478. if test "$have_qt" != yes; then
  479.   AC_MSG_RESULT([$have_qt]);
  480. else
  481.   ac_cv_have_qt="have_qt=yes 
  482.     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
  483.   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
  484.   
  485.   qt_libraries="$ac_qt_libraries"
  486.   qt_includes="$ac_qt_includes"
  487. fi
  488. if test ! "$kde_qt_libs_given" = "yes"; then
  489. KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
  490. fi
  491. AC_SUBST(qt_libraries)
  492. AC_SUBST(qt_includes)
  493. if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
  494.  QT_INCLUDES="";
  495. else
  496.  QT_INCLUDES="-I$qt_includes"
  497.  all_includes="$QT_INCLUDES $all_includes"
  498. fi
  499. if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
  500.  QT_LDFLAGS=""
  501. else
  502.  QT_LDFLAGS="-L$qt_libraries"
  503.  all_libraries="$QT_LDFLAGS $all_libraries"
  504. fi
  505. AC_SUBST(QT_INCLUDES)
  506. AC_SUBST(QT_LDFLAGS)
  507. AC_PATH_QT_MOC
  508. ])
  509. AC_DEFUN(AC_PATH_QT,
  510. [
  511. AC_PATH_QT_2
  512. ])
  513. ## ------------------------------------------------------------------------
  514. ## Now, the same with KDE
  515. ## $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
  516. ## and $(kde_includes) will be the kdehdrlocation (if needed)
  517. ## ------------------------------------------------------------------------
  518. ##
  519. AC_DEFUN(AC_BASE_PATH_KDE,
  520. [
  521. AC_REQUIRE([KDE_MISC_TESTS])
  522. AC_REQUIRE([AC_PATH_QT])dnl
  523. AC_REQUIRE([AC_CHECK_RPATH])
  524. AC_REQUIRE([AC_CHECK_BOOL])
  525. AC_SUBST(all_includes)
  526. AC_SUBST(all_libraries)
  527. ])
  528. AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
  529. [
  530. AC_MSG_CHECKING(for extra includes)
  531. AC_ARG_WITH(extra-includes, [  --with-extra-includes   adds non standard include paths], 
  532.   kde_use_extra_includes="$withval",
  533.   kde_use_extra_includes=NONE
  534. )
  535. if test -n "$kde_use_extra_includes" && 
  536.    test "$kde_use_extra_includes" != "NONE"; then
  537.    ac_save_ifs=$IFS
  538.    IFS=':'
  539.    for dir in $kde_use_extra_includes; do
  540.      all_includes="$all_includes -I$dir"
  541.      USER_INCLUDES="$USER_INCLUDES -I$dir"
  542.    done
  543.    IFS=$ac_save_ifs
  544.    kde_use_extra_includes="added"
  545. else
  546.    kde_use_extra_includes="no"
  547. fi
  548. AC_MSG_RESULT($kde_use_extra_includes)
  549. AC_MSG_CHECKING(for extra libs)
  550. AC_ARG_WITH(extra-libs, [  --with-extra-libs       adds non standard library paths], 
  551.   kde_use_extra_libs=$withval,
  552.   kde_use_extra_libs=NONE
  553. )
  554. if test -n "$kde_use_extra_libs" && 
  555.    test "$kde_use_extra_libs" != "NONE"; then
  556.    ac_save_ifs=$IFS
  557.    IFS=':'
  558.    for dir in $kde_use_extra_libs; do
  559.      all_libraries="$all_libraries -L$dir"
  560.      KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
  561.      USER_LDFLAGS="$USER_LDFLAGS -L$dir"
  562.    done
  563.    IFS=$ac_save_ifs
  564.    kde_use_extra_libs="added"
  565. else
  566.    kde_use_extra_libs="no"
  567. fi
  568. AC_MSG_RESULT($kde_use_extra_libs)
  569. ])
  570. AC_DEFUN(KDE_CHECK_KIMGIO,
  571. [
  572.    AC_REQUIRE([AC_FIND_TIFF])
  573.    AC_REQUIRE([AC_FIND_JPEG]) 
  574.    AC_REQUIRE([AC_FIND_PNG]) 
  575.    LIB_KIMGIO='-lkimgio $(LIBJPEG) $(LIBTIFF) $(LIBPNG) -lm'
  576.    AC_SUBST(LIB_KIMGIO)
  577.    LIB_KHTMLW='-lkhtmlw $(LIB_KIMGIO) -ljscript'
  578.    AC_SUBST(LIB_KHTMLW)
  579.    LIB_KHTML='-lkhtml $(LIB_KIMGIO) -ljscript'
  580.    AC_SUBST(LIB_KHTML)
  581. ])
  582. AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
  583. [
  584.    AC_REQUIRE([KDE_MISC_TESTS])
  585.    LIB_X11='-lX11 $(LIBSOCKET)'
  586.    AC_SUBST(LIB_X11)
  587.    LIB_QT='-lqt $(LIB_X11)'
  588.    AC_SUBST(LIB_QT)
  589.    LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
  590.    AC_SUBST(LIB_KDECORE)
  591.    LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
  592.    AC_SUBST(LIB_KDEUI)
  593.    LIB_KFM='-lkfm $(LIB_KDECORE)'
  594.    AC_SUBST(LIB_KFM)
  595.    LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
  596.    AC_SUBST(LIB_KFILE)
  597. ])
  598. AC_DEFUN(AC_PATH_KDE,
  599. [
  600.   AC_BASE_PATH_KDE
  601. ])
  602. ## ------------------------------------------------------------------------
  603. ## Try to find the Postgres headers and library.
  604. ## $(PG_LDFLAGS) will be -Lkdbtliblocation (if needed)
  605. ## and $(PG_INCLUDES) will be -Ikdblhdrlocation (if needed)
  606. ## ------------------------------------------------------------------------
  607. ##
  608. AC_DEFUN(AC_PATH_PG,
  609. [
  610. AC_REQUIRE([K_PATH_X])
  611. AC_MSG_CHECKING([for Postgres])
  612. ac_pg_includes=NO ac_pg_libraries=NO ac_pg_bindir=NO
  613. pg_libraries=""
  614. pg_includes=""
  615. AC_ARG_WITH(pg-dir,
  616.     [  --with-pg-dir           where the root of Postgres is installed ],
  617.     [  ac_pg_includes="$withval"/include
  618.        ac_pg_libraries="$withval"/lib
  619.        ac_pg_bindir="$withval"/bin
  620.     ])
  621. AC_ARG_WITH(pg-includes,
  622.     [  --with-pg-includes      where the Postgres includes are. ],
  623.     [  
  624.        ac_kdb_includes="$withval"
  625.     ])
  626.     
  627. kde_kdb_libs_given=no
  628. AC_ARG_WITH(pg-libraries,
  629.     [  --with-pg-libraries     where the Postgres library is installed.],
  630.     [  ac_pg_libraries="$withval"
  631.        kde_pg_libs_given=yes
  632.     ])
  633. if test "$ac_pg_includes" = NO || test "$ac_pg_libraries" = NO; then
  634. AC_CACHE_VAL(ac_cv_have_pg,
  635. [#try to guess Postgres locations
  636. pg_incdirs="$ac_pg_includes /usr/lib/pgsql/include /usr/local/pgsql/include /usr/include/pgsql /usr/include /usr/local/include /usr/X11R6/include/X11/pgsql $x_includes $PGINC"
  637. test -n "$PGDIR" && kdb_incdirs="$PGDIR/include $PGDIR $kdb_incdirs"
  638. AC_FIND_FILE(libpq++.h, $pg_incdirs, pg_incdir)
  639. ac_pg_includes="$pg_incdir"
  640. if test ! "$ac_pg_libraries" = "NO"; then
  641.   pg_libdirs="$ac_pg_libraries"
  642. fi
  643. pg_libdirs="$pg_libdirs /usr/lib/pgsql/lib /usr/X11R6/lib /usr/lib /usr/local/lib /usr/local/pgsql/lib /usr/lib/pgsql $x_libraries $PGLIB"
  644. test -n "$PGDIR" && pg_libdirs="$PGDIR/lib $PGDIR $pg_libdirs"
  645. test=NONE
  646. pg_libdir=NONE
  647. for dir in $pg_libdirs; do
  648.   try="ls -1 $dir/libpq++*"
  649.   if test=`eval $try 2> /dev/null`; then pg_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  650. done
  651. dnl AC_FIND_FILE(libpq++.so libpq++.so.3 libpq++.a, $pg_libdirs, pg_libdir)
  652. ac_pg_libraries="$pg_libdir"
  653. ac_cxxflags_safe="$CXXFLAGS"
  654. ac_ldflags_safe="$LDFLAGS"
  655. ac_libs_safe="$LIBS"
  656. CXXFLAGS="$CXXFLAGS -I$pg_incdir"
  657. LDFLAGS="-L$pg_libdir $X_LDFLAGS"
  658. LIBS="$LIBS -lpq++ -lXext -lX11 $LIBSOCKET"
  659. AC_LANG_CPLUSPLUS
  660. cat >conftest.$ac_ext <<EOF
  661. #include <libpq++.h>
  662. main(){
  663. PgDatabase a( 0 );
  664. a.Tuples();
  665. return 0;
  666. }
  667. EOF
  668. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  669.   rm -f conftest*
  670. else
  671.   echo "configure: failed program was:" >&AC_FD_CC
  672.   cat conftest.$ac_ext >&AC_FD_CC
  673.   ac_pg_libraries="NO"
  674. fi
  675. rm -f conftest*
  676. CXXFLAGS="$ac_cxxflags_safe"
  677. LDFLAGS="$ac_ldflags_safe"
  678. LIBS="$ac_libs_safe"
  679. if test "$ac_pg_includes" = NO || test "$ac_pg_libraries" = NO; then
  680.   ac_cv_have_pg="have_pg=no"
  681.   ac_pg_notfound=""
  682.   if test "$ac_pg_includes" = NO; then
  683.     if test "$ac_pg_libraries" = NO; then
  684.       ac_pg_notfound="(headers and libraries)";
  685.     else
  686.       ac_pg_notfound="(headers)";
  687.     fi
  688.   else
  689.     ac_pg_notfound="(libraries)";
  690.   fi
  691.   AC_MSG_ERROR([Postgres $ac_pg_notfound not found. Please check your installation! ]);
  692. else
  693.   have_pg="yes"
  694. fi
  695. ])
  696. else
  697.   have_pg="yes"
  698. fi
  699. eval "$ac_cv_have_pg"
  700. if test "$have_pg" != yes; then
  701.   AC_MSG_RESULT([$have_pg]);
  702. else
  703.   ac_cv_have_pg="have_pg=yes 
  704.     ac_pg_includes=$ac_pg_includes ac_pg_libraries=$ac_pg_libraries"
  705.   AC_MSG_RESULT([libraries $ac_pg_libraries, headers $ac_pg_includes])
  706.   
  707.   pg_libraries="$ac_pg_libraries"
  708.   pg_includes="$ac_pg_includes"
  709. fi
  710. AC_SUBST(pg_libraries)
  711. AC_SUBST(pg_includes)
  712. if test "$pg_includes" = "$x_includes" || test -z "$pg_includes"; then
  713.  PG_INCLUDES="";
  714. else
  715.  PG_INCLUDES="-I$pg_includes"
  716.  all_includes="$PG_INCLUDES $all_includes"
  717. fi
  718. if test "$pg_libraries" = "$x_libraries" || test -z "$pg_libraries"; then
  719.  PG_LDFLAGS=""
  720. else
  721.  PG_LDFLAGS="-L$pg_libraries"
  722.  all_libraries="$PG_LDFLAGS $all_libraries"
  723. fi
  724. AC_SUBST(PG_INCLUDES)
  725. AC_SUBST(PG_LDFLAGS)
  726. ])
  727. ## ------------------------------------------------------------------------
  728. ## Try to find the Kdb headers and library.
  729. ## $(KDB_LDFLAGS) will be -Lkdbtliblocation (if needed)
  730. ## and $(KDB_INCLUDES) will be -Ikdblhdrlocation (if needed)
  731. ## ------------------------------------------------------------------------
  732. ##
  733. AC_DEFUN(AC_PATH_KDB_0,
  734. [
  735. AC_REQUIRE([AC_PATH_PG])
  736. AC_REQUIRE([AC_PATH_QT])
  737. AC_MSG_CHECKING([for Kdb])
  738. ac_kdb_includes=NO ac_kdb_libraries=NO ac_kdb_bindir=NO
  739. kdb_libraries=""
  740. kdb_includes=""
  741. AC_ARG_WITH(kdb-dir,
  742.     [  --with-kdb-dir           where the root of Kdb is installed ],
  743.     [  ac_kdb_includes="$withval"/include
  744.        ac_kdb_libraries="$withval"/lib
  745.        ac_kdb_bindir="$withval"/bin
  746.     ])
  747. AC_ARG_WITH(kdb-includes,
  748.     [  --with-kdb-includes      where the Kdb includes are. ],
  749.     [  
  750.        ac_kdb_includes="$withval"
  751.     ])
  752.     
  753. kde_kdb_libs_given=no
  754. AC_ARG_WITH(kdb-libraries,
  755.     [  --with-kdb-libraries     where the Kdb library is installed.],
  756.     [  ac_kdb_libraries="$withval"
  757.        kde_kdb_libs_given=yes
  758.     ])
  759. if test "$ac_kdb_includes" = NO || test "$ac_kdb_libraries" = NO; then
  760. AC_CACHE_VAL(ac_cv_have_kdb,
  761. [#try to guess Kdb locations
  762. kdb_incdirs="$ac_kdb_includes /usr/lib/kdb/include /usr/local/kdb/include /usr/include/kdb /usr/include /usr/local/include /usr/X11R6/include/X11/kdb $x_includes $KDBINC"
  763. test -n "$KDBDIR" && kdb_incdirs="$KDBDIR/include $KDBDIR $kdb_incdirs"
  764. AC_FIND_FILE(kdb.h, $kdb_incdirs, kdb_incdir)
  765. ac_kdb_includes="$kdb_incdir"
  766. if test ! "$ac_kdb_libraries" = "NO"; then
  767.   kdb_libdirs="$ac_kdb_libraries"
  768. fi
  769. kdb_libdirs="$kdb_libdirs /usr/lib/kdb/lib /usr/X11R6/lib /usr/lib /usr/local/lib /usr/local/kdb/lib /usr/lib/kdb $x_libraries $KDBLIB"
  770. test -n "$KDBDIR" && kdb_libdirs="$KDBDIR/lib $KDBDIR $kdb_libdirs"
  771. test=NONE
  772. kdb_libdir=NONE
  773. for dir in $kdb_libdirs; do
  774.   try="ls -1 $dir/libkdb*"
  775.   if test=`eval $try 2> /dev/null`; then kdb_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  776. done
  777. dnl AC_FIND_FILE(libkdb.so libkdb.so.0 libkdb.a, $kdb_libdirs, kdb_libdir)
  778. ac_kdb_libraries="$kdb_libdir"
  779. ac_cxxflags_safe="$CXXFLAGS"
  780. ac_ldflags_safe="$LDFLAGS"
  781. ac_libs_safe="$LIBS"
  782. CXXFLAGS="$CXXFLAGS -I$qt_includes -I$pg_includes -I$kdb_incdir"
  783. LDFLAGS="-L$qt_libdir -L$pg_libdir -L$kdb_libdir $X_LDFLAGS"
  784. LIBS="$LIBS -lpq++ -lqt -lkdb -lXext -lX11 $LIBSOCKET"
  785. AC_LANG_CPLUSPLUS
  786. cat >conftest.$ac_ext <<EOF
  787. #include <kdbcontainer.h>
  788. main(){
  789. kdbContainer a(2);
  790. a.set(0,"abc");
  791. return 0;
  792. }
  793. EOF
  794. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  795.   rm -f conftest*
  796. else
  797.   echo "configure: failed program was:" >&AC_FD_CC
  798.   cat conftest.$ac_ext >&AC_FD_CC
  799.   ac_kdb_libraries="NO"
  800. fi
  801. rm -f conftest*
  802. CXXFLAGS="$ac_cxxflags_safe"
  803. LDFLAGS="$ac_ldflags_safe"
  804. LIBS="$ac_libs_safe"
  805. if test "$ac_kdb_includes" = NO || test "$ac_kdb_libraries" = NO; then
  806.   ac_cv_have_kdb="have_kdb=no"
  807.   ac_kdb_notfound=""
  808.   if test "$ac_kdb_includes" = NO; then
  809.     if test "$ac_kdb_libraries" = NO; then
  810.       ac_kdb_notfound="(headers and libraries)";
  811.     else
  812.       ac_kdb_notfound="(headers)";
  813.     fi
  814.   else
  815.     ac_kdb_notfound="(libraries)";
  816.   fi
  817.   AC_MSG_ERROR([Kdb-0 $ac_kdb_notfound not found. Please check your installation! ]);
  818. else
  819.   have_kdb="yes"
  820. fi
  821. ])
  822. else
  823.   have_kdb="yes"
  824. fi
  825. eval "$ac_cv_have_kdb"
  826. if test "$have_kdb" != yes; then
  827.   AC_MSG_RESULT([$have_kdb]);
  828. else
  829.   ac_cv_have_kdb="have_kdb=yes 
  830.     ac_kdb_includes=$ac_kdb_includes ac_kdb_libraries=$ac_kdb_libraries"
  831.   AC_MSG_RESULT([libraries $ac_kdb_libraries, headers $ac_kdb_includes])
  832.   
  833.   kdb_libraries="$ac_kdb_libraries"
  834.   kdb_includes="$ac_kdb_includes"
  835. fi
  836. AC_SUBST(kdb_libraries)
  837. AC_SUBST(kdb_includes)
  838. if test "$kdb_includes" = "$x_includes" || test -z "$kdb_includes"; then
  839.  KDB_INCLUDES="";
  840. else
  841.  KDB_INCLUDES="-I$kdb_includes"
  842.  all_includes="$KDB_INCLUDES $all_includes"
  843. fi
  844. if test "$kdb_libraries" = "$x_libraries" || test -z "$kdb_libraries"; then
  845.  KDB_LDFLAGS=""
  846. else
  847.  KDB_LDFLAGS="-L$kdb_libraries"
  848.  all_libraries="$KDB_LDFLAGS $all_libraries"
  849. fi
  850. AC_SUBST(KDB_INCLUDES)
  851. AC_SUBST(KDB_LDFLAGS)
  852. ])
  853. AC_DEFUN(AC_BASE_PATH_KDB,
  854. [
  855. AC_REQUIRE([KDE_MISC_TESTS])
  856. AC_REQUIRE([AC_PATH_KDB_0])dnl
  857. AC_REQUIRE([AC_CHECK_RPATH])
  858. AC_REQUIRE([AC_CHECK_BOOL])
  859. AC_SUBST(all_includes)
  860. AC_SUBST(all_libraries)
  861. LIBS="-lpq++ -lkdb $LIBS"
  862. ])
  863. AC_DEFUN(AC_PATH_KDB,
  864. [
  865. AC_BASE_PATH_KDB
  866. ])
  867. dnl slightly changed version of AC_CHECK_FUNC(setenv)
  868. AC_DEFUN(AC_CHECK_SETENV,
  869. [AC_MSG_CHECKING([for setenv])
  870. AC_CACHE_VAL(ac_cv_func_setenv,
  871. [AC_LANG_C
  872. AC_TRY_LINK(
  873. dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
  874. dnl which includes <sys/select.h> which contains a prototype for
  875. dnl select.  Similarly for bzero.
  876. [#include <assert.h>
  877. ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
  878. extern "C"
  879. #endif
  880. ])dnl
  881. [/* We use char because int might match the return type of a gcc2
  882.     builtin and then its argument prototype would still apply.  */
  883. #include <stdlib.h>
  884. ], [
  885. /* The GNU C library defines this for functions which it implements
  886.     to always fail with ENOSYS.  Some functions are actually named
  887.     something starting with __ and the normal name is an alias.  */
  888. #if defined (__stub_$1) || defined (__stub___$1)
  889. choke me
  890. #else
  891. setenv("TEST", "alle", 1);
  892. #endif
  893. ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
  894. if test "$ac_cv_func_setenv" = "yes"; then
  895.   AC_MSG_RESULT(yes)
  896.   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV)
  897. else
  898.   AC_MSG_RESULT(no)
  899. fi
  900. ])
  901. AC_DEFUN(AC_CHECK_GETDOMAINNAME,
  902. [
  903. AC_LANG_CPLUSPLUS
  904. save_CXXFLAGS="$CXXFLAGS"
  905. if test "$GCC" = "yes"; then
  906. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  907. fi
  908. AC_MSG_CHECKING(for getdomainname)
  909. AC_CACHE_VAL(ac_cv_func_getdomainname,
  910. [
  911. AC_TRY_COMPILE([
  912. #include <stdlib.h>
  913. #include <unistd.h>
  914. ],
  915. [
  916. char buffer[200];
  917. getdomainname(buffer, 200);
  918. ],
  919. ac_cv_func_getdomainname=yes,
  920. ac_cv_func_getdomainname=no)
  921. ])
  922. AC_MSG_RESULT($ac_cv_func_getdomainname)
  923. if eval "test "`echo `$ac_cv_func_getdomainname" = yes"; then
  924.   AC_DEFINE(HAVE_GETDOMAINNAME)
  925. fi
  926. CXXFLAGS="$save_CXXFLAGS"
  927. ])
  928. AC_DEFUN(AC_CHECK_GETHOSTNAME,
  929. [
  930. AC_LANG_CPLUSPLUS
  931. save_CXXFLAGS="$CXXFLAGS"
  932. if test "$GCC" = "yes"; then
  933. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  934. fi
  935. AC_MSG_CHECKING([for gethostname])
  936. AC_CACHE_VAL(ac_cv_func_gethostname,
  937. [
  938. AC_TRY_COMPILE([
  939. #include <stdlib.h>
  940. #include <unistd.h>
  941. ],
  942. [
  943. char buffer[200];
  944. gethostname(buffer, 200);
  945. ],
  946. ac_cv_func_gethostname=yes,
  947. ac_cv_func_gethostname=no)
  948. ])
  949. AC_MSG_RESULT($ac_cv_func_gethostname)
  950. if eval "test "`echo `$ac_cv_func_gethostname" = yes"; then
  951.   AC_DEFINE(HAVE_GETHOSTNAME)
  952. fi
  953. CXXFLAGS="$save_CXXFLAGS"
  954. ])
  955. AC_DEFUN(AC_CHECK_USLEEP,
  956. [
  957. AC_LANG_CPLUSPLUS
  958. AC_MSG_CHECKING([for usleep])
  959. AC_CACHE_VAL(ac_cv_func_usleep,
  960. [
  961. ac_libs_safe="$LIBS"
  962. LIBS="$LIBS $LIBUCB"
  963. AC_TRY_LINK([
  964. #include <stdlib.h>
  965. #include <unistd.h>
  966. ],
  967. [
  968. usleep(200);
  969. ],
  970. ac_cv_func_usleep=yes,
  971. ac_cv_func_usleep=no)
  972. ])
  973. AC_MSG_RESULT($ac_cv_func_usleep)
  974. if eval "test "`echo `$ac_cv_func_usleep" = yes"; then
  975.   AC_DEFINE(HAVE_USLEEP)
  976. fi
  977. LIBS="$ac_libs_safe"
  978. ])
  979. AC_DEFUN(AC_FIND_GIF,
  980.    [AC_MSG_CHECKING([for giflib])
  981. AC_CACHE_VAL(ac_cv_lib_gif,
  982. [ac_save_LIBS="$LIBS"
  983. LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
  984. AC_TRY_LINK(dnl
  985. [
  986. #ifdef __cplusplus
  987. extern "C" {
  988. #endif
  989. int GifLastError(void);
  990. #ifdef __cplusplus
  991. }
  992. #endif
  993. /* We use char because int might match the return type of a gcc2
  994.     builtin and then its argument prototype would still apply.  */
  995. ],
  996.             [return GifLastError();],
  997.             eval "ac_cv_lib_gif=yes",
  998.             eval "ac_cv_lib_gif=no")
  999. LIBS="$ac_save_LIBS"
  1000. ])dnl
  1001. if eval "test "`echo $ac_cv_lib_gif`" = yes"; then
  1002.   AC_MSG_RESULT(yes)
  1003.   AC_DEFINE_UNQUOTED(HAVE_LIBGIF)
  1004. else
  1005.   AC_MSG_ERROR(You need giflib23. Please install the kdesupport package)
  1006. fi
  1007. ])
  1008. AC_DEFUN(AC_FIND_JPEG,
  1009.    [AC_MSG_CHECKING([for jpeglib])
  1010. AC_CACHE_VAL(ac_cv_lib_jpeg,
  1011. [ac_save_LIBS="$LIBS"
  1012. LIBS="$all_libraries -ljpeg -lm"
  1013. AC_TRY_LINK(
  1014. [/* Override any gcc2 internal prototype to avoid an error.  */
  1015. struct jpeg_decompress_struct;
  1016. typedef struct jpeg_decompress_struct * j_decompress_ptr;
  1017. typedef int size_t;
  1018. #ifdef __cplusplus
  1019. extern "C" {
  1020. #endif
  1021.     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
  1022.                                     int version, size_t structsize);
  1023. #ifdef __cplusplus
  1024. }
  1025. #endif
  1026. /* We use char because int might match the return type of a gcc2
  1027.     builtin and then its argument prototype would still apply.  */
  1028. ],
  1029.             [jpeg_CreateDecompress(0L, 0, 0);],
  1030.             eval "ac_cv_lib_jpeg=-ljpeg",
  1031.             eval "ac_cv_lib_jpeg=no")
  1032. LIBS="$ac_save_LIBS"
  1033. dnl what to do, if the normal way fails:
  1034. if eval "test "`echo $ac_cv_lib_jpeg`" = no"; then
  1035. if test -f "$kde_libraries/libjpeg.so"; then
  1036.    test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
  1037.    ac_cv_lib_jpeg="-L${topdir} -ljpegkde"
  1038. else if test -f "$kde_libraries/libjpeg.sl"; then
  1039.    test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
  1040.    ac_cv_lib_jpeg="-L${topdir} -ljpegkde"
  1041. else if test -f "$kde_libraries/libjpeg.a"; then
  1042.    test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
  1043.    ac_cv_lib_jpeg="-L${topdir} -ljpegkde"
  1044.         else
  1045.   AC_MSG_ERROR([
  1046. You need jpeglib6a. Please install the kdesupport package.
  1047. If you have already installed kdesupport, you may have an
  1048. old libjpeg somewhere. 
  1049. In this case copy $KDEDIR/lib/libjpeg* to /usr/lib.
  1050. ])
  1051. fi
  1052.       fi
  1053.    fi
  1054. fi
  1055. ])dnl
  1056. if eval "test ! "`echo $ac_cv_lib_jpeg`" = no"; then
  1057.   LIBJPEG="$ac_cv_lib_jpeg"
  1058.   AC_SUBST(LIBJPEG)
  1059.   AC_MSG_RESULT($ac_cv_lib_jpeg)
  1060.   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG)
  1061. fi
  1062. ])
  1063. AC_DEFUN(AC_FIND_ZLIB,
  1064. [
  1065. AC_MSG_CHECKING([for libz])
  1066. AC_CACHE_VAL(ac_cv_lib_z,
  1067. [ac_save_LIBS="$LIBS"
  1068. LIBS="$all_libraries -lz $LIBSOCKET"
  1069. AC_TRY_LINK(dnl
  1070. [
  1071. #include<zlib.h>
  1072. ],
  1073.             [return (zlibVersion() == ZLIB_VERSION); ],
  1074.             eval "ac_cv_lib_z='-lz'",
  1075.             eval "ac_cv_lib_z=no")
  1076. LIBS="$ac_save_LIBS"
  1077. ])dnl
  1078. if eval "test ! "`echo $ac_cv_lib_z`" = no"; then
  1079. dnl  AC_DEFINE_UNQUOTED(HAVE_LIBZ)
  1080.   LIBZ="$ac_cv_lib_z"
  1081.   AC_SUBST(LIBZ)
  1082.   AC_MSG_RESULT($ac_cv_lib_z)
  1083. else
  1084.   AC_MSG_RESULT(no)
  1085.   LIBZ=""
  1086.   AC_SUBST(LIBZ)
  1087. fi
  1088. ])
  1089. AC_DEFUN(AC_FIND_TIFF,
  1090. [
  1091. AC_REQUIRE([AC_FIND_ZLIB])
  1092. AC_REQUIRE([AC_FIND_JPEG])
  1093. AC_MSG_CHECKING([for libtiff])
  1094. AC_CACHE_VAL(ac_cv_lib_tiff,
  1095. [ac_save_LIBS="$LIBS"
  1096. LIBS="$all_libraries -ltiff $LIBJPEG $LIBZ -lX11 $LIBSOCKET"
  1097. AC_TRY_LINK(dnl
  1098. [
  1099. #include<tiffio.h>
  1100. ],
  1101.             [return (TIFFOpen( "", "r") == 0); ],
  1102.             eval "ac_cv_lib_tiff='-ltiff $LIBJPEG $LIBZ'",
  1103.             eval "ac_cv_lib_tiff=no")
  1104. LIBS="$ac_save_LIBS"
  1105. ])dnl
  1106. if eval "test ! "`echo $ac_cv_lib_tiff`" = no"; then
  1107.   AC_DEFINE_UNQUOTED(HAVE_LIBTIFF)
  1108.   LIBTIFF="$ac_cv_lib_tiff"
  1109.   AC_SUBST(LIBTIFF)
  1110.   AC_MSG_RESULT($ac_cv_lib_tiff)
  1111. else
  1112.   AC_MSG_RESULT(no)
  1113.   LIBTIFF=""
  1114.   AC_SUBST(LIBTIFF)
  1115. fi
  1116. ])
  1117. AC_DEFUN(AC_FIND_PNG,
  1118. [
  1119. AC_REQUIRE([AC_FIND_ZLIB])
  1120. AC_MSG_CHECKING([for libpng])
  1121. AC_CACHE_VAL(ac_cv_lib_png,
  1122. [ac_save_LIBS="$LIBS"
  1123. LIBS="$all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
  1124. AC_LANG_C
  1125. AC_TRY_LINK(dnl
  1126.     [
  1127.     #include<png.h>
  1128.     ],
  1129.     [
  1130.     png_structp png_ptr = png_create_read_struct(  // image ptr
  1131. PNG_LIBPNG_VER_STRING, 0, 0, 0 );
  1132.     return( png_ptr != 0 ); 
  1133.     ],
  1134.     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
  1135.     eval "ac_cv_lib_png=no")
  1136.     LIBS="$ac_save_LIBS"
  1137. ])dnl
  1138. if eval "test ! "`echo $ac_cv_lib_png`" = no"; then
  1139.   AC_DEFINE_UNQUOTED(HAVE_LIBPNG)
  1140.   LIBPNG="$ac_cv_lib_png"
  1141.   AC_SUBST(LIBPNG)
  1142.   AC_MSG_RESULT($ac_cv_lib_png)
  1143. else
  1144.   AC_MSG_RESULT(no)
  1145.   LIBPNG=""
  1146.   AC_SUBST(LIBPNG)
  1147. fi
  1148. ])
  1149. AC_DEFUN(AC_CHECK_BOOL,
  1150. [
  1151. AC_MSG_CHECKING([for bool])
  1152.         AC_CACHE_VAL(ac_cv_have_bool,
  1153.         [
  1154. AC_LANG_CPLUSPLUS
  1155.            AC_TRY_COMPILE([],
  1156.                  [bool aBool = true;],
  1157.                  [ac_cv_have_bool="yes"],
  1158.                  [ac_cv_have_bool="no"])
  1159.         ]) dnl end AC_CHECK_VAL
  1160.         AC_MSG_RESULT($ac_cv_have_bool)
  1161.         if test "$ac_cv_have_bool" = "yes"; then
  1162.          AC_DEFINE(HAVE_BOOL) 
  1163.         fi 
  1164. ])
  1165. AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
  1166. [
  1167. AC_MSG_CHECKING(if you need GNU extensions)
  1168. AC_CACHE_VAL(ac_cv_gnu_extensions,
  1169. [
  1170. cat > conftest.c << EOF
  1171. #include <features.h>
  1172. #ifdef __GNU_LIBRARY__
  1173. yes
  1174. #endif
  1175. EOF
  1176. if (eval "$ac_cpp conftest.c") 2>&5 |
  1177.   egrep "yes" >/dev/null 2>&1; then
  1178.   rm -rf conftest*
  1179.   ac_cv_gnu_extensions=yes
  1180. else
  1181.   ac_cv_gnu_extensions=no
  1182. fi
  1183. ])
  1184. AC_MSG_RESULT($ac_cv_gnu_extensions)
  1185. if test "$ac_cv_gnu_extensions" = "yes"; then
  1186.   AC_DEFINE_UNQUOTED(_GNU_SOURCE)
  1187. fi
  1188. ])
  1189. AC_DEFUN(AC_CHECK_COMPILERS,
  1190. [
  1191.   dnl this is somehow a fat lie, but prevents other macros from double checking
  1192.   AC_PROVIDE([AC_PROG_CC])
  1193.   AC_PROVIDE([AC_PROG_CPP])
  1194.   AC_ARG_ENABLE(debug,[  --enable-debug    creates debugging code [default=no]],
  1195.   [ 
  1196.    if test $enableval = "no"; dnl 
  1197.      then ac_use_debug_code="no"
  1198.      else ac_use_debug_code="yes"
  1199.    fi
  1200.   ], [ac_use_debug_code="no"])
  1201.   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
  1202.    [ 
  1203.     if test $enableval = "no"; then 
  1204.          ac_use_strict_options="no"
  1205.        else 
  1206.          ac_use_strict_options="yes"
  1207.     fi
  1208.    ], [ac_use_strict_options="no"])
  1209. dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
  1210.   AC_MSG_CHECKING(for a C-Compiler)
  1211.   dnl if there is one, print out. if not, don't matter
  1212.   AC_MSG_RESULT($CC) 
  1213.  
  1214.   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
  1215.   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
  1216.   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
  1217.   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in $PATH])
  1218.   AC_PROG_CC_WORKS
  1219.   AC_PROG_CC_GNU
  1220.   if test $ac_cv_prog_gcc = yes; then
  1221.     GCC=yes
  1222.   else
  1223.     GCC=
  1224.   fi
  1225.   if test -z "$CFLAGS"; then
  1226.     if test "$ac_use_debug_code" = "yes"; then
  1227.       AC_PROG_CC_G
  1228.       if test $ac_cv_prog_cc_g = yes; then
  1229.         CFLAGS="-g"
  1230.       fi
  1231.     else
  1232.       if test "$GCC" = "yes"; then
  1233.         CFLAGS="-O2"
  1234.       else
  1235.         CFLAGS=""
  1236.       fi
  1237.     fi
  1238.     if test "$GCC" = "yes"; then
  1239.      CFLAGS="$CFLAGS -Wall"
  1240.      if test "$ac_use_strict_options" = "yes"; then
  1241. CFLAGS="$CFLAGS -W -ansi -pedantic"     
  1242.      fi
  1243.     fi
  1244.   fi
  1245.   case "$host" in 
  1246.   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
  1247.   esac
  1248.   if test -z "$LDFLAGS" && test "$ac_use_debug_code" = "no" && test "$GCC" = "yes"; then
  1249.      LDFLAGS="-s"
  1250.   fi
  1251. dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
  1252. dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
  1253.   AC_MSG_CHECKING(how to run the C preprocessor)
  1254.   # On Suns, sometimes $CPP names a directory.
  1255.   if test -n "$CPP" && test -d "$CPP"; then
  1256.     CPP=
  1257.   fi
  1258.   if test -z "$CPP"; then
  1259.   AC_CACHE_VAL(ac_cv_prog_CPP,
  1260.   [  # This must be in double quotes, not single quotes, because CPP may get
  1261.     # substituted into the Makefile and "${CC-cc}" will confuse make.
  1262.     CPP="${CC-cc} -E"
  1263.     # On the NeXT, cc -E runs the code through the compiler's parser,
  1264.     # not just through cpp.
  1265.     dnl Use a header file that comes with gcc, so configuring glibc    
  1266.     dnl with a fresh cross-compiler works.
  1267.     AC_TRY_CPP([#include <assert.h>
  1268.     Syntax Error], ,
  1269.     CPP="${CC-cc} -E -traditional-cpp"
  1270.     AC_TRY_CPP([#include <assert.h>
  1271.     Syntax Error], , CPP=/lib/cpp))
  1272.     ac_cv_prog_CPP="$CPP"])dnl
  1273.     CPP="$ac_cv_prog_CPP"
  1274.   else
  1275.     ac_cv_prog_CPP="$CPP"
  1276.   fi
  1277.   AC_MSG_RESULT($CPP)
  1278.   AC_SUBST(CPP)dnl
  1279.   AC_MSG_CHECKING(for a C++-Compiler)
  1280.   dnl if there is one, print out. if not, don't matter
  1281.   AC_MSG_RESULT($CXX) 
  1282.  
  1283.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
  1284.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
  1285.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
  1286.   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
  1287.   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in $PATH])
  1288.   AC_PROG_CXX_WORKS
  1289.   AC_PROG_CXX_GNU
  1290.   if test $ac_cv_prog_gxx = yes; then
  1291.     GXX=yes
  1292.   else
  1293.     AC_MSG_CHECKING(whether we are using SPARC CC)
  1294.     GXX=
  1295.     cat > conftest.C << EOF
  1296. #ifdef __SUNPRO_CC
  1297.    yes;
  1298. #endif
  1299. EOF
  1300.     ac_try="$CXX -E conftest.C"
  1301.     if { (eval echo configure:__online__: "$ac_try") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
  1302.       ac_cv_prog_CC=yes
  1303.     else
  1304.       ac_cv_prog_CC=no
  1305.     fi
  1306.     AC_MSG_RESULT($ac_cv_prog_CC)
  1307.   fi
  1308.   if test -z "$CXXFLAGS"; then 
  1309.     if test "$ac_use_debug_code" = "yes"; then
  1310.       AC_PROG_CXX_G
  1311.       if test $ac_cv_prog_cxx_g = yes; then
  1312.         CXXFLAGS="-g"
  1313.       fi
  1314.       if test "$ac_cv_prog_CC" = "yes"; then
  1315.         CXXFLAGS="$CXXFLAGS -pto"
  1316.       fi
  1317.     else
  1318.       if test "$GXX" = "yes"; then
  1319.          CXXFLAGS="-O2"
  1320.       else
  1321.          if test "$ac_cv_prog_CC" = "yes"; then
  1322.             CXXFLAGS="-pto -O2"
  1323.          else
  1324.             CXXFLAGS=""
  1325.          fi
  1326.       fi
  1327.     fi
  1328.     if test "$GXX" = "yes"; then
  1329.        CXXFLAGS="$CXXFLAGS -Wall"
  1330.  
  1331.        if test "$ac_use_strict_options" = "yes"; then
  1332. CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional  -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast  -Wsynth"
  1333.        fi
  1334.        if test "$kde_very_strict" = "yes"; then
  1335.          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion"
  1336.        fi
  1337.     fi
  1338.   fi  
  1339.     case "$host" in
  1340.       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
  1341.     esac    
  1342. ])
  1343. dnl just a wrapper to clean up configure.in
  1344. AC_DEFUN(KDE_PROG_LIBTOOL,
  1345. [
  1346. AC_REQUIRE([AM_ENABLE_SHARED])
  1347. AC_REQUIRE([AM_ENABLE_STATIC])
  1348. dnl libtool is only for C, so I must force him
  1349. dnl to find the correct flags for C++
  1350. ac_save_cc=$CC
  1351. ac_save_cflags="$CFLAGS"
  1352. CC=$CXX
  1353. CFLAGS="$CXXFLAGS"
  1354. AM_PROG_LIBTOOL dnl for libraries
  1355. CC=$ac_save_cc
  1356. CFLAGS="$ac_save_cflags"
  1357. ])
  1358. AC_DEFUN(KDB_DO_IT_ALL,
  1359. [
  1360. AC_CANONICAL_SYSTEM 
  1361. AC_ARG_PROGRAM 
  1362. AM_INIT_AUTOMAKE($1, $2)
  1363. AM_ENABLE_SHARED
  1364. dnl AC_PREFIX_DEFAULT(${KDBDIR:-/usr/local/})
  1365. AC_CHECK_COMPILERS
  1366. KDE_PROG_LIBTOOL
  1367. dnl AM_KDE_WITH_NLS
  1368. AC_PATH_KDB
  1369. ])
  1370. AC_DEFUN(AC_CHECK_RPATH,
  1371. [
  1372. AC_MSG_CHECKING(for rpath)
  1373. AC_ARG_ENABLE(rpath,
  1374.       [  --disable-rpath         do not use the rpath feature of ld],
  1375.       USE_RPATH=$enableval, USE_RPATH=yes)
  1376. if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
  1377.   KDE_RPATH="-rpath $(kde_libraries)"
  1378.   if test -n "$qt_libraries"; then
  1379.     KDE_RPATH="$KDE_RPATH -rpath $(qt_libraries)"
  1380.   fi
  1381.   dnl $x_libraries is set to /usr/lib in case
  1382.   if test -n "$X_LDFLAGS"; then 
  1383.     KDE_RPATH="$KDE_RPATH -rpath $(x_libraries)"
  1384.   fi
  1385.   if test -n "$KDE_EXTRA_RPATH"; then
  1386.     KDE_RPATH="$KDE_RPATH $(KDE_EXTRA_RPATH)"
  1387.   fi
  1388. fi 
  1389. AC_SUBST(KDE_EXTRA_RPATH)
  1390. AC_SUBST(KDE_RPATH)
  1391. AC_MSG_RESULT($USE_RPATH)
  1392. ])
  1393. dnl Check for the type of the third argument of getsockname
  1394. AC_DEFUN(AC_CHECK_KSIZE_T,
  1395. [AC_MSG_CHECKING(for the third argument of getsockname)  
  1396. AC_LANG_CPLUSPLUS
  1397. AC_CACHE_VAL(ac_cv_ksize_t,
  1398. [AC_TRY_COMPILE([
  1399. #include <sys/types.h>
  1400. #include <sys/socket.h>
  1401. ],[
  1402. socklen_t a=0; 
  1403. getsockname(0,(struct sockaddr*)0, &a);
  1404. ],
  1405. ac_cv_ksize_t=socklen_t,
  1406. ac_cv_ksize_t=)
  1407. if test -z "$ac_cv_ksize_t"; then
  1408. ac_safe_cxxflags="$CXXFLAGS"
  1409. if test "$GCC" = "yes"; then
  1410.   CXXFLAGS="-Werror $CXXFLAGS"
  1411. fi
  1412. AC_TRY_COMPILE([
  1413. #include <sys/types.h>
  1414. #include <sys/socket.h>
  1415. ],[
  1416. int a=0; 
  1417. getsockname(0,(struct sockaddr*)0, &a);
  1418. ],
  1419. ac_cv_ksize_t=int,
  1420. ac_cv_ksize_t=size_t)
  1421. CXXFLAGS="$ac_safe_cxxflags"
  1422. fi
  1423. ])
  1424. if test -z "$ac_cv_ksize_t"; then
  1425.   ac_cv_ksize_t=int
  1426. fi
  1427. AC_MSG_RESULT($ac_cv_ksize_t)
  1428. AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t)
  1429. ])
  1430. dnl This is a merge of some macros out of the gettext aclocal.m4
  1431. dnl since we don't need anything, I took the things we need
  1432. AC_DEFUN(AM_KDE_WITH_NLS,
  1433.   [AC_MSG_CHECKING([whether NLS is requested])
  1434.     AC_LANG_CPLUSPLUS
  1435.     dnl Default is enabled NLS
  1436.     AC_ARG_ENABLE(nls,
  1437.       [  --disable-nls           do not use Native Language Support],
  1438.       USE_NLS=$enableval, USE_NLS=yes)
  1439.     AC_MSG_RESULT($USE_NLS)
  1440.     AC_SUBST(USE_NLS)
  1441.     dnl If we use NLS figure out what method
  1442.     if test "$USE_NLS" = "yes"; then
  1443.       AC_DEFINE(ENABLE_NLS)
  1444.       AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, 
  1445.          [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
  1446.       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  1447.       if test -z "`$MSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
  1448.         AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
  1449.         msgfmt=":"
  1450.       fi
  1451.       AC_SUBST(MSGFMT)
  1452.       AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
  1453. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  1454.       dnl Test whether we really found GNU xgettext.
  1455.       if test "$XGETTEXT" != ":"; then
  1456. dnl If it is no GNU xgettext we define it as : so that the
  1457. dnl Makefiles still can work.
  1458. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  1459.   : ;
  1460. else
  1461.   AC_MSG_RESULT(
  1462.     [found xgettext programs is not GNU xgettext; ignore it])
  1463.   XGETTEXT=":"
  1464. fi
  1465.       fi
  1466.      AC_SUBST(XGETTEXT)
  1467.     fi
  1468.   ])
  1469. # Search path for a program which passes the given test.
  1470. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  1471. # serial 1
  1472. # Stephan Kulow: I appended a _KDE against name conflicts
  1473. dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
  1474. dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  1475. AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
  1476. [# Extract the first word of "$2", so it can be a program name with args.
  1477. set dummy $2; ac_word=[$]2
  1478. AC_MSG_CHECKING([for $ac_word])
  1479. AC_CACHE_VAL(ac_cv_path_$1,
  1480. [case "[$]$1" in
  1481.   /*)
  1482.   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  1483.   ;;
  1484.   *)
  1485.   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  1486.   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  1487.     test -z "$ac_dir" && ac_dir=.
  1488.     if test -f $ac_dir/$ac_word; then
  1489.       if [$3]; then
  1490. ac_cv_path_$1="$ac_dir/$ac_word"
  1491. break
  1492.       fi
  1493.     fi
  1494.   done
  1495.   IFS="$ac_save_ifs"
  1496. dnl If no 4th arg is given, leave the cache variable unset,
  1497. dnl so AC_PATH_PROGS will keep looking.
  1498. ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  1499. ])dnl
  1500.   ;;
  1501. esac])dnl
  1502. $1="$ac_cv_path_$1"
  1503. if test -n "[$]$1"; then
  1504.   AC_MSG_RESULT([$]$1)
  1505. else
  1506.   AC_MSG_RESULT(no)
  1507. fi
  1508. AC_SUBST($1)dnl
  1509. ])
  1510. # Check whether LC_MESSAGES is available in <locale.h>.
  1511. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  1512.  
  1513. # serial 1
  1514.  
  1515. AC_DEFUN(AM_LC_MESSAGES,
  1516.   [if test $ac_cv_header_locale_h = yes; then
  1517.     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  1518.       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  1519.        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  1520.     if test $am_cv_val_LC_MESSAGES = yes; then
  1521.       AC_DEFINE(HAVE_LC_MESSAGES)
  1522.     fi
  1523.   fi])
  1524.  
  1525. dnl From Jim Meyering.
  1526. dnl FIXME: migrate into libit.
  1527. AC_DEFUN(AM_FUNC_OBSTACK,
  1528. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  1529.  [AC_TRY_LINK([#include "obstack.h"],
  1530.       [struct obstack *mem;obstack_free(mem,(char *) 0)],
  1531.       am_cv_func_obstack=yes,
  1532.       am_cv_func_obstack=no)])
  1533.  if test $am_cv_func_obstack = yes; then
  1534.    AC_DEFINE(HAVE_OBSTACK)
  1535.  else
  1536.    LIBOBJS="$LIBOBJS obstack.o"
  1537.  fi
  1538. ])
  1539. dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
  1540. dnl FIXME: Migrate into libit
  1541. AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
  1542. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  1543.  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  1544.               am_cv_lib_error_at_line=yes,
  1545.       am_cv_lib_error_at_line=no)])
  1546.  if test $am_cv_lib_error_at_line = no; then
  1547.    LIBOBJS="$LIBOBJS error.o"
  1548.  fi
  1549.  AC_SUBST(LIBOBJS)dnl
  1550. ])
  1551. # Macro to add for using GNU gettext.
  1552. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  1553. # serial 1
  1554. # Stephan Kulow: I put a KDE in it to avoid name conflicts
  1555. AC_DEFUN(AM_KDE_GNU_GETTEXT,
  1556.   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  1557.    AC_REQUIRE([AC_PROG_RANLIB])dnl
  1558.    AC_REQUIRE([AC_HEADER_STDC])dnl
  1559.    AC_REQUIRE([AC_C_INLINE])dnl
  1560.    AC_REQUIRE([AC_TYPE_OFF_T])dnl
  1561.    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  1562.    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  1563.    AC_REQUIRE([AC_FUNC_MMAP])dnl
  1564.    AC_REQUIRE([AM_KDE_WITH_NLS])dnl
  1565.    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h 
  1566. unistd.h values.h alloca.h])
  1567.    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp 
  1568. __argz_count __argz_stringify __argz_next stpcpy])
  1569.    AM_LC_MESSAGES
  1570.    if test "x$CATOBJEXT" != "x"; then
  1571.      if test "x$ALL_LINGUAS" = "x"; then
  1572.        LINGUAS=
  1573.      else
  1574.        AC_MSG_CHECKING(for catalogs to be installed)
  1575.        NEW_LINGUAS=
  1576.        for lang in ${LINGUAS=$ALL_LINGUAS}; do
  1577.          case "$ALL_LINGUAS" in
  1578.           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  1579.          esac
  1580.        done
  1581.        LINGUAS=$NEW_LINGUAS
  1582.        AC_MSG_RESULT($LINGUAS)
  1583.      fi
  1584.      dnl Construct list of names of catalog files to be constructed.
  1585.      if test -n "$LINGUAS"; then
  1586.        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  1587.      fi
  1588.    fi
  1589.   ])
  1590. AC_DEFUN(AC_HAVE_XPM,
  1591.  [AC_REQUIRE_CPP()dnl
  1592.  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
  1593.  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
  1594.  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
  1595. xpm_test=$withval, xpm_test="yes")
  1596.  if test "x$xpm_test" = xno; then
  1597.    ac_cv_have_xpm=no
  1598.  else
  1599.    AC_MSG_CHECKING(for XPM)
  1600.    AC_CACHE_VAL(ac_cv_have_xpm,
  1601.    [
  1602.     AC_LANG_C
  1603.     ac_save_ldflags="$LDFLAGS"
  1604.     ac_save_cflags="$CFLAGS"
  1605.     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
  1606.     CFLAGS="$CFLAGS $X_INCLUDES"
  1607.     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
  1608.     AC_TRY_LINK([#include <X11/xpm.h>],[],
  1609. ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
  1610.     LDFLAGS="$ac_save_ldflags"
  1611.     CFLAGS="$ac_save_cflags"
  1612.    ])dnl
  1613.  
  1614.   if test "$ac_cv_have_xpm" = no; then
  1615.     AC_MSG_RESULT(no)
  1616.     XPM_LDFLAGS=""
  1617.     XPMINC=""
  1618.     $2
  1619.   else
  1620.     AC_DEFINE(HAVE_XPM)
  1621.     if test "$XPM_LDFLAGS" = ""; then
  1622.        XPMLIB="-lXpm"
  1623.     else
  1624.        XPMLIB="-L$XPM_LDFLAGS -lXpm"
  1625.     fi
  1626.     if test "$XPM_INCLUDE" = ""; then
  1627.        XPMINC=""
  1628.     else
  1629.        XPMINC="-I$XPM_INCLUDE"
  1630.     fi
  1631.     AC_MSG_RESULT(yes)
  1632.     $1
  1633.   fi
  1634.  fi
  1635.  AC_SUBST(XPMINC)
  1636.  AC_SUBST(XPMLIB)
  1637. ]) 
  1638. AC_DEFUN(AC_HAVE_GL,
  1639.  [AC_REQUIRE_CPP()dnl
  1640.  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
  1641.  test -z "$GL_INCLUDE" && GL_INCLUDE=
  1642.  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
  1643. gl_test=$withval, gl_test="yes")
  1644.  if test "x$gl_test" = xno; then
  1645.    ac_cv_have_gl=no
  1646.  else
  1647.    AC_MSG_CHECKING(for GL)
  1648.    AC_CACHE_VAL(ac_cv_have_gl,
  1649.    [
  1650.     AC_LANG_C
  1651.     ac_save_ldflags="$LDFLAGS"
  1652.     ac_save_cflags="$CFLAGS"
  1653.     LDFLAGS="$LDFLAGS $GL_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
  1654.     CFLAGS="$CFLAGS $X_INCLUDES"
  1655.     test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  1656.     AC_TRY_LINK([],[],
  1657. ac_cv_have_gl="yes",ac_cv_have_gl="no")
  1658.     LDFLAGS="$ac_save_ldflags"
  1659.     CFLAGS="$ac_save_cflags"
  1660.    ])dnl
  1661.  
  1662.   if test "$ac_cv_have_gl" = no; then
  1663.     AC_MSG_RESULT(no)
  1664.     GL_LDFLAGS=""
  1665.     GLINC=""
  1666.     $2
  1667.   else
  1668.     AC_DEFINE(HAVE_GL)
  1669.     if test "$GL_LDFLAGS" = ""; then
  1670.        GLLIB="-lMesaGL -lMesaGLU"
  1671.     else
  1672.        GLLIB="-L$GL_LDFLAGS -lMesaGL -lMesaGLU"
  1673.     fi
  1674.     if test "$GL_INCLUDE" = ""; then
  1675.        GLINC=""
  1676.     else
  1677.        GLINC="-I$GL_INCLUDE"
  1678.     fi
  1679.     AC_MSG_RESULT(yes)
  1680.     $1
  1681.   fi
  1682.  fi
  1683.  AC_SUBST(GLINC)
  1684.  AC_SUBST(GLLIB)
  1685. ]) 
  1686.  dnl PAM pam
  1687.  
  1688.  dnl Should test for PAM (Pluggable Authentication Modules)
  1689.  AC_DEFUN(AC_PATH_PAM_DIRECT,
  1690.  [
  1691.  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
  1692.  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
  1693.  
  1694.    for ac_dir in               
  1695.                                
  1696.      /usr/local/include        
  1697.      /usr/include              
  1698.      /usr/unsupported/include  
  1699.      /opt/include              
  1700.      /usr/pam/include          
  1701.      /usr/local/pam/include    
  1702.      /usr/lib/pam/include      
  1703.         
  1704.      $extra_include            
  1705.      ; 
  1706.    do
  1707.      if test -r "$ac_dir/$pam_direct_test_include"; then
  1708.        no_pam= ac_pam_includes=$ac_dir
  1709.        break
  1710.      fi
  1711.    done
  1712.  
  1713.  # First see if replacing the include by lib works.
  1714.  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` 
  1715.                            
  1716.      /lib                  
  1717.      /usr/lib              
  1718.      /usr/local/lib        
  1719.      /usr/unsupported/lib  
  1720.      /lib/security         
  1721.      /usr/security/lib     
  1722.      $extra_lib            
  1723.      ; 
  1724.  do
  1725.    for ac_extension in a so sl; do
  1726.      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
  1727.        no_pam= ac_pam_libraries=$ac_dir
  1728.        break 2
  1729.      fi
  1730.    done
  1731.  done
  1732. ])
  1733. AC_DEFUN(AC_PATH_PAM,
  1734.  [AC_REQUIRE_CPP()dnl
  1735.   AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"], [], [-lpam -ldl])
  1736.  AC_MSG_CHECKING(for PAM)
  1737.  AC_ARG_WITH(pam, 
  1738. [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
  1739.   [
  1740.     if test "x$withval" = "xyes"; then
  1741.       no_pam=
  1742.       default_pam=yes
  1743.     elif test "x$withval" = "xno"; then
  1744.       no_pam=yes
  1745.     else
  1746.       no_pam=
  1747.       pam_service="$withval"
  1748.         if test -z "$pam_service"; then
  1749.         default_pam=yes
  1750.         else
  1751.         default_pam=
  1752.         fi 
  1753.       fi
  1754.   ], no_pam=yes
  1755.  )
  1756.  if test ! "$no_pam" = yes; then
  1757.  AC_CACHE_VAL(ac_cv_path_pam,
  1758.  [
  1759.  ac_pam_includes=NONE
  1760.  ac_pam_libraries=NONE
  1761.  if test -z "$pam_libraries"; then
  1762.    pam_libraries=NONE
  1763.  fi
  1764.  if test -z "$pam_includes"; then
  1765.    pam_includes=NONE
  1766.  fi
  1767.  AC_PATH_PAM_DIRECT
  1768.  
  1769.  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
  1770.  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
  1771.  
  1772.  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
  1773.    ac_pam_libs="-lpam $PAM_MISC_LIB -ldl"
  1774.    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs="$ac_pam_libs""
  1775.  else
  1776.    ac_cv_path_pam="no_pam=yes"
  1777.  fi
  1778.  ])
  1779.  eval "$ac_cv_path_pam"
  1780.  
  1781.  fi
  1782.  if test "$no_pam" = yes; then
  1783.    AC_MSG_RESULT(no)
  1784.  else
  1785.    AC_DEFINE(HAVE_PAM)
  1786.    PAMLIBS="$ac_pam_libs"
  1787.    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
  1788.    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
  1789.    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
  1790.  if test "$default_pam" = yes; then
  1791.    AC_MSG_RESULT(["default pam service name will be used"])
  1792.  else
  1793.    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service")
  1794.    AC_MSG_RESULT(["pam service name will be: " $pam_service])
  1795.  fi
  1796. dnl test whether struct pam_message is const (Linux) or not (Sun)
  1797.    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
  1798.    AC_MSG_CHECKING(for const pam_message)
  1799.    AC_EGREP_HEADER([struct pam_message],
  1800.       $pam_appl_h,
  1801.       [ AC_EGREP_HEADER([const struct pam_message],
  1802.                         $pam_appl_h,
  1803.                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
  1804.                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
  1805.                         AC_DEFINE(PAM_MESSAGE_NONCONST)] 
  1806.                         )],
  1807.        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
  1808.        )
  1809.  fi
  1810.  
  1811.  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
  1812.      PAMLIBPATHS="-L$pam_libraries"
  1813.  fi
  1814.  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
  1815.      PAMINC="-I$pam_includes"
  1816.  fi
  1817.  
  1818.  AC_SUBST(PAMINC)
  1819.  AC_SUBST(PAMLIBS)
  1820.  AC_SUBST(PAMLIBPATHS)
  1821. ]) 
  1822. AC_DEFUN(KDE_CHECK_LIBDL,
  1823. [
  1824. AC_CHECK_LIB(dl, dlopen, [
  1825. LIBDL="-ldl"
  1826. ac_cv_have_dlfcn=yes
  1827. ])
  1828. AC_CHECK_LIB(dld, shl_unload, [
  1829. LIBDL="-ldld"
  1830. ac_cv_have_shload=yes
  1831. ])
  1832. AC_SUBST(LIBDL)
  1833. ])
  1834. AC_DEFUN(KDE_CHECK_DLOPEN,
  1835. [
  1836. KDE_CHECK_LIBDL
  1837. AC_CHECK_HEADERS(dlfcn.h dl.h)
  1838. if test "$ac_cv_header_dlfcn_h" = "no"; then
  1839.   ac_cv_have_dlfcn=no
  1840. fi
  1841. if test "$ac_cv_header_dl_h" = "no"; then
  1842.   ac_cv_have_shload=no
  1843. fi
  1844. enable_dlopen=no
  1845. AC_ARG_ENABLE(dlopen,
  1846. [  --disable-dlopen        link staticly [default=no]] ,
  1847. [if test "$enableval" = yes; then
  1848.   enable_dlopen=yes
  1849. fi],
  1850. enable_dlopen=yes)
  1851. # override the user's opinion, if we know it better ;)
  1852. if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
  1853.   enable_dlopen=no
  1854. fi
  1855. if test "$ac_cv_have_dlfcn" = "yes"; then
  1856.   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
  1857. fi
  1858. if test "$ac_cv_have_shload" = "yes"; then
  1859.   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
  1860. fi
  1861. if test "$enable_dlopen" = no ; then
  1862.   test -n "$1" && eval $1
  1863. else
  1864.   test -n "$2" && eval $2
  1865. fi
  1866. ])
  1867. AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
  1868. [
  1869. KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
  1870. KDE_PROG_LIBTOOL
  1871. AC_MSG_CHECKING([dynamic loading])
  1872. eval "`egrep '^build_libtool_libs=' libtool`"
  1873. if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
  1874.   dynamic_loading=yes
  1875.   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
  1876. else
  1877.   dynamic_loading=no
  1878. fi
  1879. AC_MSG_RESULT($dynamic_loading)
  1880. if test "$dynamic_loading" = "yes"; then
  1881.   $1
  1882. else
  1883.   $2
  1884. fi
  1885. ])
  1886. AC_DEFUN(KDE_ADD_INCLUDES,
  1887. [
  1888. if test -z "$1"; then 
  1889.   test_include="Pix.h"
  1890. else
  1891.   test_include="$1"
  1892. fi
  1893. AC_MSG_CHECKING([for libg++ ($test_include)])
  1894. AC_CACHE_VAL(kde_cv_libgpp_includes,
  1895. [
  1896. kde_cv_libgpp_includes=no
  1897.    for ac_dir in               
  1898.                                
  1899.      /usr/include/g++          
  1900.      /usr/include              
  1901.      /usr/unsupported/include  
  1902.      /opt/include              
  1903.      $extra_include            
  1904.      ; 
  1905.    do
  1906.      if test -r "$ac_dir/$test_include"; then
  1907.        kde_cv_libgpp_includes=$ac_dir
  1908.        break
  1909.      fi
  1910.    done
  1911. ])
  1912. AC_MSG_RESULT($kde_cv_libgpp_includes)
  1913. if test "$kde_cv_libgpp_includes" != "no"; then
  1914.   all_includes="-I$kde_cv_libgpp_includes $all_includes"
  1915. fi
  1916. ])
  1917. ])
  1918. AC_DEFUN(KDE_CHECK_MICO,
  1919. [
  1920. AC_REQUIRE([KDE_CHECK_LIBDL])
  1921. AC_MSG_CHECKING(for MICO)
  1922. AC_ARG_WITH(micodir,
  1923.   [  --with-micodir=micodir  where mico is installed ],
  1924.   kde_micodir=$withval,
  1925.   kde_micodir=/usr/local
  1926. )
  1927. AC_MSG_RESULT($kde_micodir)
  1928. if test ! -r  $kde_micodir/include/CORBA.h; then
  1929.   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
  1930. fi
  1931. MICO_INCLUDES=-I$kde_micodir/include
  1932. AC_SUBST(MICO_INCLUDES)
  1933. MICO_LDFLAGS=-L$kde_micodir/lib
  1934. AC_SUBST(MICO_LDFLAGS)
  1935. AC_MSG_CHECKING([for MICO version])
  1936. AC_CACHE_VAL(kde_cv_mico_version,
  1937. [
  1938. AC_LANG_C
  1939. cat >conftest.$ac_ext <<EOF
  1940. #include <stdio.h>
  1941. #include <mico/version.h>
  1942. int main() { 
  1943.     
  1944.    printf("MICO_VERSION=%sn",MICO_VERSION); 
  1945.    return (0); 
  1946. }
  1947. EOF
  1948. ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
  1949. if AC_TRY_EVAL(ac_compile); then
  1950.   if eval `./conftest 2>&5`; then
  1951.     kde_cv_mico_version=$MICO_VERSION
  1952.   else
  1953.     AC_MSG_ERROR([your system is not able to execute a small application to
  1954.     find MICO version! Check $kde_micodir/include/mico/version.h])
  1955.   fi 
  1956. else
  1957.   AC_MSG_ERROR([your system is not able to compile a small application to
  1958.   find MICO version! Check $kde_micodir/include/mico/version.h])
  1959. fi
  1960. ])
  1961. dnl installed MICO version
  1962. mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^(.*)..*..*$/1/'`
  1963. mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*.(.*)..*$/1/'`
  1964. mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*..*.(.*)$/1/'`
  1965. dnl required MICO version
  1966. req_v_maj=`echo $1 | sed -e 's/^(.*)..*..*$/1/'`
  1967. req_v_mid=`echo $1 | sed -e 's/^.*.(.*)..*$/1/'`
  1968. req_v_min=`echo $1 | sed -e 's/^.*..*.(.*)$/1/'` 
  1969. if test "$mico_v_maj" -lt "$req_v_maj" || 
  1970.    ( test "$mico_v_maj" -eq "$req_v_maj" && 
  1971.         test "$mico_v_mid" -lt "$req_v_mid" ) || 
  1972.    ( test "$mico_v_mid" -eq "$req_v_mid" && 
  1973.         test "$mico_v_min" -lt "$req_v_min" )
  1974. then
  1975.   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $1 
  1976. at least is required. You should upgrade MICO.])
  1977. else
  1978.   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $1, ok)])
  1979. fi
  1980. LIBMICO="-lmico$kde_cv_mico_version $LIBDL"
  1981. AC_SUBST(LIBMICO)
  1982. IDL=$kde_micodir/bin/idl
  1983. AC_SUBST(IDL)
  1984. ])
  1985. AC_DEFUN(KDE_CHECK_MINI_STL,
  1986. [
  1987. AC_REQUIRE([KDE_CHECK_MICO])
  1988. AC_MSG_CHECKING(if we use mico's mini-STL)
  1989. AC_CACHE_VAL(kde_cv_have_mini_stl,
  1990. [
  1991. AC_LANG_CPLUSPLUS
  1992. kde_save_cxxflags="$CXXFLAGS"
  1993. CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
  1994. AC_TRY_COMPILE(
  1995. [
  1996. #include <mico/config.h>
  1997. ],
  1998. [
  1999. #ifdef HAVE_MINI_STL
  2000. #error "nothing"
  2001. #endif
  2002. ],
  2003. kde_cv_have_mini_stl=no,
  2004. kde_cv_have_mini_stl=yes)
  2005. CXXFLAGS="$kde_save_cxxflags"
  2006. ])
  2007. AC_MSG_RESULT($kde_cv_have_mini_stl)
  2008. if test "$kde_cv_have_mini_stl" = "yes"; then
  2009.   AC_DEFINE_UNQUOTED(HAVE_MINI_STL)
  2010. fi
  2011. ])
  2012. ])
  2013. AC_DEFUN(KDE_CHECK_LIBPTHREAD,
  2014. [
  2015. AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= )
  2016. AC_SUBST(LIBPTHREAD)
  2017. ])
  2018. AC_DEFUN(KDE_TRY_LINK_PYTHON,
  2019. [
  2020. AC_CACHE_VAL(kde_cv_try_link_python_$1,
  2021. [
  2022. kde_save_cxxflags="$CXXFLAGS"
  2023. CXXFLAGS="$CXXFLAGS $PYTHONINC"
  2024. kde_save_libs="$LIBS"
  2025. LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
  2026. kde_save_ldflags="$LDFLAGS"
  2027. LDFLAGS="$LDFLAGS $PYTHONLIB"
  2028. AC_TRY_LINK(
  2029. [
  2030. #include <Python.h>
  2031. ],[
  2032. PySys_SetArgv(1, 0);
  2033. ],
  2034. [kde_cv_try_link_python_$1=yes],
  2035. [kde_cv_try_link_python_$1=no]
  2036. )
  2037. CXXFLAGS="$kde_save_cxxflags"
  2038. LIBS="$kde_save_libs"
  2039. LDFLAGS="$kde_save_ldflags"
  2040. ])
  2041. if test "$kde_cv_try_link_python_$1" = "yes"; then
  2042.   $3
  2043. else
  2044.   $4
  2045. fi
  2046. ])
  2047. AC_DEFUN(KDE_CHECK_PYTHON,
  2048. [
  2049. AC_REQUIRE([KDE_CHECK_LIBDL])
  2050. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  2051. if test -z "$1"; then 
  2052.   version="1.5"
  2053. else
  2054.   version="$1"
  2055. fi
  2056. AC_MSG_CHECKING([for Python$version])
  2057. AC_ARG_WITH(pythondir, 
  2058. [  --with-pythondir=pythondir   use python installed in pythondir ],
  2059. [
  2060.   ac_python_dir=$withval
  2061. ], ac_python_dir=/usr/local
  2062. )
  2063. python_incdirs="$ac_python_dir/include/python$version /usr/include/python$version /usr/local/include/python$version /usr/local/include"
  2064. AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
  2065. if test ! -r $python_incdir/Python.h; then
  2066.   AC_MSG_ERROR(Python.h not found.)
  2067. fi
  2068. PYTHONINC=-I$python_incdir
  2069. python_libdirs="$ac_python_dir/lib/python$version/config /usr/lib/python$version/config /usr/local/python$version/config"
  2070. AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
  2071. if test ! -r $python_libdir/libpython$version.a; then
  2072.   AC_MSG_ERROR(libpython$version.a not found.)
  2073. fi
  2074. PYTHONLIB=-L$python_libdir
  2075. LIBPYTHON=-lpython$version
  2076. AC_MSG_RESULT(header $python_incdir library $python_libdir)
  2077. dnl Note: this test is very weak
  2078. AC_MSG_CHECKING(if an Python application links)
  2079. KDE_TRY_LINK_PYTHON(normal, "", AC_MSG_RESULT(yes),
  2080.  [
  2081.     AC_MSG_RESULT(no)
  2082.     AC_MSG_CHECKING(if Python depends on -lpthread)
  2083.     KDE_TRY_LINK_PYTHON(pthread, "$LIBPTHREAD",
  2084.     [  
  2085.        AC_MSG_RESULT(yes)
  2086.        LIBPYTHON="$LIBPYTHON $LIBPTHREAD $LIBDL"
  2087.     ],
  2088.     [
  2089.        AC_MSG_RESULT(no)
  2090.        AC_MSG_CHECKING(if Python depeds on -ltcl)
  2091.        KDE_TRY_LINK_PYTHON(tcl, "-ltcl",
  2092.        [
  2093.   AC_MSG_RESULT(yes)
  2094.   LIBPYTHON="$LIBPYTHON -ltcl"
  2095.        ],
  2096.        [
  2097.   AC_MSG_RESULT(no)
  2098. AC_MSG_WARN([it seems, Python depends on another library. 
  2099.     Pleae use "make LIBPTYHON='-lpython$version -lotherlib'" to fix this
  2100.     and contact the authors to let them know about this problem])
  2101. ])
  2102.     ])
  2103.  ]) 
  2104. AC_SUBST(PYTHONINC)
  2105. AC_SUBST(PYTHONLIB)
  2106. AC_SUBST(LIBPYTHON)
  2107. ])
  2108. AC_DEFUN(KDE_CHECK_STL_SGI,
  2109. [
  2110.     AC_MSG_CHECKING([if STL implementation is SGI like])
  2111.     AC_CACHE_VAL(kde_cv_stl_type_sgi,
  2112.     [
  2113.       AC_TRY_COMPILE([
  2114. #include <string>
  2115. ],[
  2116.   string astring="Hallo Welt.";
  2117.   astring.erase(0, 6); // now astring is "Welt"
  2118.   return 0;
  2119. ], kde_cv_stl_type_sgi=yes,
  2120.    kde_cv_stl_type_sgi=no)
  2121. ])
  2122.    AC_MSG_RESULT($kde_cv_stl_type_sgi)
  2123.    if test "$kde_cv_stl_type_sgi" = "yes"; then
  2124. AC_DEFINE_UNQUOTED(HAVE_SGI_STL) 
  2125.    fi
  2126. ])
  2127. AC_DEFUN(KDE_CHECK_STL_HP,
  2128. [
  2129.     AC_MSG_CHECKING([if STL implementation is HP like])
  2130.     AC_CACHE_VAL(kde_cv_stl_type_hp,
  2131.     [
  2132.       AC_TRY_COMPILE([
  2133. #include <string>
  2134. ],[
  2135.   string astring="Hello World";
  2136.   astring.remove(0, 6); // now astring is "World"
  2137.   return 0;
  2138. ], kde_cv_stl_type_hp=yes,
  2139.    kde_cv_stl_type_hp=no)
  2140. ])
  2141.    AC_MSG_RESULT($kde_cv_stl_type_hp)
  2142.    if test "$kde_cv_stl_type_hp" = "yes"; then
  2143. AC_DEFINE_UNQUOTED(HAVE_HP_STL) 
  2144.    fi
  2145. ])
  2146. AC_DEFUN(KDE_CHECK_STL,
  2147. [
  2148.     KDE_CHECK_STL_SGI
  2149.     
  2150.     if test "$kde_cv_stl_type_sgi" = "no"; then
  2151.        KDE_CHECK_STL_HP
  2152.        if test "$kde_cv_stl_type_hp" = "no"; then
  2153.          AC_MSG_ERROR("no known STL type found")
  2154.        fi
  2155.     fi
  2156. ])
  2157. AC_DEFUN(AC_FIND_QIMGIO,
  2158.    [AC_REQUIRE([AC_FIND_JPEG])
  2159. AC_MSG_CHECKING([for qimgio])
  2160. AC_CACHE_VAL(ac_cv_lib_qimgio,
  2161. [ac_save_LIBS="$LIBS"
  2162. LIBS="$all_libraries -lqimgio -lpng -lz -lqt $LIBJPEG -lX11 $LIBSOCKET"
  2163. AC_TRY_LINK(dnl
  2164. [
  2165. void qInitImageIO ();
  2166. ],
  2167.             [qInitImageIO();],
  2168.             eval "ac_cv_lib_qimgio=yes",
  2169.             eval "ac_cv_lib_qimgio=no")
  2170. LIBS="$ac_save_LIBS"
  2171. ])dnl
  2172. if eval "test "`echo $ac_cv_lib_qimgio`" = yes"; then
  2173.   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
  2174.   AC_MSG_RESULT(yes)
  2175.   AC_DEFINE_UNQUOTED(HAVE_QIMGIO)
  2176.   AC_SUBST(LIBQIMGIO)
  2177. else
  2178.   AC_MSG_RESULT(not found)
  2179. fi
  2180. ])
  2181. AC_DEFUN(KDE_CHECK_ANSI,
  2182. [
  2183. AC_MSG_CHECKING([for strdup])
  2184.     AC_CACHE_VAL(kde_cv_stl_type_sgi,
  2185.     [
  2186. AC_LANG_CPLUSPLUS
  2187. save_CXXFLAGS="$CXXFLAGS"
  2188. if test "$GCC" = "yes"; then
  2189.   CXXFLAGS="$CXXFLAGS -pedantic-errors"
  2190. fi
  2191. AC_TRY_COMPILE([
  2192. #include <string.h>
  2193. ],[
  2194.   char buffer[] = "Hallo";
  2195.   strdup(buffer)
  2196. ], kde_cv_has_strdup=yes,
  2197.    kde_cv_has_strdup=no)
  2198. CXXFLAGS="$save_CXXFLAGS"
  2199. ])
  2200. AC_MSG_RESULT($kde_cv_has_strdup)
  2201. if test "$kde_cv_has_strdup" = "yes"; then
  2202.   AC_DEFINE_UNQUOTED(HAVE_STRDUP)
  2203. fi
  2204. ])
  2205. AC_DEFUN(KDE_CHECK_INSURE,
  2206. [
  2207.   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
  2208.   [
  2209.   if test $enableval = "no"; dnl
  2210. then ac_use_insure="no"
  2211. else ac_use_insure="yes"
  2212.    fi
  2213.   ], [ac_use_insure="no"])
  2214.   AC_MSG_CHECKING(if we will use Insure++ to debug)
  2215.   AC_MSG_RESULT($ac_use_insure)
  2216.   if test "$ac_use_insure" = "yes"; dnl
  2217.        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
  2218.    fi
  2219. ])          
  2220. dnl this is for kdm:
  2221. AC_DEFUN(AC_CHECK_KDM,
  2222. [
  2223. AC_CHECK_FUNCS(getsecretkey)
  2224. dnl checks for X server
  2225. AC_PATH_PROG(X_SERVER, X)
  2226. if test ! -z "$X_SERVER"; then
  2227. X_SERVER=`echo $X_SERVER | sed -e 's+/X$++'`
  2228. AC_DEFINE_UNQUOTED(XBINDIR,$X_SERVER)
  2229. XBINDIR=$X_SERVER
  2230. AC_SUBST(XBINDIR)
  2231. fi
  2232. dnl This one tries to find XDMDIR for config files
  2233. AC_ARG_WITH(xdmdir,
  2234. [  --with-xdmdir           If the xdm config dir can't be found automaticly],
  2235. [ ac_xdmdir=$withval],
  2236. [ ac_xdmdir="no"])
  2237. AC_MSG_CHECKING([for xdm configuration dir])
  2238. if test "$ac_xdmdir" = "no"; then
  2239.     rm -fr conftestdir
  2240.     if mkdir conftestdir; then
  2241. cd conftestdir
  2242.     cat > Imakefile <<'EOF'
  2243. acfindxdm:
  2244. @echo 'ac_xdmdir="$(XDMDIR)";'
  2245. EOF
  2246. if (xmkmf) > /dev/null 2> /dev/null && test -f Makefile; then
  2247.     eval `${MAKE-make} acfindxdm 2>/dev/null 2>/dev/null | grep -v make`
  2248. fi
  2249. cd ..
  2250. rm -fr conftestdir
  2251. dnl Check if Imake was right
  2252. if test -f $ac_xdmdir/xdm-config; then
  2253.     AC_MSG_RESULT($ac_xdmdir)
  2254. else
  2255.     dnl Here we must do something else
  2256.     dnl Maybe look for xdm-config in standard places, and
  2257.     dnl if that fails use a fresh copy in $KDEDIR/config/kdm/
  2258.     AC_FIND_FILE(xdm-config,/etc/X11/xdm /var/X11/xdm /usr/openwin/xdm /usr/X11R6/lib/X11/xdm,ac_xdmdir)
  2259.     if test -f $ac_xdmdir/xdm-config; then
  2260.                 AC_MSG_RESULT($ac_xdmdir)
  2261.             else                                 
  2262. if test "${prefix}" = NONE; then
  2263. ac_xdmdir=$ac_default_prefix/config/kdm
  2264. else
  2265. ac_xdmdir=$prefix/config/kdm
  2266. fi
  2267. AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir])
  2268. xdmconfigsubdir=xdmconfig
  2269. AC_SUBST(xdmconfigsubdir)
  2270.     fi
  2271. fi
  2272.     fi
  2273. else
  2274.     if test -f $ac_xdmdir/xdm-config; then
  2275. AC_MSG_RESULT($ac_xdmdir)
  2276.     else
  2277. AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir])
  2278. xdmconfigsubdir=xdmconfig
  2279. AC_SUBST(xdmconfigsubdir)
  2280.     fi
  2281. fi
  2282. AC_DEFINE_UNQUOTED(XDMDIR,"$ac_xdmdir")
  2283. AC_SUBST(ac_xdmdir)
  2284. AC_PATH_PAM
  2285. if test "x$no_pam" = "xyes"; then 
  2286. pam_support="no"
  2287. else
  2288. pam_support="yes"
  2289.         shadow_support="no" # if pam is installed, use it. We can't savely 
  2290.                     # test, if it works *sigh*
  2291. fi
  2292. AC_ARG_WITH(shadow,
  2293. [  --with-shadow   If you want shadow password support ],
  2294. [ if test "$withval" = "yes"; then
  2295.              shadow_support="yes"
  2296.           else
  2297.              shadow_support="no"
  2298.           fi
  2299.   if test "$pam_support" = "yes" && test "$shadow_support=yes"; then
  2300. AC_MSG_WARN("You can not define both pam AND shadow")
  2301.   fi
  2302. ],
  2303. [ if test -z "$shadow_support"; then shadow_support="no"; fi ] )
  2304. if test "$pam_support" = "yes"; then
  2305.   AC_CHECK_LIB(pam, main, [PASSWDLIB="-lpam -ldl"
  2306.   AC_DEFINE_UNQUOTED(HAVE_PAM_LIB)],
  2307.   [],-ldl)
  2308. fi
  2309. if test -z "$PASSWDLIB" && test "$shadow_support" = "yes"; then
  2310.   AC_CHECK_LIB(shadow, main,
  2311.     [ PASSWDLIB="-lshadow"
  2312.       AC_DEFINE_UNQUOTED(HAVE_SHADOW_LIB)
  2313.     ])
  2314. fi
  2315. AC_SUBST(PASSWDLIB)
  2316. AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for FreeBSD
  2317. AC_SUBST(LIBUTIL)
  2318. AC_CHECK_LIB(s, main, [LIB_LIBS="-ls"]) dnl for AIX
  2319. AC_SUBST(LIB_LIBS)
  2320. AC_CHECK_LIB(Xdmcp, main, [LIBXDMCP="-lXdmcp"], , $X_LDFLAGS -lX11) dnl for Unixware
  2321. AC_SUBST(LIBXDMCP)
  2322. if test -n "$LIBXDMCP"; then
  2323.   ac_cpp_safe=$ac_cpp
  2324.   ac_cpp='$CXXCPP $CPPFLAGS $X_INCLUDES'
  2325.   AC_CHECK_HEADERS(X11/Xdmcp.h)
  2326.   ac_cpp=$ac_cpp_safe
  2327. fi
  2328. ])
  2329. ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
  2330. ## Copyright (C) 1996-1998 Free Software Foundation, Inc.
  2331. ## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  2332. ##
  2333. ## This program is free software; you can redistribute it and/or modify
  2334. ## it under the terms of the GNU General Public License as published by
  2335. ## the Free Software Foundation; either version 2 of the License, or
  2336. ## (at your option) any later version.
  2337. ##
  2338. ## This program is distributed in the hope that it will be useful, but
  2339. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  2340. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  2341. ## General Public License for more details.
  2342. ##
  2343. ## You should have received a copy of the GNU General Public License
  2344. ## along with this program; if not, write to the Free Software
  2345. ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  2346. ##
  2347. ## As a special exception to the GNU General Public License, if you
  2348. ## distribute this file as part of a program that contains a
  2349. ## configuration script generated by Autoconf, you may include it under
  2350. ## the same distribution terms that you use for the rest of that program.
  2351. # serial 24 AM_PROG_LIBTOOL
  2352. AC_DEFUN(AM_PROG_LIBTOOL,
  2353. [AC_REQUIRE([AM_ENABLE_SHARED])dnl
  2354. AC_REQUIRE([AM_ENABLE_STATIC])dnl
  2355. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  2356. AC_REQUIRE([AC_PROG_RANLIB])dnl
  2357. AC_REQUIRE([AC_PROG_CC])dnl
  2358. AC_REQUIRE([AM_PROG_LD])dnl
  2359. AC_REQUIRE([AM_PROG_NM])dnl
  2360. AC_REQUIRE([AC_PROG_LN_S])dnl
  2361. dnl
  2362. # Always use our own libtool.
  2363. LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
  2364. AC_SUBST(LIBTOOL)dnl
  2365. # Check for any special flags to pass to ltconfig.
  2366. libtool_flags=
  2367. test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
  2368. test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
  2369. test "$silent" = yes && libtool_flags="$libtool_flags --silent"
  2370. test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
  2371. test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
  2372. # Some flags need to be propagated to the compiler or linker for good
  2373. # libtool support.
  2374. case "$host" in
  2375. *-*-irix6*)
  2376.   # Find out which ABI we are using.
  2377.   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
  2378.   if AC_TRY_EVAL(ac_compile); then
  2379.     case "`/usr/bin/file conftest.o`" in
  2380.     *32-bit*)
  2381.       LD="${LD-ld} -32"
  2382.       ;;
  2383.     *N32*)
  2384.       LD="${LD-ld} -n32"
  2385.       ;;
  2386.     *64-bit*)
  2387.       LD="${LD-ld} -64"
  2388.       ;;
  2389.     esac
  2390.   fi
  2391.   rm -rf conftest*
  2392.   ;;
  2393. *-*-sco3.2v5*)
  2394.   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  2395.   CFLAGS="$CFLAGS -belf"
  2396.   ;;
  2397. esac
  2398. # Actually configure libtool.  ac_aux_dir is where install-sh is found.
  2399. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" 
  2400. LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" 
  2401. ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig 
  2402. $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host 
  2403. || AC_MSG_ERROR([libtool configure failed])
  2404. ])
  2405. # AM_ENABLE_SHARED - implement the --enable-shared flag
  2406. # Usage: AM_ENABLE_SHARED[(DEFAULT)]
  2407. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  2408. #   `yes'.
  2409. AC_DEFUN(AM_ENABLE_SHARED_EX,
  2410. [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
  2411. AC_PROVIDE(AM_ENABLE_SHARED)
  2412. AC_ARG_ENABLE(shared,
  2413. changequote(<<, >>)dnl
  2414. <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
  2415. changequote([, ])dnl
  2416. [  --enable-shared=PKGS    only build shared libraries if the current package
  2417.                           appears as an element in the PKGS list],
  2418. [p=${PACKAGE-default}
  2419. case "$enableval" in
  2420. yes) enable_shared=yes ;;
  2421. no) enable_shared=no ;;
  2422. *)
  2423.   enable_shared=no
  2424.   # Look at the argument we got.  We use all the common list separators.
  2425.   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  2426.   for pkg in $enableval; do
  2427.     if test "X$pkg" = "X$p"; then
  2428.       enable_shared=yes
  2429.     fi
  2430.   done
  2431.   IFS="$ac_save_ifs"
  2432.   ;;
  2433. esac],
  2434. enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
  2435. ])
  2436. AC_DEFUN(AM_ENABLE_SHARED,
  2437. [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
  2438. AC_ARG_ENABLE(shared,
  2439. changequote(<<, >>)dnl
  2440. <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
  2441. changequote([, ])dnl
  2442. [
  2443. if test "$enableval" = no; then
  2444.   enable_shared=no
  2445. else
  2446.   enable_shared=yes
  2447. fi
  2448. ],
  2449. enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
  2450. ])
  2451. # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
  2452. AC_DEFUN(AM_DISABLE_SHARED,
  2453. [AM_ENABLE_SHARED(no)])
  2454. # AM_DISABLE_STATIC - set the default static flag to --disable-static
  2455. AC_DEFUN(AM_DISABLE_STATIC,
  2456. [AM_ENABLE_STATIC(no)])
  2457. # AM_ENABLE_STATIC - implement the --enable-static flag
  2458. # Usage: AM_ENABLE_STATIC[(DEFAULT)]
  2459. #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
  2460. #   `yes'.
  2461. AC_DEFUN(AM_ENABLE_STATIC_EX,
  2462. [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
  2463. AC_PROVIDE(AM_ENABLE_STATIC)
  2464. AC_ARG_ENABLE(static,
  2465. changequote(<<, >>)dnl
  2466. <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
  2467. changequote([, ])dnl
  2468. [  --enable-static=PKGS    only build shared libraries if the current package
  2469.                           appears as an element in the PKGS list],
  2470. [p=${PACKAGE-default}
  2471. case "$enableval" in
  2472. yes) enable_static=yes ;;
  2473. no) enable_static=no ;;
  2474. *)
  2475.   enable_static=no
  2476.   # Look at the argument we got.  We use all the common list separators.
  2477.   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  2478.   for pkg in $enableval; do
  2479.     if test "X$pkg" = "X$p"; then
  2480.       enable_static=yes
  2481.     fi
  2482.   done
  2483.   IFS="$ac_save_ifs"
  2484.   ;;
  2485. esac],
  2486. enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
  2487. ])
  2488. AC_DEFUN(AM_ENABLE_STATIC,
  2489. [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
  2490. AC_ARG_ENABLE(static,
  2491. changequote(<<, >>)dnl
  2492. <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
  2493. changequote([, ])dnl
  2494. [if test "$enableval" = no; then
  2495.   enable_static=no
  2496. else
  2497.   enable_static=yes
  2498. fi],
  2499. enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
  2500. ])
  2501. AC_DEFUN(AM_DISABLE_LIBRARIES,
  2502. [
  2503. AC_PROVIDE([AM_ENABLE_STATIC])
  2504. AC_PROVIDE([AM_ENABLE_SHARED])
  2505. enable_static=no
  2506. enable_shared=no
  2507. ])
  2508. # AM_PROG_LD - find the path to the GNU or non-GNU linker
  2509. AC_DEFUN(AM_PROG_LD,
  2510. [AC_ARG_WITH(gnu-ld,
  2511. [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
  2512. test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
  2513. AC_REQUIRE([AC_PROG_CC])
  2514. ac_prog=ld
  2515. if test "$ac_cv_prog_gcc" = yes; then
  2516.   # Check if gcc -print-prog-name=ld gives a path.
  2517.   AC_MSG_CHECKING([for ld used by GCC])
  2518.   ac_prog=`($CC -print-prog-name=ld) 2>&5`
  2519.   case "$ac_prog" in
  2520.   # Accept absolute paths.
  2521.   /* | [A-Za-z]:\*)
  2522.     test -z "$LD" && LD="$ac_prog"
  2523.     ;;
  2524.   "")
  2525.     # If it fails, then pretend we aren't using GCC.
  2526.     ac_prog=ld
  2527.     ;;
  2528.   *)
  2529.     # If it is relative, then search for the first ld in PATH.
  2530.     with_gnu_ld=unknown
  2531.     ;;
  2532.   esac
  2533. elif test "$with_gnu_ld" = yes; then
  2534.   AC_MSG_CHECKING([for GNU ld])
  2535. else
  2536.   AC_MSG_CHECKING([for non-GNU ld])
  2537. fi
  2538. AC_CACHE_VAL(ac_cv_path_LD,
  2539. [if test -z "$LD"; then
  2540.   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  2541.   for ac_dir in $PATH; do
  2542.     test -z "$ac_dir" && ac_dir=.
  2543.     if test -f "$ac_dir/$ac_prog"; then
  2544.       ac_cv_path_LD="$ac_dir/$ac_prog"
  2545.       # Check to see if the program is GNU ld.  I'd rather use --version,
  2546.       # but apparently some GNU ld's only accept -v.
  2547.       # Break only if it was the GNU/non-GNU ld that we prefer.
  2548.       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
  2549. test "$with_gnu_ld" != no && break
  2550.       else
  2551.         test "$with_gnu_ld" != yes && break
  2552.       fi
  2553.     fi
  2554.   done
  2555.   IFS="$ac_save_ifs"
  2556. else
  2557.   ac_cv_path_LD="$LD" # Let the user override the test with a path.
  2558. fi])
  2559. LD="$ac_cv_path_LD"
  2560. if test -n "$LD"; then
  2561.   AC_MSG_RESULT($LD)
  2562. else
  2563.   AC_MSG_RESULT(no)
  2564. fi
  2565. test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in $PATH])
  2566. AC_SUBST(LD)
  2567. AM_PROG_LD_GNU
  2568. ])
  2569. AC_DEFUN(AM_PROG_LD_GNU,
  2570. [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
  2571. [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
  2572. if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
  2573.   ac_cv_prog_gnu_ld=yes
  2574. else
  2575.   ac_cv_prog_gnu_ld=no
  2576. fi])
  2577. ])
  2578. # AM_PROG_NM - find the path to a BSD-compatible name lister
  2579. AC_DEFUN(AM_PROG_NM,
  2580. [AC_MSG_CHECKING([for BSD-compatible nm])
  2581. AC_CACHE_VAL(ac_cv_path_NM,
  2582. [case "$NM" in
  2583. /* | [A-Za-z]:\*)
  2584.   ac_cv_path_NM="$NM" # Let the user override the test with a path.
  2585.   ;;
  2586. *)
  2587.   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  2588.   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
  2589.     test -z "$ac_dir" && ac_dir=.
  2590.     if test -f $ac_dir/nm; then
  2591.       # Check to see if the nm accepts a BSD-compat flag.
  2592.       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
  2593.       #   nm: unknown option "B" ignored
  2594.       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
  2595.         ac_cv_path_NM="$ac_dir/nm -B"
  2596.       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
  2597.         ac_cv_path_NM="$ac_dir/nm -p"
  2598.       else
  2599.         ac_cv_path_NM="$ac_dir/nm"
  2600.       fi
  2601.       break
  2602.     fi
  2603.   done
  2604.   IFS="$ac_save_ifs"
  2605.   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
  2606.   ;;
  2607. esac])
  2608. NM="$ac_cv_path_NM"
  2609. AC_MSG_RESULT([$NM])
  2610. AC_SUBST(NM)
  2611. ])