TDE System Settings – easy to use control center
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.
 
 
 
 
 
 

13266 lines
419 KiB

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