2 dnl Autoconf configuration file for APR
4 dnl Process this file with autoconf to produce a configure script.
5 dnl Use ./buildconf to prepare build files and run autoconf for APR.
9 AC_INIT(build/apr_common.m4)
10 AC_CONFIG_HEADER(include/arch/unix/apr_private.h)
11 AC_CONFIG_AUX_DIR(build)
12 AC_CONFIG_MACRO_DIR(build)
15 dnl Include our own M4 macros along with those for libtool
17 sinclude(build/apr_common.m4)
18 sinclude(build/apr_network.m4)
19 sinclude(build/apr_threads.m4)
20 sinclude(build/apr_win32.m4)
21 sinclude(build/apr_hints.m4)
22 sinclude(build/libtool.m4)
23 sinclude(build/ltsugar.m4)
24 sinclude(build/argz.m4)
25 sinclude(build/ltoptions.m4)
26 sinclude(build/ltversion.m4)
27 sinclude(build/lt~obsolete.m4)
29 dnl Hard-coded top of apr_private.h:
35 dnl Hard-coded inclusion at the tail end of apr_private.h:
37 /* switch this on if we have a BeOS version below BONE */
38 #if BEOS && !HAVE_BONE_VERSION
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.
61 #undef APR_OFF_T_STRFN
62 #undef APR_INT64_STRFN
67 #undef SIZEOF_STRUCT_IOVEC
70 #define APR_INT64_STRFN strtol
72 #define SIZEOF_SIZE_T 8
73 #define SIZEOF_SSIZE_T 8
74 #define SIZEOF_VOIDP 8
75 #define SIZEOF_STRUCT_IOVEC 16
77 #define APR_INT64_STRFN strtoll
79 #define SIZEOF_SIZE_T 4
80 #define SIZEOF_SSIZE_T 4
81 #define SIZEOF_VOIDP 4
82 #define SIZEOF_STRUCT_IOVEC 8
85 #undef APR_OFF_T_STRFN
86 #define APR_OFF_T_STRFN APR_INT64_STRFN
90 #ifdef __DARWIN_UNIX03
91 #define SETPGRP_VOID 1
93 /* #undef SETPGRP_VOID */
96 #endif /* DARWIN_10 */
99 * Include common private declarations.
101 #include "../apr_private_common.h"
102 #endif /* APR_PRIVATE_H */
105 dnl Save user-defined environment settings for later restoration
107 APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
108 APR_SAVE_THE_ENVIRONMENT(CFLAGS)
109 APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
110 APR_SAVE_THE_ENVIRONMENT(LIBS)
111 APR_SAVE_THE_ENVIRONMENT(INCLUDES)
113 dnl Generate ./config.nice for reproducing runs of configure
115 APR_CONFIG_NICE(config.nice)
118 echo "Configuring APR library"
119 echo "Platform: $host"
121 dnl Some initial steps for configuration. We setup the default directory
122 dnl and which files are to be configured.
124 dnl Setup the directory macros now
126 # Absolute source/build directory
127 apr_srcdir=`(cd $srcdir && pwd)`
130 AC_SUBST(apr_builddir)
132 if test "$apr_builddir" != "$apr_srcdir"; then
134 APR_CONFIG_LOCATION=build
136 APR_CONFIG_LOCATION=source
139 AC_SUBST(APR_CONFIG_LOCATION)
141 # Libtool might need this symbol -- it must point to the location of
142 # the generated libtool script (not necessarily the "top" build dir).
144 top_builddir="$apr_builddir"
145 AC_SUBST(top_builddir)
147 # Directory containing apr build macros, helpers, and make rules
148 # NOTE: make rules (apr_rules.mk) will be in the builddir for vpath
150 apr_buildout=$apr_builddir/build
151 apr_builders=$apr_srcdir/build
152 AC_SUBST(apr_builders)
154 MKDIR=$apr_builders/mkdir.sh
156 dnl Initialize mkdir -p functionality.
157 APR_MKDIR_P_CHECK($apr_builders/mkdir.sh)
159 # get our version information
160 get_version="$apr_builders/get-version.sh"
161 version_hdr="$apr_srcdir/include/apr_version.h"
162 APR_MAJOR_VERSION="`$get_version major $version_hdr APR`"
163 APR_DOTTED_VERSION="`$get_version all $version_hdr APR`"
165 AC_SUBST(APR_DOTTED_VERSION)
166 AC_SUBST(APR_MAJOR_VERSION)
168 echo "APR Version: ${APR_DOTTED_VERSION}"
170 dnl Enable the layout handling code, then reparse the prefix-style
171 dnl arguments due to autoconf being a PITA.
172 APR_ENABLE_LAYOUT(apr)
175 dnl Set optional CC hints here in case autoconf makes an inappropriate choice.
176 dnl This allows us to suggest what the compiler should be, but still
177 dnl allows the user to override CC externally.
180 dnl Do the various CC checks *before* preloading values. The preload code
181 dnl may need to use compiler characteristics to make decisions. This macro
182 dnl can only be used once within a configure script, so this prevents a
183 dnl preload section from invoking the macro to get compiler info.
186 dnl AC_PROG_SED is only avaliable in recent autoconf versions.
187 dnl Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
190 [AC_CHECK_PROG(SED, sed, sed)])
195 dnl These added to allow default directories to be used...
197 echo "(Default will be ${DEFAULT_OSDIR})"
199 apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random"
201 dnl Checks for programs.
208 AC_CHECK_PROG(RM, rm, rm)
209 AC_CHECK_PROG(AS, as, as)
210 AC_CHECK_PROG(ASCPP, cpp, cpp)
211 AC_CHECK_TOOL(AR, ar, ar)
213 dnl Various OS checks that apparently set required flags
214 ifdef([AC_USE_SYSTEM_EXTENSIONS], [
215 AC_USE_SYSTEM_EXTENSIONS
224 dnl this is our library name
225 APR_LIBNAME="apr${libsuffix}"
226 AC_SUBST(APR_LIBNAME)
230 echo "performing libtool configuration..."
232 AC_ARG_ENABLE(experimental-libtool,[ --enable-experimental-libtool Use experimental custom libtool],
233 [experimental_libtool=$enableval],[experimental_libtool=no])
235 dnl Workarounds for busted Libtool 2.x when we don't call AC_PROG_LIBTOOL
236 if test "x$Xsed" = "x"; then
237 Xsed="$SED -e 1s/^X//"
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
248 if test "x$LTFLAGS" = "x"; then
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
262 dnl libtoolize requires that the following not be indented
263 dnl should become LT_INIT(win32-dll)
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
275 AC_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}" ] )
277 AC_SUBST(installbuilddir)
279 AC_ARG_WITH(libtool, [ --without-libtool avoid using libtool to link the library],
280 [ use_libtool=$withval ], [ use_libtool="yes" ] )
282 if 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 \$@"
287 lib_target='-rpath $(libdir) $(OBJECTS)'
288 export_lib_target='-rpath \$(libdir) \$(OBJECTS)'
290 lt_compile='$(COMPILE) -o $@ -c $<'
291 link='$(AR) cr $(TARGET_LIB) $(OBJECTS); $(RANLIB) $(TARGET_LIB)'
299 apr_platform_runtime_link_flag="-R"
309 AC_SUBST(export_lib_target)
310 AC_SUBST(shlibpath_var)
315 dnl ----------------------------- Checks for compiler flags
318 echo "${nl}Check for compiler flags..."
320 dnl AC_PROG_CC sets -g in CFLAGS (and -O2 for gcc) by default.
321 dnl On OS/390 this causes the compiler to insert extra debugger
322 dnl hook instructions. That's fine for debug/maintainer builds, not fine
327 if test "$ac_test_CFLAGS" != set; then
328 APR_REMOVEFROM(CFLAGS,-g)
333 AC_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)
342 AC_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)
351 AC_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)
363 AC_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
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`
403 APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=$apr_pool_debug)
407 if 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)
414 # this is the place to put specific options for platform/compiler
418 APR_ADDTO(CFLAGS,[-Ae +Z])
423 if echo "$CFLAGS " | grep '+DA' >/dev/null; then :
425 APR_ADDTO(CFLAGS,[+DAportable])
430 powerpc-*-beos:mwcc* )
431 APR_SETVAR(CPP,[mwcc -E])
437 AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins],
441 unsigned long val = 1010, tmp, *mem = &val;
443 if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
448 if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
451 if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
456 if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
459 if (__sync_lock_test_and_set(&val, 4040) != 3030)
464 if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
467 __sync_synchronize();
473 }], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])])
475 if test "$ap_cv_atomic_builtins" = "yes"; then
476 AC_DEFINE(HAVE_ATOMIC_BUILTINS, 1, [Define if compiler provides atomic builtins])
481 # The IBM ppc405cr processor has a bugged stwcx instruction.
482 AC_DEFINE(PPC405_ERRATA, 1, [Define on PowerPC 405 where errata 77 applies])
488 dnl Check the depend program we can use
491 proc_mutex_is_global=0
493 config_subdirs="none"
494 INSTALL_SUBDIRS="none"
495 OBJECTS_PLATFORM='$(OBJECTS_unix)'
498 i386-ibm-aix* | *-ibm-aix[[1-2]].* | *-ibm-aix3.* | *-ibm-aix4.1 | *-ibm-aix4.1.* | *-ibm-aix4.2 | *-ibm-aix4.2.*)
500 APR_ADDTO(LDFLAGS,-lld)
502 OBJECTS_PLATFORM='$(OBJECTS_aix)'
505 APR_ADDTO(CPPFLAGS,-DOS2)
506 APR_ADDTO(CFLAGS,-Zmt)
507 AC_CHECK_LIB(bsd, random)
509 enable_threads="system_threads"
512 proc_mutex_is_global=1
513 OBJECTS_PLATFORM='$(OBJECTS_os2)'
517 APR_ADDTO(CPPFLAGS,-DBEOS)
518 enable_threads="system_threads"
520 APR_CHECK_DEFINE(BONE_VERSION, sys/socket.h)
523 proc_mutex_is_global=1
524 OBJECTS_PLATFORM='$(OBJECTS_beos)'
536 OBJECTS_PLATFORM='$(OBJECTS_os390)'
545 enable_threads="system_threads"
548 proc_mutex_is_global=1
549 OBJECTS_PLATFORM='$(OBJECTS_win32)'
567 AC_SUBST(OBJECTS_PLATFORM)
569 # Check whether LFS has explicitly been disabled
570 AC_ARG_ENABLE(lfs,[ --disable-lfs Disable large file support on 32-bit platforms],
571 [apr_lfs_choice=$enableval], [apr_lfs_choice=yes])
573 if 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"
579 #include <sys/types.h>
580 #include <sys/stat.h>
592 if (sizeof(off64_t) != 8 || sizeof(off_t) != 4)
594 if ((fd = open("conftest.lfs", O_LARGEFILE|O_CREAT|O_WRONLY, 0644)) < 0)
596 if (ftruncate64(fd, off) != 0)
598 else if (fstat64(fd, &st) != 0 || st.st_size != off)
600 else if (lseek64(fd, off, SEEK_SET) != off)
602 else if (close(fd) != 0)
604 else if (lstat64("conftest.lfs", &st) != 0 || st.st_size != off)
606 else if (stat64("conftest.lfs", &st) != 0 || st.st_size != off)
608 unlink("conftest.lfs");
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])
618 AC_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
623 force_generic_atomics=yes
627 i[[456]]86) force_generic_atomics=yes ;;
628 *) force_generic_atomics=no ;;
632 if test $force_generic_atomics = yes; then
633 AC_DEFINE([USE_ATOMICS_GENERIC], 1,
634 [Define if use of generic atomics is requested])
637 AC_SUBST(proc_mutex_is_global)
639 AC_SUBST(INSTALL_SUBDIRS)
641 # For some platforms we need a version string which allows easy numeric
645 if test -x /sbin/sysctl; then
646 os_version=`/sbin/sysctl -n kern.osreldate`
652 os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'`
655 os_version=`uname -r | sed -e 's/\.//g'`
658 os_version=OS_VERSION_IS_NOT_SET
662 echo "${nl}Checking for libraries..."
664 dnl ----------------------------- Checks for Any required Libraries
665 dnl Note: Autoconf will always append LIBS with an extra " " in AC_CHECK_LIB.
666 dnl It should check for LIBS being empty and set LIBS equal to the new value
667 dnl without the extra " " in that case, but they didn't do that. So, we
668 dnl end up LIBS="-lm -lcrypt -lnsl -ldl" which is an annoyance.
671 APR_ADDTO(LIBS,[-lshell32 -ladvapi32 -lws2_32 -lrpcrt4 -lmswsock])
672 ac_cv_func_CreateFileMapping=yes
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)
684 dnl ----------------------------- Checking for Threads
685 echo "${nl}Checking for Threads..."
687 if 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" ] ) ] )
695 if test "$enable_threads" = "no"; then
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
705 APR_CHECK_PTHREADS_H([
712 APR_PTHREADS_CHECK_RESTORE ] )
713 elif test "$enable_threads" = "system_threads"; then
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
723 APR_CHECK_PTHREADS_H([
730 APR_PTHREADS_CHECK_RESTORE ] )
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])
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])
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])
759 ac_cv_define_READDIR_IS_THREAD_SAFE=no
760 ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no
761 ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no
762 ac_cv_define_GETSERVBYNAME_IS_THREAD_SAFE=no
763 if 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)
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])
775 if test "x$apr_gethostbyaddr_is_thread_safe" = "x"; then
776 AC_CHECK_LIB(c_r, gethostbyaddr, apr_gethostbyaddr_is_thread_safe=yes)
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])
782 if test "x$apr_getservbyname_is_thread_safe" = "x"; then
783 AC_CHECK_LIB(c_r, getservbyname, apr_getservbyname_is_thread_safe=yes)
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])
789 AC_CHECK_FUNCS(gethostbyname_r gethostbyaddr_r getservbyname_r)
791 echo "APR will be non-threaded"
794 dnl Electric Fence malloc checker.
795 dnl --with-efence specifies the path to Electric Fence.
796 dnl This test should remain after the threads checks since libefence
797 dnl may depend on libpthread.
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
805 [$apr_platform_runtime_link_flag$apr_efence_dir/lib])
808 AC_CHECK_LIB(efence, malloc,
809 [ APR_ADDTO(LIBS,-lefence) ],
810 [ AC_MSG_ERROR(Electric Fence requested but not detected) ])
813 AC_CHECK_FUNCS(sigsuspend, [ have_sigsuspend="1" ], [ have_sigsuspend="0" ])
814 AC_CHECK_FUNCS(sigwait, [ have_sigwait="1" ], [ have_sigwait="0" ])
815 dnl AC_CHECK_FUNCS doesn't work for this on Tru64 since the function
816 dnl is renamed in signal.h. Todo: Autodetect
824 AC_SUBST(have_sigsuspend)
825 AC_SUBST(have_sigwait)
827 AC_CHECK_FUNCS(poll kqueue port_create)
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.
831 AC_CACHE_CHECK([for epoll support], [apr_cv_epoll],
833 #include <sys/epoll.h>
838 return epoll_create(5) == -1;
839 }], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])])
841 if test "$apr_cv_epoll" = "yes"; then
842 AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported])
845 dnl ----------------------------- Checking for extended file descriptor handling
846 # test for epoll_create1
847 AC_CACHE_CHECK([for epoll_create1 support], [apr_cv_epoll_create1],
849 #include <sys/epoll.h>
854 return epoll_create1(0) == -1;
855 }], [apr_cv_epoll_create1=yes], [apr_cv_epoll_create1=no], [apr_cv_epoll_create1=no])])
857 if test "$apr_cv_epoll_create1" = "yes"; then
858 AC_DEFINE([HAVE_EPOLL_CREATE1], 1, [Define if epoll_create1 function is supported])
862 AC_CACHE_CHECK([for dup3 support], [apr_cv_dup3],
868 return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1;
869 }], [apr_cv_dup3=yes], [apr_cv_dup3=no], [apr_cv_dup3=no])])
871 if test "$apr_cv_dup3" = "yes"; then
872 AC_DEFINE([HAVE_DUP3], 1, [Define if dup3 function is supported])
876 AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4],
879 #include <sys/types.h>
880 #include <sys/socket.h>
882 #include <sys/wait.h>
886 #define A4_SOCK "./apr_accept4_test_socket"
892 struct sockaddr_un loc, rem;
895 if ((pid = fork())) {
900 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
901 goto cleanup_failure2;
903 loc.sun_family = AF_UNIX;
904 strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);
906 if (bind(fd, (struct sockaddr *) &loc,
907 sizeof(struct sockaddr_un)) == -1)
908 goto cleanup_failure;
910 if (listen(fd, 5) == -1)
911 goto cleanup_failure;
913 rem_sz = sizeof(struct sockaddr_un);
914 if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) {
915 goto cleanup_failure;
919 waitpid(pid, &status, 0);
928 waitpid(pid, &status, 0);
933 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
934 return 1; /* this will be bad: we'll hang */
936 loc.sun_family = AF_UNIX;
937 strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);
939 while(connect(fd, (struct sockaddr *) &loc,
940 sizeof(struct sockaddr_un)) == -1 &&
941 (errno==ENOENT || errno==ECONNREFUSED))
947 }], [apr_cv_accept4=yes], [apr_cv_accept4=no], [apr_cv_accept4=no])])
949 if test "$apr_cv_accept4" = "yes"; then
950 AC_DEFINE([HAVE_ACCEPT4], 1, [Define if accept4 function is supported])
953 AC_CACHE_CHECK([for SOCK_CLOEXEC support], [apr_cv_sock_cloexec],
955 #include <sys/types.h>
956 #include <sys/socket.h>
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])])
963 if test "$apr_cv_sock_cloexec" = "yes"; then
964 AC_DEFINE([HAVE_SOCK_CLOEXEC], 1, [Define if the SOCK_CLOEXEC flag is supported])
967 dnl ----------------------------- Checking for fdatasync: OS X doesn't have it
968 AC_CHECK_FUNCS(fdatasync)
970 dnl ----------------------------- Checking for extended file descriptor handling
971 # test for epoll_create1
972 AC_CACHE_CHECK([for epoll_create1 support], [apr_cv_epoll_create1],
974 #include <sys/epoll.h>
979 return epoll_create1(0) == -1;
980 }], [apr_cv_epoll_create1=yes], [apr_cv_epoll_create1=no], [apr_cv_epoll_create1=no])])
982 if test "$apr_cv_epoll_create1" = "yes"; then
983 AC_DEFINE([HAVE_EPOLL_CREATE1], 1, [Define if epoll_create1 function is supported])
987 AC_CACHE_CHECK([for dup3 support], [apr_cv_dup3],
993 return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1;
994 }], [apr_cv_dup3=yes], [apr_cv_dup3=no], [apr_cv_dup3=no])])
996 if test "$apr_cv_dup3" = "yes"; then
997 AC_DEFINE([HAVE_DUP3], 1, [Define if dup3 function is supported])
1001 AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4],
1004 #include <sys/types.h>
1005 #include <sys/socket.h>
1007 #include <sys/wait.h>
1011 #define A4_SOCK "./apr_accept4_test_socket"
1017 struct sockaddr_un loc, rem;
1020 if ((pid = fork())) {
1025 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
1026 goto cleanup_failure2;
1028 loc.sun_family = AF_UNIX;
1029 strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);
1031 if (bind(fd, (struct sockaddr *) &loc,
1032 sizeof(struct sockaddr_un)) == -1)
1033 goto cleanup_failure;
1035 if (listen(fd, 5) == -1)
1036 goto cleanup_failure;
1038 rem_sz = sizeof(struct sockaddr_un);
1039 if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) {
1040 goto cleanup_failure;
1044 waitpid(pid, &status, 0);
1053 waitpid(pid, &status, 0);
1058 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
1059 return 1; /* this will be bad: we'll hang */
1061 loc.sun_family = AF_UNIX;
1062 strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);
1064 while(connect(fd, (struct sockaddr *) &loc,
1065 sizeof(struct sockaddr_un)) == -1 &&
1066 (errno==ENOENT || errno==ECONNREFUSED))
1072 }], [apr_cv_accept4=yes], [apr_cv_accept4=no], [apr_cv_accept4=no])])
1074 if test "$apr_cv_accept4" = "yes"; then
1075 AC_DEFINE([HAVE_ACCEPT4], 1, [Define if accept4 function is supported])
1078 AC_CACHE_CHECK([for SOCK_CLOEXEC support], [apr_cv_sock_cloexec],
1080 #include <sys/types.h>
1081 #include <sys/socket.h>
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])])
1088 if test "$apr_cv_sock_cloexec" = "yes"; then
1089 AC_DEFINE([HAVE_SOCK_CLOEXEC], 1, [Define if the SOCK_CLOEXEC flag is supported])
1092 dnl ----------------------------- Checking for missing POSIX thread functions
1093 AC_CHECK_FUNCS([getpwnam_r getpwuid_r getgrnam_r getgrgid_r])
1095 dnl ----------------------------- Checking for Shared Memory Support
1096 echo "${nl}Checking for Shared Memory Support..."
1098 # The real-time POSIX extensions (e.g. shm_*, sem_*) may only
1099 # be available if linking against librt.
1100 AC_SEARCH_LIBS(shm_open, rt)
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>
1110 AC_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])
1111 AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
1114 APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
1115 AC_CHECK_FILE(/dev/zero)
1117 # Not all systems can mmap /dev/zero (such as HP-UX). Check for that.
1118 if 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)
1122 #include <sys/types.h>
1123 #include <sys/stat.h>
1125 #ifdef HAVE_SYS_MMAN_H
1126 #include <sys/mman.h>
1132 fd = open("/dev/zero", O_RDWR);
1136 m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
1137 if (m == (void *)-1) { /* aka MAP_FAILED */
1140 if (munmap(m, sizeof(void*)) < 0) {
1144 }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])
1146 AC_MSG_RESULT($ac_cv_file__dev_zero)
1149 # Now we determine which one is our anonymous shmem preference.
1153 APR_BEGIN_DECISION([anonymous shared memory allocation method])
1154 APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
1155 func:shmget func:shmat func:shmdt func:shmctl,
1157 APR_DECIDE(USE_SHMEM_SHMGET_ANON, [SysV IPC shmget()])])
1158 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap file:/dev/zero,
1160 APR_DECIDE(USE_SHMEM_MMAP_ZERO,
1161 [SVR4-style mmap() on /dev/zero])])
1162 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON,
1164 APR_DECIDE(USE_SHMEM_MMAP_ANON,
1165 [4.4BSD-style mmap() via MAP_ANON])])
1166 APR_IFALLYES(header:os2.h,
1168 APR_DECIDE(USE_SHMEM_OS2_ANON, [OS/2 DosAllocSharedMem()])])
1169 APR_IFALLYES(header:kernel/OS.h func:create_area,
1171 APR_DECIDE(USE_SHMEM_BEOS_ANON,
1173 APR_IFALLYES(header:windows.h func:CreateFileMapping,
1175 APR_DECIDE(USE_SHMEM_WIN32_ANON,
1176 [Windows CreateFileMapping()])])
1179 # Linux has problems with MM_SHMT_MMANON even though it reports
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)
1188 APR_DECISION_OVERRIDE(USE_SHMEM_SHMGET_ANON)
1192 AC_DEFINE_UNQUOTED($ac_decision)
1198 case $ac_decision in
1199 USE_SHMEM_SHMGET_ANON )
1202 USE_SHMEM_MMAP_ZERO )
1205 USE_SHMEM_MMAP_ANON )
1210 AC_SUBST(useshmgetanon)
1211 AC_SUBST(usemmapzero)
1212 AC_SUBST(usemmapanon)
1213 AC_SUBST(haveshmgetanon)
1214 AC_SUBST(havemmapzero)
1215 AC_SUBST(havemmapanon)
1217 # Now we determine which one is our name-based shmem preference.
1224 APR_BEGIN_DECISION([namebased memory allocation method])
1225 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
1227 APR_DECIDE(USE_SHMEM_MMAP_TMP,
1228 [Classical mmap() on temporary file])])
1229 APR_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open dnl
1232 APR_DECIDE(USE_SHMEM_MMAP_SHM,
1233 [mmap() via POSIX.1 shm_open() on temporary file])])
1234 APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
1235 func:shmget func:shmat func:shmdt func:shmctl,
1237 APR_DECIDE(USE_SHMEM_SHMGET, [SysV IPC shmget()])])
1238 APR_IFALLYES(header:kernel/OS.h func:create_area,
1240 APR_DECIDE(USE_SHMEM_BEOS, [BeOS areas])])
1241 APR_IFALLYES(header:os2.h,
1243 APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])])
1244 APR_IFALLYES(header:windows.h,
1246 APR_DECIDE(USE_SHMEM_WIN32, [Windows shared memory])])
1249 # Linux has problems with MM_SHMT_MMANON even though it reports
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
1260 AC_DEFINE_UNQUOTED($ac_decision)
1269 case $ac_decision in
1270 USE_SHMEM_MMAP_TMP )
1273 USE_SHMEM_MMAP_SHM )
1290 # Do we have any shared memory support?
1291 if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm$usewin32shm" = "00000000"; then
1297 AC_SUBST(usemmaptmp)
1298 AC_SUBST(usemmapshm)
1300 AC_SUBST(usebeosarea)
1302 AC_SUBST(usewin32shm)
1303 AC_SUBST(havemmaptmp)
1304 AC_SUBST(havemmapshm)
1305 AC_SUBST(haveshmget)
1306 AC_SUBST(havebeosarea)
1307 AC_SUBST(haveos2shm)
1308 AC_SUBST(havewin32shm)
1311 dnl ----------------------------- Checks for Any required Functions
1312 dnl Checks for library functions. (N.B. poll is further down)
1316 AC_CHECK_FUNCS([calloc setsid isinf isnan \
1317 getenv putenv setenv unsetenv \
1318 writev getifaddrs utime utimes])
1319 AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ])
1320 AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ])
1322 AC_CHECK_LIB(sendfile, sendfilev)
1323 AC_CHECK_FUNCS(sendfile send_file sendfilev, [ sendfile="1" ])
1325 dnl THIS MUST COME AFTER THE THREAD TESTS - FreeBSD doesn't always have a
1326 dnl threaded poll() and we don't want to use sendfile on early FreeBSD
1327 dnl systems if we are also using threads.
1329 AC_ARG_WITH(sendfile, [ --with-sendfile Override decision to use sendfile],
1330 [ if test "$withval" = "yes"; then
1335 orig_sendfile=$sendfile
1338 # FreeBSD < 4.2 has issues with threads+sendfile
1339 if test $os_version -le "401999"; then
1340 if test "$threads" = "1"; then
1349 # disable sendfile support for 2.2 on S/390
1350 if test $os_version -lt 240; then
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
1363 if test "$orig_sendfile" != "$sendfile"; then
1364 echo "sendfile support disabled to avoid system problem"
1368 AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ])
1371 AC_CHECK_FUNCS(fork, [ fork="1" ], [ fork="0" ])
1373 APR_CHECK_INET_NETWORK
1374 AC_SUBST(apr_inaddr_none)
1375 AC_CHECK_FUNC(_getch)
1376 AC_CHECK_FUNCS(strerror_r, [ strerror_r="1" ], [ strerror_r="0" ])
1377 if test "$strerror_r" = "1"; then
1378 APR_CHECK_STRERROR_R_RC
1380 AC_CHECK_FUNCS(mmap, [ mmap="1" ], [ mmap="0" ])
1381 if test "$native_mmap_emul" = "1"; then
1384 AC_CHECK_FUNCS(memmove, [ have_memmove="1" ], [have_memmove="0" ])
1385 AC_CHECK_FUNCS([getpass getpassphrase gmtime_r localtime_r mkstemp])
1388 AC_SUBST(have_inet_addr)
1389 AC_SUBST(tcp_nodelay_inherited)
1390 AC_SUBST(o_nonblock_inherited)
1391 AC_SUBST(have_inet_network)
1392 AC_SUBST(have_sigaction)
1393 AC_SUBST(have_setrlimit)
1394 AC_SUBST(have_getrlimit)
1396 AC_SUBST(have_memmove)
1398 APR_CHECK_SIGWAIT_ONE_ARG
1400 dnl ----------------------------- Checks for Any required Headers
1448 netinet/sctp_uio.h \
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.
1473 AC_CACHE_CHECK([for netinet/tcp.h], [apr_cv_hdr_netinet_tcp_h],
1475 [#ifdef HAVE_NETINET_IN_H
1476 #include <netinet/in.h>
1478 #include <netinet/tcp.h>
1479 ], [apr_cv_hdr_netinet_tcp_h=yes], [apr_cv_hdr_netinet_tcp_h=no])])
1480 if test "$apr_cv_hdr_netinet_tcp_h" = "yes"; then
1482 AC_DEFINE([HAVE_NETINET_TCP_H], 1, [Defined if netinet/tcp.h is present])
1487 AC_SUBST(arpa_ineth)
1497 AC_SUBST(sys_syslimitsh)
1498 AC_SUBST(netinet_inh)
1499 AC_SUBST(netinet_sctph)
1500 AC_SUBST(netinet_sctp_uioh)
1501 AC_SUBST(netinet_tcph)
1507 AC_SUBST(sys_ioctlh)
1508 AC_SUBST(sys_sendfileh)
1509 AC_SUBST(sys_signalh)
1510 AC_SUBST(sys_socketh)
1511 AC_SUBST(sys_sockioh)
1512 AC_SUBST(sys_typesh)
1522 AC_SUBST(semaphoreh)
1526 # Checking for h_errno in <netdb.h>
1527 if 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])
1534 AC_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]) ]
1545 dnl ----------------------------- Checks for standard typedefs
1550 AC_CHECK_TYPE(ssize_t, int)
1557 dnl Checks for pointer size
1558 AC_CHECK_SIZEOF(void*, 4)
1560 if test "x$ac_cv_sizeof_voidp" != "x"; then
1561 voidp_size=$ac_cv_sizeof_voidp
1563 AC_ERROR([Cannot determine size of void*])
1566 dnl Checks for integer size
1567 AC_CHECK_SIZEOF(char, 1)
1568 AC_CHECK_SIZEOF(int, 4)
1569 AC_CHECK_SIZEOF(long, 4)
1570 AC_CHECK_SIZEOF(short, 2)
1571 AC_CHECK_SIZEOF(long long, 8)
1573 if test "$ac_cv_sizeof_short" = "2"; then
1576 if test "$ac_cv_sizeof_int" = "4"; then
1579 # Now we need to find what apr_int64_t (sizeof == 8) will be.
1580 # The first match is our preference.
1581 if 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"'
1589 int64_strfn="strtoi"
1590 elif 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"'
1598 int64_strfn="strtol"
1599 elif 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"
1612 elif 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"
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])
1627 # If present, allow the C99 macro INT64_C to override our conversion.
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
1631 AC_CACHE_CHECK([for INT64_C], [apr_cv_define_INT64_C], [
1632 AC_EGREP_CPP(YES_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>
1640 #endif], [apr_cv_define_INT64_C=yes], [apr_cv_define_INT64_C=no])])])
1642 if 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)'
1650 if test "$ac_cv_type_size_t" = "yes"; then
1651 size_t_value="size_t"
1653 size_t_value="apr_int32_t"
1655 if test "$ac_cv_type_ssize_t" = "yes"; then
1656 ssize_t_value="ssize_t"
1658 ssize_t_value="apr_int32_t"
1660 if test "$ac_cv_socklen_t" = "yes"; then
1661 socklen_t_value="socklen_t"
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"
1675 socklen_t_value="int"
1678 APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
1680 if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
1681 pid_t_fmt='#define APR_PID_T_FMT "hd"'
1682 elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then
1683 pid_t_fmt='#define APR_PID_T_FMT "d"'
1684 elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then
1685 pid_t_fmt='#define APR_PID_T_FMT "ld"'
1686 elif 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'
1689 pid_t_fmt='#error Can not determine the proper size for pid_t'
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
1697 # uniquely, the 31-bit Linux/s390 uses "unsigned long int"
1698 # for size_t rather than "unsigned int":
1706 if test "$ac_cv_sizeof_long" = "8"; then
1707 pid_t_fmt='#define APR_PID_T_FMT "d"'
1709 pid_t_fmt='#define APR_PID_T_FMT "ld"'
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"
1742 APR_CHECK_TYPES_COMPATIBLE(ssize_t, int, [ssize_t_fmt="d"])
1743 APR_CHECK_TYPES_COMPATIBLE(ssize_t, long, [ssize_t_fmt="ld"])
1744 APR_CHECK_TYPES_COMPATIBLE(size_t, unsigned int, [size_t_fmt="u"])
1745 APR_CHECK_TYPES_COMPATIBLE(size_t, unsigned long, [size_t_fmt="lu"])
1747 APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
1749 AC_MSG_CHECKING([which format to use for apr_ssize_t])
1750 if test -n "$ssize_t_fmt"; then
1751 AC_MSG_RESULT(%$ssize_t_fmt)
1752 elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
1755 elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
1759 AC_ERROR([could not determine the proper format for apr_ssize_t])
1762 ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
1764 APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
1766 AC_MSG_CHECKING([which format to use for apr_size_t])
1767 if test -n "$size_t_fmt"; then
1768 AC_MSG_RESULT(%$size_t_fmt)
1769 elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
1772 elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
1776 AC_ERROR([could not determine the proper format for apr_size_t])
1779 size_t_fmt="#define APR_SIZE_T_FMT \"$size_t_fmt\""
1781 APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
1783 if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
1786 AC_CHECK_FUNCS([mmap64 sendfile64 sendfilev64 mkstemp64 readdir64_r])
1787 elif 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
1795 AC_MSG_CHECKING([which type to use for apr_off_t])
1796 if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
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'
1801 elif 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.
1807 off_t_fmt='#define APR_OFF_T_FMT "ld"'
1808 off_t_strfn='strtol'
1809 elif test "$ac_cv_type_off_t" = "yes"; then
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'
1823 AC_ERROR([could not determine the size of off_t])
1828 off_t_value=apr_int64_t
1829 off_t_fmt='#define APR_OFF_T_FMT "I64d"'
1830 off_t_strfn='_strtoi64'
1835 off_t_value=apr_int32_t
1837 off_t_strfn='strtoi'
1839 AC_MSG_RESULT($off_t_value)
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)
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
1856 ino_t_value=apr_int64_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"
1865 ino_t_value="unsigned int"
1870 AC_MSG_NOTICE([using $ino_t_value for ino_t])
1872 # Checks for endianness
1874 if test $ac_cv_c_bigendian = yes; then
1880 APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>
1881 #include <sys/uio.h>],struct iovec,0)
1882 if test "$ac_cv_sizeof_struct_iovec" = "0"; then
1888 AC_SUBST(voidp_size)
1889 AC_SUBST(short_value)
1891 AC_SUBST(long_value)
1892 AC_SUBST(int64_value)
1893 AC_SUBST(off_t_value)
1894 AC_SUBST(size_t_value)
1895 AC_SUBST(ssize_t_value)
1896 AC_SUBST(socklen_t_value)
1897 AC_SUBST(int64_t_fmt)
1898 AC_SUBST(uint64_t_fmt)
1899 AC_SUBST(uint64_t_hex_fmt)
1900 AC_SUBST(ssize_t_fmt)
1901 AC_SUBST(size_t_fmt)
1904 AC_SUBST(int64_literal)
1905 AC_SUBST(uint64_literal)
1909 AC_SUBST(have_iovec)
1910 AC_SUBST(ino_t_value)
1912 dnl ----------------------------- Checking for string functions
1913 AC_CHECK_FUNCS(strnicmp, have_strnicmp="1", have_strnicmp="0")
1914 AC_CHECK_FUNCS(strncasecmp, have_strncasecmp="1", have_strncasecmp="0")
1915 AC_CHECK_FUNCS(stricmp, have_stricmp="1", have_stricmp="0")
1916 AC_CHECK_FUNCS(strcasecmp, have_strcasecmp="1", have_strcasecmp="0")
1917 AC_CHECK_FUNCS(strdup, have_strdup="1", have_strdup="0")
1918 AC_CHECK_FUNCS(strstr, have_strstr="1", have_strstr="0")
1919 AC_CHECK_FUNCS(memchr, have_memchr="1", have_memchr="0")
1920 AC_CHECK_FUNC($int64_strfn, have_int64_strfn="1", have_int64_strfn="0")
1922 dnl ----------------------------- We have a fallback position
1923 if 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])
1928 if 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])
1933 AC_SUBST(have_strnicmp)
1934 AC_SUBST(have_strncasecmp)
1935 AC_SUBST(have_stricmp)
1936 AC_SUBST(have_strcasecmp)
1937 AC_SUBST(have_strdup)
1938 AC_SUBST(have_strstr)
1939 AC_SUBST(have_memchr)
1941 if test "$off_t_strfn" = "apr_strtoi64" && test "$have_int64_strfn" = "1"; then
1942 off_t_strfn=$int64_strfn
1944 AC_DEFINE_UNQUOTED(APR_OFF_T_STRFN, [$off_t_strfn],
1945 [Define as function used for conversion of strings to apr_off_t])
1947 dnl ----------------------------- Checking for DSO support
1948 echo "${nl}Checking for DSO..."
1950 [ --disable-dso Disable DSO support ],
1951 [if test "x$enableval" = "xyes"; then
1958 if test "$dsotype" = "any"; then
1959 if test "$dsotype" = "any"; then
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)
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.
1980 if test "$dsotype" = "any"; then
1981 AC_CHECK_FUNC(dlopen, [dsotype=dlfcn])
1983 if test "$dsotype" = "any"; then
1984 AC_CHECK_LIB(dl, dlopen, [dsotype=dlfcn; APR_ADDTO(LIBS,-ldl)])
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)],
1992 echo "Weird: dlopen() was found but dlsym() was not found!"])])
1994 if test "$dsotype" = "any"; then
1996 AC_CHECK_LIB(root, load_image, [dsotype=other])
1999 if test "$dsotype" = "any"; then
2001 *os390|*os400|*-aix*)
2002 # Some -aix5 will use dl, no hassles. Keep that pattern here.
2005 if test "$have_shl" = "1"; then
2006 dsotype=shl; APR_ADDTO(LIBS,-ldld)
2012 if test "$dsotype" = "any"; then
2013 AC_MSG_ERROR([Could not detect suitable DSO implementation])
2014 elif test "$dsotype" = "no"; then
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"]);;
2025 apr_modules="$apr_modules dso"
2030 dnl ----------------------------- Checking for Processes
2031 echo "${nl}Checking for Processes..."
2033 AC_CHECK_FUNCS(waitpid)
2035 AC_ARG_ENABLE(other-child,
2036 [ --enable-other-child Enable reliable child processes ],
2037 [ if test "$enableval" = "yes"; then
2046 if test -z "$have_proc_invoked"; then
2047 have_proc_invoked="0"
2050 AC_SUBST(have_proc_invoked)
2052 AC_MSG_CHECKING(for Variable Length Arrays)
2053 APR_TRY_COMPILE_NO_WARNING([],
2057 ], vla_msg=yes, vla_msg=no )
2058 AC_MSG_RESULT([$vla_msg])
2059 if test "$vla_msg" = "yes"; then
2060 AC_DEFINE(HAVE_VLA, 1, [Define if C compiler supports VLA])
2063 AC_CACHE_CHECK(struct rlimit,ac_cv_struct_rlimit,[
2065 #include <sys/types.h>
2066 #include <sys/time.h>
2067 #include <sys/resource.h>
2070 struct rlimit limit;
2075 ac_cv_struct_rlimit=yes ], [
2076 ac_cv_struct_rlimit=no ], [
2077 ac_cv_struct_rlimit=no ] ) ] )
2079 test "x$ac_cv_struct_rlimit" = xyes && struct_rlimit=1
2080 AC_SUBST(struct_rlimit)
2082 dnl ----------------------------- Checking for Locking Characteristics
2083 echo "${nl}Checking for Locking..."
2085 AC_CHECK_FUNCS(semget semctl flock)
2086 AC_CHECK_HEADERS(semaphore.h OS.h)
2087 AC_SEARCH_LIBS(sem_open, rt)
2088 AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait create_sem)
2090 # Some systems return ENOSYS from sem_open.
2091 AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[
2096 #include <semaphore.h>
2098 #define SEM_FAILED (-1)
2103 const char *sem_name = "/apr_autoconf";
2105 psem = sem_open(sem_name, O_CREAT, 0644, 1);
2106 if (psem == (sem_t *)SEM_FAILED) {
2110 psem = sem_open(sem_name, O_CREAT | O_EXCL, 0644, 1);
2111 if (psem != (sem_t *)SEM_FAILED) {
2115 sem_unlink(sem_name);
2117 }], [ac_cv_func_sem_open=yes], [ac_cv_func_sem_open=no],
2118 [ac_cv_func_sem_open=no])])
2120 # It's stupid, but not all platforms have union semun, even those that need it.
2121 AC_MSG_CHECKING(for union semun in sys/sem.h)
2123 #include <sys/types.h>
2124 #include <sys/ipc.h>
2125 #include <sys/sem.h>
2128 semctl(0, 0, 0, arg);
2129 ], [have_union_semun="1" union_semun=yes ]
2131 have_union_semun="0"
2133 AC_MSG_RESULT([$msg])
2134 AC_SUBST(have_union_semun)
2136 dnl Checks for libraries.
2137 APR_CHECK_DEFINE(LOCK_EX, sys/file.h)
2138 APR_CHECK_DEFINE(F_SETLK, fcntl.h)
2139 APR_CHECK_DEFINE(SEM_UNDO, sys/sem.h)
2141 # We are assuming that if the platform doesn't have POLLIN, it doesn't have
2142 # any POLL definitions.
2143 APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h)
2145 if 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, [
2155 #include <sys/types.h>
2156 #include <pthread.h>
2159 pthread_mutex_t mutex;
2160 pthread_mutexattr_t attr;
2161 if (pthread_mutexattr_init(&attr))
2163 if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
2165 if (pthread_mutex_init(&mutex, &attr))
2167 if (pthread_mutexattr_destroy(&attr))
2169 if (pthread_mutex_destroy(&mutex))
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])
2176 if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then
2177 APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX
2181 # See which lock mechanisms we can support on this system.
2182 APR_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")
2185 APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1",
2187 APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
2188 APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0")
2189 # note: the current APR use of shared mutex requires /dev/zero
2190 APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
2191 func:pthread_mutexattr_setpshared dnl
2193 hasprocpthreadser="1", hasprocpthreadser="0")
2194 APR_IFALLYES(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="0")
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.
2206 APR_BEGIN_DECISION([apr_lock implementation method])
2207 APR_IFALLYES(func:flock define:LOCK_EX,
2208 APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
2209 APR_IFALLYES(header:fcntl.h define:F_SETLK,
2210 APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
2211 APR_IFALLYES(func:semget func:semctl define:SEM_UNDO,
2212 APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
2213 APR_IFALLYES(header:OS.h func:create_sem,
2214 APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores]))
2215 if test "x$apr_lock_method" != "x"; then
2216 APR_DECISION_FORCE($apr_lock_method)
2219 AC_DEFINE_UNQUOTED($ac_decision)
2226 case $ac_decision in
2227 USE_FLOCK_SERIALIZE )
2230 USE_FCNTL_SERIALIZE )
2233 USE_SYSVSEM_SERIALIZE )
2236 USE_POSIXSEM_SERIALIZE )
2239 USE_PROC_PTHREAD_SERIALIZE )
2247 if test $hasfcntlser = "1"; then
2248 AC_MSG_CHECKING(if fcntl returns EACCES when F_SETLK is already held)
2250 #ifdef HAVE_STDLIB_H
2253 #ifdef HAVE_SYS_TYPES_H
2254 #include <sys/types.h>
2256 #ifdef HAVE_SYS_STAT_H
2257 #include <sys/stat.h>
2259 #ifdef HAVE_SYS_WAIT_H
2260 #include <sys/wait.h>
2262 #if defined(HAVE_UNISTD_H)
2269 struct flock proc_mutex_lock_it = {0};
2270 const char *fname = "conftest.fcntl";
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 */
2278 fd = creat(fname, S_IRWXU);
2281 if (rc = lockit()) {
2293 exit(WEXITSTATUS(status) != EACCES);
2299 rc = fcntl(fd, F_SETLK, &proc_mutex_lock_it);
2300 } while ( rc < 0 && errno == EINTR);
2302 return (rc < 0) ? errno : 0;
2303 }], [apr_fcntl_tryacquire_eacces=1], [apr_fcntl_tryacquire_eacces=0], [apr_fcntl_tryacquire_eacces=0])
2306 if 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])
2314 AC_SUBST(hasflockser)
2315 AC_SUBST(hassysvser)
2316 AC_SUBST(hasposixser)
2317 AC_SUBST(hasfcntlser)
2318 AC_SUBST(hasprocpthreadser)
2323 AC_SUBST(procpthreadser)
2324 AC_SUBST(pthreadser)
2326 AC_MSG_CHECKING(if all interprocess locks affect threads)
2327 if test "x$apr_process_lock_is_global" = "xyes"; then
2335 AC_SUBST(proclockglobal)
2337 AC_MSG_CHECKING(if POSIX sems affect threads in the same process)
2338 if 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])
2346 AC_MSG_CHECKING(if SysV sems affect threads in the same process)
2347 if 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])
2355 AC_MSG_CHECKING(if fcntl locks affect threads in the same process)
2356 if 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])
2364 AC_MSG_CHECKING(if flock locks affect threads in the same process)
2365 if 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])
2373 dnl ----------------------------- Checking for /dev/random
2374 AC_MSG_CHECKING(for entropy source)
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])
2385 AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["$withval"])
2387 AC_MSG_RESULT(EGD-compatible daemon)
2391 if 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" ])
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
2406 elif test "$apr_devrandom" != "no"; then
2407 if test -r "$apr_devrandom"; then
2410 AC_ERROR([$apr_devrandom not found or unreadable.])
2414 if test "$rand" = "1"; then
2417 if test $os_version -lt 1700; then
2419 why_no_rand=" ($apr_devrandom unusable on z/OS before V1R7)"
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])
2431 if test "$rand" != "1"; then
2433 # we have built in support for OS/2
2435 AC_MSG_RESULT([Using OS/2 builtin random])
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)
2445 AC_MSG_RESULT(not found$why_no_rand)
2455 dnl ----------------------------- Checking for File Info Support
2456 echo "${nl}Checking for File Info Support..."
2457 AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_atimensec,
2458 struct stat.st_ctimensec, struct stat.st_mtimensec, struct stat.st_atim.tv_nsec,
2459 struct stat.st_ctim.tv_nsec, struct stat.st_mtim.tv_nsec,
2460 struct 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>
2464 #ifdef HAVE_SYS_STAT_H
2465 #include <sys/stat.h>
2467 #ifdef HAVE_UNISTD_H
2471 APR_CHECK_DIRENT_INODE
2472 APR_CHECK_DIRENT_TYPE
2474 dnl ----------------------------- Checking for UUID Support
2475 echo "${nl}Checking for OS UUID Support..."
2477 AC_CHECK_HEADERS(uuid.h uuid/uuid.h sys/uuid.h, break)
2479 apr_revert_save_LIBS=$LIBS
2481 # Prefer the flavor(s) that live in libc;
2482 AC_SEARCH_LIBS(uuid_create, uuid)
2483 AC_SEARCH_LIBS(uuid_generate, uuid)
2484 if test "$ac_cv_search_uuid_create" = "none required" -o \
2485 "$ac_cv_search_uuid_generate" = "none required"; then
2486 LIBS=$apr_revert_save_LIBS
2489 AC_CHECK_FUNCS(uuid_create uuid_generate)
2491 AC_CACHE_CHECK([for os uuid usability], [apr_cv_osuuid], [
2492 # Ensure this test closely mirrors misc/unix/rand.c!
2494 #if defined(HAVE_SYS_TYPES_H)
2495 #include <sys/types.h>
2497 #if defined(HAVE_UNISTD_H)
2500 #if defined(HAVE_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>
2509 if test $ac_cv_func_uuid_create = yes; then
2510 AC_TRY_LINK([$uuid_includes], [
2513 uuid_create(&g, &s);
2514 if (s == uuid_s_ok) s = 0;
2515 ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_create=no])
2517 if test $ac_cv_func_uuid_generate = yes; then
2518 AC_TRY_LINK([$uuid_includes], [
2521 ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_generate=no])
2525 if test $apr_cv_osuuid = yes; then
2529 LIBS=$apr_revert_save_LIBS
2534 dnl ----------------------------- Checking for Time Support
2535 echo "${nl}Checking for Time Support..."
2537 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[
2538 #include <sys/types.h>
2541 dnl ----------------------------- Checking for Networking Support
2542 echo "${nl}Checking for Networking support..."
2544 if test "$ac_cv_type_in_addr" = "yes"; then
2550 AC_MSG_CHECKING([if fd == socket on this platform])
2551 if test "x$file_as_socket" != "x0" ; then
2558 AC_SUBST(have_in_addr)
2559 AC_SUBST(file_as_socket)
2561 if 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)])
2566 # Check the types only if we have gethostbyname_r
2567 if test "$ac_cv_func_gethostbyname_r" = "yes"; then
2568 APR_CHECK_GETHOSTBYNAME_R_STYLE
2571 # Check the types only if we have getservbyname_r
2572 if test "$ac_cv_func_getservbyname_r" = "yes"; then
2573 APR_CHECK_GETSERVBYNAME_R_STYLE
2576 APR_CHECK_TCP_NODELAY_INHERITED
2577 APR_CHECK_O_NONBLOCK_INHERITED
2578 APR_CHECK_TCP_NODELAY_WITH_CORK
2580 # Look for a way of corking TCP...
2581 APR_CHECK_DEFINE(TCP_CORK, netinet/tcp.h)
2582 APR_CHECK_DEFINE(TCP_NOPUSH, netinet/tcp.h)
2583 apr_tcp_nopush_flag="0"
2584 have_corkable_tcp="0"
2585 if test "x$ac_cv_define_TCP_CORK" = "xyes"; then
2586 apr_tcp_nopush_flag="TCP_CORK"
2587 have_corkable_tcp="1"
2592 #include <linux/socket.h>
2597 apr_tcp_nopush_flag="3"
2598 have_corkable_tcp="1"
2605 if test "x$ac_cv_define_TCP_NOPUSH" = "xyes"; then
2606 apr_tcp_nopush_flag="TCP_NOPUSH"
2607 have_corkable_tcp="1"
2610 APR_CHECK_DEFINE(SO_ACCEPTFILTER, sys/socket.h)
2611 if test "x$ac_cv_define_SO_ACCEPTFILTER" = "xyes"; then
2620 AC_SUBST(apr_tcp_nopush_flag)
2621 AC_SUBST(have_corkable_tcp)
2622 AC_SUBST(acceptfilter)
2625 AC_CHECK_FUNCS(set_h_errno)
2627 echo "${nl}Checking for IPv6 Networking support..."
2628 dnl Start of checking for IPv6 support...
2631 [ --disable-ipv6 Disable IPv6 support in APR.],
2632 [ if test "$enableval" = "no"; then
2633 user_disabled_ipv6=1
2635 [ user_disabled_ipv6=0 ] )
2642 AC_SEARCH_LIBS(getaddrinfo, socket inet6)
2643 AC_SEARCH_LIBS(gai_strerror, socket inet6)
2644 AC_SEARCH_LIBS(getnameinfo, socket inet6)
2645 AC_CHECK_FUNCS(gai_strerror)
2646 APR_CHECK_WORKING_GETADDRINFO
2647 APR_CHECK_NEGATIVE_EAI
2648 APR_CHECK_WORKING_GETNAMEINFO
2649 APR_CHECK_SOCKADDR_IN6
2650 APR_CHECK_SOCKADDR_STORAGE
2653 if test "$user_disabled_ipv6" = 1; then
2654 ipv6_result="no -- disabled by user"
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
2664 ipv6_result="no -- no getnameinfo"
2667 ipv6_result="no -- no working getaddrinfo"
2670 ipv6_result="no -- no sockaddr_in6"
2673 ipv6_result="no -- the platform has known problems supporting IPv6"
2677 AC_MSG_CHECKING(if APR supports IPv6)
2678 AC_MSG_RESULT($ipv6_result)
2682 # hstrerror is only needed if IPv6 is not enabled,
2683 # so getaddrinfo/gai_strerror are not used.
2684 if test $have_ipv6 = 0; then
2685 AC_SEARCH_LIBS(hstrerror, resolv,
2686 [AC_DEFINE(HAVE_HSTRERROR, 1, [Define if hstrerror is present])])
2689 dnl Check for langinfo support
2691 AC_CHECK_HEADERS(langinfo.h)
2692 AC_CHECK_FUNCS(nl_langinfo)
2694 dnl ------------------------------ Defaults for some platform nuances
2696 dnl Do we have a Win32-centric Unicode FS?
2697 APR_SETIFNULL(have_unicode_fs, [0])
2698 AC_SUBST(have_unicode_fs)
2700 APR_SETIFNULL(apr_has_xthread_files, [0])
2701 AC_SUBST(apr_has_xthread_files)
2703 APR_SETIFNULL(apr_procattr_user_set_requires_password, [0])
2704 AC_SUBST(apr_procattr_user_set_requires_password)
2706 APR_SETIFNULL(apr_thread_func, [])
2707 AC_SUBST(apr_thread_func)
2709 APR_SETIFNULL(apr_has_user, [1])
2710 AC_SUBST(apr_has_user)
2712 dnl ----------------------------- Finalize the variables
2714 echo "${nl}Restore user-defined environment settings..."
2716 APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
2717 APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_)
2718 APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
2719 APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_)
2720 APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_)
2721 AC_SUBST(NOTEST_CPPFLAGS)
2722 AC_SUBST(NOTEST_CFLAGS)
2723 AC_SUBST(NOTEST_LDFLAGS)
2724 AC_SUBST(NOTEST_LIBS)
2725 AC_SUBST(NOTEST_INCLUDES)
2727 dnl ----------------------------- Construct the files
2734 AC_SUBST(DEFAULT_OSDIR)
2736 AC_SUBST(LIBTOOL_LIBS)
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
2743 *-apple-darwin*) LT_NO_INSTALL="" ;;
2744 *) LT_NO_INSTALL="-no-install" ;;
2746 AC_SUBST(LT_NO_INSTALL)
2749 # BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
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"
2759 INCLUDE_RULES=".include \"$apr_buildout/apr_rules.mk\""
2760 INCLUDE_OUTPUTS=".include \"$apr_srcdir/build-outputs.mk\""
2764 INCLUDE_RULES="include $apr_buildout/apr_rules.mk"
2765 INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk"
2768 AC_SUBST(INCLUDE_RULES)
2769 AC_SUBST(INCLUDE_OUTPUTS)
2771 AC_CONFIG_FILES([Makefile
2775 apr-$APR_MAJOR_VERSION-config:apr-config.in
2778 if test -d $srcdir/test; then
2779 AC_CONFIG_FILES([test/Makefile test/internal/Makefile])
2782 dir=include/arch/unix
2783 test -d $dir || $MKDIR $dir
2785 AC_CONFIG_COMMANDS([default], [
2786 # Commands run at the end of config.status:
2787 for i in $APR_SAVE_HEADERS; do
2788 if cmp -s $i $i.save 2>/dev/null; then
2790 AC_MSG_NOTICE([$i is unchanged])
2794 chmod +x apr-$APR_MAJOR_VERSION-config
2796 dnl This section is expanded by configure UNQUOTED so variable
2797 dnl references must be backslash-escaped as necessary.
2799 # Commands run at the beginning of config.status:
2800 APR_SAVE_HEADERS="include/apr.h include/arch/unix/apr_private.h"
2801 APR_MAJOR_VERSION=$APR_MAJOR_VERSION
2804 for apri in \${APR_SAVE_HEADERS}; do
2805 test -r \${apri} && mv \${apri} \${apri}.save