KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12407 lines
388KB

  1. ## -*- autoconf -*-
  2. dnl This file is part of the KDE libraries/packages
  3. dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
  4. dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
  5. dnl This file is free software; you can redistribute it and/or
  6. dnl modify it under the terms of the GNU Library General Public
  7. dnl License as published by the Free Software Foundation; either
  8. dnl version 2 of the License, or (at your option) any later version.
  9. dnl This library is distributed in the hope that it will be useful,
  10. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. dnl Library General Public License for more details.
  13. dnl You should have received a copy of the GNU Library General Public License
  14. dnl along with this library; see the file COPYING.LIB. If not, write to
  15. dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. dnl Boston, MA 02110-1301, USA.
  17. dnl IMPORTANT NOTE:
  18. dnl Please do not modify this file unless you expect your modifications to be
  19. dnl carried into every other module in the repository.
  20. dnl
  21. dnl Single-module modifications are best placed in configure.in for kdelibs
  22. dnl and kdebase or configure.in.in if present.
  23. # KDE_PATH_X_DIRECT
  24. dnl Internal subroutine of AC_PATH_X.
  25. dnl Set ac_x_includes and/or ac_x_libraries.
  26. AC_DEFUN([KDE_PATH_X_DIRECT],
  27. [
  28. AC_REQUIRE([KDE_CHECK_LIB64])
  29. if test "$ac_x_includes" = NO; then
  30. # Guess where to find include files, by looking for this one X11 .h file.
  31. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
  32. # First, try using that file with no special directory specified.
  33. AC_TRY_CPP([#include <$x_direct_test_include>],
  34. [# We can compile using X headers with no special include directory.
  35. ac_x_includes=],
  36. [# Look for the header file in a standard set of common directories.
  37. # Check X11 before X11Rn because it is often a symlink to the current release.
  38. for ac_dir in \
  39. /usr/X11/include \
  40. /usr/X11R6/include \
  41. /usr/X11R5/include \
  42. /usr/X11R4/include \
  43. \
  44. /usr/include/X11 \
  45. /usr/include/X11R6 \
  46. /usr/include/X11R5 \
  47. /usr/include/X11R4 \
  48. \
  49. /usr/local/X11/include \
  50. /usr/local/X11R6/include \
  51. /usr/local/X11R5/include \
  52. /usr/local/X11R4/include \
  53. \
  54. /usr/local/include/X11 \
  55. /usr/local/include/X11R6 \
  56. /usr/local/include/X11R5 \
  57. /usr/local/include/X11R4 \
  58. \
  59. /usr/X386/include \
  60. /usr/x386/include \
  61. /usr/XFree86/include/X11 \
  62. \
  63. /usr/include \
  64. /usr/local/include \
  65. /usr/unsupported/include \
  66. /usr/athena/include \
  67. /usr/local/x11r5/include \
  68. /usr/lpp/Xamples/include \
  69. \
  70. /usr/openwin/include \
  71. /usr/openwin/share/include \
  72. ; \
  73. do
  74. if test -r "$ac_dir/$x_direct_test_include"; then
  75. ac_x_includes=$ac_dir
  76. break
  77. fi
  78. done])
  79. fi # $ac_x_includes = NO
  80. if test "$ac_x_libraries" = NO; then
  81. # Check for the libraries.
  82. test -z "$x_direct_test_library" && x_direct_test_library=Xt
  83. test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
  84. # See if we find them without any special options.
  85. # Don't add to $LIBS permanently.
  86. ac_save_LIBS="$LIBS"
  87. LIBS="-l$x_direct_test_library $LIBS"
  88. AC_TRY_LINK([#include <X11/Intrinsic.h>], [${x_direct_test_function}(1)],
  89. [LIBS="$ac_save_LIBS"
  90. # We can link X programs with no special library path.
  91. ac_x_libraries=],
  92. [LIBS="$ac_save_LIBS"
  93. # First see if replacing the include by lib works.
  94. # Check X11 before X11Rn because it is often a symlink to the current release.
  95. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \
  96. /usr/X11/lib${kdelibsuff} \
  97. /usr/X11R6/lib${kdelibsuff} \
  98. /usr/X11R5/lib${kdelibsuff} \
  99. /usr/X11R4/lib${kdelibsuff} \
  100. \
  101. /usr/lib${kdelibsuff}/X11 \
  102. /usr/lib${kdelibsuff}/X11R6 \
  103. /usr/lib${kdelibsuff}/X11R5 \
  104. /usr/lib${kdelibsuff}/X11R4 \
  105. \
  106. /usr/local/X11/lib${kdelibsuff} \
  107. /usr/local/X11R6/lib${kdelibsuff} \
  108. /usr/local/X11R5/lib${kdelibsuff} \
  109. /usr/local/X11R4/lib${kdelibsuff} \
  110. \
  111. /usr/local/lib${kdelibsuff}/X11 \
  112. /usr/local/lib${kdelibsuff}/X11R6 \
  113. /usr/local/lib${kdelibsuff}/X11R5 \
  114. /usr/local/lib${kdelibsuff}/X11R4 \
  115. \
  116. /usr/X386/lib${kdelibsuff} \
  117. /usr/x386/lib${kdelibsuff} \
  118. /usr/XFree86/lib${kdelibsuff}/X11 \
  119. \
  120. /usr/lib${kdelibsuff} \
  121. /usr/local/lib${kdelibsuff} \
  122. /usr/unsupported/lib${kdelibsuff} \
  123. /usr/athena/lib${kdelibsuff} \
  124. /usr/local/x11r5/lib${kdelibsuff} \
  125. /usr/lpp/Xamples/lib${kdelibsuff} \
  126. /lib/usr/lib${kdelibsuff}/X11 \
  127. \
  128. /usr/openwin/lib${kdelibsuff} \
  129. /usr/openwin/share/lib${kdelibsuff} \
  130. ; \
  131. do
  132. dnl Don't even attempt the hair of trying to link an X program!
  133. for ac_extension in a so sl; do
  134. if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
  135. ac_x_libraries=$ac_dir
  136. break 2
  137. fi
  138. done
  139. done])
  140. fi # $ac_x_libraries = NO
  141. ])
  142. dnl ------------------------------------------------------------------------
  143. dnl Find a file (or one of more files in a list of dirs)
  144. dnl ------------------------------------------------------------------------
  145. dnl
  146. AC_DEFUN([AC_FIND_FILE],
  147. [
  148. $3=NO
  149. for i in $2;
  150. do
  151. for j in $1;
  152. do
  153. echo "configure: __oline__: $i/$j" >&AC_FD_CC
  154. if test -r "$i/$j"; then
  155. echo "taking that" >&AC_FD_CC
  156. $3=$i
  157. break 2
  158. fi
  159. done
  160. done
  161. ])
  162. dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs,
  163. dnl if-not-found, test-parameter, prepend-path)
  164. dnl
  165. dnl Look for program-name in list-of-dirs+$PATH.
  166. dnl If prepend-path is set, look in $PATH+list-of-dirs instead.
  167. dnl If found, $variable-name is set. If not, if-not-found is evaluated.
  168. dnl test-parameter: if set, the program is executed with this arg,
  169. dnl and only a successful exit code is required.
  170. AC_DEFUN([KDE_FIND_PATH],
  171. [
  172. AC_MSG_CHECKING([for $1])
  173. if test -n "$$2"; then
  174. kde_cv_path="$$2";
  175. else
  176. kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
  177. AC_CACHE_VAL(kde_cv_path_$kde_cache,
  178. [
  179. kde_cv_path="NONE"
  180. kde_save_IFS=$IFS
  181. IFS=':'
  182. dirs=""
  183. for dir in $PATH; do
  184. dirs="$dirs $dir"
  185. done
  186. if test -z "$6"; then dnl Append dirs in PATH (default)
  187. dirs="$3 $dirs"
  188. else dnl Prepend dirs in PATH (if 6th arg is set)
  189. dirs="$dirs $3"
  190. fi
  191. IFS=$kde_save_IFS
  192. for dir in $dirs; do
  193. if test -x "$dir/$1"; then
  194. if test -n "$5"
  195. then
  196. evalstr="$dir/$1 $5 2>&1 "
  197. if eval $evalstr; then
  198. kde_cv_path="$dir/$1"
  199. break
  200. fi
  201. else
  202. kde_cv_path="$dir/$1"
  203. break
  204. fi
  205. fi
  206. done
  207. eval "kde_cv_path_$kde_cache=$kde_cv_path"
  208. ])
  209. eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
  210. fi
  211. if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
  212. AC_MSG_RESULT(not found)
  213. $4
  214. else
  215. AC_MSG_RESULT($kde_cv_path)
  216. $2=$kde_cv_path
  217. fi
  218. ])
  219. AC_DEFUN([KDE_MOC_ERROR_MESSAGE],
  220. [
  221. AC_MSG_ERROR([No Qt meta object compiler (moc) found!
  222. Please check whether you installed Qt correctly.
  223. You need to have a running moc binary.
  224. configure tried to run $ac_cv_path_moc and the test didn't
  225. succeed. If configure shouldn't have tried this one, set
  226. the environment variable MOC to the right one before running
  227. configure.
  228. ])
  229. ])
  230. AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
  231. [
  232. AC_MSG_WARN([No Qt ui compiler (uic) found!
  233. Please check whether you installed Qt correctly.
  234. You need to have a running uic binary.
  235. configure tried to run $ac_cv_path_uic and the test didn't
  236. succeed. If configure shouldn't have tried this one, set
  237. the environment variable UIC to the right one before running
  238. configure.
  239. ])
  240. ])
  241. AC_DEFUN([KDE_CHECK_UIC_FLAG],
  242. [
  243. AC_MSG_CHECKING([whether uic supports -$1 ])
  244. kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
  245. AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
  246. [
  247. cat >conftest.ui <<EOT
  248. <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
  249. EOT
  250. ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null"
  251. if AC_TRY_EVAL(ac_uic_testrun); then
  252. eval "kde_cv_prog_uic_$kde_cache=yes"
  253. else
  254. eval "kde_cv_prog_uic_$kde_cache=no"
  255. fi
  256. rm -f conftest*
  257. ])
  258. if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
  259. AC_MSG_RESULT([yes])
  260. :
  261. $3
  262. else
  263. AC_MSG_RESULT([no])
  264. :
  265. $4
  266. fi
  267. ])
  268. dnl ------------------------------------------------------------------------
  269. dnl Find the meta object compiler and the ui compiler in the PATH,
  270. dnl in $QTDIR/bin, and some more usual places
  271. dnl ------------------------------------------------------------------------
  272. dnl
  273. AC_DEFUN([AC_PATH_QT_MOC_UIC],
  274. [
  275. AC_REQUIRE([KDE_CHECK_PERL])
  276. qt_bindirs=""
  277. for dir in $kde_qt_dirs; do
  278. qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
  279. done
  280. qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
  281. if test ! "$ac_qt_bindir" = "NO"; then
  282. qt_bindirs="$ac_qt_bindir $qt_bindirs"
  283. fi
  284. KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
  285. if test -z "$UIC_NOT_NEEDED"; then
  286. KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""])
  287. if test -z "$UIC_PATH" ; then
  288. KDE_UIC_ERROR_MESSAGE
  289. exit 1
  290. else
  291. UIC=$UIC_PATH
  292. if test $kde_qtver = 3; then
  293. KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
  294. KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
  295. if test x$ac_uic_supports_libpath = xyes; then
  296. UIC="$UIC -L \$(kde_widgetdir)"
  297. fi
  298. if test x$ac_uic_supports_nounload = xyes; then
  299. UIC="$UIC -nounload"
  300. fi
  301. fi
  302. fi
  303. else
  304. UIC="echo uic not available: "
  305. fi
  306. AC_SUBST(MOC)
  307. AC_SUBST(UIC)
  308. UIC_TR="i18n"
  309. if test $kde_qtver = 3; then
  310. UIC_TR="tr2i18n"
  311. fi
  312. AC_SUBST(UIC_TR)
  313. ])
  314. AC_DEFUN([KDE_1_CHECK_PATHS],
  315. [
  316. KDE_1_CHECK_PATH_HEADERS
  317. KDE_TEST_RPATH=
  318. if test -n "$USE_RPATH"; then
  319. if test -n "$kde_libraries"; then
  320. KDE_TEST_RPATH="-R $kde_libraries"
  321. fi
  322. if test -n "$qt_libraries"; then
  323. KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
  324. fi
  325. if test -n "$x_libraries"; then
  326. KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
  327. fi
  328. KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
  329. fi
  330. AC_MSG_CHECKING([for KDE libraries installed])
  331. ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5'
  332. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  333. AC_MSG_RESULT(yes)
  334. else
  335. AC_MSG_ERROR([your system fails at linking a small KDE application!
  336. Check, if your compiler is installed correctly and if you have used the
  337. same compiler to compile Qt and kdelibs as you did use now.
  338. For more details about this problem, look at the end of config.log.])
  339. fi
  340. if eval `KDEDIR= ./conftest 2>&5`; then
  341. kde_result=done
  342. else
  343. kde_result=problems
  344. fi
  345. KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
  346. kde_have_all_paths=yes
  347. KDE_SET_PATHS($kde_result)
  348. ])
  349. AC_DEFUN([KDE_SET_PATHS],
  350. [
  351. kde_cv_all_paths="kde_have_all_paths=\"yes\" \
  352. kde_htmldir=\"$kde_htmldir\" \
  353. kde_appsdir=\"$kde_appsdir\" \
  354. kde_icondir=\"$kde_icondir\" \
  355. kde_sounddir=\"$kde_sounddir\" \
  356. kde_datadir=\"$kde_datadir\" \
  357. kde_locale=\"$kde_locale\" \
  358. kde_cgidir=\"$kde_cgidir\" \
  359. kde_confdir=\"$kde_confdir\" \
  360. kde_kcfgdir=\"$kde_kcfgdir\" \
  361. kde_mimedir=\"$kde_mimedir\" \
  362. kde_toolbardir=\"$kde_toolbardir\" \
  363. kde_wallpaperdir=\"$kde_wallpaperdir\" \
  364. kde_templatesdir=\"$kde_templatesdir\" \
  365. kde_bindir=\"$kde_bindir\" \
  366. kde_servicesdir=\"$kde_servicesdir\" \
  367. kde_servicetypesdir=\"$kde_servicetypesdir\" \
  368. kde_moduledir=\"$kde_moduledir\" \
  369. kde_styledir=\"$kde_styledir\" \
  370. kde_widgetdir=\"$kde_widgetdir\" \
  371. xdg_appsdir=\"$xdg_appsdir\" \
  372. xdg_menudir=\"$xdg_menudir\" \
  373. xdg_directorydir=\"$xdg_directorydir\" \
  374. kde_result=$1"
  375. ])
  376. AC_DEFUN([KDE_SET_DEFAULT_PATHS],
  377. [
  378. if test "$1" = "default"; then
  379. if test -z "$kde_htmldir"; then
  380. kde_htmldir='\${datadir}/doc/HTML'
  381. fi
  382. if test -z "$kde_appsdir"; then
  383. kde_appsdir='\${datadir}/applnk'
  384. fi
  385. if test -z "$kde_icondir"; then
  386. kde_icondir='\${datadir}/icons'
  387. fi
  388. if test -z "$kde_sounddir"; then
  389. kde_sounddir='\${datadir}/sounds'
  390. fi
  391. if test -z "$kde_datadir"; then
  392. kde_datadir='\${datadir}/apps'
  393. fi
  394. if test -z "$kde_locale"; then
  395. kde_locale='\${datadir}/locale'
  396. fi
  397. if test -z "$kde_cgidir"; then
  398. kde_cgidir='\${exec_prefix}/cgi-bin'
  399. fi
  400. if test -z "$kde_confdir"; then
  401. kde_confdir='\${datadir}/config'
  402. fi
  403. if test -z "$kde_kcfgdir"; then
  404. kde_kcfgdir='\${datadir}/config.kcfg'
  405. fi
  406. if test -z "$kde_mimedir"; then
  407. kde_mimedir='\${datadir}/mimelnk'
  408. fi
  409. if test -z "$kde_toolbardir"; then
  410. kde_toolbardir='\${datadir}/toolbar'
  411. fi
  412. if test -z "$kde_wallpaperdir"; then
  413. kde_wallpaperdir='\${datadir}/wallpapers'
  414. fi
  415. if test -z "$kde_templatesdir"; then
  416. kde_templatesdir='\${datadir}/templates'
  417. fi
  418. if test -z "$kde_bindir"; then
  419. kde_bindir='\${exec_prefix}/bin'
  420. fi
  421. if test -z "$kde_servicesdir"; then
  422. kde_servicesdir='\${datadir}/services'
  423. fi
  424. if test -z "$kde_servicetypesdir"; then
  425. kde_servicetypesdir='\${datadir}/servicetypes'
  426. fi
  427. if test -z "$kde_moduledir"; then
  428. if test "$kde_qtver" = "2"; then
  429. kde_moduledir='\${libdir}/kde2'
  430. else
  431. kde_moduledir='\${libdir}/kde3'
  432. fi
  433. fi
  434. if test -z "$kde_styledir"; then
  435. kde_styledir='\${libdir}/kde3/plugins/styles'
  436. fi
  437. if test -z "$kde_widgetdir"; then
  438. kde_widgetdir='\${libdir}/kde3/plugins/designer'
  439. fi
  440. if test -z "$xdg_appsdir"; then
  441. xdg_appsdir='\${datadir}/applications/kde'
  442. fi
  443. if test -z "$xdg_menudir"; then
  444. xdg_menudir='\${sysconfdir}/xdg/menus'
  445. fi
  446. if test -z "$xdg_directorydir"; then
  447. xdg_directorydir='\${datadir}/desktop-directories'
  448. fi
  449. KDE_SET_PATHS(defaults)
  450. else
  451. if test $kde_qtver = 1; then
  452. AC_MSG_RESULT([compiling])
  453. KDE_1_CHECK_PATHS
  454. else
  455. AC_MSG_ERROR([path checking not yet supported for KDE 2])
  456. fi
  457. fi
  458. ])
  459. AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS],
  460. [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
  461. test -z "$kde_icondir" || test -z "$kde_sounddir" ||
  462. test -z "$kde_datadir" || test -z "$kde_locale" ||
  463. test -z "$kde_cgidir" || test -z "$kde_confdir" ||
  464. test -z "$kde_kcfgdir" ||
  465. test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
  466. test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
  467. test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
  468. test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
  469. test -z "$kde_styledir" || test -z "kde_widgetdir" ||
  470. test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" ||
  471. test "x$kde_have_all_paths" != "xyes"; then
  472. kde_have_all_paths=no
  473. fi
  474. ])
  475. AC_DEFUN([KDE_MISSING_PROG_ERROR],
  476. [
  477. AC_MSG_ERROR([The important program $1 was not found!
  478. Please check whether you installed KDE correctly.
  479. ])
  480. ])
  481. AC_DEFUN([KDE_MISSING_ARTS_ERROR],
  482. [
  483. AC_MSG_ERROR([The important program $1 was not found!
  484. Please check whether you installed aRts correctly or use
  485. --without-arts to compile without aRts support (this will remove functionality).
  486. ])
  487. ])
  488. AC_DEFUN([KDE_SET_DEFAULT_BINDIRS],
  489. [
  490. kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
  491. test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs"
  492. if test -n "$KDEDIRS"; then
  493. kde_save_IFS=$IFS
  494. IFS=:
  495. for dir in $KDEDIRS; do
  496. kde_default_bindirs="$dir/bin $kde_default_bindirs "
  497. done
  498. IFS=$kde_save_IFS
  499. fi
  500. ])
  501. AC_DEFUN([KDE_SUBST_PROGRAMS],
  502. [
  503. AC_ARG_WITH(arts,
  504. AC_HELP_STRING([--without-arts],[build without aRts [default=no]]),
  505. [build_arts=$withval],
  506. [build_arts=yes]
  507. )
  508. AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no")
  509. if test "$build_arts" = "no"; then
  510. AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts])
  511. fi
  512. KDE_SET_DEFAULT_BINDIRS
  513. kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs"
  514. KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
  515. KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
  516. if test "$build_arts" '!=' "no"; then
  517. KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)])
  518. KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
  519. fi
  520. KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
  521. kde32ornewer=1
  522. kde33ornewer=1
  523. if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then
  524. kde32ornewer=
  525. kde33ornewer=
  526. else
  527. if test "$kde_qtver" = "3"; then
  528. if test "$kde_qtsubver" -le 1; then
  529. kde32ornewer=
  530. fi
  531. if test "$kde_qtsubver" -le 2; then
  532. kde33ornewer=
  533. fi
  534. if test "$KDECONFIG" != "compiled"; then
  535. if test `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then
  536. kde33ornewer=
  537. fi
  538. fi
  539. fi
  540. fi
  541. if test -n "$kde32ornewer"; then
  542. KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)])
  543. KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)])
  544. fi
  545. if test -n "$kde33ornewer"; then
  546. KDE_FIND_PATH(makekdewidgets, MAKEKDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(makekdewidgets)])
  547. AC_SUBST(MAKEKDEWIDGETS)
  548. fi
  549. KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""])
  550. if test -n "$MEINPROC" -a "$MEINPROC" != "compiled"; then
  551. kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
  552. test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
  553. AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
  554. if test "$KDE_XSL_STYLESHEET" = "NO"; then
  555. KDE_XSL_STYLESHEET=""
  556. else
  557. KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl"
  558. fi
  559. fi
  560. DCOP_DEPENDENCIES='$(DCOPIDL)'
  561. if test -n "$kde32ornewer"; then
  562. KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)'
  563. DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)'
  564. AC_SUBST(KCONFIG_COMPILER)
  565. AC_SUBST(KCFG_DEPENDENCIES)
  566. AC_SUBST(DCOPIDLNG)
  567. fi
  568. AC_SUBST(DCOPIDL)
  569. AC_SUBST(DCOPIDL2CPP)
  570. AC_SUBST(DCOP_DEPENDENCIES)
  571. AC_SUBST(MCOPIDL)
  572. AC_SUBST(ARTSCCONFIG)
  573. AC_SUBST(MEINPROC)
  574. AC_SUBST(KDE_XSL_STYLESHEET)
  575. AC_SUBST(XMLLINT)
  576. ])dnl
  577. AC_DEFUN([AC_CREATE_KFSSTND],
  578. [
  579. AC_REQUIRE([AC_CHECK_RPATH])
  580. AC_MSG_CHECKING([for KDE paths])
  581. kde_result=""
  582. kde_cached_paths=yes
  583. AC_CACHE_VAL(kde_cv_all_paths,
  584. [
  585. KDE_SET_DEFAULT_PATHS($1)
  586. kde_cached_paths=no
  587. ])
  588. eval "$kde_cv_all_paths"
  589. KDE_CHECK_PATHS_FOR_COMPLETENESS
  590. if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
  591. # wrong values were cached, may be, we can set better ones
  592. kde_result=
  593. kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
  594. kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir=
  595. kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
  596. kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
  597. kde_have_all_paths=
  598. kde_styledir=
  599. kde_widgetdir=
  600. xdg_appsdir = xdg_menudir= xdg_directorydir=
  601. KDE_SET_DEFAULT_PATHS($1)
  602. eval "$kde_cv_all_paths"
  603. KDE_CHECK_PATHS_FOR_COMPLETENESS
  604. kde_result="$kde_result (cache overridden)"
  605. fi
  606. if test "$kde_have_all_paths" = "no"; then
  607. AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
  608. Since it had compiled and linked before, it must be a strange problem on your system.
  609. Look at config.log for details. If you are not able to fix this, look at
  610. http://www.kde.org/faq/installation.html or any www.kde.org mirror.
  611. (If you're using an egcs version on Linux, you may update binutils!)
  612. ])
  613. else
  614. rm -f conftest*
  615. AC_MSG_RESULT($kde_result)
  616. fi
  617. bindir=$kde_bindir
  618. KDE_SUBST_PROGRAMS
  619. ])
  620. AC_DEFUN([AC_SUBST_KFSSTND],
  621. [
  622. AC_SUBST(kde_htmldir)
  623. AC_SUBST(kde_appsdir)
  624. AC_SUBST(kde_icondir)
  625. AC_SUBST(kde_sounddir)
  626. AC_SUBST(kde_datadir)
  627. AC_SUBST(kde_locale)
  628. AC_SUBST(kde_confdir)
  629. AC_SUBST(kde_kcfgdir)
  630. AC_SUBST(kde_mimedir)
  631. AC_SUBST(kde_wallpaperdir)
  632. AC_SUBST(kde_bindir)
  633. dnl X Desktop Group standards
  634. AC_SUBST(xdg_appsdir)
  635. AC_SUBST(xdg_menudir)
  636. AC_SUBST(xdg_directorydir)
  637. dnl for KDE 2
  638. AC_SUBST(kde_templatesdir)
  639. AC_SUBST(kde_servicesdir)
  640. AC_SUBST(kde_servicetypesdir)
  641. AC_SUBST(kde_moduledir)
  642. AC_SUBST(kdeinitdir, '$(kde_moduledir)')
  643. AC_SUBST(kde_styledir)
  644. AC_SUBST(kde_widgetdir)
  645. if test "$kde_qtver" = 1; then
  646. kde_minidir="$kde_icondir/mini"
  647. else
  648. # for KDE 1 - this breaks KDE2 apps using minidir, but
  649. # that's the plan ;-/
  650. kde_minidir="/dev/null"
  651. fi
  652. dnl AC_SUBST(kde_minidir)
  653. dnl AC_SUBST(kde_cgidir)
  654. dnl AC_SUBST(kde_toolbardir)
  655. ])
  656. AC_DEFUN([KDE_MISC_TESTS],
  657. [
  658. dnl Checks for libraries.
  659. AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD
  660. AC_SUBST(LIBUTIL)
  661. AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
  662. AC_SUBST(LIBCOMPAT)
  663. kde_have_crypt=
  664. AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
  665. AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
  666. AC_MSG_WARN([you have no crypt in either libcrypt or libc.
  667. You should install libcrypt from another source or configure with PAM
  668. support])
  669. kde_have_crypt=no
  670. ]))
  671. AC_SUBST(LIBCRYPT)
  672. if test $kde_have_crypt = yes; then
  673. AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
  674. fi
  675. AC_CHECK_SOCKLEN_T
  676. AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  677. if test $ac_cv_lib_dnet_dnet_ntoa = no; then
  678. AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  679. [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  680. fi
  681. AC_CHECK_FUNC(inet_ntoa)
  682. if test $ac_cv_func_inet_ntoa = no; then
  683. AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
  684. fi
  685. AC_CHECK_FUNC(connect)
  686. if test $ac_cv_func_connect = no; then
  687. AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
  688. $X_EXTRA_LIBS)
  689. fi
  690. AC_CHECK_FUNC(remove)
  691. if test $ac_cv_func_remove = no; then
  692. AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
  693. fi
  694. # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
  695. AC_CHECK_FUNC(shmat, ,
  696. AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
  697. # more headers that need to be explicitly included on darwin
  698. AC_CHECK_HEADERS(sys/types.h stdint.h)
  699. # sys/bitypes.h is needed for uint32_t and friends on Tru64
  700. AC_CHECK_HEADERS(sys/bitypes.h)
  701. # darwin requires a poll emulation library
  702. AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll")
  703. # for some image handling on Mac OS X
  704. AC_CHECK_HEADERS(Carbon/Carbon.h)
  705. # CoreAudio framework
  706. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [
  707. AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API])
  708. FRAMEWORK_COREAUDIO="-Wl,-framework,CoreAudio"
  709. ])
  710. AC_CHECK_RES_INIT
  711. AC_SUBST(LIB_POLL)
  712. AC_SUBST(FRAMEWORK_COREAUDIO)
  713. LIBSOCKET="$X_EXTRA_LIBS"
  714. AC_SUBST(LIBSOCKET)
  715. AC_SUBST(X_EXTRA_LIBS)
  716. AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
  717. AC_SUBST(LIBUCB)
  718. case $host in dnl this *is* LynxOS specific
  719. *-*-lynxos* )
  720. AC_MSG_CHECKING([LynxOS header file wrappers])
  721. [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
  722. AC_MSG_RESULT(disabled)
  723. AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
  724. ;;
  725. esac
  726. KDE_CHECK_TYPES
  727. KDE_CHECK_LIBDL
  728. KDE_CHECK_STRLCPY
  729. KDE_CHECK_PIE_SUPPORT
  730. # darwin needs this to initialize the environment
  731. AC_CHECK_HEADERS(crt_externs.h)
  732. AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
  733. AH_VERBATIM(_DARWIN_ENVIRON,
  734. [
  735. #if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
  736. # include <sys/time.h>
  737. # include <crt_externs.h>
  738. # define environ (*_NSGetEnviron())
  739. #endif
  740. ])
  741. AH_VERBATIM(_AIX_STRINGS_H_BZERO,
  742. [
  743. /*
  744. * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
  745. * that defines bzero.
  746. */
  747. #if defined(_AIX)
  748. #include <strings.h>
  749. #endif
  750. ])
  751. AC_CHECK_FUNCS([vsnprintf snprintf])
  752. AH_VERBATIM(_TRU64,[
  753. /*
  754. * On HP-UX, the declaration of vsnprintf() is needed every time !
  755. */
  756. #if !defined(HAVE_VSNPRINTF) || defined(hpux)
  757. #if __STDC__
  758. #include <stdarg.h>
  759. #include <stdlib.h>
  760. #else
  761. #include <varargs.h>
  762. #endif
  763. #ifdef __cplusplus
  764. extern "C"
  765. #endif
  766. int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
  767. #ifdef __cplusplus
  768. extern "C"
  769. #endif
  770. int snprintf(char *str, size_t n, char const *fmt, ...);
  771. #endif
  772. ])
  773. ])
  774. dnl ------------------------------------------------------------------------
  775. dnl Find the header files and libraries for X-Windows. Extended the
  776. dnl macro AC_PATH_X
  777. dnl ------------------------------------------------------------------------
  778. dnl
  779. AC_DEFUN([K_PATH_X],
  780. [
  781. AC_REQUIRE([KDE_MISC_TESTS])dnl
  782. AC_REQUIRE([KDE_CHECK_LIB64])
  783. AC_ARG_ENABLE(
  784. embedded,
  785. AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]),
  786. kde_use_qt_emb=$enableval,
  787. kde_use_qt_emb=no
  788. )
  789. AC_ARG_ENABLE(
  790. qtopia,
  791. AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]),
  792. kde_use_qt_emb_palm=$enableval,
  793. kde_use_qt_emb_palm=no
  794. )
  795. AC_ARG_ENABLE(
  796. mac,
  797. AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]),
  798. kde_use_qt_mac=$enableval,
  799. kde_use_qt_mac=no
  800. )
  801. # used to disable x11-specific stuff on special platforms
  802. AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no")
  803. if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then
  804. AC_MSG_CHECKING(for X)
  805. AC_CACHE_VAL(kde_cv_have_x,
  806. [# One or both of the vars are not set, and there is no cached value.
  807. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
  808. kde_x_includes=NO
  809. else
  810. kde_x_includes=$x_includes
  811. fi
  812. if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
  813. kde_x_libraries=NO
  814. else
  815. kde_x_libraries=$x_libraries
  816. fi
  817. # below we use the standard autoconf calls
  818. ac_x_libraries=$kde_x_libraries
  819. ac_x_includes=$kde_x_includes
  820. KDE_PATH_X_DIRECT
  821. dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
  822. dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
  823. dnl location. The correct location is /usr/lib32 or an undefined value
  824. dnl (the linker is smart enough to pick the correct default library).
  825. dnl Things work just fine if you use just AC_PATH_X_DIRECT.
  826. dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
  827. dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
  828. dnl x_includes should be left alone.
  829. case "$host" in
  830. mips-sgi-irix6*)
  831. ;;
  832. *-*-solaris*)
  833. ;;
  834. *)
  835. _AC_PATH_X_XMKMF
  836. if test -z "$ac_x_includes"; then
  837. ac_x_includes="."
  838. fi
  839. if test -z "$ac_x_libraries"; then
  840. ac_x_libraries="/usr/lib${kdelibsuff}"
  841. fi
  842. esac
  843. #from now on we use our own again
  844. # when the user already gave --x-includes, we ignore
  845. # what the standard autoconf macros told us.
  846. if test "$kde_x_includes" = NO; then
  847. kde_x_includes=$ac_x_includes
  848. fi
  849. # for --x-libraries too
  850. if test "$kde_x_libraries" = NO; then
  851. kde_x_libraries=$ac_x_libraries
  852. fi
  853. if test "$kde_x_includes" = NO; then
  854. AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
  855. fi
  856. if test "$kde_x_libraries" = NO; then
  857. AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
  858. fi
  859. # Record where we found X for the cache.
  860. kde_cv_have_x="have_x=yes \
  861. kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
  862. ])dnl
  863. eval "$kde_cv_have_x"
  864. if test "$have_x" != yes; then
  865. AC_MSG_RESULT($have_x)
  866. no_x=yes
  867. else
  868. AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
  869. fi
  870. if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
  871. X_INCLUDES=""
  872. x_includes="."; dnl better than nothing :-
  873. else
  874. x_includes=$kde_x_includes
  875. X_INCLUDES="-I$x_includes"
  876. fi
  877. if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE || test "$kde_x_libraries" = "/usr/lib"; then
  878. X_LDFLAGS=""
  879. x_libraries="/usr/lib"; dnl better than nothing :-
  880. else
  881. x_libraries=$kde_x_libraries
  882. X_LDFLAGS="-L$x_libraries"
  883. fi
  884. all_includes="$X_INCLUDES"
  885. all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS"
  886. # Check for libraries that X11R6 Xt/Xaw programs need.
  887. ac_save_LDFLAGS="$LDFLAGS"
  888. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  889. # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
  890. # check for ICE first), but we must link in the order -lSM -lICE or
  891. # we get undefined symbols. So assume we have SM if we have ICE.
  892. # These have to be linked with before -lX11, unlike the other
  893. # libraries we check for below, so use a different variable.
  894. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
  895. AC_CHECK_LIB(ICE, IceConnectionNumber,
  896. [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
  897. LDFLAGS="$ac_save_LDFLAGS"
  898. LIB_X11='-lX11 $(LIBSOCKET)'
  899. AC_MSG_CHECKING(for libXext)
  900. AC_CACHE_VAL(kde_cv_have_libXext,
  901. [
  902. kde_ldflags_safe="$LDFLAGS"
  903. kde_libs_safe="$LIBS"
  904. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
  905. LIBS="-lXext -lX11 $LIBSOCKET"
  906. AC_TRY_LINK([
  907. #include <stdio.h>
  908. #ifdef STDC_HEADERS
  909. # include <stdlib.h>
  910. #endif
  911. ],
  912. [
  913. printf("hello Xext\n");
  914. ],
  915. kde_cv_have_libXext=yes,
  916. kde_cv_have_libXext=no
  917. )
  918. LDFLAGS=$kde_ldflags_safe
  919. LIBS=$kde_libs_safe
  920. ])
  921. AC_MSG_RESULT($kde_cv_have_libXext)
  922. if test "$kde_cv_have_libXext" = "no"; then
  923. AC_MSG_ERROR([We need a working libXext to proceed. Since configure
  924. can't find it itself, we stop here assuming that make wouldn't find
  925. them either.])
  926. fi
  927. LIB_XEXT="-lXext"
  928. QTE_NORTTI=""
  929. elif test "$kde_use_qt_emb" = "yes"; then
  930. dnl We're using QT Embedded
  931. CPPFLAGS=-DQWS
  932. CXXFLAGS="$CXXFLAGS -fno-rtti"
  933. QTE_NORTTI="-fno-rtti -DQWS"
  934. X_PRE_LIBS=""
  935. LIB_X11=""
  936. LIB_XEXT=""
  937. LIB_XRENDER=""
  938. LIBSM=""
  939. X_INCLUDES=""
  940. X_LDFLAGS=""
  941. x_includes=""
  942. x_libraries=""
  943. elif test "$kde_use_qt_mac" = "yes"; then
  944. dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to
  945. dnl be included to get the information) --Sam
  946. CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
  947. CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
  948. X_PRE_LIBS=""
  949. LIB_X11=""
  950. LIB_XEXT=""
  951. LIB_XRENDER=""
  952. LIBSM=""
  953. X_INCLUDES=""
  954. X_LDFLAGS=""
  955. x_includes=""
  956. x_libraries=""
  957. fi
  958. AC_SUBST(X_PRE_LIBS)
  959. AC_SUBST(LIB_X11)
  960. AC_SUBST(LIB_XRENDER)
  961. AC_SUBST(LIBSM)
  962. AC_SUBST(X_INCLUDES)
  963. AC_SUBST(X_LDFLAGS)
  964. AC_SUBST(x_includes)
  965. AC_SUBST(x_libraries)
  966. AC_SUBST(QTE_NORTTI)
  967. AC_SUBST(LIB_XEXT)
  968. ])
  969. AC_DEFUN([KDE_PRINT_QT_PROGRAM],
  970. [
  971. AC_REQUIRE([KDE_USE_QT])
  972. cat > conftest.$ac_ext <<EOF
  973. #include "confdefs.h"
  974. #include <qglobal.h>
  975. #include <qapplication.h>
  976. EOF
  977. if test "$kde_qtver" = "2"; then
  978. cat >> conftest.$ac_ext <<EOF
  979. #include <qevent.h>
  980. #include <qstring.h>
  981. #include <qstyle.h>
  982. EOF
  983. if test $kde_qtsubver -gt 0; then
  984. cat >> conftest.$ac_ext <<EOF
  985. #if QT_VERSION < 210
  986. #error 1
  987. #endif
  988. EOF
  989. fi
  990. fi
  991. if test "$kde_qtver" = "3"; then
  992. cat >> conftest.$ac_ext <<EOF
  993. #include <qcursor.h>
  994. #include <qstylefactory.h>
  995. #include <private/qucomextra_p.h>
  996. EOF
  997. fi
  998. echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
  999. cat >> conftest.$ac_ext <<EOF
  1000. #error 1
  1001. #endif
  1002. int main() {
  1003. EOF
  1004. if test "$kde_qtver" = "2"; then
  1005. cat >> conftest.$ac_ext <<EOF
  1006. QStringList *t = new QStringList();
  1007. Q_UNUSED(t);
  1008. EOF
  1009. if test $kde_qtsubver -gt 0; then
  1010. cat >> conftest.$ac_ext <<EOF
  1011. QString s;
  1012. s.setLatin1("Elvis is alive", 14);
  1013. EOF
  1014. fi
  1015. fi
  1016. if test "$kde_qtver" = "3"; then
  1017. cat >> conftest.$ac_ext <<EOF
  1018. (void)QStyleFactory::create(QString::null);
  1019. QCursor c(Qt::WhatsThisCursor);
  1020. EOF
  1021. fi
  1022. cat >> conftest.$ac_ext <<EOF
  1023. return 0;
  1024. }
  1025. EOF
  1026. ])
  1027. AC_DEFUN([KDE_USE_QT],
  1028. [
  1029. if test -z "$1"; then
  1030. # Current default Qt version: 3.3
  1031. kde_qtver=3
  1032. kde_qtsubver=3
  1033. else
  1034. kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
  1035. # following is the check if subversion isnt found in passed argument
  1036. if test "$kde_qtsubver" = "$1"; then
  1037. kde_qtsubver=1
  1038. fi
  1039. kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
  1040. if test "$kde_qtver" = "1"; then
  1041. kde_qtsubver=42
  1042. fi
  1043. fi
  1044. if test -z "$2"; then
  1045. if test "$kde_qtver" = "2"; then
  1046. if test $kde_qtsubver -gt 0; then
  1047. kde_qt_minversion=">= Qt 2.2.2"
  1048. else
  1049. kde_qt_minversion=">= Qt 2.0.2"
  1050. fi
  1051. fi
  1052. if test "$kde_qtver" = "3"; then
  1053. if test $kde_qtsubver -gt 0; then
  1054. if test $kde_qtsubver -gt 1; then
  1055. if test $kde_qtsubver -gt 2; then
  1056. kde_qt_minversion=">= Qt 3.3 and < 4.0"
  1057. else
  1058. kde_qt_minversion=">= Qt 3.2 and < 4.0"
  1059. fi
  1060. else
  1061. kde_qt_minversion=">= Qt 3.1 (20021021) and < 4.0"
  1062. fi
  1063. else
  1064. kde_qt_minversion=">= Qt 3.0 and < 4.0"
  1065. fi
  1066. fi
  1067. if test "$kde_qtver" = "1"; then
  1068. kde_qt_minversion=">= 1.42 and < 2.0"
  1069. fi
  1070. else
  1071. kde_qt_minversion="$2"
  1072. fi
  1073. if test -z "$3"; then
  1074. if test $kde_qtver = 3; then
  1075. if test $kde_qtsubver -gt 0; then
  1076. kde_qt_verstring="QT_VERSION >= 0x03@VER@00 && QT_VERSION < 0x040000"
  1077. qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
  1078. kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
  1079. else
  1080. kde_qt_verstring="QT_VERSION >= 300 && QT_VERSION < 0x040000"
  1081. fi
  1082. fi
  1083. if test $kde_qtver = 2; then
  1084. if test $kde_qtsubver -gt 0; then
  1085. kde_qt_verstring="QT_VERSION >= 222"
  1086. else
  1087. kde_qt_verstring="QT_VERSION >= 200"
  1088. fi
  1089. fi
  1090. if test $kde_qtver = 1; then
  1091. kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
  1092. fi
  1093. else
  1094. kde_qt_verstring="$3"
  1095. fi
  1096. if test $kde_qtver = 4; then
  1097. kde_qt_dirs="$QTDIR /usr/lib/qt4 /usr/lib/qt /usr/share/qt4"
  1098. fi
  1099. if test $kde_qtver = 3; then
  1100. kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3"
  1101. fi
  1102. if test $kde_qtver = 2; then
  1103. kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
  1104. fi
  1105. if test $kde_qtver = 1; then
  1106. kde_qt_dirs="$QTDIR /usr/lib/qt"
  1107. fi
  1108. ])
  1109. AC_DEFUN([KDE_CHECK_QT_DIRECT],
  1110. [
  1111. AC_REQUIRE([KDE_USE_QT])
  1112. AC_MSG_CHECKING([if Qt compiles without flags])
  1113. AC_CACHE_VAL(kde_cv_qt_direct,
  1114. [
  1115. AC_LANG_SAVE
  1116. AC_LANG_CPLUSPLUS
  1117. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  1118. ac_LIBRARY_PATH="$LIBRARY_PATH"
  1119. ac_cxxflags_safe="$CXXFLAGS"
  1120. ac_ldflags_safe="$LDFLAGS"
  1121. ac_libs_safe="$LIBS"
  1122. CXXFLAGS="$CXXFLAGS -I$qt_includes"
  1123. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  1124. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1125. LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
  1126. else
  1127. LIBS="$LIBQT $LIBSOCKET"
  1128. fi
  1129. LD_LIBRARY_PATH=
  1130. export LD_LIBRARY_PATH
  1131. LIBRARY_PATH=
  1132. export LIBRARY_PATH
  1133. KDE_PRINT_QT_PROGRAM
  1134. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1135. kde_cv_qt_direct="yes"
  1136. else
  1137. kde_cv_qt_direct="no"
  1138. echo "configure: failed program was:" >&AC_FD_CC
  1139. cat conftest.$ac_ext >&AC_FD_CC
  1140. fi
  1141. rm -f conftest*
  1142. CXXFLAGS="$ac_cxxflags_safe"
  1143. LDFLAGS="$ac_ldflags_safe"
  1144. LIBS="$ac_libs_safe"
  1145. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  1146. export LD_LIBRARY_PATH
  1147. LIBRARY_PATH="$ac_LIBRARY_PATH"
  1148. export LIBRARY_PATH
  1149. AC_LANG_RESTORE
  1150. ])
  1151. if test "$kde_cv_qt_direct" = "yes"; then
  1152. AC_MSG_RESULT(yes)
  1153. $1
  1154. else
  1155. AC_MSG_RESULT(no)
  1156. $2
  1157. fi
  1158. ])
  1159. dnl ------------------------------------------------------------------------
  1160. dnl Try to find the Qt headers and libraries.
  1161. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
  1162. dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
  1163. dnl ------------------------------------------------------------------------
  1164. dnl
  1165. AC_DEFUN([AC_PATH_QT_1_3],
  1166. [
  1167. AC_REQUIRE([K_PATH_X])
  1168. AC_REQUIRE([KDE_USE_QT])
  1169. AC_REQUIRE([KDE_CHECK_LIB64])
  1170. dnl ------------------------------------------------------------------------
  1171. dnl Add configure flag to enable linking to MT version of Qt library.
  1172. dnl ------------------------------------------------------------------------
  1173. AC_ARG_ENABLE(
  1174. mt,
  1175. AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]),
  1176. kde_use_qt_mt=$enableval,
  1177. [
  1178. if test $kde_qtver = 3; then
  1179. kde_use_qt_mt=yes
  1180. else
  1181. kde_use_qt_mt=no
  1182. fi
  1183. ]
  1184. )
  1185. USING_QT_MT=""
  1186. dnl ------------------------------------------------------------------------
  1187. dnl If we not get --disable-qt-mt then adjust some vars for the host.
  1188. dnl ------------------------------------------------------------------------
  1189. KDE_MT_LDFLAGS=
  1190. KDE_MT_LIBS=
  1191. if test "x$kde_use_qt_mt" = "xyes"; then
  1192. KDE_CHECK_THREADING
  1193. if test "x$kde_use_threading" = "xyes"; then
  1194. CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
  1195. KDE_MT_LDFLAGS="$USE_THREADS"
  1196. KDE_MT_LIBS="$LIBPTHREAD"
  1197. else
  1198. kde_use_qt_mt=no
  1199. fi
  1200. fi
  1201. AC_SUBST(KDE_MT_LDFLAGS)
  1202. AC_SUBST(KDE_MT_LIBS)
  1203. kde_qt_was_given=yes
  1204. dnl ------------------------------------------------------------------------
  1205. dnl If we haven't been told how to link to Qt, we work it out for ourselves.
  1206. dnl ------------------------------------------------------------------------
  1207. if test -z "$LIBQT_GLOB"; then
  1208. if test "x$kde_use_qt_emb" = "xyes"; then
  1209. LIBQT_GLOB="libqte.*"
  1210. else
  1211. LIBQT_GLOB="libqt.*"
  1212. fi
  1213. fi
  1214. dnl ------------------------------------------------------------
  1215. dnl If we got --enable-embedded then adjust the Qt library name.
  1216. dnl ------------------------------------------------------------
  1217. if test "x$kde_use_qt_emb" = "xyes"; then
  1218. qtlib="qte"
  1219. else
  1220. qtlib="qt"
  1221. fi
  1222. kde_int_qt="-l$qtlib"
  1223. if test -z "$LIBQPE"; then
  1224. dnl ------------------------------------------------------------
  1225. dnl If we got --enable-palmtop then add -lqpe to the link line
  1226. dnl ------------------------------------------------------------
  1227. if test "x$kde_use_qt_emb" = "xyes"; then
  1228. if test "x$kde_use_qt_emb_palm" = "xyes"; then
  1229. LIB_QPE="-lqpe"
  1230. else
  1231. LIB_QPE=""
  1232. fi
  1233. else
  1234. LIB_QPE=""
  1235. fi
  1236. fi
  1237. dnl ------------------------------------------------------------------------
  1238. dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
  1239. dnl ------------------------------------------------------------------------
  1240. if test "x$kde_use_qt_mt" = "xyes"; then
  1241. LIBQT="-l$qtlib-mt"
  1242. kde_int_qt="-l$qtlib-mt"
  1243. LIBQT_GLOB="lib$qtlib-mt.*"
  1244. USING_QT_MT="using -mt"
  1245. else
  1246. LIBQT="-l$qtlib"
  1247. fi
  1248. if test $kde_qtver != 1; then
  1249. AC_REQUIRE([AC_FIND_PNG])
  1250. AC_REQUIRE([AC_FIND_JPEG])
  1251. LIBQT="$LIBQT $LIBPNG $LIBJPEG"
  1252. fi
  1253. if test $kde_qtver = 3; then
  1254. AC_REQUIRE([KDE_CHECK_LIBDL])
  1255. LIBQT="$LIBQT $LIBDL"
  1256. fi
  1257. AC_MSG_CHECKING([for Qt])
  1258. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1259. LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
  1260. fi
  1261. ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
  1262. qt_libraries=""
  1263. qt_includes=""
  1264. AC_ARG_WITH(qt-dir,
  1265. AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]),
  1266. [ ac_qt_includes="$withval"/include
  1267. ac_qt_libraries="$withval"/lib${kdelibsuff}
  1268. ac_qt_bindir="$withval"/bin
  1269. ])
  1270. AC_ARG_WITH(qt-includes,
  1271. AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]),
  1272. [
  1273. ac_qt_includes="$withval"
  1274. ])
  1275. kde_qt_libs_given=no
  1276. AC_ARG_WITH(qt-libraries,
  1277. AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]),
  1278. [ ac_qt_libraries="$withval"
  1279. kde_qt_libs_given=yes
  1280. ])
  1281. AC_CACHE_VAL(ac_cv_have_qt,
  1282. [#try to guess Qt locations
  1283. qt_incdirs=""
  1284. for dir in $kde_qt_dirs; do
  1285. qt_incdirs="$qt_incdirs $dir/include $dir"
  1286. done
  1287. qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes"
  1288. if test ! "$ac_qt_includes" = "NO"; then
  1289. qt_incdirs="$ac_qt_includes $qt_incdirs"
  1290. fi
  1291. if test "$kde_qtver" != "1"; then
  1292. kde_qt_header=qstyle.h
  1293. else
  1294. kde_qt_header=qglobal.h
  1295. fi
  1296. AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
  1297. ac_qt_includes="$qt_incdir"
  1298. qt_libdirs=""
  1299. for dir in $kde_qt_dirs; do
  1300. qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir"
  1301. done
  1302. qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
  1303. if test ! "$ac_qt_libraries" = "NO"; then
  1304. qt_libdir=$ac_qt_libraries
  1305. else
  1306. qt_libdirs="$ac_qt_libraries $qt_libdirs"
  1307. # if the Qt was given, the chance is too big that libqt.* doesn't exist
  1308. qt_libdir=NONE
  1309. for dir in $qt_libdirs; do
  1310. try="ls -1 $dir/${LIBQT_GLOB}"
  1311. if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  1312. done
  1313. fi
  1314. for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
  1315. if test -e "$a"; then
  1316. LIBQT="$LIBQT ${kde_int_qt}_incremental"
  1317. break
  1318. fi
  1319. done
  1320. ac_qt_libraries="$qt_libdir"
  1321. AC_LANG_SAVE
  1322. AC_LANG_CPLUSPLUS
  1323. ac_cxxflags_safe="$CXXFLAGS"
  1324. ac_ldflags_safe="$LDFLAGS"
  1325. ac_libs_safe="$LIBS"
  1326. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  1327. LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
  1328. LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
  1329. KDE_PRINT_QT_PROGRAM
  1330. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1331. rm -f conftest*
  1332. else
  1333. echo "configure: failed program was:" >&AC_FD_CC
  1334. cat conftest.$ac_ext >&AC_FD_CC
  1335. ac_qt_libraries="NO"
  1336. fi
  1337. rm -f conftest*
  1338. CXXFLAGS="$ac_cxxflags_safe"
  1339. LDFLAGS="$ac_ldflags_safe"
  1340. LIBS="$ac_libs_safe"
  1341. AC_LANG_RESTORE
  1342. if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
  1343. ac_cv_have_qt="have_qt=no"
  1344. ac_qt_notfound=""
  1345. missing_qt_mt=""
  1346. if test "$ac_qt_includes" = NO; then
  1347. if test "$ac_qt_libraries" = NO; then
  1348. ac_qt_notfound="(headers and libraries)";
  1349. else
  1350. ac_qt_notfound="(headers)";
  1351. fi
  1352. else
  1353. if test "x$kde_use_qt_mt" = "xyes"; then
  1354. missing_qt_mt="
  1355. Make sure that you have compiled Qt with thread support!"
  1356. ac_qt_notfound="(library $qtlib-mt)";
  1357. else
  1358. ac_qt_notfound="(library $qtlib)";
  1359. fi
  1360. fi
  1361. AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
  1362. For more details about this problem, look at the end of config.log.$missing_qt_mt])
  1363. else
  1364. have_qt="yes"
  1365. fi
  1366. ])
  1367. eval "$ac_cv_have_qt"
  1368. if test "$have_qt" != yes; then
  1369. AC_MSG_RESULT([$have_qt]);
  1370. else
  1371. ac_cv_have_qt="have_qt=yes \
  1372. ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
  1373. AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
  1374. qt_libraries="$ac_qt_libraries"
  1375. qt_includes="$ac_qt_includes"
  1376. fi
  1377. if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
  1378. KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
  1379. fi
  1380. AC_SUBST(qt_libraries)
  1381. AC_SUBST(qt_includes)
  1382. if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
  1383. QT_INCLUDES=""
  1384. else
  1385. QT_INCLUDES="-I$qt_includes"
  1386. all_includes="$QT_INCLUDES $all_includes"
  1387. fi
  1388. if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
  1389. QT_LDFLAGS=""
  1390. else
  1391. QT_LDFLAGS="-L$qt_libraries"
  1392. all_libraries="$QT_LDFLAGS $all_libraries"
  1393. fi
  1394. test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
  1395. AC_SUBST(QT_INCLUDES)
  1396. AC_SUBST(QT_LDFLAGS)
  1397. AC_PATH_QT_MOC_UIC
  1398. KDE_CHECK_QT_JPEG
  1399. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1400. LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
  1401. else
  1402. LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
  1403. fi
  1404. test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
  1405. for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
  1406. if test -e "$a"; then
  1407. LIB_QT="$LIB_QT ${kde_int_qt}_incremental"
  1408. break
  1409. fi
  1410. done
  1411. AC_SUBST(LIB_QT)
  1412. AC_SUBST(LIB_QPE)
  1413. AC_SUBST(kde_qtver)
  1414. ])
  1415. AC_DEFUN([AC_PATH_QT],
  1416. [
  1417. AC_PATH_QT_1_3
  1418. ])
  1419. AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
  1420. [
  1421. AC_REQUIRE([AC_PATH_QT_MOC_UIC])
  1422. if test x$ac_uic_supports_libpath = xyes; then
  1423. AC_MSG_CHECKING([if UIC has KDE plugins available])
  1424. AC_CACHE_VAL(kde_cv_uic_plugins,
  1425. [
  1426. cat > actest.ui << EOF
  1427. <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
  1428. <class>NewConnectionDialog</class>
  1429. <widget class="QDialog">
  1430. <widget class="KLineEdit">
  1431. <property name="name">
  1432. <cstring>testInput</cstring>
  1433. </property>
  1434. </widget>
  1435. </widget>
  1436. </UI>
  1437. EOF
  1438. kde_cv_uic_plugins=no
  1439. kde_line="$UIC_PATH -L $kde_widgetdir"
  1440. if test x$ac_uic_supports_nounload = xyes; then
  1441. kde_line="$kde_line -nounload"
  1442. fi
  1443. kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
  1444. if AC_TRY_EVAL(kde_line); then
  1445. # if you're trying to debug this check and think it's incorrect,
  1446. # better check your installation. The check _is_ correct - your
  1447. # installation is not.
  1448. if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
  1449. kde_cv_uic_plugins=yes
  1450. fi
  1451. fi
  1452. rm -f actest.ui actest.cpp
  1453. ])
  1454. AC_MSG_RESULT([$kde_cv_uic_plugins])
  1455. if test "$kde_cv_uic_plugins" != yes; then
  1456. AC_MSG_ERROR([
  1457. you need to install kdelibs first.
  1458. If you did install kdelibs, then the Qt version that is picked up by
  1459. this configure is not the same version you used to compile kdelibs.
  1460. The Qt Plugin installed by kdelibs is *ONLY* loadable if it is the
  1461. _same Qt version_, compiled with the _same compiler_ and the same Qt
  1462. configuration settings.
  1463. ])
  1464. fi
  1465. fi
  1466. ])
  1467. AC_DEFUN([KDE_CHECK_FINAL],
  1468. [
  1469. AC_ARG_ENABLE(final,
  1470. AC_HELP_STRING([--enable-final],
  1471. [build size optimized apps (experimental - needs lots of memory)]),
  1472. kde_use_final=$enableval, kde_use_final=no)
  1473. if test "x$kde_use_final" = "xyes"; then
  1474. KDE_USE_FINAL_TRUE=""
  1475. KDE_USE_FINAL_FALSE="#"
  1476. else
  1477. KDE_USE_FINAL_TRUE="#"
  1478. KDE_USE_FINAL_FALSE=""
  1479. fi
  1480. AC_SUBST(KDE_USE_FINAL_TRUE)
  1481. AC_SUBST(KDE_USE_FINAL_FALSE)
  1482. ])
  1483. AC_DEFUN([KDE_CHECK_CLOSURE],
  1484. [
  1485. AC_ARG_ENABLE(closure,
  1486. AC_HELP_STRING([--enable-closure],[delay template instantiation]),
  1487. kde_use_closure=$enableval, kde_use_closure=no)
  1488. KDE_NO_UNDEFINED=""
  1489. if test "x$kde_use_closure" = "xyes"; then
  1490. KDE_USE_CLOSURE_TRUE=""
  1491. KDE_USE_CLOSURE_FALSE="#"
  1492. # CXXFLAGS="$CXXFLAGS $REPO"
  1493. else
  1494. KDE_USE_CLOSURE_TRUE="#"
  1495. KDE_USE_CLOSURE_FALSE=""
  1496. KDE_NO_UNDEFINED=""
  1497. fi
  1498. AC_SUBST(KDE_USE_CLOSURE_TRUE)
  1499. AC_SUBST(KDE_USE_CLOSURE_FALSE)
  1500. AC_SUBST(KDE_NO_UNDEFINED)
  1501. ])
  1502. dnl Check if the linker supports --enable-new-dtags and --as-needed
  1503. AC_DEFUN([KDE_CHECK_NEW_LDFLAGS],
  1504. [
  1505. AC_ARG_ENABLE(new_ldflags,
  1506. AC_HELP_STRING([--enable-new-ldflags],
  1507. [enable the new linker flags]),
  1508. kde_use_new_ldflags=$enableval,
  1509. kde_use_new_ldflags=no)
  1510. LDFLAGS_AS_NEEDED=""
  1511. LDFLAGS_NEW_DTAGS=""
  1512. if test "x$kde_use_new_ldflags" = "xyes"; then
  1513. LDFLAGS_NEW_DTAGS=""
  1514. KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags],
  1515. [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],)
  1516. KDE_CHECK_COMPILER_FLAG([Wl,--as-needed],
  1517. [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],)
  1518. fi
  1519. AC_SUBST(LDFLAGS_AS_NEEDED)
  1520. AC_SUBST(LDFLAGS_NEW_DTAGS)
  1521. ])
  1522. AC_DEFUN([KDE_CHECK_NMCHECK],
  1523. [
  1524. AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
  1525. kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
  1526. if test "$kde_use_nmcheck" = "yes"; then
  1527. KDE_USE_NMCHECK_TRUE=""
  1528. KDE_USE_NMCHECK_FALSE="#"
  1529. else
  1530. KDE_USE_NMCHECK_TRUE="#"
  1531. KDE_USE_NMCHECK_FALSE=""
  1532. fi
  1533. AC_SUBST(KDE_USE_NMCHECK_TRUE)
  1534. AC_SUBST(KDE_USE_NMCHECK_FALSE)
  1535. ])
  1536. AC_DEFUN([KDE_EXPAND_MAKEVAR], [
  1537. savex=$exec_prefix
  1538. test "x$exec_prefix" = xNONE && exec_prefix=$prefix
  1539. tmp=$$2
  1540. while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
  1541. exec_prefix=$savex
  1542. ])
  1543. dnl ------------------------------------------------------------------------
  1544. dnl Now, the same with KDE
  1545. dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
  1546. dnl and $(kde_includes) will be the kdehdrlocation (if needed)
  1547. dnl ------------------------------------------------------------------------
  1548. dnl
  1549. AC_DEFUN([AC_BASE_PATH_KDE],
  1550. [
  1551. AC_REQUIRE([KDE_CHECK_STL])
  1552. AC_REQUIRE([AC_PATH_QT])dnl
  1553. AC_REQUIRE([KDE_CHECK_LIB64])
  1554. AC_CHECK_RPATH
  1555. AC_MSG_CHECKING([for KDE])
  1556. if test "${prefix}" != NONE; then
  1557. kde_includes=${includedir}
  1558. KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
  1559. kde_libraries=${libdir}
  1560. KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
  1561. else
  1562. ac_kde_includes=
  1563. ac_kde_libraries=
  1564. kde_libraries=""
  1565. kde_includes=""
  1566. fi
  1567. AC_CACHE_VAL(ac_cv_have_kde,
  1568. [#try to guess kde locations
  1569. if test "$kde_qtver" = 1; then
  1570. kde_check_header="ksock.h"
  1571. kde_check_lib="libkdecore.la"
  1572. else
  1573. kde_check_header="ksharedptr.h"
  1574. kde_check_lib="libkio.la"
  1575. fi
  1576. if test -z "$1"; then
  1577. kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
  1578. test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
  1579. kde_incdirs="$ac_kde_includes $kde_incdirs"
  1580. AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
  1581. ac_kde_includes="$kde_incdir"
  1582. if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
  1583. AC_MSG_ERROR([
  1584. in the prefix, you've chosen, are no KDE headers installed. This will fail.
  1585. So, check this please and use another prefix!])
  1586. fi
  1587. kde_libdirs="$kde_libs_prefix/lib${kdelibsuff} /usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}"
  1588. test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
  1589. kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
  1590. AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
  1591. ac_kde_libraries="$kde_libdir"
  1592. kde_widgetdir=NO
  1593. dnl this might be somewhere else
  1594. AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
  1595. if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
  1596. AC_MSG_ERROR([
  1597. in the prefix, you've chosen, are no KDE libraries installed. This will fail.
  1598. So, check this please and use another prefix!])
  1599. fi
  1600. if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then
  1601. AC_MSG_ERROR([
  1602. I can't find the designer plugins. These are required and should have been installed
  1603. by kdelibs])
  1604. fi
  1605. if test -n "$kde_widgetdir"; then
  1606. kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
  1607. fi
  1608. if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
  1609. ac_cv_have_kde="have_kde=no"
  1610. else
  1611. ac_cv_have_kde="have_kde=yes \
  1612. ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1613. fi
  1614. else dnl test -z $1, e.g. from kdelibs
  1615. ac_cv_have_kde="have_kde=no"
  1616. fi
  1617. ])dnl
  1618. eval "$ac_cv_have_kde"
  1619. if test "$have_kde" != "yes"; then
  1620. if test "${prefix}" = NONE; then
  1621. ac_kde_prefix="$ac_default_prefix"
  1622. else
  1623. ac_kde_prefix="$prefix"
  1624. fi
  1625. if test "$exec_prefix" = NONE; then
  1626. ac_kde_exec_prefix="$ac_kde_prefix"
  1627. AC_MSG_RESULT([will be installed in $ac_kde_prefix])
  1628. else
  1629. ac_kde_exec_prefix="$exec_prefix"
  1630. AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
  1631. fi
  1632. kde_libraries="${libdir}"
  1633. kde_includes="${includedir}"
  1634. else
  1635. ac_cv_have_kde="have_kde=yes \
  1636. ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1637. AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
  1638. kde_libraries="$ac_kde_libraries"
  1639. kde_includes="$ac_kde_includes"
  1640. fi
  1641. AC_SUBST(kde_libraries)
  1642. AC_SUBST(kde_includes)
  1643. if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then
  1644. KDE_INCLUDES=""
  1645. else
  1646. KDE_INCLUDES="-I$kde_includes"
  1647. all_includes="$KDE_INCLUDES $all_includes"
  1648. fi
  1649. KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION"
  1650. KDE_LDFLAGS="-L$kde_libraries"
  1651. if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
  1652. all_libraries="$KDE_LDFLAGS $all_libraries"
  1653. fi
  1654. AC_SUBST(KDE_LDFLAGS)
  1655. AC_SUBST(KDE_INCLUDES)
  1656. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1657. all_libraries="$all_libraries $USER_LDFLAGS"
  1658. all_includes="$all_includes $USER_INCLUDES"
  1659. AC_SUBST(all_includes)
  1660. AC_SUBST(all_libraries)
  1661. if test -z "$1"; then
  1662. KDE_CHECK_UIC_PLUGINS
  1663. fi
  1664. ac_kde_libraries="$kde_libdir"
  1665. AC_SUBST(AUTODIRS)
  1666. ])
  1667. AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
  1668. [
  1669. AC_MSG_CHECKING(for extra includes)
  1670. AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]),
  1671. kde_use_extra_includes="$withval",
  1672. kde_use_extra_includes=NONE
  1673. )
  1674. kde_extra_includes=
  1675. if test -n "$kde_use_extra_includes" && \
  1676. test "$kde_use_extra_includes" != "NONE"; then
  1677. ac_save_ifs=$IFS
  1678. IFS=':'
  1679. for dir in $kde_use_extra_includes; do
  1680. kde_extra_includes="$kde_extra_includes $dir"
  1681. USER_INCLUDES="$USER_INCLUDES -I$dir"
  1682. done
  1683. IFS=$ac_save_ifs
  1684. kde_use_extra_includes="added"
  1685. else
  1686. kde_use_extra_includes="no"
  1687. fi
  1688. AC_SUBST(USER_INCLUDES)
  1689. AC_MSG_RESULT($kde_use_extra_includes)
  1690. kde_extra_libs=
  1691. AC_MSG_CHECKING(for extra libs)
  1692. AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]),
  1693. kde_use_extra_libs=$withval,
  1694. kde_use_extra_libs=NONE
  1695. )
  1696. if test -n "$kde_use_extra_libs" && \
  1697. test "$kde_use_extra_libs" != "NONE"; then
  1698. ac_save_ifs=$IFS
  1699. IFS=':'
  1700. for dir in $kde_use_extra_libs; do
  1701. kde_extra_libs="$kde_extra_libs $dir"
  1702. KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
  1703. USER_LDFLAGS="$USER_LDFLAGS -L$dir"
  1704. done
  1705. IFS=$ac_save_ifs
  1706. kde_use_extra_libs="added"
  1707. else
  1708. kde_use_extra_libs="no"
  1709. fi
  1710. AC_SUBST(USER_LDFLAGS)
  1711. AC_MSG_RESULT($kde_use_extra_libs)
  1712. ])
  1713. AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
  1714. [
  1715. AC_MSG_CHECKING([for KDE headers installed])
  1716. AC_LANG_SAVE
  1717. AC_LANG_CPLUSPLUS
  1718. cat > conftest.$ac_ext <<EOF
  1719. #ifdef STDC_HEADERS
  1720. # include <stdlib.h>
  1721. #endif
  1722. #include <stdio.h>
  1723. #include "confdefs.h"
  1724. #include <kapp.h>
  1725. int main() {
  1726. printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
  1727. printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
  1728. printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
  1729. printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
  1730. printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
  1731. printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
  1732. printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
  1733. printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
  1734. printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
  1735. printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
  1736. printf("kde_wallpaperdir=\\"%s\\"\n",
  1737. KApplication::kde_wallpaperdir().data());
  1738. printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
  1739. printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
  1740. printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
  1741. printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
  1742. printf("kde_moduledir=\\"/tmp/dummy\\"\n");
  1743. printf("kde_styledir=\\"/tmp/dummy\\"\n");
  1744. printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
  1745. printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
  1746. printf("xdg_menudir=\\"/tmp/dummy\\"\n");
  1747. printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
  1748. printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
  1749. return 0;
  1750. }
  1751. EOF
  1752. ac_save_CPPFLAGS=$CPPFLAGS
  1753. CPPFLAGS="$all_includes $CPPFLAGS"
  1754. if AC_TRY_EVAL(ac_compile); then
  1755. AC_MSG_RESULT(yes)
  1756. else
  1757. AC_MSG_ERROR([your system is not able to compile a small KDE application!
  1758. Check, if you installed the KDE header files correctly.
  1759. For more details about this problem, look at the end of config.log.])
  1760. fi
  1761. CPPFLAGS=$ac_save_CPPFLAGS
  1762. AC_LANG_RESTORE
  1763. ])
  1764. AC_DEFUN([KDE_CHECK_KDEQTADDON],
  1765. [
  1766. AC_MSG_CHECKING(for kde-qt-addon)
  1767. AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
  1768. [
  1769. kde_ldflags_safe="$LDFLAGS"
  1770. kde_libs_safe="$LIBS"
  1771. kde_cxxflags_safe="$CXXFLAGS"
  1772. LIBS="-lkde-qt-addon $LIBQT $LIBS"
  1773. CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
  1774. LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
  1775. AC_TRY_LINK([
  1776. #include <qdom.h>
  1777. ],
  1778. [
  1779. QDomDocument doc;
  1780. ],
  1781. kde_cv_have_kdeqtaddon=yes,
  1782. kde_cv_have_kdeqtaddon=no
  1783. )
  1784. LDFLAGS=$kde_ldflags_safe
  1785. LIBS=$kde_libs_safe
  1786. CXXFLAGS=$kde_cxxflags_safe
  1787. ])
  1788. AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
  1789. if test "$kde_cv_have_kdeqtaddon" = "no"; then
  1790. AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
  1791. It is a separate package (and CVS module) named kde-qt-addon.])
  1792. fi
  1793. ])
  1794. AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
  1795. [
  1796. AC_REQUIRE([KDE_MISC_TESTS])
  1797. AC_REQUIRE([KDE_CHECK_LIBDL])
  1798. AC_REQUIRE([K_PATH_X])
  1799. if test $kde_qtver = 3; then
  1800. case $host in
  1801. *cygwin*) lib_kded="-lkdeinit_kded" ;;
  1802. *) lib_kded="" ;;
  1803. esac
  1804. AC_SUBST(LIB_KDED, $lib_kded)
  1805. AC_SUBST(LIB_KDECORE, "-lkdecore")
  1806. AC_SUBST(LIB_KDEUI, "-lkdeui")
  1807. AC_SUBST(LIB_KIO, "-lkio")
  1808. AC_SUBST(LIB_KJS, "-lkjs")
  1809. AC_SUBST(LIB_SMB, "-lsmb")
  1810. AC_SUBST(LIB_KAB, "-lkab")
  1811. AC_SUBST(LIB_KABC, "-lkabc")
  1812. AC_SUBST(LIB_KHTML, "-lkhtml")
  1813. AC_SUBST(LIB_KSPELL, "-lkspell")
  1814. AC_SUBST(LIB_KPARTS, "-lkparts")
  1815. AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
  1816. AC_SUBST(LIB_KUTILS, "-lkutils")
  1817. AC_SUBST(LIB_KDEPIM, "-lkdepim")
  1818. AC_SUBST(LIB_KIMPROXY, "-lkimproxy")
  1819. AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff")
  1820. AC_SUBST(LIB_KDNSSD, "-lkdnssd")
  1821. AC_SUBST(LIB_KUNITTEST, "-lkunittest")
  1822. # these are for backward compatibility
  1823. AC_SUBST(LIB_KSYCOCA, "-lkio")
  1824. AC_SUBST(LIB_KFILE, "-lkio")
  1825. elif test $kde_qtver = 2; then
  1826. AC_SUBST(LIB_KDECORE, "-lkdecore")
  1827. AC_SUBST(LIB_KDEUI, "-lkdeui")
  1828. AC_SUBST(LIB_KIO, "-lkio")
  1829. AC_SUBST(LIB_KSYCOCA, "-lksycoca")
  1830. AC_SUBST(LIB_SMB, "-lsmb")
  1831. AC_SUBST(LIB_KFILE, "-lkfile")
  1832. AC_SUBST(LIB_KAB, "-lkab")
  1833. AC_SUBST(LIB_KHTML, "-lkhtml")
  1834. AC_SUBST(LIB_KSPELL, "-lkspell")
  1835. AC_SUBST(LIB_KPARTS, "-lkparts")
  1836. AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
  1837. else
  1838. AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)")
  1839. AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)")
  1840. AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)")
  1841. AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)")
  1842. AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")
  1843. fi
  1844. ])
  1845. AC_DEFUN([AC_PATH_KDE],
  1846. [
  1847. AC_BASE_PATH_KDE
  1848. AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]),
  1849. [
  1850. if test "$enableval" = "no";
  1851. then ac_use_path_checking="default"
  1852. else ac_use_path_checking=""
  1853. fi
  1854. ],
  1855. [
  1856. if test "$kde_qtver" = 1;
  1857. then ac_use_path_checking=""
  1858. else ac_use_path_checking="default"
  1859. fi
  1860. ]
  1861. )
  1862. AC_CREATE_KFSSTND($ac_use_path_checking)
  1863. AC_SUBST_KFSSTND
  1864. KDE_CREATE_LIBS_ALIASES
  1865. ])
  1866. dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
  1867. AC_DEFUN([KDE_CHECK_FUNC_EXT],
  1868. [
  1869. AC_MSG_CHECKING(for $1)
  1870. AC_CACHE_VAL(kde_cv_func_$1,
  1871. [
  1872. AC_LANG_SAVE
  1873. AC_LANG_CPLUSPLUS
  1874. save_CXXFLAGS="$CXXFLAGS"
  1875. kde_safe_LIBS="$LIBS"
  1876. LIBS="$LIBS $X_EXTRA_LIBS"
  1877. AC_TRY_COMPILE([
  1878. $2
  1879. ],
  1880. [
  1881. $3
  1882. ],
  1883. kde_cv_func_$1=yes,
  1884. kde_cv_func_$1=no)
  1885. CXXFLAGS="$save_CXXFLAGS"
  1886. LIBS="$kde_safe_LIBS"
  1887. AC_LANG_RESTORE
  1888. ])
  1889. AC_MSG_RESULT($kde_cv_func_$1)
  1890. AC_MSG_CHECKING([if $1 needs custom prototype])
  1891. AC_CACHE_VAL(kde_cv_proto_$1,
  1892. [
  1893. if test "x$kde_cv_func_$1" = xyes; then
  1894. kde_cv_proto_$1=no
  1895. else
  1896. case "$1" in
  1897. setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
  1898. kde_cv_proto_$1="yes - in libkdefakes"
  1899. ;;
  1900. *)
  1901. kde_cv_proto_$1=unknown
  1902. ;;
  1903. esac
  1904. fi
  1905. if test "x$kde_cv_proto_$1" = xunknown; then
  1906. AC_LANG_SAVE
  1907. AC_LANG_CPLUSPLUS
  1908. kde_safe_libs=$LIBS
  1909. LIBS="$LIBS $X_EXTRA_LIBS"
  1910. AC_TRY_LINK([
  1911. $2
  1912. extern "C" $4;
  1913. ],
  1914. [
  1915. $3
  1916. ],
  1917. [ kde_cv_func_$1=yes
  1918. kde_cv_proto_$1=yes ],
  1919. [kde_cv_proto_$1="$1 unavailable"]
  1920. )
  1921. LIBS=$kde_safe_libs
  1922. AC_LANG_RESTORE
  1923. fi
  1924. ])
  1925. AC_MSG_RESULT($kde_cv_proto_$1)
  1926. if test "x$kde_cv_func_$1" = xyes; then
  1927. AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
  1928. $6
  1929. fi
  1930. if test "x$kde_cv_proto_$1" = xno; then
  1931. AC_DEFINE(HAVE_$5_PROTO, 1,
  1932. [Define if you have the $1 prototype])
  1933. fi
  1934. AH_VERBATIM([_HAVE_$5_PROTO],
  1935. [
  1936. #if !defined(HAVE_$5_PROTO)
  1937. #ifdef __cplusplus
  1938. extern "C" {
  1939. #endif
  1940. $4;
  1941. #ifdef __cplusplus
  1942. }
  1943. #endif
  1944. #endif
  1945. ])
  1946. ])
  1947. AC_DEFUN([AC_CHECK_SETENV],
  1948. [
  1949. KDE_CHECK_FUNC_EXT(setenv, [
  1950. #include <stdlib.h>
  1951. ],
  1952. [setenv("VAR", "VALUE", 1);],
  1953. [int setenv (const char *, const char *, int)],
  1954. [SETENV])
  1955. ])
  1956. AC_DEFUN([AC_CHECK_UNSETENV],
  1957. [
  1958. KDE_CHECK_FUNC_EXT(unsetenv, [
  1959. #include <stdlib.h>
  1960. ],
  1961. [unsetenv("VAR");],
  1962. [void unsetenv (const char *)],
  1963. [UNSETENV])
  1964. ])
  1965. AC_DEFUN([AC_CHECK_GETDOMAINNAME],
  1966. [
  1967. KDE_CHECK_FUNC_EXT(getdomainname, [
  1968. #include <stdlib.h>
  1969. #include <unistd.h>
  1970. #include <netdb.h>
  1971. ],
  1972. [
  1973. char buffer[200];
  1974. getdomainname(buffer, 200);
  1975. ],
  1976. [#include <sys/types.h>
  1977. int getdomainname (char *, size_t)],
  1978. [GETDOMAINNAME])
  1979. ])
  1980. AC_DEFUN([AC_CHECK_GETHOSTNAME],
  1981. [
  1982. KDE_CHECK_FUNC_EXT(gethostname, [
  1983. #include <stdlib.h>
  1984. #include <unistd.h>
  1985. ],
  1986. [
  1987. char buffer[200];
  1988. gethostname(buffer, 200);
  1989. ],
  1990. [int gethostname (char *, unsigned int)],
  1991. [GETHOSTNAME])
  1992. ])
  1993. AC_DEFUN([AC_CHECK_USLEEP],
  1994. [
  1995. KDE_CHECK_FUNC_EXT(usleep, [
  1996. #include <unistd.h>
  1997. ],
  1998. [
  1999. usleep(200);
  2000. ],
  2001. [int usleep (unsigned int)],
  2002. [USLEEP])
  2003. ])
  2004. AC_DEFUN([AC_CHECK_RANDOM],
  2005. [
  2006. KDE_CHECK_FUNC_EXT(random, [
  2007. #include <stdlib.h>
  2008. ],
  2009. [
  2010. random();
  2011. ],
  2012. [long int random(void)],
  2013. [RANDOM])
  2014. KDE_CHECK_FUNC_EXT(srandom, [
  2015. #include <stdlib.h>
  2016. ],
  2017. [
  2018. srandom(27);
  2019. ],
  2020. [void srandom(unsigned int)],
  2021. [SRANDOM])
  2022. ])
  2023. AC_DEFUN([AC_CHECK_INITGROUPS],
  2024. [
  2025. KDE_CHECK_FUNC_EXT(initgroups, [
  2026. #include <sys/types.h>
  2027. #include <unistd.h>
  2028. #include <grp.h>
  2029. ],
  2030. [
  2031. char buffer[200];
  2032. initgroups(buffer, 27);
  2033. ],
  2034. [int initgroups(const char *, gid_t)],
  2035. [INITGROUPS])
  2036. ])
  2037. AC_DEFUN([AC_CHECK_MKSTEMPS],
  2038. [
  2039. KDE_CHECK_FUNC_EXT(mkstemps, [
  2040. #include <stdlib.h>
  2041. #include <unistd.h>
  2042. ],
  2043. [
  2044. mkstemps("/tmp/aaaXXXXXX", 6);
  2045. ],
  2046. [int mkstemps(char *, int)],
  2047. [MKSTEMPS])
  2048. ])
  2049. AC_DEFUN([AC_CHECK_MKSTEMP],
  2050. [
  2051. KDE_CHECK_FUNC_EXT(mkstemp, [
  2052. #include <stdlib.h>
  2053. #include <unistd.h>
  2054. ],
  2055. [
  2056. mkstemp("/tmp/aaaXXXXXX");
  2057. ],
  2058. [int mkstemp(char *)],
  2059. [MKSTEMP])
  2060. ])
  2061. AC_DEFUN([AC_CHECK_MKDTEMP],
  2062. [
  2063. KDE_CHECK_FUNC_EXT(mkdtemp, [
  2064. #include <stdlib.h>
  2065. #include <unistd.h>
  2066. ],
  2067. [
  2068. mkdtemp("/tmp/aaaXXXXXX");
  2069. ],
  2070. [char *mkdtemp(char *)],
  2071. [MKDTEMP])
  2072. ])
  2073. AC_DEFUN([AC_CHECK_RES_INIT],
  2074. [
  2075. AC_MSG_CHECKING([if res_init needs -lresolv])
  2076. kde_libs_safe="$LIBS"
  2077. LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
  2078. AC_TRY_LINK(
  2079. [
  2080. #include <sys/types.h>
  2081. #include <netinet/in.h>
  2082. #include <arpa/nameser.h>
  2083. #include <resolv.h>
  2084. ],
  2085. [
  2086. res_init();
  2087. ],
  2088. [
  2089. LIBRESOLV="-lresolv"
  2090. AC_MSG_RESULT(yes)
  2091. AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
  2092. ],
  2093. [ AC_MSG_RESULT(no) ]
  2094. )
  2095. LIBS=$kde_libs_safe
  2096. AC_SUBST(LIBRESOLV)
  2097. KDE_CHECK_FUNC_EXT(res_init,
  2098. [
  2099. #include <sys/types.h>
  2100. #include <netinet/in.h>
  2101. #include <arpa/nameser.h>
  2102. #include <resolv.h>
  2103. ],
  2104. [res_init()],
  2105. [int res_init(void)],
  2106. [RES_INIT])
  2107. ])
  2108. AC_DEFUN([AC_CHECK_STRLCPY],
  2109. [
  2110. KDE_CHECK_FUNC_EXT(strlcpy, [
  2111. #include <string.h>
  2112. ],
  2113. [ char buf[20];
  2114. strlcpy(buf, "KDE function test", sizeof(buf));
  2115. ],
  2116. [unsigned long strlcpy(char*, const char*, unsigned long)],
  2117. [STRLCPY])
  2118. ])
  2119. AC_DEFUN([AC_CHECK_STRLCAT],
  2120. [
  2121. KDE_CHECK_FUNC_EXT(strlcat, [
  2122. #include <string.h>
  2123. ],
  2124. [ char buf[20];
  2125. buf[0]='\0';
  2126. strlcat(buf, "KDE function test", sizeof(buf));
  2127. ],
  2128. [unsigned long strlcat(char*, const char*, unsigned long)],
  2129. [STRLCAT])
  2130. ])
  2131. AC_DEFUN([AC_CHECK_RES_QUERY],
  2132. [
  2133. KDE_CHECK_FUNC_EXT(res_query, [
  2134. #include <sys/types.h>
  2135. #include <netinet/in.h>
  2136. #include <arpa/nameser.h>
  2137. #include <resolv.h>
  2138. #include <netdb.h>
  2139. ],
  2140. [
  2141. res_query(NULL, 0, 0, NULL, 0);
  2142. ],
  2143. [int res_query(const char *, int, int, unsigned char *, int)],
  2144. [RES_QUERY])
  2145. ])
  2146. AC_DEFUN([AC_CHECK_DN_SKIPNAME],
  2147. [
  2148. KDE_CHECK_FUNC_EXT(dn_skipname, [
  2149. #include <sys/types.h>
  2150. #include <netinet/in.h>
  2151. #include <arpa/nameser.h>
  2152. #include <resolv.h>
  2153. ],
  2154. [
  2155. dn_skipname (NULL, NULL);
  2156. ],
  2157. [int dn_skipname (unsigned char *, unsigned char *)],
  2158. [DN_SKIPNAME])
  2159. ])
  2160. AC_DEFUN([AC_FIND_GIF],
  2161. [AC_MSG_CHECKING([for giflib])
  2162. AC_CACHE_VAL(ac_cv_lib_gif,
  2163. [ac_save_LIBS="$LIBS"
  2164. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2165. LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
  2166. else
  2167. LIBS="$all_libraries -lgif"
  2168. fi
  2169. AC_TRY_LINK(dnl
  2170. [
  2171. #ifdef __cplusplus
  2172. extern "C" {
  2173. #endif
  2174. int GifLastError(void);
  2175. #ifdef __cplusplus
  2176. }
  2177. #endif
  2178. /* We use char because int might match the return type of a gcc2
  2179. builtin and then its argument prototype would still apply. */
  2180. ],
  2181. [return GifLastError();],
  2182. eval "ac_cv_lib_gif=yes",
  2183. eval "ac_cv_lib_gif=no")
  2184. LIBS="$ac_save_LIBS"
  2185. ])dnl
  2186. if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
  2187. AC_MSG_RESULT(yes)
  2188. AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
  2189. else
  2190. AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
  2191. fi
  2192. ])
  2193. AC_DEFUN([KDE_FIND_JPEG_HELPER],
  2194. [
  2195. AC_MSG_CHECKING([for libjpeg$2])
  2196. AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
  2197. [
  2198. ac_save_LIBS="$LIBS"
  2199. LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
  2200. ac_save_CFLAGS="$CFLAGS"
  2201. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2202. AC_TRY_LINK(
  2203. [
  2204. #ifdef __cplusplus
  2205. extern "C" {
  2206. #endif
  2207. void jpeg_CreateDecompress();
  2208. #ifdef __cplusplus
  2209. }
  2210. #endif
  2211. ],
  2212. [jpeg_CreateDecompress();],
  2213. eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
  2214. eval "ac_cv_lib_jpeg_$1=no")
  2215. LIBS="$ac_save_LIBS"
  2216. CFLAGS="$ac_save_CFLAGS"
  2217. ])
  2218. if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
  2219. LIBJPEG="$ac_cv_lib_jpeg_$1"
  2220. AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
  2221. else
  2222. AC_MSG_RESULT(no)
  2223. $3
  2224. fi
  2225. ])
  2226. AC_DEFUN([AC_FIND_JPEG],
  2227. [
  2228. dnl first look for libraries
  2229. KDE_FIND_JPEG_HELPER(6b, 6b,
  2230. KDE_FIND_JPEG_HELPER(normal, [],
  2231. [
  2232. LIBJPEG=
  2233. ]
  2234. )
  2235. )
  2236. dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
  2237. dnl requires system dependent includes loaded before it)
  2238. jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
  2239. AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
  2240. test "x$jpeg_incdir" = xNO && jpeg_incdir=
  2241. dnl if headers _and_ libraries are missing, this is no error, and we
  2242. dnl continue with a warning (the user will get no jpeg support in khtml)
  2243. dnl if only one is missing, it means a configuration error, but we still
  2244. dnl only warn
  2245. if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
  2246. AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
  2247. else
  2248. if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
  2249. AC_MSG_WARN([
  2250. There is an installation error in jpeg support. You seem to have only one
  2251. of either the headers _or_ the libraries installed. You may need to either
  2252. provide correct --with-extra-... options, or the development package of
  2253. libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
  2254. Disabling JPEG support.
  2255. ])
  2256. else
  2257. AC_MSG_WARN([libjpeg not found. disable JPEG support.])
  2258. fi
  2259. jpeg_incdir=
  2260. LIBJPEG=
  2261. fi
  2262. AC_SUBST(LIBJPEG)
  2263. AH_VERBATIM(_AC_CHECK_JPEG,
  2264. [/*
  2265. * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
  2266. * headers and I'm too lazy to write a configure test as long as only
  2267. * unixware is related
  2268. */
  2269. #ifdef _UNIXWARE
  2270. #define HAVE_BOOLEAN
  2271. #endif
  2272. ])
  2273. ])
  2274. AC_DEFUN([KDE_CHECK_QT_JPEG],
  2275. [
  2276. if test -n "$LIBJPEG"; then
  2277. AC_MSG_CHECKING([if Qt needs $LIBJPEG])
  2278. AC_CACHE_VAL(kde_cv_qt_jpeg,
  2279. [
  2280. AC_LANG_SAVE
  2281. AC_LANG_CPLUSPLUS
  2282. ac_save_LIBS="$LIBS"
  2283. LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
  2284. LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
  2285. ac_save_CXXFLAGS="$CXXFLAGS"
  2286. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  2287. AC_TRY_LINK(
  2288. [#include <qapplication.h>],
  2289. [
  2290. int argc;
  2291. char** argv;
  2292. QApplication app(argc, argv);],
  2293. eval "kde_cv_qt_jpeg=no",
  2294. eval "kde_cv_qt_jpeg=yes")
  2295. LIBS="$ac_save_LIBS"
  2296. CXXFLAGS="$ac_save_CXXFLAGS"
  2297. AC_LANG_RESTORE
  2298. fi
  2299. ])
  2300. if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
  2301. AC_MSG_RESULT(yes)
  2302. LIBJPEG_QT='$(LIBJPEG)'
  2303. else
  2304. AC_MSG_RESULT(no)
  2305. LIBJPEG_QT=
  2306. fi
  2307. ])
  2308. AC_DEFUN([AC_FIND_ZLIB],
  2309. [
  2310. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2311. AC_MSG_CHECKING([for libz])
  2312. AC_CACHE_VAL(ac_cv_lib_z,
  2313. [
  2314. kde_save_LIBS="$LIBS"
  2315. LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
  2316. kde_save_CFLAGS="$CFLAGS"
  2317. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2318. AC_TRY_LINK(dnl
  2319. [
  2320. #include<zlib.h>
  2321. ],
  2322. [
  2323. char buf[42];
  2324. gzFile f = (gzFile) 0;
  2325. /* this would segfault.. but we only link, don't run */
  2326. (void) gzgets(f, buf, sizeof(buf));
  2327. return (zlibVersion() == ZLIB_VERSION);
  2328. ],
  2329. eval "ac_cv_lib_z='-lz'",
  2330. eval "ac_cv_lib_z=no")
  2331. LIBS="$kde_save_LIBS"
  2332. CFLAGS="$kde_save_CFLAGS"
  2333. ])dnl
  2334. if test ! "$ac_cv_lib_z" = no; then
  2335. AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
  2336. LIBZ="$ac_cv_lib_z"
  2337. AC_MSG_RESULT($ac_cv_lib_z)
  2338. else
  2339. AC_MSG_ERROR(not found.
  2340. Possibly configure picks up an outdated version
  2341. installed by XFree86. Remove it from your system.
  2342. Check your installation and look into config.log)
  2343. LIBZ=""
  2344. fi
  2345. AC_SUBST(LIBZ)
  2346. ])
  2347. AC_DEFUN([KDE_TRY_TIFFLIB],
  2348. [
  2349. AC_MSG_CHECKING([for libtiff $1])
  2350. AC_CACHE_VAL(kde_cv_libtiff_$1,
  2351. [
  2352. AC_LANG_SAVE
  2353. AC_LANG_CPLUSPLUS
  2354. kde_save_LIBS="$LIBS"
  2355. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2356. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
  2357. else
  2358. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
  2359. fi
  2360. kde_save_CXXFLAGS="$CXXFLAGS"
  2361. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  2362. AC_TRY_LINK(dnl
  2363. [
  2364. #include<tiffio.h>
  2365. ],
  2366. [return (TIFFOpen( "", "r") == 0); ],
  2367. [
  2368. kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
  2369. ], [
  2370. kde_cv_libtiff_$1=no
  2371. ])
  2372. LIBS="$kde_save_LIBS"
  2373. CXXFLAGS="$kde_save_CXXFLAGS"
  2374. AC_LANG_RESTORE
  2375. ])
  2376. if test "$kde_cv_libtiff_$1" = "no"; then
  2377. AC_MSG_RESULT(no)
  2378. LIBTIFF=""
  2379. $3
  2380. else
  2381. LIBTIFF="$kde_cv_libtiff_$1"
  2382. AC_MSG_RESULT(yes)
  2383. AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
  2384. $2
  2385. fi
  2386. ])
  2387. AC_DEFUN([AC_FIND_TIFF],
  2388. [
  2389. AC_REQUIRE([K_PATH_X])
  2390. AC_REQUIRE([AC_FIND_ZLIB])
  2391. AC_REQUIRE([AC_FIND_JPEG])
  2392. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2393. KDE_TRY_TIFFLIB(tiff, [],
  2394. KDE_TRY_TIFFLIB(tiff34))
  2395. AC_SUBST(LIBTIFF)
  2396. ])
  2397. AC_DEFUN([KDE_FIND_LIBEXR],
  2398. [
  2399. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2400. AC_REQUIRE([AC_FIND_ZLIB])
  2401. AC_CACHE_VAL(ac_cv_libexr,
  2402. [
  2403. if test -z "$PKG_CONFIG"; then
  2404. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2405. fi
  2406. AC_MSG_CHECKING([for OpenEXR libraries])
  2407. if test "$PKG_CONFIG" = "no" ; then
  2408. AC_MSG_RESULT(no)
  2409. echo "*** The pkg-config script could not be found. Make sure it is"
  2410. echo "*** in your path, or set the PKG_CONFIG environment variable"
  2411. echo "*** to the full path to pkg-config."
  2412. echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
  2413. else
  2414. if !(`$PKG_CONFIG --exists OpenEXR`) ; then
  2415. AC_MSG_RESULT(no)
  2416. EXRSTATUS=no
  2417. else
  2418. if !(`$PKG_CONFIG --atleast-version="1.1.1" OpenEXR`) ; then
  2419. AC_MSG_RESULT(no)
  2420. EXRSTATUS=old
  2421. else
  2422. kde_save_LIBS="$LIBS"
  2423. LIBS="$LIBS $all_libraries $USER_LDFLAGS `pkg-config --libs OpenEXR` $LIBZ"
  2424. AC_LANG_SAVE
  2425. AC_LANG_CPLUSPLUS
  2426. kde_save_CXXFLAGS="$CXXFLAGS"
  2427. EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR`
  2428. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS"
  2429. AC_TRY_LINK(dnl
  2430. [
  2431. #include <ImfRgbaFile.h>
  2432. ],
  2433. [
  2434. using namespace Imf;
  2435. RgbaInputFile file ("dummy");
  2436. return 0;
  2437. ],
  2438. eval "ac_cv_libexr='`pkg-config --libs OpenEXR`'",
  2439. eval "ac_cv_libexr=no"
  2440. )
  2441. LIBS="$kde_save_LIBS"
  2442. CXXFLAGS="$kde_save_CXXFLAGS"
  2443. AC_LANG_RESTORE
  2444. ])dnl
  2445. if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then
  2446. AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR])
  2447. LIB_EXR="$ac_cv_libexr"
  2448. AC_MSG_RESULT($ac_cv_libexr)
  2449. else
  2450. AC_MSG_RESULT(no)
  2451. LIB_EXR=""
  2452. fi
  2453. fi
  2454. fi
  2455. fi
  2456. AC_SUBST(LIB_EXR)
  2457. AC_SUBST(EXR_FLAGS)
  2458. ])
  2459. AC_DEFUN([AC_FIND_PNG],
  2460. [
  2461. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2462. AC_REQUIRE([AC_FIND_ZLIB])
  2463. AC_MSG_CHECKING([for libpng])
  2464. AC_CACHE_VAL(ac_cv_lib_png,
  2465. [
  2466. kde_save_LIBS="$LIBS"
  2467. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2468. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
  2469. else
  2470. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
  2471. fi
  2472. kde_save_CFLAGS="$CFLAGS"
  2473. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2474. AC_TRY_LINK(dnl
  2475. [
  2476. #include<png.h>
  2477. ],
  2478. [
  2479. png_structp png_ptr = png_create_read_struct( /* image ptr */
  2480. PNG_LIBPNG_VER_STRING, 0, 0, 0 );
  2481. return( png_ptr != 0 );
  2482. ],
  2483. eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
  2484. eval "ac_cv_lib_png=no"
  2485. )
  2486. LIBS="$kde_save_LIBS"
  2487. CFLAGS="$kde_save_CFLAGS"
  2488. ])dnl
  2489. if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
  2490. AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
  2491. LIBPNG="$ac_cv_lib_png"
  2492. AC_SUBST(LIBPNG)
  2493. AC_MSG_RESULT($ac_cv_lib_png)
  2494. else
  2495. AC_MSG_RESULT(no)
  2496. LIBPNG=""
  2497. AC_SUBST(LIBPNG)
  2498. fi
  2499. ])
  2500. AC_DEFUN([AC_FIND_JASPER],
  2501. [
  2502. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2503. AC_REQUIRE([AC_FIND_JPEG])
  2504. AC_MSG_CHECKING([for jasper])
  2505. AC_CACHE_VAL(ac_cv_jasper,
  2506. [
  2507. kde_save_LIBS="$LIBS"
  2508. LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
  2509. kde_save_CFLAGS="$CFLAGS"
  2510. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2511. AC_TRY_LINK(dnl
  2512. [
  2513. #include<jasper/jasper.h>
  2514. ],
  2515. [
  2516. return( jas_init() );
  2517. ],
  2518. eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
  2519. eval "ac_cv_jasper=no"
  2520. )
  2521. LIBS="$kde_save_LIBS"
  2522. CFLAGS="$kde_save_CFLAGS"
  2523. ])dnl
  2524. if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
  2525. AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
  2526. LIB_JASPER="$ac_cv_jasper"
  2527. AC_MSG_RESULT($ac_cv_jasper)
  2528. else
  2529. AC_MSG_RESULT(no)
  2530. LIB_JASPER=""
  2531. fi
  2532. AC_SUBST(LIB_JASPER)
  2533. ])
  2534. AC_DEFUN([AC_CHECK_BOOL],
  2535. [
  2536. AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
  2537. ])
  2538. AC_DEFUN([AC_CHECK_GNU_EXTENSIONS],
  2539. [
  2540. AC_MSG_CHECKING(if you need GNU extensions)
  2541. AC_CACHE_VAL(ac_cv_gnu_extensions,
  2542. [
  2543. cat > conftest.c << EOF
  2544. #include <features.h>
  2545. #ifdef __GNU_LIBRARY__
  2546. yes
  2547. #endif
  2548. EOF
  2549. if (eval "$ac_cpp conftest.c") 2>&5 |
  2550. egrep "yes" >/dev/null 2>&1; then
  2551. rm -rf conftest*
  2552. ac_cv_gnu_extensions=yes
  2553. else
  2554. ac_cv_gnu_extensions=no
  2555. fi
  2556. ])
  2557. AC_MSG_RESULT($ac_cv_gnu_extensions)
  2558. if test "$ac_cv_gnu_extensions" = "yes"; then
  2559. AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
  2560. fi
  2561. ])
  2562. AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
  2563. [
  2564. AC_MSG_CHECKING([whether $CXX supports -$1])
  2565. kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
  2566. AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
  2567. [
  2568. AC_LANG_SAVE
  2569. AC_LANG_CPLUSPLUS
  2570. save_CXXFLAGS="$CXXFLAGS"
  2571. CXXFLAGS="$CXXFLAGS -$1"
  2572. AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
  2573. CXXFLAGS="$save_CXXFLAGS"
  2574. AC_LANG_RESTORE
  2575. ])
  2576. if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
  2577. AC_MSG_RESULT(yes)
  2578. :
  2579. $2
  2580. else
  2581. AC_MSG_RESULT(no)
  2582. :
  2583. $3
  2584. fi
  2585. ])
  2586. AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG],
  2587. [
  2588. AC_MSG_CHECKING([whether $CC supports -$1])
  2589. kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
  2590. AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache,
  2591. [
  2592. AC_LANG_SAVE
  2593. AC_LANG_C
  2594. save_CFLAGS="$CFLAGS"
  2595. CFLAGS="$CFLAGS -$1"
  2596. AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], [])
  2597. CFLAGS="$save_CFLAGS"
  2598. AC_LANG_RESTORE
  2599. ])
  2600. if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then
  2601. AC_MSG_RESULT(yes)
  2602. :
  2603. $2
  2604. else
  2605. AC_MSG_RESULT(no)
  2606. :
  2607. $3
  2608. fi
  2609. ])
  2610. dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
  2611. dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
  2612. dnl it's all white-space separated
  2613. AC_DEFUN([AC_REMOVE_FORBIDDEN],
  2614. [ __val=$$1
  2615. __forbid=" $2 "
  2616. if test -n "$__val"; then
  2617. __new=""
  2618. ac_save_IFS=$IFS
  2619. IFS=" "
  2620. for i in $__val; do
  2621. case "$__forbid" in
  2622. *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
  2623. *) # Careful to not add spaces, where there were none, because otherwise
  2624. # libtool gets confused, if we change e.g. CXX
  2625. if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
  2626. esac
  2627. done
  2628. IFS=$ac_save_IFS
  2629. $1=$__new
  2630. fi
  2631. ])
  2632. AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER],
  2633. [
  2634. AC_MSG_CHECKING([whether $CC is blacklisted])
  2635. dnl In theory we have tu run this test against $CC and $CXX
  2636. dnl in C and in C++ mode, because its perfectly legal for
  2637. dnl the user to mix compiler versions, since C has a defined
  2638. dnl ABI.
  2639. dnl
  2640. dnl For now, we assume the user is not on crack.
  2641. AC_TRY_COMPILE([
  2642. #ifdef __GNUC__
  2643. #if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0
  2644. choke me
  2645. #endif
  2646. #endif
  2647. ], ,
  2648. kde_bad_compiler=no,
  2649. kde_bad_compiler=yes
  2650. )
  2651. AC_MSG_RESULT($kde_bad_compiler)
  2652. if test "$kde_bad_compiler" = "yes"; then
  2653. AC_MSG_ERROR([
  2654. This particular compiler version is blacklisted because it
  2655. is known to miscompile KDE. Please use a newer version, or
  2656. if that is not yet available, choose an older version.
  2657. Please do not report a bug or bother us reporting this
  2658. configure error. We know about it, and we introduced
  2659. it by intention to avoid untraceable bugs or crashes in KDE.
  2660. ])
  2661. fi
  2662. ])
  2663. AC_DEFUN([KDE_CHECK_FOR_OPT_NOINLINE_MATCH],
  2664. [
  2665. AC_CACHE_CHECK([whether system headers can cope with -O2 -fno-inline],
  2666. kde_cv_opt_noinline_match,
  2667. [
  2668. kde_cv_opt_noinline_match=irrelevant
  2669. dnl if we don't use both -O2 and -fno-inline, this check is moot
  2670. if echo "$CFLAGS" | grep -e -O2 >/dev/null 2>/dev/null \
  2671. && echo "$CFLAGS" | grep -e -fno-inline >/dev/null 2>/dev/null ; then
  2672. ac_cflags_save="$CFLAGS"
  2673. CFLAGS="$CFLAGS -D_USE_GNU"
  2674. AC_TRY_LINK([
  2675. #include <string.h>
  2676. ], [ const char *pt, *et;
  2677. et = __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p ( ";," ) && ((size_t)(const void *)(( ";," )+ 1) - (size_t)(const void *)( ";," ) == 1) ? ((__a0 =((__const char *) ( ";," ))[0], __a0 == '\0') ? ((void) ( pt ),((void *)0) ) : ((__a1 = ((__const char *) ( ";," ))[1], __a1== '\0') ? (__extension__ (__builtin_constant_p ( __a0 ) && ( __a0 ) == '\0' ? (char *) __rawmemchr ( pt , __a0) : strchr( pt , __a0 ))) : ((__a2 = ((__const char *) ( ";," ))[2], __a2 == '\0') ? __strpbrk_c2 ( pt , __a0, __a1) :(((__const char *) ( ";," ))[3] == '\0' ? __strpbrk_c3 ( pt ,__a0, __a1, __a2): strpbrk ( pt , ";," ))))) : strpbrk ( pt , ";," )); }) ;
  2678. ],
  2679. kde_cv_opt_noinline_match=yes,
  2680. kde_cv_opt_noinline_match=no
  2681. )
  2682. CFLAGS="$ac_cflags_save"
  2683. fi
  2684. ])
  2685. ])
  2686. dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
  2687. AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
  2688. [dnl
  2689. if test "x$kde_use_qt_emb" != "xyes"; then
  2690. AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
  2691. AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
  2692. else
  2693. AC_REMOVE_FORBIDDEN(CXX, [-rpath])
  2694. AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
  2695. fi
  2696. ])
  2697. AC_DEFUN([AC_CHECK_COMPILERS],
  2698. [
  2699. AC_ARG_ENABLE(debug,
  2700. AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]),
  2701. [
  2702. case $enableval in
  2703. yes)
  2704. kde_use_debug_code="yes"
  2705. kde_use_debug_define=no
  2706. ;;
  2707. full)
  2708. kde_use_debug_code="full"
  2709. kde_use_debug_define=no
  2710. ;;
  2711. *)
  2712. kde_use_debug_code="no"
  2713. kde_use_debug_define=yes
  2714. ;;
  2715. esac
  2716. ],
  2717. [kde_use_debug_code="no"
  2718. kde_use_debug_define=no
  2719. ])
  2720. dnl Just for configure --help
  2721. AC_ARG_ENABLE(dummyoption,
  2722. AC_HELP_STRING([--disable-debug],
  2723. [disables debug output and debug symbols [default=no]]),
  2724. [],[])
  2725. AC_ARG_ENABLE(strict,
  2726. AC_HELP_STRING([--enable-strict],
  2727. [compiles with strict compiler options (may not work!)]),
  2728. [
  2729. if test $enableval = "no"; then
  2730. kde_use_strict_options="no"
  2731. else
  2732. kde_use_strict_options="yes"
  2733. fi
  2734. ], [kde_use_strict_options="no"])
  2735. AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]),
  2736. [
  2737. if test $enableval = "no"; then
  2738. kde_use_warnings="no"
  2739. else
  2740. kde_use_warnings="yes"
  2741. fi
  2742. ], [kde_use_warnings="yes"])
  2743. dnl enable warnings for debug build
  2744. if test "$kde_use_debug_code" != "no"; then
  2745. kde_use_warnings=yes
  2746. fi
  2747. AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]),
  2748. [kde_use_profiling=$enableval],
  2749. [kde_use_profiling="no"]
  2750. )
  2751. dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
  2752. CFLAGS=" $CFLAGS"
  2753. AC_PROG_CC
  2754. AC_PROG_CPP
  2755. if test "$GCC" = "yes"; then
  2756. if test "$kde_use_debug_code" != "no"; then
  2757. if test $kde_use_debug_code = "full"; then
  2758. CFLAGS="-g3 -fno-inline $CFLAGS"
  2759. else
  2760. CFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CFLAGS"
  2761. fi
  2762. else
  2763. CFLAGS="-O2 $CFLAGS"
  2764. fi
  2765. fi
  2766. if test "$kde_use_debug_define" = "yes"; then
  2767. CFLAGS="-DNDEBUG $CFLAGS"
  2768. fi
  2769. case "$host" in
  2770. *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
  2771. *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
  2772. esac
  2773. if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
  2774. LDFLAGS=""
  2775. fi
  2776. CXXFLAGS=" $CXXFLAGS"
  2777. AC_PROG_CXX
  2778. KDE_CHECK_FOR_BAD_COMPILER
  2779. if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
  2780. if test "$kde_use_debug_code" != "no"; then
  2781. if test "$CXX" = "KCC"; then
  2782. CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
  2783. else
  2784. if test "$kde_use_debug_code" = "full"; then
  2785. CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
  2786. else
  2787. CXXFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CXXFLAGS"
  2788. fi
  2789. fi
  2790. KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
  2791. dnl convenience compiler flags
  2792. KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
  2793. AC_SUBST(WOVERLOADED_VIRTUAL)
  2794. else
  2795. if test "$CXX" = "KCC"; then
  2796. CXXFLAGS="+K3 $CXXFLAGS"
  2797. else
  2798. CXXFLAGS="-O2 $CXXFLAGS"
  2799. fi
  2800. fi
  2801. fi
  2802. if test "$kde_use_debug_define" = "yes"; then
  2803. CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
  2804. fi
  2805. if test "$kde_use_profiling" = "yes"; then
  2806. KDE_CHECK_COMPILER_FLAG(pg,
  2807. [
  2808. CFLAGS="-pg $CFLAGS"
  2809. CXXFLAGS="-pg $CXXFLAGS"
  2810. ])
  2811. fi
  2812. if test "$kde_use_warnings" = "yes"; then
  2813. if test "$GCC" = "yes"; then
  2814. CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS"
  2815. case $host in
  2816. *-*-linux-gnu)
  2817. CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
  2818. CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts $CXXFLAGS"
  2819. KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
  2820. KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
  2821. ;;
  2822. esac
  2823. KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
  2824. KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
  2825. dnl ### FIXME: revert for KDE 4
  2826. KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"])
  2827. fi
  2828. fi
  2829. if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
  2830. CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
  2831. fi
  2832. AC_ARG_ENABLE(pch,
  2833. AC_HELP_STRING([--enable-pch],
  2834. [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]),
  2835. [ kde_use_pch=$enableval ],[ kde_use_pch=no ])
  2836. HAVE_GCC_VISIBILITY=0
  2837. AC_SUBST([HAVE_GCC_VISIBILITY])
  2838. if test "$GXX" = "yes"; then
  2839. gcc_no_reorder_blocks=NO
  2840. KDE_CHECK_COMPILER_FLAG(fno-reorder-blocks,[gcc_no_reorder_blocks=YES])
  2841. if test $kde_use_debug_code != "no" && \
  2842. test $kde_use_debug_code != "full" && \
  2843. test "YES" = "$gcc_no_reorder_blocks" ; then
  2844. CXXFLAGS="$CXXFLAGS -fno-reorder-blocks"
  2845. CFLAGS="$CFLAGS -fno-reorder-blocks"
  2846. fi
  2847. KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
  2848. KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
  2849. KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
  2850. KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= )
  2851. ENABLE_PERMISSIVE_FLAG="-fpermissive"
  2852. if test "$kde_use_pch" = "yes"; then
  2853. AC_MSG_CHECKING(whether gcc supports precompiling c header files)
  2854. echo >conftest.h
  2855. if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then
  2856. kde_gcc_supports_pch=yes
  2857. AC_MSG_RESULT(yes)
  2858. else
  2859. kde_gcc_supports_pch=no
  2860. AC_MSG_RESULT(no)
  2861. fi
  2862. if test "$kde_gcc_supports_pch" = "yes"; then
  2863. AC_MSG_CHECKING(whether gcc supports precompiling c++ header files)
  2864. if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then
  2865. kde_gcc_supports_pch=yes
  2866. AC_MSG_RESULT(yes)
  2867. else
  2868. kde_gcc_supports_pch=no
  2869. AC_MSG_RESULT(no)
  2870. fi
  2871. fi
  2872. rm -f conftest.h conftest.h.gch
  2873. fi
  2874. KDE_CHECK_FOR_OPT_NOINLINE_MATCH
  2875. if test "x$kde_cv_opt_noinline_match" = "xno" ; then
  2876. CFLAGS="`echo "$CFLAGS" | sed "s/ -fno-inline//"`"
  2877. fi
  2878. fi
  2879. AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes")
  2880. if test "$CXX" = "KCC"; then
  2881. dnl unfortunately we currently cannot disable exception support in KCC
  2882. dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
  2883. dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
  2884. dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= )
  2885. if test "$kde_use_pch" = "yes"; then
  2886. dnl TODO: support --pch-dir!
  2887. KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
  2888. dnl the below works (but the dir must exist), but it's
  2889. dnl useless for a whole package.
  2890. dnl The are precompiled headers for each source file, so when compiling
  2891. dnl from scratch, it doesn't make a difference, and they take up
  2892. dnl around ~5Mb _per_ sourcefile.
  2893. dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
  2894. dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
  2895. fi
  2896. dnl this flag controls inlining. by default KCC inlines in optimisation mode
  2897. dnl all implementations that are defined inside the class {} declaration.
  2898. dnl because of templates-compatibility with broken gcc compilers, this
  2899. dnl can cause excessive inlining. This flag limits it to a sane level
  2900. KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
  2901. KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
  2902. KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
  2903. KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
  2904. dnl Some source files are shared between multiple executables
  2905. dnl (or libraries) and some of those need template instantiations.
  2906. dnl In that case KCC needs to compile those sources with
  2907. dnl --one_instantiation_per_object. To make it easy for us we compile
  2908. dnl _all_ objects with that flag (--one_per is a shorthand).
  2909. KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
  2910. fi
  2911. AC_SUBST(USE_EXCEPTIONS)
  2912. dnl obsolete macro - provided to keep things going
  2913. USE_RTTI=
  2914. AC_SUBST(USE_RTTI)
  2915. case "$host" in
  2916. *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
  2917. *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
  2918. *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
  2919. *-*-solaris*)
  2920. if test "$GXX" = yes; then
  2921. libstdcpp=`$CXX -print-file-name=libstdc++.so`
  2922. if test ! -f $libstdcpp; then
  2923. AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
  2924. fi
  2925. fi
  2926. ;;
  2927. esac
  2928. AC_VALIDIFY_CXXFLAGS
  2929. AC_PROG_CXXCPP
  2930. if test "$GCC" = yes; then
  2931. NOOPT_CFLAGS=-O0
  2932. fi
  2933. KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
  2934. AC_ARG_ENABLE(coverage,
  2935. AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [
  2936. if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then
  2937. ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
  2938. ac_coverage_linker="-lgcc"
  2939. elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then
  2940. ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
  2941. ac_coverage_linker=""
  2942. else
  2943. AC_MSG_ERROR([coverage with your compiler is not supported])
  2944. fi
  2945. CFLAGS="$CFLAGS $ac_coverage_compiler"
  2946. CXXFLAGS="$CXXFLAGS $ac_coverage_compiler"
  2947. LDFLAGS="$LDFLAGS $ac_coverage_linker"
  2948. ])
  2949. AC_SUBST(NOOPT_CXXFLAGS)
  2950. AC_SUBST(NOOPT_CFLAGS)
  2951. AC_SUBST(ENABLE_PERMISSIVE_FLAG)
  2952. KDE_CHECK_NEW_LDFLAGS
  2953. KDE_CHECK_FINAL
  2954. KDE_CHECK_CLOSURE
  2955. KDE_CHECK_NMCHECK
  2956. ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
  2957. ])
  2958. AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG],
  2959. [
  2960. AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug,
  2961. [
  2962. AC_LANG_SAVE
  2963. AC_LANG_CPLUSPLUS
  2964. safe_CXXFLAGS=$CXXFLAGS
  2965. safe_LDFLAGS=$LDFLAGS
  2966. CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0"
  2967. LDFLAGS="$LDFLAGS -shared -fPIC"
  2968. AC_TRY_LINK(
  2969. [
  2970. /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */
  2971. #include <string>
  2972. int some_function( void ) __attribute__ ((visibility("default")));
  2973. int some_function( void )
  2974. {
  2975. std::string s("blafasel");
  2976. return 0;
  2977. }
  2978. ], [/* elvis is alive */],
  2979. kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes)
  2980. CXXFLAGS=$safe_CXXFLAGS
  2981. LDFLAGS=$safe_LDFLAGS
  2982. AC_LANG_RESTORE
  2983. ]
  2984. )
  2985. if test x$kde_cv_val_gcc_visibility_bug = xno; then
  2986. CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
  2987. fi
  2988. ]
  2989. )
  2990. AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY],
  2991. [
  2992. AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
  2993. AC_MSG_CHECKING([grepping for visibility push/pop in headers])
  2994. if test "x$GXX" = "xyes"; then
  2995. AC_LANG_SAVE
  2996. AC_LANG_CPLUSPLUS
  2997. AC_EGREP_CPP(
  2998. [GCC visibility push],
  2999. [ #include <exception>
  3000. ],
  3001. [
  3002. AC_MSG_RESULT(yes)
  3003. kde_stdc_visibility_patched=yes ],
  3004. [
  3005. AC_MSG_RESULT(no)
  3006. AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for
  3007. visibility support. Disabling -fvisibility=hidden])
  3008. kde_stdc_visibility_patched=no ])
  3009. AC_LANG_RESTORE
  3010. kde_have_gcc_visibility=no
  3011. KDE_CHECK_COMPILER_FLAG(fvisibility=hidden,
  3012. [
  3013. kde_have_gcc_visibility=yes
  3014. dnl the whole toolchain is just a mess, gcc is just too buggy
  3015. dnl to handle STL with visibility enabled. Lets reconsider
  3016. dnl when gcc 4.2 is out or when things get fixed in the compiler.
  3017. dnl Contact mueller@kde.org for details.
  3018. AC_ARG_ENABLE(gcc-hidden-visibility,
  3019. AC_HELP_STRING([--enable-gcc-hidden-visibility],[toolchain hidden visibility [default=no]]),
  3020. [kde_have_gcc_visibility=$enableval],
  3021. [kde_have_gcc_visibility=no])
  3022. AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched,
  3023. [
  3024. AC_LANG_SAVE
  3025. AC_LANG_CPLUSPLUS
  3026. safe_CXXFLAGS=$CXXFLAGS
  3027. CXXFLAGS="$CXXFLAGS $all_includes"
  3028. AC_TRY_COMPILE(
  3029. [
  3030. #include <qglobal.h>
  3031. #if Q_EXPORT - 0 != 0
  3032. /* if this compiles, then Q_EXPORT is undefined */
  3033. /* if Q_EXPORT is nonempty, this will break compilation */
  3034. #endif
  3035. ], [/* elvis is alive */],
  3036. kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes)
  3037. CXXFLAGS=$safe_CXXFLAGS
  3038. AC_LANG_RESTORE
  3039. ]
  3040. )
  3041. if test x$kde_have_gcc_visibility = "xyes" && test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
  3042. CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
  3043. KDE_CHECK_VISIBILITY_GCC_BUG
  3044. HAVE_GCC_VISIBILITY=1
  3045. AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
  3046. fi
  3047. ])
  3048. fi
  3049. ])
  3050. AC_DEFUN([KDE_ADD_DEPENDENCIES],
  3051. [
  3052. [A]M_DEPENDENCIES(CC)
  3053. [A]M_DEPENDENCIES(CXX)
  3054. ])
  3055. dnl just a wrapper to clean up configure.in
  3056. AC_DEFUN([KDE_PROG_LIBTOOL],
  3057. [
  3058. AC_REQUIRE([AC_CHECK_COMPILERS])
  3059. AC_REQUIRE([AC_ENABLE_SHARED])
  3060. AC_REQUIRE([AC_ENABLE_STATIC])
  3061. AC_REQUIRE([AC_LIBTOOL_DLOPEN])
  3062. AC_REQUIRE([KDE_CHECK_LIB64])
  3063. AC_OBJEXT
  3064. AC_EXEEXT
  3065. AM_PROG_LIBTOOL
  3066. AC_LIBTOOL_CXX
  3067. LIBTOOL_SHELL="/bin/sh ./libtool"
  3068. # LIBTOOL="$LIBTOOL --silent"
  3069. KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
  3070. AC_SUBST(KDE_PLUGIN)
  3071. # This hack ensures that libtool creates shared libs for kunittest plugins. By default check_LTLIBRARIES makes static libs.
  3072. KDE_CHECK_PLUGIN="\$(KDE_PLUGIN) -rpath \$(libdir)"
  3073. AC_SUBST(KDE_CHECK_PLUGIN)
  3074. # we patch configure quite some so we better keep that consistent for incremental runs
  3075. AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
  3076. ])
  3077. AC_DEFUN([KDE_CHECK_LIB64],
  3078. [
  3079. AC_ARG_ENABLE(libsuffix,
  3080. AC_HELP_STRING([--enable-libsuffix],
  3081. [/lib directory suffix (64,32,none,auto[=default])]),
  3082. kdelibsuff=$enableval, kdelibsuff="auto")
  3083. if test "$kdelibsuff" = "auto"; then
  3084. cat > conftest.c << EOF
  3085. #include <stdio.h>
  3086. int main() {
  3087. return 0;
  3088. }
  3089. EOF
  3090. kdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out |sed -ne '/libc.so/{
  3091. s,.*/lib\([[^\/]]*\)/.*,\1,
  3092. p
  3093. }'`
  3094. rm -rf conftest.*
  3095. fi
  3096. if test "$kdelibsuff" = "no" || test "$kdelibsuff" = "none"; then
  3097. kdelibsuff=
  3098. fi
  3099. if test -z "$kdelibsuff"; then
  3100. AC_MSG_RESULT([not using lib directory suffix])
  3101. AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
  3102. else
  3103. if test "$libdir" = '${exec_prefix}/lib'; then
  3104. libdir="$libdir${kdelibsuff}"
  3105. AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms
  3106. fi
  3107. AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories)
  3108. AC_MSG_RESULT([using lib directory suffix $kdelibsuff])
  3109. fi
  3110. ])
  3111. AC_DEFUN([KDE_CHECK_TYPES],
  3112. [ AC_CHECK_SIZEOF(int, 4)dnl
  3113. AC_CHECK_SIZEOF(short)dnl
  3114. AC_CHECK_SIZEOF(long, 4)dnl
  3115. AC_CHECK_SIZEOF(char *, 4)dnl
  3116. ])dnl
  3117. dnl Not used - kept for compat only?
  3118. AC_DEFUN([KDE_DO_IT_ALL],
  3119. [
  3120. AC_CANONICAL_SYSTEM
  3121. AC_ARG_PROGRAM
  3122. AM_INIT_AUTOMAKE($1, $2)
  3123. AM_DISABLE_LIBRARIES
  3124. AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  3125. AC_CHECK_COMPILERS
  3126. KDE_PROG_LIBTOOL
  3127. AM_KDE_WITH_NLS
  3128. AC_PATH_KDE
  3129. ])
  3130. AC_DEFUN([AC_CHECK_RPATH],
  3131. [
  3132. AC_MSG_CHECKING(for rpath)
  3133. AC_ARG_ENABLE(rpath,
  3134. AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]),
  3135. USE_RPATH=$enableval, USE_RPATH=yes)
  3136. if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
  3137. KDE_RPATH="-R \$(libdir)"
  3138. if test "$kde_libraries" != "$libdir"; then
  3139. KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)"
  3140. fi
  3141. if test -n "$qt_libraries"; then
  3142. KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
  3143. fi
  3144. dnl $x_libraries is set to /usr/lib in case
  3145. if test -n "$X_LDFLAGS"; then
  3146. X_RPATH="-R \$(x_libraries)"
  3147. KDE_RPATH="$KDE_RPATH $X_RPATH"
  3148. fi
  3149. if test -n "$KDE_EXTRA_RPATH"; then
  3150. KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
  3151. fi
  3152. fi
  3153. AC_SUBST(KDE_EXTRA_RPATH)
  3154. AC_SUBST(KDE_RPATH)
  3155. AC_SUBST(X_RPATH)
  3156. AC_MSG_RESULT($USE_RPATH)
  3157. ])
  3158. dnl Check for the type of the third argument of getsockname
  3159. AC_DEFUN([AC_CHECK_SOCKLEN_T],
  3160. [
  3161. AC_MSG_CHECKING(for socklen_t)
  3162. AC_CACHE_VAL(kde_cv_socklen_t,
  3163. [
  3164. AC_LANG_PUSH(C++)
  3165. kde_cv_socklen_t=no
  3166. AC_TRY_COMPILE([
  3167. #include <sys/types.h>
  3168. #include <sys/socket.h>
  3169. ],
  3170. [
  3171. socklen_t len;
  3172. getpeername(0,0,&len);
  3173. ],
  3174. [
  3175. kde_cv_socklen_t=yes
  3176. kde_cv_socklen_t_equiv=socklen_t
  3177. ])
  3178. AC_LANG_POP(C++)
  3179. ])
  3180. AC_MSG_RESULT($kde_cv_socklen_t)
  3181. if test $kde_cv_socklen_t = no; then
  3182. AC_MSG_CHECKING([for socklen_t equivalent for socket functions])
  3183. AC_CACHE_VAL(kde_cv_socklen_t_equiv,
  3184. [
  3185. kde_cv_socklen_t_equiv=int
  3186. AC_LANG_PUSH(C++)
  3187. for t in int size_t unsigned long "unsigned long"; do
  3188. AC_TRY_COMPILE([
  3189. #include <sys/types.h>
  3190. #include <sys/socket.h>
  3191. ],
  3192. [
  3193. $t len;
  3194. getpeername(0,0,&len);
  3195. ],
  3196. [
  3197. kde_cv_socklen_t_equiv="$t"
  3198. break
  3199. ])
  3200. done
  3201. AC_LANG_POP(C++)
  3202. ])
  3203. AC_MSG_RESULT($kde_cv_socklen_t_equiv)
  3204. fi
  3205. AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv,
  3206. [type to use in place of socklen_t if not defined])
  3207. AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv,
  3208. [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)])
  3209. ])
  3210. dnl This is a merge of some macros out of the gettext aclocal.m4
  3211. dnl since we don't need anything, I took the things we need
  3212. dnl the copyright for them is:
  3213. dnl >
  3214. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  3215. dnl This Makefile.in is free software; the Free Software Foundation
  3216. dnl gives unlimited permission to copy and/or distribute it,
  3217. dnl with or without modifications, as long as this notice is preserved.
  3218. dnl This program is distributed in the hope that it will be useful,
  3219. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  3220. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  3221. dnl PARTICULAR PURPOSE.
  3222. dnl >
  3223. dnl for this file it is relicensed under LGPL
  3224. AC_DEFUN([AM_KDE_WITH_NLS],
  3225. [
  3226. dnl If we use NLS figure out what method
  3227. AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
  3228. [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
  3229. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  3230. if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
  3231. AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
  3232. GMSGFMT=":"
  3233. fi
  3234. MSGFMT=$GMSGFMT
  3235. AC_SUBST(GMSGFMT)
  3236. AC_SUBST(MSGFMT)
  3237. AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
  3238. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  3239. dnl Test whether we really found GNU xgettext.
  3240. if test "$XGETTEXT" != ":"; then
  3241. dnl If it is no GNU xgettext we define it as : so that the
  3242. dnl Makefiles still can work.
  3243. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  3244. : ;
  3245. else
  3246. AC_MSG_RESULT(
  3247. [found xgettext programs is not GNU xgettext; ignore it])
  3248. XGETTEXT=":"
  3249. fi
  3250. fi
  3251. AC_SUBST(XGETTEXT)
  3252. ])
  3253. # Search path for a program which passes the given test.
  3254. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  3255. # serial 1
  3256. # Stephan Kulow: I appended a _KDE against name conflicts
  3257. dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
  3258. dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  3259. AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
  3260. [# Extract the first word of "$2", so it can be a program name with args.
  3261. set dummy $2; ac_word=[$]2
  3262. AC_MSG_CHECKING([for $ac_word])
  3263. AC_CACHE_VAL(ac_cv_path_$1,
  3264. [case "[$]$1" in
  3265. /*)
  3266. ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  3267. ;;
  3268. *)
  3269. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  3270. for ac_dir in ifelse([$5], , $PATH, [$5]); do
  3271. test -z "$ac_dir" && ac_dir=.
  3272. if test -f $ac_dir/$ac_word; then
  3273. if [$3]; then
  3274. ac_cv_path_$1="$ac_dir/$ac_word"
  3275. break
  3276. fi
  3277. fi
  3278. done
  3279. IFS="$ac_save_ifs"
  3280. dnl If no 4th arg is given, leave the cache variable unset,
  3281. dnl so AC_PATH_PROGS will keep looking.
  3282. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  3283. ])dnl
  3284. ;;
  3285. esac])dnl
  3286. $1="$ac_cv_path_$1"
  3287. if test -n "[$]$1"; then
  3288. AC_MSG_RESULT([$]$1)
  3289. else
  3290. AC_MSG_RESULT(no)
  3291. fi
  3292. AC_SUBST($1)dnl
  3293. ])
  3294. # Check whether LC_MESSAGES is available in <locale.h>.
  3295. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  3296. # serial 1
  3297. AC_DEFUN([AM_LC_MESSAGES],
  3298. [if test $ac_cv_header_locale_h = yes; then
  3299. AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  3300. [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  3301. am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  3302. if test $am_cv_val_LC_MESSAGES = yes; then
  3303. AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
  3304. fi
  3305. fi])
  3306. dnl From Jim Meyering.
  3307. dnl FIXME: migrate into libit.
  3308. AC_DEFUN([AM_FUNC_OBSTACK],
  3309. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  3310. [AC_TRY_LINK([#include "obstack.h"],
  3311. [struct obstack *mem;obstack_free(mem,(char *) 0)],
  3312. am_cv_func_obstack=yes,
  3313. am_cv_func_obstack=no)])
  3314. if test $am_cv_func_obstack = yes; then
  3315. AC_DEFINE(HAVE_OBSTACK)
  3316. else
  3317. LIBOBJS="$LIBOBJS obstack.o"
  3318. fi
  3319. ])
  3320. dnl From Jim Meyering. Use this if you use the GNU error.[ch].
  3321. dnl FIXME: Migrate into libit
  3322. AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
  3323. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  3324. [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  3325. am_cv_lib_error_at_line=yes,
  3326. am_cv_lib_error_at_line=no)])
  3327. if test $am_cv_lib_error_at_line = no; then
  3328. LIBOBJS="$LIBOBJS error.o"
  3329. fi
  3330. AC_SUBST(LIBOBJS)dnl
  3331. ])
  3332. # Macro to add for using GNU gettext.
  3333. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  3334. # serial 1
  3335. # Stephan Kulow: I put a KDE in it to avoid name conflicts
  3336. AC_DEFUN([AM_KDE_GNU_GETTEXT],
  3337. [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  3338. AC_REQUIRE([AC_PROG_RANLIB])dnl
  3339. AC_REQUIRE([AC_HEADER_STDC])dnl
  3340. AC_REQUIRE([AC_TYPE_OFF_T])dnl
  3341. AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  3342. AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  3343. AC_REQUIRE([AC_FUNC_MMAP])dnl
  3344. AC_REQUIRE([AM_KDE_WITH_NLS])dnl
  3345. AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
  3346. AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
  3347. __argz_count __argz_stringify __argz_next])
  3348. AC_MSG_CHECKING(for stpcpy)
  3349. AC_CACHE_VAL(kde_cv_func_stpcpy,
  3350. [
  3351. kde_safe_cxxflags=$CXXFLAGS
  3352. CXXFLAGS="-Werror"
  3353. AC_LANG_SAVE
  3354. AC_LANG_CPLUSPLUS
  3355. AC_TRY_COMPILE([
  3356. #include <string.h>
  3357. ],
  3358. [
  3359. char buffer[200];
  3360. stpcpy(buffer, buffer);
  3361. ],
  3362. kde_cv_func_stpcpy=yes,
  3363. kde_cv_func_stpcpy=no)
  3364. AC_LANG_RESTORE
  3365. CXXFLAGS=$kde_safe_cxxflags
  3366. ])
  3367. AC_MSG_RESULT($kde_cv_func_stpcpy)
  3368. if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
  3369. AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
  3370. fi
  3371. AM_LC_MESSAGES
  3372. if test "x$CATOBJEXT" != "x"; then
  3373. if test "x$ALL_LINGUAS" = "x"; then
  3374. LINGUAS=
  3375. else
  3376. AC_MSG_CHECKING(for catalogs to be installed)
  3377. NEW_LINGUAS=
  3378. for lang in ${LINGUAS=$ALL_LINGUAS}; do
  3379. case "$ALL_LINGUAS" in
  3380. *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  3381. esac
  3382. done
  3383. LINGUAS=$NEW_LINGUAS
  3384. AC_MSG_RESULT($LINGUAS)
  3385. fi
  3386. dnl Construct list of names of catalog files to be constructed.
  3387. if test -n "$LINGUAS"; then
  3388. for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  3389. fi
  3390. fi
  3391. ])
  3392. AC_DEFUN([AC_HAVE_XPM],
  3393. [AC_REQUIRE_CPP()dnl
  3394. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3395. test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
  3396. test -z "$XPM_INCLUDE" && XPM_INCLUDE=
  3397. AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]),
  3398. xpm_test=$withval, xpm_test="yes")
  3399. if test "x$xpm_test" = xno; then
  3400. ac_cv_have_xpm=no
  3401. else
  3402. AC_MSG_CHECKING(for XPM)
  3403. AC_CACHE_VAL(ac_cv_have_xpm,
  3404. [
  3405. ac_save_ldflags="$LDFLAGS"
  3406. ac_save_cflags="$CFLAGS"
  3407. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  3408. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
  3409. else
  3410. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
  3411. fi
  3412. CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
  3413. test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
  3414. AC_TRY_LINK([#include <X11/xpm.h>],[],
  3415. ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
  3416. LDFLAGS="$ac_save_ldflags"
  3417. CFLAGS="$ac_save_cflags"
  3418. ])dnl
  3419. if test "$ac_cv_have_xpm" = no; then
  3420. AC_MSG_RESULT(no)
  3421. XPM_LDFLAGS=""
  3422. XPMINC=""
  3423. $2
  3424. else
  3425. AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
  3426. if test "$XPM_LDFLAGS" = ""; then
  3427. XPMLIB='-lXpm $(LIB_X11)'
  3428. else
  3429. XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
  3430. fi
  3431. if test "$XPM_INCLUDE" = ""; then
  3432. XPMINC=""
  3433. else
  3434. XPMINC="-I$XPM_INCLUDE"
  3435. fi
  3436. AC_MSG_RESULT(yes)
  3437. $1
  3438. fi
  3439. fi
  3440. AC_SUBST(XPMINC)
  3441. AC_SUBST(XPMLIB)
  3442. ])
  3443. AC_DEFUN([AC_HAVE_DPMS],
  3444. [AC_REQUIRE_CPP()dnl
  3445. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3446. test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
  3447. test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
  3448. DPMS_LIB=
  3449. AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]),
  3450. dpms_test=$withval, dpms_test="yes")
  3451. if test "x$dpms_test" = xno; then
  3452. ac_cv_have_dpms=no
  3453. else
  3454. AC_MSG_CHECKING(for DPMS)
  3455. dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
  3456. dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
  3457. AC_CACHE_VAL(ac_cv_have_dpms,
  3458. [
  3459. if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
  3460. AC_MSG_RESULT(no)
  3461. ac_cv_have_dpms="no"
  3462. else
  3463. ac_save_ldflags="$LDFLAGS"
  3464. ac_save_cflags="$CFLAGS"
  3465. ac_save_libs="$LIBS"
  3466. LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries"
  3467. LIBS="-lX11 -lXext $LIBSOCKET"
  3468. CFLAGS="$CFLAGS $X_INCLUDES"
  3469. test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  3470. AC_TRY_LINK([
  3471. #include <X11/Xproto.h>
  3472. #include <X11/X.h>
  3473. #include <X11/Xlib.h>
  3474. #include <X11/extensions/dpms.h>
  3475. int foo_test_dpms()
  3476. { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  3477. ac_cv_have_dpms="yes", [
  3478. LIBS="-lXdpms $LIBS"
  3479. AC_TRY_LINK([
  3480. #include <X11/Xproto.h>
  3481. #include <X11/X.h>
  3482. #include <X11/Xlib.h>
  3483. #include <X11/extensions/dpms.h>
  3484. int foo_test_dpms()
  3485. { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  3486. [
  3487. ac_cv_have_dpms="-lXdpms"
  3488. ],ac_cv_have_dpms="no")
  3489. ])
  3490. LDFLAGS="$ac_save_ldflags"
  3491. CFLAGS="$ac_save_cflags"
  3492. LIBS="$ac_save_libs"
  3493. fi
  3494. ])dnl
  3495. if test "$ac_cv_have_dpms" = no; then
  3496. AC_MSG_RESULT(no)
  3497. DPMS_LDFLAGS=""
  3498. DPMSINC=""
  3499. $2
  3500. else
  3501. AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
  3502. if test "$ac_cv_have_dpms" = "-lXdpms"; then
  3503. DPMS_LIB="-lXdpms"
  3504. fi
  3505. if test "$DPMS_LDFLAGS" = ""; then
  3506. DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
  3507. else
  3508. DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
  3509. fi
  3510. if test "$DPMS_INCLUDE" = ""; then
  3511. DPMSINC=""
  3512. else
  3513. DPMSINC="-I$DPMS_INCLUDE"
  3514. fi
  3515. AC_MSG_RESULT(yes)
  3516. $1
  3517. fi
  3518. fi
  3519. ac_save_cflags="$CFLAGS"
  3520. CFLAGS="$CFLAGS $X_INCLUDES"
  3521. test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  3522. AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
  3523. [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
  3524. AC_CHECK_DECL(DPMSCapable,
  3525. AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
  3526. [#include <X11/Xlib.h>
  3527. #include <X11/extensions/dpms.h>])
  3528. AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
  3529. [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
  3530. AC_CHECK_DECL(DPMSInfo,
  3531. AC_DEFINE(HAVE_DPMSINFO_PROTO),,
  3532. [#include <X11/Xlib.h>
  3533. #include <X11/extensions/dpms.h>])
  3534. CFLAGS="$ac_save_cflags"
  3535. AC_SUBST(DPMSINC)
  3536. AC_SUBST(DPMSLIB)
  3537. ])
  3538. AC_DEFUN([AC_HAVE_GL],
  3539. [AC_REQUIRE_CPP()dnl
  3540. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3541. test -z "$GL_LDFLAGS" && GL_LDFLAGS=
  3542. test -z "$GL_INCLUDE" && GL_INCLUDE=
  3543. AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]),
  3544. gl_test=$withval, gl_test="yes")
  3545. if test "x$kde_use_qt_emb" = "xyes"; then
  3546. # GL and Qt Embedded is a no-go for now.
  3547. ac_cv_have_gl=no
  3548. elif test "x$gl_test" = xno; then
  3549. ac_cv_have_gl=no
  3550. else
  3551. AC_MSG_CHECKING(for GL)
  3552. AC_CACHE_VAL(ac_cv_have_gl,
  3553. [
  3554. AC_LANG_SAVE
  3555. AC_LANG_CPLUSPLUS
  3556. ac_save_ldflags=$LDFLAGS
  3557. ac_save_cxxflags=$CXXFLAGS
  3558. ac_save_libs=$LIBS
  3559. LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries"
  3560. LIBS="$LIBS -lGL -lGLU"
  3561. test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11"
  3562. LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET"
  3563. CXXFLAGS="$CFLAGS $X_INCLUDES"
  3564. test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  3565. AC_TRY_LINK([#include <GL/gl.h>
  3566. #include <GL/glu.h>
  3567. ], [],
  3568. ac_cv_have_gl="yes", ac_cv_have_gl="no")
  3569. AC_LANG_RESTORE
  3570. LDFLAGS=$ac_save_ldflags
  3571. CXXFLAGS=$ac_save_cxxflags
  3572. LIBS=$ac_save_libs
  3573. ])dnl
  3574. if test "$ac_cv_have_gl" = "no"; then
  3575. AC_MSG_RESULT(no)
  3576. GL_LDFLAGS=""
  3577. GLINC=""
  3578. $2
  3579. else
  3580. AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
  3581. if test "$GL_LDFLAGS" = ""; then
  3582. GLLIB='-lGLU -lGL $(LIB_X11)'
  3583. else
  3584. GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
  3585. fi
  3586. if test "$GL_INCLUDE" = ""; then
  3587. GLINC=""
  3588. else
  3589. GLINC="-I$GL_INCLUDE"
  3590. fi
  3591. AC_MSG_RESULT($ac_cv_have_gl)
  3592. $1
  3593. fi
  3594. fi
  3595. AC_SUBST(GLINC)
  3596. AC_SUBST(GLLIB)
  3597. ])
  3598. dnl shadow password and PAM magic - maintained by ossi@kde.org
  3599. AC_DEFUN([KDE_PAM], [
  3600. AC_REQUIRE([KDE_CHECK_LIBDL])
  3601. want_pam=
  3602. AC_ARG_WITH(pam,
  3603. AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]),
  3604. [ if test "x$withval" = "xyes"; then
  3605. want_pam=yes
  3606. pam_service=kde
  3607. elif test "x$withval" = "xno"; then
  3608. want_pam=no
  3609. else
  3610. want_pam=yes
  3611. pam_service=$withval
  3612. fi
  3613. ], [ pam_service=kde ])
  3614. use_pam=
  3615. PAMLIBS=
  3616. if test "x$want_pam" != xno; then
  3617. AC_CHECK_LIB(pam, pam_start, [
  3618. AC_CHECK_HEADER(security/pam_appl.h,
  3619. [ pam_header=security/pam_appl.h ],
  3620. [ AC_CHECK_HEADER(pam/pam_appl.h,
  3621. [ pam_header=pam/pam_appl.h ],
  3622. [
  3623. AC_MSG_WARN([PAM detected, but no headers found!
  3624. Make sure you have the necessary development packages installed.])
  3625. ]
  3626. )
  3627. ]
  3628. )
  3629. ], , $LIBDL)
  3630. if test -z "$pam_header"; then
  3631. if test "x$want_pam" = xyes; then
  3632. AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
  3633. fi
  3634. else
  3635. AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
  3636. PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
  3637. use_pam=yes
  3638. dnl darwin claims to be something special
  3639. if test "$pam_header" = "pam/pam_appl.h"; then
  3640. AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
  3641. fi
  3642. dnl test whether struct pam_message is const (Linux) or not (Sun)
  3643. AC_MSG_CHECKING(for const pam_message)
  3644. AC_EGREP_HEADER([struct pam_message], $pam_header,
  3645. [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
  3646. [AC_MSG_RESULT([const: Linux-type PAM])],
  3647. [AC_MSG_RESULT([nonconst: Sun-type PAM])
  3648. AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
  3649. )],
  3650. [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
  3651. fi
  3652. fi
  3653. AC_SUBST(PAMLIBS)
  3654. ])
  3655. dnl DEF_PAM_SERVICE(arg name, full name, define name)
  3656. AC_DEFUN([DEF_PAM_SERVICE], [
  3657. AC_ARG_WITH($1-pam,
  3658. AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]),
  3659. [ if test "x$use_pam" = xyes; then
  3660. $3_PAM_SERVICE=$withval
  3661. else
  3662. AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
  3663. You may want to enforce it by using --with-pam.])
  3664. fi
  3665. ],
  3666. [ if test "x$use_pam" = xyes; then
  3667. $3_PAM_SERVICE="$pam_service"
  3668. fi
  3669. ])
  3670. if test -n "$$3_PAM_SERVICE"; then
  3671. AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
  3672. AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
  3673. fi
  3674. AC_SUBST($3_PAM_SERVICE)
  3675. ])
  3676. AC_DEFUN([KDE_SHADOWPASSWD], [
  3677. AC_REQUIRE([KDE_PAM])
  3678. AC_CHECK_LIB(shadow, getspent,
  3679. [ LIBSHADOW="-lshadow"
  3680. ac_use_shadow=yes
  3681. ],
  3682. [ dnl for UnixWare
  3683. AC_CHECK_LIB(gen, getspent,
  3684. [ LIBGEN="-lgen"
  3685. ac_use_shadow=yes
  3686. ],
  3687. [ AC_CHECK_FUNC(getspent,
  3688. [ ac_use_shadow=yes ],
  3689. [ ac_use_shadow=no ])
  3690. ])
  3691. ])
  3692. AC_SUBST(LIBSHADOW)
  3693. AC_SUBST(LIBGEN)
  3694. AC_MSG_CHECKING([for shadow passwords])
  3695. AC_ARG_WITH(shadow,
  3696. AC_HELP_STRING([--with-shadow],[If you want shadow password support]),
  3697. [ if test "x$withval" != "xno"; then
  3698. use_shadow=yes
  3699. else
  3700. use_shadow=no
  3701. fi
  3702. ], [
  3703. use_shadow="$ac_use_shadow"
  3704. ])
  3705. if test "x$use_shadow" = xyes; then
  3706. AC_MSG_RESULT(yes)
  3707. AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
  3708. else
  3709. AC_MSG_RESULT(no)
  3710. LIBSHADOW=
  3711. LIBGEN=
  3712. fi
  3713. dnl finally make the relevant binaries setuid root, if we have shadow passwds.
  3714. dnl this still applies, if we could use it indirectly through pam.
  3715. if test "x$use_shadow" = xyes ||
  3716. ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
  3717. case $host in
  3718. *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
  3719. SETUIDFLAGS="-m 4755 -o root";;
  3720. *)
  3721. SETUIDFLAGS="-m 4755";;
  3722. esac
  3723. fi
  3724. AC_SUBST(SETUIDFLAGS)
  3725. ])
  3726. AC_DEFUN([KDE_PASSWDLIBS], [
  3727. AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
  3728. AC_REQUIRE([KDE_PAM])
  3729. AC_REQUIRE([KDE_SHADOWPASSWD])
  3730. if test "x$use_pam" = "xyes"; then
  3731. PASSWDLIBS="$PAMLIBS"
  3732. else
  3733. PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
  3734. fi
  3735. dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
  3736. dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires
  3737. dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
  3738. dnl may need to read /etc/master.passwd).
  3739. case $host in
  3740. *-*-freebsd*)
  3741. SETUIDFLAGS="-m 4755 -o root"
  3742. ;;
  3743. *)
  3744. ;;
  3745. esac
  3746. AC_SUBST(PASSWDLIBS)
  3747. ])
  3748. AC_DEFUN([KDE_CHECK_LIBDL],
  3749. [
  3750. AC_CHECK_LIB(dl, dlopen, [
  3751. LIBDL="-ldl"
  3752. ac_cv_have_dlfcn=yes
  3753. ])
  3754. AC_CHECK_LIB(dld, shl_unload, [
  3755. LIBDL="-ldld"
  3756. ac_cv_have_shload=yes
  3757. ])
  3758. AC_SUBST(LIBDL)
  3759. ])
  3760. AC_DEFUN([KDE_CHECK_DLOPEN],
  3761. [
  3762. KDE_CHECK_LIBDL
  3763. AC_CHECK_HEADERS(dlfcn.h dl.h)
  3764. if test "$ac_cv_header_dlfcn_h" = "no"; then
  3765. ac_cv_have_dlfcn=no
  3766. fi
  3767. if test "$ac_cv_header_dl_h" = "no"; then
  3768. ac_cv_have_shload=no
  3769. fi
  3770. dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
  3771. dnl (MM)
  3772. AC_ARG_ENABLE(dlopen,
  3773. AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]),
  3774. enable_dlopen=$enableval,
  3775. enable_dlopen=yes)
  3776. # override the user's opinion, if we know it better ;)
  3777. if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
  3778. enable_dlopen=no
  3779. fi
  3780. if test "$ac_cv_have_dlfcn" = "yes"; then
  3781. AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
  3782. fi
  3783. if test "$ac_cv_have_shload" = "yes"; then
  3784. AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
  3785. fi
  3786. if test "$enable_dlopen" = no ; then
  3787. test -n "$1" && eval $1
  3788. else
  3789. test -n "$2" && eval $2
  3790. fi
  3791. ])
  3792. AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
  3793. [
  3794. KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
  3795. KDE_PROG_LIBTOOL
  3796. AC_MSG_CHECKING([dynamic loading])
  3797. eval "`egrep '^build_libtool_libs=' libtool`"
  3798. if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
  3799. dynamic_loading=yes
  3800. AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
  3801. else
  3802. dynamic_loading=no
  3803. fi
  3804. AC_MSG_RESULT($dynamic_loading)
  3805. if test "$dynamic_loading" = "yes"; then
  3806. $1
  3807. else
  3808. $2
  3809. fi
  3810. ])
  3811. AC_DEFUN([KDE_ADD_INCLUDES],
  3812. [
  3813. if test -z "$1"; then
  3814. test_include="Pix.h"
  3815. else
  3816. test_include="$1"
  3817. fi
  3818. AC_MSG_CHECKING([for libg++ ($test_include)])
  3819. AC_CACHE_VAL(kde_cv_libgpp_includes,
  3820. [
  3821. kde_cv_libgpp_includes=no
  3822. for ac_dir in \
  3823. \
  3824. /usr/include/g++ \
  3825. /usr/include \
  3826. /usr/unsupported/include \
  3827. /opt/include \
  3828. $extra_include \
  3829. ; \
  3830. do
  3831. if test -r "$ac_dir/$test_include"; then
  3832. kde_cv_libgpp_includes=$ac_dir
  3833. break
  3834. fi
  3835. done
  3836. ])
  3837. AC_MSG_RESULT($kde_cv_libgpp_includes)
  3838. if test "$kde_cv_libgpp_includes" != "no"; then
  3839. all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
  3840. fi
  3841. ])
  3842. ])
  3843. AC_DEFUN([KDE_CHECK_LIBPTHREAD],
  3844. [
  3845. dnl This code is here specifically to handle the
  3846. dnl various flavors of threading library on FreeBSD
  3847. dnl 4-, 5-, and 6-, and the (weird) rules around it.
  3848. dnl There may be an environment PTHREAD_LIBS that
  3849. dnl specifies what to use; otherwise, search for it.
  3850. dnl -pthread is special cased and unsets LIBPTHREAD
  3851. dnl below if found.
  3852. LIBPTHREAD=""
  3853. if test -n "$PTHREAD_LIBS"; then
  3854. if test "x$PTHREAD_LIBS" = "x-pthread" ; then
  3855. LIBPTHREAD="PTHREAD"
  3856. else
  3857. PTHREAD_LIBS_save="$PTHREAD_LIBS"
  3858. PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
  3859. AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS])
  3860. KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [
  3861. LIBPTHREAD="$PTHREAD_LIBS_save"])
  3862. PTHREAD_LIBS="$PTHREAD_LIBS_save"
  3863. fi
  3864. fi
  3865. dnl Is this test really needed, in the face of the Tru64 test below?
  3866. if test -z "$LIBPTHREAD"; then
  3867. AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"])
  3868. fi
  3869. dnl This is a special Tru64 check, see BR 76171 issue #18.
  3870. if test -z "$LIBPTHREAD" ; then
  3871. AC_MSG_CHECKING([for pthread_create in -lpthread])
  3872. kde_safe_libs=$LIBS
  3873. LIBS="$LIBS -lpthread"
  3874. AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
  3875. AC_MSG_RESULT(yes)
  3876. LIBPTHREAD="-lpthread"],[
  3877. AC_MSG_RESULT(no)])
  3878. LIBS=$kde_safe_libs
  3879. fi
  3880. dnl Un-special-case for FreeBSD.
  3881. if test "x$LIBPTHREAD" = "xPTHREAD" ; then
  3882. LIBPTHREAD=""
  3883. fi
  3884. AC_SUBST(LIBPTHREAD)
  3885. ])
  3886. AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
  3887. [
  3888. USE_THREADS=""
  3889. if test -z "$LIBPTHREAD"; then
  3890. KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
  3891. fi
  3892. AH_VERBATIM(__svr_define, [
  3893. #if defined(__SVR4) && !defined(__svr4__)
  3894. #define __svr4__ 1
  3895. #endif
  3896. ])
  3897. case $host_os in
  3898. solaris*)
  3899. KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
  3900. CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
  3901. ;;
  3902. freebsd*)
  3903. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
  3904. ;;
  3905. aix*)
  3906. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
  3907. LIBPTHREAD="$LIBPTHREAD -lc_r"
  3908. ;;
  3909. linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  3910. if test "$CXX" = "KCC"; then
  3911. CXXFLAGS="$CXXFLAGS --thread_safe"
  3912. NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
  3913. fi
  3914. ;;
  3915. *)
  3916. ;;
  3917. esac
  3918. AC_SUBST(USE_THREADS)
  3919. AC_SUBST(LIBPTHREAD)
  3920. ])
  3921. AC_DEFUN([KDE_CHECK_THREADING],
  3922. [
  3923. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  3924. AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
  3925. dnl default is yes if libpthread is found and no if no libpthread is available
  3926. if test -z "$LIBPTHREAD"; then
  3927. if test -z "$USE_THREADS"; then
  3928. kde_check_threading_default=no
  3929. else
  3930. kde_check_threading_default=yes
  3931. fi
  3932. else
  3933. kde_check_threading_default=yes
  3934. fi
  3935. AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]),
  3936. kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
  3937. if test "x$kde_use_threading" = "xyes"; then
  3938. AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
  3939. fi
  3940. ])
  3941. AC_DEFUN([KDE_TRY_LINK_PYTHON],
  3942. [
  3943. if test "$kde_python_link_found" = no; then
  3944. if test "$1" = normal; then
  3945. AC_MSG_CHECKING(if a Python application links)
  3946. else
  3947. AC_MSG_CHECKING(if Python depends on $2)
  3948. fi
  3949. AC_CACHE_VAL(kde_cv_try_link_python_$1,
  3950. [
  3951. kde_save_cflags="$CFLAGS"
  3952. CFLAGS="$CFLAGS $PYTHONINC"
  3953. kde_save_libs="$LIBS"
  3954. LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
  3955. kde_save_ldflags="$LDFLAGS"
  3956. LDFLAGS="$LDFLAGS $PYTHONLIB"
  3957. AC_TRY_LINK(
  3958. [
  3959. #include <Python.h>
  3960. ],[
  3961. PySys_SetArgv(1, 0);
  3962. ],
  3963. [kde_cv_try_link_python_$1=yes],
  3964. [kde_cv_try_link_python_$1=no]
  3965. )
  3966. CFLAGS="$kde_save_cflags"
  3967. LIBS="$kde_save_libs"
  3968. LDFLAGS="$kde_save_ldflags"
  3969. ])
  3970. if test "$kde_cv_try_link_python_$1" = "yes"; then
  3971. AC_MSG_RESULT(yes)
  3972. kde_python_link_found=yes
  3973. if test ! "$1" = normal; then
  3974. LIBPYTHON="$LIBPYTHON $2"
  3975. fi
  3976. $3
  3977. else
  3978. AC_MSG_RESULT(no)
  3979. $4
  3980. fi
  3981. fi
  3982. ])
  3983. AC_DEFUN([KDE_CHECK_PYTHON_DIR],
  3984. [
  3985. AC_MSG_CHECKING([for Python directory])
  3986. AC_CACHE_VAL(kde_cv_pythondir,
  3987. [
  3988. if test -z "$PYTHONDIR"; then
  3989. kde_cv_pythondir=/usr/local
  3990. else
  3991. kde_cv_pythondir="$PYTHONDIR"
  3992. fi
  3993. ])
  3994. AC_ARG_WITH(pythondir,
  3995. AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]),
  3996. [
  3997. ac_python_dir=$withval
  3998. ], ac_python_dir=$kde_cv_pythondir
  3999. )
  4000. AC_MSG_RESULT($ac_python_dir)
  4001. ])
  4002. AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
  4003. [
  4004. AC_REQUIRE([KDE_CHECK_LIBDL])
  4005. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  4006. AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
  4007. if test -z "$1"; then
  4008. version="1.5"
  4009. else
  4010. version="$1"
  4011. fi
  4012. AC_MSG_CHECKING([for Python$version])
  4013. python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
  4014. AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
  4015. if test ! -r $python_incdir/Python.h; then
  4016. AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
  4017. python_incdir=$python_incdir/python$version
  4018. if test ! -r $python_incdir/Python.h; then
  4019. python_incdir=no
  4020. fi
  4021. fi
  4022. PYTHONINC=-I$python_incdir
  4023. python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs"
  4024. AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
  4025. if test ! -r $python_libdir/libpython$version.so; then
  4026. AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
  4027. if test ! -r $python_libdir/libpython$version.a; then
  4028. AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
  4029. python_libdir=$python_libdir/python$version/config
  4030. if test ! -r $python_libdir/libpython$version.a; then
  4031. python_libdir=no
  4032. fi
  4033. fi
  4034. fi
  4035. PYTHONLIB=-L$python_libdir
  4036. kde_orig_LIBPYTHON=$LIBPYTHON
  4037. if test -z "$LIBPYTHON"; then
  4038. LIBPYTHON=-lpython$version
  4039. fi
  4040. AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
  4041. python_moddir=$python_moddir/python$version
  4042. if test ! -r $python_moddir/copy.py; then
  4043. python_moddir=no
  4044. fi
  4045. PYTHONMODDIR=$python_moddir
  4046. AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
  4047. if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then
  4048. LIBPYTHON=$kde_orig_LIBPYTHON
  4049. test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
  4050. test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
  4051. $2
  4052. else
  4053. dnl Note: this test is very weak
  4054. kde_python_link_found=no
  4055. KDE_TRY_LINK_PYTHON(normal)
  4056. KDE_TRY_LINK_PYTHON(m, -lm)
  4057. KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
  4058. KDE_TRY_LINK_PYTHON(tcl, -ltcl)
  4059. KDE_TRY_LINK_PYTHON(db2, -ldb2)
  4060. KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
  4061. KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
  4062. KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
  4063. KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
  4064. KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
  4065. KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
  4066. KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
  4067. KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
  4068. [AC_MSG_WARN([it seems, Python depends on another library.
  4069. Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
  4070. and contact the authors to let them know about this problem])
  4071. ])
  4072. LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
  4073. AC_SUBST(PYTHONINC)
  4074. AC_SUBST(PYTHONLIB)
  4075. AC_SUBST(LIBPYTHON)
  4076. AC_SUBST(PYTHONMODDIR)
  4077. AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
  4078. fi
  4079. ])
  4080. AC_DEFUN([KDE_CHECK_PYTHON],
  4081. [
  4082. KDE_CHECK_PYTHON_INTERN("2.5",
  4083. [KDE_CHECK_PYTHON_INTERN("2.4",
  4084. [KDE_CHECK_PYTHON_INTERN("2.3",
  4085. [KDE_CHECK_PYTHON_INTERN("2.2",
  4086. [KDE_CHECK_PYTHON_INTERN("2.1",
  4087. [KDE_CHECK_PYTHON_INTERN("2.0",
  4088. [KDE_CHECK_PYTHON_INTERN($1, $2) ])
  4089. ])
  4090. ])
  4091. ])
  4092. ])
  4093. ])
  4094. ])
  4095. AC_DEFUN([KDE_CHECK_STL],
  4096. [
  4097. AC_LANG_SAVE
  4098. AC_LANG_CPLUSPLUS
  4099. ac_save_CXXFLAGS="$CXXFLAGS"
  4100. CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
  4101. AC_MSG_CHECKING([if C++ programs can be compiled])
  4102. AC_CACHE_VAL(kde_cv_stl_works,
  4103. [
  4104. AC_TRY_COMPILE([
  4105. #include <string>
  4106. using namespace std;
  4107. ],[
  4108. string astring="Hallo Welt.";
  4109. astring.erase(0, 6); // now astring is "Welt"
  4110. return 0;
  4111. ], kde_cv_stl_works=yes,
  4112. kde_cv_stl_works=no)
  4113. ])
  4114. AC_MSG_RESULT($kde_cv_stl_works)
  4115. if test "$kde_cv_stl_works" = "yes"; then
  4116. # back compatible
  4117. AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
  4118. else
  4119. AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
  4120. Check config.log for details - if you're using a Linux distribution you might miss
  4121. a package named similar to libstdc++-dev.])
  4122. fi
  4123. CXXFLAGS="$ac_save_CXXFLAGS"
  4124. AC_LANG_RESTORE
  4125. ])
  4126. AC_DEFUN([AC_FIND_QIMGIO],
  4127. [AC_REQUIRE([AC_FIND_JPEG])
  4128. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  4129. AC_MSG_CHECKING([for qimgio])
  4130. AC_CACHE_VAL(ac_cv_lib_qimgio,
  4131. [
  4132. AC_LANG_SAVE
  4133. AC_LANG_CPLUSPLUS
  4134. ac_save_LIBS="$LIBS"
  4135. ac_save_CXXFLAGS="$CXXFLAGS"
  4136. LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
  4137. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  4138. AC_TRY_RUN(dnl
  4139. [
  4140. #include <qimageio.h>
  4141. #include <qstring.h>
  4142. int main() {
  4143. QString t = "hallo";
  4144. t.fill('t');
  4145. qInitImageIO();
  4146. }
  4147. ],
  4148. ac_cv_lib_qimgio=yes,
  4149. ac_cv_lib_qimgio=no,
  4150. ac_cv_lib_qimgio=no)
  4151. LIBS="$ac_save_LIBS"
  4152. CXXFLAGS="$ac_save_CXXFLAGS"
  4153. AC_LANG_RESTORE
  4154. ])dnl
  4155. if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
  4156. LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
  4157. AC_MSG_RESULT(yes)
  4158. AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
  4159. AC_SUBST(LIBQIMGIO)
  4160. else
  4161. AC_MSG_RESULT(not found)
  4162. fi
  4163. ])
  4164. AC_DEFUN([AM_DISABLE_LIBRARIES],
  4165. [
  4166. AC_PROVIDE([AM_ENABLE_STATIC])
  4167. AC_PROVIDE([AM_ENABLE_SHARED])
  4168. enable_static=no
  4169. enable_shared=yes
  4170. ])
  4171. AC_DEFUN([AC_CHECK_UTMP_FILE],
  4172. [
  4173. AC_MSG_CHECKING([for utmp file])
  4174. AC_CACHE_VAL(kde_cv_utmp_file,
  4175. [
  4176. kde_cv_utmp_file=no
  4177. for ac_file in \
  4178. \
  4179. /var/run/utmp \
  4180. /var/adm/utmp \
  4181. /etc/utmp \
  4182. ; \
  4183. do
  4184. if test -r "$ac_file"; then
  4185. kde_cv_utmp_file=$ac_file
  4186. break
  4187. fi
  4188. done
  4189. ])
  4190. if test "$kde_cv_utmp_file" != "no"; then
  4191. AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
  4192. $1
  4193. AC_MSG_RESULT($kde_cv_utmp_file)
  4194. else
  4195. $2
  4196. AC_MSG_RESULT([non found])
  4197. fi
  4198. ])
  4199. AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
  4200. [
  4201. DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
  4202. TOPSUBDIRS=""
  4203. if test ! -s $srcdir/subdirs; then
  4204. dnl Note: Makefile.common creates subdirs, so this is just a fallback
  4205. files=`cd $srcdir && ls -1`
  4206. dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
  4207. for i in $dirs; do
  4208. echo $i >> $srcdir/subdirs
  4209. done
  4210. fi
  4211. ac_topsubdirs=
  4212. if test -s $srcdir/inst-apps; then
  4213. ac_topsubdirs="`cat $srcdir/inst-apps`"
  4214. elif test -s $srcdir/subdirs; then
  4215. ac_topsubdirs="`cat $srcdir/subdirs`"
  4216. fi
  4217. for i in $ac_topsubdirs; do
  4218. AC_MSG_CHECKING([if $i should be compiled])
  4219. if test -d $srcdir/$i; then
  4220. install_it="yes"
  4221. for j in $DO_NOT_COMPILE; do
  4222. if test $i = $j; then
  4223. install_it="no"
  4224. fi
  4225. done
  4226. else
  4227. install_it="no"
  4228. fi
  4229. AC_MSG_RESULT($install_it)
  4230. vari=`echo $i | sed -e 's,[[-+.@]],_,g'`
  4231. if test $install_it = "yes"; then
  4232. TOPSUBDIRS="$TOPSUBDIRS $i"
  4233. eval "$vari""_SUBDIR_included=yes"
  4234. else
  4235. eval "$vari""_SUBDIR_included=no"
  4236. fi
  4237. done
  4238. AC_SUBST(TOPSUBDIRS)
  4239. ])
  4240. AC_DEFUN([KDE_CHECK_NAMESPACES],
  4241. [
  4242. AC_MSG_CHECKING(whether C++ compiler supports namespaces)
  4243. AC_LANG_SAVE
  4244. AC_LANG_CPLUSPLUS
  4245. AC_TRY_COMPILE([
  4246. ],
  4247. [
  4248. namespace Foo {
  4249. extern int i;
  4250. namespace Bar {
  4251. extern int i;
  4252. }
  4253. }
  4254. int Foo::i = 0;
  4255. int Foo::Bar::i = 1;
  4256. ],[
  4257. AC_MSG_RESULT(yes)
  4258. AC_DEFINE(HAVE_NAMESPACES)
  4259. ], [
  4260. AC_MSG_RESULT(no)
  4261. ])
  4262. AC_LANG_RESTORE
  4263. ])
  4264. dnl ------------------------------------------------------------------------
  4265. dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
  4266. dnl ------------------------------------------------------------------------
  4267. dnl
  4268. AC_DEFUN([AC_CHECK_S_ISSOCK],
  4269. [
  4270. AC_MSG_CHECKING(for S_ISSOCK)
  4271. AC_CACHE_VAL(ac_cv_have_s_issock,
  4272. [
  4273. AC_TRY_LINK(
  4274. [
  4275. #include <sys/stat.h>
  4276. ],
  4277. [
  4278. struct stat buff;
  4279. int b = S_ISSOCK( buff.st_mode );
  4280. ],
  4281. ac_cv_have_s_issock=yes,
  4282. ac_cv_have_s_issock=no)
  4283. ])
  4284. AC_MSG_RESULT($ac_cv_have_s_issock)
  4285. if test "$ac_cv_have_s_issock" = "yes"; then
  4286. AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
  4287. fi
  4288. AH_VERBATIM(_ISSOCK,
  4289. [
  4290. #ifndef HAVE_S_ISSOCK
  4291. #define HAVE_S_ISSOCK
  4292. #define S_ISSOCK(mode) (1==0)
  4293. #endif
  4294. ])
  4295. ])
  4296. dnl ------------------------------------------------------------------------
  4297. dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
  4298. dnl ------------------------------------------------------------------------
  4299. dnl
  4300. AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
  4301. [
  4302. AC_MSG_CHECKING(for MAXPATHLEN)
  4303. AC_CACHE_VAL(ac_cv_maxpathlen,
  4304. [
  4305. cat > conftest.$ac_ext <<EOF
  4306. #ifdef STDC_HEADERS
  4307. # include <stdlib.h>
  4308. #endif
  4309. #include <stdio.h>
  4310. #include <sys/param.h>
  4311. #ifndef MAXPATHLEN
  4312. #define MAXPATHLEN 1024
  4313. #endif
  4314. KDE_HELLO MAXPATHLEN
  4315. EOF
  4316. ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
  4317. if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
  4318. ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
  4319. else
  4320. ac_cv_maxpathlen=1024
  4321. fi
  4322. rm conftest.*
  4323. ])
  4324. AC_MSG_RESULT($ac_cv_maxpathlen)
  4325. AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
  4326. ])
  4327. AC_DEFUN([KDE_CHECK_HEADER],
  4328. [
  4329. kde_safe_cppflags=$CPPFLAGS
  4330. CPPFLAGS="$CPPFLAGS $all_includes"
  4331. AC_LANG_SAVE
  4332. AC_LANG_CPLUSPLUS
  4333. AC_CHECK_HEADER([$1], [$2], [$3], [$4])
  4334. AC_LANG_RESTORE
  4335. CPPFLAGS=$kde_safe_cppflags
  4336. ])
  4337. AC_DEFUN([KDE_CHECK_HEADERS],
  4338. [
  4339. AH_CHECK_HEADERS([$1])
  4340. AC_LANG_SAVE
  4341. kde_safe_cppflags=$CPPFLAGS
  4342. CPPFLAGS="$CPPFLAGS $all_includes"
  4343. AC_LANG_CPLUSPLUS
  4344. AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
  4345. CPPFLAGS=$kde_safe_cppflags
  4346. AC_LANG_RESTORE
  4347. ])
  4348. AC_DEFUN([KDE_FAST_CONFIGURE],
  4349. [
  4350. dnl makes configure fast (needs perl)
  4351. AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]),
  4352. with_fast_perl=$enableval, with_fast_perl=yes)
  4353. ])
  4354. AC_DEFUN([KDE_CONF_FILES],
  4355. [
  4356. val=
  4357. if test -f $srcdir/configure.files ; then
  4358. val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
  4359. fi
  4360. CONF_FILES=
  4361. if test -n "$val" ; then
  4362. for i in $val ; do
  4363. CONF_FILES="$CONF_FILES $i"
  4364. done
  4365. fi
  4366. AC_SUBST(CONF_FILES)
  4367. ])dnl
  4368. dnl This sets the prefix, for arts and kdelibs
  4369. dnl Do NOT use in any other module.
  4370. dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde
  4371. AC_DEFUN([KDE_SET_PREFIX_CORE],
  4372. [
  4373. unset CDPATH
  4374. dnl make $KDEDIR the default for the installation
  4375. AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  4376. if test "x$prefix" = "xNONE"; then
  4377. prefix=$ac_default_prefix
  4378. ac_configure_args="$ac_configure_args --prefix=$prefix"
  4379. fi
  4380. # And delete superfluous '/' to make compares easier
  4381. prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4382. exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4383. kde_libs_prefix='$(prefix)'
  4384. kde_libs_htmldir='$(kde_htmldir)'
  4385. AC_SUBST(kde_libs_prefix)
  4386. AC_SUBST(kde_libs_htmldir)
  4387. KDE_FAST_CONFIGURE
  4388. KDE_CONF_FILES
  4389. ])
  4390. AC_DEFUN([KDE_SET_PREFIX],
  4391. [
  4392. unset CDPATH
  4393. dnl We can't give real code to that macro, only a value.
  4394. dnl It only matters for --help, since we set the prefix in this function anyway.
  4395. AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix})
  4396. KDE_SET_DEFAULT_BINDIRS
  4397. if test "x$prefix" = "xNONE"; then
  4398. dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it
  4399. KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
  4400. else
  4401. dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH
  4402. kde_save_PATH="$PATH"
  4403. PATH="$exec_prefix/bin:$prefix/bin:$PATH"
  4404. KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
  4405. PATH="$kde_save_PATH"
  4406. fi
  4407. kde_libs_prefix=`$KDECONFIG --prefix`
  4408. if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
  4409. AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
  4410. This means it has been moved since you installed it.
  4411. This won't work. Please recompile kdelibs for the new prefix.
  4412. ])
  4413. fi
  4414. kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
  4415. AC_MSG_CHECKING([where to install])
  4416. if test "x$prefix" = "xNONE"; then
  4417. prefix=$kde_libs_prefix
  4418. AC_MSG_RESULT([$prefix (as returned by kde-config)])
  4419. else
  4420. dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different
  4421. given_prefix=$prefix
  4422. AC_MSG_RESULT([$prefix (as requested)])
  4423. fi
  4424. # And delete superfluous '/' to make compares easier
  4425. prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4426. exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4427. given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4428. AC_SUBST(KDECONFIG)
  4429. AC_SUBST(kde_libs_prefix)
  4430. AC_SUBST(kde_libs_htmldir)
  4431. KDE_FAST_CONFIGURE
  4432. KDE_CONF_FILES
  4433. ])
  4434. pushdef([AC_PROG_INSTALL],
  4435. [
  4436. dnl our own version, testing for a -p flag
  4437. popdef([AC_PROG_INSTALL])
  4438. dnl as AC_PROG_INSTALL works as it works we first have
  4439. dnl to save if the user didn't specify INSTALL, as the
  4440. dnl autoconf one overwrites INSTALL and we have no chance to find
  4441. dnl out afterwards
  4442. test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
  4443. test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
  4444. test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
  4445. AC_PROG_INSTALL
  4446. if test -z "$kde_save_INSTALL_given" ; then
  4447. # OK, user hasn't given any INSTALL, autoconf found one for us
  4448. # now we test, if it supports the -p flag
  4449. AC_MSG_CHECKING(for -p flag to install)
  4450. rm -f confinst.$$.* > /dev/null 2>&1
  4451. echo "Testtest" > confinst.$$.orig
  4452. ac_res=no
  4453. if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
  4454. if test -f confinst.$$.new ; then
  4455. # OK, -p seems to do no harm to install
  4456. INSTALL="${INSTALL} -p"
  4457. ac_res=yes
  4458. fi
  4459. fi
  4460. rm -f confinst.$$.*
  4461. AC_MSG_RESULT($ac_res)
  4462. fi
  4463. dnl the following tries to resolve some signs and wonders coming up
  4464. dnl with different autoconf/automake versions
  4465. dnl e.g.:
  4466. dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
  4467. dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
  4468. dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
  4469. dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
  4470. dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
  4471. dnl install-@DIR@PROGRAMS targets to explicitly use that flag
  4472. dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
  4473. dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
  4474. dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
  4475. dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from
  4476. dnl automake (due to broken Makefile.am or whatever) to install programs,
  4477. dnl and so does not see the -s flag in automake > 1.4
  4478. dnl to clean up that mess we:
  4479. dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
  4480. dnl which cleans KDE's program with automake > 1.4;
  4481. dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
  4482. dnl with automake<=1.4
  4483. dnl note that dues to this sometimes two '-s' flags are used (if KDE
  4484. dnl properly uses install-@DIR@PROGRAMS, but I don't care
  4485. dnl
  4486. dnl And to all this comes, that I even can't write in comments variable
  4487. dnl names used by automake, because it is so stupid to think I wanted to
  4488. dnl _use_ them, therefor I have written A_M_... instead of AM_
  4489. dnl hmm, I wanted to say something ... ahh yes: Arghhh.
  4490. if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
  4491. INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
  4492. fi
  4493. if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
  4494. INSTALL_SCRIPT='${INSTALL}'
  4495. fi
  4496. ])dnl
  4497. AC_DEFUN([KDE_LANG_CPLUSPLUS],
  4498. [AC_LANG_CPLUSPLUS
  4499. ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
  4500. pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
  4501. ])
  4502. pushdef([AC_LANG_CPLUSPLUS],
  4503. [popdef([AC_LANG_CPLUSPLUS])
  4504. KDE_LANG_CPLUSPLUS
  4505. ])
  4506. AC_DEFUN([KDE_CHECK_LONG_LONG],
  4507. [
  4508. AC_MSG_CHECKING(for long long)
  4509. AC_CACHE_VAL(kde_cv_c_long_long,
  4510. [
  4511. AC_LANG_SAVE
  4512. AC_LANG_CPLUSPLUS
  4513. AC_TRY_LINK([], [
  4514. long long foo = 0;
  4515. foo = foo+1;
  4516. ],
  4517. kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
  4518. AC_LANG_RESTORE
  4519. ])
  4520. AC_MSG_RESULT($kde_cv_c_long_long)
  4521. if test "$kde_cv_c_long_long" = yes; then
  4522. AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
  4523. fi
  4524. ])
  4525. AC_DEFUN([KDE_CHECK_LIB],
  4526. [
  4527. kde_save_LDFLAGS="$LDFLAGS"
  4528. dnl AC_CHECK_LIB modifies LIBS, so save it here
  4529. kde_save_LIBS="$LIBS"
  4530. LDFLAGS="$LDFLAGS $all_libraries"
  4531. case $host_os in
  4532. aix*) LDFLAGS="-brtl $LDFLAGS"
  4533. test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
  4534. ;;
  4535. esac
  4536. AC_CHECK_LIB($1, $2, $3, $4, $5)
  4537. LDFLAGS="$kde_save_LDFLAGS"
  4538. LIBS="$kde_save_LIBS"
  4539. ])
  4540. AC_DEFUN([KDE_JAVA_PREFIX],
  4541. [
  4542. dir=`dirname "$1"`
  4543. base=`basename "$1"`
  4544. list=`ls -1 $dir 2> /dev/null`
  4545. for entry in $list; do
  4546. if test -d $dir/$entry/bin; then
  4547. case $entry in
  4548. $base)
  4549. javadirs="$javadirs $dir/$entry/bin"
  4550. ;;
  4551. esac
  4552. elif test -d $dir/$entry/jre/bin; then
  4553. case $entry in
  4554. $base)
  4555. javadirs="$javadirs $dir/$entry/jre/bin"
  4556. ;;
  4557. esac
  4558. fi
  4559. done
  4560. ])
  4561. dnl KDE_CHEC_JAVA_DIR(onlyjre)
  4562. AC_DEFUN([KDE_CHECK_JAVA_DIR],
  4563. [
  4564. AC_ARG_WITH(java,
  4565. AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]),
  4566. [ ac_java_dir=$withval
  4567. ], ac_java_dir=""
  4568. )
  4569. AC_MSG_CHECKING([for Java])
  4570. dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
  4571. if test "x$ac_java_dir" = "xno"; then
  4572. kde_java_bindir=no
  4573. kde_java_includedir=no
  4574. kde_java_libjvmdir=no
  4575. kde_java_libgcjdir=no
  4576. kde_java_libhpidir=no
  4577. else
  4578. if test "x$ac_java_dir" = "x"; then
  4579. dnl No option set -> collect list of candidate paths
  4580. if test -n "$JAVA_HOME"; then
  4581. KDE_JAVA_PREFIX($JAVA_HOME)
  4582. fi
  4583. KDE_JAVA_PREFIX(/usr/j2se)
  4584. KDE_JAVA_PREFIX(/usr/lib/j2se)
  4585. KDE_JAVA_PREFIX(/usr/j*dk*)
  4586. KDE_JAVA_PREFIX(/usr/lib/j*dk*)
  4587. KDE_JAVA_PREFIX(/opt/j*sdk*)
  4588. KDE_JAVA_PREFIX(/usr/lib/java*)
  4589. KDE_JAVA_PREFIX(/usr/java*)
  4590. KDE_JAVA_PREFIX(/usr/java/j*dk*)
  4591. KDE_JAVA_PREFIX(/usr/java/j*re*)
  4592. KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
  4593. KDE_JAVA_PREFIX(/usr/lib/SunJava*)
  4594. KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
  4595. KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
  4596. KDE_JAVA_PREFIX(/opt/java*)
  4597. kde_cv_path="NONE"
  4598. kde_save_IFS=$IFS
  4599. IFS=':'
  4600. for dir in $PATH; do
  4601. if test -d "$dir"; then
  4602. javadirs="$javadirs $dir"
  4603. fi
  4604. done
  4605. IFS=$kde_save_IFS
  4606. jredirs=
  4607. dnl Now javadirs contains a list of paths that exist, all ending with bin/
  4608. for dir in $javadirs; do
  4609. dnl Check for the java executable
  4610. if test -x "$dir/java"; then
  4611. sane_path=$(cd $dir; /bin/pwd)
  4612. dnl And also check for a libjvm.so somewhere under there
  4613. dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
  4614. if test "$sane_path" != "/usr/bin"; then
  4615. libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
  4616. if test ! -f $libjvmdir/libjvm.so; then continue; fi
  4617. jredirs="$jredirs $dir"
  4618. fi
  4619. fi
  4620. done
  4621. dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
  4622. JAVAC=
  4623. JAVA=
  4624. kde_java_bindir=no
  4625. for dir in $jredirs; do
  4626. JAVA="$dir/java"
  4627. kde_java_bindir=$dir
  4628. if test -x "$dir/javac"; then
  4629. JAVAC="$dir/javac"
  4630. break
  4631. fi
  4632. done
  4633. if test -n "$JAVAC"; then
  4634. dnl this substitution might not work - well, we test for jni.h below
  4635. kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
  4636. else
  4637. kde_java_includedir=no
  4638. fi
  4639. else
  4640. dnl config option set
  4641. kde_java_bindir=$ac_java_dir/bin
  4642. if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
  4643. kde_java_includedir=no
  4644. else
  4645. kde_java_includedir=$ac_java_dir/include
  4646. fi
  4647. fi
  4648. fi
  4649. dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
  4650. if test "x$kde_java_bindir" != "xno"; then
  4651. dnl Look for libjvm.so
  4652. kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
  4653. dnl Look for libgcj.so
  4654. kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
  4655. dnl Look for libhpi.so and avoid green threads
  4656. kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
  4657. dnl Now check everything's fine under there
  4658. dnl the include dir is our flag for having the JDK
  4659. if test -d "$kde_java_includedir"; then
  4660. if test ! -x "$kde_java_bindir/javac"; then
  4661. AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
  4662. fi
  4663. if test ! -x "$kde_java_bindir/javah"; then
  4664. AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4665. fi
  4666. if test ! -x "$kde_java_bindir/jar"; then
  4667. AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4668. fi
  4669. if test ! -r "$kde_java_includedir/jni.h"; then
  4670. AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
  4671. fi
  4672. jni_includes="-I$kde_java_includedir"
  4673. dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
  4674. dnl and under linux here..
  4675. dnl not needed for gcj
  4676. if test "x$kde_java_libgcjdir" = "x"; then
  4677. test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
  4678. test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
  4679. test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
  4680. fi
  4681. else
  4682. JAVAC=
  4683. jni_includes=
  4684. fi
  4685. if test "x$kde_java_libgcjdir" = "x"; then
  4686. if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
  4687. AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
  4688. fi
  4689. else
  4690. if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
  4691. AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
  4692. fi
  4693. fi
  4694. if test ! -x "$kde_java_bindir/java"; then
  4695. AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4696. fi
  4697. dnl not needed for gcj compile
  4698. if test "x$kde_java_libgcjdir" = "x"; then
  4699. if test ! -r "$kde_java_libhpidir/libhpi.so"; then
  4700. AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
  4701. fi
  4702. fi
  4703. if test -n "$jni_includes"; then
  4704. dnl Check for JNI version
  4705. AC_LANG_SAVE
  4706. AC_LANG_CPLUSPLUS
  4707. ac_cxxflags_safe="$CXXFLAGS"
  4708. CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
  4709. AC_TRY_COMPILE([
  4710. #include <jni.h>
  4711. ],
  4712. [
  4713. #ifndef JNI_VERSION_1_2
  4714. Syntax Error
  4715. #endif
  4716. ],[ kde_jni_works=yes ],
  4717. [ kde_jni_works=no ])
  4718. if test $kde_jni_works = no; then
  4719. AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
  4720. You need to have Java Development Kit (JDK) version 1.2.
  4721. Use --with-java to specify another location.
  4722. Use --without-java to configure without java support.
  4723. Or download a newer JDK and try again.
  4724. See e.g. http://java.sun.com/products/jdk/1.2 ])
  4725. fi
  4726. CXXFLAGS="$ac_cxxflags_safe"
  4727. AC_LANG_RESTORE
  4728. dnl All tests ok, inform and subst the variables
  4729. JAVAC=$kde_java_bindir/javac
  4730. JAVAH=$kde_java_bindir/javah
  4731. JAR=$kde_java_bindir/jar
  4732. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4733. if test "x$kde_java_libgcjdir" = "x"; then
  4734. JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
  4735. else
  4736. JVMLIBS="-L$kde_java_libgcjdir -lgcj"
  4737. fi
  4738. AC_MSG_RESULT([java JDK in $kde_java_bindir])
  4739. else
  4740. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4741. AC_MSG_RESULT([java JRE in $kde_java_bindir])
  4742. fi
  4743. elif test -d "/Library/Java/Home"; then
  4744. kde_java_bindir="/Library/Java/Home/bin"
  4745. jni_includes="-I/Library/Java/Home/include"
  4746. JAVAC=$kde_java_bindir/javac
  4747. JAVAH=$kde_java_bindir/javah
  4748. JAR=$kde_java_bindir/jar
  4749. JVMLIBS="-Wl,-framework,JavaVM"
  4750. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4751. AC_MSG_RESULT([Apple Java Framework])
  4752. else
  4753. AC_MSG_RESULT([none found])
  4754. fi
  4755. AC_SUBST(JAVAC)
  4756. AC_SUBST(JAVAH)
  4757. AC_SUBST(JAR)
  4758. AC_SUBST(JVMLIBS)
  4759. AC_SUBST(jni_includes)
  4760. # for backward compat
  4761. kde_cv_java_includedir=$kde_java_includedir
  4762. kde_cv_java_bindir=$kde_java_bindir
  4763. ])
  4764. dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
  4765. dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
  4766. dnl big packages, m4_foreach is dog-slow. So use our own version of
  4767. dnl it. (matz@kde.org)
  4768. m4_define([mm_foreach],
  4769. [m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
  4770. m4_define([mm_car], [[$1]])
  4771. m4_define([mm_car2], [[$@]])
  4772. m4_define([_mm_foreach],
  4773. [m4_if(m4_quote($2), [], [],
  4774. [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
  4775. mm_car2(m4_shift($2)),
  4776. [$3])])])
  4777. m4_define([AC_FOREACH],
  4778. [mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
  4779. AC_DEFUN([KDE_NEED_FLEX],
  4780. [
  4781. kde_libs_safe=$LIBS
  4782. LIBS="$LIBS $USER_LDFLAGS"
  4783. AM_PROG_LEX
  4784. LIBS=$kde_libs_safe
  4785. if test -z "$LEXLIB"; then
  4786. AC_MSG_ERROR([You need to have flex installed.])
  4787. fi
  4788. AC_SUBST(LEXLIB)
  4789. ])
  4790. AC_DEFUN([AC_PATH_QTOPIA],
  4791. [
  4792. dnl TODO: use AC_CACHE_VAL
  4793. if test -z "$1"; then
  4794. qtopia_minver_maj=1
  4795. qtopia_minver_min=5
  4796. qtopia_minver_pat=0
  4797. else
  4798. qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
  4799. qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
  4800. qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
  4801. fi
  4802. qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
  4803. qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
  4804. AC_REQUIRE([AC_PATH_QT])
  4805. AC_MSG_CHECKING([for Qtopia])
  4806. LIB_QTOPIA="-lqpe"
  4807. AC_SUBST(LIB_QTOPIA)
  4808. kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
  4809. ac_qtopia_incdir=NO
  4810. AC_ARG_WITH(qtopia-dir,
  4811. AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]),
  4812. [ ac_qtopia_incdir="$withval"/include] )
  4813. qtopia_incdirs=""
  4814. for dir in $kde_qtopia_dirs; do
  4815. qtopia_incdirs="$qtopia_incdirs $dir/include"
  4816. done
  4817. if test ! "$ac_qtopia_incdir" = "NO"; then
  4818. qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
  4819. fi
  4820. qtopia_incdir=""
  4821. AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
  4822. ac_qtopia_incdir="$qtopia_incdir"
  4823. if test -z "$qtopia_incdir"; then
  4824. AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
  4825. fi
  4826. qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
  4827. qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
  4828. qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
  4829. qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
  4830. qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
  4831. if test "$qtopia_ver" -lt "$qtopia_minver"; then
  4832. AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
  4833. is required.])
  4834. fi
  4835. AC_LANG_SAVE
  4836. AC_LANG_CPLUSPLUS
  4837. ac_cxxflags_safe="$CXXFLAGS"
  4838. ac_ldflags_safe="$LDFLAGS"
  4839. ac_libs_safe="$LIBS"
  4840. CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
  4841. LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
  4842. LIBS="$LIBS $LIB_QTOPIA $LIBQT"
  4843. cat > conftest.$ac_ext <<EOF
  4844. #include "confdefs.h"
  4845. #include <qpe/qpeapplication.h>
  4846. #include <qpe/version.h>
  4847. int main( int argc, char **argv )
  4848. {
  4849. QPEApplication app( argc, argv );
  4850. return 0;
  4851. }
  4852. EOF
  4853. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  4854. rm -f conftest*
  4855. else
  4856. rm -f conftest*
  4857. AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
  4858. the end of config.log])
  4859. fi
  4860. CXXFLAGS="$ac_cxxflags_safe"
  4861. LDFLAGS="$ac_ldflags_safe"
  4862. LIBS="$ac_libs_safe"
  4863. AC_LANG_RESTORE
  4864. QTOPIA_INCLUDES="-I$qtopia_incdir"
  4865. AC_SUBST(QTOPIA_INCLUDES)
  4866. AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
  4867. ])
  4868. AC_DEFUN([KDE_INIT_DOXYGEN],
  4869. [
  4870. AC_MSG_CHECKING([for Qt docs])
  4871. kde_qtdir=
  4872. if test "${with_qt_dir+set}" = set; then
  4873. kde_qtdir="$with_qt_dir"
  4874. fi
  4875. AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
  4876. AC_MSG_RESULT($QTDOCDIR)
  4877. AC_SUBST(QTDOCDIR)
  4878. KDE_FIND_PATH(dot, DOT, [], [])
  4879. if test -n "$DOT"; then
  4880. KDE_HAVE_DOT="YES"
  4881. else
  4882. KDE_HAVE_DOT="NO"
  4883. fi
  4884. AC_SUBST(KDE_HAVE_DOT)
  4885. KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
  4886. AC_SUBST(DOXYGEN)
  4887. DOXYGEN_PROJECT_NAME="$1"
  4888. DOXYGEN_PROJECT_NUMBER="$2"
  4889. AC_SUBST(DOXYGEN_PROJECT_NAME)
  4890. AC_SUBST(DOXYGEN_PROJECT_NUMBER)
  4891. KDE_HAS_DOXYGEN=no
  4892. if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then
  4893. KDE_HAS_DOXYGEN=yes
  4894. fi
  4895. AC_SUBST(KDE_HAS_DOXYGEN)
  4896. ])
  4897. AC_DEFUN([AC_FIND_BZIP2],
  4898. [
  4899. AC_MSG_CHECKING([for bzDecompress in libbz2])
  4900. AC_CACHE_VAL(ac_cv_lib_bzip2,
  4901. [
  4902. AC_LANG_SAVE
  4903. AC_LANG_CPLUSPLUS
  4904. kde_save_LIBS="$LIBS"
  4905. LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
  4906. kde_save_CXXFLAGS="$CXXFLAGS"
  4907. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  4908. AC_TRY_LINK(dnl
  4909. [
  4910. #define BZ_NO_STDIO
  4911. #include<bzlib.h>
  4912. ],
  4913. [ bz_stream s; (void) bzDecompress(&s); ],
  4914. eval "ac_cv_lib_bzip2='-lbz2'",
  4915. eval "ac_cv_lib_bzip2=no")
  4916. LIBS="$kde_save_LIBS"
  4917. CXXFLAGS="$kde_save_CXXFLAGS"
  4918. AC_LANG_RESTORE
  4919. ])dnl
  4920. AC_MSG_RESULT($ac_cv_lib_bzip2)
  4921. if test ! "$ac_cv_lib_bzip2" = no; then
  4922. BZIP2DIR=bzip2
  4923. LIBBZ2="$ac_cv_lib_bzip2"
  4924. AC_SUBST(LIBBZ2)
  4925. else
  4926. cxx_shared_flag=
  4927. ld_shared_flag=
  4928. KDE_CHECK_COMPILER_FLAG(shared, [
  4929. ld_shared_flag="-shared"
  4930. ])
  4931. KDE_CHECK_COMPILER_FLAG(fPIC, [
  4932. cxx_shared_flag="-fPIC"
  4933. ])
  4934. AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
  4935. AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
  4936. [
  4937. AC_LANG_SAVE
  4938. AC_LANG_CPLUSPLUS
  4939. kde_save_LIBS="$LIBS"
  4940. LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
  4941. kde_save_CXXFLAGS="$CXXFLAGS"
  4942. CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
  4943. AC_TRY_LINK(dnl
  4944. [
  4945. #define BZ_NO_STDIO
  4946. #include<bzlib.h>
  4947. ],
  4948. [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
  4949. eval "ac_cv_lib_bzip2_prefix='-lbz2'",
  4950. eval "ac_cv_lib_bzip2_prefix=no")
  4951. LIBS="$kde_save_LIBS"
  4952. CXXFLAGS="$kde_save_CXXFLAGS"
  4953. AC_LANG_RESTORE
  4954. ])dnl
  4955. AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
  4956. if test ! "$ac_cv_lib_bzip2_prefix" = no; then
  4957. BZIP2DIR=bzip2
  4958. LIBBZ2="$ac_cv_lib_bzip2_prefix"
  4959. AC_SUBST(LIBBZ2)
  4960. AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
  4961. dnl else, we just ignore this
  4962. fi
  4963. fi
  4964. AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
  4965. ])
  4966. dnl ------------------------------------------------------------------------
  4967. dnl Try to find the SSL headers and libraries.
  4968. dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
  4969. dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
  4970. dnl ------------------------------------------------------------------------
  4971. dnl
  4972. AC_DEFUN([KDE_CHECK_SSL],
  4973. [
  4974. LIBSSL="-lssl -lcrypto"
  4975. AC_REQUIRE([KDE_CHECK_LIB64])
  4976. ac_ssl_includes=NO ac_ssl_libraries=NO
  4977. ssl_libraries=""
  4978. ssl_includes=""
  4979. AC_ARG_WITH(ssl-dir,
  4980. AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]),
  4981. [ ac_ssl_includes="$withval"/include
  4982. ac_ssl_libraries="$withval"/lib$kdelibsuff
  4983. ])
  4984. want_ssl=yes
  4985. AC_ARG_WITH(ssl,
  4986. AC_HELP_STRING([--without-ssl],[disable SSL checks]),
  4987. [want_ssl=$withval])
  4988. if test $want_ssl = yes; then
  4989. AC_MSG_CHECKING(for OpenSSL)
  4990. AC_CACHE_VAL(ac_cv_have_ssl,
  4991. [#try to guess OpenSSL locations
  4992. ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
  4993. ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
  4994. AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
  4995. ac_ssl_includes="$ssl_incdir"
  4996. ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs"
  4997. if test ! "$ac_ssl_libraries" = "NO"; then
  4998. ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
  4999. fi
  5000. test=NONE
  5001. ssl_libdir=NONE
  5002. for dir in $ssl_libdirs; do
  5003. try="ls -1 $dir/libssl*"
  5004. if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  5005. done
  5006. ac_ssl_libraries="$ssl_libdir"
  5007. ac_ldflags_safe="$LDFLAGS"
  5008. ac_libs_safe="$LIBS"
  5009. LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
  5010. LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
  5011. AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
  5012. ac_ssl_rsaref="yes"
  5013. ,
  5014. ac_ssl_rsaref="no"
  5015. )
  5016. LDFLAGS="$ac_ldflags_safe"
  5017. LIBS="$ac_libs_safe"
  5018. if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
  5019. have_ssl=no
  5020. else
  5021. have_ssl=yes;
  5022. fi
  5023. ])
  5024. eval "$ac_cv_have_ssl"
  5025. AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
  5026. AC_MSG_CHECKING([whether OpenSSL uses rsaref])
  5027. AC_MSG_RESULT($ac_ssl_rsaref)
  5028. AC_MSG_CHECKING([for easter eggs])
  5029. AC_MSG_RESULT([none found])
  5030. else
  5031. have_ssl=no
  5032. fi
  5033. if test "$have_ssl" = yes; then
  5034. AC_MSG_CHECKING(for OpenSSL version)
  5035. dnl Check for SSL version
  5036. AC_CACHE_VAL(ac_cv_ssl_version,
  5037. [
  5038. cat >conftest.$ac_ext <<EOF
  5039. #include <openssl/opensslv.h>
  5040. #include <stdio.h>
  5041. int main() {
  5042. #ifndef OPENSSL_VERSION_NUMBER
  5043. printf("ssl_version=\\"error\\"\n");
  5044. #else
  5045. if (OPENSSL_VERSION_NUMBER < 0x00906000)
  5046. printf("ssl_version=\\"old\\"\n");
  5047. else
  5048. printf("ssl_version=\\"ok\\"\n");
  5049. #endif
  5050. return (0);
  5051. }
  5052. EOF
  5053. ac_save_CPPFLAGS=$CPPFLAGS
  5054. if test "$ac_ssl_includes" != "/usr/include"; then
  5055. CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
  5056. fi
  5057. if AC_TRY_EVAL(ac_link); then
  5058. if eval `./conftest 2>&5`; then
  5059. if test $ssl_version = error; then
  5060. AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
  5061. else
  5062. if test $ssl_version = old; then
  5063. AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
  5064. have_ssl=no
  5065. fi
  5066. fi
  5067. ac_cv_ssl_version="ssl_version=$ssl_version"
  5068. else
  5069. AC_MSG_ERROR([Your system couldn't run a small SSL test program.
  5070. Check config.log, and if you can't figure it out, send a mail to
  5071. David Faure <faure@kde.org>, attaching your config.log])
  5072. fi
  5073. else
  5074. AC_MSG_ERROR([Your system couldn't link a small SSL test program.
  5075. Check config.log, and if you can't figure it out, send a mail to
  5076. David Faure <faure@kde.org>, attaching your config.log])
  5077. fi
  5078. CPPFLAGS=$ac_save_CPPFLAGS
  5079. ])
  5080. eval "$ac_cv_ssl_version"
  5081. AC_MSG_RESULT($ssl_version)
  5082. fi
  5083. if test "$have_ssl" != yes; then
  5084. LIBSSL="";
  5085. else
  5086. AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
  5087. ac_cv_have_ssl="have_ssl=yes \
  5088. ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
  5089. ssl_libraries="$ac_ssl_libraries"
  5090. ssl_includes="$ac_ssl_includes"
  5091. if test "$ac_ssl_rsaref" = yes; then
  5092. LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref"
  5093. fi
  5094. if test $ssl_version = "old"; then
  5095. AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
  5096. fi
  5097. fi
  5098. SSL_INCLUDES=
  5099. if test "$ssl_includes" = "/usr/include"; then
  5100. if test -f /usr/kerberos/include/krb5.h; then
  5101. SSL_INCLUDES="-I/usr/kerberos/include"
  5102. fi
  5103. elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
  5104. SSL_INCLUDES="-I$ssl_includes"
  5105. fi
  5106. if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
  5107. SSL_LDFLAGS=""
  5108. else
  5109. SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
  5110. fi
  5111. AC_SUBST(SSL_INCLUDES)
  5112. AC_SUBST(SSL_LDFLAGS)
  5113. AC_SUBST(LIBSSL)
  5114. ])
  5115. AC_DEFUN([KDE_CHECK_STRLCPY],
  5116. [
  5117. AC_REQUIRE([AC_CHECK_STRLCAT])
  5118. AC_REQUIRE([AC_CHECK_STRLCPY])
  5119. AC_CHECK_SIZEOF(size_t)
  5120. AC_CHECK_SIZEOF(unsigned long)
  5121. AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
  5122. AC_TRY_COMPILE(,[
  5123. #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
  5124. choke me
  5125. #endif
  5126. ],AC_MSG_RESULT([yes]),[
  5127. AC_MSG_RESULT(no)
  5128. AC_MSG_ERROR([
  5129. Apparently on your system our assumption sizeof size_t == sizeof unsigned long
  5130. does not apply. Please mail kde-devel@kde.org with a description of your system!
  5131. ])
  5132. ])
  5133. ])
  5134. AC_DEFUN([KDE_CHECK_BINUTILS],
  5135. [
  5136. AC_MSG_CHECKING([if ld supports unversioned version maps])
  5137. kde_save_LDFLAGS="$LDFLAGS"
  5138. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  5139. echo "{ local: extern \"C++\" { foo }; };" > conftest.map
  5140. AC_TRY_LINK([int foo;],
  5141. [
  5142. #ifdef __INTEL_COMPILER
  5143. icc apparently does not support libtools version-info and version-script
  5144. at the same time. Dunno where the bug is, but until somebody figured out,
  5145. better disable the optional version scripts.
  5146. #endif
  5147. foo = 42;
  5148. ], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
  5149. LDFLAGS="$kde_save_LDFLAGS"
  5150. rm -f conftest.map
  5151. AM_CONDITIONAL(include_VERSION_SCRIPT,
  5152. [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
  5153. AC_MSG_RESULT($kde_supports_versionmaps)
  5154. ])
  5155. AC_DEFUN([AM_PROG_OBJC],[
  5156. AC_CHECK_PROGS(OBJC, gcc, gcc)
  5157. test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
  5158. if test "x${OBJCFLAGS-unset}" = xunset; then
  5159. OBJCFLAGS="-g -O2"
  5160. fi
  5161. AC_SUBST(OBJCFLAGS)
  5162. _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
  5163. ])
  5164. AC_DEFUN([KDE_CHECK_PERL],
  5165. [
  5166. KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
  5167. AC_MSG_ERROR([No Perl found in your $PATH.
  5168. We need perl to generate some code.])
  5169. ])
  5170. AC_SUBST(PERL)
  5171. ])
  5172. AC_DEFUN([KDE_CHECK_LARGEFILE],
  5173. [
  5174. AC_SYS_LARGEFILE
  5175. if test "$ac_cv_sys_file_offset_bits" != no; then
  5176. CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
  5177. fi
  5178. if test "x$ac_cv_sys_large_files" != "xno"; then
  5179. CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1"
  5180. fi
  5181. ])
  5182. dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in)
  5183. dnl which allows to search for libs that get installed into the KDE prefix.
  5184. dnl
  5185. dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not)
  5186. dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page
  5187. dnl also defines KSTUFF_PKG_ERRORS on error
  5188. AC_DEFUN([KDE_PKG_CHECK_MODULES], [
  5189. PKG_CONFIG_PATH="$prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
  5190. if test "$prefix" != "$kde_libs_prefix"; then
  5191. PKG_CONFIG_PATH="$kde_libs_prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
  5192. fi
  5193. export PKG_CONFIG_PATH
  5194. PKG_CHECK_MODULES([$1],[$2],[$3],[$4])
  5195. ])
  5196. dnl Check for PIE support in the compiler and linker
  5197. AC_DEFUN([KDE_CHECK_PIE_SUPPORT],
  5198. [
  5199. AC_CACHE_CHECK([for PIE support], kde_cv_val_pie_support,
  5200. [
  5201. AC_LANG_SAVE
  5202. AC_LANG_CPLUSPLUS
  5203. safe_CXXFLAGS=$CXXFLAGS
  5204. safe_LDFLAGS=$LDFLAGS
  5205. CXXFLAGS="$CXXFLAGS -fPIE"
  5206. LDFLAGS="$LDFLAGS -pie"
  5207. AC_TRY_LINK([int foo;], [], [kde_cv_val_pie_support=yes], [kde_cv_val_pie_support=no])
  5208. CXXFLAGS=$safe_CXXFLAGS
  5209. LDFLAGS=$safe_LDFLAGS
  5210. AC_LANG_RESTORE
  5211. ])
  5212. AC_MSG_CHECKING(if enabling -pie/fPIE support)
  5213. AC_ARG_ENABLE(pie,
  5214. AC_HELP_STRING([--enable-pie],[platform supports PIE linking [default=detect]]),
  5215. [kde_has_pie_support=$enableval],
  5216. [kde_has_pie_support=detect])
  5217. if test "$kde_has_pie_support" = "detect"; then
  5218. kde_has_pie_support=$kde_cv_val_pie_support
  5219. fi
  5220. AC_MSG_RESULT([$kde_has_pie_support])
  5221. KDE_USE_FPIE=""
  5222. KDE_USE_PIE=""
  5223. AC_SUBST([KDE_USE_FPIE])
  5224. AC_SUBST([KDE_USE_PIE])
  5225. if test "$kde_has_pie_support" = "yes"; then
  5226. KDE_USE_FPIE="-fPIE"
  5227. KDE_USE_PIE="-pie"
  5228. fi
  5229. ])
  5230. # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
  5231. ## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
  5232. ## Free Software Foundation, Inc.
  5233. ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  5234. ##
  5235. ## This file is free software; the Free Software Foundation gives
  5236. ## unlimited permission to copy and/or distribute it, with or without
  5237. ## modifications, as long as this notice is preserved.
  5238. # serial 48 Debian 1.5.22-4 AC_PROG_LIBTOOL
  5239. # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
  5240. # -----------------------------------------------------------
  5241. # If this macro is not defined by Autoconf, define it here.
  5242. m4_ifdef([AC_PROVIDE_IFELSE],
  5243. [],
  5244. [m4_define([AC_PROVIDE_IFELSE],
  5245. [m4_ifdef([AC_PROVIDE_$1],
  5246. [$2], [$3])])])
  5247. # AC_PROG_LIBTOOL
  5248. # ---------------
  5249. AC_DEFUN([AC_PROG_LIBTOOL],
  5250. [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
  5251. dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
  5252. dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
  5253. AC_PROVIDE_IFELSE([AC_PROG_CXX],
  5254. [AC_LIBTOOL_CXX],
  5255. [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
  5256. ])])
  5257. dnl And a similar setup for Fortran 77 support
  5258. AC_PROVIDE_IFELSE([AC_PROG_F77],
  5259. [AC_LIBTOOL_F77],
  5260. [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
  5261. ])])
  5262. dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
  5263. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
  5264. dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
  5265. AC_PROVIDE_IFELSE([AC_PROG_GCJ],
  5266. [AC_LIBTOOL_GCJ],
  5267. [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
  5268. [AC_LIBTOOL_GCJ],
  5269. [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
  5270. [AC_LIBTOOL_GCJ],
  5271. [ifdef([AC_PROG_GCJ],
  5272. [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
  5273. ifdef([A][M_PROG_GCJ],
  5274. [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
  5275. ifdef([LT_AC_PROG_GCJ],
  5276. [define([LT_AC_PROG_GCJ],
  5277. defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
  5278. ])])# AC_PROG_LIBTOOL
  5279. # _AC_PROG_LIBTOOL
  5280. # ----------------
  5281. AC_DEFUN([_AC_PROG_LIBTOOL],
  5282. [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
  5283. AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
  5284. AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
  5285. AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
  5286. # This can be used to rebuild libtool when needed
  5287. LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
  5288. # Always use our own libtool.
  5289. LIBTOOL='$(SHELL) $(top_builddir)/libtool'
  5290. AC_SUBST(LIBTOOL)dnl
  5291. # Prevent multiple expansion
  5292. define([AC_PROG_LIBTOOL], [])
  5293. ])# _AC_PROG_LIBTOOL
  5294. # AC_LIBTOOL_SETUP
  5295. # ----------------
  5296. AC_DEFUN([AC_LIBTOOL_SETUP],
  5297. [AC_PREREQ(2.50)dnl
  5298. AC_REQUIRE([AC_ENABLE_SHARED])dnl
  5299. AC_REQUIRE([AC_ENABLE_STATIC])dnl
  5300. AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
  5301. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  5302. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  5303. AC_REQUIRE([AC_PROG_CC])dnl
  5304. AC_REQUIRE([AC_PROG_LD])dnl
  5305. AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
  5306. AC_REQUIRE([AC_PROG_NM])dnl
  5307. AC_REQUIRE([AC_PROG_LN_S])dnl
  5308. AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
  5309. # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
  5310. AC_REQUIRE([AC_OBJEXT])dnl
  5311. AC_REQUIRE([AC_EXEEXT])dnl
  5312. dnl
  5313. AC_LIBTOOL_SYS_MAX_CMD_LEN
  5314. AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
  5315. AC_LIBTOOL_OBJDIR
  5316. AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
  5317. _LT_AC_PROG_ECHO_BACKSLASH
  5318. case $host_os in
  5319. aix3*)
  5320. # AIX sometimes has problems with the GCC collect2 program. For some
  5321. # reason, if we set the COLLECT_NAMES environment variable, the problems
  5322. # vanish in a puff of smoke.
  5323. if test "X${COLLECT_NAMES+set}" != Xset; then
  5324. COLLECT_NAMES=
  5325. export COLLECT_NAMES
  5326. fi
  5327. ;;
  5328. esac
  5329. # Sed substitution that helps us do robust quoting. It backslashifies
  5330. # metacharacters that are still active within double-quoted strings.
  5331. Xsed='sed -e 1s/^X//'
  5332. [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
  5333. # Same as above, but do not quote variable references.
  5334. [double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
  5335. # Sed substitution to delay expansion of an escaped shell variable in a
  5336. # double_quote_subst'ed string.
  5337. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
  5338. # Sed substitution to avoid accidental globbing in evaled expressions
  5339. no_glob_subst='s/\*/\\\*/g'
  5340. # Constants:
  5341. rm="rm -f"
  5342. # Global variables:
  5343. default_ofile=libtool
  5344. can_build_shared=yes
  5345. # All known linkers require a `.a' archive for static linking (except MSVC,
  5346. # which needs '.lib').
  5347. libext=a
  5348. ltmain="$ac_aux_dir/ltmain.sh"
  5349. ofile="$default_ofile"
  5350. with_gnu_ld="$lt_cv_prog_gnu_ld"
  5351. AC_CHECK_TOOL(AR, ar, false)
  5352. AC_CHECK_TOOL(RANLIB, ranlib, :)
  5353. AC_CHECK_TOOL(STRIP, strip, :)
  5354. old_CC="$CC"
  5355. old_CFLAGS="$CFLAGS"
  5356. # Set sane defaults for various variables
  5357. test -z "$AR" && AR=ar
  5358. test -z "$AR_FLAGS" && AR_FLAGS=cru
  5359. test -z "$AS" && AS=as
  5360. test -z "$CC" && CC=cc
  5361. test -z "$LTCC" && LTCC=$CC
  5362. test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
  5363. test -z "$DLLTOOL" && DLLTOOL=dlltool
  5364. test -z "$LD" && LD=ld
  5365. test -z "$LN_S" && LN_S="ln -s"
  5366. test -z "$MAGIC_CMD" && MAGIC_CMD=file
  5367. test -z "$NM" && NM=nm
  5368. test -z "$SED" && SED=sed
  5369. test -z "$OBJDUMP" && OBJDUMP=objdump
  5370. test -z "$RANLIB" && RANLIB=:
  5371. test -z "$STRIP" && STRIP=:
  5372. test -z "$ac_objext" && ac_objext=o
  5373. # Determine commands to create old-style static archives.
  5374. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
  5375. old_postinstall_cmds='chmod 644 $oldlib'
  5376. old_postuninstall_cmds=
  5377. if test -n "$RANLIB"; then
  5378. case $host_os in
  5379. openbsd*)
  5380. old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
  5381. ;;
  5382. *)
  5383. old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
  5384. ;;
  5385. esac
  5386. old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
  5387. fi
  5388. _LT_CC_BASENAME([$compiler])
  5389. # Only perform the check for file, if the check method requires it
  5390. case $deplibs_check_method in
  5391. file_magic*)
  5392. if test "$file_magic_cmd" = '$MAGIC_CMD'; then
  5393. AC_PATH_MAGIC
  5394. fi
  5395. ;;
  5396. esac
  5397. AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
  5398. AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
  5399. enable_win32_dll=yes, enable_win32_dll=no)
  5400. AC_ARG_ENABLE([libtool-lock],
  5401. [AC_HELP_STRING([--disable-libtool-lock],
  5402. [avoid locking (might break parallel builds)])])
  5403. test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
  5404. AC_ARG_WITH([pic],
  5405. [AC_HELP_STRING([--with-pic],
  5406. [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
  5407. [pic_mode="$withval"],
  5408. [pic_mode=default])
  5409. test -z "$pic_mode" && pic_mode=default
  5410. # Use C for the default configuration in the libtool script
  5411. tagname=
  5412. AC_LIBTOOL_LANG_C_CONFIG
  5413. _LT_AC_TAGCONFIG
  5414. ])# AC_LIBTOOL_SETUP
  5415. # _LT_AC_SYS_COMPILER
  5416. # -------------------
  5417. AC_DEFUN([_LT_AC_SYS_COMPILER],
  5418. [AC_REQUIRE([AC_PROG_CC])dnl
  5419. # If no C compiler was specified, use CC.
  5420. LTCC=${LTCC-"$CC"}
  5421. # If no C compiler flags were specified, use CFLAGS.
  5422. LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
  5423. # Allow CC to be a program name with arguments.
  5424. compiler=$CC
  5425. ])# _LT_AC_SYS_COMPILER
  5426. # _LT_CC_BASENAME(CC)
  5427. # -------------------
  5428. # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
  5429. AC_DEFUN([_LT_CC_BASENAME],
  5430. [for cc_temp in $1""; do
  5431. case $cc_temp in
  5432. compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
  5433. distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
  5434. \-*) ;;
  5435. *) break;;
  5436. esac
  5437. done
  5438. cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
  5439. ])
  5440. # _LT_COMPILER_BOILERPLATE
  5441. # ------------------------
  5442. # Check for compiler boilerplate output or warnings with
  5443. # the simple compiler test code.
  5444. AC_DEFUN([_LT_COMPILER_BOILERPLATE],
  5445. [ac_outfile=conftest.$ac_objext
  5446. printf "$lt_simple_compile_test_code" >conftest.$ac_ext
  5447. eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
  5448. _lt_compiler_boilerplate=`cat conftest.err`
  5449. $rm conftest*
  5450. ])# _LT_COMPILER_BOILERPLATE
  5451. # _LT_LINKER_BOILERPLATE
  5452. # ----------------------
  5453. # Check for linker boilerplate output or warnings with
  5454. # the simple link test code.
  5455. AC_DEFUN([_LT_LINKER_BOILERPLATE],
  5456. [ac_outfile=conftest.$ac_objext
  5457. printf "$lt_simple_link_test_code" >conftest.$ac_ext
  5458. eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
  5459. _lt_linker_boilerplate=`cat conftest.err`
  5460. $rm conftest*
  5461. ])# _LT_LINKER_BOILERPLATE
  5462. # _LT_AC_SYS_LIBPATH_AIX
  5463. # ----------------------
  5464. # Links a minimal program and checks the executable
  5465. # for the system default hardcoded library path. In most cases,
  5466. # this is /usr/lib:/lib, but when the MPI compilers are used
  5467. # the location of the communication and MPI libs are included too.
  5468. # If we don't find anything, use the default library path according
  5469. # to the aix ld manual.
  5470. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
  5471. [AC_LINK_IFELSE(AC_LANG_PROGRAM,[
  5472. aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
  5473. }'`
  5474. # Check for a 64-bit object if we didn't find anything.
  5475. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
  5476. }'`; fi],[])
  5477. if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
  5478. ])# _LT_AC_SYS_LIBPATH_AIX
  5479. # _LT_AC_SHELL_INIT(ARG)
  5480. # ----------------------
  5481. AC_DEFUN([_LT_AC_SHELL_INIT],
  5482. [ifdef([AC_DIVERSION_NOTICE],
  5483. [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
  5484. [AC_DIVERT_PUSH(NOTICE)])
  5485. $1
  5486. AC_DIVERT_POP
  5487. ])# _LT_AC_SHELL_INIT
  5488. # _LT_AC_PROG_ECHO_BACKSLASH
  5489. # --------------------------
  5490. # Add some code to the start of the generated configure script which
  5491. # will find an echo command which doesn't interpret backslashes.
  5492. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
  5493. [_LT_AC_SHELL_INIT([
  5494. # Check that we are running under the correct shell.
  5495. SHELL=${CONFIG_SHELL-/bin/sh}
  5496. case X$ECHO in
  5497. X*--fallback-echo)
  5498. # Remove one level of quotation (which was required for Make).
  5499. ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
  5500. ;;
  5501. esac
  5502. echo=${ECHO-echo}
  5503. if test "X[$]1" = X--no-reexec; then
  5504. # Discard the --no-reexec flag, and continue.
  5505. shift
  5506. elif test "X[$]1" = X--fallback-echo; then
  5507. # Avoid inline document here, it may be left over
  5508. :
  5509. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
  5510. # Yippee, $echo works!
  5511. :
  5512. else
  5513. # Restart under the correct shell.
  5514. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
  5515. fi
  5516. if test "X[$]1" = X--fallback-echo; then
  5517. # used as fallback echo
  5518. shift
  5519. cat <<EOF
  5520. [$]*
  5521. EOF
  5522. exit 0
  5523. fi
  5524. # The HP-UX ksh and POSIX shell print the target directory to stdout
  5525. # if CDPATH is set.
  5526. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  5527. if test -z "$ECHO"; then
  5528. if test "X${echo_test_string+set}" != Xset; then
  5529. # find a string as large as possible, as long as the shell can cope with it
  5530. for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
  5531. # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
  5532. if (echo_test_string=`eval $cmd`) 2>/dev/null &&
  5533. echo_test_string=`eval $cmd` &&
  5534. (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
  5535. then
  5536. break
  5537. fi
  5538. done
  5539. fi
  5540. if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
  5541. echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
  5542. test "X$echo_testing_string" = "X$echo_test_string"; then
  5543. :
  5544. else
  5545. # The Solaris, AIX, and Digital Unix default echo programs unquote
  5546. # backslashes. This makes it impossible to quote backslashes using
  5547. # echo "$something" | sed 's/\\/\\\\/g'
  5548. #
  5549. # So, first we look for a working echo in the user's PATH.
  5550. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
  5551. for dir in $PATH /usr/ucb; do
  5552. IFS="$lt_save_ifs"
  5553. if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
  5554. test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
  5555. echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
  5556. test "X$echo_testing_string" = "X$echo_test_string"; then
  5557. echo="$dir/echo"
  5558. break
  5559. fi
  5560. done
  5561. IFS="$lt_save_ifs"
  5562. if test "X$echo" = Xecho; then
  5563. # We didn't find a better echo, so look for alternatives.
  5564. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
  5565. echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
  5566. test "X$echo_testing_string" = "X$echo_test_string"; then
  5567. # This shell has a builtin print -r that does the trick.
  5568. echo='print -r'
  5569. elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
  5570. test "X$CONFIG_SHELL" != X/bin/ksh; then
  5571. # If we have ksh, try running configure again with it.
  5572. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
  5573. export ORIGINAL_CONFIG_SHELL
  5574. CONFIG_SHELL=/bin/ksh
  5575. export CONFIG_SHELL
  5576. exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
  5577. else
  5578. # Try using printf.
  5579. echo='printf %s\n'
  5580. if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
  5581. echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
  5582. test "X$echo_testing_string" = "X$echo_test_string"; then
  5583. # Cool, printf works
  5584. :
  5585. elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
  5586. test "X$echo_testing_string" = 'X\t' &&
  5587. echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
  5588. test "X$echo_testing_string" = "X$echo_test_string"; then
  5589. CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
  5590. export CONFIG_SHELL
  5591. SHELL="$CONFIG_SHELL"
  5592. export SHELL
  5593. echo="$CONFIG_SHELL [$]0 --fallback-echo"
  5594. elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
  5595. test "X$echo_testing_string" = 'X\t' &&
  5596. echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
  5597. test "X$echo_testing_string" = "X$echo_test_string"; then
  5598. echo="$CONFIG_SHELL [$]0 --fallback-echo"
  5599. else
  5600. # maybe with a smaller string...
  5601. prev=:
  5602. for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
  5603. if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
  5604. then
  5605. break
  5606. fi
  5607. prev="$cmd"
  5608. done
  5609. if test "$prev" != 'sed 50q "[$]0"'; then
  5610. echo_test_string=`eval $prev`
  5611. export echo_test_string
  5612. exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
  5613. else
  5614. # Oops. We lost completely, so just stick with echo.
  5615. echo=echo
  5616. fi
  5617. fi
  5618. fi
  5619. fi
  5620. fi
  5621. fi
  5622. # Copy echo and quote the copy suitably for passing to libtool from
  5623. # the Makefile, instead of quoting the original, which is used later.
  5624. ECHO=$echo
  5625. if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
  5626. ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
  5627. fi
  5628. AC_SUBST(ECHO)
  5629. ])])# _LT_AC_PROG_ECHO_BACKSLASH
  5630. # _LT_AC_LOCK
  5631. # -----------
  5632. AC_DEFUN([_LT_AC_LOCK],
  5633. [AC_ARG_ENABLE([libtool-lock],
  5634. [AC_HELP_STRING([--disable-libtool-lock],
  5635. [avoid locking (might break parallel builds)])])
  5636. test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
  5637. # Some flags need to be propagated to the compiler or linker for good
  5638. # libtool support.
  5639. case $host in
  5640. ia64-*-hpux*)
  5641. # Find out which ABI we are using.
  5642. echo 'int i;' > conftest.$ac_ext
  5643. if AC_TRY_EVAL(ac_compile); then
  5644. case `/usr/bin/file conftest.$ac_objext` in
  5645. *ELF-32*)
  5646. HPUX_IA64_MODE="32"
  5647. ;;
  5648. *ELF-64*)
  5649. HPUX_IA64_MODE="64"
  5650. ;;
  5651. esac
  5652. fi
  5653. rm -rf conftest*
  5654. ;;
  5655. *-*-irix6*)
  5656. # Find out which ABI we are using.
  5657. echo '[#]line __oline__ "configure"' > conftest.$ac_ext
  5658. if AC_TRY_EVAL(ac_compile); then
  5659. if test "$lt_cv_prog_gnu_ld" = yes; then
  5660. case `/usr/bin/file conftest.$ac_objext` in
  5661. *32-bit*)
  5662. LD="${LD-ld} -melf32bsmip"
  5663. ;;
  5664. *N32*)
  5665. LD="${LD-ld} -melf32bmipn32"
  5666. ;;
  5667. *64-bit*)
  5668. LD="${LD-ld} -melf64bmip"
  5669. ;;
  5670. esac
  5671. else
  5672. case `/usr/bin/file conftest.$ac_objext` in
  5673. *32-bit*)
  5674. LD="${LD-ld} -32"
  5675. ;;
  5676. *N32*)
  5677. LD="${LD-ld} -n32"
  5678. ;;
  5679. *64-bit*)
  5680. LD="${LD-ld} -64"
  5681. ;;
  5682. esac
  5683. fi
  5684. fi
  5685. rm -rf conftest*
  5686. ;;
  5687. x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
  5688. # Find out which ABI we are using.
  5689. echo 'int i;' > conftest.$ac_ext
  5690. if AC_TRY_EVAL(ac_compile); then
  5691. case `/usr/bin/file conftest.o` in
  5692. *32-bit*)
  5693. case $host in
  5694. x86_64-*linux*)
  5695. LD="${LD-ld} -m elf_i386"
  5696. ;;
  5697. ppc64-*linux*|powerpc64-*linux*)
  5698. LD="${LD-ld} -m elf32ppclinux"
  5699. ;;
  5700. s390x-*linux*)
  5701. LD="${LD-ld} -m elf_s390"
  5702. ;;
  5703. sparc64-*linux*)
  5704. LD="${LD-ld} -m elf32_sparc"
  5705. ;;
  5706. esac
  5707. ;;
  5708. *64-bit*)
  5709. case $host in
  5710. x86_64-*linux*)
  5711. LD="${LD-ld} -m elf_x86_64"
  5712. ;;
  5713. ppc*-*linux*|powerpc*-*linux*)
  5714. LD="${LD-ld} -m elf64ppc"
  5715. ;;
  5716. s390*-*linux*)
  5717. LD="${LD-ld} -m elf64_s390"
  5718. ;;
  5719. sparc*-*linux*)
  5720. LD="${LD-ld} -m elf64_sparc"
  5721. ;;
  5722. esac
  5723. ;;
  5724. esac
  5725. fi
  5726. rm -rf conftest*
  5727. ;;
  5728. *-*-sco3.2v5*)
  5729. # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  5730. SAVE_CFLAGS="$CFLAGS"
  5731. CFLAGS="$CFLAGS -belf"
  5732. AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
  5733. [AC_LANG_PUSH(C)
  5734. AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
  5735. AC_LANG_POP])
  5736. if test x"$lt_cv_cc_needs_belf" != x"yes"; then
  5737. # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
  5738. CFLAGS="$SAVE_CFLAGS"
  5739. fi
  5740. ;;
  5741. sparc*-*solaris*)
  5742. # Find out which ABI we are using.
  5743. echo 'int i;' > conftest.$ac_ext
  5744. if AC_TRY_EVAL(ac_compile); then
  5745. case `/usr/bin/file conftest.o` in
  5746. *64-bit*)
  5747. case $lt_cv_prog_gnu_ld in
  5748. yes*) LD="${LD-ld} -m elf64_sparc" ;;
  5749. *) LD="${LD-ld} -64" ;;
  5750. esac
  5751. ;;
  5752. esac
  5753. fi
  5754. rm -rf conftest*
  5755. ;;
  5756. AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
  5757. [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
  5758. AC_CHECK_TOOL(DLLTOOL, dlltool, false)
  5759. AC_CHECK_TOOL(AS, as, false)
  5760. AC_CHECK_TOOL(OBJDUMP, objdump, false)
  5761. ;;
  5762. ])
  5763. esac
  5764. need_locks="$enable_libtool_lock"
  5765. ])# _LT_AC_LOCK
  5766. # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
  5767. # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
  5768. # ----------------------------------------------------------------
  5769. # Check whether the given compiler option works
  5770. AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
  5771. [AC_REQUIRE([LT_AC_PROG_SED])
  5772. AC_CACHE_CHECK([$1], [$2],
  5773. [$2=no
  5774. ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
  5775. printf "$lt_simple_compile_test_code" > conftest.$ac_ext
  5776. lt_compiler_flag="$3"
  5777. # Insert the option either (1) after the last *FLAGS variable, or
  5778. # (2) before a word containing "conftest.", or (3) at the end.
  5779. # Note that $ac_compile itself does not contain backslashes and begins
  5780. # with a dollar sign (not a hyphen), so the echo should work correctly.
  5781. # The option is referenced via a variable to avoid confusing sed.
  5782. lt_compile=`echo "$ac_compile" | $SED \
  5783. -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  5784. -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
  5785. -e 's:$: $lt_compiler_flag:'`
  5786. (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
  5787. (eval "$lt_compile" 2>conftest.err)
  5788. ac_status=$?
  5789. cat conftest.err >&AS_MESSAGE_LOG_FD
  5790. echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
  5791. if (exit $ac_status) && test -s "$ac_outfile"; then
  5792. # The compiler can only warn and ignore the option if not recognized
  5793. # So say no if there are warnings other than the usual output.
  5794. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  5795. $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  5796. if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  5797. $2=yes
  5798. fi
  5799. fi
  5800. $rm conftest*
  5801. ])
  5802. if test x"[$]$2" = xyes; then
  5803. ifelse([$5], , :, [$5])
  5804. else
  5805. ifelse([$6], , :, [$6])
  5806. fi
  5807. ])# AC_LIBTOOL_COMPILER_OPTION
  5808. # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
  5809. # [ACTION-SUCCESS], [ACTION-FAILURE])
  5810. # ------------------------------------------------------------
  5811. # Check whether the given compiler option works
  5812. AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
  5813. [AC_CACHE_CHECK([$1], [$2],
  5814. [$2=no
  5815. save_LDFLAGS="$LDFLAGS"
  5816. LDFLAGS="$LDFLAGS $3"
  5817. printf "$lt_simple_link_test_code" > conftest.$ac_ext
  5818. if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
  5819. # The linker can only warn and ignore the option if not recognized
  5820. # So say no if there are warnings
  5821. if test -s conftest.err; then
  5822. # Append any errors to the config.log.
  5823. cat conftest.err 1>&AS_MESSAGE_LOG_FD
  5824. $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
  5825. $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  5826. if diff conftest.exp conftest.er2 >/dev/null; then
  5827. $2=yes
  5828. fi
  5829. else
  5830. $2=yes
  5831. fi
  5832. fi
  5833. $rm conftest*
  5834. LDFLAGS="$save_LDFLAGS"
  5835. ])
  5836. if test x"[$]$2" = xyes; then
  5837. ifelse([$4], , :, [$4])
  5838. else
  5839. ifelse([$5], , :, [$5])
  5840. fi
  5841. ])# AC_LIBTOOL_LINKER_OPTION
  5842. # AC_LIBTOOL_SYS_MAX_CMD_LEN
  5843. # --------------------------
  5844. AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
  5845. [# find the maximum length of command line arguments