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