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