Dolphin file manager
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.

11891 lines
365KB

  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/tde/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}/trinity'
  432. fi
  433. fi
  434. if test -z "$kde_styledir"; then
  435. kde_styledir='\${libdir}/trinity/plugins/styles'
  436. fi
  437. if test -z "$kde_widgetdir"; then
  438. kde_widgetdir='\${libdir}/trinity/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/trinity/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. trinity2ornewer=1
  522. trinity3ornewer=1
  523. if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then
  524. trinity2ornewer=
  525. trinity3ornewer=
  526. else
  527. if test "$kde_qtver" = "3"; then
  528. if test "$kde_qtsubver" -le 1; then
  529. trinity2ornewer=
  530. fi
  531. if test "$kde_qtsubver" -le 2; then
  532. trinity3ornewer=
  533. fi
  534. if test "$KDECONFIG" != "compiled"; then
  535. if test `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then
  536. trinity3ornewer=
  537. fi
  538. fi
  539. fi
  540. fi
  541. if test -n "$trinity2ornewer"; 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 "$trinity3ornewer"; 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/trinity/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 "$trinity2ornewer"; 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 /usr/lib${kdelibsuff}/qt-3.3"
  1101. if test -z "$PKG_CONFIG"; then
  1102. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1103. fi
  1104. if test "$PKG_CONFIG" != "no" ; then
  1105. if $PKG_CONFIG --exists qt-mt ; then
  1106. kde_qt_dirs="$kde_qt_dirs `$PKG_CONFIG --variable=prefix qt-mt`"
  1107. fi
  1108. fi
  1109. fi
  1110. if test $kde_qtver = 2; then
  1111. kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
  1112. fi
  1113. if test $kde_qtver = 1; then
  1114. kde_qt_dirs="$QTDIR /usr/lib/qt"
  1115. fi
  1116. ])
  1117. AC_DEFUN([KDE_CHECK_QT_DIRECT],
  1118. [
  1119. AC_REQUIRE([KDE_USE_QT])
  1120. AC_MSG_CHECKING([if Qt compiles without flags])
  1121. AC_CACHE_VAL(kde_cv_qt_direct,
  1122. [
  1123. AC_LANG_SAVE
  1124. AC_LANG_CPLUSPLUS
  1125. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  1126. ac_LIBRARY_PATH="$LIBRARY_PATH"
  1127. ac_cxxflags_safe="$CXXFLAGS"
  1128. ac_ldflags_safe="$LDFLAGS"
  1129. ac_libs_safe="$LIBS"
  1130. CXXFLAGS="$CXXFLAGS -I$qt_includes"
  1131. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  1132. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1133. LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
  1134. else
  1135. LIBS="$LIBQT $LIBSOCKET"
  1136. fi
  1137. LD_LIBRARY_PATH=
  1138. export LD_LIBRARY_PATH
  1139. LIBRARY_PATH=
  1140. export LIBRARY_PATH
  1141. KDE_PRINT_QT_PROGRAM
  1142. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1143. kde_cv_qt_direct="yes"
  1144. else
  1145. kde_cv_qt_direct="no"
  1146. echo "configure: failed program was:" >&AC_FD_CC
  1147. cat conftest.$ac_ext >&AC_FD_CC
  1148. fi
  1149. rm -f conftest*
  1150. CXXFLAGS="$ac_cxxflags_safe"
  1151. LDFLAGS="$ac_ldflags_safe"
  1152. LIBS="$ac_libs_safe"
  1153. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  1154. export LD_LIBRARY_PATH
  1155. LIBRARY_PATH="$ac_LIBRARY_PATH"
  1156. export LIBRARY_PATH
  1157. AC_LANG_RESTORE
  1158. ])
  1159. if test "$kde_cv_qt_direct" = "yes"; then
  1160. AC_MSG_RESULT(yes)
  1161. $1
  1162. else
  1163. AC_MSG_RESULT(no)
  1164. $2
  1165. fi
  1166. ])
  1167. dnl ------------------------------------------------------------------------
  1168. dnl Try to find the Qt headers and libraries.
  1169. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
  1170. dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
  1171. dnl ------------------------------------------------------------------------
  1172. dnl
  1173. AC_DEFUN([AC_PATH_QT_1_3],
  1174. [
  1175. AC_REQUIRE([K_PATH_X])
  1176. AC_REQUIRE([KDE_USE_QT])
  1177. AC_REQUIRE([KDE_CHECK_LIB64])
  1178. dnl ------------------------------------------------------------------------
  1179. dnl Add configure flag to enable linking to MT version of Qt library.
  1180. dnl ------------------------------------------------------------------------
  1181. AC_ARG_ENABLE(
  1182. mt,
  1183. AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]),
  1184. kde_use_qt_mt=$enableval,
  1185. [
  1186. if test $kde_qtver = 3; then
  1187. kde_use_qt_mt=yes
  1188. else
  1189. kde_use_qt_mt=no
  1190. fi
  1191. ]
  1192. )
  1193. USING_QT_MT=""
  1194. dnl ------------------------------------------------------------------------
  1195. dnl If we not get --disable-qt-mt then adjust some vars for the host.
  1196. dnl ------------------------------------------------------------------------
  1197. KDE_MT_LDFLAGS=
  1198. KDE_MT_LIBS=
  1199. if test "x$kde_use_qt_mt" = "xyes"; then
  1200. KDE_CHECK_THREADING
  1201. if test "x$kde_use_threading" = "xyes"; then
  1202. CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
  1203. KDE_MT_LDFLAGS="$USE_THREADS"
  1204. KDE_MT_LIBS="$LIBPTHREAD"
  1205. else
  1206. kde_use_qt_mt=no
  1207. fi
  1208. fi
  1209. AC_SUBST(KDE_MT_LDFLAGS)
  1210. AC_SUBST(KDE_MT_LIBS)
  1211. kde_qt_was_given=yes
  1212. dnl ------------------------------------------------------------------------
  1213. dnl If we haven't been told how to link to Qt, we work it out for ourselves.
  1214. dnl ------------------------------------------------------------------------
  1215. if test -z "$LIBQT_GLOB"; then
  1216. if test "x$kde_use_qt_emb" = "xyes"; then
  1217. LIBQT_GLOB="libqte.*"
  1218. else
  1219. LIBQT_GLOB="libqt.*"
  1220. fi
  1221. fi
  1222. dnl ------------------------------------------------------------
  1223. dnl If we got --enable-embedded then adjust the Qt library name.
  1224. dnl ------------------------------------------------------------
  1225. if test "x$kde_use_qt_emb" = "xyes"; then
  1226. qtlib="qte"
  1227. else
  1228. qtlib="qt"
  1229. fi
  1230. kde_int_qt="-l$qtlib"
  1231. if test -z "$LIBQPE"; then
  1232. dnl ------------------------------------------------------------
  1233. dnl If we got --enable-palmtop then add -lqpe to the link line
  1234. dnl ------------------------------------------------------------
  1235. if test "x$kde_use_qt_emb" = "xyes"; then
  1236. if test "x$kde_use_qt_emb_palm" = "xyes"; then
  1237. LIB_QPE="-lqpe"
  1238. else
  1239. LIB_QPE=""
  1240. fi
  1241. else
  1242. LIB_QPE=""
  1243. fi
  1244. fi
  1245. dnl ------------------------------------------------------------------------
  1246. dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
  1247. dnl ------------------------------------------------------------------------
  1248. if test "x$kde_use_qt_mt" = "xyes"; then
  1249. LIBQT="-l$qtlib-mt"
  1250. kde_int_qt="-l$qtlib-mt"
  1251. LIBQT_GLOB="lib$qtlib-mt.*"
  1252. USING_QT_MT="using -mt"
  1253. else
  1254. LIBQT="-l$qtlib"
  1255. fi
  1256. if test $kde_qtver != 1; then
  1257. AC_REQUIRE([AC_FIND_PNG])
  1258. AC_REQUIRE([AC_FIND_JPEG])
  1259. LIBQT="$LIBQT $LIBPNG $LIBJPEG"
  1260. fi
  1261. if test $kde_qtver = 3; then
  1262. AC_REQUIRE([KDE_CHECK_LIBDL])
  1263. LIBQT="$LIBQT $LIBDL"
  1264. fi
  1265. AC_MSG_CHECKING([for Qt])
  1266. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1267. LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
  1268. fi
  1269. ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
  1270. qt_libraries=""
  1271. qt_includes=""
  1272. AC_ARG_WITH(qt-dir,
  1273. AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]),
  1274. [ ac_qt_includes="$withval"/include
  1275. ac_qt_libraries="$withval"/lib${kdelibsuff}
  1276. ac_qt_bindir="$withval"/bin
  1277. ])
  1278. AC_ARG_WITH(qt-includes,
  1279. AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]),
  1280. [
  1281. ac_qt_includes="$withval"
  1282. ])
  1283. kde_qt_libs_given=no
  1284. AC_ARG_WITH(qt-libraries,
  1285. AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]),
  1286. [ ac_qt_libraries="$withval"
  1287. kde_qt_libs_given=yes
  1288. ])
  1289. AC_CACHE_VAL(ac_cv_have_qt,
  1290. [#try to guess Qt locations
  1291. qt_incdirs=""
  1292. for dir in $kde_qt_dirs; do
  1293. qt_incdirs="$qt_incdirs $dir/include $dir"
  1294. done
  1295. if test -z "$PKG_CONFIG"; then
  1296. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1297. fi
  1298. if test "$PKG_CONFIG" != "no" ; then
  1299. if $PKG_CONFIG --exists qt-mt ; then
  1300. qt_incdirs="$qt_incdirs `$PKG_CONFIG --variable=includedir qt-mt`"
  1301. fi
  1302. fi
  1303. 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"
  1304. if test ! "$ac_qt_includes" = "NO"; then
  1305. qt_incdirs="$ac_qt_includes $qt_incdirs"
  1306. fi
  1307. if test "$kde_qtver" != "1"; then
  1308. kde_qt_header=qstyle.h
  1309. else
  1310. kde_qt_header=qglobal.h
  1311. fi
  1312. AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
  1313. ac_qt_includes="$qt_incdir"
  1314. qt_libdirs=""
  1315. for dir in $kde_qt_dirs; do
  1316. qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir/lib $dir"
  1317. done
  1318. if test -z "$PKG_CONFIG"; then
  1319. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1320. fi
  1321. if test "$PKG_CONFIG" != "no" ; then
  1322. if $PKG_CONFIG --exists qt-mt ; then
  1323. qt_libdirs="$qt_incdirs `$PKG_CONFIG --variable=libdir qt-mt`"
  1324. fi
  1325. fi
  1326. qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
  1327. if test ! "$ac_qt_libraries" = "NO"; then
  1328. qt_libdir=$ac_qt_libraries
  1329. else
  1330. qt_libdirs="$ac_qt_libraries $qt_libdirs"
  1331. # if the Qt was given, the chance is too big that libqt.* doesn't exist
  1332. qt_libdir=NONE
  1333. for dir in $qt_libdirs; do
  1334. try="ls -1 $dir/${LIBQT_GLOB}"
  1335. if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  1336. done
  1337. fi
  1338. for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
  1339. if test -e "$a"; then
  1340. LIBQT="$LIBQT ${kde_int_qt}_incremental"
  1341. break
  1342. fi
  1343. done
  1344. ac_qt_libraries="$qt_libdir"
  1345. AC_LANG_SAVE
  1346. AC_LANG_CPLUSPLUS
  1347. ac_cxxflags_safe="$CXXFLAGS"
  1348. ac_ldflags_safe="$LDFLAGS"
  1349. ac_libs_safe="$LIBS"
  1350. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  1351. LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
  1352. LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
  1353. KDE_PRINT_QT_PROGRAM
  1354. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1355. rm -f conftest*
  1356. else
  1357. echo "configure: failed program was:" >&AC_FD_CC
  1358. cat conftest.$ac_ext >&AC_FD_CC
  1359. ac_qt_libraries="NO"
  1360. fi
  1361. rm -f conftest*
  1362. CXXFLAGS="$ac_cxxflags_safe"
  1363. LDFLAGS="$ac_ldflags_safe"
  1364. LIBS="$ac_libs_safe"
  1365. AC_LANG_RESTORE
  1366. if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
  1367. ac_cv_have_qt="have_qt=no"
  1368. ac_qt_notfound=""
  1369. missing_qt_mt=""
  1370. if test "$ac_qt_includes" = NO; then
  1371. if test "$ac_qt_libraries" = NO; then
  1372. ac_qt_notfound="(headers and libraries)";
  1373. else
  1374. ac_qt_notfound="(headers)";
  1375. fi
  1376. else
  1377. if test "x$kde_use_qt_mt" = "xyes"; then
  1378. missing_qt_mt="
  1379. Make sure that you have compiled Qt with thread support!"
  1380. ac_qt_notfound="(library $qtlib-mt)";
  1381. else
  1382. ac_qt_notfound="(library $qtlib)";
  1383. fi
  1384. fi
  1385. AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
  1386. For more details about this problem, look at the end of config.log.$missing_qt_mt])
  1387. else
  1388. have_qt="yes"
  1389. fi
  1390. ])
  1391. eval "$ac_cv_have_qt"
  1392. if test "$have_qt" != yes; then
  1393. AC_MSG_RESULT([$have_qt]);
  1394. else
  1395. ac_cv_have_qt="have_qt=yes \
  1396. ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
  1397. AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
  1398. qt_libraries="$ac_qt_libraries"
  1399. qt_includes="$ac_qt_includes"
  1400. fi
  1401. if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
  1402. KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
  1403. fi
  1404. AC_SUBST(qt_libraries)
  1405. AC_SUBST(qt_includes)
  1406. if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
  1407. QT_INCLUDES=""
  1408. else
  1409. QT_INCLUDES="-I$qt_includes"
  1410. all_includes="$QT_INCLUDES $all_includes"
  1411. fi
  1412. if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
  1413. QT_LDFLAGS=""
  1414. else
  1415. QT_LDFLAGS="-L$qt_libraries"
  1416. all_libraries="$QT_LDFLAGS $all_libraries"
  1417. fi
  1418. test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
  1419. AC_SUBST(QT_INCLUDES)
  1420. AC_SUBST(QT_LDFLAGS)
  1421. AC_PATH_QT_MOC_UIC
  1422. KDE_CHECK_QT_JPEG
  1423. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1424. LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
  1425. else
  1426. LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
  1427. fi
  1428. test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
  1429. for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
  1430. if test -e "$a"; then
  1431. LIB_QT="$LIB_QT ${kde_int_qt}_incremental"
  1432. break
  1433. fi
  1434. done
  1435. AC_SUBST(LIB_QT)
  1436. AC_SUBST(LIB_QPE)
  1437. AC_SUBST(kde_qtver)
  1438. ])
  1439. AC_DEFUN([AC_PATH_QT],
  1440. [
  1441. AC_PATH_QT_1_3
  1442. ])
  1443. AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
  1444. [
  1445. AC_REQUIRE([AC_PATH_QT_MOC_UIC])
  1446. if test x$ac_uic_supports_libpath = xyes; then
  1447. AC_MSG_CHECKING([if UIC has KDE plugins available])
  1448. AC_CACHE_VAL(kde_cv_uic_plugins,
  1449. [
  1450. cat > actest.ui << EOF
  1451. <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
  1452. <class>NewConnectionDialog</class>
  1453. <widget class="QDialog">
  1454. <widget class="KLineEdit">
  1455. <property name="name">
  1456. <cstring>testInput</cstring>
  1457. </property>
  1458. </widget>
  1459. </widget>
  1460. </UI>
  1461. EOF
  1462. kde_cv_uic_plugins=no
  1463. kde_line="$UIC_PATH -L $kde_widgetdir"
  1464. if test x$ac_uic_supports_nounload = xyes; then
  1465. kde_line="$kde_line -nounload"
  1466. fi
  1467. kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
  1468. if AC_TRY_EVAL(kde_line); then
  1469. # if you're trying to debug this check and think it's incorrect,
  1470. # better check your installation. The check _is_ correct - your
  1471. # installation is not.
  1472. if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
  1473. kde_cv_uic_plugins=yes
  1474. fi
  1475. fi
  1476. rm -f actest.ui actest.cpp
  1477. ])
  1478. AC_MSG_RESULT([$kde_cv_uic_plugins])
  1479. if test "$kde_cv_uic_plugins" != yes; then
  1480. AC_MSG_ERROR([
  1481. you need to install kdelibs first.
  1482. If you did install kdelibs, then the Qt version that is picked up by
  1483. this configure is not the same version you used to compile kdelibs.
  1484. The Qt Plugin installed by kdelibs is *ONLY* loadable if it is the
  1485. _same Qt version_, compiled with the _same compiler_ and the same Qt
  1486. configuration settings.
  1487. ])
  1488. fi
  1489. fi
  1490. ])
  1491. AC_DEFUN([KDE_CHECK_FINAL],
  1492. [
  1493. AC_ARG_ENABLE(final,
  1494. AC_HELP_STRING([--enable-final],
  1495. [build size optimized apps (experimental - needs lots of memory)]),
  1496. kde_use_final=$enableval, kde_use_final=no)
  1497. if test "x$kde_use_final" = "xyes"; then
  1498. KDE_USE_FINAL_TRUE=""
  1499. KDE_USE_FINAL_FALSE="#"
  1500. else
  1501. KDE_USE_FINAL_TRUE="#"
  1502. KDE_USE_FINAL_FALSE=""
  1503. fi
  1504. AC_SUBST(KDE_USE_FINAL_TRUE)
  1505. AC_SUBST(KDE_USE_FINAL_FALSE)
  1506. ])
  1507. AC_DEFUN([KDE_CHECK_CLOSURE],
  1508. [
  1509. AC_ARG_ENABLE(closure,
  1510. AC_HELP_STRING([--enable-closure],[delay template instantiation]),
  1511. kde_use_closure=$enableval, kde_use_closure=no)
  1512. KDE_NO_UNDEFINED=""
  1513. if test "x$kde_use_closure" = "xyes"; then
  1514. KDE_USE_CLOSURE_TRUE=""
  1515. KDE_USE_CLOSURE_FALSE="#"
  1516. # CXXFLAGS="$CXXFLAGS $REPO"
  1517. else
  1518. KDE_USE_CLOSURE_TRUE="#"
  1519. KDE_USE_CLOSURE_FALSE=""
  1520. KDE_NO_UNDEFINED=""
  1521. case $host in
  1522. *-*-linux-gnu)
  1523. KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
  1524. [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
  1525. [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
  1526. [KDE_NO_UNDEFINED=""])],
  1527. [KDE_NO_UNDEFINED=""])
  1528. ;;
  1529. esac
  1530. fi
  1531. AC_SUBST(KDE_USE_CLOSURE_TRUE)
  1532. AC_SUBST(KDE_USE_CLOSURE_FALSE)
  1533. AC_SUBST(KDE_NO_UNDEFINED)
  1534. ])
  1535. dnl Check if the linker supports --enable-new-dtags and --as-needed
  1536. AC_DEFUN([KDE_CHECK_NEW_LDFLAGS],
  1537. [
  1538. AC_ARG_ENABLE(new_ldflags,
  1539. AC_HELP_STRING([--enable-new-ldflags],
  1540. [enable the new linker flags]),
  1541. kde_use_new_ldflags=$enableval,
  1542. kde_use_new_ldflags=no)
  1543. LDFLAGS_AS_NEEDED=""
  1544. LDFLAGS_NEW_DTAGS=""
  1545. if test "x$kde_use_new_ldflags" = "xyes"; then
  1546. LDFLAGS_NEW_DTAGS=""
  1547. KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags],
  1548. [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],)
  1549. KDE_CHECK_COMPILER_FLAG([Wl,--as-needed],
  1550. [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],)
  1551. fi
  1552. AC_SUBST(LDFLAGS_AS_NEEDED)
  1553. AC_SUBST(LDFLAGS_NEW_DTAGS)
  1554. ])
  1555. AC_DEFUN([KDE_CHECK_NMCHECK],
  1556. [
  1557. AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
  1558. kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
  1559. if test "$kde_use_nmcheck" = "yes"; then
  1560. KDE_USE_NMCHECK_TRUE=""
  1561. KDE_USE_NMCHECK_FALSE="#"
  1562. else
  1563. KDE_USE_NMCHECK_TRUE="#"
  1564. KDE_USE_NMCHECK_FALSE=""
  1565. fi
  1566. AC_SUBST(KDE_USE_NMCHECK_TRUE)
  1567. AC_SUBST(KDE_USE_NMCHECK_FALSE)
  1568. ])
  1569. AC_DEFUN([KDE_EXPAND_MAKEVAR], [
  1570. savex=$exec_prefix
  1571. test "x$exec_prefix" = xNONE && exec_prefix=$prefix
  1572. tmp=$$2
  1573. while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
  1574. exec_prefix=$savex
  1575. ])
  1576. dnl ------------------------------------------------------------------------
  1577. dnl Now, the same with KDE
  1578. dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
  1579. dnl and $(kde_includes) will be the kdehdrlocation (if needed)
  1580. dnl ------------------------------------------------------------------------
  1581. dnl
  1582. AC_DEFUN([AC_BASE_PATH_KDE],
  1583. [
  1584. AC_REQUIRE([KDE_CHECK_STL])
  1585. AC_REQUIRE([AC_PATH_QT])dnl
  1586. AC_REQUIRE([KDE_CHECK_LIB64])
  1587. AC_CHECK_RPATH
  1588. AC_MSG_CHECKING([for KDE])
  1589. if test "${prefix}" != NONE; then
  1590. kde_includes=${includedir}
  1591. KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
  1592. kde_libraries=${libdir}
  1593. KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
  1594. else
  1595. ac_kde_includes=
  1596. ac_kde_libraries=
  1597. kde_libraries=""
  1598. kde_includes=""
  1599. fi
  1600. AC_CACHE_VAL(ac_cv_have_kde,
  1601. [#try to guess kde locations
  1602. if test "$kde_qtver" = 1; then
  1603. kde_check_header="ksock.h"
  1604. kde_check_lib="libkdecore.la"
  1605. else
  1606. kde_check_header="ksharedptr.h"
  1607. kde_check_lib="libkio.la"
  1608. fi
  1609. if test -z "$1"; then
  1610. 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/trinity/include /opt/kde/include $x_includes $qt_includes"
  1611. test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
  1612. kde_incdirs="$ac_kde_includes $kde_incdirs"
  1613. AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
  1614. ac_kde_includes="$kde_incdir"
  1615. if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
  1616. AC_MSG_ERROR([
  1617. in the prefix, you've chosen, are no KDE headers installed. This will fail.
  1618. So, check this please and use another prefix!])
  1619. fi
  1620. 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}/trinity /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/trinity/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}"
  1621. test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
  1622. kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
  1623. AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
  1624. ac_kde_libraries="$kde_libdir"
  1625. kde_widgetdir=NO
  1626. dnl this might be somewhere else
  1627. AC_FIND_FILE("trinity/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
  1628. if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
  1629. AC_MSG_ERROR([
  1630. in the prefix, you've chosen, are no KDE libraries installed. This will fail.
  1631. So, check this please and use another prefix!])
  1632. fi
  1633. if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/trinity/plugins/designer/kdewidgets.la"; then
  1634. AC_MSG_ERROR([
  1635. I can't find the designer plugins. These are required and should have been installed
  1636. by kdelibs])
  1637. fi
  1638. if test -n "$kde_widgetdir"; then
  1639. kde_widgetdir="$kde_widgetdir/trinity/plugins/designer"
  1640. fi
  1641. if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
  1642. ac_cv_have_kde="have_kde=no"
  1643. else
  1644. ac_cv_have_kde="have_kde=yes \
  1645. ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1646. fi
  1647. else dnl test -z $1, e.g. from kdelibs
  1648. ac_cv_have_kde="have_kde=no"
  1649. fi
  1650. ])dnl
  1651. eval "$ac_cv_have_kde"
  1652. if test "$have_kde" != "yes"; then
  1653. if test "${prefix}" = NONE; then
  1654. ac_kde_prefix="$ac_default_prefix"
  1655. else
  1656. ac_kde_prefix="$prefix"
  1657. fi
  1658. if test "$exec_prefix" = NONE; then
  1659. ac_kde_exec_prefix="$ac_kde_prefix"
  1660. AC_MSG_RESULT([will be installed in $ac_kde_prefix])
  1661. else
  1662. ac_kde_exec_prefix="$exec_prefix"
  1663. AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
  1664. fi
  1665. kde_libraries="${libdir}"
  1666. kde_includes="${includedir}"
  1667. else
  1668. ac_cv_have_kde="have_kde=yes \
  1669. ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1670. AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
  1671. kde_libraries="$ac_kde_libraries"
  1672. kde_includes="$ac_kde_includes"
  1673. fi
  1674. AC_SUBST(kde_libraries)
  1675. AC_SUBST(kde_includes)
  1676. if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then
  1677. KDE_INCLUDES=""
  1678. else
  1679. KDE_INCLUDES="-I$kde_includes"
  1680. all_includes="$KDE_INCLUDES $all_includes"
  1681. fi
  1682. KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION"
  1683. KDE_LDFLAGS="-L$kde_libraries"
  1684. if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
  1685. all_libraries="$KDE_LDFLAGS $all_libraries"
  1686. fi
  1687. AC_SUBST(KDE_LDFLAGS)
  1688. AC_SUBST(KDE_INCLUDES)
  1689. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1690. all_libraries="$all_libraries $USER_LDFLAGS"
  1691. all_includes="$all_includes $USER_INCLUDES"
  1692. AC_SUBST(all_includes)
  1693. AC_SUBST(all_libraries)
  1694. if test -z "$1"; then
  1695. KDE_CHECK_UIC_PLUGINS
  1696. fi
  1697. ac_kde_libraries="$kde_libdir"
  1698. AC_SUBST(AUTODIRS)
  1699. ])
  1700. AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
  1701. [
  1702. AC_MSG_CHECKING(for extra includes)
  1703. AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]),
  1704. kde_use_extra_includes="$withval",
  1705. kde_use_extra_includes=NONE
  1706. )
  1707. kde_extra_includes=
  1708. if test -n "$kde_use_extra_includes" && \
  1709. test "$kde_use_extra_includes" != "NONE"; then
  1710. ac_save_ifs=$IFS
  1711. IFS=':'
  1712. for dir in $kde_use_extra_includes; do
  1713. kde_extra_includes="$kde_extra_includes $dir"
  1714. USER_INCLUDES="$USER_INCLUDES -I$dir"
  1715. done
  1716. IFS=$ac_save_ifs
  1717. kde_use_extra_includes="added"
  1718. else
  1719. kde_use_extra_includes="no"
  1720. fi
  1721. AC_SUBST(USER_INCLUDES)
  1722. AC_MSG_RESULT($kde_use_extra_includes)
  1723. kde_extra_libs=
  1724. AC_MSG_CHECKING(for extra libs)
  1725. AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]),
  1726. kde_use_extra_libs=$withval,
  1727. kde_use_extra_libs=NONE
  1728. )
  1729. if test -n "$kde_use_extra_libs" && \
  1730. test "$kde_use_extra_libs" != "NONE"; then
  1731. ac_save_ifs=$IFS
  1732. IFS=':'
  1733. for dir in $kde_use_extra_libs; do
  1734. kde_extra_libs="$kde_extra_libs $dir"
  1735. KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
  1736. USER_LDFLAGS="$USER_LDFLAGS -L$dir"
  1737. done
  1738. IFS=$ac_save_ifs
  1739. kde_use_extra_libs="added"
  1740. else
  1741. kde_use_extra_libs="no"
  1742. fi
  1743. AC_SUBST(USER_LDFLAGS)
  1744. AC_MSG_RESULT($kde_use_extra_libs)
  1745. ])
  1746. AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
  1747. [
  1748. AC_MSG_CHECKING([for KDE headers installed])
  1749. AC_LANG_SAVE
  1750. AC_LANG_CPLUSPLUS
  1751. cat > conftest.$ac_ext <<EOF
  1752. #ifdef STDC_HEADERS
  1753. # include <stdlib.h>
  1754. #endif
  1755. #include <stdio.h>
  1756. #include "confdefs.h"
  1757. #include <kapp.h>
  1758. int main() {
  1759. printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
  1760. printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
  1761. printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
  1762. printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
  1763. printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
  1764. printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
  1765. printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
  1766. printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
  1767. printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
  1768. printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
  1769. printf("kde_wallpaperdir=\\"%s\\"\n",
  1770. KApplication::kde_wallpaperdir().data());
  1771. printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
  1772. printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
  1773. printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
  1774. printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
  1775. printf("kde_moduledir=\\"/tmp/dummy\\"\n");
  1776. printf("kde_styledir=\\"/tmp/dummy\\"\n");
  1777. printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
  1778. printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
  1779. printf("xdg_menudir=\\"/tmp/dummy\\"\n");
  1780. printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
  1781. printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
  1782. return 0;
  1783. }
  1784. EOF
  1785. ac_save_CPPFLAGS=$CPPFLAGS
  1786. CPPFLAGS="$all_includes $CPPFLAGS"
  1787. if AC_TRY_EVAL(ac_compile); then
  1788. AC_MSG_RESULT(yes)
  1789. else
  1790. AC_MSG_ERROR([your system is not able to compile a small KDE application!
  1791. Check, if you installed the KDE header files correctly.
  1792. For more details about this problem, look at the end of config.log.])
  1793. fi
  1794. CPPFLAGS=$ac_save_CPPFLAGS
  1795. AC_LANG_RESTORE
  1796. ])
  1797. AC_DEFUN([KDE_CHECK_KDEQTADDON],
  1798. [
  1799. AC_MSG_CHECKING(for kde-qt-addon)
  1800. AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
  1801. [
  1802. kde_ldflags_safe="$LDFLAGS"
  1803. kde_libs_safe="$LIBS"
  1804. kde_cxxflags_safe="$CXXFLAGS"
  1805. LIBS="-lkde-qt-addon $LIBQT $LIBS"
  1806. CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
  1807. LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
  1808. AC_TRY_LINK([
  1809. #include <qdom.h>
  1810. ],
  1811. [
  1812. QDomDocument doc;
  1813. ],
  1814. kde_cv_have_kdeqtaddon=yes,
  1815. kde_cv_have_kdeqtaddon=no
  1816. )
  1817. LDFLAGS=$kde_ldflags_safe
  1818. LIBS=$kde_libs_safe
  1819. CXXFLAGS=$kde_cxxflags_safe
  1820. ])
  1821. AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
  1822. if test "$kde_cv_have_kdeqtaddon" = "no"; then
  1823. AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
  1824. It is a separate package (and CVS module) named kde-qt-addon.])
  1825. fi
  1826. ])
  1827. AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
  1828. [
  1829. AC_REQUIRE([KDE_MISC_TESTS])
  1830. AC_REQUIRE([KDE_CHECK_LIBDL])
  1831. AC_REQUIRE([K_PATH_X])
  1832. if test $kde_qtver = 3; then
  1833. case $host in
  1834. *cygwin*) lib_kded="-lkdeinit_kded" ;;
  1835. *) lib_kded="" ;;
  1836. esac
  1837. AC_SUBST(LIB_KDED, $lib_kded)
  1838. AC_SUBST(LIB_KDECORE, "-lkdecore")
  1839. AC_SUBST(LIB_KDEUI, "-lkdeui")
  1840. AC_SUBST(LIB_KIO, "-lkio")
  1841. AC_SUBST(LIB_KJS, "-lkjs")
  1842. AC_SUBST(LIB_SMB, "-lsmb")
  1843. AC_SUBST(LIB_KAB, "-lkab")
  1844. AC_SUBST(LIB_KABC, "-lkabc")
  1845. AC_SUBST(LIB_KHTML, "-lkhtml")
  1846. AC_SUBST(LIB_KSPELL, "-lkspell")
  1847. AC_SUBST(LIB_KPARTS, "-lkparts")
  1848. AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
  1849. AC_SUBST(LIB_KUTILS, "-lkutils")
  1850. AC_SUBST(LIB_KDEPIM, "-lkdepim")
  1851. AC_SUBST(LIB_KIMPROXY, "-lkimproxy")
  1852. AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff")
  1853. AC_SUBST(LIB_KDNSSD, "-lkdnssd")
  1854. AC_SUBST(LIB_KUNITTEST, "-lkunittest")
  1855. # these are for backward compatibility
  1856. AC_SUBST(LIB_KSYCOCA, "-lkio")
  1857. AC_SUBST(LIB_KFILE, "-lkio")
  1858. elif test $kde_qtver = 2; then
  1859. AC_SUBST(LIB_KDECORE, "-lkdecore")
  1860. AC_SUBST(LIB_KDEUI, "-lkdeui")
  1861. AC_SUBST(LIB_KIO, "-lkio")
  1862. AC_SUBST(LIB_KSYCOCA, "-lksycoca")
  1863. AC_SUBST(LIB_SMB, "-lsmb")
  1864. AC_SUBST(LIB_KFILE, "-lkfile")
  1865. AC_SUBST(LIB_KAB, "-lkab")
  1866. AC_SUBST(LIB_KHTML, "-lkhtml")
  1867. AC_SUBST(LIB_KSPELL, "-lkspell")
  1868. AC_SUBST(LIB_KPARTS, "-lkparts")
  1869. AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
  1870. else
  1871. AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)")
  1872. AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)")
  1873. AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)")
  1874. AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)")
  1875. AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")
  1876. fi
  1877. ])
  1878. AC_DEFUN([AC_PATH_KDE],
  1879. [
  1880. AC_BASE_PATH_KDE
  1881. AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]),
  1882. [
  1883. if test "$enableval" = "no";
  1884. then ac_use_path_checking="default"
  1885. else ac_use_path_checking=""
  1886. fi
  1887. ],
  1888. [
  1889. if test "$kde_qtver" = 1;
  1890. then ac_use_path_checking=""
  1891. else ac_use_path_checking="default"
  1892. fi
  1893. ]
  1894. )
  1895. AC_CREATE_KFSSTND($ac_use_path_checking)
  1896. AC_SUBST_KFSSTND
  1897. KDE_CREATE_LIBS_ALIASES
  1898. ])
  1899. dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
  1900. AC_DEFUN([KDE_CHECK_FUNC_EXT],
  1901. [
  1902. AC_MSG_CHECKING(for $1)
  1903. AC_CACHE_VAL(kde_cv_func_$1,
  1904. [
  1905. AC_LANG_SAVE
  1906. AC_LANG_CPLUSPLUS
  1907. save_CXXFLAGS="$CXXFLAGS"
  1908. kde_safe_LIBS="$LIBS"
  1909. LIBS="$LIBS $X_EXTRA_LIBS"
  1910. if test "$GXX" = "yes"; then
  1911. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  1912. fi
  1913. AC_TRY_COMPILE([
  1914. $2
  1915. ],
  1916. [
  1917. $3
  1918. ],
  1919. kde_cv_func_$1=yes,
  1920. kde_cv_func_$1=no)
  1921. CXXFLAGS="$save_CXXFLAGS"
  1922. LIBS="$kde_safe_LIBS"
  1923. AC_LANG_RESTORE
  1924. ])
  1925. AC_MSG_RESULT($kde_cv_func_$1)
  1926. AC_MSG_CHECKING([if $1 needs custom prototype])
  1927. AC_CACHE_VAL(kde_cv_proto_$1,
  1928. [
  1929. if test "x$kde_cv_func_$1" = xyes; then
  1930. kde_cv_proto_$1=no
  1931. else
  1932. case "$1" in
  1933. setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
  1934. kde_cv_proto_$1="yes - in libkdefakes"
  1935. ;;
  1936. *)
  1937. kde_cv_proto_$1=unknown
  1938. ;;
  1939. esac
  1940. fi
  1941. if test "x$kde_cv_proto_$1" = xunknown; then
  1942. AC_LANG_SAVE
  1943. AC_LANG_CPLUSPLUS
  1944. kde_safe_libs=$LIBS
  1945. LIBS="$LIBS $X_EXTRA_LIBS"
  1946. AC_TRY_LINK([
  1947. $2
  1948. extern "C" $4;
  1949. ],
  1950. [
  1951. $3
  1952. ],
  1953. [ kde_cv_func_$1=yes
  1954. kde_cv_proto_$1=yes ],
  1955. [kde_cv_proto_$1="$1 unavailable"]
  1956. )
  1957. LIBS=$kde_safe_libs
  1958. AC_LANG_RESTORE
  1959. fi
  1960. ])
  1961. AC_MSG_RESULT($kde_cv_proto_$1)
  1962. if test "x$kde_cv_func_$1" = xyes; then
  1963. AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
  1964. $6
  1965. fi
  1966. if test "x$kde_cv_proto_$1" = xno; then
  1967. AC_DEFINE(HAVE_$5_PROTO, 1,
  1968. [Define if you have the $1 prototype])
  1969. fi
  1970. AH_VERBATIM([_HAVE_$5_PROTO],
  1971. [
  1972. #if !defined(HAVE_$5_PROTO)
  1973. #ifdef __cplusplus
  1974. extern "C" {
  1975. #endif
  1976. $4;
  1977. #ifdef __cplusplus
  1978. }
  1979. #endif
  1980. #endif
  1981. ])
  1982. ])
  1983. AC_DEFUN([AC_CHECK_SETENV],
  1984. [
  1985. KDE_CHECK_FUNC_EXT(setenv, [
  1986. #include <stdlib.h>
  1987. ],
  1988. [setenv("VAR", "VALUE", 1);],
  1989. [int setenv (const char *, const char *, int)],
  1990. [SETENV])
  1991. ])
  1992. AC_DEFUN([AC_CHECK_UNSETENV],
  1993. [
  1994. KDE_CHECK_FUNC_EXT(unsetenv, [
  1995. #include <stdlib.h>
  1996. ],
  1997. [unsetenv("VAR");],
  1998. [void unsetenv (const char *)],
  1999. [UNSETENV])
  2000. ])
  2001. AC_DEFUN([AC_CHECK_GETDOMAINNAME],
  2002. [
  2003. KDE_CHECK_FUNC_EXT(getdomainname, [
  2004. #include <stdlib.h>
  2005. #include <unistd.h>
  2006. #include <netdb.h>
  2007. ],
  2008. [
  2009. char buffer[200];
  2010. getdomainname(buffer, 200);
  2011. ],
  2012. [#include <sys/types.h>
  2013. int getdomainname (char *, size_t)],
  2014. [GETDOMAINNAME])
  2015. ])
  2016. AC_DEFUN([AC_CHECK_GETHOSTNAME],
  2017. [
  2018. KDE_CHECK_FUNC_EXT(gethostname, [
  2019. #include <stdlib.h>
  2020. #include <unistd.h>
  2021. ],
  2022. [
  2023. char buffer[200];
  2024. gethostname(buffer, 200);
  2025. ],
  2026. [int gethostname (char *, unsigned int)],
  2027. [GETHOSTNAME])
  2028. ])
  2029. AC_DEFUN([AC_CHECK_USLEEP],
  2030. [
  2031. KDE_CHECK_FUNC_EXT(usleep, [
  2032. #include <unistd.h>
  2033. ],
  2034. [
  2035. usleep(200);
  2036. ],
  2037. [int usleep (unsigned int)],
  2038. [USLEEP])
  2039. ])
  2040. AC_DEFUN([AC_CHECK_RANDOM],
  2041. [
  2042. KDE_CHECK_FUNC_EXT(random, [
  2043. #include <stdlib.h>
  2044. ],
  2045. [
  2046. random();
  2047. ],
  2048. [long int random(void)],
  2049. [RANDOM])
  2050. KDE_CHECK_FUNC_EXT(srandom, [
  2051. #include <stdlib.h>
  2052. ],
  2053. [
  2054. srandom(27);
  2055. ],
  2056. [void srandom(unsigned int)],
  2057. [SRANDOM])
  2058. ])
  2059. AC_DEFUN([AC_CHECK_INITGROUPS],
  2060. [
  2061. KDE_CHECK_FUNC_EXT(initgroups, [
  2062. #include <sys/types.h>
  2063. #include <unistd.h>
  2064. #include <grp.h>
  2065. ],
  2066. [
  2067. char buffer[200];
  2068. initgroups(buffer, 27);
  2069. ],
  2070. [int initgroups(const char *, gid_t)],
  2071. [INITGROUPS])
  2072. ])
  2073. AC_DEFUN([AC_CHECK_MKSTEMPS],
  2074. [
  2075. KDE_CHECK_FUNC_EXT(mkstemps, [
  2076. #include <stdlib.h>
  2077. #include <unistd.h>
  2078. ],
  2079. [
  2080. mkstemps("/tmp/aaaXXXXXX", 6);
  2081. ],
  2082. [int mkstemps(char *, int)],
  2083. [MKSTEMPS])
  2084. ])
  2085. AC_DEFUN([AC_CHECK_MKSTEMP],
  2086. [
  2087. KDE_CHECK_FUNC_EXT(mkstemp, [
  2088. #include <stdlib.h>
  2089. #include <unistd.h>
  2090. ],
  2091. [
  2092. mkstemp("/tmp/aaaXXXXXX");
  2093. ],
  2094. [int mkstemp(char *)],
  2095. [MKSTEMP])
  2096. ])
  2097. AC_DEFUN([AC_CHECK_MKDTEMP],
  2098. [
  2099. KDE_CHECK_FUNC_EXT(mkdtemp, [
  2100. #include <stdlib.h>
  2101. #include <unistd.h>
  2102. ],
  2103. [
  2104. mkdtemp("/tmp/aaaXXXXXX");
  2105. ],
  2106. [char *mkdtemp(char *)],
  2107. [MKDTEMP])
  2108. ])
  2109. AC_DEFUN([AC_CHECK_RES_INIT],
  2110. [
  2111. AC_MSG_CHECKING([if res_init needs -lresolv])
  2112. kde_libs_safe="$LIBS"
  2113. LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
  2114. AC_TRY_LINK(
  2115. [
  2116. #include <sys/types.h>
  2117. #include <netinet/in.h>
  2118. #include <arpa/nameser.h>
  2119. #include <resolv.h>
  2120. ],
  2121. [
  2122. res_init();
  2123. ],
  2124. [
  2125. LIBRESOLV="-lresolv"
  2126. AC_MSG_RESULT(yes)
  2127. AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
  2128. ],
  2129. [ AC_MSG_RESULT(no) ]
  2130. )
  2131. LIBS=$kde_libs_safe
  2132. AC_SUBST(LIBRESOLV)
  2133. KDE_CHECK_FUNC_EXT(res_init,
  2134. [
  2135. #include <sys/types.h>
  2136. #include <netinet/in.h>
  2137. #include <arpa/nameser.h>
  2138. #include <resolv.h>
  2139. ],
  2140. [res_init()],
  2141. [int res_init(void)],
  2142. [RES_INIT])
  2143. ])
  2144. AC_DEFUN([AC_CHECK_STRLCPY],
  2145. [
  2146. KDE_CHECK_FUNC_EXT(strlcpy, [
  2147. #include <string.h>
  2148. ],
  2149. [ char buf[20];
  2150. strlcpy(buf, "KDE function test", sizeof(buf));
  2151. ],
  2152. [unsigned long strlcpy(char*, const char*, unsigned long)],
  2153. [STRLCPY])
  2154. ])
  2155. AC_DEFUN([AC_CHECK_STRLCAT],
  2156. [
  2157. KDE_CHECK_FUNC_EXT(strlcat, [
  2158. #include <string.h>
  2159. ],
  2160. [ char buf[20];
  2161. buf[0]='\0';
  2162. strlcat(buf, "KDE function test", sizeof(buf));
  2163. ],
  2164. [unsigned long strlcat(char*, const char*, unsigned long)],
  2165. [STRLCAT])
  2166. ])
  2167. AC_DEFUN([AC_CHECK_RES_QUERY],
  2168. [
  2169. KDE_CHECK_FUNC_EXT(res_query, [
  2170. #include <sys/types.h>
  2171. #include <netinet/in.h>
  2172. #include <arpa/nameser.h>
  2173. #include <resolv.h>
  2174. #include <netdb.h>
  2175. ],
  2176. [
  2177. res_query(NULL, 0, 0, NULL, 0);
  2178. ],
  2179. [int res_query(const char *, int, int, unsigned char *, int)],
  2180. [RES_QUERY])
  2181. ])
  2182. AC_DEFUN([AC_CHECK_DN_SKIPNAME],
  2183. [
  2184. KDE_CHECK_FUNC_EXT(dn_skipname, [
  2185. #include <sys/types.h>
  2186. #include <netinet/in.h>
  2187. #include <arpa/nameser.h>
  2188. #include <resolv.h>
  2189. ],
  2190. [
  2191. dn_skipname (NULL, NULL);
  2192. ],
  2193. [int dn_skipname (unsigned char *, unsigned char *)],
  2194. [DN_SKIPNAME])
  2195. ])
  2196. AC_DEFUN([AC_FIND_GIF],
  2197. [AC_MSG_CHECKING([for giflib])
  2198. AC_CACHE_VAL(ac_cv_lib_gif,
  2199. [ac_save_LIBS="$LIBS"
  2200. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2201. LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
  2202. else
  2203. LIBS="$all_libraries -lgif"
  2204. fi
  2205. AC_TRY_LINK(dnl
  2206. [
  2207. #ifdef __cplusplus
  2208. extern "C" {
  2209. #endif
  2210. int GifLastError(void);
  2211. #ifdef __cplusplus
  2212. }
  2213. #endif
  2214. /* We use char because int might match the return type of a gcc2
  2215. builtin and then its argument prototype would still apply. */
  2216. ],
  2217. [return GifLastError();],
  2218. eval "ac_cv_lib_gif=yes",
  2219. eval "ac_cv_lib_gif=no")
  2220. LIBS="$ac_save_LIBS"
  2221. ])dnl
  2222. if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
  2223. AC_MSG_RESULT(yes)
  2224. AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
  2225. else
  2226. AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
  2227. fi
  2228. ])
  2229. AC_DEFUN([KDE_FIND_JPEG_HELPER],
  2230. [
  2231. AC_MSG_CHECKING([for libjpeg$2])
  2232. AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
  2233. [
  2234. ac_save_LIBS="$LIBS"
  2235. LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
  2236. ac_save_CFLAGS="$CFLAGS"
  2237. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2238. AC_TRY_LINK(
  2239. [
  2240. #ifdef __cplusplus
  2241. extern "C" {
  2242. #endif
  2243. void jpeg_CreateDecompress();
  2244. #ifdef __cplusplus
  2245. }
  2246. #endif
  2247. ],
  2248. [jpeg_CreateDecompress();],
  2249. eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
  2250. eval "ac_cv_lib_jpeg_$1=no")
  2251. LIBS="$ac_save_LIBS"
  2252. CFLAGS="$ac_save_CFLAGS"
  2253. ])
  2254. if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
  2255. LIBJPEG="$ac_cv_lib_jpeg_$1"
  2256. AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
  2257. else
  2258. AC_MSG_RESULT(no)
  2259. $3
  2260. fi
  2261. ])
  2262. AC_DEFUN([AC_FIND_JPEG],
  2263. [
  2264. dnl first look for libraries
  2265. KDE_FIND_JPEG_HELPER(6b, 6b,
  2266. KDE_FIND_JPEG_HELPER(normal, [],
  2267. [
  2268. LIBJPEG=
  2269. ]
  2270. )
  2271. )
  2272. dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
  2273. dnl requires system dependent includes loaded before it)
  2274. jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
  2275. AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
  2276. test "x$jpeg_incdir" = xNO && jpeg_incdir=
  2277. dnl if headers _and_ libraries are missing, this is no error, and we
  2278. dnl continue with a warning (the user will get no jpeg support in khtml)
  2279. dnl if only one is missing, it means a configuration error, but we still
  2280. dnl only warn
  2281. if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
  2282. AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
  2283. else
  2284. if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
  2285. AC_MSG_WARN([
  2286. There is an installation error in jpeg support. You seem to have only one
  2287. of either the headers _or_ the libraries installed. You may need to either
  2288. provide correct --with-extra-... options, or the development package of
  2289. libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
  2290. Disabling JPEG support.
  2291. ])
  2292. else
  2293. AC_MSG_WARN([libjpeg not found. disable JPEG support.])
  2294. fi
  2295. jpeg_incdir=
  2296. LIBJPEG=
  2297. fi
  2298. AC_SUBST(LIBJPEG)
  2299. AH_VERBATIM(_AC_CHECK_JPEG,
  2300. [/*
  2301. * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
  2302. * headers and I'm too lazy to write a configure test as long as only
  2303. * unixware is related
  2304. */
  2305. #ifdef _UNIXWARE
  2306. #define HAVE_BOOLEAN
  2307. #endif
  2308. ])
  2309. ])
  2310. AC_DEFUN([KDE_CHECK_QT_JPEG],
  2311. [
  2312. if test -n "$LIBJPEG"; then
  2313. AC_MSG_CHECKING([if Qt needs $LIBJPEG])
  2314. AC_CACHE_VAL(kde_cv_qt_jpeg,
  2315. [
  2316. AC_LANG_SAVE
  2317. AC_LANG_CPLUSPLUS
  2318. ac_save_LIBS="$LIBS"
  2319. LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
  2320. LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
  2321. ac_save_CXXFLAGS="$CXXFLAGS"
  2322. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  2323. AC_TRY_LINK(
  2324. [#include <qapplication.h>],
  2325. [
  2326. int argc;
  2327. char** argv;
  2328. QApplication app(argc, argv);],
  2329. eval "kde_cv_qt_jpeg=no",
  2330. eval "kde_cv_qt_jpeg=yes")
  2331. LIBS="$ac_save_LIBS"
  2332. CXXFLAGS="$ac_save_CXXFLAGS"
  2333. AC_LANG_RESTORE
  2334. fi
  2335. ])
  2336. if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
  2337. AC_MSG_RESULT(yes)
  2338. LIBJPEG_QT='$(LIBJPEG)'
  2339. else
  2340. AC_MSG_RESULT(no)
  2341. LIBJPEG_QT=
  2342. fi
  2343. ])
  2344. AC_DEFUN([AC_FIND_ZLIB],
  2345. [
  2346. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2347. AC_MSG_CHECKING([for libz])
  2348. AC_CACHE_VAL(ac_cv_lib_z,
  2349. [
  2350. kde_save_LIBS="$LIBS"
  2351. LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
  2352. kde_save_CFLAGS="$CFLAGS"
  2353. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2354. AC_TRY_LINK(dnl
  2355. [
  2356. #include<zlib.h>
  2357. #include<string.h>
  2358. ],
  2359. [
  2360. char buf[42];
  2361. gzFile f = (gzFile) 0;
  2362. /* this would segfault.. but we only link, don't run */
  2363. (void) gzgets(f, buf, sizeof(buf));
  2364. return (strcmp(zlibVersion(), ZLIB_VERSION) == 0);
  2365. ],
  2366. eval "ac_cv_lib_z='-lz'",
  2367. eval "ac_cv_lib_z=no")
  2368. LIBS="$kde_save_LIBS"
  2369. CFLAGS="$kde_save_CFLAGS"
  2370. ])dnl
  2371. if test ! "$ac_cv_lib_z" = no; then
  2372. AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
  2373. LIBZ="$ac_cv_lib_z"
  2374. AC_MSG_RESULT($ac_cv_lib_z)
  2375. else
  2376. AC_MSG_ERROR(not found.
  2377. Possibly configure picks up an outdated version
  2378. installed by XFree86. Remove it from your system.
  2379. Check your installation and look into config.log)
  2380. LIBZ=""
  2381. fi
  2382. AC_SUBST(LIBZ)
  2383. ])
  2384. AC_DEFUN([KDE_TRY_TIFFLIB],
  2385. [
  2386. AC_MSG_CHECKING([for libtiff $1])
  2387. AC_CACHE_VAL(kde_cv_libtiff_$1,
  2388. [
  2389. AC_LANG_SAVE
  2390. AC_LANG_CPLUSPLUS
  2391. kde_save_LIBS="$LIBS"
  2392. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2393. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
  2394. else
  2395. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
  2396. fi
  2397. kde_save_CXXFLAGS="$CXXFLAGS"
  2398. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  2399. AC_TRY_LINK(dnl
  2400. [
  2401. #include<tiffio.h>
  2402. ],
  2403. [return (TIFFOpen( "", "r") == 0); ],
  2404. [
  2405. kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
  2406. ], [
  2407. kde_cv_libtiff_$1=no
  2408. ])
  2409. LIBS="$kde_save_LIBS"
  2410. CXXFLAGS="$kde_save_CXXFLAGS"
  2411. AC_LANG_RESTORE
  2412. ])
  2413. if test "$kde_cv_libtiff_$1" = "no"; then
  2414. AC_MSG_RESULT(no)
  2415. LIBTIFF=""
  2416. $3
  2417. else
  2418. LIBTIFF="$kde_cv_libtiff_$1"
  2419. AC_MSG_RESULT(yes)
  2420. AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
  2421. $2
  2422. fi
  2423. ])
  2424. AC_DEFUN([AC_FIND_TIFF],
  2425. [
  2426. AC_REQUIRE([K_PATH_X])
  2427. AC_REQUIRE([AC_FIND_ZLIB])
  2428. AC_REQUIRE([AC_FIND_JPEG])
  2429. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2430. KDE_TRY_TIFFLIB(tiff, [],
  2431. KDE_TRY_TIFFLIB(tiff34))
  2432. AC_SUBST(LIBTIFF)
  2433. ])
  2434. AC_DEFUN([KDE_FIND_LIBEXR],
  2435. [
  2436. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2437. AC_REQUIRE([AC_FIND_ZLIB])
  2438. AC_CACHE_VAL(ac_cv_libexr,
  2439. [
  2440. if test -z "$PKG_CONFIG"; then
  2441. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2442. fi
  2443. AC_MSG_CHECKING([for OpenEXR libraries])
  2444. if test "$PKG_CONFIG" = "no" ; then
  2445. AC_MSG_RESULT(no)
  2446. echo "*** The pkg-config script could not be found. Make sure it is"
  2447. echo "*** in your path, or set the PKG_CONFIG environment variable"
  2448. echo "*** to the full path to pkg-config."
  2449. echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
  2450. else
  2451. if ! $PKG_CONFIG --exists OpenEXR ; then
  2452. AC_MSG_RESULT(no)
  2453. EXRSTATUS=no
  2454. else
  2455. if ! $PKG_CONFIG --atleast-version="1.1.1" OpenEXR ; then
  2456. AC_MSG_RESULT(no)
  2457. EXRSTATUS=old
  2458. else
  2459. kde_save_LIBS="$LIBS"
  2460. LIBS="$LIBS $all_libraries $USER_LDFLAGS `pkg-config --libs OpenEXR` $LIBZ"
  2461. AC_LANG_SAVE
  2462. AC_LANG_CPLUSPLUS
  2463. kde_save_CXXFLAGS="$CXXFLAGS"
  2464. EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR`
  2465. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS"
  2466. AC_TRY_LINK(dnl
  2467. [
  2468. #include <ImfRgbaFile.h>
  2469. ],
  2470. [
  2471. using namespace Imf;
  2472. RgbaInputFile file ("dummy");
  2473. return 0;
  2474. ],
  2475. eval "ac_cv_libexr='`pkg-config --libs OpenEXR`'",
  2476. eval "ac_cv_libexr=no"
  2477. )
  2478. LIBS="$kde_save_LIBS"
  2479. CXXFLAGS="$kde_save_CXXFLAGS"
  2480. AC_LANG_RESTORE
  2481. ])dnl
  2482. if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then
  2483. AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR])
  2484. LIB_EXR="$ac_cv_libexr"
  2485. AC_MSG_RESULT($ac_cv_libexr)
  2486. else
  2487. AC_MSG_RESULT(no)
  2488. LIB_EXR=""
  2489. fi
  2490. fi
  2491. fi
  2492. fi
  2493. AC_SUBST(LIB_EXR)
  2494. AC_SUBST(EXR_FLAGS)
  2495. ])
  2496. AC_DEFUN([AC_FIND_PNG],
  2497. [
  2498. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2499. AC_REQUIRE([AC_FIND_ZLIB])
  2500. AC_MSG_CHECKING([for libpng])
  2501. AC_CACHE_VAL(ac_cv_lib_png,
  2502. [
  2503. kde_save_LIBS="$LIBS"
  2504. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2505. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
  2506. else
  2507. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
  2508. fi
  2509. kde_save_CFLAGS="$CFLAGS"
  2510. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2511. AC_TRY_LINK(dnl
  2512. [
  2513. #include<png.h>
  2514. ],
  2515. [
  2516. png_structp png_ptr = png_create_read_struct( /* image ptr */
  2517. PNG_LIBPNG_VER_STRING, 0, 0, 0 );
  2518. return( png_ptr != 0 );
  2519. ],
  2520. eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
  2521. eval "ac_cv_lib_png=no"
  2522. )
  2523. LIBS="$kde_save_LIBS"
  2524. CFLAGS="$kde_save_CFLAGS"
  2525. ])dnl
  2526. if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
  2527. AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
  2528. LIBPNG="$ac_cv_lib_png"
  2529. AC_SUBST(LIBPNG)
  2530. AC_MSG_RESULT($ac_cv_lib_png)
  2531. else
  2532. AC_MSG_RESULT(no)
  2533. LIBPNG=""
  2534. AC_SUBST(LIBPNG)
  2535. fi
  2536. ])
  2537. AC_DEFUN([AC_FIND_JASPER],
  2538. [
  2539. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2540. AC_REQUIRE([AC_FIND_JPEG])
  2541. AC_MSG_CHECKING([for jasper])
  2542. AC_CACHE_VAL(ac_cv_jasper,
  2543. [
  2544. kde_save_LIBS="$LIBS"
  2545. LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
  2546. kde_save_CFLAGS="$CFLAGS"
  2547. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2548. AC_TRY_LINK(dnl
  2549. [
  2550. #include<jasper/jasper.h>
  2551. ],
  2552. [
  2553. return( jas_init() );
  2554. ],
  2555. eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
  2556. eval "ac_cv_jasper=no"
  2557. )
  2558. LIBS="$kde_save_LIBS"
  2559. CFLAGS="$kde_save_CFLAGS"
  2560. ])dnl
  2561. if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
  2562. AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
  2563. LIB_JASPER="$ac_cv_jasper"
  2564. AC_MSG_RESULT($ac_cv_jasper)
  2565. else
  2566. AC_MSG_RESULT(no)
  2567. LIB_JASPER=""
  2568. fi
  2569. AC_SUBST(LIB_JASPER)
  2570. ])
  2571. AC_DEFUN([AC_CHECK_BOOL],
  2572. [
  2573. AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
  2574. ])
  2575. AC_DEFUN([AC_CHECK_GNU_EXTENSIONS],
  2576. [
  2577. AC_MSG_CHECKING(if you need GNU extensions)
  2578. AC_CACHE_VAL(ac_cv_gnu_extensions,
  2579. [
  2580. cat > conftest.c << EOF
  2581. #include <features.h>
  2582. #ifdef __GNU_LIBRARY__
  2583. yes
  2584. #endif
  2585. EOF
  2586. if (eval "$ac_cpp conftest.c") 2>&5 |
  2587. egrep "yes" >/dev/null 2>&1; then
  2588. rm -rf conftest*
  2589. ac_cv_gnu_extensions=yes
  2590. else
  2591. ac_cv_gnu_extensions=no
  2592. fi
  2593. ])
  2594. AC_MSG_RESULT($ac_cv_gnu_extensions)
  2595. if test "$ac_cv_gnu_extensions" = "yes"; then
  2596. AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
  2597. fi
  2598. ])
  2599. AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
  2600. [
  2601. AC_MSG_CHECKING([whether $CXX supports -$1])
  2602. kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
  2603. AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
  2604. [
  2605. AC_LANG_SAVE
  2606. AC_LANG_CPLUSPLUS
  2607. save_CXXFLAGS="$CXXFLAGS"
  2608. CXXFLAGS="$CXXFLAGS -$1"
  2609. AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
  2610. CXXFLAGS="$save_CXXFLAGS"
  2611. AC_LANG_RESTORE
  2612. ])
  2613. if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
  2614. AC_MSG_RESULT(yes)
  2615. :
  2616. $2
  2617. else
  2618. AC_MSG_RESULT(no)
  2619. :
  2620. $3
  2621. fi
  2622. ])
  2623. AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG],
  2624. [
  2625. AC_MSG_CHECKING([whether $CC supports -$1])
  2626. kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
  2627. AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache,
  2628. [
  2629. AC_LANG_SAVE
  2630. AC_LANG_C
  2631. save_CFLAGS="$CFLAGS"
  2632. CFLAGS="$CFLAGS -$1"
  2633. AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], [])
  2634. CFLAGS="$save_CFLAGS"
  2635. AC_LANG_RESTORE
  2636. ])
  2637. if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then
  2638. AC_MSG_RESULT(yes)
  2639. :
  2640. $2
  2641. else
  2642. AC_MSG_RESULT(no)
  2643. :
  2644. $3
  2645. fi
  2646. ])
  2647. dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
  2648. dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
  2649. dnl it's all white-space separated
  2650. AC_DEFUN([AC_REMOVE_FORBIDDEN],
  2651. [ __val=$$1
  2652. __forbid=" $2 "
  2653. if test -n "$__val"; then
  2654. __new=""
  2655. ac_save_IFS=$IFS
  2656. IFS=" "
  2657. for i in $__val; do
  2658. case "$__forbid" in
  2659. *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
  2660. *) # Careful to not add spaces, where there were none, because otherwise
  2661. # libtool gets confused, if we change e.g. CXX
  2662. if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
  2663. esac
  2664. done
  2665. IFS=$ac_save_IFS
  2666. $1=$__new
  2667. fi
  2668. ])
  2669. AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER],
  2670. [
  2671. AC_MSG_CHECKING([whether $CC is blacklisted])
  2672. dnl In theory we have tu run this test against $CC and $CXX
  2673. dnl in C and in C++ mode, because its perfectly legal for
  2674. dnl the user to mix compiler versions, since C has a defined
  2675. dnl ABI.
  2676. dnl
  2677. dnl For now, we assume the user is not on crack.
  2678. AC_TRY_COMPILE([
  2679. #ifdef __GNUC__
  2680. #if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0
  2681. choke me
  2682. #endif
  2683. #endif
  2684. ], ,
  2685. kde_bad_compiler=no,
  2686. kde_bad_compiler=yes
  2687. )
  2688. AC_MSG_RESULT($kde_bad_compiler)
  2689. if test "$kde_bad_compiler" = "yes"; then
  2690. AC_MSG_ERROR([
  2691. This particular compiler version is blacklisted because it
  2692. is known to miscompile KDE. Please use a newer version, or
  2693. if that is not yet available, choose an older version.
  2694. Please do not report a bug or bother us reporting this
  2695. configure error. We know about it, and we introduced
  2696. it by intention to avoid untraceable bugs or crashes in KDE.
  2697. ])
  2698. fi
  2699. ])
  2700. AC_DEFUN([KDE_CHECK_FOR_OPT_NOINLINE_MATCH],
  2701. [
  2702. AC_CACHE_CHECK([whether system headers can cope with -O2 -fno-inline],
  2703. kde_cv_opt_noinline_match,
  2704. [
  2705. kde_cv_opt_noinline_match=irrelevant
  2706. dnl if we don't use both -O2 and -fno-inline, this check is moot
  2707. if echo "$CFLAGS" | grep -e -O2 >/dev/null 2>/dev/null \
  2708. && echo "$CFLAGS" | grep -e -fno-inline >/dev/null 2>/dev/null ; then
  2709. ac_cflags_save="$CFLAGS"
  2710. CFLAGS="$CFLAGS -D_USE_GNU"
  2711. AC_TRY_LINK([
  2712. #include <string.h>
  2713. ], [ const char *pt, *et;
  2714. 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 , ";," )); }) ;
  2715. ],
  2716. kde_cv_opt_noinline_match=yes,
  2717. kde_cv_opt_noinline_match=no
  2718. )
  2719. CFLAGS="$ac_cflags_save"
  2720. fi
  2721. ])
  2722. ])
  2723. dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
  2724. AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
  2725. [dnl
  2726. if test "x$kde_use_qt_emb" != "xyes"; then
  2727. AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
  2728. AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
  2729. else
  2730. AC_REMOVE_FORBIDDEN(CXX, [-rpath])
  2731. AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
  2732. fi
  2733. ])
  2734. AC_DEFUN([AC_CHECK_COMPILERS],
  2735. [
  2736. AC_ARG_ENABLE(debug,
  2737. AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]),
  2738. [
  2739. case $enableval in
  2740. yes)
  2741. kde_use_debug_code="yes"
  2742. kde_use_debug_define=no
  2743. ;;
  2744. full)
  2745. kde_use_debug_code="full"
  2746. kde_use_debug_define=no
  2747. ;;
  2748. *)
  2749. kde_use_debug_code="no"
  2750. kde_use_debug_define=yes
  2751. ;;
  2752. esac
  2753. ],
  2754. [kde_use_debug_code="no"
  2755. kde_use_debug_define=no
  2756. ])
  2757. dnl Just for configure --help
  2758. AC_ARG_ENABLE(dummyoption,
  2759. AC_HELP_STRING([--disable-debug],
  2760. [disables debug output and debug symbols [default=no]]),
  2761. [],[])
  2762. AC_ARG_ENABLE(strict,
  2763. AC_HELP_STRING([--enable-strict],
  2764. [compiles with strict compiler options (may not work!)]),
  2765. [
  2766. if test $enableval = "no"; then
  2767. kde_use_strict_options="no"
  2768. else
  2769. kde_use_strict_options="yes"
  2770. fi
  2771. ], [kde_use_strict_options="no"])
  2772. AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]),
  2773. [
  2774. if test $enableval = "no"; then
  2775. kde_use_warnings="no"
  2776. else
  2777. kde_use_warnings="yes"
  2778. fi
  2779. ], [kde_use_warnings="yes"])
  2780. dnl enable warnings for debug build
  2781. if test "$kde_use_debug_code" != "no"; then
  2782. kde_use_warnings=yes
  2783. fi
  2784. AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]),
  2785. [kde_use_profiling=$enableval],
  2786. [kde_use_profiling="no"]
  2787. )
  2788. dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
  2789. CFLAGS=" $CFLAGS"
  2790. AC_PROG_CC
  2791. AC_PROG_CPP
  2792. if test "$GCC" = "yes"; then
  2793. if test "$kde_use_debug_code" != "no"; then
  2794. if test $kde_use_debug_code = "full"; then
  2795. CFLAGS="-g3 -fno-inline $CFLAGS"
  2796. else
  2797. CFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CFLAGS"
  2798. fi
  2799. else
  2800. CFLAGS="-O2 $CFLAGS"
  2801. fi
  2802. fi
  2803. if test "$kde_use_debug_define" = "yes"; then
  2804. CFLAGS="-DNDEBUG $CFLAGS"
  2805. fi
  2806. case "$host" in
  2807. *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
  2808. *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
  2809. esac
  2810. if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
  2811. LDFLAGS=""
  2812. fi
  2813. CXXFLAGS=" $CXXFLAGS"
  2814. AC_PROG_CXX
  2815. KDE_CHECK_FOR_BAD_COMPILER
  2816. if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
  2817. if test "$kde_use_debug_code" != "no"; then
  2818. if test "$CXX" = "KCC"; then
  2819. CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
  2820. else
  2821. if test "$kde_use_debug_code" = "full"; then
  2822. CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
  2823. else
  2824. CXXFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CXXFLAGS"
  2825. fi
  2826. fi
  2827. KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
  2828. dnl convenience compiler flags
  2829. KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
  2830. AC_SUBST(WOVERLOADED_VIRTUAL)
  2831. else
  2832. if test "$CXX" = "KCC"; then
  2833. CXXFLAGS="+K3 $CXXFLAGS"
  2834. else
  2835. CXXFLAGS="-O2 $CXXFLAGS"
  2836. fi
  2837. fi
  2838. fi
  2839. if test "$kde_use_debug_define" = "yes"; then
  2840. CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
  2841. fi
  2842. if test "$kde_use_profiling" = "yes"; then
  2843. KDE_CHECK_COMPILER_FLAG(pg,
  2844. [
  2845. CFLAGS="-pg $CFLAGS"
  2846. CXXFLAGS="-pg $CXXFLAGS"
  2847. ])
  2848. fi
  2849. if test "$kde_use_warnings" = "yes"; then
  2850. if test "$GCC" = "yes"; then
  2851. CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS"
  2852. case $host in
  2853. *-*-linux-gnu)
  2854. CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
  2855. CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts $CXXFLAGS"
  2856. KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
  2857. KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
  2858. ;;
  2859. esac
  2860. KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
  2861. KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
  2862. dnl ### FIXME: revert for KDE 4
  2863. KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"])
  2864. fi
  2865. fi
  2866. if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
  2867. CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
  2868. fi
  2869. AC_ARG_ENABLE(pch,
  2870. AC_HELP_STRING([--enable-pch],
  2871. [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]),
  2872. [ kde_use_pch=$enableval ],[ kde_use_pch=no ])
  2873. HAVE_GCC_VISIBILITY=0
  2874. AC_SUBST([HAVE_GCC_VISIBILITY])
  2875. if test "$GXX" = "yes"; then
  2876. gcc_no_reorder_blocks=NO
  2877. KDE_CHECK_COMPILER_FLAG(fno-reorder-blocks,[gcc_no_reorder_blocks=YES])
  2878. if test $kde_use_debug_code != "no" && \
  2879. test $kde_use_debug_code != "full" && \
  2880. test "YES" = "$gcc_no_reorder_blocks" ; then
  2881. CXXFLAGS="$CXXFLAGS -fno-reorder-blocks"
  2882. CFLAGS="$CFLAGS -fno-reorder-blocks"
  2883. fi
  2884. KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
  2885. KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
  2886. KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
  2887. KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= )
  2888. ENABLE_PERMISSIVE_FLAG="-fpermissive"
  2889. if test "$kde_use_pch" = "yes"; then
  2890. AC_MSG_CHECKING(whether gcc supports precompiling c header files)
  2891. echo >conftest.h
  2892. if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then
  2893. kde_gcc_supports_pch=yes
  2894. AC_MSG_RESULT(yes)
  2895. else
  2896. kde_gcc_supports_pch=no
  2897. AC_MSG_RESULT(no)
  2898. fi
  2899. if test "$kde_gcc_supports_pch" = "yes"; then
  2900. AC_MSG_CHECKING(whether gcc supports precompiling c++ header files)
  2901. if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then
  2902. kde_gcc_supports_pch=yes
  2903. AC_MSG_RESULT(yes)
  2904. else
  2905. kde_gcc_supports_pch=no
  2906. AC_MSG_RESULT(no)
  2907. fi
  2908. fi
  2909. rm -f conftest.h conftest.h.gch
  2910. fi
  2911. KDE_CHECK_FOR_OPT_NOINLINE_MATCH
  2912. if test "x$kde_cv_opt_noinline_match" = "xno" ; then
  2913. CFLAGS="`echo "$CFLAGS" | sed "s/ -fno-inline//"`"
  2914. fi
  2915. fi
  2916. AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes")
  2917. if test "$CXX" = "KCC"; then
  2918. dnl unfortunately we currently cannot disable exception support in KCC
  2919. dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
  2920. dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
  2921. dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= )
  2922. if test "$kde_use_pch" = "yes"; then
  2923. dnl TODO: support --pch-dir!
  2924. KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
  2925. dnl the below works (but the dir must exist), but it's
  2926. dnl useless for a whole package.
  2927. dnl The are precompiled headers for each source file, so when compiling
  2928. dnl from scratch, it doesn't make a difference, and they take up
  2929. dnl around ~5Mb _per_ sourcefile.
  2930. dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
  2931. dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
  2932. fi
  2933. dnl this flag controls inlining. by default KCC inlines in optimisation mode
  2934. dnl all implementations that are defined inside the class {} declaration.
  2935. dnl because of templates-compatibility with broken gcc compilers, this
  2936. dnl can cause excessive inlining. This flag limits it to a sane level
  2937. KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
  2938. KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
  2939. KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
  2940. KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
  2941. dnl Some source files are shared between multiple executables
  2942. dnl (or libraries) and some of those need template instantiations.
  2943. dnl In that case KCC needs to compile those sources with
  2944. dnl --one_instantiation_per_object. To make it easy for us we compile
  2945. dnl _all_ objects with that flag (--one_per is a shorthand).
  2946. KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
  2947. fi
  2948. AC_SUBST(USE_EXCEPTIONS)
  2949. dnl obsolete macro - provided to keep things going
  2950. USE_RTTI=
  2951. AC_SUBST(USE_RTTI)
  2952. case "$host" in
  2953. *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
  2954. *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
  2955. *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
  2956. *-*-solaris*)
  2957. if test "$GXX" = yes; then
  2958. libstdcpp=`$CXX -print-file-name=libstdc++.so`
  2959. if test ! -f $libstdcpp; then
  2960. 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])
  2961. fi
  2962. fi
  2963. ;;
  2964. esac
  2965. AC_VALIDIFY_CXXFLAGS
  2966. AC_PROG_CXXCPP
  2967. if test "$GCC" = yes; then
  2968. NOOPT_CFLAGS=-O0
  2969. fi
  2970. KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
  2971. AC_ARG_ENABLE(coverage,
  2972. AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [
  2973. if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then
  2974. ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
  2975. ac_coverage_linker="-lgcc"
  2976. elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then
  2977. ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
  2978. ac_coverage_linker=""
  2979. else
  2980. AC_MSG_ERROR([coverage with your compiler is not supported])
  2981. fi
  2982. CFLAGS="$CFLAGS $ac_coverage_compiler"
  2983. CXXFLAGS="$CXXFLAGS $ac_coverage_compiler"
  2984. LDFLAGS="$LDFLAGS $ac_coverage_linker"
  2985. ])
  2986. AC_SUBST(NOOPT_CXXFLAGS)
  2987. AC_SUBST(NOOPT_CFLAGS)
  2988. AC_SUBST(ENABLE_PERMISSIVE_FLAG)
  2989. KDE_CHECK_NEW_LDFLAGS
  2990. KDE_CHECK_FINAL
  2991. KDE_CHECK_CLOSURE
  2992. KDE_CHECK_NMCHECK
  2993. ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
  2994. ])
  2995. AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG],
  2996. [
  2997. AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug,
  2998. [
  2999. AC_LANG_SAVE
  3000. AC_LANG_CPLUSPLUS
  3001. safe_CXXFLAGS=$CXXFLAGS
  3002. safe_LDFLAGS=$LDFLAGS
  3003. CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0"
  3004. LDFLAGS="$LDFLAGS -shared -fPIC"
  3005. AC_TRY_LINK(
  3006. [
  3007. /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */
  3008. #include <string>
  3009. int some_function( void ) __attribute__ ((visibility("default")));
  3010. int some_function( void )
  3011. {
  3012. std::string s("blafasel");
  3013. return 0;
  3014. }
  3015. ], [/* elvis is alive */],
  3016. kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes)
  3017. CXXFLAGS=$safe_CXXFLAGS
  3018. LDFLAGS=$safe_LDFLAGS
  3019. AC_LANG_RESTORE
  3020. ]
  3021. )
  3022. if test x$kde_cv_val_gcc_visibility_bug = xno; then
  3023. CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
  3024. fi
  3025. ]
  3026. )
  3027. AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY],
  3028. [
  3029. AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
  3030. AC_MSG_CHECKING([grepping for visibility push/pop in headers])
  3031. if test "x$GXX" = "xyes"; then
  3032. AC_LANG_SAVE
  3033. AC_LANG_CPLUSPLUS
  3034. AC_EGREP_CPP(
  3035. [GCC visibility push],
  3036. [ #include <exception>
  3037. ],
  3038. [
  3039. AC_MSG_RESULT(yes)
  3040. kde_stdc_visibility_patched=yes ],
  3041. [
  3042. AC_MSG_RESULT(no)
  3043. AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for
  3044. visibility support. Disabling -fvisibility=hidden])
  3045. kde_stdc_visibility_patched=no ])
  3046. AC_LANG_RESTORE
  3047. kde_have_gcc_visibility=no
  3048. KDE_CHECK_COMPILER_FLAG(fvisibility=hidden,
  3049. [
  3050. kde_have_gcc_visibility=yes
  3051. dnl the whole toolchain is just a mess, gcc is just too buggy
  3052. dnl to handle STL with visibility enabled. Lets reconsider
  3053. dnl when gcc 4.2 is out or when things get fixed in the compiler.
  3054. dnl Contact mueller@kde.org for details.
  3055. AC_ARG_ENABLE(gcc-hidden-visibility,
  3056. AC_HELP_STRING([--enable-gcc-hidden-visibility],[toolchain hidden visibility [default=no]]),
  3057. [kde_have_gcc_visibility=$enableval],
  3058. [kde_have_gcc_visibility=no])
  3059. AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched,
  3060. [
  3061. AC_LANG_SAVE
  3062. AC_LANG_CPLUSPLUS
  3063. safe_CXXFLAGS=$CXXFLAGS
  3064. CXXFLAGS="$CXXFLAGS $all_includes"
  3065. AC_TRY_COMPILE(
  3066. [
  3067. #include <qglobal.h>
  3068. #if Q_EXPORT - 0 != 0
  3069. /* if this compiles, then Q_EXPORT is undefined */
  3070. /* if Q_EXPORT is nonempty, this will break compilation */
  3071. #endif
  3072. ], [/* elvis is alive */],
  3073. kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes)
  3074. CXXFLAGS=$safe_CXXFLAGS
  3075. AC_LANG_RESTORE
  3076. ]
  3077. )
  3078. 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
  3079. CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
  3080. KDE_CHECK_VISIBILITY_GCC_BUG
  3081. HAVE_GCC_VISIBILITY=1
  3082. AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
  3083. fi
  3084. ])
  3085. fi
  3086. ])
  3087. AC_DEFUN([KDE_ADD_DEPENDENCIES],
  3088. [
  3089. [A]M_DEPENDENCIES(CC)
  3090. [A]M_DEPENDENCIES(CXX)
  3091. ])
  3092. dnl just a wrapper to clean up configure.in
  3093. AC_DEFUN([KDE_PROG_LIBTOOL],
  3094. [
  3095. AC_REQUIRE([AC_CHECK_COMPILERS])
  3096. AC_REQUIRE([AC_ENABLE_SHARED])
  3097. AC_REQUIRE([AC_ENABLE_STATIC])
  3098. AC_REQUIRE([AC_LIBTOOL_DLOPEN])
  3099. AC_REQUIRE([KDE_CHECK_LIB64])
  3100. AC_OBJEXT
  3101. AC_EXEEXT
  3102. AM_PROG_LIBTOOL
  3103. AC_LIBTOOL_CXX
  3104. LIBTOOL_SHELL="/bin/sh ./libtool"
  3105. # LIBTOOL="$LIBTOOL --silent"
  3106. KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
  3107. AC_SUBST(KDE_PLUGIN)
  3108. # This hack ensures that libtool creates shared libs for kunittest plugins. By default check_LTLIBRARIES makes static libs.
  3109. KDE_CHECK_PLUGIN="\$(KDE_PLUGIN) -rpath \$(libdir)"
  3110. AC_SUBST(KDE_CHECK_PLUGIN)
  3111. # we patch configure quite some so we better keep that consistent for incremental runs
  3112. AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
  3113. ])
  3114. AC_DEFUN([KDE_CHECK_LIB64],
  3115. [
  3116. AC_ARG_ENABLE(libsuffix,
  3117. AC_HELP_STRING([--enable-libsuffix],
  3118. [/lib directory suffix (64,32,none,auto[=default])]),
  3119. kdelibsuff=$enableval, kdelibsuff="auto")
  3120. if test "$kdelibsuff" = "auto"; then
  3121. cat > conftest.c << EOF
  3122. #include <stdio.h>
  3123. int main() {
  3124. return 0;
  3125. }
  3126. EOF
  3127. kdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out |sed -ne '/libc.so/{
  3128. s,.*/lib\([[^\/]]*\)/.*,\1,
  3129. p
  3130. }'`
  3131. rm -rf conftest.*
  3132. fi
  3133. if test "$kdelibsuff" = "no" || test "$kdelibsuff" = "none"; then
  3134. kdelibsuff=
  3135. fi
  3136. if test -z "$kdelibsuff"; then
  3137. AC_MSG_RESULT([not using lib directory suffix])
  3138. AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
  3139. else
  3140. if test "$libdir" = '${exec_prefix}/lib'; then
  3141. libdir="$libdir${kdelibsuff}"
  3142. AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms
  3143. fi
  3144. AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories)
  3145. AC_MSG_RESULT([using lib directory suffix $kdelibsuff])
  3146. fi
  3147. ])
  3148. AC_DEFUN([KDE_CHECK_TYPES],
  3149. [ AC_CHECK_SIZEOF(int, 4)dnl
  3150. AC_CHECK_SIZEOF(short)dnl
  3151. AC_CHECK_SIZEOF(long, 4)dnl
  3152. AC_CHECK_SIZEOF(char *, 4)dnl
  3153. ])dnl
  3154. dnl Not used - kept for compat only?
  3155. AC_DEFUN([KDE_DO_IT_ALL],
  3156. [
  3157. AC_CANONICAL_SYSTEM
  3158. AC_ARG_PROGRAM
  3159. AM_INIT_AUTOMAKE($1, $2)
  3160. AM_DISABLE_LIBRARIES
  3161. AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  3162. AC_CHECK_COMPILERS
  3163. KDE_PROG_LIBTOOL
  3164. AM_KDE_WITH_NLS
  3165. AC_PATH_KDE
  3166. ])
  3167. AC_DEFUN([AC_CHECK_RPATH],
  3168. [
  3169. AC_MSG_CHECKING(for rpath)
  3170. AC_ARG_ENABLE(rpath,
  3171. AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]),
  3172. USE_RPATH=$enableval, USE_RPATH=yes)
  3173. if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
  3174. KDE_RPATH="-R \$(libdir)"
  3175. if test "$kde_libraries" != "$libdir"; then
  3176. KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)"
  3177. fi
  3178. if test -n "$qt_libraries"; then
  3179. KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
  3180. fi
  3181. dnl $x_libraries is set to /usr/lib in case
  3182. if test -n "$X_LDFLAGS"; then
  3183. X_RPATH="-R \$(x_libraries)"
  3184. KDE_RPATH="$KDE_RPATH $X_RPATH"
  3185. fi
  3186. if test -n "$KDE_EXTRA_RPATH"; then
  3187. KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
  3188. fi
  3189. fi
  3190. AC_SUBST(KDE_EXTRA_RPATH)
  3191. AC_SUBST(KDE_RPATH)
  3192. AC_SUBST(X_RPATH)
  3193. AC_MSG_RESULT($USE_RPATH)
  3194. ])
  3195. dnl Check for the type of the third argument of getsockname
  3196. AC_DEFUN([AC_CHECK_SOCKLEN_T],
  3197. [
  3198. AC_MSG_CHECKING(for socklen_t)
  3199. AC_CACHE_VAL(kde_cv_socklen_t,
  3200. [
  3201. AC_LANG_PUSH(C++)
  3202. kde_cv_socklen_t=no
  3203. AC_TRY_COMPILE([
  3204. #include <sys/types.h>
  3205. #include <sys/socket.h>
  3206. ],
  3207. [
  3208. socklen_t len;
  3209. getpeername(0,0,&len);
  3210. ],
  3211. [
  3212. kde_cv_socklen_t=yes
  3213. kde_cv_socklen_t_equiv=socklen_t
  3214. ])
  3215. AC_LANG_POP(C++)
  3216. ])
  3217. AC_MSG_RESULT($kde_cv_socklen_t)
  3218. if test $kde_cv_socklen_t = no; then
  3219. AC_MSG_CHECKING([for socklen_t equivalent for socket functions])
  3220. AC_CACHE_VAL(kde_cv_socklen_t_equiv,
  3221. [
  3222. kde_cv_socklen_t_equiv=int
  3223. AC_LANG_PUSH(C++)
  3224. for t in int size_t unsigned long "unsigned long"; do
  3225. AC_TRY_COMPILE([
  3226. #include <sys/types.h>
  3227. #include <sys/socket.h>
  3228. ],
  3229. [
  3230. $t len;
  3231. getpeername(0,0,&len);
  3232. ],
  3233. [
  3234. kde_cv_socklen_t_equiv="$t"
  3235. break
  3236. ])
  3237. done
  3238. AC_LANG_POP(C++)
  3239. ])
  3240. AC_MSG_RESULT($kde_cv_socklen_t_equiv)
  3241. fi
  3242. AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv,
  3243. [type to use in place of socklen_t if not defined])
  3244. AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv,
  3245. [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)])
  3246. ])
  3247. dnl This is a merge of some macros out of the gettext aclocal.m4
  3248. dnl since we don't need anything, I took the things we need
  3249. dnl the copyright for them is:
  3250. dnl >
  3251. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  3252. dnl This Makefile.in is free software; the Free Software Foundation
  3253. dnl gives unlimited permission to copy and/or distribute it,
  3254. dnl with or without modifications, as long as this notice is preserved.
  3255. dnl This program is distributed in the hope that it will be useful,
  3256. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  3257. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  3258. dnl PARTICULAR PURPOSE.
  3259. dnl >
  3260. dnl for this file it is relicensed under LGPL
  3261. AC_DEFUN([AM_KDE_WITH_NLS],
  3262. [
  3263. dnl If we use NLS figure out what method
  3264. AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
  3265. [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
  3266. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  3267. if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
  3268. AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
  3269. GMSGFMT=":"
  3270. fi
  3271. MSGFMT=$GMSGFMT
  3272. AC_SUBST(GMSGFMT)
  3273. AC_SUBST(MSGFMT)
  3274. AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
  3275. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  3276. dnl Test whether we really found GNU xgettext.
  3277. if test "$XGETTEXT" != ":"; then
  3278. dnl If it is no GNU xgettext we define it as : so that the
  3279. dnl Makefiles still can work.
  3280. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  3281. : ;
  3282. else
  3283. AC_MSG_RESULT(
  3284. [found xgettext programs is not GNU xgettext; ignore it])
  3285. XGETTEXT=":"
  3286. fi
  3287. fi
  3288. AC_SUBST(XGETTEXT)
  3289. ])
  3290. # Search path for a program which passes the given test.
  3291. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  3292. # serial 1
  3293. # Stephan Kulow: I appended a _KDE against name conflicts
  3294. dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
  3295. dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  3296. AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
  3297. [# Extract the first word of "$2", so it can be a program name with args.
  3298. set dummy $2; ac_word=[$]2
  3299. AC_MSG_CHECKING([for $ac_word])
  3300. AC_CACHE_VAL(ac_cv_path_$1,
  3301. [case "[$]$1" in
  3302. /*)
  3303. ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  3304. ;;
  3305. *)
  3306. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  3307. for ac_dir in ifelse([$5], , $PATH, [$5]); do
  3308. test -z "$ac_dir" && ac_dir=.
  3309. if test -f $ac_dir/$ac_word; then
  3310. if [$3]; then
  3311. ac_cv_path_$1="$ac_dir/$ac_word"
  3312. break
  3313. fi
  3314. fi
  3315. done
  3316. IFS="$ac_save_ifs"
  3317. dnl If no 4th arg is given, leave the cache variable unset,
  3318. dnl so AC_PATH_PROGS will keep looking.
  3319. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  3320. ])dnl
  3321. ;;
  3322. esac])dnl
  3323. $1="$ac_cv_path_$1"
  3324. if test -n "[$]$1"; then
  3325. AC_MSG_RESULT([$]$1)
  3326. else
  3327. AC_MSG_RESULT(no)
  3328. fi
  3329. AC_SUBST($1)dnl
  3330. ])
  3331. # Check whether LC_MESSAGES is available in <locale.h>.
  3332. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  3333. # serial 1
  3334. AC_DEFUN([AM_LC_MESSAGES],
  3335. [if test $ac_cv_header_locale_h = yes; then
  3336. AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  3337. [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  3338. am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  3339. if test $am_cv_val_LC_MESSAGES = yes; then
  3340. AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
  3341. fi
  3342. fi])
  3343. dnl From Jim Meyering.
  3344. dnl FIXME: migrate into libit.
  3345. AC_DEFUN([AM_FUNC_OBSTACK],
  3346. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  3347. [AC_TRY_LINK([#include "obstack.h"],
  3348. [struct obstack *mem;obstack_free(mem,(char *) 0)],
  3349. am_cv_func_obstack=yes,
  3350. am_cv_func_obstack=no)])
  3351. if test $am_cv_func_obstack = yes; then
  3352. AC_DEFINE(HAVE_OBSTACK)
  3353. else
  3354. LIBOBJS="$LIBOBJS obstack.o"
  3355. fi
  3356. ])
  3357. dnl From Jim Meyering. Use this if you use the GNU error.[ch].
  3358. dnl FIXME: Migrate into libit
  3359. AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
  3360. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  3361. [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  3362. am_cv_lib_error_at_line=yes,
  3363. am_cv_lib_error_at_line=no)])
  3364. if test $am_cv_lib_error_at_line = no; then
  3365. LIBOBJS="$LIBOBJS error.o"
  3366. fi
  3367. AC_SUBST(LIBOBJS)dnl
  3368. ])
  3369. # Macro to add for using GNU gettext.
  3370. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  3371. # serial 1
  3372. # Stephan Kulow: I put a KDE in it to avoid name conflicts
  3373. AC_DEFUN([AM_KDE_GNU_GETTEXT],
  3374. [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  3375. AC_REQUIRE([AC_PROG_RANLIB])dnl
  3376. AC_REQUIRE([AC_HEADER_STDC])dnl
  3377. AC_REQUIRE([AC_TYPE_OFF_T])dnl
  3378. AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  3379. AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  3380. AC_REQUIRE([AC_FUNC_MMAP])dnl
  3381. AC_REQUIRE([AM_KDE_WITH_NLS])dnl
  3382. AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
  3383. AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
  3384. __argz_count __argz_stringify __argz_next])
  3385. AC_MSG_CHECKING(for stpcpy)
  3386. AC_CACHE_VAL(kde_cv_func_stpcpy,
  3387. [
  3388. kde_safe_cxxflags=$CXXFLAGS
  3389. CXXFLAGS="-Werror"
  3390. AC_LANG_SAVE
  3391. AC_LANG_CPLUSPLUS
  3392. AC_TRY_COMPILE([
  3393. #include <string.h>
  3394. ],
  3395. [
  3396. char buffer[200];
  3397. stpcpy(buffer, buffer);
  3398. ],
  3399. kde_cv_func_stpcpy=yes,
  3400. kde_cv_func_stpcpy=no)
  3401. AC_LANG_RESTORE
  3402. CXXFLAGS=$kde_safe_cxxflags
  3403. ])
  3404. AC_MSG_RESULT($kde_cv_func_stpcpy)
  3405. if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
  3406. AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
  3407. fi
  3408. AM_LC_MESSAGES
  3409. if test "x$CATOBJEXT" != "x"; then
  3410. if test "x$ALL_LINGUAS" = "x"; then
  3411. LINGUAS=
  3412. else
  3413. AC_MSG_CHECKING(for catalogs to be installed)
  3414. NEW_LINGUAS=
  3415. for lang in ${LINGUAS=$ALL_LINGUAS}; do
  3416. case "$ALL_LINGUAS" in
  3417. *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  3418. esac
  3419. done
  3420. LINGUAS=$NEW_LINGUAS
  3421. AC_MSG_RESULT($LINGUAS)
  3422. fi
  3423. dnl Construct list of names of catalog files to be constructed.
  3424. if test -n "$LINGUAS"; then
  3425. for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  3426. fi
  3427. fi
  3428. ])
  3429. AC_DEFUN([AC_HAVE_XPM],
  3430. [AC_REQUIRE_CPP()dnl
  3431. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3432. test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
  3433. test -z "$XPM_INCLUDE" && XPM_INCLUDE=
  3434. AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]),
  3435. xpm_test=$withval, xpm_test="yes")
  3436. if test "x$xpm_test" = xno; then
  3437. ac_cv_have_xpm=no
  3438. else
  3439. AC_MSG_CHECKING(for XPM)
  3440. AC_CACHE_VAL(ac_cv_have_xpm,
  3441. [
  3442. ac_save_ldflags="$LDFLAGS"
  3443. ac_save_cflags="$CFLAGS"
  3444. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  3445. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
  3446. else
  3447. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
  3448. fi
  3449. CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
  3450. test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
  3451. AC_TRY_LINK([#include <X11/xpm.h>],[],
  3452. ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
  3453. LDFLAGS="$ac_save_ldflags"
  3454. CFLAGS="$ac_save_cflags"
  3455. ])dnl
  3456. if test "$ac_cv_have_xpm" = no; then
  3457. AC_MSG_RESULT(no)
  3458. XPM_LDFLAGS=""
  3459. XPMINC=""
  3460. $2
  3461. else
  3462. AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
  3463. if test "$XPM_LDFLAGS" = ""; then
  3464. XPMLIB='-lXpm $(LIB_X11)'
  3465. else
  3466. XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
  3467. fi
  3468. if test "$XPM_INCLUDE" = ""; then
  3469. XPMINC=""
  3470. else
  3471. XPMINC="-I$XPM_INCLUDE"
  3472. fi
  3473. AC_MSG_RESULT(yes)
  3474. $1
  3475. fi
  3476. fi
  3477. AC_SUBST(XPMINC)
  3478. AC_SUBST(XPMLIB)
  3479. ])
  3480. AC_DEFUN([AC_HAVE_DPMS],
  3481. [AC_REQUIRE_CPP()dnl
  3482. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3483. test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
  3484. test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
  3485. DPMS_LIB=
  3486. AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]),
  3487. dpms_test=$withval, dpms_test="yes")
  3488. if test "x$dpms_test" = xno; then
  3489. ac_cv_have_dpms=no
  3490. else
  3491. AC_MSG_CHECKING(for DPMS)
  3492. dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
  3493. dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
  3494. AC_CACHE_VAL(ac_cv_have_dpms,
  3495. [
  3496. if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
  3497. AC_MSG_RESULT(no)
  3498. ac_cv_have_dpms="no"
  3499. else
  3500. ac_save_ldflags="$LDFLAGS"
  3501. ac_save_cflags="$CFLAGS"
  3502. ac_save_libs="$LIBS"
  3503. LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries"
  3504. LIBS="-lX11 -lXext $LIBSOCKET"
  3505. CFLAGS="$CFLAGS $X_INCLUDES"
  3506. test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  3507. AC_TRY_LINK([
  3508. #include <X11/Xproto.h>
  3509. #include <X11/X.h>
  3510. #include <X11/Xlib.h>
  3511. #include <X11/extensions/dpms.h>
  3512. int foo_test_dpms()
  3513. { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  3514. ac_cv_have_dpms="yes", [
  3515. LIBS="-lXdpms $LIBS"
  3516. AC_TRY_LINK([
  3517. #include <X11/Xproto.h>
  3518. #include <X11/X.h>
  3519. #include <X11/Xlib.h>
  3520. #include <X11/extensions/dpms.h>
  3521. int foo_test_dpms()
  3522. { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  3523. [
  3524. ac_cv_have_dpms="-lXdpms"
  3525. ],ac_cv_have_dpms="no")
  3526. ])
  3527. LDFLAGS="$ac_save_ldflags"
  3528. CFLAGS="$ac_save_cflags"
  3529. LIBS="$ac_save_libs"
  3530. fi
  3531. ])dnl
  3532. if test "$ac_cv_have_dpms" = no; then
  3533. AC_MSG_RESULT(no)
  3534. DPMS_LDFLAGS=""
  3535. DPMSINC=""
  3536. $2
  3537. else
  3538. AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
  3539. if test "$ac_cv_have_dpms" = "-lXdpms"; then
  3540. DPMS_LIB="-lXdpms"
  3541. fi
  3542. if test "$DPMS_LDFLAGS" = ""; then
  3543. DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
  3544. else
  3545. DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
  3546. fi
  3547. if test "$DPMS_INCLUDE" = ""; then
  3548. DPMSINC=""
  3549. else
  3550. DPMSINC="-I$DPMS_INCLUDE"
  3551. fi
  3552. AC_MSG_RESULT(yes)
  3553. $1
  3554. fi
  3555. fi
  3556. ac_save_cflags="$CFLAGS"
  3557. CFLAGS="$CFLAGS $X_INCLUDES"
  3558. test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  3559. AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
  3560. [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
  3561. AC_CHECK_DECL(DPMSCapable,
  3562. AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
  3563. [#include <X11/Xlib.h>
  3564. #include <X11/extensions/dpms.h>])
  3565. AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
  3566. [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
  3567. AC_CHECK_DECL(DPMSInfo,
  3568. AC_DEFINE(HAVE_DPMSINFO_PROTO),,
  3569. [#include <X11/Xlib.h>
  3570. #include <X11/extensions/dpms.h>])
  3571. CFLAGS="$ac_save_cflags"
  3572. AC_SUBST(DPMSINC)
  3573. AC_SUBST(DPMSLIB)
  3574. ])
  3575. AC_DEFUN([AC_HAVE_GL],
  3576. [AC_REQUIRE_CPP()dnl
  3577. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3578. test -z "$GL_LDFLAGS" && GL_LDFLAGS=
  3579. test -z "$GL_INCLUDE" && GL_INCLUDE=
  3580. AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]),
  3581. gl_test=$withval, gl_test="yes")
  3582. if test "x$kde_use_qt_emb" = "xyes"; then
  3583. # GL and Qt Embedded is a no-go for now.
  3584. ac_cv_have_gl=no
  3585. elif test "x$gl_test" = xno; then
  3586. ac_cv_have_gl=no
  3587. else
  3588. AC_MSG_CHECKING(for GL)
  3589. AC_CACHE_VAL(ac_cv_have_gl,
  3590. [
  3591. AC_LANG_SAVE
  3592. AC_LANG_CPLUSPLUS
  3593. ac_save_ldflags=$LDFLAGS
  3594. ac_save_cxxflags=$CXXFLAGS
  3595. ac_save_libs=$LIBS
  3596. LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries"
  3597. LIBS="$LIBS -lGL -lGLU"
  3598. test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11"
  3599. LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET"
  3600. CXXFLAGS="$CFLAGS $X_INCLUDES"
  3601. test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  3602. AC_TRY_LINK([#include <GL/gl.h>
  3603. #include <GL/glu.h>
  3604. ], [],
  3605. ac_cv_have_gl="yes", ac_cv_have_gl="no")
  3606. AC_LANG_RESTORE
  3607. LDFLAGS=$ac_save_ldflags
  3608. CXXFLAGS=$ac_save_cxxflags
  3609. LIBS=$ac_save_libs
  3610. ])dnl
  3611. if test "$ac_cv_have_gl" = "no"; then
  3612. AC_MSG_RESULT(no)
  3613. GL_LDFLAGS=""
  3614. GLINC=""
  3615. $2
  3616. else
  3617. AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
  3618. if test "$GL_LDFLAGS" = ""; then
  3619. GLLIB='-lGLU -lGL $(LIB_X11)'
  3620. else
  3621. GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
  3622. fi
  3623. if test "$GL_INCLUDE" = ""; then
  3624. GLINC=""
  3625. else
  3626. GLINC="-I$GL_INCLUDE"
  3627. fi
  3628. AC_MSG_RESULT($ac_cv_have_gl)
  3629. $1
  3630. fi
  3631. fi
  3632. AC_SUBST(GLINC)
  3633. AC_SUBST(GLLIB)
  3634. ])
  3635. dnl shadow password and PAM magic - maintained by ossi@kde.org
  3636. AC_DEFUN([KDE_PAM], [
  3637. AC_REQUIRE([KDE_CHECK_LIBDL])
  3638. want_pam=
  3639. AC_ARG_WITH(pam,
  3640. AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]),
  3641. [ if test "x$withval" = "xyes"; then
  3642. want_pam=yes
  3643. pam_service=kde
  3644. elif test "x$withval" = "xno"; then
  3645. want_pam=no
  3646. else
  3647. want_pam=yes
  3648. pam_service=$withval
  3649. fi
  3650. ], [ pam_service=kde ])
  3651. use_pam=
  3652. PAMLIBS=
  3653. if test "x$want_pam" != xno; then
  3654. AC_CHECK_LIB(pam, pam_start, [
  3655. AC_CHECK_HEADER(security/pam_appl.h,
  3656. [ pam_header=security/pam_appl.h ],
  3657. [ AC_CHECK_HEADER(pam/pam_appl.h,
  3658. [ pam_header=pam/pam_appl.h ],
  3659. [
  3660. AC_MSG_WARN([PAM detected, but no headers found!
  3661. Make sure you have the necessary development packages installed.])
  3662. ]
  3663. )
  3664. ]
  3665. )
  3666. ], , $LIBDL)
  3667. if test -z "$pam_header"; then
  3668. if test "x$want_pam" = xyes; then
  3669. AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
  3670. fi
  3671. else
  3672. AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
  3673. PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
  3674. use_pam=yes
  3675. dnl darwin claims to be something special
  3676. if test "$pam_header" = "pam/pam_appl.h"; then
  3677. AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
  3678. fi
  3679. dnl test whether struct pam_message is const (Linux) or not (Sun)
  3680. AC_MSG_CHECKING(for const pam_message)
  3681. AC_EGREP_HEADER([struct pam_message], $pam_header,
  3682. [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
  3683. [AC_MSG_RESULT([const: Linux-type PAM])],
  3684. [AC_MSG_RESULT([nonconst: Sun-type PAM])
  3685. AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
  3686. )],
  3687. [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
  3688. fi
  3689. fi
  3690. AC_SUBST(PAMLIBS)
  3691. ])
  3692. dnl DEF_PAM_SERVICE(arg name, full name, define name)
  3693. AC_DEFUN([DEF_PAM_SERVICE], [
  3694. AC_ARG_WITH($1-pam,
  3695. AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]),
  3696. [ if test "x$use_pam" = xyes; then
  3697. $3_PAM_SERVICE=$withval
  3698. else
  3699. AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
  3700. You may want to enforce it by using --with-pam.])
  3701. fi
  3702. ],
  3703. [ if test "x$use_pam" = xyes; then
  3704. $3_PAM_SERVICE="$pam_service"
  3705. fi
  3706. ])
  3707. if test -n "$$3_PAM_SERVICE"; then
  3708. AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
  3709. AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
  3710. fi
  3711. AC_SUBST($3_PAM_SERVICE)
  3712. ])
  3713. AC_DEFUN([KDE_SHADOWPASSWD], [
  3714. AC_REQUIRE([KDE_PAM])
  3715. AC_CHECK_LIB(shadow, getspent,
  3716. [ LIBSHADOW="-lshadow"
  3717. ac_use_shadow=yes
  3718. ],
  3719. [ dnl for UnixWare
  3720. AC_CHECK_LIB(gen, getspent,
  3721. [ LIBGEN="-lgen"
  3722. ac_use_shadow=yes
  3723. ],
  3724. [ AC_CHECK_FUNC(getspent,
  3725. [ ac_use_shadow=yes ],
  3726. [ ac_use_shadow=no ])
  3727. ])
  3728. ])
  3729. AC_SUBST(LIBSHADOW)
  3730. AC_SUBST(LIBGEN)
  3731. AC_MSG_CHECKING([for shadow passwords])
  3732. AC_ARG_WITH(shadow,
  3733. AC_HELP_STRING([--with-shadow],[If you want shadow password support]),
  3734. [ if test "x$withval" != "xno"; then
  3735. use_shadow=yes
  3736. else
  3737. use_shadow=no
  3738. fi
  3739. ], [
  3740. use_shadow="$ac_use_shadow"
  3741. ])
  3742. if test "x$use_shadow" = xyes; then
  3743. AC_MSG_RESULT(yes)
  3744. AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
  3745. else
  3746. AC_MSG_RESULT(no)
  3747. LIBSHADOW=
  3748. LIBGEN=
  3749. fi
  3750. dnl finally make the relevant binaries setuid root, if we have shadow passwds.
  3751. dnl this still applies, if we could use it indirectly through pam.
  3752. if test "x$use_shadow" = xyes ||
  3753. ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
  3754. case $host in
  3755. *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
  3756. SETUIDFLAGS="-m 4755 -o root";;
  3757. *)
  3758. SETUIDFLAGS="-m 4755";;
  3759. esac
  3760. fi
  3761. AC_SUBST(SETUIDFLAGS)
  3762. ])
  3763. AC_DEFUN([KDE_PASSWDLIBS], [
  3764. AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
  3765. AC_REQUIRE([KDE_PAM])
  3766. AC_REQUIRE([KDE_SHADOWPASSWD])
  3767. if test "x$use_pam" = "xyes"; then
  3768. PASSWDLIBS="$PAMLIBS"
  3769. else
  3770. PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
  3771. fi
  3772. dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
  3773. dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires
  3774. dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
  3775. dnl may need to read /etc/master.passwd).
  3776. case $host in
  3777. *-*-freebsd*)
  3778. SETUIDFLAGS="-m 4755 -o root"
  3779. ;;
  3780. *)
  3781. ;;
  3782. esac
  3783. AC_SUBST(PASSWDLIBS)
  3784. ])
  3785. AC_DEFUN([KDE_CHECK_LIBDL],
  3786. [
  3787. AC_CHECK_LIB(dl, dlopen, [
  3788. LIBDL="-ldl"
  3789. ac_cv_have_dlfcn=yes
  3790. ])
  3791. AC_CHECK_LIB(dld, shl_unload, [
  3792. LIBDL="-ldld"
  3793. ac_cv_have_shload=yes
  3794. ])
  3795. AC_SUBST(LIBDL)
  3796. ])
  3797. AC_DEFUN([KDE_CHECK_DLOPEN],
  3798. [
  3799. KDE_CHECK_LIBDL
  3800. AC_CHECK_HEADERS(dlfcn.h dl.h)
  3801. if test "$ac_cv_header_dlfcn_h" = "no"; then
  3802. ac_cv_have_dlfcn=no
  3803. fi
  3804. if test "$ac_cv_header_dl_h" = "no"; then
  3805. ac_cv_have_shload=no
  3806. fi
  3807. dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
  3808. dnl (MM)
  3809. AC_ARG_ENABLE(dlopen,
  3810. AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]),
  3811. enable_dlopen=$enableval,
  3812. enable_dlopen=yes)
  3813. # override the user's opinion, if we know it better ;)
  3814. if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
  3815. enable_dlopen=no
  3816. fi
  3817. if test "$ac_cv_have_dlfcn" = "yes"; then
  3818. AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
  3819. fi
  3820. if test "$ac_cv_have_shload" = "yes"; then
  3821. AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
  3822. fi
  3823. if test "$enable_dlopen" = no ; then
  3824. test -n "$1" && eval $1
  3825. else
  3826. test -n "$2" && eval $2
  3827. fi
  3828. ])
  3829. AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
  3830. [
  3831. KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
  3832. KDE_PROG_LIBTOOL
  3833. AC_MSG_CHECKING([dynamic loading])
  3834. eval "`egrep '^build_libtool_libs=' libtool`"
  3835. if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
  3836. dynamic_loading=yes
  3837. AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
  3838. else
  3839. dynamic_loading=no
  3840. fi
  3841. AC_MSG_RESULT($dynamic_loading)
  3842. if test "$dynamic_loading" = "yes"; then
  3843. $1
  3844. else
  3845. $2
  3846. fi
  3847. ])
  3848. AC_DEFUN([KDE_ADD_INCLUDES],
  3849. [
  3850. if test -z "$1"; then
  3851. test_include="Pix.h"
  3852. else
  3853. test_include="$1"
  3854. fi
  3855. AC_MSG_CHECKING([for libg++ ($test_include)])
  3856. AC_CACHE_VAL(kde_cv_libgpp_includes,
  3857. [
  3858. kde_cv_libgpp_includes=no
  3859. for ac_dir in \
  3860. \
  3861. /usr/include/g++ \
  3862. /usr/include \
  3863. /usr/unsupported/include \
  3864. /opt/include \
  3865. $extra_include \
  3866. ; \
  3867. do
  3868. if test -r "$ac_dir/$test_include"; then
  3869. kde_cv_libgpp_includes=$ac_dir
  3870. break
  3871. fi
  3872. done
  3873. ])
  3874. AC_MSG_RESULT($kde_cv_libgpp_includes)
  3875. if test "$kde_cv_libgpp_includes" != "no"; then
  3876. all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
  3877. fi
  3878. ])
  3879. ])
  3880. AC_DEFUN([KDE_CHECK_LIBPTHREAD],
  3881. [
  3882. dnl This code is here specifically to handle the
  3883. dnl various flavors of threading library on FreeBSD
  3884. dnl 4-, 5-, and 6-, and the (weird) rules around it.
  3885. dnl There may be an environment PTHREAD_LIBS that
  3886. dnl specifies what to use; otherwise, search for it.
  3887. dnl -pthread is special cased and unsets LIBPTHREAD
  3888. dnl below if found.
  3889. LIBPTHREAD=""
  3890. if test -n "$PTHREAD_LIBS"; then
  3891. if test "x$PTHREAD_LIBS" = "x-pthread" ; then
  3892. LIBPTHREAD="PTHREAD"
  3893. else
  3894. PTHREAD_LIBS_save="$PTHREAD_LIBS"
  3895. PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
  3896. AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS])
  3897. KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [
  3898. LIBPTHREAD="$PTHREAD_LIBS_save"])
  3899. PTHREAD_LIBS="$PTHREAD_LIBS_save"
  3900. fi
  3901. fi
  3902. dnl Is this test really needed, in the face of the Tru64 test below?
  3903. if test -z "$LIBPTHREAD"; then
  3904. AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"])
  3905. fi
  3906. dnl This is a special Tru64 check, see BR 76171 issue #18.
  3907. if test -z "$LIBPTHREAD" ; then
  3908. AC_MSG_CHECKING([for pthread_create in -lpthread])
  3909. kde_safe_libs=$LIBS
  3910. LIBS="$LIBS -lpthread"
  3911. AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
  3912. AC_MSG_RESULT(yes)
  3913. LIBPTHREAD="-lpthread"],[
  3914. AC_MSG_RESULT(no)])
  3915. LIBS=$kde_safe_libs
  3916. fi
  3917. dnl Un-special-case for FreeBSD.
  3918. if test "x$LIBPTHREAD" = "xPTHREAD" ; then
  3919. LIBPTHREAD=""
  3920. fi
  3921. AC_SUBST(LIBPTHREAD)
  3922. ])
  3923. AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
  3924. [
  3925. USE_THREADS=""
  3926. if test -z "$LIBPTHREAD"; then
  3927. KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
  3928. fi
  3929. AH_VERBATIM(__svr_define, [
  3930. #if defined(__SVR4) && !defined(__svr4__)
  3931. #define __svr4__ 1
  3932. #endif
  3933. ])
  3934. case $host_os in
  3935. solaris*)
  3936. KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
  3937. CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
  3938. ;;
  3939. freebsd*)
  3940. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
  3941. ;;
  3942. aix*)
  3943. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
  3944. LIBPTHREAD="$LIBPTHREAD -lc_r"
  3945. ;;
  3946. linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  3947. if test "$CXX" = "KCC"; then
  3948. CXXFLAGS="$CXXFLAGS --thread_safe"
  3949. NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
  3950. fi
  3951. ;;
  3952. *)
  3953. ;;
  3954. esac
  3955. AC_SUBST(USE_THREADS)
  3956. AC_SUBST(LIBPTHREAD)
  3957. ])
  3958. AC_DEFUN([KDE_CHECK_THREADING],
  3959. [
  3960. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  3961. AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
  3962. dnl default is yes if libpthread is found and no if no libpthread is available
  3963. if test -z "$LIBPTHREAD"; then
  3964. if test -z "$USE_THREADS"; then
  3965. kde_check_threading_default=no
  3966. else
  3967. kde_check_threading_default=yes
  3968. fi
  3969. else
  3970. kde_check_threading_default=yes
  3971. fi
  3972. AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]),
  3973. kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
  3974. if test "x$kde_use_threading" = "xyes"; then
  3975. AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
  3976. fi
  3977. ])
  3978. AC_DEFUN([KDE_TRY_LINK_PYTHON],
  3979. [
  3980. if test "$kde_python_link_found" = no; then
  3981. if test "$1" = normal; then
  3982. AC_MSG_CHECKING(if a Python application links)
  3983. else
  3984. AC_MSG_CHECKING(if Python depends on $2)
  3985. fi
  3986. AC_CACHE_VAL(kde_cv_try_link_python_$1,
  3987. [
  3988. kde_save_cflags="$CFLAGS"
  3989. CFLAGS="$CFLAGS $PYTHONINC"
  3990. kde_save_libs="$LIBS"
  3991. LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
  3992. kde_save_ldflags="$LDFLAGS"
  3993. LDFLAGS="$LDFLAGS $PYTHONLIB"
  3994. AC_TRY_LINK(
  3995. [
  3996. #include <Python.h>
  3997. ],[
  3998. PySys_SetArgv(1, 0);
  3999. ],
  4000. [kde_cv_try_link_python_$1=yes],
  4001. [kde_cv_try_link_python_$1=no]
  4002. )
  4003. CFLAGS="$kde_save_cflags"
  4004. LIBS="$kde_save_libs"
  4005. LDFLAGS="$kde_save_ldflags"
  4006. ])
  4007. if test "$kde_cv_try_link_python_$1" = "yes"; then
  4008. AC_MSG_RESULT(yes)
  4009. kde_python_link_found=yes
  4010. if test ! "$1" = normal; then
  4011. LIBPYTHON="$LIBPYTHON $2"
  4012. fi
  4013. $3
  4014. else
  4015. AC_MSG_RESULT(no)
  4016. $4
  4017. fi
  4018. fi
  4019. ])
  4020. AC_DEFUN([KDE_CHECK_PYTHON_DIR],
  4021. [
  4022. AC_MSG_CHECKING([for Python directory])
  4023. AC_CACHE_VAL(kde_cv_pythondir,
  4024. [
  4025. if test -z "$PYTHONDIR"; then
  4026. kde_cv_pythondir=/usr/local
  4027. else
  4028. kde_cv_pythondir="$PYTHONDIR"
  4029. fi
  4030. ])
  4031. AC_ARG_WITH(pythondir,
  4032. AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]),
  4033. [
  4034. ac_python_dir=$withval
  4035. ], ac_python_dir=$kde_cv_pythondir
  4036. )
  4037. AC_MSG_RESULT($ac_python_dir)
  4038. ])
  4039. AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
  4040. [
  4041. AC_REQUIRE([KDE_CHECK_LIBDL])
  4042. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  4043. AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
  4044. if test -z "$1"; then
  4045. version="1.5"
  4046. else
  4047. version="$1"
  4048. fi
  4049. AC_MSG_CHECKING([for Python$version])
  4050. python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
  4051. AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
  4052. if test ! -r $python_incdir/Python.h; then
  4053. AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
  4054. python_incdir=$python_incdir/python$version
  4055. if test ! -r $python_incdir/Python.h; then
  4056. python_incdir=no
  4057. fi
  4058. fi
  4059. PYTHONINC=-I$python_incdir
  4060. python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs"
  4061. AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
  4062. if test ! -r $python_libdir/libpython$version.so; then
  4063. AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
  4064. if test ! -r $python_libdir/libpython$version.a; then
  4065. AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
  4066. python_libdir=$python_libdir/python$version/config
  4067. if test ! -r $python_libdir/libpython$version.a; then
  4068. python_libdir=no
  4069. fi
  4070. fi
  4071. fi
  4072. PYTHONLIB=-L$python_libdir
  4073. kde_orig_LIBPYTHON=$LIBPYTHON
  4074. if test -z "$LIBPYTHON"; then
  4075. LIBPYTHON=-lpython$version
  4076. fi
  4077. AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
  4078. python_moddir=$python_moddir/python$version
  4079. if test ! -r $python_moddir/copy.py; then
  4080. python_moddir=no
  4081. fi
  4082. PYTHONMODDIR=$python_moddir
  4083. AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
  4084. if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then
  4085. LIBPYTHON=$kde_orig_LIBPYTHON
  4086. test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
  4087. test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
  4088. $2
  4089. else
  4090. dnl Note: this test is very weak
  4091. kde_python_link_found=no
  4092. KDE_TRY_LINK_PYTHON(normal)
  4093. KDE_TRY_LINK_PYTHON(m, -lm)
  4094. KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
  4095. KDE_TRY_LINK_PYTHON(tcl, -ltcl)
  4096. KDE_TRY_LINK_PYTHON(db2, -ldb2)
  4097. KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
  4098. KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
  4099. KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
  4100. KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
  4101. KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
  4102. KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
  4103. KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
  4104. KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
  4105. [AC_MSG_WARN([it seems, Python depends on another library.
  4106. Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
  4107. and contact the authors to let them know about this problem])
  4108. ])
  4109. LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
  4110. AC_SUBST(PYTHONINC)
  4111. AC_SUBST(PYTHONLIB)
  4112. AC_SUBST(LIBPYTHON)
  4113. AC_SUBST(PYTHONMODDIR)
  4114. AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
  4115. fi
  4116. ])
  4117. AC_DEFUN([KDE_CHECK_PYTHON],
  4118. [
  4119. KDE_CHECK_PYTHON_INTERN("2.6",
  4120. [KDE_CHECK_PYTHON_INTERN("2.5",
  4121. [KDE_CHECK_PYTHON_INTERN("2.4",
  4122. [KDE_CHECK_PYTHON_INTERN("2.3",
  4123. [KDE_CHECK_PYTHON_INTERN("2.2",
  4124. [KDE_CHECK_PYTHON_INTERN("2.1",
  4125. [KDE_CHECK_PYTHON_INTERN("2.0",
  4126. [KDE_CHECK_PYTHON_INTERN($1, $2) ])
  4127. ])
  4128. ])
  4129. ])
  4130. ])
  4131. ])
  4132. ])
  4133. ])
  4134. AC_DEFUN([KDE_CHECK_STL],
  4135. [
  4136. AC_LANG_SAVE
  4137. AC_LANG_CPLUSPLUS
  4138. ac_save_CXXFLAGS="$CXXFLAGS"
  4139. CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
  4140. AC_MSG_CHECKING([if C++ programs can be compiled])
  4141. AC_CACHE_VAL(kde_cv_stl_works,
  4142. [
  4143. AC_TRY_COMPILE([
  4144. #include <string>
  4145. using namespace std;
  4146. ],[
  4147. string astring="Hallo Welt.";
  4148. astring.erase(0, 6); // now astring is "Welt"
  4149. return 0;
  4150. ], kde_cv_stl_works=yes,
  4151. kde_cv_stl_works=no)
  4152. ])
  4153. AC_MSG_RESULT($kde_cv_stl_works)
  4154. if test "$kde_cv_stl_works" = "yes"; then
  4155. # back compatible
  4156. AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
  4157. else
  4158. AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
  4159. Check config.log for details - if you're using a Linux distribution you might miss
  4160. a package named similar to libstdc++-dev.])
  4161. fi
  4162. CXXFLAGS="$ac_save_CXXFLAGS"
  4163. AC_LANG_RESTORE
  4164. ])
  4165. AC_DEFUN([AC_FIND_QIMGIO],
  4166. [AC_REQUIRE([AC_FIND_JPEG])
  4167. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  4168. AC_MSG_CHECKING([for qimgio])
  4169. AC_CACHE_VAL(ac_cv_lib_qimgio,
  4170. [
  4171. AC_LANG_SAVE
  4172. AC_LANG_CPLUSPLUS
  4173. ac_save_LIBS="$LIBS"
  4174. ac_save_CXXFLAGS="$CXXFLAGS"
  4175. LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
  4176. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  4177. AC_TRY_RUN(dnl
  4178. [
  4179. #include <qimageio.h>
  4180. #include <qstring.h>
  4181. int main() {
  4182. QString t = "hallo";
  4183. t.fill('t');
  4184. qInitImageIO();
  4185. }
  4186. ],
  4187. ac_cv_lib_qimgio=yes,
  4188. ac_cv_lib_qimgio=no,
  4189. ac_cv_lib_qimgio=no)
  4190. LIBS="$ac_save_LIBS"
  4191. CXXFLAGS="$ac_save_CXXFLAGS"
  4192. AC_LANG_RESTORE
  4193. ])dnl
  4194. if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
  4195. LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
  4196. AC_MSG_RESULT(yes)
  4197. AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
  4198. AC_SUBST(LIBQIMGIO)
  4199. else
  4200. AC_MSG_RESULT(not found)
  4201. fi
  4202. ])
  4203. AC_DEFUN([AM_DISABLE_LIBRARIES],
  4204. [
  4205. AC_PROVIDE([AM_ENABLE_STATIC])
  4206. AC_PROVIDE([AM_ENABLE_SHARED])
  4207. enable_static=no
  4208. enable_shared=yes
  4209. ])
  4210. AC_DEFUN([AC_CHECK_UTMP_FILE],
  4211. [
  4212. AC_MSG_CHECKING([for utmp file])
  4213. AC_CACHE_VAL(kde_cv_utmp_file,
  4214. [
  4215. kde_cv_utmp_file=no
  4216. for ac_file in \
  4217. \
  4218. /var/run/utmp \
  4219. /var/adm/utmp \
  4220. /etc/utmp \
  4221. ; \
  4222. do
  4223. if test -r "$ac_file"; then
  4224. kde_cv_utmp_file=$ac_file
  4225. break
  4226. fi
  4227. done
  4228. ])
  4229. if test "$kde_cv_utmp_file" != "no"; then
  4230. AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
  4231. $1
  4232. AC_MSG_RESULT($kde_cv_utmp_file)
  4233. else
  4234. $2
  4235. AC_MSG_RESULT([non found])
  4236. fi
  4237. ])
  4238. AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
  4239. [
  4240. DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
  4241. TOPSUBDIRS=""
  4242. if test ! -s $srcdir/subdirs; then
  4243. dnl Note: Makefile.common creates subdirs, so this is just a fallback
  4244. files=`cd $srcdir && ls -1`
  4245. dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
  4246. for i in $dirs; do
  4247. echo $i >> $srcdir/subdirs
  4248. done
  4249. fi
  4250. ac_topsubdirs=
  4251. if test -s $srcdir/inst-apps; then
  4252. ac_topsubdirs="`cat $srcdir/inst-apps`"
  4253. elif test -s $srcdir/subdirs; then
  4254. ac_topsubdirs="`cat $srcdir/subdirs`"
  4255. fi
  4256. for i in $ac_topsubdirs; do
  4257. AC_MSG_CHECKING([if $i should be compiled])
  4258. if test -d $srcdir/$i; then
  4259. install_it="yes"
  4260. for j in $DO_NOT_COMPILE; do
  4261. if test $i = $j; then
  4262. install_it="no"
  4263. fi
  4264. done
  4265. else
  4266. install_it="no"
  4267. fi
  4268. AC_MSG_RESULT($install_it)
  4269. vari=`echo $i | sed -e 's,[[-+.@]],_,g'`
  4270. if test $install_it = "yes"; then
  4271. TOPSUBDIRS="$TOPSUBDIRS $i"
  4272. eval "$vari""_SUBDIR_included=yes"
  4273. else
  4274. eval "$vari""_SUBDIR_included=no"
  4275. fi
  4276. done
  4277. AC_SUBST(TOPSUBDIRS)
  4278. ])
  4279. AC_DEFUN([KDE_CHECK_NAMESPACES],
  4280. [
  4281. AC_MSG_CHECKING(whether C++ compiler supports namespaces)
  4282. AC_LANG_SAVE
  4283. AC_LANG_CPLUSPLUS
  4284. AC_TRY_COMPILE([
  4285. ],
  4286. [
  4287. namespace Foo {
  4288. extern int i;
  4289. namespace Bar {
  4290. extern int i;
  4291. }
  4292. }
  4293. int Foo::i = 0;
  4294. int Foo::Bar::i = 1;
  4295. ],[
  4296. AC_MSG_RESULT(yes)
  4297. AC_DEFINE(HAVE_NAMESPACES)
  4298. ], [
  4299. AC_MSG_RESULT(no)
  4300. ])
  4301. AC_LANG_RESTORE
  4302. ])
  4303. dnl ------------------------------------------------------------------------
  4304. dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
  4305. dnl ------------------------------------------------------------------------
  4306. dnl
  4307. AC_DEFUN([AC_CHECK_S_ISSOCK],
  4308. [
  4309. AC_MSG_CHECKING(for S_ISSOCK)
  4310. AC_CACHE_VAL(ac_cv_have_s_issock,
  4311. [
  4312. AC_TRY_LINK(
  4313. [
  4314. #include <sys/stat.h>
  4315. ],
  4316. [
  4317. struct stat buff;
  4318. int b = S_ISSOCK( buff.st_mode );
  4319. ],
  4320. ac_cv_have_s_issock=yes,
  4321. ac_cv_have_s_issock=no)
  4322. ])
  4323. AC_MSG_RESULT($ac_cv_have_s_issock)
  4324. if test "$ac_cv_have_s_issock" = "yes"; then
  4325. AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
  4326. fi
  4327. AH_VERBATIM(_ISSOCK,
  4328. [
  4329. #ifndef HAVE_S_ISSOCK
  4330. #define HAVE_S_ISSOCK
  4331. #define S_ISSOCK(mode) (1==0)
  4332. #endif
  4333. ])
  4334. ])
  4335. dnl ------------------------------------------------------------------------
  4336. dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
  4337. dnl ------------------------------------------------------------------------
  4338. dnl
  4339. AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
  4340. [
  4341. AC_MSG_CHECKING(for MAXPATHLEN)
  4342. AC_CACHE_VAL(ac_cv_maxpathlen,
  4343. [
  4344. cat > conftest.$ac_ext <<EOF
  4345. #ifdef STDC_HEADERS
  4346. # include <stdlib.h>
  4347. #endif
  4348. #include <stdio.h>
  4349. #include <sys/param.h>
  4350. #ifndef MAXPATHLEN
  4351. #define MAXPATHLEN 1024
  4352. #endif
  4353. KDE_HELLO MAXPATHLEN
  4354. EOF
  4355. ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
  4356. if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
  4357. ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
  4358. else
  4359. ac_cv_maxpathlen=1024
  4360. fi
  4361. rm conftest.*
  4362. ])
  4363. AC_MSG_RESULT($ac_cv_maxpathlen)
  4364. AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
  4365. ])
  4366. AC_DEFUN([KDE_CHECK_HEADER],
  4367. [
  4368. kde_safe_cppflags=$CPPFLAGS
  4369. CPPFLAGS="$CPPFLAGS $all_includes"
  4370. AC_LANG_SAVE
  4371. AC_LANG_CPLUSPLUS
  4372. AC_CHECK_HEADER([$1], [$2], [$3], [$4])
  4373. AC_LANG_RESTORE
  4374. CPPFLAGS=$kde_safe_cppflags
  4375. ])
  4376. AC_DEFUN([KDE_CHECK_HEADERS],
  4377. [
  4378. AH_CHECK_HEADERS([$1])
  4379. AC_LANG_SAVE
  4380. kde_safe_cppflags=$CPPFLAGS
  4381. CPPFLAGS="$CPPFLAGS $all_includes"
  4382. AC_LANG_CPLUSPLUS
  4383. AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
  4384. CPPFLAGS=$kde_safe_cppflags
  4385. AC_LANG_RESTORE
  4386. ])
  4387. AC_DEFUN([KDE_FAST_CONFIGURE],
  4388. [
  4389. dnl makes configure fast (needs perl)
  4390. AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]),
  4391. with_fast_perl=$enableval, with_fast_perl=yes)
  4392. ])
  4393. AC_DEFUN([KDE_CONF_FILES],
  4394. [
  4395. val=
  4396. if test -f $srcdir/configure.files ; then
  4397. val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
  4398. fi
  4399. CONF_FILES=
  4400. if test -n "$val" ; then
  4401. for i in $val ; do
  4402. CONF_FILES="$CONF_FILES $i"
  4403. done
  4404. fi
  4405. AC_SUBST(CONF_FILES)
  4406. ])dnl
  4407. dnl This sets the prefix, for arts and kdelibs
  4408. dnl Do NOT use in any other module.
  4409. dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde
  4410. AC_DEFUN([KDE_SET_PREFIX_CORE],
  4411. [
  4412. unset CDPATH
  4413. dnl make $KDEDIR the default for the installation
  4414. AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
  4415. if test "x$prefix" = "xNONE"; then
  4416. prefix=$ac_default_prefix
  4417. ac_configure_args="$ac_configure_args --prefix=$prefix"
  4418. fi
  4419. # And delete superfluous '/' to make compares easier
  4420. prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4421. exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4422. kde_libs_prefix='$(prefix)'
  4423. kde_libs_htmldir='$(kde_htmldir)'
  4424. AC_SUBST(kde_libs_prefix)
  4425. AC_SUBST(kde_libs_htmldir)
  4426. KDE_FAST_CONFIGURE
  4427. KDE_CONF_FILES
  4428. ])
  4429. AC_DEFUN([KDE_SET_PREFIX],
  4430. [
  4431. unset CDPATH
  4432. dnl We can't give real code to that macro, only a value.
  4433. dnl It only matters for --help, since we set the prefix in this function anyway.
  4434. AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix})
  4435. KDE_SET_DEFAULT_BINDIRS
  4436. if test "x$prefix" = "xNONE"; then
  4437. dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it
  4438. KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
  4439. else
  4440. dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH
  4441. kde_save_PATH="$PATH"
  4442. PATH="$exec_prefix/bin:$prefix/bin:$PATH"
  4443. KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend)
  4444. PATH="$kde_save_PATH"
  4445. fi
  4446. kde_libs_prefix=`$KDECONFIG --prefix`
  4447. if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
  4448. AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
  4449. This means it has been moved since you installed it.
  4450. This won't work. Please recompile kdelibs for the new prefix.
  4451. ])
  4452. fi
  4453. kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
  4454. AC_MSG_CHECKING([where to install])
  4455. if test "x$prefix" = "xNONE"; then
  4456. prefix=$kde_libs_prefix
  4457. AC_MSG_RESULT([$prefix (as returned by kde-config)])
  4458. else
  4459. dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different
  4460. given_prefix=$prefix
  4461. AC_MSG_RESULT([$prefix (as requested)])
  4462. fi
  4463. # And delete superfluous '/' to make compares easier
  4464. prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4465. exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4466. given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4467. AC_SUBST(KDECONFIG)
  4468. AC_SUBST(kde_libs_prefix)
  4469. AC_SUBST(kde_libs_htmldir)
  4470. KDE_FAST_CONFIGURE
  4471. KDE_CONF_FILES
  4472. ])
  4473. pushdef([AC_PROG_INSTALL],
  4474. [
  4475. dnl our own version, testing for a -p flag
  4476. popdef([AC_PROG_INSTALL])
  4477. dnl as AC_PROG_INSTALL works as it works we first have
  4478. dnl to save if the user didn't specify INSTALL, as the
  4479. dnl autoconf one overwrites INSTALL and we have no chance to find
  4480. dnl out afterwards
  4481. test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
  4482. test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
  4483. test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
  4484. AC_PROG_INSTALL
  4485. if test -z "$kde_save_INSTALL_given" ; then
  4486. # OK, user hasn't given any INSTALL, autoconf found one for us
  4487. # now we test, if it supports the -p flag
  4488. AC_MSG_CHECKING(for -p flag to install)
  4489. rm -f confinst.$$.* > /dev/null 2>&1
  4490. echo "Testtest" > confinst.$$.orig
  4491. ac_res=no
  4492. if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
  4493. if test -f confinst.$$.new ; then
  4494. # OK, -p seems to do no harm to install
  4495. INSTALL="${INSTALL} -p"
  4496. ac_res=yes
  4497. fi
  4498. fi
  4499. rm -f confinst.$$.*
  4500. AC_MSG_RESULT($ac_res)
  4501. fi
  4502. dnl the following tries to resolve some signs and wonders coming up
  4503. dnl with different autoconf/automake versions
  4504. dnl e.g.:
  4505. dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
  4506. dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
  4507. dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
  4508. dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
  4509. dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
  4510. dnl install-@DIR@PROGRAMS targets to explicitly use that flag
  4511. dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
  4512. dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
  4513. dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
  4514. dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from
  4515. dnl automake (due to broken Makefile.am or whatever) to install programs,
  4516. dnl and so does not see the -s flag in automake > 1.4
  4517. dnl to clean up that mess we:
  4518. dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
  4519. dnl which cleans KDE's program with automake > 1.4;
  4520. dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
  4521. dnl with automake<=1.4
  4522. dnl note that dues to this sometimes two '-s' flags are used (if KDE
  4523. dnl properly uses install-@DIR@PROGRAMS, but I don't care
  4524. dnl
  4525. dnl And to all this comes, that I even can't write in comments variable
  4526. dnl names used by automake, because it is so stupid to think I wanted to
  4527. dnl _use_ them, therefor I have written A_M_... instead of AM_
  4528. dnl hmm, I wanted to say something ... ahh yes: Arghhh.
  4529. if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
  4530. INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
  4531. fi
  4532. if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
  4533. INSTALL_SCRIPT='${INSTALL}'
  4534. fi
  4535. ])dnl
  4536. AC_DEFUN([KDE_LANG_CPLUSPLUS],
  4537. [AC_LANG_CPLUSPLUS
  4538. ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
  4539. pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
  4540. ])
  4541. pushdef([AC_LANG_CPLUSPLUS],
  4542. [popdef([AC_LANG_CPLUSPLUS])
  4543. KDE_LANG_CPLUSPLUS
  4544. ])
  4545. AC_DEFUN([KDE_CHECK_LONG_LONG],
  4546. [
  4547. AC_MSG_CHECKING(for long long)
  4548. AC_CACHE_VAL(kde_cv_c_long_long,
  4549. [
  4550. AC_LANG_SAVE
  4551. AC_LANG_CPLUSPLUS
  4552. AC_TRY_LINK([], [
  4553. long long foo = 0;
  4554. foo = foo+1;
  4555. ],
  4556. kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
  4557. AC_LANG_RESTORE
  4558. ])
  4559. AC_MSG_RESULT($kde_cv_c_long_long)
  4560. if test "$kde_cv_c_long_long" = yes; then
  4561. AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
  4562. fi
  4563. ])
  4564. AC_DEFUN([KDE_CHECK_LIB],
  4565. [
  4566. kde_save_LDFLAGS="$LDFLAGS"
  4567. dnl AC_CHECK_LIB modifies LIBS, so save it here
  4568. kde_save_LIBS="$LIBS"
  4569. LDFLAGS="$LDFLAGS $all_libraries"
  4570. case $host_os in
  4571. aix*) LDFLAGS="-brtl $LDFLAGS"
  4572. test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
  4573. ;;
  4574. esac
  4575. AC_CHECK_LIB($1, $2, $3, $4, $5)
  4576. LDFLAGS="$kde_save_LDFLAGS"
  4577. LIBS="$kde_save_LIBS"
  4578. ])
  4579. AC_DEFUN([KDE_JAVA_PREFIX],
  4580. [
  4581. dir=`dirname "$1"`
  4582. base=`basename "$1"`
  4583. list=`ls -1 $dir 2> /dev/null`
  4584. for entry in $list; do
  4585. if test -d $dir/$entry/bin; then
  4586. case $entry in
  4587. $base)
  4588. javadirs="$javadirs $dir/$entry/bin"
  4589. ;;
  4590. esac
  4591. elif test -d $dir/$entry/jre/bin; then
  4592. case $entry in
  4593. $base)
  4594. javadirs="$javadirs $dir/$entry/jre/bin"
  4595. ;;
  4596. esac
  4597. fi
  4598. done
  4599. ])
  4600. dnl KDE_CHEC_JAVA_DIR(onlyjre)
  4601. AC_DEFUN([KDE_CHECK_JAVA_DIR],
  4602. [
  4603. AC_ARG_WITH(java,
  4604. AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]),
  4605. [ ac_java_dir=$withval
  4606. ], ac_java_dir=""
  4607. )
  4608. AC_MSG_CHECKING([for Java])
  4609. dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
  4610. if test "x$ac_java_dir" = "xno"; then
  4611. kde_java_bindir=no
  4612. kde_java_includedir=no
  4613. kde_java_libjvmdir=no
  4614. kde_java_libgcjdir=no
  4615. kde_java_libhpidir=no
  4616. else
  4617. if test "x$ac_java_dir" = "x"; then
  4618. dnl No option set -> collect list of candidate paths
  4619. if test -n "$JAVA_HOME"; then
  4620. KDE_JAVA_PREFIX($JAVA_HOME)
  4621. fi
  4622. KDE_JAVA_PREFIX(/usr/j2se)
  4623. KDE_JAVA_PREFIX(/usr/lib/j2se)
  4624. KDE_JAVA_PREFIX(/usr/j*dk*)
  4625. KDE_JAVA_PREFIX(/usr/lib/j*dk*)
  4626. KDE_JAVA_PREFIX(/opt/j*sdk*)
  4627. KDE_JAVA_PREFIX(/usr/lib/java*)
  4628. KDE_JAVA_PREFIX(/usr/java*)
  4629. KDE_JAVA_PREFIX(/usr/java/j*dk*)
  4630. KDE_JAVA_PREFIX(/usr/java/j*re*)
  4631. KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
  4632. KDE_JAVA_PREFIX(/usr/lib/SunJava*)
  4633. KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
  4634. KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
  4635. KDE_JAVA_PREFIX(/opt/java*)
  4636. kde_cv_path="NONE"
  4637. kde_save_IFS=$IFS
  4638. IFS=':'
  4639. for dir in $PATH; do
  4640. if test -d "$dir"; then
  4641. javadirs="$javadirs $dir"
  4642. fi
  4643. done
  4644. IFS=$kde_save_IFS
  4645. jredirs=
  4646. dnl Now javadirs contains a list of paths that exist, all ending with bin/
  4647. for dir in $javadirs; do
  4648. dnl Check for the java executable
  4649. if test -x "$dir/java"; then
  4650. sane_path=$(cd $dir; /bin/pwd)
  4651. dnl And also check for a libjvm.so somewhere under there
  4652. dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
  4653. if test "$sane_path" != "/usr/bin"; then
  4654. libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
  4655. if test ! -f $libjvmdir/libjvm.so; then continue; fi
  4656. jredirs="$jredirs $dir"
  4657. fi
  4658. fi
  4659. done
  4660. dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
  4661. JAVAC=
  4662. JAVA=
  4663. kde_java_bindir=no
  4664. for dir in $jredirs; do
  4665. JAVA="$dir/java"
  4666. kde_java_bindir=$dir
  4667. if test -x "$dir/javac"; then
  4668. JAVAC="$dir/javac"
  4669. break
  4670. fi
  4671. done
  4672. if test -n "$JAVAC"; then
  4673. dnl this substitution might not work - well, we test for jni.h below
  4674. kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
  4675. else
  4676. kde_java_includedir=no
  4677. fi
  4678. else
  4679. dnl config option set
  4680. kde_java_bindir=$ac_java_dir/bin
  4681. if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
  4682. kde_java_includedir=no
  4683. else
  4684. kde_java_includedir=$ac_java_dir/include
  4685. fi
  4686. fi
  4687. fi
  4688. dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
  4689. if test "x$kde_java_bindir" != "xno"; then
  4690. dnl Look for libjvm.so
  4691. kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
  4692. dnl Look for libgcj.so
  4693. kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
  4694. dnl Look for libhpi.so and avoid green threads
  4695. kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
  4696. dnl Now check everything's fine under there
  4697. dnl the include dir is our flag for having the JDK
  4698. if test -d "$kde_java_includedir"; then
  4699. if test ! -x "$kde_java_bindir/javac"; then
  4700. AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
  4701. fi
  4702. if test ! -x "$kde_java_bindir/javah"; then
  4703. AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4704. fi
  4705. if test ! -x "$kde_java_bindir/jar"; then
  4706. AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4707. fi
  4708. if test ! -r "$kde_java_includedir/jni.h"; then
  4709. AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
  4710. fi
  4711. jni_includes="-I$kde_java_includedir"
  4712. dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
  4713. dnl and under linux here..
  4714. dnl not needed for gcj
  4715. if test "x$kde_java_libgcjdir" = "x"; then
  4716. test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
  4717. test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
  4718. test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
  4719. fi
  4720. else
  4721. JAVAC=
  4722. jni_includes=
  4723. fi
  4724. if test "x$kde_java_libgcjdir" = "x"; then
  4725. if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
  4726. AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
  4727. fi
  4728. else
  4729. if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
  4730. AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
  4731. fi
  4732. fi
  4733. if test ! -x "$kde_java_bindir/java"; then
  4734. AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4735. fi
  4736. dnl not needed for gcj compile
  4737. if test "x$kde_java_libgcjdir" = "x"; then
  4738. if test ! -r "$kde_java_libhpidir/libhpi.so"; then
  4739. AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
  4740. fi
  4741. fi
  4742. if test -n "$jni_includes"; then
  4743. dnl Check for JNI version
  4744. AC_LANG_SAVE
  4745. AC_LANG_CPLUSPLUS
  4746. ac_cxxflags_safe="$CXXFLAGS"
  4747. CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
  4748. AC_TRY_COMPILE([
  4749. #include <jni.h>
  4750. ],
  4751. [
  4752. #ifndef JNI_VERSION_1_2
  4753. Syntax Error
  4754. #endif
  4755. ],[ kde_jni_works=yes ],
  4756. [ kde_jni_works=no ])
  4757. if test $kde_jni_works = no; then
  4758. AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
  4759. You need to have Java Development Kit (JDK) version 1.2.
  4760. Use --with-java to specify another location.
  4761. Use --without-java to configure without java support.
  4762. Or download a newer JDK and try again.
  4763. See e.g. http://java.sun.com/products/jdk/1.2 ])
  4764. fi
  4765. CXXFLAGS="$ac_cxxflags_safe"
  4766. AC_LANG_RESTORE
  4767. dnl All tests ok, inform and subst the variables
  4768. JAVAC=$kde_java_bindir/javac
  4769. JAVAH=$kde_java_bindir/javah
  4770. JAR=$kde_java_bindir/jar
  4771. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4772. if test "x$kde_java_libgcjdir" = "x"; then
  4773. JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
  4774. else
  4775. JVMLIBS="-L$kde_java_libgcjdir -lgcj"
  4776. fi
  4777. AC_MSG_RESULT([java JDK in $kde_java_bindir])
  4778. else
  4779. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4780. AC_MSG_RESULT([java JRE in $kde_java_bindir])
  4781. fi
  4782. elif test -d "/Library/Java/Home"; then
  4783. kde_java_bindir="/Library/Java/Home/bin"
  4784. jni_includes="-I/Library/Java/Home/include"
  4785. JAVAC=$kde_java_bindir/javac
  4786. JAVAH=$kde_java_bindir/javah
  4787. JAR=$kde_java_bindir/jar
  4788. JVMLIBS="-Wl,-framework,JavaVM"
  4789. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4790. AC_MSG_RESULT([Apple Java Framework])
  4791. else
  4792. AC_MSG_RESULT([none found])
  4793. fi
  4794. AC_SUBST(JAVAC)
  4795. AC_SUBST(JAVAH)
  4796. AC_SUBST(JAR)
  4797. AC_SUBST(JVMLIBS)
  4798. AC_SUBST(jni_includes)
  4799. # for backward compat
  4800. kde_cv_java_includedir=$kde_java_includedir
  4801. kde_cv_java_bindir=$kde_java_bindir
  4802. ])
  4803. dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
  4804. dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
  4805. dnl big packages, m4_foreach is dog-slow. So use our own version of
  4806. dnl it. (matz@kde.org)
  4807. m4_define([mm_foreach],
  4808. [m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
  4809. m4_define([mm_car], [[$1]])
  4810. m4_define([mm_car2], [[$@]])
  4811. m4_define([_mm_foreach],
  4812. [m4_if(m4_quote($2), [], [],
  4813. [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
  4814. mm_car2(m4_shift($2)),
  4815. [$3])])])
  4816. m4_define([AC_FOREACH],
  4817. [mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
  4818. AC_DEFUN([KDE_NEED_FLEX],
  4819. [
  4820. kde_libs_safe=$LIBS
  4821. LIBS="$LIBS $USER_LDFLAGS"
  4822. AM_PROG_LEX
  4823. LIBS=$kde_libs_safe
  4824. if test -z "$LEXLIB"; then
  4825. AC_MSG_ERROR([You need to have flex installed.])
  4826. fi
  4827. AC_SUBST(LEXLIB)
  4828. ])
  4829. AC_DEFUN([AC_PATH_QTOPIA],
  4830. [
  4831. dnl TODO: use AC_CACHE_VAL
  4832. if test -z "$1"; then
  4833. qtopia_minver_maj=1
  4834. qtopia_minver_min=5
  4835. qtopia_minver_pat=0
  4836. else
  4837. qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
  4838. qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
  4839. qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
  4840. fi
  4841. qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
  4842. qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
  4843. AC_REQUIRE([AC_PATH_QT])
  4844. AC_MSG_CHECKING([for Qtopia])
  4845. LIB_QTOPIA="-lqpe"
  4846. AC_SUBST(LIB_QTOPIA)
  4847. kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
  4848. ac_qtopia_incdir=NO
  4849. AC_ARG_WITH(qtopia-dir,
  4850. AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]),
  4851. [ ac_qtopia_incdir="$withval"/include] )
  4852. qtopia_incdirs=""
  4853. for dir in $kde_qtopia_dirs; do
  4854. qtopia_incdirs="$qtopia_incdirs $dir/include"
  4855. done
  4856. if test ! "$ac_qtopia_incdir" = "NO"; then
  4857. qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
  4858. fi
  4859. qtopia_incdir=""
  4860. AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
  4861. ac_qtopia_incdir="$qtopia_incdir"
  4862. if test -z "$qtopia_incdir"; then
  4863. AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
  4864. fi
  4865. qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
  4866. qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
  4867. qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
  4868. qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
  4869. qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
  4870. if test "$qtopia_ver" -lt "$qtopia_minver"; then
  4871. AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
  4872. is required.])
  4873. fi
  4874. AC_LANG_SAVE
  4875. AC_LANG_CPLUSPLUS
  4876. ac_cxxflags_safe="$CXXFLAGS"
  4877. ac_ldflags_safe="$LDFLAGS"
  4878. ac_libs_safe="$LIBS"
  4879. CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
  4880. LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
  4881. LIBS="$LIBS $LIB_QTOPIA $LIBQT"
  4882. cat > conftest.$ac_ext <<EOF
  4883. #include "confdefs.h"
  4884. #include <qpe/qpeapplication.h>
  4885. #include <qpe/version.h>
  4886. int main( int argc, char **argv )
  4887. {
  4888. QPEApplication app( argc, argv );
  4889. return 0;
  4890. }
  4891. EOF
  4892. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  4893. rm -f conftest*
  4894. else
  4895. rm -f conftest*
  4896. AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
  4897. the end of config.log])
  4898. fi
  4899. CXXFLAGS="$ac_cxxflags_safe"
  4900. LDFLAGS="$ac_ldflags_safe"
  4901. LIBS="$ac_libs_safe"
  4902. AC_LANG_RESTORE
  4903. QTOPIA_INCLUDES="-I$qtopia_incdir"
  4904. AC_SUBST(QTOPIA_INCLUDES)
  4905. AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
  4906. ])
  4907. AC_DEFUN([KDE_INIT_DOXYGEN],
  4908. [
  4909. AC_MSG_CHECKING([for Qt docs])
  4910. kde_qtdir=
  4911. if test "${with_qt_dir+set}" = set; then
  4912. kde_qtdir="$with_qt_dir"
  4913. fi
  4914. 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)
  4915. AC_MSG_RESULT($QTDOCDIR)
  4916. AC_SUBST(QTDOCDIR)
  4917. KDE_FIND_PATH(dot, DOT, [], [])
  4918. if test -n "$DOT"; then
  4919. KDE_HAVE_DOT="YES"
  4920. else
  4921. KDE_HAVE_DOT="NO"
  4922. fi
  4923. AC_SUBST(KDE_HAVE_DOT)
  4924. KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
  4925. AC_SUBST(DOXYGEN)
  4926. DOXYGEN_PROJECT_NAME="$1"
  4927. DOXYGEN_PROJECT_NUMBER="$2"
  4928. AC_SUBST(DOXYGEN_PROJECT_NAME)
  4929. AC_SUBST(DOXYGEN_PROJECT_NUMBER)
  4930. KDE_HAS_DOXYGEN=no
  4931. if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then
  4932. KDE_HAS_DOXYGEN=yes
  4933. fi
  4934. AC_SUBST(KDE_HAS_DOXYGEN)
  4935. ])
  4936. AC_DEFUN([AC_FIND_BZIP2],
  4937. [
  4938. AC_MSG_CHECKING([for bzDecompress in libbz2])
  4939. AC_CACHE_VAL(ac_cv_lib_bzip2,
  4940. [
  4941. AC_LANG_SAVE
  4942. AC_LANG_CPLUSPLUS
  4943. kde_save_LIBS="$LIBS"
  4944. LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
  4945. kde_save_CXXFLAGS="$CXXFLAGS"
  4946. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  4947. AC_TRY_LINK(dnl
  4948. [
  4949. #define BZ_NO_STDIO
  4950. #include<bzlib.h>
  4951. ],
  4952. [ bz_stream s; (void) bzDecompress(&s); ],
  4953. eval "ac_cv_lib_bzip2='-lbz2'",
  4954. eval "ac_cv_lib_bzip2=no")
  4955. LIBS="$kde_save_LIBS"
  4956. CXXFLAGS="$kde_save_CXXFLAGS"
  4957. AC_LANG_RESTORE
  4958. ])dnl
  4959. AC_MSG_RESULT($ac_cv_lib_bzip2)
  4960. if test ! "$ac_cv_lib_bzip2" = no; then
  4961. BZIP2DIR=bzip2
  4962. LIBBZ2="$ac_cv_lib_bzip2"
  4963. AC_SUBST(LIBBZ2)
  4964. else
  4965. cxx_shared_flag=
  4966. ld_shared_flag=
  4967. KDE_CHECK_COMPILER_FLAG(shared, [
  4968. ld_shared_flag="-shared"
  4969. ])
  4970. KDE_CHECK_COMPILER_FLAG(fPIC, [
  4971. cxx_shared_flag="-fPIC"
  4972. ])
  4973. AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
  4974. AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
  4975. [
  4976. AC_LANG_SAVE
  4977. AC_LANG_CPLUSPLUS
  4978. kde_save_LIBS="$LIBS"
  4979. LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
  4980. kde_save_CXXFLAGS="$CXXFLAGS"
  4981. CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
  4982. AC_TRY_LINK(dnl
  4983. [
  4984. #define BZ_NO_STDIO
  4985. #include<bzlib.h>
  4986. ],
  4987. [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
  4988. eval "ac_cv_lib_bzip2_prefix='-lbz2'",
  4989. eval "ac_cv_lib_bzip2_prefix=no")
  4990. LIBS="$kde_save_LIBS"
  4991. CXXFLAGS="$kde_save_CXXFLAGS"
  4992. AC_LANG_RESTORE
  4993. ])dnl
  4994. AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
  4995. if test ! "$ac_cv_lib_bzip2_prefix" = no; then
  4996. BZIP2DIR=bzip2
  4997. LIBBZ2="$ac_cv_lib_bzip2_prefix"
  4998. AC_SUBST(LIBBZ2)
  4999. AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
  5000. dnl else, we just ignore this
  5001. fi
  5002. fi
  5003. AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
  5004. ])
  5005. dnl ------------------------------------------------------------------------
  5006. dnl Try to find the SSL headers and libraries.
  5007. dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
  5008. dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
  5009. dnl ------------------------------------------------------------------------
  5010. dnl
  5011. AC_DEFUN([KDE_CHECK_SSL],
  5012. [
  5013. LIBSSL="-lssl -lcrypto"
  5014. AC_REQUIRE([KDE_CHECK_LIB64])
  5015. ac_ssl_includes=NO ac_ssl_libraries=NO
  5016. ssl_libraries=""
  5017. ssl_includes=""
  5018. AC_ARG_WITH(ssl-dir,
  5019. AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]),
  5020. [ ac_ssl_includes="$withval"/include
  5021. ac_ssl_libraries="$withval"/lib$kdelibsuff
  5022. ])
  5023. want_ssl=yes
  5024. AC_ARG_WITH(ssl,
  5025. AC_HELP_STRING([--without-ssl],[disable SSL checks]),
  5026. [want_ssl=$withval])
  5027. if test $want_ssl = yes; then
  5028. AC_MSG_CHECKING(for OpenSSL)
  5029. AC_CACHE_VAL(ac_cv_have_ssl,
  5030. [#try to guess OpenSSL locations
  5031. ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
  5032. ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
  5033. AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
  5034. ac_ssl_includes="$ssl_incdir"
  5035. 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"
  5036. if test ! "$ac_ssl_libraries" = "NO"; then
  5037. ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
  5038. fi
  5039. test=NONE
  5040. ssl_libdir=NONE
  5041. for dir in $ssl_libdirs; do
  5042. try="ls -1 $dir/libssl*"
  5043. if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  5044. done
  5045. ac_ssl_libraries="$ssl_libdir"
  5046. ac_ldflags_safe="$LDFLAGS"
  5047. ac_libs_safe="$LIBS"
  5048. LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
  5049. LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
  5050. AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
  5051. ac_ssl_rsaref="yes"
  5052. ,
  5053. ac_ssl_rsaref="no"
  5054. )
  5055. LDFLAGS="$ac_ldflags_safe"
  5056. LIBS="$ac_libs_safe"
  5057. if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
  5058. have_ssl=no
  5059. else
  5060. have_ssl=yes;
  5061. fi
  5062. ])
  5063. eval "$ac_cv_have_ssl"
  5064. AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
  5065. AC_MSG_CHECKING([whether OpenSSL uses rsaref])
  5066. AC_MSG_RESULT($ac_ssl_rsaref)
  5067. AC_MSG_CHECKING([for easter eggs])
  5068. AC_MSG_RESULT([none found])
  5069. else
  5070. have_ssl=no
  5071. fi
  5072. if test "$have_ssl" = yes; then
  5073. AC_MSG_CHECKING(for OpenSSL version)
  5074. dnl Check for SSL version
  5075. AC_CACHE_VAL(ac_cv_ssl_version,
  5076. [
  5077. cat >conftest.$ac_ext <<EOF
  5078. #include <openssl/opensslv.h>
  5079. #include <stdio.h>
  5080. int main() {
  5081. #ifndef OPENSSL_VERSION_NUMBER
  5082. printf("ssl_version=\\"error\\"\n");
  5083. #else
  5084. if (OPENSSL_VERSION_NUMBER < 0x00906000)
  5085. printf("ssl_version=\\"old\\"\n");
  5086. else
  5087. printf("ssl_version=\\"ok\\"\n");
  5088. #endif
  5089. return (0);
  5090. }
  5091. EOF
  5092. ac_save_CPPFLAGS=$CPPFLAGS
  5093. if test "$ac_ssl_includes" != "/usr/include"; then
  5094. CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
  5095. fi
  5096. if AC_TRY_EVAL(ac_link); then
  5097. if eval `./conftest 2>&5`; then
  5098. if test $ssl_version = error; then
  5099. AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
  5100. else
  5101. if test $ssl_version = old; then
  5102. AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
  5103. have_ssl=no
  5104. fi
  5105. fi
  5106. ac_cv_ssl_version="ssl_version=$ssl_version"
  5107. else
  5108. AC_MSG_ERROR([Your system couldn't run a small SSL test program.
  5109. Check config.log, and if you can't figure it out, send a mail to
  5110. David Faure <faure@kde.org>, attaching your config.log])
  5111. fi
  5112. else
  5113. AC_MSG_ERROR([Your system couldn't link a small SSL test program.
  5114. Check config.log, and if you can't figure it out, send a mail to
  5115. David Faure <faure@kde.org>, attaching your config.log])
  5116. fi
  5117. CPPFLAGS=$ac_save_CPPFLAGS
  5118. ])
  5119. eval "$ac_cv_ssl_version"
  5120. AC_MSG_RESULT($ssl_version)
  5121. fi
  5122. if test "$have_ssl" != yes; then
  5123. LIBSSL="";
  5124. else
  5125. AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
  5126. ac_cv_have_ssl="have_ssl=yes \
  5127. ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
  5128. ssl_libraries="$ac_ssl_libraries"
  5129. ssl_includes="$ac_ssl_includes"
  5130. if test "$ac_ssl_rsaref" = yes; then
  5131. LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref"
  5132. fi
  5133. if test $ssl_version = "old"; then
  5134. AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
  5135. fi
  5136. fi
  5137. SSL_INCLUDES=
  5138. if test "$ssl_includes" = "/usr/include"; then
  5139. if test -f /usr/kerberos/include/krb5.h; then
  5140. SSL_INCLUDES="-I/usr/kerberos/include"
  5141. fi
  5142. elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
  5143. SSL_INCLUDES="-I$ssl_includes"
  5144. fi
  5145. if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
  5146. SSL_LDFLAGS=""
  5147. else
  5148. SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
  5149. fi
  5150. AC_SUBST(SSL_INCLUDES)
  5151. AC_SUBST(SSL_LDFLAGS)
  5152. AC_SUBST(LIBSSL)
  5153. ])
  5154. AC_DEFUN([KDE_CHECK_STRLCPY],
  5155. [
  5156. AC_REQUIRE([AC_CHECK_STRLCAT])
  5157. AC_REQUIRE([AC_CHECK_STRLCPY])
  5158. AC_CHECK_SIZEOF(size_t)
  5159. AC_CHECK_SIZEOF(unsigned long)
  5160. AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
  5161. AC_TRY_COMPILE(,[
  5162. #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
  5163. choke me
  5164. #endif
  5165. ],AC_MSG_RESULT([yes]),[
  5166. AC_MSG_RESULT(no)
  5167. AC_MSG_ERROR([
  5168. Apparently on your system our assumption sizeof size_t == sizeof unsigned long
  5169. does not apply. Please mail kde-devel@kde.org with a description of your system!
  5170. ])
  5171. ])
  5172. ])
  5173. AC_DEFUN([KDE_CHECK_BINUTILS],
  5174. [
  5175. AC_MSG_CHECKING([if ld supports unversioned version maps])
  5176. kde_save_LDFLAGS="$LDFLAGS"
  5177. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  5178. echo "{ local: extern \"C++\" { foo }; };" > conftest.map
  5179. AC_TRY_LINK([int foo;],
  5180. [
  5181. #ifdef __INTEL_COMPILER
  5182. icc apparently does not support libtools version-info and version-script
  5183. at the same time. Dunno where the bug is, but until somebody figured out,
  5184. better disable the optional version scripts.
  5185. #endif
  5186. foo = 42;
  5187. ], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
  5188. LDFLAGS="$kde_save_LDFLAGS"
  5189. rm -f conftest.map
  5190. AM_CONDITIONAL(include_VERSION_SCRIPT,
  5191. [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
  5192. AC_MSG_RESULT($kde_supports_versionmaps)
  5193. ])
  5194. AC_DEFUN([AM_PROG_OBJC],[
  5195. AC_CHECK_PROGS(OBJC, gcc, gcc)
  5196. test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
  5197. if test "x${OBJCFLAGS-unset}" = xunset; then
  5198. OBJCFLAGS="-g -O2"
  5199. fi
  5200. AC_SUBST(OBJCFLAGS)
  5201. _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
  5202. ])
  5203. AC_DEFUN([KDE_CHECK_PERL],
  5204. [
  5205. KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
  5206. AC_MSG_ERROR([No Perl found in your $PATH.
  5207. We need perl to generate some code.])
  5208. ])
  5209. AC_SUBST(PERL)
  5210. ])
  5211. AC_DEFUN([KDE_CHECK_LARGEFILE],
  5212. [
  5213. AC_SYS_LARGEFILE
  5214. if test "$ac_cv_sys_file_offset_bits" != no; then
  5215. CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
  5216. fi
  5217. if test "x$ac_cv_sys_large_files" != "xno"; then
  5218. CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1"
  5219. fi
  5220. ])
  5221. dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in)
  5222. dnl which allows to search for libs that get installed into the KDE prefix.
  5223. dnl
  5224. dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not)
  5225. dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page
  5226. dnl also defines KSTUFF_PKG_ERRORS on error
  5227. AC_DEFUN([KDE_PKG_CHECK_MODULES], [
  5228. PKG_CONFIG_PATH="$prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
  5229. if test "$prefix" != "$kde_libs_prefix"; then
  5230. PKG_CONFIG_PATH="$kde_libs_prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
  5231. fi
  5232. export PKG_CONFIG_PATH
  5233. PKG_CHECK_MODULES([$1],[$2],[$3],[$4])
  5234. ])
  5235. dnl Check for PIE support in the compiler and linker
  5236. AC_DEFUN([KDE_CHECK_PIE_SUPPORT],
  5237. [
  5238. AC_CACHE_CHECK([for PIE support], kde_cv_val_pie_support,
  5239. [
  5240. AC_LANG_SAVE
  5241. AC_LANG_CPLUSPLUS
  5242. safe_CXXFLAGS=$CXXFLAGS
  5243. safe_LDFLAGS=$LDFLAGS
  5244. CXXFLAGS="$CXXFLAGS -fPIE"
  5245. LDFLAGS="$LDFLAGS -pie"
  5246. AC_TRY_LINK([int foo;], [], [kde_cv_val_pie_support=yes], [kde_cv_val_pie_support=no])
  5247. CXXFLAGS=$safe_CXXFLAGS
  5248. LDFLAGS=$safe_LDFLAGS
  5249. AC_LANG_RESTORE
  5250. ])
  5251. AC_MSG_CHECKING(if enabling -pie/fPIE support)
  5252. AC_ARG_ENABLE(pie,
  5253. AC_HELP_STRING([--enable-pie],[platform supports PIE linking [default=detect]]),
  5254. [kde_has_pie_support=$enableval],
  5255. [kde_has_pie_support=detect])
  5256. if test "$kde_has_pie_support" = "detect"; then
  5257. kde_has_pie_support=$kde_cv_val_pie_support
  5258. fi
  5259. AC_MSG_RESULT([$kde_has_pie_support])
  5260. KDE_USE_FPIE=""
  5261. KDE_USE_PIE=""
  5262. AC_SUBST([KDE_USE_FPIE])
  5263. AC_SUBST([KDE_USE_PIE])
  5264. if test "$kde_has_pie_support" = "yes"; then
  5265. KDE_USE_FPIE="-fPIE"
  5266. KDE_USE_PIE="-pie"
  5267. fi
  5268. ])
  5269. # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
  5270. ## Copyright 1996, 1997, 1998, 1999, 2000, 2001
  5271. ## Free Software Foundation, Inc.
  5272. ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  5273. ##
  5274. ## This program is free software; you can redistribute it and/or modify
  5275. ## it under the terms of the GNU General Public License as published by
  5276. ## the Free Software Foundation; either version 2 of the License, or
  5277. ## (at your option) any later version.
  5278. ##
  5279. ## This program is distributed in the hope that it will be useful, but
  5280. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  5281. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  5282. ## General Public License for more details.
  5283. ##
  5284. ## You should have received a copy of the GNU General Public License
  5285. ## along with this program; if not, write to the Free Software
  5286. ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  5287. ##
  5288. ## As a special exception to the GNU General Public License, if you
  5289. ## distribute this file as part of a program that contains a
  5290. ## configuration script generated by Autoconf, you may include it under
  5291. ## the same distribution terms that you use for the rest of that program.
  5292. # serial 47 AC_PROG_LIBTOOL
  5293. # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
  5294. # -----------------------------------------------------------
  5295. # If this macro is not defined by Autoconf, define it here.
  5296. m4_ifdef([AC_PROVIDE_IFELSE],
  5297. [],
  5298. [m4_define([AC_PROVIDE_IFELSE],
  5299. [m4_ifdef([AC_PROVIDE_$1],
  5300. [$2], [$3])])])
  5301. # AC_PROG_LIBTOOL
  5302. # ---------------
  5303. AC_DEFUN([AC_PROG_LIBTOOL],
  5304. [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
  5305. dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
  5306. dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
  5307. AC_PROVIDE_IFELSE([AC_PROG_CXX],
  5308. [AC_LIBTOOL_CXX],
  5309. [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
  5310. ])])
  5311. dnl And a similar setup for Fortran 77 support
  5312. AC_PROVIDE_IFELSE([AC_PROG_F77],
  5313. [AC_LIBTOOL_F77],
  5314. [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
  5315. ])])
  5316. dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
  5317. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
  5318. dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
  5319. AC_PROVIDE_IFELSE([AC_PROG_GCJ],
  5320. [AC_LIBTOOL_GCJ],
  5321. [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
  5322. [AC_LIBTOOL_GCJ],
  5323. [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
  5324. [AC_LIBTOOL_GCJ],
  5325. [ifdef([AC_PROG_GCJ],
  5326. [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
  5327. ifdef([A][M_PROG_GCJ],
  5328. [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
  5329. ifdef([LT_AC_PROG_GCJ],
  5330. [define([LT_AC_PROG_GCJ],
  5331. defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
  5332. ])])# AC_PROG_LIBTOOL
  5333. # _AC_PROG_LIBTOOL
  5334. # ----------------
  5335. AC_DEFUN([_AC_PROG_LIBTOOL],
  5336. [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
  5337. AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
  5338. AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
  5339. AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
  5340. # This can be used to rebuild libtool when needed
  5341. LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
  5342. # Always use our own libtool.
  5343. LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
  5344. AC_SUBST(LIBTOOL)dnl
  5345. # Prevent multiple expansion
  5346. define([AC_PROG_LIBTOOL], [])
  5347. ])# _AC_PROG_LIBTOOL
  5348. # AC_LIBTOOL_SETUP
  5349. # ----------------
  5350. AC_DEFUN([AC_LIBTOOL_SETUP],
  5351. [AC_PREREQ(2.50)dnl
  5352. AC_REQUIRE([AC_ENABLE_SHARED])dnl
  5353. AC_REQUIRE([AC_ENABLE_STATIC])dnl
  5354. AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
  5355. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  5356. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  5357. AC_REQUIRE([AC_PROG_CC])dnl
  5358. AC_REQUIRE([AC_PROG_LD])dnl
  5359. AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
  5360. AC_REQUIRE([AC_PROG_NM])dnl
  5361. AC_REQUIRE([AC_PROG_LN_S])dnl
  5362. AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
  5363. # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
  5364. AC_REQUIRE([AC_OBJEXT])dnl
  5365. AC_REQUIRE([AC_EXEEXT])dnl
  5366. dnl
  5367. AC_LIBTOOL_SYS_MAX_CMD_LEN
  5368. AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
  5369. AC_LIBTOOL_OBJDIR
  5370. AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
  5371. _LT_AC_PROG_ECHO_BACKSLASH
  5372. case $host_os in
  5373. aix3*)
  5374. # AIX sometimes has problems with the GCC collect2 program. For some
  5375. # reason, if we set the COLLECT_NAMES environment variable, the problems
  5376. # vanish in a puff of smoke.
  5377. if test "X${COLLECT_NAMES+set}" != Xset; then
  5378. COLLECT_NAMES=
  5379. export COLLECT_NAMES
  5380. fi
  5381. ;;
  5382. esac
  5383. # Sed substitution that helps us do robust quoting. It backslashifies
  5384. # metacharacters that are still active within double-quoted strings.
  5385. Xsed='sed -e s/^X//'
  5386. [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
  5387. # Same as above, but do not quote variable references.
  5388. [double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
  5389. # Sed substitution to delay expansion of an escaped shell variable in a
  5390. # double_quote_subst'ed string.
  5391. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
  5392. # Sed substitution to avoid accidental globbing in evaled expressions
  5393. no_glob_subst='s/\*/\\\*/g'
  5394. # Constants:
  5395. rm="rm -f"
  5396. # Global variables:
  5397. default_ofile=libtool
  5398. can_build_shared=yes
  5399. # All known linkers require a `.a' archive for static linking (except M$VC,
  5400. # which needs '.lib').
  5401. libext=a
  5402. ltmain="$ac_aux_dir/ltmain.sh"
  5403. ofile="$default_ofile"
  5404. with_gnu_ld="$lt_cv_prog_gnu_ld"
  5405. AC_CHECK_TOOL(AR, ar, false)
  5406. AC_CHECK_TOOL(RANLIB, ranlib, :)
  5407. AC_CHECK_TOOL(STRIP, strip, :)
  5408. old_CC="$CC"
  5409. old_CFLAGS="$CFLAGS"
  5410. # Set sane defaults for various variables
  5411. test -z "$AR" && AR=ar
  5412. test -z "$AR_FLAGS" && AR_FLAGS=cru
  5413. test -z "$AS" && AS=as
  5414. test -z "$CC" && CC=cc
  5415. test -z "$LTCC" && LTCC=$CC
  5416. test -z "$DLLTOOL" && DLLTOOL=dlltool
  5417. test -z "$LD" && LD=ld
  5418. test -z "$LN_S" && LN_S="ln -s"
  5419. test -z "$MAGIC_CMD" && MAGIC_CMD=file
  5420. test -z "$NM" && NM=nm
  5421. test -z "$SED" && SED=sed
  5422. test -z "$OBJDUMP" && OBJDUMP=objdump
  5423. test -z "$RANLIB" && RANLIB=:
  5424. test -z "$STRIP" && STRIP=:
  5425. test -z "$ac_objext" && ac_objext=o
  5426. # Determine commands to create old-style static archives.
  5427. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
  5428. old_postinstall_cmds='chmod 644 $oldlib'
  5429. old_postuninstall_cmds=
  5430. if test -n "$RANLIB"; then
  5431. case $host_os in
  5432. openbsd*)
  5433. old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
  5434. ;;
  5435. *)
  5436. old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
  5437. ;;
  5438. esac
  5439. old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
  5440. fi
  5441. # Only perform the check for file, if the check method requires it
  5442. case $deplibs_check_method in
  5443. file_magic*)
  5444. if test "$file_magic_cmd" = '$MAGIC_CMD'; then
  5445. AC_PATH_MAGIC
  5446. fi
  5447. ;;
  5448. esac
  5449. AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
  5450. AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
  5451. enable_win32_dll=yes, enable_win32_dll=no)
  5452. AC_ARG_ENABLE([libtool-lock],
  5453. [AC_HELP_STRING([--disable-libtool-lock],
  5454. [avoid locking (might break parallel builds)])])
  5455. test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
  5456. AC_ARG_WITH([pic],
  5457. [AC_HELP_STRING([--with-pic],
  5458. [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
  5459. [pic_mode="$withval"],
  5460. [pic_mode=default])
  5461. test -z "$pic_mode" && pic_mode=default
  5462. # Use C for the default configuration in the libtool script
  5463. tagname=
  5464. AC_LIBTOOL_LANG_C_CONFIG
  5465. _LT_AC_TAGCONFIG
  5466. ])# AC_LIBTOOL_SETUP
  5467. # _LT_AC_SYS_COMPILER
  5468. # -------------------
  5469. AC_DEFUN([_LT_AC_SYS_COMPILER],
  5470. [AC_REQUIRE([AC_PROG_CC])dnl
  5471. # If no C compiler was specified, use CC.
  5472. LTCC=${LTCC-"$CC"}
  5473. # Allow CC to be a program name with arguments.
  5474. compiler=$CC
  5475. ])# _LT_AC_SYS_COMPILER
  5476. # _LT_AC_SYS_LIBPATH_AIX
  5477. # ----------------------
  5478. # Links a minimal program and checks the executable
  5479. # for the system default hardcoded library path. In most cases,
  5480. # this is /usr/lib:/lib, but when the MPI compilers are used
  5481. # the location of the communication and MPI libs are included too.
  5482. # If we don't find anything, use the default library path according
  5483. # to the aix ld manual.
  5484. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
  5485. [AC_LINK_IFELSE(AC_LANG_PROGRAM,[
  5486. aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
  5487. }'`
  5488. # Check for a 64-bit object if we didn't find anything.
  5489. 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; }
  5490. }'`; fi],[])
  5491. if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
  5492. ])# _LT_AC_SYS_LIBPATH_AIX
  5493. # _LT_AC_SHELL_INIT(ARG)
  5494. # ----------------------
  5495. AC_DEFUN([_LT_AC_SHELL_INIT],
  5496. [ifdef([AC_DIVERSION_NOTICE],
  5497. [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
  5498. [AC_DIVERT_PUSH(NOTICE)])
  5499. $1
  5500. AC_DIVERT_POP
  5501. ])# _LT_AC_SHELL_INIT
  5502. # _LT_AC_PROG_ECHO_BACKSLASH
  5503. # --------------------------
  5504. # Add some code to the start of the generated configure script which
  5505. # will find an echo command which doesn't interpret backslashes.
  5506. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
  5507. [_LT_AC_SHELL_INIT([
  5508. # Check that we are running under the correct shell.
  5509. SHELL=${CONFIG_SHELL-/bin/sh}
  5510. case X$ECHO in
  5511. X*--fallback-echo)
  5512. # Remove one level of quotation (which was required for Make).
  5513. ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
  5514. ;;
  5515. esac
  5516. echo=${ECHO-echo}
  5517. if test "X[$]1" = X--no-reexec; then
  5518. # Discard the --no-reexec flag, and continue.
  5519. shift
  5520. elif test "X[$]1" = X--fallback-echo; then
  5521. # Avoid inline document here, it may be left over
  5522. :
  5523. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
  5524. # Yippee, $echo works!
  5525. :
  5526. else
  5527. # Restart under the correct shell.
  5528. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
  5529. fi
  5530. if test "X[$]1" = X--fallback-echo; then
  5531. # used as fallback echo
  5532. shift
  5533. cat <<EOF
  5534. [$]*
  5535. EOF
  5536. exit 0
  5537. fi
  5538. # The HP-UX ksh and POSIX shell print the target directory to stdout
  5539. # if CDPATH is set.
  5540. if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
  5541. if test -z "$ECHO"; then
  5542. if test "X${echo_test_string+set}" != Xset; then
  5543. # find a string as large as possible, as long as the shell can cope with it
  5544. for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
  5545. # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
  5546. if (echo_test_string="`eval $cmd`") 2>/dev/null &&
  5547. echo_test_string="`eval $cmd`" &&
  5548. (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
  5549. then
  5550. break
  5551. fi
  5552. done
  5553. fi
  5554. if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
  5555. echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
  5556. test "X$echo_testing_string" = "X$echo_test_string"; then
  5557. :
  5558. else
  5559. # The Solaris, AIX, and Digital Unix default echo programs unquote
  5560. # backslashes. This makes it impossible to quote backslashes using
  5561. # echo "$something" | sed 's/\\/\\\\/g'
  5562. #
  5563. # So, first we look for a working echo in the user's PATH.
  5564. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
  5565. for dir in $PATH /usr/ucb; do
  5566. IFS="$lt_save_ifs"
  5567. if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
  5568. test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
  5569. echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
  5570. test "X$echo_testing_string" = "X$echo_test_string"; then
  5571. echo="$dir/echo"
  5572. break
  5573. fi
  5574. done
  5575. IFS="$lt_save_ifs"
  5576. if test "X$echo" = Xecho; then
  5577. # We didn't find a better echo, so look for alternatives.
  5578. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
  5579. echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
  5580. test "X$echo_testing_string" = "X$echo_test_string"; then
  5581. # This shell has a builtin print -r that does the trick.
  5582. echo='print -r'
  5583. elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
  5584. test "X$CONFIG_SHELL" != X/bin/ksh; then
  5585. # If we have ksh, try running configure again with it.
  5586. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
  5587. export ORIGINAL_CONFIG_SHELL
  5588. CONFIG_SHELL=/bin/ksh
  5589. export CONFIG_SHELL
  5590. exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
  5591. else
  5592. # Try using printf.
  5593. echo='printf %s\n'
  5594. if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
  5595. echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
  5596. test "X$echo_testing_string" = "X$echo_test_string"; then
  5597. # Cool, printf works
  5598. :
  5599. elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
  5600. test "X$echo_testing_string" = 'X\t' &&
  5601. echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
  5602. test "X$echo_testing_string" = "X$echo_test_string"; then
  5603. CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
  5604. export CONFIG_SHELL
  5605. SHELL="$CONFIG_SHELL"
  5606. export SHELL
  5607. echo="$CONFIG_SHELL [$]0 --fallback-echo"
  5608. elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
  5609. test "X$echo_testing_string" = 'X\t' &&
  5610. echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
  5611. test "X$echo_testing_string" = "X$echo_test_string"; then
  5612. echo="$CONFIG_SHELL [$]0 --fallback-echo"
  5613. else
  5614. # maybe with a smaller string...
  5615. prev=:
  5616. for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
  5617. if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
  5618. then
  5619. break
  5620. fi
  5621. prev="$cmd"
  5622. done
  5623. if test "$prev" != 'sed 50q "[$]0"'; then
  5624. echo_test_string=`eval $prev`
  5625. export echo_test_string
  5626. exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
  5627. else
  5628. # Oops. We lost completely, so just stick with echo.
  5629. echo=echo
  5630. fi
  5631. fi
  5632. fi
  5633. fi
  5634. fi
  5635. fi
  5636. # Copy echo and quote the copy suitably for passing to libtool from
  5637. # the Makefile, instead of quoting the original, which is used later.
  5638. ECHO=$echo
  5639. if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
  5640. ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
  5641. fi
  5642. AC_SUBST(ECHO)
  5643. ])])# _LT_AC_PROG_ECHO_BACKSLASH
  5644. # _LT_AC_LOCK
  5645. # -----------
  5646. AC_DEFUN([_LT_AC_LOCK],
  5647. [AC_ARG_ENABLE([libtool-lock],
  5648. [AC_HELP_STRING([--disable-libtool-lock],
  5649. [avoid locking (might break parallel builds)])])
  5650. test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
  5651. # Some flags need to be propagated to the compiler or linker for good
  5652. # libtool support.
  5653. case $host in
  5654. ia64-*-hpux*)
  5655. # Find out which ABI we are using.
  5656. echo 'int i;' > conftest.$ac_ext
  5657. if AC_TRY_EVAL(ac_compile); then
  5658. case `/usr/bin/file conftest.$ac_objext` in
  5659. *ELF-32*)
  5660. HPUX_IA64_MODE="32"
  5661. ;;
  5662. *ELF-64*)
  5663. HPUX_IA64_MODE="64"
  5664. ;;
  5665. esac
  5666. fi
  5667. rm -rf conftest*
  5668. ;;
  5669. *-*-irix6*)
  5670. # Find out which ABI we are using.
  5671. echo '[#]line __oline__ "configure"' > conftest.$ac_ext
  5672. if AC_TRY_EVAL(ac_compile); then
  5673. if test "$lt_cv_prog_gnu_ld" = yes; then
  5674. case `/usr/bin/file conftest.$ac_objext` in
  5675. *32-bit*)
  5676. LD="${LD-ld} -melf32bsmip"
  5677. ;;
  5678. *N32*)
  5679. LD="${LD-ld} -melf32bmipn32"
  5680. ;;
  5681. *64-bit*)
  5682. LD="${LD-ld} -melf64bmip"
  5683. ;;
  5684. esac
  5685. else
  5686. case `/usr/bin/file conftest.$ac_objext` in
  5687. *32-bit*)
  5688. LD="${LD-ld} -32"
  5689. ;;
  5690. *N32*)
  5691. LD="${LD-ld} -n32"
  5692. ;;
  5693. *64-bit*)
  5694. LD="${LD-ld} -64"
  5695. ;;
  5696. esac
  5697. fi
  5698. fi
  5699. rm -rf conftest*
  5700. ;;
  5701. x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
  5702. # Find out which ABI we are using.
  5703. echo 'int i;' > conftest.$ac_ext
  5704. if AC_TRY_EVAL(ac_compile); then
  5705. case "`/usr/bin/file conftest.o`" in
  5706. *32-bit*)
  5707. LINUX_64_MODE="32"
  5708. case $host in
  5709. x86_64-*linux*)
  5710. LD="${LD-ld} -m elf_i386"
  5711. ;;
  5712. ppc64-*linux*)
  5713. LD="${LD-ld} -m elf32ppclinux"
  5714. ;;
  5715. s390x-*linux*)
  5716. LD="${LD-ld} -m elf_s390"
  5717. ;;
  5718. sparc64-*linux*)
  5719. LD="${LD-ld} -m elf32_sparc"
  5720. ;;
  5721. esac
  5722. ;;
  5723. *64-bit*)
  5724. LINUX_64_MODE="64"
  5725. case $host in
  5726. x86_64-*linux*)
  5727. LD="${LD-ld} -m elf_x86_64"
  5728. ;;
  5729. ppc*-*linux*|powerpc*-*linux*)
  5730. LD="${LD-ld} -m elf64ppc"
  5731. ;;
  5732. s390*-*linux*)
  5733. LD="${LD-ld} -m elf64_s390"
  5734. ;;
  5735. sparc*-*linux*)
  5736. LD="${LD-ld} -m elf64_sparc"
  5737. ;;
  5738. esac
  5739. ;;
  5740. esac
  5741. fi
  5742. rm -rf conftest*
  5743. ;;
  5744. *-*-sco3.2v5*)
  5745. # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  5746. SAVE_CFLAGS="$CFLAGS"
  5747. CFLAGS="$CFLAGS -belf"
  5748. AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
  5749. [AC_LANG_PUSH(C)
  5750. AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
  5751. AC_LANG_POP])
  5752. if test x"$lt_cv_cc_needs_belf" != x"yes"; then
  5753. # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
  5754. CFLAGS="$SAVE_CFLAGS"
  5755. fi
  5756. ;;
  5757. AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
  5758. [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
  5759. AC_CHECK_TOOL(DLLTOOL, dlltool, false)
  5760. AC_CHECK_TOOL(AS, as, false)
  5761. AC_CHECK_TOOL(OBJDUMP, objdump, false)
  5762. ;;
  5763. ])
  5764. esac
  5765. need_locks="$enable_libtool_lock"
  5766. ])# _LT_AC_LOCK
  5767. # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
  5768. # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
  5769. # ----------------------------------------------------------------
  5770. # Check whether the given compiler option works
  5771. AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
  5772. [AC_REQUIRE([LT_AC_PROG_SED])
  5773. AC_CACHE_CHECK([$1], [$2],
  5774. [$2=no
  5775. ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
  5776. printf "$lt_simple_compile_test_code" > conftest.$ac_ext
  5777. lt_compiler_flag="$3"
  5778. # Insert the option either (1) after the last *FLAGS variable, or
  5779. # (2) before a word containing "conftest.", or (3) at the end.
  5780. # Note that $ac_compile itself does not contain backslashes and begins
  5781. # with a dollar sign (not a hyphen), so the echo should work correctly.
  5782. # The option is referenced via a variable to avoid confusing sed.
  5783. lt_compile=`echo "$ac_compile" | $SED \
  5784. -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
  5785. -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
  5786. -e 's:$: $lt_compiler_flag:'`
  5787. (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
  5788. (eval "$lt_compile" 2>conftest.err)
  5789. ac_status=$?
  5790. cat conftest.err >&AS_MESSAGE_LOG_FD
  5791. echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
  5792. if (exit $ac_status) && test -s "$ac_outfile"; then
  5793. # The compiler can only warn and ignore the option if not recognized
  5794. # So say no if there are warnings
  5795. if test ! -s conftest.err; then
  5796. $2=yes
  5797. fi
  5798. fi
  5799. $rm conftest*
  5800. ])
  5801. if test x"[$]$2" = xyes; then
  5802. ifelse([$5], , :, [$5])
  5803. else
  5804. ifelse([$6], , :, [$6])
  5805. fi
  5806. ])# AC_LIBTOOL_COMPILER_OPTION
  5807. # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
  5808. # [ACTION-SUCCESS], [ACTION-FAILURE])
  5809. # ------------------------------------------------------------
  5810. # Check whether the given compiler option works
  5811. AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
  5812. [AC_CACHE_CHECK([$1], [$2],
  5813. [$2=no
  5814. save_LDFLAGS="$LDFLAGS"
  5815. LDFLAGS="$LDFLAGS $3"
  5816. printf "$lt_simple_link_test_code" > conftest.$ac_ext
  5817. if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
  5818. # The compiler can only warn and ignore the option if not recognized
  5819. # So say no if there are warnings
  5820. if test -s conftest.err; then
  5821. # Append any errors to the config.log.
  5822. cat conftest.err 1>&AS_MESSAGE_LOG_FD
  5823. else
  5824. $2=yes
  5825. fi
  5826. fi
  5827. $rm conftest*
  5828. LDFLAGS="$save_LDFLAGS"
  5829. ])
  5830. if test x"[$]$2" = xyes; then
  5831. ifelse([$4], , :, [$4])
  5832. else
  5833. ifelse([$5], , :, [$5])
  5834. fi
  5835. ])# AC_LIBTOOL_LINKER_OPTION
  5836. # AC_LIBTOOL_SYS_MAX_CMD_LEN
  5837. # --------------------------
  5838. AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
  5839. [# find the maximum length of command line arguments
  5840. AC_MSG_CHECKING([the maximum length of command line arguments])
  5841. AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
  5842. i=0
  5843. testring="ABCD"
  5844. case $build_os in
  5845. msdosdjgpp*)
  5846. # On DJGPP, this test can blow up pretty badly due to problems in libc
  5847. # (any single argument exceeding 2000 bytes causes a buffer overrun
  5848. # during glob expansion). Even if it were fixed, the result of this
  5849. # check would be larger than it should be.
  5850. lt_cv_sys_max_cmd_len=12288; # 12K is about right
  5851. ;;
  5852. gnu*)
  5853. # Under GNU Hurd, this test is not required because there is
  5854. # no limit to the length of command line arguments.
  5855. # Libtool will interpret -1 as no limit whatsoever
  5856. lt_cv_sys_max_cmd_len=-1;
  5857. ;;
  5858. cygwin* | mingw*)
  5859. # On Win9x/ME, this test blows up -- it succeeds, but takes
  5860. # about 5 minutes as the teststring grows exponentially.
  5861. # Worse, since 9x/ME are not pre-emptively multitasking,
  5862. # you end up with a "frozen" computer, even though with patience
  5863. # the test eventually succeeds (with a max line length of 256k).
  5864. # Instead, let's just punt: use the minimum linelength reported by
  5865. # all of the supported platforms: 8192 (on NT/2K/XP).
  5866. lt_cv_sys_max_cmd_len=8192;
  5867. ;;
  5868. *)
  5869. # If test is not a shell built-in, we'll probably end up computing a
  5870. # maximum length that is only half of the actual maximum length, but
  5871. # we can't tell.
  5872. while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \
  5873. = "XX$testring") >/dev/null 2>&1 &&
  5874. new_result=`expr "X$testring" : ".*" 2>&1` &&
  5875. lt_cv_sys_max_cmd_len=$new_result &&
  5876. test $i != 17 # 1/2 MB should be enough
  5877. do
  5878. i=`expr $i + 1`
  5879. testring=$testring$testring
  5880. done
  5881. testring=
  5882. # Add a significant safety factor because C++ compilers can tack on massive
  5883. # amounts of additional arguments before passing them to the linker.
  5884. # It appears as though 1/2 is a usable value.
  5885. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
  5886. ;;
  5887. esac
  5888. ])
  5889. if test -n $lt_cv_sys_max_cmd_len ; then
  5890. AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
  5891. else
  5892. AC_MSG_RESULT(none)
  5893. fi
  5894. ])# AC_LIBTOOL_SYS_MAX_CMD_LEN
  5895. # _LT_AC_CHECK_DLFCN
  5896. # --------------------
  5897. AC_DEFUN([_LT_AC_CHECK_DLFCN],
  5898. [AC_CHECK_HEADERS(dlfcn.h)dnl
  5899. ])# _LT_AC_CHECK_DLFCN
  5900. # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
  5901. # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
  5902. # ------------------------------------------------------------------
  5903. AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
  5904. [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
  5905. if test "$cross_compiling" = yes; then :
  5906. [$4]
  5907. else
  5908. lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  5909. lt_status=$lt_dlunknown
  5910. cat > conftest.$ac_ext <<EOF
  5911. [#line __oline__ "configure"
  5912. #include "confdefs.h"
  5913. #if HAVE_DLFCN_H
  5914. #include <dlfcn.h>
  5915. #endif
  5916. #include <stdio.h>
  5917. #ifdef RTLD_GLOBAL
  5918. # define LT_DLGLOBAL RTLD_GLOBAL
  5919. #else
  5920. # ifdef DL_GLOBAL
  5921. # define LT_DLGLOBAL DL_GLOBAL
  5922. # else
  5923. # define LT_DLGLOBAL 0
  5924. # endif
  5925. #endif
  5926. /* We may have to define LT_DLLAZY_OR_NOW in the command line if we
  5927. find out it does not work in some platform. */
  5928. #ifndef LT_DLLAZY_OR_NOW
  5929. # ifdef RTLD_LAZY
  5930. # define LT_DLLAZY_OR_NOW RTLD_LAZY
  5931. # else
  5932. # ifdef DL_LAZY
  5933. # define LT_DLLAZY_OR_NOW DL_LAZY
  5934. # else
  5935. # ifdef RTLD_NOW
  5936. # define LT_DLLAZY_OR_NOW RTLD_NOW
  5937. # else
  5938. # ifdef DL_NOW
  5939. # define LT_DLLAZY_OR_NOW DL_NOW
  5940. # else
  5941. # define LT_DLLAZY_OR_NOW 0
  5942. # endif
  5943. # endif
  5944. # endif
  5945. # endif
  5946. #endif
  5947. #ifdef __cplusplus
  5948. extern "C" void exit (int);
  5949. #endif
  5950. void fnord() { int i=42;}
  5951. int main ()
  5952. {
  5953. void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
  5954. int status = $lt_dlunknown;
  5955. if (self)
  5956. {
  5957. if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
  5958. else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
  5959. /* dlclose (self); */
  5960. }
  5961. exit (status);
  5962. }]
  5963. EOF
  5964. if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
  5965. (./conftest; exit; ) 2>/dev/null
  5966. lt_status=$?
  5967. case x$lt_status in
  5968. x$lt_dlno_uscore) $1 ;;
  5969. x$lt_dlneed_uscore) $2 ;;
  5970. x$lt_unknown|x*) $3 ;;
  5971. esac
  5972. else :
  5973. # compilation failed
  5974. $3
  5975. fi
  5976. fi
  5977. rm -fr conftest*
  5978. ])# _LT_AC_TRY_DLOPEN_SELF
  5979. # AC_LIBTOOL_DLOPEN_SELF
  5980. # -------------------
  5981. AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
  5982. [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
  5983. if test "x$enable_dlopen" != xyes; then
  5984. enable_dlopen=unknown
  5985. enable_dlopen_self=unknown
  5986. enable_dlopen_self_static=unknown
  5987. else
  5988. lt_cv_dlopen=no
  5989. lt_cv_dlopen_libs=
  5990. case $host_os in
  5991. beos*)
  5992. lt_cv_dlopen="load_add_on"
  5993. lt_cv_dlopen_libs=
  5994. lt_cv_dlopen_self=yes
  5995. ;;
  5996. mingw* | pw32*)
  5997. lt_cv_dlopen="LoadLibrary"
  5998. lt_cv_dlopen_libs=
  5999. ;;
  6000. cygwin*)
  6001. lt_cv_dlopen="dlopen"
  6002. lt_cv_dlopen_libs=
  6003. ;;
  6004. darwin*)
  6005. # if libdl is installed we need to link against it
  6006. AC_CHECK_LIB([dl], [dlopen],
  6007. [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
  6008. lt_cv_dlopen="dyld"
  6009. lt_cv_dlopen_libs=
  6010. lt_cv_dlopen_self=yes
  6011. ])
  6012. ;;
  6013. *)
  6014. AC_CHECK_FUNC([shl_load],
  6015. [lt_cv_dlopen="shl_load"],
  6016. [AC_CHECK_LIB([dld], [shl_load],
  6017. [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
  6018. [AC_CHECK_FUNC([dlopen],
  6019. [lt_cv_dlopen="dlopen"],
  6020. [AC_CHECK_LIB([dl], [dlopen],
  6021. [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
  6022. [AC_CHECK_LIB([svld], [dlopen],
  6023. [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
  6024. [AC_CHECK_LIB([dld], [dld_link],
  6025. [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
  6026. ])
  6027. ])
  6028. ])
  6029. ])
  6030. ])
  6031. ;;
  6032. esac
  6033. if test "x$lt_cv_dlopen" != xno; then
  6034. enable_dlopen=yes
  6035. else
  6036. enable_dlopen=no
  6037. fi
  6038. case $lt_cv_dlopen in
  6039. dlopen)
  6040. save_CPPFLAGS="$CPPFLAGS"
  6041. test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
  6042. save_LDFLAGS="$LDFLAGS"
  6043. eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
  6044. save_LIBS="$LIBS"
  6045. LIBS="$lt_cv_dlopen_libs $LIBS"
  6046. AC_CACHE_CHECK([whether a program can dlopen itself],
  6047. lt_cv_dlopen_self, [dnl
  6048. _LT_AC_TRY_DLOPEN_SELF(
  6049. lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
  6050. lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
  6051. ])
  6052. if test "x$lt_cv_dlopen_self" = xyes; then
  6053. LDFLAGS="$LDFLAGS $link_static_flag"
  6054. AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
  6055. lt_cv_dlopen_self_static, [dnl
  6056. _LT_AC_TRY_DLOPEN_SELF(
  6057. lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
  6058. lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
  6059. ])
  6060. fi
  6061. CPPFLAGS="$save_CPPFLAGS"
  6062. LDFLAGS="$save_LDFLAGS"
  6063. LIBS="$save_LIBS"
  6064. ;;
  6065. esac
  6066. case $lt_cv_dlopen_self in
  6067. yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
  6068. *) enable_dlopen_self=unknown ;;
  6069. esac
  6070. case $lt_cv_dlopen_self_static in
  6071. yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
  6072. *) enable_dlopen_self_static=unknown ;;
  6073. esac
  6074. fi
  6075. ])# AC_LIBTOOL_DLOPEN_SELF
  6076. # AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
  6077. # ---------------------------------
  6078. # Check to see if options -c and -o are simultaneously supported by compiler
  6079. AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
  6080. [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
  6081. AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
  6082. [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
  6083. [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
  6084. $rm -r conftest 2>/dev/null
  6085. mkdir conftest
  6086. cd conftest
  6087. mkdir out
  6088. printf "$lt_simple_compile_test_code" > conftest.$ac_ext
  6089. # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
  6090. # that will create temporary files in the current directory regardless of
  6091. # the output directory. Thus, making CWD read-only will cause this test
  6092. # to fail, enabling locking or at least warning the user not to do parallel
  6093. # builds.
  6094. chmod -w .
  6095. lt_compiler_flag="-o out/conftest2.$ac_objext"
  6096. # Insert the option either (1) after the last *FLAGS variable, or
  6097. # (2) before a word containing "conftest.", or (3) at the end.
  6098. # Note that $ac_compile itself does not contain backslashes and begins
  6099. # with a dollar sign (not a hyphen), so the echo should work correctly.
  6100. lt_compile=`echo "$ac_compile" | $SED \
  6101. -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
  6102. -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
  6103. -e 's:$: $lt_compiler_flag:'`
  6104. (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
  6105. (eval "$lt_compile" 2>out/conftest.err)
  6106. ac_status=$?
  6107. cat out/conftest.err >&AS_MESSAGE_LOG_FD
  6108. echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
  6109. if (exit $ac_status) && test -s out/conftest2.$ac_objext
  6110. then
  6111. # The compiler can only warn and ignore the option if not recognized
  6112. # So say no if there are warnings
  6113. if test ! -s out/conftest.err; then
  6114. _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
  6115. fi
  6116. fi
  6117. chmod u+w .
  6118. $rm conftest* out/*
  6119. rmdir out
  6120. cd ..
  6121. rmdir conftest
  6122. $rm conftest*
  6123. ])
  6124. ])# AC_LIBTOOL_PROG_CC_C_O
  6125. # AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
  6126. # -----------------------------------------
  6127. # Check to see if we can do hard links to lock some files if needed
  6128. AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
  6129. [AC_REQUIRE([_LT_AC_LOCK])dnl
  6130. hard_links="nottested"
  6131. if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
  6132. # do not overwrite the value of need_locks provided by the user
  6133. AC_MSG_CHECKING([if we can lock with hard links])
  6134. hard_links=yes
  6135. $rm conftest*
  6136. ln conftest.a conftest.b 2>/dev/null && hard_links=no
  6137. touch conftest.a
  6138. ln conftest.a conftest.b 2>&5 || hard_links=no
  6139. ln conftest.a conftest.b 2>/dev/null && hard_links=no
  6140. AC_MSG_RESULT([$hard_links])
  6141. if test "$hard_links" = no; then
  6142. AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
  6143. need_locks=warn
  6144. fi
  6145. else
  6146. need_locks=no
  6147. fi
  6148. ])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
  6149. # AC_LIBTOOL_OBJDIR
  6150. # -----------------
  6151. AC_DEFUN([AC_LIBTOOL_OBJDIR],
  6152. [AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
  6153. [rm -f .libs 2>/dev/null
  6154. mkdir .libs 2>/dev/null
  6155. if test -d .libs; then
  6156. lt_cv_objdir=.libs
  6157. else
  6158. # MS-DOS does not allow filenames that begin with a dot.
  6159. lt_cv_objdir=_libs
  6160. fi
  6161. rmdir .libs 2>/dev/null])
  6162. objdir=$lt_cv_objdir
  6163. ])# AC_LIBTOOL_OBJDIR
  6164. # AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
  6165. # ----------------------------------------------
  6166. # Check hardcoding attributes.
  6167. AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
  6168. [AC_MSG_CHECKING([how to hardcode library paths into programs])
  6169. _LT_AC_TAGVAR(hardcode_action, $1)=
  6170. if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
  6171. test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
  6172. test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
  6173. # We can hardcode non-existant directories.
  6174. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
  6175. # If the only mechanism to avoid hardcoding is shlibpath_var, we
  6176. # have to relink, otherwise we might link with an installed library
  6177. # when we should be linking with a yet-to-be-installed one
  6178. ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
  6179. test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
  6180. # Linking always hardcodes the temporary library directory.
  6181. _LT_AC_TAGVAR(hardcode_action, $1)=relink
  6182. else
  6183. # We can link without hardcoding, and we can hardcode nonexisting dirs.
  6184. _LT_AC_TAGVAR(hardcode_action, $1)=immediate
  6185. fi
  6186. else
  6187. # We cannot hardcode anything, or else we can only hardcode existing
  6188. # directories.
  6189. _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
  6190. fi
  6191. AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
  6192. if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
  6193. # Fast installation is not supported
  6194. enable_fast_install=no
  6195. elif test "$shlibpath_overrides_runpath" = yes ||
  6196. test "$enable_shared" = no; then
  6197. # Fast installation is not necessary
  6198. enable_fast_install=needless
  6199. fi
  6200. ])