1dnl 2dnl Autoconf configuration file for APR 3dnl 4dnl Process this file with autoconf to produce a configure script. 5dnl Use ./buildconf to prepare build files and run autoconf for APR. 6 7AC_PREREQ(2.59) 8 9AC_INIT(build/apr_common.m4) 10AC_CONFIG_HEADER(include/arch/unix/apr_private.h) 11AC_CONFIG_AUX_DIR(build) 12AC_CONFIG_MACRO_DIR(build) 13 14dnl 15dnl Include our own M4 macros along with those for libtool 16dnl 17sinclude(build/apr_common.m4) 18sinclude(build/apr_network.m4) 19sinclude(build/apr_threads.m4) 20sinclude(build/apr_win32.m4) 21sinclude(build/apr_hints.m4) 22sinclude(build/libtool.m4) 23sinclude(build/ltsugar.m4) 24sinclude(build/argz.m4) 25sinclude(build/ltoptions.m4) 26sinclude(build/ltversion.m4) 27sinclude(build/lt~obsolete.m4) 28 29dnl Hard-coded top of apr_private.h: 30AH_TOP([ 31#ifndef APR_PRIVATE_H 32#define APR_PRIVATE_H 33]) 34 35dnl Hard-coded inclusion at the tail end of apr_private.h: 36AH_BOTTOM([ 37/* switch this on if we have a BeOS version below BONE */ 38#if defined(BEOS) && !defined(HAVE_BONE_VERSION) 39#define BEOS_R5 1 40#else 41#define BEOS_BONE 1 42#endif 43 44/* 45 * Darwin 10's default compiler (gcc42) builds for both 64 and 46 * 32 bit architectures unless specifically told not to. 47 * In those cases, we need to override types depending on how 48 * we're being built at compile time. 49 * NOTE: This is an ugly work-around for Darwin's 50 * concept of universal binaries, a single package 51 * (executable, lib, etc...) which contains both 32 52 * and 64 bit versions. The issue is that if APR is 53 * built universally, if something else is compiled 54 * against it, some bit sizes will depend on whether 55 * it is 32 or 64 bit. This is determined by the __LP64__ 56 * flag. Since we need to support both, we have to 57 * handle OS X unqiuely. 58 */ 59#ifdef DARWIN_10 60 61#undef APR_OFF_T_STRFN 62#undef APR_INT64_STRFN 63#undef SIZEOF_LONG 64#undef SIZEOF_SIZE_T 65#undef SIZEOF_SSIZE_T 66#undef SIZEOF_VOIDP 67#undef SIZEOF_STRUCT_IOVEC 68 69#ifdef __LP64__ 70 #define APR_INT64_STRFN strtol 71 #define SIZEOF_LONG 8 72 #define SIZEOF_SIZE_T 8 73 #define SIZEOF_SSIZE_T 8 74 #define SIZEOF_VOIDP 8 75 #define SIZEOF_STRUCT_IOVEC 16 76#else 77 #define APR_INT64_STRFN strtoll 78 #define SIZEOF_LONG 4 79 #define SIZEOF_SIZE_T 4 80 #define SIZEOF_SSIZE_T 4 81 #define SIZEOF_VOIDP 4 82 #define SIZEOF_STRUCT_IOVEC 8 83#endif 84 85#undef APR_OFF_T_STRFN 86#define APR_OFF_T_STRFN APR_INT64_STRFN 87 88 89#undef SETPGRP_VOID 90#ifdef __DARWIN_UNIX03 91 #define SETPGRP_VOID 1 92#else 93/* #undef SETPGRP_VOID */ 94#endif 95 96#endif /* DARWIN_10 */ 97 98/* 99 * Include common private declarations. 100 */ 101#include "../apr_private_common.h" 102#endif /* APR_PRIVATE_H */ 103]) 104 105dnl Save user-defined environment settings for later restoration 106dnl 107APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) 108APR_SAVE_THE_ENVIRONMENT(CFLAGS) 109APR_SAVE_THE_ENVIRONMENT(LDFLAGS) 110APR_SAVE_THE_ENVIRONMENT(LIBS) 111APR_SAVE_THE_ENVIRONMENT(INCLUDES) 112 113dnl Generate ./config.nice for reproducing runs of configure 114dnl 115APR_CONFIG_NICE(config.nice) 116 117AC_CANONICAL_SYSTEM 118echo "Configuring APR library" 119echo "Platform: $host" 120 121dnl Some initial steps for configuration. We setup the default directory 122dnl and which files are to be configured. 123 124dnl Setup the directory macros now 125 126# Absolute source/build directory 127apr_srcdir=`(cd $srcdir && pwd)` 128apr_builddir=`pwd` 129AC_SUBST(apr_srcdir) 130AC_SUBST(apr_builddir) 131 132if test "$apr_builddir" != "$apr_srcdir"; then 133 USE_VPATH=1 134 APR_CONFIG_LOCATION=build 135else 136 APR_CONFIG_LOCATION=source 137fi 138 139AC_SUBST(APR_CONFIG_LOCATION) 140 141# Libtool might need this symbol -- it must point to the location of 142# the generated libtool script (not necessarily the "top" build dir). 143# 144top_builddir="$apr_builddir" 145AC_SUBST(top_builddir) 146 147# Directory containing apr build macros, helpers, and make rules 148# NOTE: make rules (apr_rules.mk) will be in the builddir for vpath 149# 150apr_buildout=$apr_builddir/build 151apr_builders=$apr_srcdir/build 152AC_SUBST(apr_builders) 153 154MKDIR=$apr_builders/mkdir.sh 155 156dnl Initialize mkdir -p functionality. 157APR_MKDIR_P_CHECK($apr_builders/mkdir.sh) 158 159# get our version information 160get_version="$apr_builders/get-version.sh" 161version_hdr="$apr_srcdir/include/apr_version.h" 162APR_MAJOR_VERSION="`$get_version major $version_hdr APR`" 163APR_DOTTED_VERSION="`$get_version all $version_hdr APR`" 164 165AC_SUBST(APR_DOTTED_VERSION) 166AC_SUBST(APR_MAJOR_VERSION) 167 168echo "APR Version: ${APR_DOTTED_VERSION}" 169 170dnl Enable the layout handling code, then reparse the prefix-style 171dnl arguments due to autoconf being a PITA. 172APR_ENABLE_LAYOUT(apr) 173APR_PARSE_ARGUMENTS 174 175dnl Set optional CC hints here in case autoconf makes an inappropriate choice. 176dnl This allows us to suggest what the compiler should be, but still 177dnl allows the user to override CC externally. 178APR_CC_HINTS 179 180dnl Do the various CC checks *before* preloading values. The preload code 181dnl may need to use compiler characteristics to make decisions. This macro 182dnl can only be used once within a configure script, so this prevents a 183dnl preload section from invoking the macro to get compiler info. 184AC_PROG_CC 185 186dnl AC_PROG_SED is only avaliable in recent autoconf versions. 187dnl Use AC_CHECK_PROG instead if AC_PROG_SED is not present. 188ifdef([AC_PROG_SED], 189 [AC_PROG_SED], 190 [AC_CHECK_PROG(SED, sed, sed)]) 191 192dnl Preload 193APR_PRELOAD 194 195dnl These added to allow default directories to be used... 196DEFAULT_OSDIR="unix" 197echo "(Default will be ${DEFAULT_OSDIR})" 198 199apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random" 200 201dnl Checks for programs. 202AC_PROG_MAKE_SET 203AC_PROG_CPP 204AC_PROG_AWK 205AC_PROG_LN_S 206AC_PROG_RANLIB 207AC_PROG_INSTALL 208AC_CHECK_PROG(RM, rm, rm) 209AC_CHECK_PROG(AS, as, as) 210AC_CHECK_PROG(ASCPP, cpp, cpp) 211AC_CHECK_TOOL(AR, ar, ar) 212 213dnl Various OS checks that apparently set required flags 214ifdef([AC_USE_SYSTEM_EXTENSIONS], [ 215AC_USE_SYSTEM_EXTENSIONS 216], [ 217AC_AIX 218AC_MINIX 219]) 220 221AC_ISC_POSIX 222APR_EBCDIC 223 224dnl this is our library name 225APR_LIBNAME="apr${libsuffix}" 226AC_SUBST(APR_LIBNAME) 227 228dnl prep libtool 229dnl 230echo "performing libtool configuration..." 231 232AC_ARG_ENABLE(experimental-libtool,[ --enable-experimental-libtool Use experimental custom libtool], 233 [experimental_libtool=$enableval],[experimental_libtool=no]) 234 235dnl Workarounds for busted Libtool 2.x when we don't call AC_PROG_LIBTOOL 236if test "x$Xsed" = "x"; then 237 Xsed="$SED -e 1s/^X//" 238fi 239 240case $host in 241*-os2*) 242 # Use a custom-made libtool replacement 243 echo "using aplibtool" 244 LIBTOOL="$srcdir/build/aplibtool" 245 gcc $CFLAGS $CPPFLAGS -o $LIBTOOL.exe $LIBTOOL.c 246 ;; 247*) 248 if test "x$LTFLAGS" = "x"; then 249 LTFLAGS='--silent' 250 fi 251 if test "$experimental_libtool" = "yes"; then 252 # Use a custom-made libtool replacement 253 echo "using jlibtool" 254 LIBTOOL="$apr_builddir/libtool" 255 LIBTOOL_SRC="$apr_srcdir/build/jlibtool.c" 256 $CC $CFLAGS $CPPFLAGS -o $LIBTOOL $LIBTOOL_SRC 257 eval `$apr_builddir/libtool --config | grep "^shlibpath_var=[[A-Z_]]*$"` 258 if test "x$shlibpath_var" = "x"; then 259 shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR 260 fi 261 else 262 dnl libtoolize requires that the following not be indented 263 dnl should become LT_INIT(win32-dll) 264AC_LIBTOOL_WIN32_DLL 265AC_PROG_LIBTOOL 266 # get libtool's setting of shlibpath_var 267 if test "x$shlibpath_var" = "x"; then 268 eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool` 269 fi 270 if test "x$shlibpath_var" = "x"; then 271 AC_MSG_NOTICE([SHLIBPATH variable could not be determined]) 272 shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR 273 fi 274 fi 275 ;; 276esac 277 278AC_ARG_WITH(installbuilddir, [ --with-installbuilddir=DIR location to store APR build files], 279 [ installbuilddir=$withval ] ) 280AC_SUBST(installbuilddir) 281 282AC_ARG_WITH(libtool, [ --without-libtool avoid using libtool to link the library], 283 [ use_libtool=$withval ], [ use_libtool="yes" ] ) 284 285if test "x$use_libtool" = "xyes"; then 286 lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@' 287 LT_VERSION="-version-info `$get_version libtool $version_hdr APR`" 288 link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(COMPILE) \$(LT_LDFLAGS) \$(LT_VERSION) \$(ALL_LDFLAGS) -o \$@" 289 so_ext='lo' 290 lib_target='-rpath $(libdir) $(OBJECTS)' 291 export_lib_target='-rpath \$(libdir) \$(OBJECTS)' 292else 293 lt_compile='$(COMPILE) -o $@ -c $<' 294 link='$(AR) cr $(TARGET_LIB) $(OBJECTS); $(RANLIB) $(TARGET_LIB)' 295 so_ext='o' 296 lib_target='' 297 export_lib_target='' 298fi 299 300case $host in 301 *-solaris2*) 302 apr_platform_runtime_link_flag="-R" 303 ;; 304 *-mingw* | *-cygwin*) 305 LT_LDFLAGS="$LT_LDFLAGS -no-undefined" 306 ;; 307 *) 308 ;; 309esac 310 311AC_SUBST(lt_compile) 312AC_SUBST(link) 313AC_SUBST(so_ext) 314AC_SUBST(lib_target) 315AC_SUBST(export_lib_target) 316AC_SUBST(shlibpath_var) 317AC_SUBST(LTFLAGS) 318AC_SUBST(LT_LDFLAGS) 319AC_SUBST(LT_VERSION) 320 321dnl ----------------------------- Checks for compiler flags 322nl=' 323' 324echo "${nl}Check for compiler flags..." 325 326dnl AC_PROG_CC sets -g in CFLAGS (and -O2 for gcc) by default. 327dnl On OS/390 this causes the compiler to insert extra debugger 328dnl hook instructions. That's fine for debug/maintainer builds, not fine 329dnl otherwise. 330 331case $host in 332 *os390) 333 if test "$ac_test_CFLAGS" != set; then 334 APR_REMOVEFROM(CFLAGS,-g) 335 fi 336 ;; 337esac 338 339AC_ARG_ENABLE(debug,[ --enable-debug Turn on debugging and compile time warnings], 340 [APR_ADDTO(CFLAGS,-g) 341 if test "$GCC" = "yes"; then 342 APR_ADDTO(CFLAGS,-Wall) 343 elif test "$AIX_XLC" = "yes"; then 344 APR_ADDTO(CFLAGS,-qfullpath) 345 fi 346])dnl 347 348AC_ARG_ENABLE(maintainer-mode,[ --enable-maintainer-mode Turn on debugging and compile time warnings], 349 [APR_ADDTO(CFLAGS,-g) 350 if test "$GCC" = "yes"; then 351 APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations]) 352 case `($CC --version) 2>/dev/null` in 353 *clang-900* | *"clang version 5.0.0"*) 354 APR_ADDTO(CFLAGS,[-Wno-error=strict-prototypes]) 355 ;; 356 esac 357 elif test "$AIX_XLC" = "yes"; then 358 APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro) 359 fi 360])dnl 361 362AC_ARG_ENABLE(profile,[ --enable-profile Turn on profiling for the build (GCC)], 363 if test "$GCC" = "yes"; then 364 APR_ADDTO(CFLAGS, -pg) 365 APR_REMOVEFROM(CFLAGS, -g) 366 if test "$host" = "i586-pc-beos"; then 367 APR_REMOVEFROM(CFLAGS, -O2) 368 APR_ADDTO(CFLAGS, -O1) 369 APR_ADDTO(LDFLAGS, -p) 370 fi 371 fi 372)dnl 373 374AC_ARG_ENABLE(pool-debug, 375 [ --enable-pool-debug[[=yes|no|verbose|verbose-alloc|lifetime|owner|all]] Turn on pools debugging], 376 [ if test -z "$enableval"; then 377 APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=1) 378 elif test ! "$enableval" = "no"; then 379 apr_pool_debug=1 380 381 for i in $enableval 382 do 383 flag=0 384 385 case $i in 386 yes) 387 flag=1 388 ;; 389 verbose) 390 flag=2 391 ;; 392 lifetime) 393 flag=4 394 ;; 395 owner) 396 flag=8 397 ;; 398 verbose-alloc) 399 flag=16 400 ;; 401 all) 402 apr_pool_debug=31 403 ;; 404 *) 405 ;; 406 esac 407 408 if test $flag -gt 0; then 409 apr_pool_debug=`expr '(' $apr_pool_debug - $apr_pool_debug % \ 410 '(' $flag '*' 2 ')' ')' + $flag + $apr_pool_debug % $flag` 411 fi 412 done 413 414 APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=$apr_pool_debug) 415 fi 416 ]) 417 418if test "$host" = "i586-pc-beos"; then 419 AC_ARG_ENABLE(malloc-debug,[ --enable-malloc-debug Switch on malloc_debug for BeOS], 420 APR_REMOVEFROM(CFLAGS, -O2) 421 APR_ADDTO(CPPFLAGS, -fcheck-memory-usage -D_KERNEL_MODE) 422 ) dnl 423fi 424 425# this is the place to put specific options for platform/compiler 426# combinations 427case "$host:$CC" in 428 *-hp-hpux*:cc ) 429 APR_ADDTO(CFLAGS,[-Ae +Z]) 430 case $host in 431 ia64-* ) 432 ;; 433 * ) 434 if echo "$CFLAGS " | grep '+DA' >/dev/null; then : 435 else 436 APR_ADDTO(CFLAGS,[+DAportable]) 437 fi 438 ;; 439 esac 440 ;; 441 powerpc-*-beos:mwcc* ) 442 APR_SETVAR(CPP,[mwcc -E]) 443 APR_SETVAR(CC,mwcc) 444 APR_SETVAR(AR,ar) 445 ;; 446 dnl If building static APR, both the APR build and the app build 447 dnl need -DAPR_DECLARE_STATIC to generate the right linkage from 448 dnl APR_DECLARE et al. 449 dnl If building dynamic APR, the APR build needs APR_DECLARE_EXPORT 450 dnl and the app build should have neither define. 451 *-mingw* | *-cygwin*) 452 if test "$enable_shared" = "yes"; then 453 APR_ADDTO(INTERNAL_CPPFLAGS, -DAPR_DECLARE_EXPORT) 454 else 455 APR_ADDTO(CPPFLAGS, -DAPR_DECLARE_STATIC) 456 fi 457 ;; 458esac 459 460AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins], 461[AC_TRY_RUN([ 462int main() 463{ 464 unsigned long val = 1010, tmp, *mem = &val; 465 466 if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) 467 return 1; 468 469 tmp = val; 470 471 if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) 472 return 1; 473 474 if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) 475 return 1; 476 477 tmp = 3030; 478 479 if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) 480 return 1; 481 482 if (__sync_lock_test_and_set(&val, 4040) != 3030) 483 return 1; 484 485 mem = &tmp; 486 487 if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) 488 return 1; 489 490 __sync_synchronize(); 491 492 if (mem != &val) 493 return 1; 494 495 return 0; 496}], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])]) 497 498if test "$ap_cv_atomic_builtins" = "yes"; then 499 AC_DEFINE(HAVE_ATOMIC_BUILTINS, 1, [Define if compiler provides atomic builtins]) 500fi 501 502case $host in 503 powerpc-405-*) 504 # The IBM ppc405cr processor has a bugged stwcx instruction. 505 AC_DEFINE(PPC405_ERRATA, 1, [Define on PowerPC 405 where errata 77 applies]) 506 ;; 507 *) 508 ;; 509esac 510 511dnl Check the depend program we can use 512APR_CHECK_DEPEND 513 514proc_mutex_is_global=0 515 516config_subdirs="none" 517INSTALL_SUBDIRS="none" 518OBJECTS_PLATFORM='$(OBJECTS_unix)' 519 520case $host in 521 i386-ibm-aix* | *-ibm-aix[[1-2]].* | *-ibm-aix3.* | *-ibm-aix4.1 | *-ibm-aix4.1.* | *-ibm-aix4.2 | *-ibm-aix4.2.*) 522 OSDIR="aix" 523 APR_ADDTO(LDFLAGS,-lld) 524 eolstr="\\n" 525 OBJECTS_PLATFORM='$(OBJECTS_aix)' 526 ;; 527 *-os2*) 528 APR_ADDTO(CPPFLAGS,-DOS2) 529 APR_ADDTO(CFLAGS,-Zmt) 530 AC_CHECK_LIB(bsd, random) 531 OSDIR="os2" 532 enable_threads="system_threads" 533 eolstr="\\r\\n" 534 file_as_socket="0" 535 proc_mutex_is_global=1 536 OBJECTS_PLATFORM='$(OBJECTS_os2)' 537 ;; 538 *beos*) 539 OSDIR="beos" 540 APR_ADDTO(CPPFLAGS,-DBEOS) 541 enable_threads="system_threads" 542 native_mmap_emul="1" 543 APR_CHECK_DEFINE(BONE_VERSION, sys/socket.h) 544 eolstr="\\n" 545 osver=`uname -r` 546 proc_mutex_is_global=1 547 OBJECTS_PLATFORM='$(OBJECTS_beos)' 548 case $osver in 549 5.0.4) 550 file_as_socket="1" 551 ;; 552 *) 553 file_as_socket="0" 554 ;; 555 esac 556 ;; 557 *apple-darwin*) 558 ac_cv_func_fdatasync="no" # Mac OS X wrongly reports it has fdatasync() 559 OSDIR="unix" 560 eolstr="\\n" 561 ;; 562 *os390) 563 OSDIR="os390" 564 OBJECTS_PLATFORM='$(OBJECTS_os390)' 565 eolstr="\\n" 566 ;; 567 *os400) 568 OSDIR="as400" 569 eolstr="\\n" 570 ;; 571 *mingw*) 572 OSDIR="win32" 573 enable_threads="system_threads" 574 eolstr="\\r\\n" 575 file_as_socket=0 576 proc_mutex_is_global=1 577 OBJECTS_PLATFORM='$(OBJECTS_win32)' 578 ;; 579 *cygwin*) 580 OSDIR="unix" 581 enable_threads="no" 582 eolstr="\\n" 583 ;; 584 *hpux10* ) 585 enable_threads="no" 586 OSDIR="unix" 587 eolstr="\\n" 588 ;; 589 *darwin* ) 590 ac_cv_func_fdatasync="no" # Mac OS X wrongly reports it has fdatasync() 591 OSDIR="unix" 592 eolstr="\\n" 593 ;; 594 *) 595 OSDIR="unix" 596 eolstr="\\n" 597 ;; 598esac 599 600AC_SUBST(OBJECTS_PLATFORM) 601 602# Check whether LFS has explicitly been disabled 603AC_ARG_ENABLE(lfs,[ --disable-lfs Disable large file support on 32-bit platforms], 604[apr_lfs_choice=$enableval], [apr_lfs_choice=yes]) 605 606if test "$apr_lfs_choice" = "yes"; then 607 # Check whether the transitional LFS API is sufficient 608 AC_CACHE_CHECK([whether to enable -D_LARGEFILE64_SOURCE], [apr_cv_use_lfs64], [ 609 apr_save_CPPFLAGS=$CPPFLAGS 610 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" 611 AC_TRY_RUN([ 612#include <sys/types.h> 613#include <sys/stat.h> 614#include <fcntl.h> 615#include <stdlib.h> 616#include <stdio.h> 617#include <unistd.h> 618 619void main(void) 620{ 621 int fd, ret = 0; 622 struct stat64 st; 623 off64_t off = 4242; 624 625 if (sizeof(off64_t) != 8 || sizeof(off_t) != 4) 626 exit(1); 627 if ((fd = open("conftest.lfs", O_LARGEFILE|O_CREAT|O_WRONLY, 0644)) < 0) 628 exit(2); 629 if (ftruncate64(fd, off) != 0) 630 ret = 3; 631 else if (fstat64(fd, &st) != 0 || st.st_size != off) 632 ret = 4; 633 else if (lseek64(fd, off, SEEK_SET) != off) 634 ret = 5; 635 else if (close(fd) != 0) 636 ret = 6; 637 else if (lstat64("conftest.lfs", &st) != 0 || st.st_size != off) 638 ret = 7; 639 else if (stat64("conftest.lfs", &st) != 0 || st.st_size != off) 640 ret = 8; 641 unlink("conftest.lfs"); 642 643 exit(ret); 644}], [apr_cv_use_lfs64=yes], [apr_cv_use_lfs64=no], [apr_cv_use_lfs64=no]) 645 CPPFLAGS=$apr_save_CPPFLAGS]) 646 if test "$apr_cv_use_lfs64" = "yes"; then 647 APR_ADDTO(CPPFLAGS, [-D_LARGEFILE64_SOURCE]) 648 fi 649fi 650 651AC_ARG_ENABLE(nonportable-atomics, 652[ --enable-nonportable-atomics Use optimized atomic code which may produce nonportable binaries], 653[if test $enableval = yes; then 654 force_generic_atomics=no 655 else 656 force_generic_atomics=yes 657 fi 658], 659[case $host_cpu in 660 i[[456]]86) force_generic_atomics=yes ;; 661 *) force_generic_atomics=no 662 case $host in 663 *solaris2.10*) 664 AC_TRY_COMPILE( 665 [#include <atomic.h>], 666 [void *ptr = NULL; atomic_cas_ptr(&ptr, NULL, NULL);],, 667 [force_generic_atomics=yes] 668 ) 669 if test $force_generic_atomics = yes; then 670 AC_MSG_NOTICE([nonportable atomic support disabled, system needs Patch-ID 118884 or 118885]) 671 fi 672 ;; 673 esac 674 ;; 675esac 676]) 677 678if test $force_generic_atomics = yes; then 679 AC_DEFINE([USE_ATOMICS_GENERIC], 1, 680 [Define if use of generic atomics is requested]) 681fi 682 683AC_SUBST(proc_mutex_is_global) 684AC_SUBST(eolstr) 685AC_SUBST(INSTALL_SUBDIRS) 686 687# For some platforms we need a version string which allows easy numeric 688# comparisons. 689case $host in 690 *freebsd*) 691 if test -x /sbin/sysctl; then 692 os_version=`/sbin/sysctl -n kern.osreldate` 693 else 694 os_version=000000 695 fi 696 ;; 697 *linux*) 698 os_major=[`uname -r | sed -e 's/\([1-9][0-9]*\)\..*/\1/'`] 699 os_minor=[`uname -r | sed -e 's/[1-9][0-9]*\.\([0-9]\+\)\..*/\1/'`] 700 if test $os_major -lt 2 -o \( $os_major -eq 2 -a $os_minor -lt 4 \); then 701 AC_MSG_WARN([Configured for pre-2.4 Linux $os_major.$os_minor]) 702 os_pre24linux=1 703 else 704 os_pre24linux=0 705 AC_MSG_NOTICE([Configured for Linux $os_major.$os_minor]) 706 fi 707 ;; 708 *os390) 709 os_version=`uname -r | sed -e 's/\.//g'` 710 ;; 711 *) 712 os_version=OS_VERSION_IS_NOT_SET 713 ;; 714esac 715 716echo "${nl}Checking for libraries..." 717 718dnl ----------------------------- Checks for Any required Libraries 719dnl Note: Autoconf will always append LIBS with an extra " " in AC_CHECK_LIB. 720dnl It should check for LIBS being empty and set LIBS equal to the new value 721dnl without the extra " " in that case, but they didn't do that. So, we 722dnl end up LIBS="-lm -lcrypt -lnsl -ldl" which is an annoyance. 723case $host in 724 *mingw*) 725 APR_ADDTO(LIBS,[-lshell32 -ladvapi32 -lws2_32 -lrpcrt4 -lmswsock]) 726 ac_cv_func_CreateFileMapping=yes 727 ;; 728 *) 729 AC_SEARCH_LIBS(gethostbyname, nsl) 730 AC_SEARCH_LIBS(gethostname, nsl) 731 AC_SEARCH_LIBS(socket, socket) 732 AC_SEARCH_LIBS(crypt, crypt ufc) 733 AC_CHECK_LIB(truerand, main) 734 AC_SEARCH_LIBS(modf, m) 735 ;; 736esac 737 738dnl ----------------------------- Checking for Threads 739echo "${nl}Checking for Threads..." 740 741if test -z "$enable_threads"; then 742 AC_ARG_ENABLE(threads, 743 [ --enable-threads Enable threading support in APR.], 744 [ enable_threads=$enableval] , 745 [ APR_CHECK_PTHREADS_H([ enable_threads="pthread" ] , 746 [ enable_threads="no" ] ) ] ) 747fi 748 749if test "$enable_threads" = "no"; then 750 threads="0" 751 pthreadh="0" 752 pthreadser="0" 753else 754 if test "$enable_threads" = "pthread"; then 755# We have specified pthreads for our threading library, just make sure 756# that we have everything we need 757 APR_PTHREADS_CHECK_SAVE 758 APR_PTHREADS_CHECK 759 APR_CHECK_PTHREADS_H([ 760 threads="1" 761 pthreadh="1" 762 pthreadser="1" ], [ 763 threads="0" 764 pthreadh="0" 765 pthreadser="0" 766 APR_PTHREADS_CHECK_RESTORE ] ) 767 elif test "$enable_threads" = "system_threads"; then 768 threads="1" 769 pthreadh="0" 770 pthreadser="0" 771 else 772# We basically specified that we wanted threads, but not how to implement 773# them. In this case, just look for pthreads. In the future, we can check 774# for other threading libraries as well. 775 APR_PTHREADS_CHECK_SAVE 776 APR_PTHREADS_CHECK 777 APR_CHECK_PTHREADS_H([ 778 threads="1" 779 pthreadh="1" 780 pthreadser="1" ], [ 781 threads="0" 782 pthreadser="0" 783 pthreadh="0" 784 APR_PTHREADS_CHECK_RESTORE ] ) 785 fi 786 if test "$pthreadh" = "1"; then 787 APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS 788 APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG 789 APR_CHECK_PTHREAD_RECURSIVE_MUTEX 790 AC_CHECK_FUNCS([pthread_key_delete pthread_rwlock_init \ 791 pthread_attr_setguardsize pthread_yield]) 792 793 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then 794 dnl ----------------------------- Checking for pthread_rwlock_t 795 AC_CACHE_CHECK([for pthread_rwlock_t], [apr_cv_type_rwlock_t], 796 AC_TRY_COMPILE([#include <sys/types.h> 797#include <pthread.h>], [pthread_rwlock_t *rwlock;], 798 [apr_cv_type_rwlock_t=yes], [apr_cv_type_rwlock_t=no], 799 [apr_cv_type_rwlock_t=no])) 800 if test "$apr_cv_type_rwlock_t" = "yes"; then 801 AC_DEFINE(HAVE_PTHREAD_RWLOCKS, 1, [Define if pthread rwlocks are available]) 802 fi 803 fi 804 805 if test "$ac_cv_func_pthread_yield" = "no"; then 806 dnl ----------------------------- Checking for sched_yield 807 AC_CHECK_HEADERS([sched.h]) 808 AC_CHECK_FUNCS([sched_yield]) 809 fi 810 fi 811fi 812 813ac_cv_define_READDIR_IS_THREAD_SAFE=yes 814ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no 815ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no 816ac_cv_define_GETSERVBYNAME_IS_THREAD_SAFE=no 817if test "$threads" = "1"; then 818 echo "APR will use threads" 819 AC_DEFINE(READDIR_IS_THREAD_SAFE, 1, [Modern readdir is thread safe]) 820 if test "x$apr_gethostbyname_is_thread_safe" = "x"; then 821 AC_CHECK_LIB(c_r, gethostbyname, apr_gethostbyname_is_thread_safe=yes) 822 fi 823 if test "$apr_gethostbyname_is_thread_safe" = "yes"; then 824 AC_DEFINE(GETHOSTBYNAME_IS_THREAD_SAFE, 1, 825 [Define if gethostbyname is thread safe]) 826 fi 827 if test "x$apr_gethostbyaddr_is_thread_safe" = "x"; then 828 AC_CHECK_LIB(c_r, gethostbyaddr, apr_gethostbyaddr_is_thread_safe=yes) 829 fi 830 if test "$apr_gethostbyaddr_is_thread_safe" = "yes"; then 831 AC_DEFINE(GETHOSTBYADDR_IS_THREAD_SAFE, 1, 832 [Define if gethostbyaddr is thread safe]) 833 fi 834 if test "x$apr_getservbyname_is_thread_safe" = "x"; then 835 AC_CHECK_LIB(c_r, getservbyname, apr_getservbyname_is_thread_safe=yes) 836 fi 837 if test "$apr_getservbyname_is_thread_safe" = "yes"; then 838 AC_DEFINE(GETSERVBYNAME_IS_THREAD_SAFE, 1, 839 [Define if getservbyname is thread safe]) 840 fi 841 AC_CHECK_FUNCS(gethostbyname_r gethostbyaddr_r getservbyname_r) 842else 843 echo "APR will be non-threaded" 844fi 845 846dnl Electric Fence malloc checker. 847dnl --with-efence specifies the path to Electric Fence. 848dnl This test should remain after the threads checks since libefence 849dnl may depend on libpthread. 850AC_ARG_WITH(efence, 851 [ --with-efence[[=DIR]] path to Electric Fence installation], 852 [ apr_efence_dir="$withval" 853 if test "$apr_efence_dir" != "yes"; then 854 APR_ADDTO(LDFLAGS,[-L$apr_efence_dir/lib]) 855 if test "x$apr_platform_runtime_link_flag" != "x"; then 856 APR_ADDTO(LDFLAGS, 857 [$apr_platform_runtime_link_flag$apr_efence_dir/lib]) 858 fi 859 fi 860 AC_CHECK_LIB(efence, malloc, 861 [ APR_ADDTO(LIBS,-lefence) ], 862 [ AC_MSG_ERROR(Electric Fence requested but not detected) ]) 863 ]) 864 865AC_ARG_WITH(valgrind, 866 [ --with-valgrind[[=DIR]] Enable code to teach valgrind about apr pools 867 (optionally: set path to valgrind headers) ], 868 [ if test "$withval" != no; then 869 if test "$withval" = yes; then 870 withval=/usr/include/valgrind 871 fi 872 APR_ADDTO(CPPFLAGS, -I$withval) 873 AC_CHECK_HEADERS(valgrind.h memcheck.h) 874 APR_IFALLYES(header:valgrind.h header:memcheck.h, 875 [AC_DEFINE(HAVE_VALGRIND, 1, [Compile in valgrind support]) ], 876 [AC_MSG_ERROR(valgrind headers not found) ] 877 ) 878 fi ] 879) 880 881AC_CHECK_FUNCS(sigsuspend, [ have_sigsuspend="1" ], [ have_sigsuspend="0" ]) 882AC_CHECK_FUNCS(sigwait, [ have_sigwait="1" ], [ have_sigwait="0" ]) 883dnl AC_CHECK_FUNCS doesn't work for this on Tru64 since the function 884dnl is renamed in signal.h. Todo: Autodetect 885case $host in 886 *alpha*-dec-osf* ) 887 have_sigwait="1" 888 ;; 889esac 890 891AC_SUBST(threads) 892AC_SUBST(have_sigsuspend) 893AC_SUBST(have_sigwait) 894 895AC_CHECK_FUNCS(poll kqueue port_create) 896 897# Check for the Linux epoll interface; epoll* may be available in libc 898# but return ENOSYS on a pre-2.6 kernel, so do a run-time check. 899AC_CACHE_CHECK([for epoll support], [apr_cv_epoll], 900[AC_TRY_RUN([ 901#include <sys/epoll.h> 902#include <unistd.h> 903 904int main() 905{ 906 return epoll_create(5) == -1; 907}], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])]) 908 909if test "$apr_cv_epoll" = "yes"; then 910 AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported]) 911fi 912 913dnl ----------------------------- Checking for extended file descriptor handling 914# test for epoll_create1 915AC_CACHE_CHECK([for epoll_create1 support], [apr_cv_epoll_create1], 916[AC_TRY_RUN([ 917#include <sys/epoll.h> 918#include <unistd.h> 919 920int main() 921{ 922 return epoll_create1(0) == -1; 923}], [apr_cv_epoll_create1=yes], [apr_cv_epoll_create1=no], [apr_cv_epoll_create1=no])]) 924 925if test "$apr_cv_epoll_create1" = "yes"; then 926 AC_DEFINE([HAVE_EPOLL_CREATE1], 1, [Define if epoll_create1 function is supported]) 927fi 928 929# test for dup3 930AC_CACHE_CHECK([for dup3 support], [apr_cv_dup3], 931[AC_TRY_RUN([ 932#include <unistd.h> 933 934int main() 935{ 936 return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1; 937}], [apr_cv_dup3=yes], [apr_cv_dup3=no], [apr_cv_dup3=no])]) 938 939if test "$apr_cv_dup3" = "yes"; then 940 AC_DEFINE([HAVE_DUP3], 1, [Define if dup3 function is supported]) 941fi 942 943# Test for accept4(). Create a non-blocking socket, bind it to 944# an unspecified port & address (kernel picks), and attempt to 945# call accept4() on it. If the syscall is wired up (i.e. the 946# kernel is new enough), it should return EAGAIN. 947AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4], 948[AC_TRY_RUN([ 949#include <sys/types.h> 950#include <sys/socket.h> 951#include <sys/wait.h> 952#include <netinet/in.h> 953#include <netinet/tcp.h> 954#include <errno.h> 955#include <string.h> 956#include <unistd.h> 957#include <fcntl.h> 958 959int main(int argc, char **argv) 960{ 961 int fd, flags; 962 struct sockaddr_in sin; 963 964 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) 965 return 1; 966 flags = fcntl(fd, F_GETFL); 967 if (flags == -1 || fcntl(fd, F_SETFL, flags|O_NONBLOCK) == -1) 968 return 5; 969 970 memset(&sin, 0, sizeof sin); 971 sin.sin_family = AF_INET; 972 973 if (bind(fd, (struct sockaddr *) &sin, sizeof sin) == -1) 974 return 2; 975 976 if (listen(fd, 5) == -1) 977 return 3; 978 979 if (accept4(fd, NULL, 0, SOCK_NONBLOCK) == 0 980 || errno == EAGAIN || errno == EWOULDBLOCK) 981 return 0; 982 983 return 4; 984}], [apr_cv_accept4=yes], [apr_cv_accept4=no], [apr_cv_accept4=no])]) 985 986if test "$apr_cv_accept4" = "yes"; then 987 AC_DEFINE([HAVE_ACCEPT4], 1, [Define if accept4 function is supported]) 988fi 989 990AC_CACHE_CHECK([for SOCK_CLOEXEC support], [apr_cv_sock_cloexec], 991[AC_TRY_RUN([ 992#include <sys/types.h> 993#include <sys/socket.h> 994 995int main() 996{ 997 return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1; 998}], [apr_cv_sock_cloexec=yes], [apr_cv_sock_cloexec=no], [apr_cv_sock_cloexec=no])]) 999 1000if test "$apr_cv_sock_cloexec" = "yes"; then 1001 AC_DEFINE([HAVE_SOCK_CLOEXEC], 1, [Define if the SOCK_CLOEXEC flag is supported]) 1002fi 1003 1004dnl ----------------------------- Checking for fdatasync: OS X doesn't have it 1005AC_CHECK_FUNCS(fdatasync) 1006 1007dnl ----------------------------- Checking for extended file descriptor handling 1008# test for epoll_create1 1009AC_CACHE_CHECK([for epoll_create1 support], [apr_cv_epoll_create1], 1010[AC_TRY_RUN([ 1011#include <sys/epoll.h> 1012#include <unistd.h> 1013 1014int main() 1015{ 1016 return epoll_create1(0) == -1; 1017}], [apr_cv_epoll_create1=yes], [apr_cv_epoll_create1=no], [apr_cv_epoll_create1=no])]) 1018 1019if test "$apr_cv_epoll_create1" = "yes"; then 1020 AC_DEFINE([HAVE_EPOLL_CREATE1], 1, [Define if epoll_create1 function is supported]) 1021fi 1022 1023# Check for z/OS async i/o support. 1024AC_CACHE_CHECK([for asio -> message queue support], [apr_cv_aio_msgq], 1025[AC_TRY_RUN([ 1026#define _AIO_OS390 1027#include <aio.h> 1028 1029int main() 1030{ 1031 struct aiocb a; 1032 1033 a.aio_notifytype = AIO_MSGQ; /* use IPC message queue for notification */ 1034 1035 return aio_cancel(2, NULL) == -1; 1036}], [apr_cv_aio_msgq=yes], [apr_cv_aio_msgq=no], [apr_cv_aio_msgq=no])]) 1037 1038if test "$apr_cv_aio_msgq" = "yes"; then 1039 AC_DEFINE([HAVE_AIO_MSGQ], 1, [Define if async i/o supports message q's]) 1040fi 1041 1042# test for dup3 1043AC_CACHE_CHECK([for dup3 support], [apr_cv_dup3], 1044[AC_TRY_RUN([ 1045#include <unistd.h> 1046 1047int main() 1048{ 1049 return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1; 1050}], [apr_cv_dup3=yes], [apr_cv_dup3=no], [apr_cv_dup3=no])]) 1051 1052if test "$apr_cv_dup3" = "yes"; then 1053 AC_DEFINE([HAVE_DUP3], 1, [Define if dup3 function is supported]) 1054fi 1055 1056# test for accept4 1057AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4], 1058[AC_TRY_RUN([ 1059#include <unistd.h> 1060#include <sys/types.h> 1061#include <sys/socket.h> 1062#include <sys/un.h> 1063#include <sys/wait.h> 1064#include <signal.h> 1065#include <errno.h> 1066 1067#define A4_SOCK "./apr_accept4_test_socket" 1068 1069int main() 1070{ 1071 pid_t pid; 1072 int fd; 1073 struct sockaddr_un loc, rem; 1074 socklen_t rem_sz; 1075 1076 if ((pid = fork())) { 1077 int status; 1078 1079 unlink(A4_SOCK); 1080 1081 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) 1082 goto cleanup_failure2; 1083 1084 loc.sun_family = AF_UNIX; 1085 strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); 1086 1087 if (bind(fd, (struct sockaddr *) &loc, 1088 sizeof(struct sockaddr_un)) == -1) 1089 goto cleanup_failure; 1090 1091 if (listen(fd, 5) == -1) 1092 goto cleanup_failure; 1093 1094 rem_sz = sizeof(struct sockaddr_un); 1095 if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) { 1096 goto cleanup_failure; 1097 } 1098 else { 1099 close(fd); 1100 waitpid(pid, &status, 0); 1101 unlink(A4_SOCK); 1102 return 0; 1103 } 1104 1105cleanup_failure: 1106 close(fd); 1107cleanup_failure2: 1108 kill(pid, SIGKILL); 1109 waitpid(pid, &status, 0); 1110 unlink(A4_SOCK); 1111 return 1; 1112 } 1113 else { 1114 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) 1115 return 1; /* this will be bad: we'll hang */ 1116 1117 loc.sun_family = AF_UNIX; 1118 strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); 1119 1120 while(connect(fd, (struct sockaddr *) &loc, 1121 sizeof(struct sockaddr_un)) == -1 && 1122 (errno==ENOENT || errno==ECONNREFUSED)) 1123 ; 1124 1125 close(fd); 1126 return 0; 1127 } 1128}], [apr_cv_accept4=yes], [apr_cv_accept4=no], [apr_cv_accept4=no])]) 1129 1130if test "$apr_cv_accept4" = "yes"; then 1131 AC_DEFINE([HAVE_ACCEPT4], 1, [Define if accept4 function is supported]) 1132fi 1133 1134AC_CACHE_CHECK([for SOCK_CLOEXEC support], [apr_cv_sock_cloexec], 1135[AC_TRY_RUN([ 1136#include <sys/types.h> 1137#include <sys/socket.h> 1138 1139int main() 1140{ 1141 return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1; 1142}], [apr_cv_sock_cloexec=yes], [apr_cv_sock_cloexec=no], [apr_cv_sock_cloexec=no])]) 1143 1144if test "$apr_cv_sock_cloexec" = "yes"; then 1145 AC_DEFINE([HAVE_SOCK_CLOEXEC], 1, [Define if the SOCK_CLOEXEC flag is supported]) 1146fi 1147 1148dnl ----------------------------- Checking for missing POSIX thread functions 1149AC_CHECK_FUNCS([getpwnam_r getpwuid_r getgrnam_r getgrgid_r]) 1150 1151dnl ----------------------------- Checking for Shared Memory Support 1152echo "${nl}Checking for Shared Memory Support..." 1153 1154# The real-time POSIX extensions (e.g. shm_*, sem_*) may only 1155# be available if linking against librt. 1156AC_SEARCH_LIBS(shm_open, rt) 1157 1158case $host in 1159 *-sysv*) 1160 ac_includes_default="$ac_includes_default 1161#if HAVE_SYS_MUTEX_H /* needed to define lock_t for sys/shm.h */ 1162# include <sys/mutex.h> 1163#endif";; 1164esac 1165 1166AC_CHECK_HEADERS([sys/types.h sys/mman.h sys/ipc.h sys/mutex.h \ 1167 sys/shm.h sys/file.h sys/socket.h kernel/OS.h os2.h windows.h]) 1168AC_CHECK_HEADERS([net/if.h],[],[], 1169[ 1170#ifdef HAVE_SYS_SOCKET_H 1171#include <sys/socket.h> 1172#endif 1173#include <net/if.h> 1174]) 1175AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \ 1176 create_area mprotect]) 1177 1178APR_CHECK_DEFINE(MAP_ANON, sys/mman.h) 1179AC_CHECK_FILE(/dev/zero) 1180 1181# Not all systems can mmap /dev/zero (such as HP-UX). Check for that. 1182if test "$ac_cv_func_mmap" = "yes" && 1183 test "$ac_cv_file__dev_zero" = "yes"; then 1184 AC_MSG_CHECKING(for mmap that can map /dev/zero) 1185 AC_TRY_RUN([ 1186#include <sys/types.h> 1187#include <sys/stat.h> 1188#include <fcntl.h> 1189#ifdef HAVE_SYS_MMAN_H 1190#include <sys/mman.h> 1191#endif 1192 int main() 1193 { 1194 int fd; 1195 void *m; 1196 fd = open("/dev/zero", O_RDWR); 1197 if (fd < 0) { 1198 return 1; 1199 } 1200 m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); 1201 if (m == (void *)-1) { /* aka MAP_FAILED */ 1202 return 2; 1203 } 1204 if (munmap(m, sizeof(void*)) < 0) { 1205 return 3; 1206 } 1207 return 0; 1208 }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no]) 1209 1210 AC_MSG_RESULT($ac_cv_file__dev_zero) 1211fi 1212 1213# Now we determine which one is our anonymous shmem preference. 1214haveshmgetanon="0" 1215havemmapzero="0" 1216havemmapanon="0" 1217APR_BEGIN_DECISION([anonymous shared memory allocation method]) 1218APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl 1219 func:shmget func:shmat func:shmdt func:shmctl, 1220 [haveshmgetanon="1" 1221 APR_DECIDE(USE_SHMEM_SHMGET_ANON, [SysV IPC shmget()])]) 1222APR_IFALLYES(header:sys/mman.h func:mmap func:munmap file:/dev/zero, 1223 [havemmapzero="1" 1224 APR_DECIDE(USE_SHMEM_MMAP_ZERO, 1225 [SVR4-style mmap() on /dev/zero])]) 1226APR_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON, 1227 [havemmapanon="1" 1228 APR_DECIDE(USE_SHMEM_MMAP_ANON, 1229 [4.4BSD-style mmap() via MAP_ANON])]) 1230APR_IFALLYES(header:os2.h, 1231 [haveos2shm="1" 1232 APR_DECIDE(USE_SHMEM_OS2_ANON, [OS/2 DosAllocSharedMem()])]) 1233APR_IFALLYES(header:kernel/OS.h func:create_area, 1234 [havebeosshm="1" 1235 APR_DECIDE(USE_SHMEM_BEOS_ANON, 1236 [BeOS areas])]) 1237APR_IFALLYES(header:windows.h func:CreateFileMapping, 1238 [havewin32shm="1" 1239 APR_DECIDE(USE_SHMEM_WIN32_ANON, 1240 [Windows CreateFileMapping()])]) 1241case $host in 1242 *linux* ) 1243 # Linux has problems with MM_SHMT_MMANON even though it reports 1244 # that it has it. 1245 # FIXME - find exact 2.3 version that MMANON was fixed in. It is 1246 # confirmed fixed in 2.4 series. 1247 if test $os_pre24linux -eq 1; then 1248 AC_MSG_WARN([Disabling anon mmap() support for Linux pre-2.4]) 1249 APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_ZERO USE_SHMEM_SHMGET_ANON) 1250 fi 1251 ;; 1252 *hpux11* ) 1253 APR_DECISION_OVERRIDE(USE_SHMEM_SHMGET_ANON) 1254 ;; 1255esac 1256APR_END_DECISION 1257AC_DEFINE_UNQUOTED($ac_decision) 1258 1259useshmgetanon="0" 1260usemmapzero="0" 1261usemmapanon="0" 1262 1263case $ac_decision in 1264 USE_SHMEM_SHMGET_ANON ) 1265 useshmgetanon="1" 1266 ;; 1267 USE_SHMEM_MMAP_ZERO ) 1268 usemmapzero="1" 1269 ;; 1270 USE_SHMEM_MMAP_ANON ) 1271 usemmapanon="1" 1272 ;; 1273esac 1274 1275AC_SUBST(useshmgetanon) 1276AC_SUBST(usemmapzero) 1277AC_SUBST(usemmapanon) 1278AC_SUBST(haveshmgetanon) 1279AC_SUBST(havemmapzero) 1280AC_SUBST(havemmapanon) 1281 1282# Now we determine which one is our name-based shmem preference. 1283havemmaptmp="0" 1284havemmapshm="0" 1285haveshmget="0" 1286havebeosarea="0" 1287haveos2shm="0" 1288havewin32shm="0" 1289APR_BEGIN_DECISION([namebased memory allocation method]) 1290APR_IFALLYES(header:sys/mman.h func:mmap func:munmap, 1291 [havemmaptmp="1" 1292 APR_DECIDE(USE_SHMEM_MMAP_TMP, 1293 [Classical mmap() on temporary file])]) 1294APR_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open dnl 1295 func:shm_unlink, 1296 [havemmapshm="1" 1297 APR_DECIDE(USE_SHMEM_MMAP_SHM, 1298 [mmap() via POSIX.1 shm_open() on temporary file])]) 1299APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl 1300 func:shmget func:shmat func:shmdt func:shmctl, 1301 [haveshmget="1" 1302 APR_DECIDE(USE_SHMEM_SHMGET, [SysV IPC shmget()])]) 1303APR_IFALLYES(header:kernel/OS.h func:create_area, 1304 [havebeosshm="1" 1305 APR_DECIDE(USE_SHMEM_BEOS, [BeOS areas])]) 1306APR_IFALLYES(header:os2.h, 1307 [haveos2shm="1" 1308 APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])]) 1309APR_IFALLYES(header:windows.h, 1310 [havewin32shm="1" 1311 APR_DECIDE(USE_SHMEM_WIN32, [Windows shared memory])]) 1312AC_ARG_ENABLE(posix-shm, 1313[ --enable-posix-shm Use POSIX shared memory (shm_open) if available], 1314[ 1315if test "$havemmapshm" = "1"; then 1316 APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_SHM) 1317fi 1318]) 1319case $host in 1320 *linux* ) 1321 # Linux pre-2.4 had problems with MM_SHMT_MMANON even though 1322 # it reports that it has it. 1323 if test $os_pre24linux -eq 1; then 1324 APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_TMP USE_SHMEM_MMAP_SHM dnl 1325 USE_SHMEM_SHMGET) 1326 fi 1327 ;; 1328esac 1329APR_END_DECISION 1330AC_DEFINE_UNQUOTED($ac_decision) 1331 1332usemmaptmp="0" 1333usemmapshm="0" 1334useshmget="0" 1335usebeosarea="0" 1336useos2shm="0" 1337usewin32shm="0" 1338 1339case $ac_decision in 1340 USE_SHMEM_MMAP_TMP ) 1341 usemmaptmp="1" 1342 ;; 1343 USE_SHMEM_MMAP_SHM ) 1344 usemmapshm="1" 1345 ;; 1346 USE_SHMEM_SHMGET ) 1347 useshmget="1" 1348 ;; 1349 USE_SHMEM_BEOS ) 1350 usebeosarea="1" 1351 ;; 1352 USE_SHMEM_OS2 ) 1353 useos2shm="1" 1354 ;; 1355 USE_SHMEM_WIN32 ) 1356 usewin32shm="1" 1357 ;; 1358esac 1359 1360# Do we have any shared memory support? 1361if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm$usewin32shm" = "00000000"; then 1362 sharedmem="0" 1363else 1364 sharedmem="1" 1365fi 1366 1367AC_SUBST(usemmaptmp) 1368AC_SUBST(usemmapshm) 1369AC_SUBST(useshmget) 1370AC_SUBST(usebeosarea) 1371AC_SUBST(useos2shm) 1372AC_SUBST(usewin32shm) 1373AC_SUBST(havemmaptmp) 1374AC_SUBST(havemmapshm) 1375AC_SUBST(haveshmget) 1376AC_SUBST(havebeosarea) 1377AC_SUBST(haveos2shm) 1378AC_SUBST(havewin32shm) 1379AC_SUBST(sharedmem) 1380 1381dnl ----------------------------- Checks for Any required Functions 1382dnl Checks for library functions. (N.B. poll is further down) 1383 1384AC_FUNC_ALLOCA 1385 1386AC_CHECK_FUNCS([calloc setsid isinf isnan \ 1387 getenv putenv setenv unsetenv \ 1388 writev getifaddrs utime utimes]) 1389AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ]) 1390AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ]) 1391sendfile="0" 1392AC_CHECK_LIB(sendfile, sendfilev) 1393AC_CHECK_FUNCS(sendfile send_file sendfilev, [ sendfile="1" ]) 1394 1395dnl THIS MUST COME AFTER THE THREAD TESTS - FreeBSD doesn't always have a 1396dnl threaded poll() and we don't want to use sendfile on early FreeBSD 1397dnl systems if we are also using threads. 1398 1399AC_ARG_WITH(sendfile, [ --with-sendfile Override decision to use sendfile], 1400 [ if test "$withval" = "yes"; then 1401 sendfile="1" 1402 else 1403 sendfile="0" 1404 fi ], [ 1405 orig_sendfile=$sendfile 1406 case $host in 1407 *freebsd*) 1408 # FreeBSD < 4.2 has issues with threads+sendfile 1409 if test $os_version -le "401999"; then 1410 if test "$threads" = "1"; then 1411 sendfile="0" 1412 fi 1413 fi 1414 ;; 1415 *alpha*-dec-osf* ) 1416 sendfile="0" 1417 ;; 1418 s390-*-linux-gnu) 1419 # disable sendfile support for 2.2 on S/390 1420 if test $os_pre24linux -eq 1; then 1421 AC_MSG_WARN([Disabled sendfile support for Linux 2.2 on S/390]) 1422 sendfile="0" 1423 fi 1424 ;; 1425 *aix*) 1426 # compiler-independent check for 64-bit build 1427 AC_CHECK_SIZEOF(void*, 4) 1428 if test "x$ac_cv_sizeof_voidp" = "x8"; then 1429 # sendfile not working for 64-bit build 1430 sendfile="0" 1431 fi 1432 ;; 1433 esac 1434 if test "$orig_sendfile" != "$sendfile"; then 1435 echo "sendfile support disabled to avoid system problem" 1436 fi ] ) 1437AC_SUBST(sendfile) 1438 1439AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ]) 1440AC_DECL_SYS_SIGLIST 1441 1442AC_CHECK_FUNCS(fork, [ fork="1" ], [ fork="0" ]) 1443APR_CHECK_INET_ADDR 1444APR_CHECK_INET_NETWORK 1445AC_SUBST(apr_inaddr_none) 1446AC_CHECK_FUNC(_getch) 1447AC_CHECK_FUNCS(strerror_r, [ strerror_r="1" ], [ strerror_r="0" ]) 1448if test "$strerror_r" = "1"; then 1449 APR_CHECK_STRERROR_R_RC 1450fi 1451AC_CHECK_FUNCS(mmap, [ mmap="1" ], [ mmap="0" ]) 1452if test "$native_mmap_emul" = "1"; then 1453 mmap="1" 1454fi 1455AC_CHECK_FUNCS(memmove, [ have_memmove="1" ], [have_memmove="0" ]) 1456AC_CHECK_FUNCS([getpass getpassphrase gmtime_r localtime_r]) 1457case $host in 1458 *-hp-hpux*) 1459 dnl mkstemp is limited to 26 temporary files (a-z); use APR replacement 1460 ;; 1461 *) 1462 AC_CHECK_FUNCS(mkstemp) 1463 ;; 1464esac 1465 1466AC_SUBST(fork) 1467AC_SUBST(have_inet_addr) 1468AC_SUBST(tcp_nodelay_inherited) 1469AC_SUBST(o_nonblock_inherited) 1470AC_SUBST(have_inet_network) 1471AC_SUBST(have_sigaction) 1472AC_SUBST(have_setrlimit) 1473AC_SUBST(have_getrlimit) 1474AC_SUBST(mmap) 1475AC_SUBST(have_memmove) 1476 1477APR_CHECK_SIGWAIT_ONE_ARG 1478 1479dnl ----------------------------- Checks for Any required Headers 1480AC_HEADER_STDC 1481 1482APR_FLAG_HEADERS( 1483 ByteOrder.h \ 1484 conio.h \ 1485 crypt.h \ 1486 ctype.h \ 1487 dir.h \ 1488 dirent.h \ 1489 dl.h \ 1490 dlfcn.h \ 1491 errno.h \ 1492 fcntl.h \ 1493 grp.h \ 1494 inttypes.h \ 1495 io.h \ 1496 limits.h \ 1497 mach-o/dyld.h \ 1498 malloc.h \ 1499 memory.h \ 1500 netdb.h \ 1501 osreldate.h \ 1502 poll.h \ 1503 process.h \ 1504 pwd.h \ 1505 semaphore.h \ 1506 signal.h \ 1507 stdarg.h \ 1508 stddef.h \ 1509 stdio.h \ 1510 stdlib.h \ 1511 string.h \ 1512 strings.h \ 1513 sysapi.h \ 1514 sysgtime.h \ 1515 termios.h \ 1516 time.h \ 1517 tpfeq.h \ 1518 tpfio.h \ 1519 unistd.h \ 1520 unix.h \ 1521 windows.h \ 1522 winsock2.h \ 1523 arpa/inet.h \ 1524 kernel/OS.h \ 1525 net/errno.h \ 1526 netinet/in.h \ 1527 netinet/sctp.h \ 1528 netinet/sctp_uio.h \ 1529 sys/file.h \ 1530 sys/ioctl.h \ 1531 sys/mman.h \ 1532 sys/param.h \ 1533 sys/poll.h \ 1534 sys/resource.h \ 1535 sys/select.h \ 1536 sys/sem.h \ 1537 sys/sendfile.h \ 1538 sys/signal.h \ 1539 sys/socket.h \ 1540 sys/sockio.h \ 1541 sys/stat.h \ 1542 sys/sysctl.h \ 1543 sys/syslimits.h \ 1544 sys/time.h \ 1545 sys/types.h \ 1546 sys/uio.h \ 1547 sys/un.h \ 1548 sys/wait.h) 1549 1550# IRIX 6.5 has a problem in <netinet/tcp.h> which prevents it from 1551# being included by itself. Check for <netinet/tcp.h> manually, 1552# including another header file first. 1553AC_CACHE_CHECK([for netinet/tcp.h], [apr_cv_hdr_netinet_tcp_h], 1554[AC_TRY_CPP( 1555[#ifdef HAVE_NETINET_IN_H 1556#include <netinet/in.h> 1557#endif 1558#include <netinet/tcp.h> 1559], [apr_cv_hdr_netinet_tcp_h=yes], [apr_cv_hdr_netinet_tcp_h=no])]) 1560if test "$apr_cv_hdr_netinet_tcp_h" = "yes"; then 1561 netinet_tcph=1 1562 AC_DEFINE([HAVE_NETINET_TCP_H], 1, [Defined if netinet/tcp.h is present]) 1563else 1564 netinet_tcph=0 1565fi 1566 1567AC_SUBST(arpa_ineth) 1568AC_SUBST(conioh) 1569AC_SUBST(ctypeh) 1570AC_SUBST(crypth) 1571AC_SUBST(errnoh) 1572AC_SUBST(direnth) 1573AC_SUBST(fcntlh) 1574AC_SUBST(inttypesh) 1575AC_SUBST(ioh) 1576AC_SUBST(limitsh) 1577AC_SUBST(netdbh) 1578AC_SUBST(sys_syslimitsh) 1579AC_SUBST(netinet_inh) 1580AC_SUBST(netinet_sctph) 1581AC_SUBST(netinet_sctp_uioh) 1582AC_SUBST(netinet_tcph) 1583AC_SUBST(stdargh) 1584AC_SUBST(stdioh) 1585AC_SUBST(stdlibh) 1586AC_SUBST(stringh) 1587AC_SUBST(stringsh) 1588AC_SUBST(sys_ioctlh) 1589AC_SUBST(sys_sendfileh) 1590AC_SUBST(sys_signalh) 1591AC_SUBST(sys_socketh) 1592AC_SUBST(sys_sockioh) 1593AC_SUBST(sys_typesh) 1594AC_SUBST(sys_timeh) 1595AC_SUBST(sys_uioh) 1596AC_SUBST(sys_unh) 1597AC_SUBST(timeh) 1598AC_SUBST(unistdh) 1599AC_SUBST(signalh) 1600AC_SUBST(sys_waith) 1601AC_SUBST(processh) 1602AC_SUBST(pthreadh) 1603AC_SUBST(semaphoreh) 1604AC_SUBST(windowsh) 1605AC_SUBST(winsock2h) 1606 1607# Checking for h_errno in <netdb.h> 1608if test "$netdbh" = "1"; then 1609 APR_CHECK_H_ERRNO_FLAG 1610 if test "$ac_cv_h_errno_cflags" = "no"; then 1611 AC_MSG_ERROR([can not find h_errno in netdb.h]) 1612 fi 1613fi 1614 1615AC_ARG_ENABLE(allocator-uses-mmap, 1616 [ --enable-allocator-uses-mmap Use mmap in apr_allocator instead of malloc ], 1617 [ if test "$enableval" = "yes"; then 1618 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON, 1619 [AC_DEFINE(APR_ALLOCATOR_USES_MMAP, 1, 1620 [Define if apr_allocator should use mmap]) ], 1621 [AC_MSG_ERROR([mmap()/MAP_ANON not supported]) ] 1622 ) 1623 fi ] 1624) 1625 1626AC_ARG_ENABLE(allocator-guard-pages, 1627 [ --enable-allocator-guard-pages Use guard pages in apr_allocator 1628 (implies --enable-allocator-uses-mmap) ] , 1629 [ if test "$enableval" = "yes"; then 1630 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap func:mprotect define:MAP_ANON, 1631 [AC_DEFINE(APR_ALLOCATOR_GUARD_PAGES, 1, 1632 [Define if apr_allocator should use guard pages]) ], 1633 [AC_MSG_ERROR([mmap()/MAP_ANON/mprotect() not supported]) ] 1634 ) 1635 fi ] 1636) 1637 1638 1639AC_ARG_ENABLE(pool-concurrency-check, 1640 [ --enable-pool-concurrency-check Check for concurrent usage of memory pools], 1641 [ if test "$enableval" = "yes"; then 1642 AC_DEFINE(APR_POOL_CONCURRENCY_CHECK, 1, 1643 [Define if pool functions should abort if concurrent usage is detected]) 1644 fi ] 1645) 1646 1647dnl ----------------------------- Checks for standard typedefs 1648AC_TYPE_OFF_T 1649AC_TYPE_PID_T 1650AC_TYPE_SIZE_T 1651AC_TYPE_UID_T 1652AC_CHECK_TYPE(ssize_t, int) 1653AC_C_INLINE 1654AC_C_CONST 1655AC_FUNC_SETPGRP 1656 1657APR_CHECK_SOCKLEN_T 1658 1659dnl Checks for pointer size 1660AC_CHECK_SIZEOF(void*, 4) 1661 1662if test "x$ac_cv_sizeof_voidp" != "x"; then 1663 voidp_size=$ac_cv_sizeof_voidp 1664else 1665 AC_ERROR([Cannot determine size of void*]) 1666fi 1667 1668dnl Checks for integer size 1669AC_CHECK_SIZEOF(char, 1) 1670AC_CHECK_SIZEOF(short, 2) 1671AC_CHECK_SIZEOF(int, 4) 1672AC_CHECK_SIZEOF(long, 4) 1673AC_CHECK_SIZEOF(long long, 8) 1674 1675if test "$ac_cv_sizeof_short" = "2"; then 1676 short_value=short 1677fi 1678if test "$ac_cv_sizeof_int" = "4"; then 1679 int_value=int 1680fi 1681 1682# Now we need to find what apr_int64_t (sizeof == 8) will be. 1683# The first match is our preference (use inttypes if available). 1684APR_IFALLYES(header:stdint.h header:inttypes.h, hasinttypes="1", hasinttypes="0") 1685if test "$hasinttypes" = "1"; then 1686 int64_literal='#define APR_INT64_C(val) INT64_C(val)' 1687 uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)' 1688 int64_t_fmt='#define APR_INT64_T_FMT PRId64' 1689 uint64_t_fmt='#define APR_UINT64_T_FMT PRIu64' 1690 uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT PRIx64' 1691 int64_value="int64_t" 1692 uint64_value="uint64_t" 1693 APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, int, d, [ 1694 int64_strfn="strtoi" 1695 ], [ 1696 APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, long, ld, [ 1697 int64_strfn="strtol" 1698 ], [ 1699 APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, long long, lld, [ 1700 int64_strfn="strtoll" 1701 ], [ 1702 AC_ERROR([could not determine the string function for int64_t]) 1703 ])])]) 1704elif test "$ac_cv_sizeof_int" = "8"; then 1705 int64_literal='#define APR_INT64_C(val) (val)' 1706 uint64_literal='#define APR_UINT64_C(val) (val##U)' 1707 int64_t_fmt='#define APR_INT64_T_FMT "d"' 1708 uint64_t_fmt='#define APR_UINT64_T_FMT "u"' 1709 uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"' 1710 int64_value="int" 1711 uint64_value="unsigned int" 1712 int64_strfn="strtoi" 1713elif test "$ac_cv_sizeof_long" = "8"; then 1714 int64_literal='#define APR_INT64_C(val) (val##L)' 1715 uint64_literal='#define APR_UINT64_C(val) (val##UL)' 1716 int64_t_fmt='#define APR_INT64_T_FMT "ld"' 1717 uint64_t_fmt='#define APR_UINT64_T_FMT "lu"' 1718 uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"' 1719 int64_value="long" 1720 uint64_value="unsigned long" 1721 int64_strfn="strtol" 1722elif test "$ac_cv_sizeof_long_long" = "8"; then 1723 int64_literal='#define APR_INT64_C(val) (val##LL)' 1724 uint64_literal='#define APR_UINT64_C(val) (val##ULL)' 1725 # Linux, Solaris, FreeBSD all support ll with printf. 1726 # BSD 4.4 originated 'q'. Solaris is more popular and 1727 # doesn't support 'q'. Solaris wins. Exceptions can 1728 # go to the OS-dependent section. 1729 int64_t_fmt='#define APR_INT64_T_FMT "lld"' 1730 uint64_t_fmt='#define APR_UINT64_T_FMT "llu"' 1731 uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"' 1732 int64_value="long long" 1733 uint64_value="unsigned long long" 1734 int64_strfn="strtoll" 1735elif test "$ac_cv_sizeof_longlong" = "8"; then 1736 int64_literal='#define APR_INT64_C(val) (val##LL)' 1737 uint64_literal='#define APR_UINT64_C(val) (val##ULL)' 1738 int64_t_fmt='#define APR_INT64_T_FMT "qd"' 1739 uint64_t_fmt='#define APR_UINT64_T_FMT "qu"' 1740 uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"' 1741 int64_value="__int64" 1742 uint64_value="unsigned __int64" 1743 int64_strfn="strtoll" 1744else 1745 # int64_literal may be overriden if your compiler thinks you have 1746 # a 64-bit value but APR does not agree. 1747 AC_ERROR([could not detect a 64-bit integer type]) 1748fi 1749 1750# If present, allow the C99 macro INT64_C to override our conversion. 1751# 1752# HP-UX's ANSI C compiler provides this without any includes, so we 1753# will first look for INT64_C without adding stdint.h 1754AC_CACHE_CHECK([for INT64_C], [apr_cv_define_INT64_C], [ 1755AC_EGREP_CPP(YES_IS_DEFINED, 1756[#ifdef INT64_C 1757YES_IS_DEFINED 1758#endif], [apr_cv_define_INT64_C=yes], [ 1759 # Now check for INT64_C in stdint.h 1760 AC_EGREP_CPP(YES_IS_DEFINED, [#include <stdint.h> 1761#ifdef INT64_C 1762YES_IS_DEFINED 1763#endif], [apr_cv_define_INT64_C=yes], [apr_cv_define_INT64_C=no])])]) 1764 1765if test "$apr_cv_define_INT64_C" = "yes"; then 1766 int64_literal='#define APR_INT64_C(val) INT64_C(val)' 1767 uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)' 1768 stdint=1 1769else 1770 stdint=0 1771fi 1772 1773if test "$ac_cv_type_size_t" = "yes"; then 1774 size_t_value="size_t" 1775else 1776 size_t_value="apr_int32_t" 1777fi 1778if test "$ac_cv_type_ssize_t" = "yes"; then 1779 ssize_t_value="ssize_t" 1780else 1781 ssize_t_value="apr_int32_t" 1782fi 1783if test "$ac_cv_socklen_t" = "yes"; then 1784 socklen_t_value="socklen_t" 1785 case $host in 1786 *-hp-hpux*) 1787 if test "$ac_cv_sizeof_long" = "8"; then 1788 # 64-bit HP-UX requires 32-bit socklens in 1789 # kernel, but user-space declarations say 1790 # 64-bit (socklen_t == size_t == long). 1791 # This will result in many compile warnings, 1792 # but we're functionally busted otherwise. 1793 socklen_t_value="int" 1794 fi 1795 ;; 1796 esac 1797else 1798 socklen_t_value="int" 1799fi 1800 1801APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8) 1802 1803if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then 1804 pid_t_fmt='#define APR_PID_T_FMT "hd"' 1805elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then 1806 pid_t_fmt='#define APR_PID_T_FMT "d"' 1807elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then 1808 pid_t_fmt='#define APR_PID_T_FMT "ld"' 1809elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then 1810 pid_t_fmt='#define APR_PID_T_FMT APR_INT64_T_FMT' 1811else 1812 pid_t_fmt='#error Can not determine the proper size for pid_t' 1813fi 1814 1815# Basically, we have tried to figure out the correct format strings 1816# for APR types which vary between platforms, but we don't always get 1817# it right. 1818case $host in 1819 s390*linux*) 1820 # uniquely, the 31-bit Linux/s390 uses "unsigned long int" 1821 # for size_t rather than "unsigned int": 1822 size_t_fmt="lu" 1823 ssize_t_fmt="ld" 1824 ;; 1825 *-os2*) 1826 size_t_fmt="lu" 1827 ;; 1828 *-solaris*) 1829 if test "$ac_cv_sizeof_long" = "8"; then 1830 pid_t_fmt='#define APR_PID_T_FMT "d"' 1831 else 1832 pid_t_fmt='#define APR_PID_T_FMT "ld"' 1833 fi 1834 ;; 1835 *aix4*|*aix5*) 1836 ssize_t_fmt="ld" 1837 size_t_fmt="lu" 1838 ;; 1839 *beos*) 1840 ssize_t_fmt="ld" 1841 size_t_fmt="ld" 1842 ;; 1843 *apple-darwin*) 1844 osver=`uname -r` 1845 case $osver in 1846 [[0-7]].*) 1847 ssize_t_fmt="d" 1848 ;; 1849 *) 1850 ssize_t_fmt="ld" 1851 ;; 1852 esac 1853 size_t_fmt="lu" 1854 ;; 1855 *-mingw*) 1856 int64_t_fmt='#define APR_INT64_T_FMT "I64d"' 1857 uint64_t_fmt='#define APR_UINT64_T_FMT "I64u"' 1858 uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "I64x"' 1859 int64_value="__int64" 1860 uint64_value="unsigned __int64" 1861 int64_strfn="_strtoi64" 1862 ;; 1863esac 1864 1865dnl I would expect much of the above to go away with new compile test 1866APR_CHECK_TYPES_FMT_COMPATIBLE(ssize_t, long, ld, [ssize_t_fmt="ld"], [ 1867APR_CHECK_TYPES_FMT_COMPATIBLE(ssize_t, int, d, [ssize_t_fmt="d"]) 1868]) 1869APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned long, lu, [size_t_fmt="lu"], [ 1870APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"]) 1871]) 1872 1873APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8) 1874 1875dnl the else cases below should no longer occur; 1876AC_MSG_CHECKING([which format to use for apr_ssize_t]) 1877if test -n "$ssize_t_fmt"; then 1878 AC_MSG_RESULT(%$ssize_t_fmt) 1879elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then 1880 ssize_t_fmt="d" 1881 AC_MSG_RESULT(%d) 1882elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then 1883 ssize_t_fmt="ld" 1884 AC_MSG_RESULT(%ld) 1885else 1886 AC_ERROR([could not determine the proper format for apr_ssize_t]) 1887fi 1888 1889ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\"" 1890 1891APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8) 1892 1893# else cases below should no longer occur; 1894AC_MSG_CHECKING([which format to use for apr_size_t]) 1895if test -n "$size_t_fmt"; then 1896 AC_MSG_RESULT(%$size_t_fmt) 1897elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then 1898 size_t_fmt="d" 1899 AC_MSG_RESULT(%d) 1900elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then 1901 size_t_fmt="ld" 1902 AC_MSG_RESULT(%ld) 1903else 1904 AC_ERROR([could not determine the proper format for apr_size_t]) 1905fi 1906 1907size_t_fmt="#define APR_SIZE_T_FMT \"$size_t_fmt\"" 1908 1909APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8) 1910 1911if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then 1912 # Enable LFS 1913 aprlfs=1 1914 AC_CHECK_FUNCS([mmap64 sendfile64 sendfilev64 readdir64_r]) 1915 case $host in 1916 *-hp-hpux*) 1917 dnl mkstemp64 is limited to 26 temporary files (a-z); use APR replacement 1918 ;; 1919 *) 1920 AC_CHECK_FUNCS(mkstemp64) 1921 ;; 1922 esac 1923elif test "${ac_cv_sizeof_off_t}" != "${ac_cv_sizeof_size_t}"; then 1924 # unsure of using -gt above is as portable, can can't forsee where 1925 # off_t can legitimately be smaller than size_t 1926 aprlfs=1 1927else 1928 aprlfs=0 1929fi 1930 1931AC_MSG_CHECKING([which type to use for apr_off_t]) 1932if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then 1933 # LFS is go! 1934 off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT' 1935 off_t_value='off64_t' 1936 off_t_strfn='apr_strtoi64' 1937elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then 1938 # Special case: off_t may change size with _FILE_OFFSET_BITS 1939 # on 32-bit systems with LFS support. To avoid compatibility 1940 # issues when other packages do define _FILE_OFFSET_BITS, 1941 # hard-code apr_off_t to long. 1942 off_t_value=long 1943 off_t_fmt='#define APR_OFF_T_FMT "ld"' 1944 off_t_strfn='strtol' 1945elif test "$ac_cv_type_off_t" = "yes"; then 1946 # off_t is more commonly a long than an int; prefer that case 1947 # where int and long are the same size and interchangable. 1948 off_t_value=off_t 1949 APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long, ld, [ 1950 off_t_fmt="#define APR_OFF_T_FMT \"ld\"" 1951 off_t_strfn='strtol' 1952 ], [ 1953 APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, int, d, [ 1954 off_t_fmt="#define APR_OFF_T_FMT \"d\"" 1955 off_t_strfn='strtoi' 1956 ], [ 1957 APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long long, lld, [ 1958 off_t_fmt="#define APR_OFF_T_FMT \"lld\"" 1959 off_t_strfn='strtoll' 1960 ], [ 1961 APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, $int64_value, I64d, [ 1962 off_t_fmt="#define APR_OFF_T_FMT APR_INT64_T_FMT" 1963 off_t_strfn='apr_strtoi64'], [ 1964 # Per OS tuning... 1965 case $host in 1966 *-mingw*) 1967 off_t_value=apr_int64_t 1968 off_t_fmt='#define APR_OFF_T_FMT "I64d"' 1969 off_t_strfn='_strtoi64' 1970 ;; 1971 *) 1972 AC_ERROR([could not determine the size of off_t]) 1973 ;; 1974 esac 1975 ])])])]) 1976else 1977 # Fallback on int 1978 off_t_value=apr_int32_t 1979 off_t_fmt=d 1980 off_t_strfn='strtoi' 1981fi 1982AC_MSG_RESULT($off_t_value) 1983 1984# Regardless of whether _LARGEFILE64_SOURCE is used, on some 1985# platforms _FILE_OFFSET_BITS will affect the size of ino_t and hence 1986# the build-time ABI may be different from the apparent ABI when using 1987# APR with another package which *does* define _FILE_OFFSET_BITS. 1988# (Exactly as per the case above with off_t where LFS is *not* used) 1989# 1990# To be safe, hard-code apr_ino_t as 'unsigned long' or 'unsigned int' 1991# iff that is exactly the size of ino_t here; otherwise use ino_t as existing 1992# releases did. To be correct, apr_ino_t should have been made an 1993# ino64_t as apr_off_t is off64_t, but this can't be done now without 1994# breaking ABI. 1995 1996# Per OS tuning... 1997case $host in 1998*mingw*) 1999 ino_t_value=apr_int64_t 2000 ;; 2001*) 2002 ino_t_value=ino_t 2003 APR_CHECK_SIZEOF_EXTENDED(AC_INCLUDES_DEFAULT, ino_t, $ac_cv_sizeof_long) 2004 if test $ac_cv_sizeof_ino_t = 4; then 2005 if test $ac_cv_sizeof_long = 4; then 2006 ino_t_value="unsigned long" 2007 else 2008 ino_t_value="unsigned int" 2009 fi 2010 fi 2011 ;; 2012esac 2013AC_MSG_NOTICE([using $ino_t_value for ino_t]) 2014 2015# Checks for endianness 2016AC_C_BIGENDIAN 2017if test $ac_cv_c_bigendian = yes; then 2018 bigendian=1 2019else 2020 bigendian=0 2021fi 2022 2023APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h> 2024#include <sys/uio.h>],struct iovec,0) 2025if test "$ac_cv_sizeof_struct_iovec" = "0"; then 2026 have_iovec=0 2027else 2028 have_iovec=1 2029fi 2030 2031AC_SUBST(voidp_size) 2032AC_SUBST(short_value) 2033AC_SUBST(int_value) 2034AC_SUBST(int64_value) 2035AC_SUBST(uint64_value) 2036AC_SUBST(off_t_value) 2037AC_SUBST(size_t_value) 2038AC_SUBST(ssize_t_value) 2039AC_SUBST(socklen_t_value) 2040AC_SUBST(int64_t_fmt) 2041AC_SUBST(uint64_t_fmt) 2042AC_SUBST(uint64_t_hex_fmt) 2043AC_SUBST(ssize_t_fmt) 2044AC_SUBST(size_t_fmt) 2045AC_SUBST(off_t_fmt) 2046AC_SUBST(pid_t_fmt) 2047AC_SUBST(int64_literal) 2048AC_SUBST(uint64_literal) 2049AC_SUBST(stdint) 2050AC_SUBST(bigendian) 2051AC_SUBST(aprlfs) 2052AC_SUBST(have_iovec) 2053AC_SUBST(ino_t_value) 2054 2055dnl ----------------------------- Checking for string functions 2056AC_CHECK_FUNCS(strnicmp, have_strnicmp="1", have_strnicmp="0") 2057AC_CHECK_FUNCS(strncasecmp, have_strncasecmp="1", have_strncasecmp="0") 2058AC_CHECK_FUNCS(stricmp, have_stricmp="1", have_stricmp="0") 2059AC_CHECK_FUNCS(strcasecmp, have_strcasecmp="1", have_strcasecmp="0") 2060AC_CHECK_FUNCS(strdup, have_strdup="1", have_strdup="0") 2061AC_CHECK_FUNCS(strstr, have_strstr="1", have_strstr="0") 2062AC_CHECK_FUNCS(memchr, have_memchr="1", have_memchr="0") 2063AC_CHECK_FUNC($int64_strfn, have_int64_strfn="1", have_int64_strfn="0") 2064 2065dnl ----------------------------- We have a fallback position 2066if test "$have_int64_strfn" = "0" && test "$int64_strfn" = "strtoll"; then 2067 int64_strfn="strtoq" 2068 AC_CHECK_FUNC(strtoq, [have_int64_strfn=1], [have_int64_strfn=0]) 2069fi 2070 2071if test "$have_int64_strfn" = "1"; then 2072 AC_DEFINE_UNQUOTED(APR_INT64_STRFN, [$int64_strfn], 2073 [Define as function which can be used for conversion of strings to apr_int64_t]) 2074fi 2075 2076AC_SUBST(have_strnicmp) 2077AC_SUBST(have_strncasecmp) 2078AC_SUBST(have_stricmp) 2079AC_SUBST(have_strcasecmp) 2080AC_SUBST(have_strdup) 2081AC_SUBST(have_strstr) 2082AC_SUBST(have_memchr) 2083 2084if test "$off_t_strfn" = "apr_strtoi64" && test "$have_int64_strfn" = "1"; then 2085 off_t_strfn=$int64_strfn 2086fi 2087AC_DEFINE_UNQUOTED(APR_OFF_T_STRFN, [$off_t_strfn], 2088 [Define as function used for conversion of strings to apr_off_t]) 2089 2090dnl ----------------------------- Checking for DSO support 2091echo "${nl}Checking for DSO..." 2092AC_ARG_ENABLE(dso, 2093 [ --disable-dso Disable DSO support ], 2094 [if test "x$enableval" = "xyes"; then 2095 dsotype=any 2096 else 2097 dsotype=$enableval 2098 fi 2099 ], [dsotype=any]) 2100 2101if test "$dsotype" = "any"; then 2102 if test "$dsotype" = "any"; then 2103 case $host in 2104 *darwin[[0-8]]\.*) 2105 # Original Darwin, not for 9.0!: 2106 AC_CHECK_FUNC(NSLinkModule, [dsotype=dyld]);; 2107 hppa*-hpux[[1-9]]\.*|hppa*-hpux1[[01]]*) 2108 # shl is specific to parisc hpux SOM binaries, not used for 64 bit 2109 AC_CHECK_LIB(dld, shl_load, [have_shl=1]) 2110 if test "$ac_cv_sizeof_voidp$have_shl" = "41"; then 2111 dsotype=shl; APR_ADDTO(LIBS,-ldld) 2112 fi;; 2113 *mingw*|*-os2*) 2114 # several 'other's below probably belong up here. If they always 2115 # use a platform implementation and shouldn't test the dlopen/dlfcn 2116 # features, then bring them up here. 2117 # But if they -should- optionally use dlfcn, and/or need the config 2118 # detection of dlopen/dlsym, do not move them up. 2119 dsotype=other ;; 2120 esac 2121 fi 2122 # Normal POSIX: 2123 if test "$dsotype" = "any"; then 2124 AC_CHECK_FUNC(dlopen, [dsotype=dlfcn]) 2125 fi 2126 if test "$dsotype" = "any"; then 2127 AC_CHECK_LIB(dl, dlopen, [dsotype=dlfcn; APR_ADDTO(LIBS,-ldl)]) 2128 fi 2129 if test "$dsotype" = "dlfcn"; then 2130 # ReliantUnix has dlopen() in libc but dlsym() in libdl :( 2131 AC_CHECK_FUNC(dlsym, [], 2132 [AC_CHECK_LIB(dl, dlsym, 2133 [APR_ADDTO(LIBS, -ldl)], 2134 [dsotype=any 2135 echo "Weird: dlopen() was found but dlsym() was not found!"])]) 2136 fi 2137 if test "$dsotype" = "any"; then 2138 # BeOS: 2139 AC_CHECK_LIB(root, load_image, [dsotype=other]) 2140 fi 2141 # Everything else: 2142 if test "$dsotype" = "any"; then 2143 case $host in 2144 *os390|*os400|*-aix*) 2145 # Some -aix5 will use dl, no hassles. Keep that pattern here. 2146 dsotype=other ;; 2147 *-hpux*) 2148 if test "$have_shl" = "1"; then 2149 dsotype=shl; APR_ADDTO(LIBS,-ldld) 2150 fi;; 2151 esac 2152 fi 2153fi 2154 2155if test "$dsotype" = "any"; then 2156 AC_MSG_ERROR([Could not detect suitable DSO implementation]) 2157elif test "$dsotype" = "no"; then 2158 aprdso="0" 2159else 2160 case "$dsotype" in 2161 dlfcn) AC_DEFINE(DSO_USE_DLFCN, 1, [Define if DSO support uses dlfcn.h]);; 2162 shl) AC_DEFINE(DSO_USE_SHL, 1, [Define if DSO support uses shl_load]);; 2163 dyld) AC_DEFINE(DSO_USE_DYLD, 1, [Define if DSO support uses dyld.h]);; 2164 other) ;; # Use whatever is in dso/OSDIR 2165 *) AC_MSG_ERROR([Unknown DSO implementation "$dsotype"]);; 2166 esac 2167 aprdso="1" 2168 apr_modules="$apr_modules dso" 2169fi 2170 2171AC_SUBST(aprdso) 2172 2173dnl ----------------------------- Checking for Processes 2174echo "${nl}Checking for Processes..." 2175 2176AC_CHECK_FUNCS(waitpid) 2177 2178AC_ARG_ENABLE(other-child, 2179 [ --enable-other-child Enable reliable child processes ], 2180 [ if test "$enableval" = "yes"; then 2181 oc="1" 2182 else 2183 oc="0" 2184 fi ], 2185 [ oc=1 ] ) 2186 2187AC_SUBST(oc) 2188 2189if test -z "$have_proc_invoked"; then 2190 have_proc_invoked="0" 2191fi 2192 2193AC_SUBST(have_proc_invoked) 2194 2195AC_MSG_CHECKING(for Variable Length Arrays) 2196APR_TRY_COMPILE_NO_WARNING([], 2197[ 2198 int foo[argc]; 2199 foo[0] = 0; 2200], vla_msg=yes, vla_msg=no ) 2201AC_MSG_RESULT([$vla_msg]) 2202if test "$vla_msg" = "yes"; then 2203 AC_DEFINE(HAVE_VLA, 1, [Define if C compiler supports VLA]) 2204fi 2205 2206AC_CACHE_CHECK(struct rlimit,ac_cv_struct_rlimit,[ 2207AC_TRY_RUN([ 2208#include <sys/types.h> 2209#include <sys/time.h> 2210#include <sys/resource.h> 2211main() 2212{ 2213 struct rlimit limit; 2214 limit.rlim_cur = 0; 2215 limit.rlim_max = 0; 2216 exit(0); 2217}], [ 2218 ac_cv_struct_rlimit=yes ], [ 2219 ac_cv_struct_rlimit=no ], [ 2220 ac_cv_struct_rlimit=no ] ) ] ) 2221struct_rlimit=0 2222test "x$ac_cv_struct_rlimit" = xyes && struct_rlimit=1 2223AC_SUBST(struct_rlimit) 2224 2225dnl ----------------------------- Checking for Locking Characteristics 2226echo "${nl}Checking for Locking..." 2227 2228AC_CHECK_FUNCS(semget semctl semop semtimedop flock) 2229APR_IFALLYES(func:semtimedop, have_semtimedop="1", have_semtimedop="0") 2230 2231AC_CHECK_HEADERS(semaphore.h) 2232AC_SEARCH_LIBS(sem_open, rt) 2233AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait sem_timedwait) 2234APR_IFALLYES(func:sem_timedwait, have_sem_timedwait="1", have_sem_timedwait="0") 2235 2236AC_CHECK_HEADERS(OS.h) 2237AC_CHECK_FUNCS(create_sem acquire_sem acquire_sem_etc) 2238APR_IFALLYES(header:OS.h func:acquire_sem_etc, have_acquire_sem_etc="1", have_acquire_sem_etc="0") 2239 2240# Some systems return ENOSYS from sem_open. 2241AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[ 2242AC_TRY_RUN([ 2243#include <errno.h> 2244#include <stdlib.h> 2245#include <fcntl.h> 2246#include <semaphore.h> 2247#ifndef SEM_FAILED 2248#define SEM_FAILED (-1) 2249#endif 2250main() 2251{ 2252 sem_t *psem; 2253 const char *sem_name = "/apr_autoconf"; 2254 2255 psem = sem_open(sem_name, O_CREAT, 0644, 1); 2256 if (psem == (sem_t *)SEM_FAILED) { 2257 exit(1); 2258 } 2259 sem_close(psem); 2260 psem = sem_open(sem_name, O_CREAT | O_EXCL, 0644, 1); 2261 if (psem != (sem_t *)SEM_FAILED) { 2262 sem_close(psem); 2263 exit(1); 2264 } 2265 sem_unlink(sem_name); 2266 exit(0); 2267}], [ac_cv_func_sem_open=yes], [ac_cv_func_sem_open=no], 2268[ac_cv_func_sem_open=no])]) 2269 2270# It's stupid, but not all platforms have union semun, even those that need it. 2271AC_MSG_CHECKING(for union semun in sys/sem.h) 2272AC_TRY_COMPILE([ 2273#include <sys/types.h> 2274#include <sys/ipc.h> 2275#include <sys/sem.h> 2276],[ 2277union semun arg; 2278semctl(0, 0, 0, arg); 2279], [have_union_semun="1" union_semun=yes ] 2280msg=yes, [ 2281have_union_semun="0" 2282msg=no ] ) 2283AC_MSG_RESULT([$msg]) 2284AC_SUBST(have_union_semun) 2285 2286dnl Checks for libraries. 2287APR_CHECK_DEFINE(LOCK_EX, sys/file.h) 2288APR_CHECK_DEFINE(F_SETLK, fcntl.h) 2289APR_CHECK_DEFINE(SEM_UNDO, sys/sem.h) 2290 2291# We are assuming that if the platform doesn't have POLLIN, it doesn't have 2292# any POLL definitions. 2293APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h) 2294 2295if test "$threads" = "1"; then 2296 APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h) 2297 AC_CHECK_FUNCS(pthread_mutex_timedlock pthread_mutexattr_setpshared) 2298 APR_IFALLYES(header:pthread.h func:pthread_mutex_timedlock, 2299 have_pthread_mutex_timedlock="1", have_pthread_mutex_timedlock="0") 2300 AC_SUBST(have_pthread_mutex_timedlock) 2301 # Some systems have setpshared and define PROCESS_SHARED, but don't 2302 # really support PROCESS_SHARED locks. So, we must validate that we 2303 # can go through the steps without receiving some sort of system error. 2304 # Linux and older versions of AIX have this problem. 2305 APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED func:pthread_mutexattr_setpshared, [ 2306 AC_CACHE_CHECK([for working PROCESS_SHARED locks], apr_cv_process_shared_works, [ 2307 AC_TRY_RUN([ 2308#include <sys/types.h> 2309#include <pthread.h> 2310 int main() 2311 { 2312 pthread_mutex_t mutex; 2313 pthread_mutexattr_t attr; 2314 if (pthread_mutexattr_init(&attr)) 2315 exit(1); 2316 if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) 2317 exit(2); 2318 if (pthread_mutex_init(&mutex, &attr)) 2319 exit(3); 2320 if (pthread_mutexattr_destroy(&attr)) 2321 exit(4); 2322 if (pthread_mutex_destroy(&mutex)) 2323 exit(5); 2324 exit(0); 2325 }], [apr_cv_process_shared_works=yes], [apr_cv_process_shared_works=no])]) 2326 # Override detection of pthread_mutexattr_setpshared 2327 ac_cv_func_pthread_mutexattr_setpshared=$apr_cv_process_shared_works]) 2328 2329 if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then 2330 APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX 2331 fi 2332fi 2333 2334# See which lock mechanisms we can support on this system. 2335APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl 2336 func:sem_unlink func:sem_post func:sem_wait, 2337 hasposixser="1", hasposixser="0") 2338APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO, 2339 hassysvser="1", hassysvser="0") 2340APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0") 2341APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0") 2342# note: the current APR use of shared mutex requires /dev/zero 2343APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl 2344 func:pthread_mutexattr_setpshared dnl 2345 file:/dev/zero, 2346 hasprocpthreadser="1", hasprocpthreadser="0") 2347APR_IFALLYES(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="0") 2348 2349AC_CHECK_FUNCS(pthread_condattr_setpshared) 2350APR_IFALLYES(header:pthread.h func:pthread_condattr_setpshared, 2351 have_pthread_condattr_setpshared="1", have_pthread_condattr_setpshared="0") 2352AC_SUBST(have_pthread_condattr_setpshared) 2353 2354# See which lock mechanism we'll select by default on this system. 2355# The last APR_DECIDE to execute sets the default. 2356# At this stage, we match the ordering in Apache 1.3 2357# which is (highest to lowest): sysvsem -> fcntl -> flock. 2358# POSIX semaphores and cross-process pthread mutexes are not 2359# used by default since they have less desirable behaviour when 2360# e.g. a process holding the mutex segfaults. 2361# The BEOSSEM decision doesn't require any substitutions but is 2362# included here to prevent the fcntl() branch being selected 2363# from the decision making. 2364APR_BEGIN_DECISION([apr_lock implementation method]) 2365APR_IFALLYES(func:flock define:LOCK_EX, 2366 APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()])) 2367APR_IFALLYES(header:fcntl.h define:F_SETLK, 2368 APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()])) 2369APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO, 2370 APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()])) 2371APR_IFALLYES(header:OS.h func:create_sem func:acquire_sem func:acquire_sem_etc, 2372 APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores])) 2373# pthread mutex both pshared and robust[_np] is the best default 2374case "$apr_cv_mutex_robust_shared" in 2375"yes"|"np") 2376 APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread pshared mutex]) 2377 ;; 2378*) 2379 ;; 2380esac 2381if test "x$apr_lock_method" != "x"; then 2382 APR_DECISION_FORCE($apr_lock_method) 2383fi 2384APR_END_DECISION 2385AC_DEFINE_UNQUOTED($ac_decision) 2386 2387flockser="0" 2388sysvser="0" 2389posixser="0" 2390procpthreadser="0" 2391fcntlser="0" 2392case $ac_decision in 2393 USE_FLOCK_SERIALIZE ) 2394 flockser="1" 2395 ;; 2396 USE_FCNTL_SERIALIZE ) 2397 fcntlser="1" 2398 ;; 2399 USE_SYSVSEM_SERIALIZE ) 2400 sysvser="1" 2401 ;; 2402 USE_POSIXSEM_SERIALIZE ) 2403 posixser="1" 2404 ;; 2405 USE_PROC_PTHREAD_SERIALIZE ) 2406 procpthreadser="1" 2407 ;; 2408 USE_BEOSSEM ) 2409 beossem="1" 2410 ;; 2411esac 2412 2413if test $hasfcntlser = "1"; then 2414AC_MSG_CHECKING(if fcntl returns EACCES when F_SETLK is already held) 2415AC_TRY_RUN([ 2416#ifdef HAVE_STDLIB_H 2417#include <stdlib.h> 2418#endif 2419#ifdef HAVE_SYS_TYPES_H 2420#include <sys/types.h> 2421#endif 2422#ifdef HAVE_SYS_STAT_H 2423#include <sys/stat.h> 2424#endif 2425#ifdef HAVE_SYS_WAIT_H 2426#include <sys/wait.h> 2427#endif 2428#if defined(HAVE_UNISTD_H) 2429#include <unistd.h> 2430#endif 2431#include <fcntl.h> 2432#include <errno.h> 2433 2434int fd; 2435struct flock proc_mutex_lock_it = {0}; 2436const char *fname = "conftest.fcntl"; 2437 2438int main() 2439{ 2440 int rc, status;; 2441 proc_mutex_lock_it.l_whence = SEEK_SET; /* from current point */ 2442 proc_mutex_lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ 2443 2444 fd = creat(fname, S_IRWXU); 2445 unlink(fname); 2446 2447 if (rc = lockit()) { 2448 exit(-1); 2449 } 2450 2451 if (fork()) { 2452 wait(&status); 2453 } 2454 else { 2455 return(lockit()); 2456 } 2457 2458 close(fd); 2459 exit(WEXITSTATUS(status) != EACCES); 2460} 2461 2462int lockit() { 2463 int rc; 2464 do { 2465 rc = fcntl(fd, F_SETLK, &proc_mutex_lock_it); 2466 } while ( rc < 0 && errno == EINTR); 2467 2468 return (rc < 0) ? errno : 0; 2469}], [apr_fcntl_tryacquire_eacces=1], [apr_fcntl_tryacquire_eacces=0], [apr_fcntl_tryacquire_eacces=0]) 2470fi 2471 2472if test "$apr_fcntl_tryacquire_eacces" = "1"; then 2473 AC_DEFINE(FCNTL_TRYACQUIRE_EACCES, 1, [Define if fcntl returns EACCES when F_SETLK is already held]) 2474 AC_MSG_RESULT(yes) 2475else 2476 AC_MSG_RESULT(no) 2477fi 2478 2479 2480AC_SUBST(hasflockser) 2481AC_SUBST(hassysvser) 2482AC_SUBST(hasposixser) 2483AC_SUBST(hasfcntlser) 2484AC_SUBST(hasprocpthreadser) 2485AC_SUBST(flockser) 2486AC_SUBST(sysvser) 2487AC_SUBST(posixser) 2488AC_SUBST(fcntlser) 2489AC_SUBST(procpthreadser) 2490AC_SUBST(pthreadser) 2491 2492AC_MSG_CHECKING(if all interprocess locks affect threads) 2493if test "x$apr_process_lock_is_global" = "xyes"; then 2494 proclockglobal="1" 2495 AC_MSG_RESULT(yes) 2496else 2497 proclockglobal="0" 2498 AC_MSG_RESULT(no) 2499fi 2500 2501AC_SUBST(proclockglobal) 2502 2503AC_MSG_CHECKING(if POSIX sems affect threads in the same process) 2504if test "x$apr_posixsem_is_global" = "xyes"; then 2505 AC_DEFINE(POSIXSEM_IS_GLOBAL, 1, 2506 [Define if POSIX semaphores affect threads within the process]) 2507 AC_MSG_RESULT(yes) 2508else 2509 AC_MSG_RESULT(no) 2510fi 2511 2512AC_MSG_CHECKING(if SysV sems affect threads in the same process) 2513if test "x$apr_sysvsem_is_global" = "xyes"; then 2514 AC_DEFINE(SYSVSEM_IS_GLOBAL, 1, 2515 [Define if SysV semaphores affect threads within the process]) 2516 AC_MSG_RESULT(yes) 2517else 2518 AC_MSG_RESULT(no) 2519fi 2520 2521AC_MSG_CHECKING(if fcntl locks affect threads in the same process) 2522if test "x$apr_fcntl_is_global" = "xyes"; then 2523 AC_DEFINE(FCNTL_IS_GLOBAL, 1, 2524 [Define if fcntl locks affect threads within the process]) 2525 AC_MSG_RESULT(yes) 2526else 2527 AC_MSG_RESULT(no) 2528fi 2529 2530AC_MSG_CHECKING(if flock locks affect threads in the same process) 2531if test "x$apr_flock_is_global" = "xyes"; then 2532 AC_DEFINE(FLOCK_IS_GLOBAL, 1, 2533 [Define if flock locks affect threads within the process]) 2534 AC_MSG_RESULT(yes) 2535else 2536 AC_MSG_RESULT(no) 2537fi 2538 2539dnl ----------------------------- Checking for /dev/random 2540AC_CHECK_HEADERS(sys/random.h) 2541AC_CHECK_FUNCS(getrandom) 2542 2543AC_CHECK_HEADERS(sys/syscall.h) 2544AC_CHECK_HEADERS(linux/random.h) 2545AC_CHECK_DECLS([SYS_getrandom], [], [], [#include <sys/syscall.h>]) 2546 2547AC_CHECK_FUNCS(arc4random_buf) 2548 2549AC_MSG_CHECKING(for entropy source) 2550 2551why_no_rand="" 2552 2553AC_ARG_WITH(egd, 2554 [ --with-egd[[=DIR]] use EGD-compatible socket], 2555 [ AC_DEFINE(HAVE_EGD, 1, [Define if EGD is supported]) 2556 if test "$withval" = "yes"; then 2557 AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy"], 2558 [Define to list of paths to EGD sockets]) 2559 else 2560 AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["$withval"]) 2561 fi 2562 AC_MSG_RESULT(EGD-compatible daemon) 2563 rand="1" 2564 ]) 2565 2566if test "$rand" != "1"; then 2567 if test "$ac_cv_func_getrandom" = yes; then 2568 rand="getrandom" 2569 elif test "$ac_cv_have_decl_SYS_getrandom" = yes; then 2570 rand="SYS_getrandom" 2571 elif test "$ac_cv_func_arc4random_buf" = yes; then 2572 rand="arc4random" 2573 fi 2574fi 2575 2576if test "$rand" != "1"; then 2577 AC_ARG_WITH(devrandom, 2578 [ --with-devrandom[[=DEV]] use /dev/random or compatible [[searches by default]]], 2579 [ apr_devrandom="$withval" ], [ apr_devrandom="no" ]) 2580 if test "$apr_devrandom" = "no"; then 2581 if test -z "$rand"; then 2582 apr_devrandom="yes" 2583 else 2584 apr_devrandom="no" 2585 fi 2586 fi 2587 2588 if test "$apr_devrandom" = "yes"; then 2589 # /dev/random on OpenBSD doesn't provide random data, so 2590 # prefer /dev/arandom, which does; see random(4). 2591 for f in /dev/arandom /dev/urandom /dev/random; do 2592 if test -r $f; then 2593 apr_devrandom=$f 2594 rand="1" 2595 break 2596 fi 2597 done 2598 elif test "$apr_devrandom" != "no"; then 2599 if test -r "$apr_devrandom"; then 2600 rand="1" 2601 else 2602 AC_ERROR([$apr_devrandom not found or unreadable.]) 2603 fi 2604 fi 2605 2606 if test "$rand" = "1"; then 2607 case $host in 2608 *os390) 2609 if test $os_version -lt 1700; then 2610 rand="0" 2611 why_no_rand=" ($apr_devrandom unusable on z/OS before V1R7)" 2612 fi 2613 ;; 2614 esac 2615 fi 2616 2617 if test "$rand" = "1"; then 2618 AC_DEFINE_UNQUOTED(DEV_RANDOM, ["$apr_devrandom"], [Define to path of random device]) 2619 AC_MSG_RESULT([$apr_devrandom]) 2620 elif test -n "$rand"; then 2621 AC_DEFINE_UNQUOTED(SYS_RANDOM, ["$rand"], [Define system call of random]) 2622 AC_MSG_RESULT([$rand]) 2623 rand="1" 2624 fi 2625fi 2626 2627if test "$rand" != "1"; then 2628 case $host in 2629 # we have built in support for OS/2 2630 *-os2*) 2631 AC_MSG_RESULT([Using OS/2 builtin random]) 2632 rand="1" 2633 ;; 2634 *) 2635 if test "$rand" != "1"; then 2636 if test "$ac_cv_lib_truerand_main" = "yes"; then 2637 AC_DEFINE(HAVE_TRUERAND, 1, [Define if truerand is supported]) 2638 AC_MSG_RESULT(truerand) 2639 rand="1" 2640 else 2641 AC_MSG_RESULT(not found$why_no_rand) 2642 rand="0" 2643 fi 2644 fi 2645 ;; 2646 esac 2647fi 2648 2649AC_SUBST(rand) 2650 2651dnl ----------------------------- Checking for File Info Support 2652echo "${nl}Checking for File Info Support..." 2653AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_atimensec, 2654struct stat.st_ctimensec, struct stat.st_mtimensec, struct stat.st_atim.tv_nsec, 2655struct stat.st_ctim.tv_nsec, struct stat.st_mtim.tv_nsec, 2656struct stat.st_atime_n, struct stat.st_ctime_n, struct stat.st_mtime_n],,,[ 2657#ifdef HAVE_SYS_TYPES_H 2658#include <sys/types.h> 2659#endif 2660#ifdef HAVE_SYS_STAT_H 2661#include <sys/stat.h> 2662#endif 2663#ifdef HAVE_UNISTD_H 2664#include <unistd.h> 2665#endif]) 2666 2667APR_CHECK_DIRENT_INODE 2668APR_CHECK_DIRENT_TYPE 2669 2670dnl ----------------------------- Checking for UUID Support 2671echo "${nl}Checking for OS UUID Support..." 2672 2673AC_CHECK_HEADERS(uuid.h uuid/uuid.h sys/uuid.h, break) 2674 2675apr_revert_save_LIBS=$LIBS 2676 2677# Prefer the flavor(s) that live in libc; 2678AC_SEARCH_LIBS(uuid_create, uuid) 2679AC_SEARCH_LIBS(uuid_generate, uuid) 2680if test "$ac_cv_search_uuid_create" = "none required" -o \ 2681 "$ac_cv_search_uuid_generate" = "none required"; then 2682 LIBS=$apr_revert_save_LIBS 2683fi 2684 2685AC_CHECK_FUNCS(uuid_create uuid_generate) 2686 2687AC_CACHE_CHECK([for os uuid usability], [apr_cv_osuuid], [ 2688# Ensure this test closely mirrors misc/unix/rand.c! 2689uuid_includes=" 2690#if defined(HAVE_SYS_TYPES_H) 2691#include <sys/types.h> 2692#endif 2693#if defined(HAVE_UNISTD_H) 2694#include <unistd.h> 2695#endif 2696#if defined(HAVE_UUID_H) 2697#include <uuid.h> 2698#elif defined(HAVE_UUID_UUID_H) 2699#include <uuid/uuid.h> 2700#elif defined(HAVE_SYS_UUID_H) 2701#include <sys/uuid.h> 2702#endif 2703" 2704 apr_cv_osuuid=no 2705 if test $ac_cv_func_uuid_create = yes; then 2706 AC_TRY_LINK([$uuid_includes], [ 2707 uuid_t g; 2708 uint32_t s; 2709 uuid_create(&g, &s); 2710 if (s == uuid_s_ok) s = 0; 2711 ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_create=no]) 2712 fi 2713 if test $ac_cv_func_uuid_generate = yes; then 2714 AC_TRY_LINK([$uuid_includes], [ 2715 uuid_t g; 2716 uuid_generate(g); 2717 ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_generate=no]) 2718 fi 2719]) 2720 2721if test $apr_cv_osuuid = yes; then 2722 osuuid="1" 2723else 2724 osuuid="0" 2725 LIBS=$apr_revert_save_LIBS 2726fi 2727AC_SUBST(osuuid) 2728 2729 2730dnl ----------------------------- Checking for Time Support 2731echo "${nl}Checking for Time Support..." 2732 2733AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[ 2734#include <sys/types.h> 2735#include <time.h>]) 2736 2737dnl ----------------------------- Checking for Networking Support 2738echo "${nl}Checking for Networking support..." 2739APR_TYPE_IN_ADDR 2740if test "$ac_cv_type_in_addr" = "yes"; then 2741 have_in_addr="1" 2742else 2743 have_in_addr="0" 2744fi 2745 2746AC_MSG_CHECKING([if fd == socket on this platform]) 2747if test "x$file_as_socket" != "x0" ; then 2748 file_as_socket="1"; 2749 echo "yes" 2750else 2751 echo "no" 2752fi 2753 2754AC_SUBST(have_in_addr) 2755AC_SUBST(file_as_socket) 2756 2757if test "$ac_cv_func_poll $file_as_socket" = "yes 1"; then 2758 AC_DEFINE(WAITIO_USES_POLL, 1, 2759 [Define if apr_wait_for_io_or_timeout() uses poll(2)]) 2760fi 2761 2762# Check the types only if we have gethostbyname_r 2763if test "$ac_cv_func_gethostbyname_r" = "yes"; then 2764 APR_CHECK_GETHOSTBYNAME_R_STYLE 2765fi 2766 2767# Check the types only if we have getservbyname_r 2768if test "$ac_cv_func_getservbyname_r" = "yes"; then 2769 APR_CHECK_GETSERVBYNAME_R_STYLE 2770fi 2771 2772APR_CHECK_TCP_NODELAY_INHERITED 2773APR_CHECK_O_NONBLOCK_INHERITED 2774APR_CHECK_TCP_NODELAY_WITH_CORK 2775 2776# Look for a way of corking TCP... 2777APR_CHECK_DEFINE(TCP_CORK, netinet/tcp.h) 2778APR_CHECK_DEFINE(TCP_NOPUSH, netinet/tcp.h) 2779apr_tcp_nopush_flag="0" 2780have_corkable_tcp="0" 2781if test "x$ac_cv_define_TCP_CORK" = "xyes"; then 2782 apr_tcp_nopush_flag="TCP_CORK" 2783 have_corkable_tcp="1" 2784else 2785 case $host in 2786 *linux*) 2787 AC_EGREP_CPP(yes,[ 2788#include <linux/socket.h> 2789#ifdef TCP_CORK 2790yes 2791#endif 2792 ],[ 2793 apr_tcp_nopush_flag="3" 2794 have_corkable_tcp="1" 2795 ]) 2796 ;; 2797 *) 2798 ;; 2799 esac 2800fi 2801if test "x$ac_cv_define_TCP_NOPUSH" = "xyes"; then 2802 apr_tcp_nopush_flag="TCP_NOPUSH" 2803 have_corkable_tcp="1" 2804fi 2805 2806APR_CHECK_DEFINE(SO_ACCEPTFILTER, sys/socket.h) 2807if test "x$ac_cv_define_SO_ACCEPTFILTER" = "xyes"; then 2808 acceptfilter="1" 2809else 2810 acceptfilter="0" 2811fi 2812 2813APR_CHECK_SCTP 2814APR_CHECK_MCAST 2815 2816AC_SUBST(apr_tcp_nopush_flag) 2817AC_SUBST(have_corkable_tcp) 2818AC_SUBST(acceptfilter) 2819AC_SUBST(have_sctp) 2820 2821AC_CHECK_FUNCS(set_h_errno) 2822 2823echo "${nl}Checking for IPv6 Networking support..." 2824dnl Start of checking for IPv6 support... 2825 2826AC_ARG_ENABLE(ipv6, 2827 [ --disable-ipv6 Disable IPv6 support in APR.], 2828 [ if test "$enableval" = "no"; then 2829 user_disabled_ipv6=1 2830 fi ], 2831 [ user_disabled_ipv6=0 ] ) 2832 2833case $host in 2834 *) 2835 broken_ipv6=0 2836esac 2837 2838AC_SEARCH_LIBS(getaddrinfo, socket inet6) 2839AC_SEARCH_LIBS(gai_strerror, socket inet6) 2840AC_SEARCH_LIBS(getnameinfo, socket inet6) 2841AC_CHECK_FUNCS(gai_strerror if_nametoindex if_indextoname) 2842APR_CHECK_WORKING_GETADDRINFO 2843APR_CHECK_NEGATIVE_EAI 2844APR_CHECK_WORKING_GETNAMEINFO 2845APR_CHECK_SOCKADDR_IN6 2846APR_CHECK_SOCKADDR_STORAGE 2847APR_CHECK_SOCKADDR_UN 2848 2849have_ipv6="0" 2850if test "$user_disabled_ipv6" = 1; then 2851 ipv6_result="no -- disabled by user" 2852else 2853 if test "x$broken_ipv6" = "x0"; then 2854 if test "x$have_sockaddr_in6" = "x1"; then 2855 if test "x$ac_cv_working_getaddrinfo" = "xyes"; then 2856 if test "x$ac_cv_working_getnameinfo" = "xyes"; then 2857 APR_CHECK_GETADDRINFO_ADDRCONFIG 2858 have_ipv6="1" 2859 ipv6_result="yes" 2860 else 2861 ipv6_result="no -- no getnameinfo" 2862 fi 2863 else 2864 ipv6_result="no -- no working getaddrinfo" 2865 fi 2866 else 2867 ipv6_result="no -- no sockaddr_in6" 2868 fi 2869 else 2870 ipv6_result="no -- the platform has known problems supporting IPv6" 2871 fi 2872fi 2873 2874AC_MSG_CHECKING(if APR supports IPv6) 2875AC_MSG_RESULT($ipv6_result) 2876 2877AC_SUBST(have_ipv6) 2878 2879AC_ARG_ENABLE(timedlocks, 2880 [ --disable-timedlocks Disable timed locks ], 2881 [apr_has_timedlocks="0"], [apr_has_timedlocks="1"] 2882) 2883AC_SUBST(apr_has_timedlocks) 2884 2885# hstrerror is only needed if IPv6 is not enabled, 2886# so getaddrinfo/gai_strerror are not used. 2887if test $have_ipv6 = 0; then 2888 AC_SEARCH_LIBS(hstrerror, resolv, 2889 [AC_DEFINE(HAVE_HSTRERROR, 1, [Define if hstrerror is present])]) 2890fi 2891 2892dnl Check for langinfo support 2893 2894AC_CHECK_HEADERS(langinfo.h) 2895AC_CHECK_FUNCS(nl_langinfo) 2896 2897dnl ------------------------------ Defaults for some platform nuances 2898 2899dnl Do we have a Win32-centric Unicode FS? 2900APR_SETIFNULL(have_unicode_fs, [0]) 2901AC_SUBST(have_unicode_fs) 2902 2903APR_SETIFNULL(apr_has_xthread_files, [0]) 2904AC_SUBST(apr_has_xthread_files) 2905 2906APR_SETIFNULL(apr_procattr_user_set_requires_password, [0]) 2907AC_SUBST(apr_procattr_user_set_requires_password) 2908 2909APR_SETIFNULL(apr_thread_func, []) 2910AC_SUBST(apr_thread_func) 2911 2912APR_SETIFNULL(apr_has_user, [1]) 2913AC_SUBST(apr_has_user) 2914 2915dnl ----------------------------- Finalize the variables 2916 2917echo "${nl}Restore user-defined environment settings..." 2918 2919APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_) 2920APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_) 2921APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_) 2922APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_) 2923APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_) 2924AC_SUBST(NOTEST_CPPFLAGS) 2925AC_SUBST(NOTEST_CFLAGS) 2926AC_SUBST(NOTEST_LDFLAGS) 2927AC_SUBST(NOTEST_LIBS) 2928AC_SUBST(NOTEST_INCLUDES) 2929 2930dnl ----------------------------- Construct the files 2931 2932AC_SUBST(INTERNAL_CPPFLAGS) 2933AC_SUBST(LDLIBS) 2934AC_SUBST(INCLUDES) 2935AC_SUBST(AR) 2936AC_SUBST(RM) 2937AC_SUBST(OSDIR) 2938AC_SUBST(DEFAULT_OSDIR) 2939AC_SUBST(EXEEXT) 2940AC_SUBST(LIBTOOL_LIBS) 2941 2942# Use -no-install or -no-fast-install to link the test 2943# programs on all platforms but Darwin, where it would cause 2944# the programs to be linked against installed versions of 2945# libapr instead of those just built. 2946case $host in 2947 *-apple-darwin*) 2948 LT_NO_INSTALL="" 2949 ;; 2950 *-mingw*) 2951 LT_NO_INSTALL="-no-fast-install" 2952 ;; 2953 *) 2954 LT_NO_INSTALL="-no-install" 2955 ;; 2956esac 2957AC_SUBST(LT_NO_INSTALL) 2958 2959# 2960# BSD/OS (BSDi) needs to use a different include syntax in the Makefiles 2961# 2962case $host in 2963*bsdi*) 2964 # Check whether they've installed GNU make 2965 if make --version > /dev/null 2>&1; then 2966 INCLUDE_RULES="include $apr_buildout/apr_rules.mk" 2967 INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk" 2968 else 2969 # BSDi make 2970 INCLUDE_RULES=".include \"$apr_buildout/apr_rules.mk\"" 2971 INCLUDE_OUTPUTS=".include \"$apr_srcdir/build-outputs.mk\"" 2972 fi 2973 ;; 2974*) 2975 INCLUDE_RULES="include $apr_buildout/apr_rules.mk" 2976 INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk" 2977 ;; 2978esac 2979AC_SUBST(INCLUDE_RULES) 2980AC_SUBST(INCLUDE_OUTPUTS) 2981 2982AC_CONFIG_FILES([Makefile 2983 include/apr.h 2984 build/apr_rules.mk 2985 build/pkg/pkginfo 2986 apr-$APR_MAJOR_VERSION-config:apr-config.in 2987 apr.pc]) 2988 2989if test -d $srcdir/test; then 2990 AC_CONFIG_FILES([test/Makefile test/internal/Makefile]) 2991fi 2992 2993dir=include/arch/unix 2994test -d $dir || $MKDIR $dir 2995 2996AC_CONFIG_COMMANDS([default], [ 2997# Commands run at the end of config.status: 2998for i in $APR_SAVE_HEADERS; do 2999 if cmp -s $i $i.save 2>/dev/null; then 3000 mv $i.save $i 3001 AC_MSG_NOTICE([$i is unchanged]) 3002 fi 3003 rm -f $i.save 3004done 3005chmod +x apr-$APR_MAJOR_VERSION-config 3006],[ 3007dnl This section is expanded by configure UNQUOTED so variable 3008dnl references must be backslash-escaped as necessary. 3009 3010# Commands run at the beginning of config.status: 3011APR_SAVE_HEADERS="include/apr.h include/arch/unix/apr_private.h" 3012APR_MAJOR_VERSION=$APR_MAJOR_VERSION 3013APR_PLATFORM=$host 3014 3015for apri in \${APR_SAVE_HEADERS}; do 3016 test -r \${apri} && mv \${apri} \${apri}.save 3017done 3018]) 3019 3020AC_OUTPUT 3021