Shared admin folder
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

6916 líneas
188 KiB

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