📄 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 APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX 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(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="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.# The BEOSSEM decision doesn't require any substitutions but is# included here to prevent the fcntl() branch being selected# from the decision making.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()]))APR_IFALLYES(header:OS.h func:create_sem, APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores])) 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" ;; USE_BEOSSEM ) beossem="1" ;;esacif test $hasfcntlser = "1"; thenAC_MSG_CHECKING(if fcntl returns EACCES when F_SETLK is already held)AC_TRY_RUN([#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#ifdef HAVE_SYS_TYPES_H#include <sys/types.h>#endif#ifdef HAVE_SYS_STAT_H#include <sys/stat.h>#endif#ifdef HAVE_SYS_WAIT_H#include <sys/wait.h>#endif#if defined(HAVE_UNISTD_H)#include <unistd.h>#endif#include <fcntl.h>#include <errno.h>int fd;struct flock proc_mutex_lock_it = {0};const char *fname = "conftest.fcntl";int main(){ int rc, status;; proc_mutex_lock_it.l_whence = SEEK_SET; /* from current point */ proc_mutex_lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ fd = creat(fname, S_IRWXU); unlink(fname); if (rc = lockit()) { exit(-1); } if (fork()) { wait(&status); } else { return(lockit()); } close(fd); exit(WEXITSTATUS(status) != EACCES);}int lockit() { int rc; do { rc = fcntl(fd, F_SETLK, &proc_mutex_lock_it); } while ( rc < 0 && errno == EINTR); return (rc < 0) ? errno : 0;}], [apr_fcntl_tryacquire_eacces=1], [apr_fcntl_tryacquire_eacces=0], [apr_fcntl_tryacquire_eacces=0])fiif test "$apr_fcntl_tryacquire_eacces" = "1"; then AC_DEFINE(FCNTL_TRYACQUIRE_EACCES, 1, [Define if fcntl returns EACCES when F_SETLK is already held])fiAC_SUBST(hasflockser)AC_SUBST(hassysvser)AC_SUBST(hasposixser)AC_SUBST(hasfcntlser)AC_SUBST(hasprocpthreadser)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)why_no_rand=""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/urandom /dev/random; 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 case $host in *os390) if test $os_version -lt 1700; then rand="0" why_no_rand=" ($apr_devrandom unusable on z/OS before V1R7)" fi ;; esac 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$why_no_rand) rand="0" fi fi ;; esacfiAC_SUBST(rand)dnl ----------------------------- Checking for File Info Support echo "${nl}Checking for File Info Support..."AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_atimensec,struct stat.st_ctimensec, struct stat.st_mtimensec, struct stat.st_atim.tv_nsec,struct stat.st_ctim.tv_nsec, struct stat.st_mtim.tv_nsec,struct stat.st_atime_n, struct stat.st_ctime_n, struct stat.st_mtime_n],,,[#ifdef HAVE_SYS_TYPES_H#include <sys/types.h>#endif#ifdef HAVE_SYS_STAT_H#include <sys/stat.h>#endif#ifdef HAVE_UNISTD_H#include <unistd.h>#endif])APR_CHECK_DIRENT_INODEAPR_CHECK_DIRENT_TYPEdnl ----------------------------- Checking for UUID Support echo "${nl}Checking for OS UUID Support..."AC_CHECK_HEADERS(uuid.h uuid/uuid.h sys/uuid.h, break)apr_revert_save_LIBS=$LIBS# Prefer the flavor(s) that live in libc;AC_SEARCH_LIBS(uuid_create, uuid)AC_SEARCH_LIBS(uuid_generate, uuid)if test "$ac_cv_search_uuid_create" = "none required" -o \ "$ac_cv_search_uuid_generate" = "none required"; then LIBS=$apr_revert_save_LIBSfiAC_CHECK_FUNCS(uuid_create uuid_generate)AC_CACHE_CHECK([for os uuid usability], [apr_cv_osuuid], [# Ensure this test closely mirrors misc/unix/rand.c!uuid_includes="#if defined(HAVE_SYS_TYPES_H)#include <sys/types.h>#endif#if defined(HAVE_UNISTD_H)#include <unistd.h>#endif#if defined(HAVE_UUID_H)#include <uuid.h>#elif defined(HAVE_UUID_UUID_H)#include <uuid/uuid.h>#elif defined(HAVE_SYS_UUID_H)#include <sys/uuid.h>#endif" apr_cv_osuuid=no if test $ac_cv_func_uuid_create = yes; then AC_TRY_LINK([$uuid_includes], [ uuid_t g; uint32_t s; uuid_create(&g, &s); if (s == uuid_s_ok) s = 0; ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_create=no]) fi if test $ac_cv_func_uuid_generate = yes; then AC_TRY_LINK([$uuid_includes], [ uuid_t g; uuid_generate(g); ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_generate=no]) fi ])if test $apr_cv_osuuid = yes; then osuuid="1"else osuuid="0" LIBS=$apr_revert_save_LIBSfiAC_SUBST(osuuid)dnl ----------------------------- Checking for Time Support echo "${nl}Checking for Time Support..."AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[#include <sys/types.h>#include <time.h>])dnl ----------------------------- Checking for Networking Support echo "${nl}Checking for Networking support..."APR_TYPE_IN_ADDRif test "$ac_cv_type_in_addr" = "yes"; then have_in_addr="1"else have_in_addr="0"fiAC_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)if test "$ac_cv_func_poll $file_as_socket" = "yes 1"; then AC_DEFINE(WAITIO_USES_POLL, 1, [Define if apr_wait_for_io_or_timeout() uses poll(2)])fi# Check the types only if we have gethostbyname_rif test "$ac_cv_func_gethostbyname_r" = "yes"; then APR_CHECK_GETHOSTBYNAME_R_STYLEfi# Check the types only if we have getservbyname_rif test "$ac_cv_func_getservbyname_r" = "yes"; then APR_CHECK_GETSERVBYNAME_R_STYLEfiAPR_CHECK_TCP_NODELAY_INHERITEDAPR_CHECK_O_NONBLOCK_INHERITEDAPR_CHECK_TCP_NODELAY_WITH_CORK# 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/sock
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -