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