aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in177
1 files changed, 136 insertions, 41 deletions
diff --git a/configure.in b/configure.in
index be6777f7b20b..6833b32d04de 100644
--- a/configure.in
+++ b/configure.in
@@ -264,8 +264,11 @@ case $host in
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# get libtool's setting of shlibpath_var
- eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool`
if test "x$shlibpath_var" = "x"; then
+ eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool`
+ fi
+ if test "x$shlibpath_var" = "x"; then
+ AC_MSG_NOTICE([SHLIBPATH variable could not be determined])
shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
fi
fi
@@ -807,15 +810,13 @@ else
fi
fi
-ac_cv_define_READDIR_IS_THREAD_SAFE=no
+ac_cv_define_READDIR_IS_THREAD_SAFE=yes
ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no
ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no
ac_cv_define_GETSERVBYNAME_IS_THREAD_SAFE=no
if test "$threads" = "1"; then
echo "APR will use threads"
- AC_CHECK_LIB(c_r, readdir,
- AC_DEFINE(READDIR_IS_THREAD_SAFE, 1,
- [Define if readdir is thread safe]))
+ AC_DEFINE(READDIR_IS_THREAD_SAFE, 1, [Modern readdir is thread safe])
if test "x$apr_gethostbyname_is_thread_safe" = "x"; then
AC_CHECK_LIB(c_r, gethostbyname, apr_gethostbyname_is_thread_safe=yes)
fi
@@ -1490,6 +1491,7 @@ APR_FLAG_HEADERS(
errno.h \
fcntl.h \
grp.h \
+ inttypes.h \
io.h \
limits.h \
mach-o/dyld.h \
@@ -1569,6 +1571,7 @@ AC_SUBST(crypth)
AC_SUBST(errnoh)
AC_SUBST(direnth)
AC_SUBST(fcntlh)
+AC_SUBST(inttypesh)
AC_SUBST(ioh)
AC_SUBST(limitsh)
AC_SUBST(netdbh)
@@ -1664,9 +1667,9 @@ fi
dnl Checks for integer size
AC_CHECK_SIZEOF(char, 1)
+AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(long long, 8)
if test "$ac_cv_sizeof_short" = "2"; then
@@ -1675,16 +1678,37 @@ fi
if test "$ac_cv_sizeof_int" = "4"; then
int_value=int
fi
+
# Now we need to find what apr_int64_t (sizeof == 8) will be.
-# The first match is our preference.
-if test "$ac_cv_sizeof_int" = "8"; then
+# The first match is our preference (use inttypes if available).
+APR_IFALLYES(header:stdint.h header:inttypes.h, hasinttypes="1", hasinttypes="0")
+if test "$hasinttypes" = "1"; then
+ int64_literal='#define APR_INT64_C(val) INT64_C(val)'
+ uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)'
+ int64_t_fmt='#define APR_INT64_T_FMT PRId64'
+ uint64_t_fmt='#define APR_UINT64_T_FMT PRIu64'
+ uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT PRIx64'
+ int64_value="int64_t"
+ uint64_value="uint64_t"
+ APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, int, d, [
+ int64_strfn="strtoi"
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, long, ld, [
+ int64_strfn="strtol"
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, long long, lld, [
+ int64_strfn="strtoll"
+ ], [
+ AC_ERROR([could not determine the string function for int64_t])
+ ])])])
+elif test "$ac_cv_sizeof_int" = "8"; then
int64_literal='#define APR_INT64_C(val) (val)'
uint64_literal='#define APR_UINT64_C(val) (val##U)'
int64_t_fmt='#define APR_INT64_T_FMT "d"'
uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
int64_value="int"
- long_value=int
+ uint64_value="unsigned int"
int64_strfn="strtoi"
elif test "$ac_cv_sizeof_long" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##L)'
@@ -1693,7 +1717,7 @@ elif test "$ac_cv_sizeof_long" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
int64_value="long"
- long_value=long
+ uint64_value="unsigned long"
int64_strfn="strtol"
elif test "$ac_cv_sizeof_long_long" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##LL)'
@@ -1706,7 +1730,7 @@ elif test "$ac_cv_sizeof_long_long" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "llu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"'
int64_value="long long"
- long_value="long long"
+ uint64_value="unsigned long long"
int64_strfn="strtoll"
elif test "$ac_cv_sizeof_longlong" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##LL)'
@@ -1715,7 +1739,7 @@ elif test "$ac_cv_sizeof_longlong" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
int64_value="__int64"
- long_value="__int64"
+ uint64_value="unsigned __int64"
int64_strfn="strtoll"
else
# int64_literal may be overriden if your compiler thinks you have
@@ -1833,18 +1857,22 @@ case $host in
uint64_t_fmt='#define APR_UINT64_T_FMT "I64u"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "I64x"'
int64_value="__int64"
- long_value="__int64"
+ uint64_value="unsigned __int64"
int64_strfn="_strtoi64"
;;
esac
-APR_CHECK_TYPES_COMPATIBLE(ssize_t, int, [ssize_t_fmt="d"])
-APR_CHECK_TYPES_COMPATIBLE(ssize_t, long, [ssize_t_fmt="ld"])
-APR_CHECK_TYPES_COMPATIBLE(size_t, unsigned int, [size_t_fmt="u"])
-APR_CHECK_TYPES_COMPATIBLE(size_t, unsigned long, [size_t_fmt="lu"])
+dnl I would expect much of the above to go away with new compile test
+APR_CHECK_TYPES_FMT_COMPATIBLE(ssize_t, long, ld, [ssize_t_fmt="ld"], [
+APR_CHECK_TYPES_FMT_COMPATIBLE(ssize_t, int, d, [ssize_t_fmt="d"])
+])
+APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned long, lu, [size_t_fmt="lu"], [
+APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"])
+])
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
+dnl the else cases below should no longer occur;
AC_MSG_CHECKING([which format to use for apr_ssize_t])
if test -n "$ssize_t_fmt"; then
AC_MSG_RESULT(%$ssize_t_fmt)
@@ -1862,6 +1890,7 @@ ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
+# else cases below should no longer occur;
AC_MSG_CHECKING([which format to use for apr_size_t])
if test -n "$size_t_fmt"; then
AC_MSG_RESULT(%$size_t_fmt)
@@ -1914,21 +1943,24 @@ elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then
off_t_fmt='#define APR_OFF_T_FMT "ld"'
off_t_strfn='strtol'
elif test "$ac_cv_type_off_t" = "yes"; then
- off_t_value=off_t
# off_t is more commonly a long than an int; prefer that case
- # where int and long are the same size.
- if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
- off_t_fmt='#define APR_OFF_T_FMT "ld"'
+ # where int and long are the same size and interchangable.
+ off_t_value=off_t
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long, ld, [
+ off_t_fmt="#define APR_OFF_T_FMT \"ld\""
off_t_strfn='strtol'
- elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then
- off_t_fmt='#define APR_OFF_T_FMT "d"'
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, int, d, [
+ off_t_fmt="#define APR_OFF_T_FMT \"d\""
off_t_strfn='strtoi'
- elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
- off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
- off_t_strfn='apr_strtoi64'
- else
- AC_ERROR([could not determine the size of off_t])
- fi
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long long, lld, [
+ off_t_fmt="#define APR_OFF_T_FMT \"lld\""
+ off_t_strfn='strtoll'
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, $int64_value, I64d, [
+ off_t_fmt="#define APR_OFF_T_FMT APR_INT64_T_FMT"
+ off_t_strfn='apr_strtoi64'], [
# Per OS tuning...
case $host in
*-mingw*)
@@ -1936,7 +1968,11 @@ elif test "$ac_cv_type_off_t" = "yes"; then
off_t_fmt='#define APR_OFF_T_FMT "I64d"'
off_t_strfn='_strtoi64'
;;
+ *)
+ AC_ERROR([could not determine the size of off_t])
+ ;;
esac
+ ])])])])
else
# Fallback on int
off_t_value=apr_int32_t
@@ -1995,8 +2031,8 @@ fi
AC_SUBST(voidp_size)
AC_SUBST(short_value)
AC_SUBST(int_value)
-AC_SUBST(long_value)
AC_SUBST(int64_value)
+AC_SUBST(uint64_value)
AC_SUBST(off_t_value)
AC_SUBST(size_t_value)
AC_SUBST(ssize_t_value)
@@ -2189,10 +2225,17 @@ AC_SUBST(struct_rlimit)
dnl ----------------------------- Checking for Locking Characteristics
echo "${nl}Checking for Locking..."
-AC_CHECK_FUNCS(semget semctl flock)
-AC_CHECK_HEADERS(semaphore.h OS.h)
+AC_CHECK_FUNCS(semget semctl semop semtimedop flock)
+APR_IFALLYES(func:semtimedop, have_semtimedop="1", have_semtimedop="0")
+
+AC_CHECK_HEADERS(semaphore.h)
AC_SEARCH_LIBS(sem_open, rt)
-AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait create_sem)
+AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait sem_timedwait)
+APR_IFALLYES(func:sem_timedwait, have_sem_timedwait="1", have_sem_timedwait="0")
+
+AC_CHECK_HEADERS(OS.h)
+AC_CHECK_FUNCS(create_sem acquire_sem acquire_sem_etc)
+APR_IFALLYES(header:OS.h func:acquire_sem_etc, have_acquire_sem_etc="1", have_acquire_sem_etc="0")
# Some systems return ENOSYS from sem_open.
AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[
@@ -2251,7 +2294,10 @@ APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h)
if test "$threads" = "1"; then
APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
- AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
+ AC_CHECK_FUNCS(pthread_mutex_timedlock pthread_mutexattr_setpshared)
+ APR_IFALLYES(header:pthread.h func:pthread_mutex_timedlock,
+ have_pthread_mutex_timedlock="1", have_pthread_mutex_timedlock="0")
+ AC_SUBST(have_pthread_mutex_timedlock)
# Some systems have setpshared and define PROCESS_SHARED, but don't
# really support PROCESS_SHARED locks. So, we must validate that we
# can go through the steps without receiving some sort of system error.
@@ -2289,8 +2335,8 @@ fi
APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
func:sem_unlink func:sem_post func:sem_wait,
hasposixser="1", hasposixser="0")
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1",
- hassysvser="0")
+APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO,
+ hassysvser="1", hassysvser="0")
APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0")
# note: the current APR use of shared mutex requires /dev/zero
@@ -2300,6 +2346,11 @@ APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
hasprocpthreadser="1", hasprocpthreadser="0")
APR_IFALLYES(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="0")
+AC_CHECK_FUNCS(pthread_condattr_setpshared)
+APR_IFALLYES(header:pthread.h func:pthread_condattr_setpshared,
+ have_pthread_condattr_setpshared="1", have_pthread_condattr_setpshared="0")
+AC_SUBST(have_pthread_condattr_setpshared)
+
# See which lock mechanism we'll select by default on this system.
# The last APR_DECIDE to execute sets the default.
# At this stage, we match the ordering in Apache 1.3
@@ -2315,10 +2366,18 @@ APR_IFALLYES(func:flock define:LOCK_EX,
APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
APR_IFALLYES(header:fcntl.h define:F_SETLK,
APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO,
+APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO,
APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
-APR_IFALLYES(header:OS.h func:create_sem,
+APR_IFALLYES(header:OS.h func:create_sem func:acquire_sem func:acquire_sem_etc,
APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores]))
+# pthread mutex both pshared and robust[_np] is the best default
+case "$apr_cv_mutex_robust_shared" in
+"yes"|"np")
+ APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread pshared mutex])
+ ;;
+*)
+ ;;
+esac
if test "x$apr_lock_method" != "x"; then
APR_DECISION_FORCE($apr_lock_method)
fi
@@ -2478,6 +2537,15 @@ else
fi
dnl ----------------------------- Checking for /dev/random
+AC_CHECK_HEADERS(sys/random.h)
+AC_CHECK_FUNCS(getrandom)
+
+AC_CHECK_HEADERS(sys/syscall.h)
+AC_CHECK_HEADERS(linux/random.h)
+AC_CHECK_DECLS([SYS_getrandom], [], [], [#include <sys/syscall.h>])
+
+AC_CHECK_FUNCS(arc4random_buf)
+
AC_MSG_CHECKING(for entropy source)
why_no_rand=""
@@ -2496,9 +2564,26 @@ AC_ARG_WITH(egd,
])
if test "$rand" != "1"; then
+ if test "$ac_cv_func_getrandom" = yes; then
+ rand="getrandom"
+ elif test "$ac_cv_have_decl_SYS_getrandom" = yes; then
+ rand="SYS_getrandom"
+ elif test "$ac_cv_func_arc4random_buf" = yes; then
+ rand="arc4random"
+ fi
+fi
+
+if test "$rand" != "1"; then
AC_ARG_WITH(devrandom,
[ --with-devrandom[[=DEV]] use /dev/random or compatible [[searches by default]]],
- [ apr_devrandom="$withval" ], [ apr_devrandom="yes" ])
+ [ apr_devrandom="$withval" ], [ apr_devrandom="no" ])
+ if test "$apr_devrandom" = "no"; then
+ if test -z "$rand"; then
+ apr_devrandom="yes"
+ else
+ apr_devrandom="no"
+ fi
+ fi
if test "$apr_devrandom" = "yes"; then
# /dev/random on OpenBSD doesn't provide random data, so
@@ -2506,7 +2591,7 @@ if test "$rand" != "1"; then
for f in /dev/arandom /dev/urandom /dev/random; do
if test -r $f; then
apr_devrandom=$f
- rand=1
+ rand="1"
break
fi
done
@@ -2532,6 +2617,10 @@ if test "$rand" != "1"; then
if test "$rand" = "1"; then
AC_DEFINE_UNQUOTED(DEV_RANDOM, ["$apr_devrandom"], [Define to path of random device])
AC_MSG_RESULT([$apr_devrandom])
+ elif test -n "$rand"; then
+ AC_DEFINE_UNQUOTED(SYS_RANDOM, ["$rand"], [Define system call of random])
+ AC_MSG_RESULT([$rand])
+ rand="1"
fi
fi
@@ -2749,7 +2838,7 @@ esac
AC_SEARCH_LIBS(getaddrinfo, socket inet6)
AC_SEARCH_LIBS(gai_strerror, socket inet6)
AC_SEARCH_LIBS(getnameinfo, socket inet6)
-AC_CHECK_FUNCS(gai_strerror)
+AC_CHECK_FUNCS(gai_strerror if_nametoindex if_indextoname)
APR_CHECK_WORKING_GETADDRINFO
APR_CHECK_NEGATIVE_EAI
APR_CHECK_WORKING_GETNAMEINFO
@@ -2787,6 +2876,12 @@ AC_MSG_RESULT($ipv6_result)
AC_SUBST(have_ipv6)
+AC_ARG_ENABLE(timedlocks,
+ [ --disable-timedlocks Disable timed locks ],
+ [apr_has_timedlocks="0"], [apr_has_timedlocks="1"]
+)
+AC_SUBST(apr_has_timedlocks)
+
# hstrerror is only needed if IPv6 is not enabled,
# so getaddrinfo/gai_strerror are not used.
if test $have_ipv6 = 0; then