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)
14
dnl Include our own M4 macros along with those for libtool
16
sinclude(build/apr_common.m4)
17
sinclude(build/apr_network.m4)
18
sinclude(build/apr_threads.m4)
19
sinclude(build/apr_hints.m4)
20
sinclude(build/libtool.m4)
21
sinclude(build/ltsugar.m4)
23
dnl Hard-coded inclusion at the tail end of apr_private.h:
25
/* switch this on if we have a BeOS version below BONE */
26
#if BEOS && !HAVE_BONE_VERSION
33
* Include common private declarations.
35
#include "../apr_private_common.h"
38
dnl Save user-defined environment settings for later restoration
40
APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
41
APR_SAVE_THE_ENVIRONMENT(CFLAGS)
42
APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
43
APR_SAVE_THE_ENVIRONMENT(LIBS)
44
APR_SAVE_THE_ENVIRONMENT(INCLUDES)
46
dnl Generate ./config.nice for reproducing runs of configure
48
APR_CONFIG_NICE(config.nice)
51
echo "Configuring APR library"
52
echo "Platform: $host"
54
dnl Some initial steps for configuration. We setup the default directory
55
dnl and which files are to be configured.
57
dnl Setup the directory macros now
59
# Absolute source/build directory
60
apr_srcdir=`(cd $srcdir && pwd)`
63
AC_SUBST(apr_builddir)
65
if test "$apr_builddir" != "$apr_srcdir"; then
67
APR_CONFIG_LOCATION=build
69
APR_CONFIG_LOCATION=source
72
AC_SUBST(APR_CONFIG_LOCATION)
74
# Libtool might need this symbol -- it must point to the location of
75
# the generated libtool script (not necessarily the "top" build dir).
77
top_builddir="$apr_builddir"
78
AC_SUBST(top_builddir)
80
# Directory containing apr build macros, helpers, and make rules
81
# NOTE: make rules (apr_rules.mk) will be in the builddir for vpath
83
apr_buildout=$apr_builddir/build
84
apr_builders=$apr_srcdir/build
85
AC_SUBST(apr_builders)
87
MKDIR=$apr_builders/mkdir.sh
89
dnl Initialize mkdir -p functionality.
90
APR_MKDIR_P_CHECK($apr_builders/mkdir.sh)
92
# get our version information
93
get_version="$apr_builders/get-version.sh"
94
version_hdr="$apr_srcdir/include/apr_version.h"
95
APR_MAJOR_VERSION="`$get_version major $version_hdr APR`"
96
APR_DOTTED_VERSION="`$get_version all $version_hdr APR`"
98
AC_SUBST(APR_DOTTED_VERSION)
99
AC_SUBST(APR_MAJOR_VERSION)
101
echo "APR Version: ${APR_DOTTED_VERSION}"
103
dnl Enable the layout handling code, then reparse the prefix-style
104
dnl arguments due to autoconf being a PITA.
105
APR_ENABLE_LAYOUT(apr)
108
dnl Set optional CC hints here in case autoconf makes an inappropriate choice.
109
dnl This allows us to suggest what the compiler should be, but still
110
dnl allows the user to override CC externally.
113
dnl Do the various CC checks *before* preloading values. The preload code
114
dnl may need to use compiler characteristics to make decisions. This macro
115
dnl can only be used once within a configure script, so this prevents a
116
dnl preload section from invoking the macro to get compiler info.
122
dnl These added to allow default directories to be used...
124
echo "(Default will be ${DEFAULT_OSDIR})"
126
apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random"
128
dnl Checks for programs.
135
AC_CHECK_PROG(RM, rm, rm)
136
AC_CHECK_PROG(AS, as, as)
137
AC_CHECK_PROG(ASCPP, cpp, cpp)
138
AC_CHECK_TOOL(AR, ar, ar)
140
dnl Various OS checks that apparently set required flags
147
dnl this is our library name
148
APR_LIBNAME="apr${libsuffix}"
149
AC_SUBST(APR_LIBNAME)
153
echo "performing libtool configuration..."
155
AC_ARG_ENABLE(experimental-libtool,[ --enable-experimental-libtool Use experimental custom libtool],
156
[experimental_libtool=$enableval],[experimental_libtool=no])
160
# Use a custom-made libtool replacement
161
echo "using aplibtool"
162
LIBTOOL="$srcdir/build/aplibtool"
163
gcc $CFLAGS $CPPFLAGS -o $LIBTOOL.exe $LIBTOOL.c
166
if test "x$LTFLAGS" = "x"; then
169
if test "$experimental_libtool" = "yes"; then
170
# Use a custom-made libtool replacement
171
echo "using jlibtool"
172
LIBTOOL="$apr_builddir/libtool"
173
LIBTOOL_SRC="$apr_srcdir/build/jlibtool.c"
174
$CC $CFLAGS $CPPFLAGS -o $LIBTOOL $LIBTOOL_SRC
175
eval `$apr_builddir/libtool --config | grep "^shlibpath_var=[[A-Z_]]*$"`
176
if test "x$shlibpath_var" = "x"; then
177
shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
180
dnl libtoolize requires that the following not be indented
182
# get libtool's setting of shlibpath_var
183
eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool`
184
if test "x$shlibpath_var" = "x"; then
185
shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
191
AC_ARG_WITH(installbuilddir, [ --with-installbuilddir=DIR location to store APR build files (defaults to '${datadir}/build')],
192
[ installbuilddir=$withval ], [ installbuilddir="${datadir}/build-${APR_MAJOR_VERSION}" ] )
193
AC_SUBST(installbuilddir)
195
AC_ARG_WITH(libtool, [ --without-libtool avoid using libtool to link the library],
196
[ use_libtool=$withval ], [ use_libtool="yes" ] )
198
if test "x$use_libtool" = "xyes"; then
199
lt_compile='$(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -o $@ -c $< && touch $@'
200
LT_VERSION="-version-info `$get_version libtool $version_hdr APR`"
201
link="\$(LIBTOOL) \$(LTFLAGS) --mode=link \$(LT_LDFLAGS) \$(COMPILE) ${LT_VERSION} \$(ALL_LDFLAGS) -o \$@"
203
lib_target='-rpath $(libdir) $(OBJECTS)'
204
export_lib_target='-rpath \$(libdir) \$(OBJECTS)'
206
lt_compile='$(COMPILE) -o $@ -c $<'
207
link='$(AR) cr $(TARGET_LIB) $(OBJECTS); $(RANLIB) $(TARGET_LIB)'
215
apr_platform_runtime_link_flag="-R"
225
AC_SUBST(export_lib_target)
226
AC_SUBST(shlibpath_var)
230
dnl ----------------------------- Checks for compiler flags
233
echo "${nl}Check for compiler flags..."
235
dnl AC_PROG_CC sets -g in CFLAGS (and -O2 for gcc) by default.
236
dnl On OS/390 this causes the compiler to insert extra debugger
237
dnl hook instructions. That's fine for debug/maintainer builds, not fine
242
if test "$ac_test_CFLAGS" != set; then
243
APR_REMOVEFROM(CFLAGS,-g)
248
AC_ARG_ENABLE(debug,[ --enable-debug Turn on debugging and compile time warnings],
249
[APR_ADDTO(CFLAGS,-g)
250
if test "$GCC" = "yes"; then
251
APR_ADDTO(CFLAGS,-Wall)
252
elif test "$AIX_XLC" = "yes"; then
253
APR_ADDTO(CFLAGS,-qfullpath)
257
AC_ARG_ENABLE(maintainer-mode,[ --enable-maintainer-mode Turn on debugging and compile time warnings],
258
[APR_ADDTO(CFLAGS,-g)
259
if test "$GCC" = "yes"; then
260
APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations])
261
elif test "$AIX_XLC" = "yes"; then
262
APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
266
AC_ARG_ENABLE(profile,[ --enable-profile Turn on profiling for the build (GCC)],
267
if test "$GCC" = "yes"; then
268
APR_ADDTO(CFLAGS, -pg)
269
APR_REMOVEFROM(CFLAGS, -g)
270
if test "$host" = "i586-pc-beos"; then
271
APR_REMOVEFROM(CFLAGS, -O2)
272
APR_ADDTO(CFLAGS, -O1)
273
APR_ADDTO(LDFLAGS, -p)
278
AC_ARG_ENABLE(pool-debug,
279
[ --enable-pool-debug[[=yes|no|verbose|verbose-alloc|lifetime|owner|all]] Turn on pools debugging],
280
[ if test -z "$enableval"; then
281
APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=1)
282
elif test ! "$enableval" = "no"; then
312
if test $flag -gt 0; then
313
apr_pool_debug=`expr '(' $apr_pool_debug - $apr_pool_debug % \
314
'(' $flag '*' 2 ')' ')' + $flag + $apr_pool_debug % $flag`
318
APR_ADDTO(CPPFLAGS, -DAPR_POOL_DEBUG=$apr_pool_debug)
322
if test "$host" = "i586-pc-beos"; then
323
AC_ARG_ENABLE(malloc-debug,[ --enable-malloc-debug Switch on malloc_debug for BeOS],
324
APR_REMOVEFROM(CFLAGS, -O2)
325
APR_ADDTO(CPPFLAGS, -fcheck-memory-usage -D_KERNEL_MODE)
329
# this is the place to put specific options for platform/compiler
333
APR_ADDTO(CFLAGS,[-Ae +Z])
338
if echo "$CFLAGS " | grep '+DA' >/dev/null; then :
340
APR_ADDTO(CFLAGS,[+DAportable])
345
powerpc-*-beos:mwcc* )
346
APR_SETVAR(CPP,[mwcc -E])
352
dnl Check the depend program we can use
355
proc_mutex_is_global=0
357
config_subdirs="none"
358
INSTALL_SUBDIRS="none"
359
OBJECTS_PLATFORM='$(OBJECTS_unix)'
362
i386-ibm-aix* | *-ibm-aix[1-2].* | *-ibm-aix3.* | *-ibm-aix4.1 | *-ibm-aix4.1.* | *-ibm-aix4.2 | *-ibm-aix4.2.*)
364
APR_ADDTO(LDFLAGS,-lld)
366
OBJECTS_PLATFORM='$(OBJECTS_aix)'
369
APR_ADDTO(CPPFLAGS,-DOS2)
370
APR_ADDTO(CFLAGS,-Zmt)
371
AC_CHECK_LIB(bsd, random)
373
enable_threads="system_threads"
376
proc_mutex_is_global=1
377
OBJECTS_PLATFORM='$(OBJECTS_os2)'
381
APR_ADDTO(CPPFLAGS,-DBEOS)
382
enable_threads="system_threads"
384
APR_CHECK_DEFINE(BONE_VERSION, sys/socket.h)
387
proc_mutex_is_global=1
388
OBJECTS_PLATFORM='$(OBJECTS_beos)'
400
OBJECTS_PLATFORM='$(OBJECTS_os390)'
409
APR_ADDTO(CPPFLAGS,-DCYGWIN)
424
AC_SUBST(OBJECTS_PLATFORM)
426
# Check whether LFS has explicitly been disabled
427
AC_ARG_ENABLE(lfs,[ --disable-lfs Disable large file support on 32-bit platforms],
428
[apr_lfs_choice=$enableval], [apr_lfs_choice=yes])
430
if test "$apr_lfs_choice" = "yes"; then
431
# Check whether the transitional LFS API is sufficient
432
AC_CACHE_CHECK([whether to enable -D_LARGEFILE64_SOURCE], [apr_cv_use_lfs64], [
433
apr_save_CPPFLAGS=$CPPFLAGS
434
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
436
#include <sys/types.h>
437
#include <sys/stat.h>
449
if (sizeof(off64_t) != 8 || sizeof(off_t) != 4)
451
if ((fd = open("conftest.lfs", O_LARGEFILE|O_CREAT|O_WRONLY)) < 0)
453
if (ftruncate64(fd, off) != 0)
455
else if (fstat64(fd, &st) != 0 || st.st_size != off)
457
else if (lseek64(fd, off, SEEK_SET) != off)
459
else if (close(fd) != 0)
461
else if (lstat64("conftest.lfs", &st) != 0 || st.st_size != off)
463
else if (stat64("conftest.lfs", &st) != 0 || st.st_size != off)
465
unlink("conftest.lfs");
468
}], [apr_cv_use_lfs64=yes], [apr_cv_use_lfs64=no], [apr_cv_use_lfs64=no])
469
CPPFLAGS=$apr_save_CPPFLAGS])
470
if test "$apr_cv_use_lfs64" = "yes"; then
471
APR_ADDTO(CPPFLAGS, [-D_LARGEFILE64_SOURCE])
475
AC_ARG_ENABLE(nonportable-atomics,
476
[ --enable-nonportable-atomics Use optimized atomic code which may produce nonportable binaries],
477
[if test $enableval = yes; then
478
force_generic_atomics=no
480
force_generic_atomics=yes
484
i[[456]]86) force_generic_atomics=yes ;;
485
*) force_generic_atomics=no ;;
489
if test $force_generic_atomics = yes; then
490
AC_DEFINE([USE_GENERIC_ATOMICS], 1,
491
[Define if use of generic atomics is requested])
494
AC_SUBST(proc_mutex_is_global)
496
AC_SUBST(INSTALL_SUBDIRS)
498
# For some platforms we need a version string which allows easy numeric
502
if test -x /sbin/sysctl; then
503
os_version=`/sbin/sysctl -n kern.osreldate`
509
os_version=`uname -r | sed -e 's/\(.\)\.\(.\)\.\(.\).*/\1\2\3/'`
512
os_version=`uname -r | sed -e 's/\(.\)\.\(.\).*/\1\2/'`
515
os_version=OS_VERSION_IS_NOT_SET
519
echo "${nl}Checking for libraries..."
521
dnl ----------------------------- Checks for Any required Libraries
522
dnl Note: Autoconf will always append LIBS with an extra " " in AC_CHECK_LIB.
523
dnl It should check for LIBS being empty and set LIBS equal to the new value
524
dnl without the extra " " in that case, but they didn't do that. So, we
525
dnl end up LIBS="-lm -lcrypt -lnsl -ldl" which is an annoyance.
526
AC_SEARCH_LIBS(gethostbyname, nsl)
527
AC_SEARCH_LIBS(gethostname, nsl)
528
AC_SEARCH_LIBS(socket, socket)
529
AC_SEARCH_LIBS(crypt, crypt ufc)
530
AC_CHECK_LIB(truerand, main)
531
AC_SEARCH_LIBS(modf, m)
533
dnl ----------------------------- Checking for Threads
534
echo "${nl}Checking for Threads..."
536
if test -z "$enable_threads"; then
537
AC_ARG_ENABLE(threads,
538
[ --enable-threads Enable threading support in APR.],
539
[ enable_threads=$enableval] ,
540
[ APR_CHECK_PTHREADS_H([ enable_threads="pthread" ] ,
541
[ enable_threads="no" ] ) ] )
544
if test "$enable_threads" = "no"; then
549
if test "$enable_threads" = "pthread"; then
550
# We have specified pthreads for our threading library, just make sure
551
# that we have everything we need
552
APR_PTHREADS_CHECK_SAVE
554
APR_CHECK_PTHREADS_H([
561
APR_PTHREADS_CHECK_RESTORE ] )
562
elif test "$enable_threads" = "system_threads"; then
567
# We basically specified that we wanted threads, but not how to implement
568
# them. In this case, just look for pthreads. In the future, we can check
569
# for other threading libraries as well.
570
APR_PTHREADS_CHECK_SAVE
572
APR_CHECK_PTHREADS_H([
579
APR_PTHREADS_CHECK_RESTORE ] )
581
if test "$pthreadh" = "1"; then
582
APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
583
APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
584
APR_CHECK_PTHREAD_RECURSIVE_MUTEX
585
AC_CHECK_FUNCS([pthread_key_delete pthread_rwlock_init \
586
pthread_attr_setguardsize])
588
if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
589
dnl ----------------------------- Checking for pthread_rwlock_t
590
AC_CACHE_CHECK([for pthread_rwlock_t], [apr_cv_type_rwlock_t],
591
AC_TRY_COMPILE([#include <sys/types.h>
592
#include <pthread.h>], [pthread_rwlock_t *rwlock;],
593
[apr_cv_type_rwlock_t=yes], [apr_cv_type_rwlock_t=no],
594
[apr_cv_type_rwlock_t=no]))
595
if test "$apr_cv_type_rwlock_t" = "yes"; then
596
AC_DEFINE(HAVE_PTHREAD_RWLOCKS, 1, [Define if pthread rwlocks are available])
602
ac_cv_define_READDIR_IS_THREAD_SAFE=no
603
ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no
604
ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no
605
if test "$threads" = "1"; then
606
echo "APR will use threads"
607
AC_CHECK_LIB(c_r, readdir,
608
AC_DEFINE(READDIR_IS_THREAD_SAFE, 1,
609
[Define if readdir is thread safe]))
610
if test "x$apr_gethostbyname_is_thread_safe" = "x"; then
611
AC_CHECK_LIB(c_r, gethostbyname, apr_gethostbyname_is_thread_safe=yes)
613
if test "$apr_gethostbyname_is_thread_safe" = "yes"; then
614
AC_DEFINE(GETHOSTBYNAME_IS_THREAD_SAFE, 1,
615
[Define if gethostbyname is thread safe])
617
if test "x$apr_gethostbyaddr_is_thread_safe" = "x"; then
618
AC_CHECK_LIB(c_r, gethostbyaddr, apr_gethostbyaddr_is_thread_safe=yes)
620
if test "$apr_gethostbyaddr_is_thread_safe" = "yes"; then
621
AC_DEFINE(GETHOSTBYADDR_IS_THREAD_SAFE, 1,
622
[Define if gethostbyaddr is thread safe])
624
AC_CHECK_FUNCS(gethostbyname_r gethostbyaddr_r)
626
echo "APR will be non-threaded"
629
dnl Electric Fence malloc checker.
630
dnl --with-efence specifies the path to Electric Fence.
631
dnl This test should remain after the threads checks since libefence
632
dnl may depend on libpthread.
634
[ --with-efence[[=DIR]] path to Electric Fence installation],
635
[ apr_efence_dir="$withval"
636
if test "$apr_efence_dir" != "yes"; then
637
APR_ADDTO(LDFLAGS,[-L$apr_efence_dir/lib])
638
if test "x$apr_platform_runtime_link_flag" != "x"; then
640
[$apr_platform_runtime_link_flag$apr_efence_dir/lib])
643
AC_CHECK_LIB(efence, malloc,
644
[ APR_ADDTO(LIBS,-lefence) ],
645
[ AC_MSG_ERROR(Electric Fence requested but not detected) ])
648
AC_CHECK_FUNCS(sigsuspend, [ have_sigsuspend="1" ], [ have_sigsuspend="0" ])
649
AC_CHECK_FUNCS(sigwait, [ have_sigwait="1" ], [ have_sigwait="0" ])
650
dnl AC_CHECK_FUNCS doesn't work for this on Tru64 since the function
651
dnl is renamed in signal.h. Todo: Autodetect
659
AC_SUBST(have_sigsuspend)
660
AC_SUBST(have_sigwait)
662
AC_CHECK_FUNCS(poll kqueue port_create)
664
# Check for the Linux epoll interface; epoll* may be available in libc
665
# but return ENOSYS on a pre-2.6 kernel, so do a run-time check.
666
AC_CACHE_CHECK([for epoll support], [apr_cv_epoll],
668
#include <sys/epoll.h>
673
return epoll_create(5) == -1;
674
}], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])])
676
if test "$apr_cv_epoll" = "yes"; then
677
AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported])
680
dnl ----------------------------- Checking for missing POSIX thread functions
681
AC_CHECK_FUNCS([getpwnam_r getpwuid_r getgrnam_r getgrgid_r])
683
dnl ----------------------------- Checking for Shared Memory Support
684
echo "${nl}Checking for Shared Memory Support..."
686
# The real-time POSIX extensions (e.g. shm_*, sem_*) may only
687
# be available if linking against librt.
688
AC_SEARCH_LIBS(shm_open, rt)
692
ac_includes_default="$ac_includes_default
693
#if HAVE_SYS_MUTEX_H /* needed to define lock_t for sys/shm.h */
694
# include <sys/mutex.h>
698
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])
699
AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
701
APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
702
APR_CHECK_FILE(/dev/zero)
704
# Not all systems can mmap /dev/zero (such as HP-UX). Check for that.
705
if test "$ac_cv_func_mmap" = "yes" &&
706
test "$ac_cv_file__dev_zero" = "yes"; then
707
AC_MSG_CHECKING(for mmap that can map /dev/zero)
709
#include <sys/types.h>
710
#include <sys/stat.h>
712
#ifdef HAVE_SYS_MMAN_H
713
#include <sys/mman.h>
719
fd = open("/dev/zero", O_RDWR);
723
m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
724
if (m == (void *)-1) { /* aka MAP_FAILED */
727
if (munmap(m, sizeof(void*)) < 0) {
731
}], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])
733
AC_MSG_RESULT($ac_cv_file__dev_zero)
736
# Now we determine which one is our anonymous shmem preference.
740
APR_BEGIN_DECISION([anonymous shared memory allocation method])
741
APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
742
func:shmget func:shmat func:shmdt func:shmctl,
744
APR_DECIDE(USE_SHMEM_SHMGET_ANON, [SysV IPC shmget()])])
745
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap file:/dev/zero,
747
APR_DECIDE(USE_SHMEM_MMAP_ZERO,
748
[SVR4-style mmap() on /dev/zero])])
749
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON,
751
APR_DECIDE(USE_SHMEM_MMAP_ANON,
752
[4.4BSD-style mmap() via MAP_ANON])])
753
APR_IFALLYES(header:os2.h,
755
APR_DECIDE(USE_SHMEM_OS2_ANON, [OS/2 DosAllocSharedMem()])])
756
APR_IFALLYES(header:kernel/OS.h func:create_area,
758
APR_DECIDE(USE_SHMEM_BEOS_ANON,
762
# Linux has problems with MM_SHMT_MMANON even though it reports
764
# FIXME - find exact 2.3 version that MMANON was fixed in. It is
765
# confirmed fixed in 2.4 series.
766
if test $os_version -le "240"; then
767
APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_ZERO USE_SHMEM_SHMGET_ANON)
771
APR_DECISION_OVERRIDE(USE_SHMEM_SHMGET_ANON)
775
AC_DEFINE_UNQUOTED($ac_decision)
782
USE_SHMEM_SHMGET_ANON )
785
USE_SHMEM_MMAP_ZERO )
788
USE_SHMEM_MMAP_ANON )
793
AC_SUBST(useshmgetanon)
794
AC_SUBST(usemmapzero)
795
AC_SUBST(usemmapanon)
796
AC_SUBST(haveshmgetanon)
797
AC_SUBST(havemmapzero)
798
AC_SUBST(havemmapanon)
800
# Now we determine which one is our name-based shmem preference.
806
APR_BEGIN_DECISION([namebased memory allocation method])
807
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
809
APR_DECIDE(USE_SHMEM_MMAP_TMP,
810
[Classical mmap() on temporary file])])
811
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open dnl
814
APR_DECIDE(USE_SHMEM_MMAP_SHM,
815
[mmap() via POSIX.1 shm_open() on temporary file])])
816
APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
817
func:shmget func:shmat func:shmdt func:shmctl,
819
APR_DECIDE(USE_SHMEM_SHMGET, [SysV IPC shmget()])])
820
APR_IFALLYES(header:kernel/OS.h func:create_area,
822
APR_DECIDE(USE_SHMEM_BEOS, [BeOS areas])])
823
APR_IFALLYES(header:os2.h,
825
APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])])
828
# Linux has problems with MM_SHMT_MMANON even though it reports
830
# FIXME - find exact 2.3 version that MMANON was fixed in. It is
831
# confirmed fixed in 2.4 series.
832
if test $os_version -le "240"; then
833
APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_TMP USE_SHMEM_MMAP_SHM dnl
839
AC_DEFINE_UNQUOTED($ac_decision)
865
# Do we have any shared memory support?
866
if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm" = "0000000"; then
875
AC_SUBST(usebeosarea)
877
AC_SUBST(havemmaptmp)
878
AC_SUBST(havemmapshm)
880
AC_SUBST(havebeosarea)
884
dnl ----------------------------- Checks for Any required Functions
885
dnl Checks for library functions. (N.B. poll is further down)
886
AC_CHECK_FUNCS([alloca calloc setsid isinf isnan \
887
getenv putenv setenv unsetenv \
888
writev getifaddrs utime utimes])
889
AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ])
890
AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ])
892
AC_CHECK_LIB(sendfile, sendfilev)
893
AC_CHECK_FUNCS(sendfile send_file sendfilev, [ sendfile="1" ])
895
dnl THIS MUST COME AFTER THE THREAD TESTS - FreeBSD doesn't always have a
896
dnl threaded poll() and we don't want to use sendfile on early FreeBSD
897
dnl systems if we are also using threads.
899
AC_ARG_WITH(sendfile, [ --with-sendfile Override decision to use sendfile],
900
[ if test "$withval" = "yes"; then
905
orig_sendfile=$sendfile
908
# FreeBSD < 4.2 has issues with threads+sendfile
909
if test $os_version -le "401999"; then
910
if test "$threads" = "1"; then
919
# disable sendfile support for 2.2 on S/390
920
if test $os_version -lt 240; then
925
# compiler-independent check for 64-bit build
926
AC_CHECK_SIZEOF(void*, 4)
927
if test "x$ac_cv_sizeof_voidp" = "x8"; then
928
# sendfile not working for 64-bit build
933
if test "$orig_sendfile" != "$sendfile"; then
934
echo "sendfile support disabled to avoid system problem"
938
AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ])
941
AC_CHECK_FUNCS(fork, [ fork="1" ], [ fork="0" ])
943
APR_CHECK_INET_NETWORK
944
AC_SUBST(apr_inaddr_none)
945
AC_CHECK_FUNC(_getch)
946
AC_CHECK_FUNCS(strerror_r, [ strerror_r="1" ], [ strerror_r="0" ])
947
if test "$strerror_r" = "1"; then
948
APR_CHECK_STRERROR_R_RC
950
AC_CHECK_FUNCS(mmap, [ mmap="1" ], [ mmap="0" ])
951
if test "$native_mmap_emul" = "1"; then
954
AC_CHECK_FUNCS(memmove, [ have_memmove="1" ], [have_memmove="0" ])
955
AC_CHECK_FUNCS([getpass getpassphrase gmtime_r localtime_r mkstemp])
958
AC_SUBST(have_inet_addr)
959
AC_SUBST(tcp_nodelay_inherited)
960
AC_SUBST(o_nonblock_inherited)
961
AC_SUBST(have_inet_network)
962
AC_SUBST(have_sigaction)
963
AC_SUBST(have_setrlimit)
964
AC_SUBST(have_getrlimit)
966
AC_SUBST(have_memmove)
968
APR_CHECK_SIGWAIT_ONE_ARG
969
APR_CHECK_DIRENT_INODE
970
APR_CHECK_DIRENT_TYPE
972
dnl ----------------------------- Checks for Any required Headers
1019
netinet/sctp_uio.h \
1040
# IRIX 6.5 has a problem in <netinet/tcp.h> which prevents it from
1041
# being included by itself. Check for <netinet/tcp.h> manually,
1042
# including another header file first.
1043
AC_CACHE_CHECK([for netinet/tcp.h], [apr_cv_hdr_netinet_tcp_h],
1045
[#ifdef HAVE_NETINET_IN_H
1046
#include <netinet/in.h>
1048
#include <netinet/tcp.h>
1049
], [apr_cv_hdr_netinet_tcp_h=yes], [apr_cv_hdr_netinet_tcp_h=no])])
1050
if test "$apr_cv_hdr_netinet_tcp_h" = "yes"; then
1052
AC_DEFINE([HAVE_NETINET_TCP_H], 1, [Defined if netinet/tcp.h is present])
1057
AC_SUBST(arpa_ineth)
1067
AC_SUBST(sys_syslimitsh)
1068
AC_SUBST(netinet_inh)
1069
AC_SUBST(netinet_sctph)
1070
AC_SUBST(netinet_sctp_uioh)
1071
AC_SUBST(netinet_tcph)
1077
AC_SUBST(sys_ioctlh)
1078
AC_SUBST(sys_sendfileh)
1079
AC_SUBST(sys_signalh)
1080
AC_SUBST(sys_socketh)
1081
AC_SUBST(sys_sockioh)
1082
AC_SUBST(sys_typesh)
1091
AC_SUBST(semaphoreh)
1093
# Checking for h_errno in <netdb.h>
1094
if test "$netdbh" = "1"; then
1095
APR_CHECK_H_ERRNO_FLAG
1096
if test "$ac_cv_h_errno_cflags" = "no"; then
1097
AC_MSG_ERROR([can not find h_errno in netdb.h])
1101
dnl ----------------------------- Checks for standard typedefs
1106
AC_CHECK_TYPE(ssize_t, int)
1113
dnl Checks for pointer size
1114
AC_CHECK_SIZEOF(void*, 4)
1116
if test "x$ac_cv_sizeof_voidp" != "x"; then
1117
voidp_size=$ac_cv_sizeof_voidp
1119
AC_ERROR([Cannot determine size of void*])
1122
dnl Checks for integer size
1123
AC_CHECK_SIZEOF(char, 1)
1124
AC_CHECK_SIZEOF(int, 4)
1125
AC_CHECK_SIZEOF(long, 4)
1126
AC_CHECK_SIZEOF(short, 2)
1127
AC_CHECK_SIZEOF(long long, 8)
1129
if test "$ac_cv_sizeof_short" = "2"; then
1132
if test "$ac_cv_sizeof_int" = "4"; then
1135
# Now we need to find what apr_int64_t (sizeof == 8) will be.
1136
# The first match is our preference.
1137
if test "$ac_cv_sizeof_int" = "8"; then
1138
int64_literal='#define APR_INT64_C(val) (val)'
1139
uint64_literal='#define APR_UINT64_C(val) (val##U)'
1140
int64_t_fmt='#define APR_INT64_T_FMT "d"'
1141
uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
1142
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
1145
int64_strfn="strtoi"
1146
elif test "$ac_cv_sizeof_long" = "8"; then
1147
int64_literal='#define APR_INT64_C(val) (val##L)'
1148
uint64_literal='#define APR_UINT64_C(val) (val##UL)'
1149
int64_t_fmt='#define APR_INT64_T_FMT "ld"'
1150
uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
1151
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
1154
int64_strfn="strtol"
1155
elif test "$ac_cv_sizeof_long_long" = "8"; then
1156
int64_literal='#define APR_INT64_C(val) (val##LL)'
1157
uint64_literal='#define APR_UINT64_C(val) (val##ULL)'
1158
# Linux, Solaris, FreeBSD all support ll with printf.
1159
# BSD 4.4 originated 'q'. Solaris is more popular and
1160
# doesn't support 'q'. Solaris wins. Exceptions can
1161
# go to the OS-dependent section.
1162
int64_t_fmt='#define APR_INT64_T_FMT "lld"'
1163
uint64_t_fmt='#define APR_UINT64_T_FMT "llu"'
1164
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"'
1165
int64_value="long long"
1166
long_value="long long"
1167
int64_strfn="strtoll"
1168
elif test "$ac_cv_sizeof_longlong" = "8"; then
1169
int64_literal='#define APR_INT64_C(val) (val##LL)'
1170
uint64_literal='#define APR_UINT64_C(val) (val##ULL)'
1171
int64_t_fmt='#define APR_INT64_T_FMT "qd"'
1172
uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
1173
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
1174
int64_value="__int64"
1175
long_value="__int64"
1176
int64_strfn="strtoll"
1178
# int64_literal may be overriden if your compiler thinks you have
1179
# a 64-bit value but APR does not agree.
1180
AC_ERROR([could not detect a 64-bit integer type])
1183
# If present, allow the C99 macro INT64_C to override our conversion.
1185
# HP-UX's ANSI C compiler provides this without any includes, so we
1186
# will first look for INT64_C without adding stdint.h
1187
AC_CACHE_CHECK([for INT64_C], [apr_cv_define_INT64_C], [
1188
AC_EGREP_CPP(YES_IS_DEFINED,
1191
#endif], [apr_cv_define_INT64_C=yes], [
1192
# Now check for INT64_C in stdint.h
1193
AC_EGREP_CPP(YES_IS_DEFINED, [#include <stdint.h>
1196
#endif], [apr_cv_define_INT64_C=yes], [apr_cv_define_INT64_C=no])])])
1198
if test "$apr_cv_define_INT64_C" = "yes"; then
1199
int64_literal='#define APR_INT64_C(val) INT64_C(val)'
1200
uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)'
1206
if test "$ac_cv_type_size_t" = "yes"; then
1207
size_t_value="size_t"
1209
size_t_value="apr_int32_t"
1211
if test "$ac_cv_type_ssize_t" = "yes"; then
1212
ssize_t_value="ssize_t"
1214
ssize_t_value="apr_int32_t"
1216
if test "$ac_cv_socklen_t" = "yes"; then
1217
socklen_t_value="socklen_t"
1220
if test "$ac_cv_sizeof_long" = "8"; then
1221
# 64-bit HP-UX requires 32-bit socklens in
1222
# kernel, but user-space declarations say
1223
# 64-bit (socklen_t == size_t == long).
1224
# This will result in many compile warnings,
1225
# but we're functionally busted otherwise.
1226
socklen_t_value="int"
1231
socklen_t_value="int"
1234
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
1236
if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
1237
ssize_t_fmt='#define APR_SSIZE_T_FMT "d"'
1238
elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
1239
ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
1241
ssize_t_fmt='#error Can not determine the proper size for ssize_t'
1244
APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
1246
if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
1247
size_t_fmt='#define APR_SIZE_T_FMT "d"'
1248
elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
1249
size_t_fmt='#define APR_SIZE_T_FMT "ld"'
1251
size_t_fmt='#error Can not determine the proper size for size_t'
1254
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
1256
if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
1259
AC_CHECK_FUNCS([mmap64 sendfile64 sendfilev64 mkstemp64])
1264
AC_MSG_CHECKING([which type to use for apr_off_t])
1265
if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
1267
off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
1268
off_t_value='off64_t'
1269
off_t_strfn='apr_strtoi64'
1270
elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then
1271
# Special case: off_t may change size with _FILE_OFFSET_BITS
1272
# on 32-bit systems with LFS support. To avoid compatibility
1273
# issues when other packages do define _FILE_OFFSET_BITS,
1274
# hard-code apr_off_t to long.
1276
off_t_fmt='#define APR_OFF_T_FMT "ld"'
1277
off_t_strfn='strtol'
1278
elif test "$ac_cv_type_off_t" = "yes"; then
1280
# off_t is more commonly a long than an int; prefer that case
1281
# where int and long are the same size.
1282
if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
1283
off_t_fmt='#define APR_OFF_T_FMT "ld"'
1284
off_t_strfn='strtol'
1285
elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then
1286
off_t_fmt='#define APR_OFF_T_FMT "d"'
1287
off_t_strfn='strtoi'
1288
elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
1289
off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
1290
off_t_strfn='apr_strtoi64'
1292
AC_ERROR([could not determine the size of off_t])
1296
off_t_value=apr_int32_t
1298
off_t_strfn='strtoi'
1300
AC_MSG_RESULT($off_t_value)
1302
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
1304
if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
1305
pid_t_fmt='#define APR_PID_T_FMT "hd"'
1306
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then
1307
pid_t_fmt='#define APR_PID_T_FMT "d"'
1308
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then
1309
pid_t_fmt='#define APR_PID_T_FMT "ld"'
1310
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then
1311
pid_t_fmt='#define APR_PID_T_FMT APR_INT64_T_FMT'
1313
pid_t_fmt='#error Can not determine the proper size for pid_t'
1316
# Checks for endianness
1318
if test $ac_cv_c_bigendian = yes; then
1324
# Basically, we have tried to figure out the correct format strings
1325
# for APR types which vary between platforms, but we don't always get
1326
# it right. If you find that we don't get it right for your platform,
1327
# you can override our decision below.
1330
# uniquely, the 31-bit Linux/s390 uses "unsigned long int"
1331
# for size_t rather than "unsigned int":
1332
size_t_fmt='#define APR_SIZE_T_FMT "lu"'
1333
ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
1336
size_t_fmt='#define APR_SIZE_T_FMT "lu"'
1339
pid_t_fmt='#define APR_PID_T_FMT "ld"'
1342
ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
1343
size_t_fmt='#define APR_SIZE_T_FMT "ld"'
1346
ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'
1347
size_t_fmt='#define APR_SIZE_T_FMT "ld"'
1350
ssize_t_fmt='#define APR_SSIZE_T_FMT "d"'
1351
size_t_fmt='#define APR_SIZE_T_FMT "lu"'
1355
AC_SUBST(voidp_size)
1356
AC_SUBST(short_value)
1358
AC_SUBST(long_value)
1359
AC_SUBST(int64_value)
1360
AC_SUBST(off_t_value)
1361
AC_SUBST(size_t_value)
1362
AC_SUBST(ssize_t_value)
1363
AC_SUBST(socklen_t_value)
1364
AC_SUBST(int64_t_fmt)
1365
AC_SUBST(uint64_t_fmt)
1366
AC_SUBST(uint64_t_hex_fmt)
1367
AC_SUBST(ssize_t_fmt)
1368
AC_SUBST(size_t_fmt)
1371
AC_SUBST(int64_literal)
1372
AC_SUBST(uint64_literal)
1377
dnl ----------------------------- Checking for string functions
1378
AC_CHECK_FUNCS(strnicmp, have_strnicmp="1", have_strnicmp="0")
1379
AC_CHECK_FUNCS(strncasecmp, have_strncasecmp="1", have_strncasecmp="0")
1380
AC_CHECK_FUNCS(stricmp, have_stricmp="1", have_stricmp="0")
1381
AC_CHECK_FUNCS(strcasecmp, have_strcasecmp="1", have_strcasecmp="0")
1382
AC_CHECK_FUNCS(strdup, have_strdup="1", have_strdup="0")
1383
AC_CHECK_FUNCS(strstr, have_strstr="1", have_strstr="0")
1384
AC_CHECK_FUNCS(memchr, have_memchr="1", have_memchr="0")
1385
AC_CHECK_FUNC($int64_strfn, have_int64_strfn="1", have_int64_strfn="0")
1387
dnl ----------------------------- We have a fallback position
1388
if test "$have_int64_strfn" = "0" && test "$int64_strfn" = "strtoll"; then
1389
int64_strfn="strtoq"
1390
AC_CHECK_FUNC(strtoq, [have_int64_strfn=1], [have_int64_strfn=0])
1393
if test "$have_int64_strfn" = "1"; then
1394
AC_DEFINE_UNQUOTED(APR_INT64_STRFN, [$int64_strfn],
1395
[Define as function which can be used for conversion of strings to apr_int64_t])
1398
AC_SUBST(have_strnicmp)
1399
AC_SUBST(have_strncasecmp)
1400
AC_SUBST(have_stricmp)
1401
AC_SUBST(have_strcasecmp)
1402
AC_SUBST(have_strdup)
1403
AC_SUBST(have_strstr)
1404
AC_SUBST(have_memchr)
1406
if test "$off_t_strfn" = "apr_strtoi64" && test "$have_int64_strfn" = "1"; then
1407
off_t_strfn=$int64_strfn
1409
AC_DEFINE_UNQUOTED(APR_OFF_T_STRFN, [$off_t_strfn],
1410
[Define as function used for conversion of strings to apr_off_t])
1412
dnl ----------------------------- Checking for DSO support
1413
echo "${nl}Checking for DSO..."
1415
[ --disable-dso Disable DSO support ],
1416
[if test "x$enableval" = "xyes"; then
1423
if test "$dsotype" = "any"; then
1425
AC_CHECK_FUNC(NSLinkModule, [dsotype=dyld])
1426
if test "$dsotype" = "any"; then
1428
AC_CHECK_LIB(dld, shl_load, [dsotype=shl; APR_ADDTO(LIBS,-ldld)])
1431
if test "$dsotype" = "any"; then
1432
AC_CHECK_FUNC(dlopen, [dsotype=dlfcn])
1434
if test "$dsotype" = "any"; then
1435
AC_CHECK_LIB(dl, dlopen, [dsotype=dlfcn; APR_ADDTO(LIBS,-ldl)])
1437
if test "$dsotype" = "dlfcn"; then
1438
# ReliantUnix has dlopen() in libc but dlsym() in libdl :(
1439
AC_CHECK_FUNC(dlsym, [],
1440
[AC_CHECK_LIB(dl, dlsym,
1441
[APR_ADDTO(LIBS, -ldl)],
1443
echo "Weird: dlopen() was found but dlsym() was not found!"])])
1445
if test "$dsotype" = "any"; then
1447
AC_CHECK_LIB(root, load_image, [dsotype=other])
1450
if test "$dsotype" = "any"; then
1452
*os390|*-os2*|*os400|*-aix*) dsotype=other ;;
1457
if test "$dsotype" = "any"; then
1458
AC_MSG_ERROR([Could not detect suitable DSO implementation])
1459
elif test "$dsotype" = "no"; then
1463
dlfcn) AC_DEFINE(DSO_USE_DLFCN, 1, [Define if DSO support uses dlfcn.h]);;
1464
shl) AC_DEFINE(DSO_USE_SHL, 1, [Define if DSO support uses shl_load]);;
1465
dyld) AC_DEFINE(DSO_USE_DYLD, 1, [Define if DSO support uses dyld.h]);;
1466
other) ;; # Use whatever is in dso/OSDIR
1467
*) AC_MSG_ERROR([Unknown DSO implementation "$dsotype"]);;
1470
apr_modules="$apr_modules dso"
1475
dnl ----------------------------- Checking for Processes
1476
echo "${nl}Checking for Processes..."
1478
AC_CHECK_FUNCS(waitpid)
1480
AC_ARG_ENABLE(other-child,
1481
[ --enable-other-child Enable reliable child processes ],
1482
[ if test "$enableval" = "yes"; then
1491
AC_MSG_CHECKING(for Variable Length Arrays)
1492
APR_TRY_COMPILE_NO_WARNING([],
1496
], vla_msg=yes, vla_msg=no )
1497
AC_MSG_RESULT([$vla_msg])
1498
if test "$vla_msg" = "yes"; then
1499
AC_DEFINE(HAVE_VLA, 1, [Define if C compiler supports VLA])
1502
AC_CACHE_CHECK(struct rlimit,ac_cv_struct_rlimit,[
1504
#include <sys/types.h>
1505
#include <sys/time.h>
1506
#include <sys/resource.h>
1509
struct rlimit limit;
1514
ac_cv_struct_rlimit=yes ], [
1515
ac_cv_struct_rlimit=no ], [
1516
ac_cv_struct_rlimit=no ] ) ] )
1518
test "x$ac_cv_struct_rlimit" = xyes && struct_rlimit=1
1519
AC_SUBST(struct_rlimit)
1521
dnl ----------------------------- Checking for Locking Characteristics
1522
echo "${nl}Checking for Locking..."
1524
AC_CHECK_FUNCS(semget semctl flock)
1525
AC_CHECK_HEADERS(semaphore.h OS.h)
1526
AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait create_sem)
1528
# Some systems return ENOSYS from sem_open.
1529
AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[
1534
#include <semaphore.h>
1538
const char *sem_name = "/apr_autoconf";
1540
psem = sem_open(sem_name, O_CREAT, 0644, 1);
1541
if (psem == (sem_t *)SEM_FAILED) {
1545
sem_unlink(sem_name);
1547
}], [ac_cv_func_sem_open=yes], [ac_cv_func_sem_open=no],
1548
[ac_cv_func_sem_open=no])])
1550
# It's stupid, but not all platforms have union semun, even those that need it.
1551
AC_MSG_CHECKING(for union semun in sys/sem.h)
1553
#include <sys/types.h>
1554
#include <sys/ipc.h>
1555
#include <sys/sem.h>
1558
semctl(0, 0, 0, arg);
1559
], [have_union_semun="1" union_semun=yes ]
1561
have_union_semun="0"
1563
AC_MSG_RESULT([$msg])
1564
AC_SUBST(have_union_semun)
1566
dnl Checks for libraries.
1567
APR_CHECK_DEFINE(LOCK_EX, sys/file.h)
1568
APR_CHECK_DEFINE(F_SETLK, fcntl.h)
1569
APR_CHECK_DEFINE(SEM_UNDO, sys/sem.h)
1571
# We are assuming that if the platform doesn't have POLLIN, it doesn't have
1572
# any POLL definitions.
1573
APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h)
1575
if test "$threads" = "1"; then
1576
APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
1577
AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
1578
# Some systems have setpshared and define PROCESS_SHARED, but don't
1579
# really support PROCESS_SHARED locks. So, we must validate that we
1580
# can go through the steps without receiving some sort of system error.
1581
# Linux and older versions of AIX have this problem.
1582
APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED func:pthread_mutexattr_setpshared, [
1583
AC_CACHE_CHECK([for working PROCESS_SHARED locks], apr_cv_process_shared_works, [
1585
#include <sys/types.h>
1586
#include <pthread.h>
1589
pthread_mutex_t mutex;
1590
pthread_mutexattr_t attr;
1591
if (pthread_mutexattr_init(&attr))
1593
if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
1595
if (pthread_mutex_init(&mutex, &attr))
1597
if (pthread_mutexattr_destroy(&attr))
1599
if (pthread_mutex_destroy(&mutex))
1602
}], [apr_cv_process_shared_works=yes], [apr_cv_process_shared_works=no])])
1603
# Override detection of pthread_mutexattr_setpshared
1604
ac_cv_func_pthread_mutexattr_setpshared=$apr_cv_process_shared_works])
1606
if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then
1607
APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX
1611
# See which lock mechanisms we can support on this system.
1612
APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
1613
func:sem_unlink func:sem_post func:sem_wait,
1614
hasposixser="1", hasposixser="0")
1615
APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1",
1617
APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
1618
APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0")
1619
# note: the current APR use of shared mutex requires /dev/zero
1620
APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
1621
func:pthread_mutexattr_setpshared dnl
1623
hasprocpthreadser="1", hasprocpthreadser="0")
1624
APR_IFALLYES(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="0")
1626
# See which lock mechanism we'll select by default on this system.
1627
# The last APR_DECIDE to execute sets the default.
1628
# At this stage, we match the ordering in Apache 1.3
1629
# which is (highest to lowest): sysvsem -> fcntl -> flock.
1630
# POSIX semaphores and cross-process pthread mutexes are not
1631
# used by default since they have less desirable behaviour when
1632
# e.g. a process holding the mutex segfaults.
1633
# The BEOSSEM decision doesn't require any substitutions but is
1634
# included here to prevent the fcntl() branch being selected
1635
# from the decision making.
1636
APR_BEGIN_DECISION([apr_lock implementation method])
1637
APR_IFALLYES(func:flock define:LOCK_EX,
1638
APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
1639
APR_IFALLYES(header:fcntl.h define:F_SETLK,
1640
APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
1641
APR_IFALLYES(func:semget func:semctl define:SEM_UNDO,
1642
APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
1643
APR_IFALLYES(header:OS.h func:create_sem,
1644
APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores]))
1645
if test "x$apr_lock_method" != "x"; then
1646
APR_DECISION_FORCE($apr_lock_method)
1649
AC_DEFINE_UNQUOTED($ac_decision)
1656
case $ac_decision in
1657
USE_FLOCK_SERIALIZE )
1660
USE_FCNTL_SERIALIZE )
1663
USE_SYSVSEM_SERIALIZE )
1666
USE_POSIXSEM_SERIALIZE )
1669
USE_PROC_PTHREAD_SERIALIZE )
1677
AC_SUBST(hasflockser)
1678
AC_SUBST(hassysvser)
1679
AC_SUBST(hasposixser)
1680
AC_SUBST(hasfcntlser)
1681
AC_SUBST(hasprocpthreadser)
1686
AC_SUBST(procpthreadser)
1687
AC_SUBST(pthreadser)
1689
AC_MSG_CHECKING(if all interprocess locks affect threads)
1690
if test "x$apr_process_lock_is_global" = "xyes"; then
1698
AC_SUBST(proclockglobal)
1700
AC_MSG_CHECKING(if POSIX sems affect threads in the same process)
1701
if test "x$apr_posixsem_is_global" = "xyes"; then
1702
AC_DEFINE(POSIXSEM_IS_GLOBAL, 1,
1703
[Define if POSIX semaphores affect threads within the process])
1709
AC_MSG_CHECKING(if SysV sems affect threads in the same process)
1710
if test "x$apr_sysvsem_is_global" = "xyes"; then
1711
AC_DEFINE(SYSVSEM_IS_GLOBAL, 1,
1712
[Define if SysV semaphores affect threads within the process])
1718
AC_MSG_CHECKING(if fcntl locks affect threads in the same process)
1719
if test "x$apr_fcntl_is_global" = "xyes"; then
1720
AC_DEFINE(FCNTL_IS_GLOBAL, 1,
1721
[Define if fcntl locks affect threads within the process])
1727
AC_MSG_CHECKING(if flock locks affect threads in the same process)
1728
if test "x$apr_flock_is_global" = "xyes"; then
1729
AC_DEFINE(FLOCK_IS_GLOBAL, 1,
1730
[Define if flock locks affect threads within the process])
1736
dnl ----------------------------- Checking for /dev/random
1737
AC_MSG_CHECKING(for entropy source)
1740
[ --with-egd[[=DIR]] use EGD-compatible socket],
1741
[ AC_DEFINE(HAVE_EGD, 1, [Define if EGD is supported])
1742
if test "$withval" = "yes"; then
1743
AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy"],
1744
[Define to list of paths to EGD sockets])
1746
AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["$withval"])
1748
AC_MSG_RESULT(EGD-compatible daemon)
1752
if test "$rand" != "1"; then
1753
AC_ARG_WITH(devrandom,
1754
[ --with-devrandom[[=DEV]] use /dev/random or compatible [[searches by default]]],
1755
[ apr_devrandom="$withval" ], [ apr_devrandom="yes" ])
1757
if test "$apr_devrandom" = "yes"; then
1758
# /dev/random on OpenBSD doesn't provide random data, so
1759
# prefer /dev/arandom, which does; see random(4).
1760
for f in /dev/arandom /dev/random /dev/urandom; do
1767
elif test "$apr_devrandom" != "no"; then
1768
if test -r "$apr_devrandom"; then
1771
AC_ERROR([$apr_devrandom not found or unreadable.])
1775
if test "$rand" = "1"; then
1776
AC_DEFINE_UNQUOTED(DEV_RANDOM, ["$apr_devrandom"], [Define to path of random device])
1777
AC_MSG_RESULT([$apr_devrandom])
1781
if test "$rand" != "1"; then
1783
# we have built in support for OS/2
1785
AC_MSG_RESULT([Using OS/2 builtin random])
1789
if test "$rand" != "1"; then
1790
if test "$ac_cv_lib_truerand_main" = "yes"; then
1791
AC_DEFINE(HAVE_TRUERAND, 1, [Define if truerand is supported])
1792
AC_MSG_RESULT(truerand)
1795
AC_MSG_RESULT(not found)
1805
dnl ----------------------------- Checking for UUID Support
1806
echo "${nl}Checking for OS UUID Support..."
1808
AC_CHECK_HEADERS(uuid.h uuid/uuid.h sys/uuid.h, break)
1810
apr_revert_save_LIBS=$LIBS
1812
# Prefer the flavor(s) that live in libc;
1813
AC_SEARCH_LIBS(uuid_create, uuid)
1814
AC_SEARCH_LIBS(uuid_generate, uuid)
1815
if test "$ac_cv_search_uuid_create" = "none required" -o \
1816
"$ac_cv_search_uuid_generate" = "none required"; then
1817
LIBS=$apr_revert_save_LIBS
1820
AC_CHECK_FUNCS(uuid_create uuid_generate)
1822
AC_CACHE_CHECK([for os uuid usability], [apr_cv_osuuid], [
1823
# Ensure this test closely mirrors misc/unix/rand.c!
1825
#if defined(HAVE_SYS_TYPES_H)
1826
#include <sys/types.h>
1828
#if defined(HAVE_UNISTD_H)
1831
#if defined(HAVE_UUID_H)
1833
#elif defined(HAVE_UUID_UUID_H)
1834
#include <uuid/uuid.h>
1835
#elif defined(HAVE_SYS_UUID_H)
1836
#include <sys/uuid.h>
1840
if test $ac_cv_func_uuid_create = yes; then
1841
AC_TRY_LINK([$uuid_includes], [
1844
uuid_create(&g, &s);
1845
if (s == uuid_s_ok) s = 0;
1846
], [apr_cv_osuuid=yes], [apr_cv_func_uuid_create=no])
1848
if test $ac_cv_func_uuid_generate = yes; then
1849
AC_TRY_LINK([$uuid_includes], [
1852
], [apr_cv_osuuid=yes], [apr_cv_func_uuid_generate=no])
1856
if test $apr_cv_osuuid = yes; then
1860
LIBS=$apr_revert_save_LIBS
1865
dnl ----------------------------- Checking for Time Support
1866
echo "${nl}Checking for Time Support..."
1868
AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[
1869
#include <sys/types.h>
1872
dnl ----------------------------- Checking for Networking Support
1873
echo "${nl}Checking for Networking support..."
1874
AC_MSG_CHECKING(for in_addr in netinet/in.h)
1876
#include <sys/types.h>
1877
#include <netinet/in.h>
1880
arg.s_addr = htonl(INADDR_ANY);
1881
], [ have_in_addr="1"
1882
msg=yes ] , [ have_in_addr="0"
1884
AC_MSG_RESULT([$msg])
1886
AC_MSG_CHECKING([if fd == socket on this platform])
1887
if test "x$file_as_socket" != "x0" ; then
1894
AC_SUBST(have_in_addr)
1895
AC_SUBST(file_as_socket)
1897
if test "$ac_cv_func_poll $file_as_socket" = "yes 1"; then
1898
AC_DEFINE(WAITIO_USES_POLL, 1,
1899
[Define if apr_wait_for_io_or_timeout() uses poll(2)])
1902
# Check the types only if we have gethostbyname_r
1903
if test "$ac_cv_func_gethostbyname_r" = "yes"; then
1904
APR_CHECK_GETHOSTBYNAME_R_STYLE
1907
APR_CHECK_TCP_NODELAY_INHERITED
1908
APR_CHECK_O_NONBLOCK_INHERITED
1909
APR_CHECK_TCP_NODELAY_WITH_CORK
1911
# Look for a way of corking TCP...
1912
APR_CHECK_DEFINE(TCP_CORK, netinet/tcp.h)
1913
APR_CHECK_DEFINE(TCP_NOPUSH, netinet/tcp.h)
1914
apr_tcp_nopush_flag="0"
1915
have_corkable_tcp="0"
1916
if test "x$ac_cv_define_TCP_CORK" = "xyes"; then
1917
apr_tcp_nopush_flag="TCP_CORK"
1918
have_corkable_tcp="1"
1923
#include <linux/socket.h>
1928
apr_tcp_nopush_flag="3"
1929
have_corkable_tcp="1"
1936
if test "x$ac_cv_define_TCP_NOPUSH" = "xyes"; then
1937
apr_tcp_nopush_flag="TCP_NOPUSH"
1938
have_corkable_tcp="1"
1941
APR_CHECK_DEFINE(SO_ACCEPTFILTER, sys/socket.h)
1942
if test "x$ac_cv_define_SO_ACCEPTFILTER" = "xyes"; then
1951
AC_SUBST(apr_tcp_nopush_flag)
1952
AC_SUBST(have_corkable_tcp)
1953
AC_SUBST(acceptfilter)
1956
AC_CHECK_FUNCS(set_h_errno)
1958
echo "${nl}Checking for IPv6 Networking support..."
1959
dnl Start of checking for IPv6 support...
1962
[ --disable-ipv6 Disable IPv6 support in APR.],
1963
[ if test "$enableval" = "no"; then
1964
user_disabled_ipv6=1
1966
[ user_disabled_ipv6=0 ] )
1973
AC_SEARCH_LIBS(getaddrinfo, socket inet6)
1974
AC_SEARCH_LIBS(gai_strerror, socket inet6)
1975
AC_SEARCH_LIBS(getnameinfo, socket inet6)
1976
AC_CHECK_FUNCS(gai_strerror)
1977
APR_CHECK_WORKING_GETADDRINFO
1978
APR_CHECK_NEGATIVE_EAI
1979
APR_CHECK_WORKING_GETNAMEINFO
1980
APR_CHECK_SOCKADDR_IN6
1981
APR_CHECK_SOCKADDR_STORAGE
1984
if test "$user_disabled_ipv6" = 1; then
1985
ipv6_result="no -- disabled by user"
1987
if test "x$broken_ipv6" = "x0"; then
1988
if test "x$have_sockaddr_in6" = "x1"; then
1989
if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
1990
if test "x$ac_cv_working_getnameinfo" = "xyes"; then
1991
APR_CHECK_GETADDRINFO_ADDRCONFIG
1995
ipv6_result="no -- no getnameinfo"
1998
ipv6_result="no -- no working getaddrinfo"
2001
ipv6_result="no -- no sockaddr_in6"
2004
ipv6_result="no -- the platform has known problems supporting IPv6"
2008
AC_MSG_CHECKING(if APR supports IPv6)
2009
AC_MSG_RESULT($ipv6_result)
2013
# hstrerror is only needed if IPv6 is not enabled,
2014
# so getaddrinfo/gai_strerror are not used.
2015
if test $have_ipv6 = 0; then
2016
AC_SEARCH_LIBS(hstrerror, resolv,
2017
[AC_DEFINE(HAVE_HSTRERROR, 1, [Define if hstrerror is present])])
2020
dnl Check for langinfo support
2022
AC_CHECK_HEADERS(langinfo.h)
2023
AC_CHECK_FUNCS(nl_langinfo)
2025
dnl ----------------------------- Finalize the variables
2027
echo "${nl}Restore user-defined environment settings..."
2029
APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
2030
APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_)
2031
APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
2032
APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_)
2033
APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_)
2034
AC_SUBST(NOTEST_CPPFLAGS)
2035
AC_SUBST(NOTEST_CFLAGS)
2036
AC_SUBST(NOTEST_LDFLAGS)
2037
AC_SUBST(NOTEST_LIBS)
2038
AC_SUBST(NOTEST_INCLUDES)
2040
dnl ----------------------------- Construct the files
2047
AC_SUBST(DEFAULT_OSDIR)
2049
AC_SUBST(LIBTOOL_LIBS)
2051
# Use -no-install to link the test programs on all platforms
2052
# but Darwin, where it would cause the programs to be linked
2053
# against installed versions of libapr instead of those just
2056
*-apple-darwin*) LT_NO_INSTALL="" ;;
2057
*) LT_NO_INSTALL="-no-install" ;;
2059
AC_SUBST(LT_NO_INSTALL)
2062
# BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
2066
# Check whether they've installed GNU make
2067
if make --version > /dev/null 2>&1; then
2068
INCLUDE_RULES="include $apr_buildout/apr_rules.mk"
2069
INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk"
2072
INCLUDE_RULES=".include \"$apr_buildout/apr_rules.mk\""
2073
INCLUDE_OUTPUTS=".include \"$apr_srcdir/build-outputs.mk\""
2077
INCLUDE_RULES="include $apr_buildout/apr_rules.mk"
2078
INCLUDE_OUTPUTS="include $apr_srcdir/build-outputs.mk"
2081
AC_SUBST(INCLUDE_RULES)
2082
AC_SUBST(INCLUDE_OUTPUTS)
2084
AC_CONFIG_FILES([Makefile
2088
apr-$APR_MAJOR_VERSION-config:apr-config.in
2091
if test -d $srcdir/test; then
2092
AC_CONFIG_FILES([test/Makefile test/internal/Makefile])
2095
dir=include/arch/unix
2096
test -d $dir || $MKDIR $dir
2098
AC_CONFIG_COMMANDS([default], [
2099
# Commands run at the end of config.status:
2100
for i in $APR_SAVE_HEADERS; do
2101
if cmp -s $i $i.save 2>/dev/null; then
2103
AC_MSG_NOTICE([$i is unchanged])
2107
chmod +x apr-$APR_MAJOR_VERSION-config
2109
dnl This section is expanded by configure UNQUOTED so variable
2110
dnl references must be backslash-escaped as necessary.
2112
# Commands run at the beginning of config.status:
2113
APR_SAVE_HEADERS="include/apr.h include/arch/unix/apr_private.h"
2114
APR_MAJOR_VERSION=$APR_MAJOR_VERSION
2116
for apri in \${APR_SAVE_HEADERS}; do
2117
test -r \${apri} && mv \${apri} \${apri}.save