📄 configure.in
字号:
pthread_mutex_t mutex; pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr)) exit(1); if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) exit(2); if (pthread_mutex_init(&mutex, &attr)) exit(3); if (pthread_mutexattr_destroy(&attr)) exit(4); if (pthread_mutex_destroy(&mutex)) exit(5); exit(0); }], [apr_cv_process_shared_works=yes], [apr_cv_process_shared_works=no])]) # Override detection of pthread_mutexattr_setpshared ac_cv_func_pthread_mutexattr_setpshared=$apr_cv_process_shared_works]) if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then AC_CHECK_FUNCS(pthread_mutexattr_setrobust_np) if test "$ac_cv_func_pthread_mutexattr_setrobust_np" = "no"; then AC_CACHE_CHECK([for pthread_mutexattr_setrobust_np with _POSIX_THREAD_PRIO_INHERIT], [apr_cv_setrobust_with_prio_inherit], [ AC_TRY_COMPILE([#define _POSIX_THREAD_PRIO_INHERIT#include <sys/types.h>#include <pthread.h>],[ int main() { pthread_mutexattr_t attr; pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); return 0; }], [apr_cv_setrobust_with_prio_inherit=yes], [apr_cv_setrobust_with_prio_inherit=no])]) if test "$apr_cv_setrobust_with_prio_inherit" = "yes"; then ac_cv_func_pthread_mutexattr_setrobust_np=yes APR_ADDTO(CPPFLAGS, -D_POSIX_THREAD_PRIO_INHERIT) fi fi fifi# See which lock mechanisms we can support on this system.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: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/zeroAPR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl func:pthread_mutexattr_setpshared dnl file:/dev/zero, hasprocpthreadser="1", hasprocpthreadser="0")APR_IFALLYES(struct:pthread_rw, hasrwlockser="1", hasrwlockser="0")# 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# which is (highest to lowest): sysvsem -> fcntl -> flock.# POSIX semaphores and cross-process pthread mutexes are not# used by default since they have less desirable behaviour when# e.g. a process holding the mutex segfaults.APR_BEGIN_DECISION([apr_lock implementation method])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_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))if test "x$apr_lock_method" != "x"; then APR_DECISION_FORCE($apr_lock_method)fiAPR_END_DECISIONAC_DEFINE_UNQUOTED($ac_decision)flockser="0"sysvser="0"posixser="0"procpthreadser="0"fcntlser="0"case $ac_decision in USE_FLOCK_SERIALIZE ) flockser="1" ;; USE_FCNTL_SERIALIZE ) fcntlser="1" ;; USE_SYSVSEM_SERIALIZE ) sysvser="1" ;; USE_POSIXSEM_SERIALIZE ) posixser="1" ;; USE_PROC_PTHREAD_SERIALIZE ) procpthreadser="1" ;;esacAC_SUBST(hasflockser)AC_SUBST(hassysvser)AC_SUBST(hasposixser)AC_SUBST(hasfcntlser)AC_SUBST(hasprocpthreadser)AC_SUBST(hasrwlockser)AC_SUBST(flockser)AC_SUBST(sysvser)AC_SUBST(posixser)AC_SUBST(fcntlser)AC_SUBST(procpthreadser)AC_SUBST(pthreadser)AC_MSG_CHECKING(if all interprocess locks affect threads)if test "x$apr_process_lock_is_global" = "xyes"; then proclockglobal="1" AC_MSG_RESULT(yes)else proclockglobal="0" AC_MSG_RESULT(no)fiAC_SUBST(proclockglobal)AC_MSG_CHECKING(if POSIX sems affect threads in the same process)if test "x$apr_posixsem_is_global" = "xyes"; then AC_DEFINE(POSIXSEM_IS_GLOBAL, 1, [Define if POSIX semaphores affect threads within the process]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fiAC_MSG_CHECKING(if SysV sems affect threads in the same process)if test "x$apr_sysvsem_is_global" = "xyes"; then AC_DEFINE(SYSVSEM_IS_GLOBAL, 1, [Define if SysV semaphores affect threads within the process]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fiAC_MSG_CHECKING(if fcntl locks affect threads in the same process)if test "x$apr_fcntl_is_global" = "xyes"; then AC_DEFINE(FCNTL_IS_GLOBAL, 1, [Define if fcntl locks affect threads within the process]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fiAC_MSG_CHECKING(if flock locks affect threads in the same process)if test "x$apr_flock_is_global" = "xyes"; then AC_DEFINE(FLOCK_IS_GLOBAL, 1, [Define if flock locks affect threads within the process]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fidnl ----------------------------- Checking for /dev/random AC_MSG_CHECKING(for entropy source)AC_ARG_WITH(egd, [ --with-egd[[=DIR]] use EGD-compatible socket], [ AC_DEFINE(HAVE_EGD, 1, [Define if EGD is supported]) if test "$withval" = "yes"; then AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy"], [Define to list of paths to EGD sockets]) else AC_DEFINE_UNQUOTED(EGD_DEFAULT_SOCKET, ["$withval"]) fi AC_MSG_RESULT(EGD-compatible daemon) rand="1" ])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" ]) if test "$apr_devrandom" = "yes"; then # /dev/random on OpenBSD doesn't provide random data, so # prefer /dev/arandom, which does; see random(4). for f in /dev/arandom /dev/random /dev/urandom; do if test -r $f; then apr_devrandom=$f rand=1 break fi done elif test "$apr_devrandom" != "no"; then if test -r "$apr_devrandom"; then rand="1" else AC_ERROR([$apr_devrandom not found or unreadable.]) fi fi if test "$rand" = "1"; then AC_DEFINE_UNQUOTED(DEV_RANDOM, ["$apr_devrandom"], [Define to path of random device]) AC_MSG_RESULT([$apr_devrandom]) fifiif test "$rand" != "1"; then case $host in # we have built in support for OS/2 *-os2*) AC_MSG_RESULT([Using OS/2 builtin random]) rand="1" ;; *) if test "$rand" != "1"; then if test "$ac_cv_lib_truerand_main" = "yes"; then AC_DEFINE(HAVE_TRUERAND, 1, [Define if truerand is supported]) AC_MSG_RESULT(truerand) rand="1" else AC_MSG_RESULT(not found) rand="0" fi fi ;; esacfiAC_SUBST(rand)dnl ----------------------------- Checking for Time Support echo "${nl}Checking for Time Support..."AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,[AC_TRY_COMPILE([#include <sys/types.h>#include <time.h>], [struct tm tm; tm.tm_gmtoff;], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])if test "$ac_cv_struct_tm_gmtoff" = "yes"; then AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])fidnl ----------------------------- Checking for Networking Support echo "${nl}Checking for Networking support..."AC_MSG_CHECKING(for in_addr in netinet/in.h)AC_TRY_COMPILE([#include <sys/types.h>#include <netinet/in.h>],[struct in_addr arg;arg.s_addr = htonl(INADDR_ANY);], [ have_in_addr="1" msg=yes ] , [ have_in_addr="0"msg=no ])AC_MSG_RESULT([$msg])AC_MSG_CHECKING([if fd == socket on this platform])if test "x$file_as_socket" != "x0" ; then file_as_socket="1"; echo "yes"else echo "no"fiAC_SUBST(have_in_addr)AC_SUBST(file_as_socket)# Check the types only if we have gethostbyname_rif test "$ac_cv_func_gethostbyname_r" = "yes"; then APR_CHECK_GETHOSTBYNAME_R_STYLEfiAPR_CHECK_TCP_NODELAY_INHERITEDAPR_CHECK_O_NONBLOCK_INHERITED# Look for a way of corking TCP...APR_CHECK_DEFINE(TCP_CORK, netinet/tcp.h)APR_CHECK_DEFINE(TCP_NOPUSH, netinet/tcp.h)apr_tcp_nopush_flag="0"have_corkable_tcp="0"if test "x$ac_cv_define_TCP_CORK" = "xyes"; then apr_tcp_nopush_flag="TCP_CORK" have_corkable_tcp="1"else case $host in *linux*) AC_EGREP_CPP(yes,[#include <linux/socket.h>#ifdef TCP_CORKyes#endif ],[ apr_tcp_nopush_flag="3" have_corkable_tcp="1" ]) ;; *) ;; esacfiif test "x$ac_cv_define_TCP_NOPUSH" = "xyes"; then apr_tcp_nopush_flag="TCP_NOPUSH" have_corkable_tcp="1"fiAPR_CHECK_DEFINE(SO_ACCEPTFILTER, sys/socket.h)if test "x$ac_cv_define_SO_ACCEPTFILTER" = "xyes"; then acceptfilter="1"else acceptfilter="0"fiAPR_CHECK_SCTPAC_SUBST(apr_tcp_nopush_flag)AC_SUBST(have_corkable_tcp)AC_SUBST(acceptfilter)AC_SUBST(have_sctp)AC_CHECK_FUNCS(set_h_errno)APR_CHECK_RESOLV_RETRANSecho "${nl}Checking for IPv6 Networking support..."dnl Start of checking for IPv6 support...AC_ARG_ENABLE(ipv6, [ --disable-ipv6 Disable IPv6 support in APR.], [ if test "$enableval" = "no"; then user_disabled_ipv6=1 fi ], [ user_disabled_ipv6=0 ] )case $host in *) broken_ipv6=0esacAC_SEARCH_LIBS(getaddrinfo, socket inet6)AC_SEARCH_LIBS(gai_strerror, socket inet6)AC_SEARCH_LIBS(getnameinfo, socket inet6)AC_CHECK_FUNCS(gai_strerror)APR_CHECK_WORKING_GETADDRINFOAPR_CHECK_NEGATIVE_EAIAPR_CHECK_WORKING_GETNAMEINFOAPR_CHECK_SOCKADDR_IN6have_ipv6="0"if test "$user_disabled_ipv6" = 1; then ipv6_result="no -- disabled by user"else if test "x$broken_ipv6" = "x0"; then if test "x$have_sockaddr_in6" = "x1"; then if test "x$ac_cv_working_getaddrinfo" = "xyes"; then if test "x$ac_cv_working_getnameinfo" = "xyes"; then have_ipv6="1" ipv6_result="yes" else ipv6_result="no -- no getnameinfo" fi else ipv6_result="no -- no working getaddrinfo" fi else ipv6_result="no -- no sockaddr_in6" fi else ipv6_result="no -- the platform has known problems supporting IPv6" fifiAC_MSG_CHECKING(if APR supports IPv6)AC_MSG_RESULT($ipv6_result)AC_SUBST(have_ipv6)dnl Check for langinfo supportAC_CHECK_HEADERS(langinfo.h)AC_CHECK_FUNCS(nl_langinfo)dnl Random late checks...# AC_CHECK_FUNCS is not sufficient since the function may be usable when# struct stat64 is not exposed (e.g. HP-UX). Note that fstat64 only# happens to be usable on Linux because -D_GNU_SOURCE is picked up# by the earlier crypt_r check.AC_CACHE_CHECK([for usable fstat64], [apr_cv_func_fstat64], [AC_TRY_COMPILE([#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>], [struct stat64 st; fstat64(0, &st);], [apr_cv_func_fstat64=yes], [apr_cv_func_fstat64=no])])if test $apr_cv_func_fstat64 = yes; then AC_DEFINE(HAVE_FSTAT64, 1, [Define if fstat64 can be used])fidnl ----------------------------- Finalize the variablesecho "${nl}Restore user-defined environment settings..."APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)APR_RESTORE_THE_ENVIRONMENT(CFLAGS, EXTRA_)APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)APR_RESTORE_THE_ENVIRONMENT(LIBS, EXTRA_)APR_RESTORE_THE_ENVIRONMENT(INCLUDES, EXTRA_)AC_SUBST(NOTEST_CPPFLAGS)AC_SUBST(NOTEST_CFLAGS)AC_SUBST(NOTEST_LDFLAGS)AC_SUBST(NOTEST_LIBS)AC_SUBST(NOTEST_INCLUDES)dnl ----------------------------- Construct the filesAC_SUBST(LDLIBS)AC_SUBST(AR)AC_SUBST(RM)AC_SUBST(OSDIR)AC_SUBST(DEFAULT_OSDIR)AC_SUBST(EXEEXT)AC_SUBST(LIBTOOL_LIBS)echo "${nl}Construct Makefiles and header files."MAKEFILE1="Makefile strings/Makefile passwd/Makefile tables/Makefile build/Makefile"SUBDIRS="strings passwd tables "for dir in $apr_modulesdo test -d $dir || $MKDIR $dir if test -f $srcdir/$dir/$OSDIR/Makefile.in; then MAKEFILE2="$MAKEFILE2 $dir/$OSDIR/Makefile " SUBDIRS="$SUBDIRS $dir/$OSDIR " else MAKEFILE2="$MAKEFILE2 $dir/$DEFAULT_OSDIR/Makefile " SUBDIRS="$SUBDIRS $dir/$DEFAULT_OSDIR " fidoneif test -d $srcdir/test; then MAKEFILE3="test/Makefile test/internal/Makefile"fiAC_SUBST(SUBDIRS)## BSD/OS (BSDi) needs to use a different include syntax in the Makefiles#case $host in*bsdi*) # Check whether they've installed GNU make if make --version > /dev/null 2>&1; then INCLUDE_RULES="include $apr_buildout/apr_rules.mk" else # BSDi make INCLUDE_RULES=".include \"$apr_buildout/apr_rules.mk\"" fi ;;*) INCLUDE_RULES="include $apr_buildout/apr_rules.mk" ;;esacAC_SUBST(INCLUDE_RULES)SAVE_FILES="include/apr.h include/arch/unix/apr_private.h"for i in $SAVE_FILES; do test -r $i && mv $i $i.savedonedir=include/arch/unixtest -d $dir || $MKDIR $dirAC_OUTPUT([ $MAKEFILE1 $MAKEFILE2 $MAKEFILE3 include/apr.h build/apr_rules.mk build/pkg/pkginfo apr-config],[for i in $SAVE_FILES; do if cmp -s $i $i.save 2>/dev/null; then mv $i.save $i echo "$i is unchanged" fi rm -f $i.savedonechmod +x apr-config])dnl ----------------------------- Fixup Makefiles for VPATH supportchangequote({,})if test -n "$USE_VPATH"; then for makefile in $MAKEFILE1 $MAKEFILE2 $MAKEFILE3; do cat $makefile | \ sed \ -e 's#-I\($(INCDIR[0-9]*)\)#-I\1 -I$(srcdir)/\1#g' \ -e 's#-I\($(OSDIR[0-9]*)\)#-I\1 -I$(srcdir)/\1#g' \ -e 's#-I\($(DEFOSDIR[0-9]*)\)#-I\1 -I$(srcdir)/\1#g' \ > tmp cp tmp $makefile done rm -f tmpfichangequote([,])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -