📄 configure.in
字号:
AC_SUBST(netinet_sctp_uioh)AC_SUBST(netinet_tcph)AC_SUBST(stdargh)AC_SUBST(stdioh)AC_SUBST(stdlibh)AC_SUBST(stringh)AC_SUBST(stringsh)AC_SUBST(sys_ioctlh)AC_SUBST(sys_sendfileh)AC_SUBST(sys_signalh)AC_SUBST(sys_socketh)AC_SUBST(sys_sockioh)AC_SUBST(sys_typesh)AC_SUBST(sys_timeh)AC_SUBST(sys_uioh)AC_SUBST(sys_unh)AC_SUBST(timeh)AC_SUBST(unistdh)AC_SUBST(signalh)AC_SUBST(sys_waith)AC_SUBST(pthreadh)AC_SUBST(semaphoreh)# Checking for h_errno in <netdb.h>if test "$netdbh" = "1"; then APR_CHECK_H_ERRNO_FLAG if test "$ac_cv_h_errno_cflags" = "no"; then AC_MSG_ERROR([can not find h_errno in netdb.h]) fifidnl ----------------------------- Checks for standard typedefsAC_TYPE_OFF_TAC_TYPE_PID_TAC_TYPE_SIZE_TAC_TYPE_UID_TAC_CHECK_TYPE(ssize_t, int)AC_C_INLINEAC_C_CONSTAC_TYPE_SIZE_TAC_FUNC_SETPGRPAPR_CHECK_SOCKLEN_TAPR_INADDR_NONEdnl Checks for pointer sizeAC_CHECK_SIZEOF(void*, 4)if test "x$ac_cv_sizeof_voidp" != "x"; then voidp_size=$ac_cv_sizeof_voidpelse AC_ERROR([Cannot determine size of void*])fidnl Checks for integer sizeAC_CHECK_SIZEOF(char, 1)AC_CHECK_SIZEOF(int, 4)AC_CHECK_SIZEOF(long, 4)AC_CHECK_SIZEOF(short, 2)AC_CHECK_SIZEOF(long double, 12)AC_CHECK_SIZEOF(long long, 8)if test "$ac_cv_sizeof_short" = "2"; then short_value=shortfiif test "$ac_cv_sizeof_int" = "4"; then int_value=intfi# 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 int64_literal='#define APR_INT64_C(val) (val)' int64_t_fmt='#define APR_INT64_T_FMT "d"' int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 1' uint64_t_fmt='#define APR_UINT64_T_FMT "u"' uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 1' uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"' int64_value="int" long_value=int int64_strfn="strtoi"elif test "$ac_cv_sizeof_long" = "8"; then int64_literal='#define APR_INT64_C(val) (val##L)' int64_t_fmt='#define APR_INT64_T_FMT "ld"' int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 2' uint64_t_fmt='#define APR_UINT64_T_FMT "lu"' uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 2' uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"' int64_value="long" long_value=long int64_strfn="strtol"elif test "$ac_cv_sizeof_long_long" = "8"; then int64_literal='#define APR_INT64_C(val) (val##LL)' # Linux, Solaris, FreeBSD all support ll with printf. # BSD 4.4 originated 'q'. Solaris is more popular and # doesn't support 'q'. Solaris wins. Exceptions can # go to the OS-dependent section. int64_t_fmt='#define APR_INT64_T_FMT "lld"' int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 3' uint64_t_fmt='#define APR_UINT64_T_FMT "llu"' uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 3' uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"' int64_value="long long" long_value="long long" int64_strfn="strtoll"elif test "$ac_cv_sizeof_long_double" = "8"; then int64_literal='#define APR_INT64_C(val) (val##LD)' int64_t_fmt='#define APR_INT64_T_FMT "Ld"' int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 2' uint64_t_fmt='#define APR_UINT64_T_FMT "Lu"' uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 2' uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "Lx"' int64_value="long double" long_value="long double" int64_strfn="strtoll"elif test "$ac_cv_sizeof_longlong" = "8"; then int64_literal='#define APR_INT64_C(val) (val##LL)' int64_t_fmt='#define APR_INT64_T_FMT "qd"' int64_t_fmt_len='#define APR_INT64_T_FMT_LEN 2' uint64_t_fmt='#define APR_UINT64_T_FMT "qu"' uint64_t_fmt_len='#define APR_UINT64_T_FMT_LEN 2' uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"' int64_value="__int64" long_value="__int64" int64_strfn="strtoll"else # int64_literal may be overriden if your compiler thinks you have # a 64-bit value but APR does not agree. int64_literal='#error Can not determine the proper size for apr_int64_t' int64_t_fmt='#error Can not determine the proper size for apr_int64_t' int64_t_fmt_len='#error Can not determine the proper size for apr_int64_t' uint64_t_fmt='#error Can not determine the proper size for apr_int64_t' uint64_t_fmt_len='#error Can not determine the proper size for apr_int64_t' uint64_t_hex_fmt='#error Can not determine the proper size for apr_uint64_t'fi# If present, allow the C99 macro INT64_C to override our conversion.## HP-UX's ANSI C compiler provides this without any includes, so we# will first look for INT64_C without adding stdint.hAC_CACHE_CHECK([for INT64_C], [apr_cv_define_INT64_C], [AC_EGREP_CPP(YES_IS_DEFINED,[#ifdef INT64_CYES_IS_DEFINED#endif], [apr_cv_define_INT64_C=yes], [ # Now check for INT64_C in stdint.h AC_EGREP_CPP(YES_IS_DEFINED, [#include <stdint.h>#ifdef INT64_CYES_IS_DEFINED#endif], [apr_cv_define_INT64_C=yes], [apr_cv_define_INT64_C=no])])])if test "$apr_cv_define_INT64_C" = "yes"; then int64_literal='#define APR_INT64_C(val) INT64_C(val)' stdint=1else stdint=0fiif test "$ac_cv_type_size_t" = "yes"; then size_t_value="size_t"else size_t_value="apr_int32_t"fiif test "$ac_cv_type_ssize_t" = "yes"; then ssize_t_value="ssize_t"else ssize_t_value="apr_int32_t"fiif test "$ac_cv_socklen_t" = "yes"; then socklen_t_value="socklen_t" case $host in *-hp-hpux*) if test "$ac_cv_sizeof_long" = "8"; then # 64-bit HP-UX requires 32-bit socklens in # kernel, but user-space declarations say # 64-bit (socklen_t == size_t == long). # This will result in many compile warnings, # but we're functionally busted otherwise. socklen_t_value="int" fi ;; esacelse socklen_t_value="int"fiAPR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then ssize_t_fmt='#define APR_SSIZE_T_FMT "d"'elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"'else ssize_t_fmt='#error Can not determine the proper size for ssize_t'fiAPR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then size_t_fmt='#define APR_SIZE_T_FMT "d"'elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then size_t_fmt='#define APR_SIZE_T_FMT "ld"'else size_t_fmt='#error Can not determine the proper size for size_t'fiif test "$ac_cv_type_off_t" = "yes"; then APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8) AC_MSG_CHECKING([which type to use for apr_off_t]) if test "${ac_cv_sizeof_off_t}${ac_cv_sizeof_long}" = "44"; then # Special case: off_t may change size with _FILE_OFFSET_BITS # on 32-bit systems with LFS support. To avoid compatibility # with other software which may export _FILE_OFFSET_BITS, # hard-code apr_off_t to long. off_t_value=long off_t_fmt='#define APR_OFF_T_FMT "ld"' else 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"' elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then off_t_fmt='#define APR_OFF_T_FMT "d"' 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' else AC_ERROR([could not determine the size of off_t]) fi fi AC_MSG_RESULT([$off_t_value])else off_t_value='apr_int32_t' off_t_fmt='#define APR_OFF_T_FMT "d"'fiAPR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then pid_t_fmt='#define APR_PID_T_FMT "hd"'elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then pid_t_fmt='#define APR_PID_T_FMT "d"'elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then pid_t_fmt='#define APR_PID_T_FMT "ld"'elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then pid_t_fmt='#define APR_PID_T_FMT APR_INT64_T_FMT'else pid_t_fmt='#error Can not determine the proper size for pid_t'fi# Basically, we have tried to figure out the correct format strings# for APR types which vary between platforms, but we don't always get # it right. If you find that we don't get it right for your platform, # you can override our decision below.case $host in *linux*) case $host in s390*) size_t_fmt='#define APR_SIZE_T_FMT "ld"' ;; esac ;; *os2_emx) size_t_fmt='#define APR_SIZE_T_FMT "lu"' ;; *-solaris*) pid_t_fmt='#define APR_PID_T_FMT "ld"' ;; *aix4*|*aix5*) ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"' size_t_fmt='#define APR_SIZE_T_FMT "ld"' ;; *beos*) ssize_t_fmt='#define APR_SSIZE_T_FMT "ld"' size_t_fmt='#define APR_SIZE_T_FMT "ld"' ;; *apple-darwin*) ssize_t_fmt='#define APR_SSIZE_T_FMT "d"' size_t_fmt='#define APR_SIZE_T_FMT "lu"' ;;esacAC_SUBST(voidp_size)AC_SUBST(short_value)AC_SUBST(int_value)AC_SUBST(long_value)AC_SUBST(int64_value)AC_SUBST(off_t_value)AC_SUBST(size_t_value)AC_SUBST(ssize_t_value)AC_SUBST(socklen_t_value)AC_SUBST(int64_t_fmt) AC_SUBST(int64_t_fmt_len) AC_SUBST(uint64_t_fmt) AC_SUBST(uint64_t_fmt_len) AC_SUBST(uint64_t_hex_fmt) AC_SUBST(ssize_t_fmt) AC_SUBST(size_t_fmt)AC_SUBST(off_t_fmt) AC_SUBST(pid_t_fmt)AC_SUBST(int64_literal) AC_SUBST(stdint) dnl ----------------------------- Checking for string functionsAC_CHECK_FUNCS(strnicmp, have_strnicmp="1", have_strnicmp="0")AC_CHECK_FUNCS(strncasecmp, have_strncasecmp="1", have_strncasecmp="0")AC_CHECK_FUNCS(stricmp, have_stricmp="1", have_stricmp="0")AC_CHECK_FUNCS(strcasecmp, have_strcasecmp="1", have_strcasecmp="0")AC_CHECK_FUNCS(strdup, have_strdup="1", have_strdup="0")AC_CHECK_FUNCS(strstr, have_strstr="1", have_strstr="0")AC_CHECK_FUNCS(memchr, have_memchr="1", have_memchr="0")AC_CHECK_FUNCS($int64_strfn, have_int64_strfn="1", have_int64_strfn="0")dnl ----------------------------- We have a fallback positionif test "$have_int64_strfn" = "0" && test "$int64_strfn" = "strtoll"; then int64_strfn="strtoq" AC_CHECK_FUNCS($int64_strfn, have_int64_strfn="1", have_int64_strfn="0")fiAC_SUBST(have_strnicmp)AC_SUBST(have_strncasecmp)AC_SUBST(have_stricmp)AC_SUBST(have_strcasecmp)AC_SUBST(have_strdup)AC_SUBST(have_strstr)AC_SUBST(have_memchr)AC_SUBST(have_int64_strfn)AC_SUBST(int64_strfn)dnl ----------------------------- Checking for DSO supportecho "${nl}Checking for DSO..."AC_ARG_ENABLE(dso, [ --disable-dso Disable DSO support ], [ tempdso=$enableval], [ AC_CHECK_FUNCS(NSLinkModule, [ tempdso="dyld" ], [ tempdso="no" ]) if test "$tempdso" = "no"; then AC_CHECK_LIB(dld, shl_load, [ tempdso="shl" APR_ADDTO(LIBS,-ldld) ], tempdso="no") fi if test "$tempdso" = "no"; then AC_CHECK_FUNCS(dlopen, [ tempdso="dlfcn" ], [ tempdso="no" ]) fi if test "$tempdso" = "no"; then AC_CHECK_LIB(dl, dlopen, [ tempdso="dlfcn" APR_ADDTO(LIBS,-ldl) ], tempdso="no") fi if test "$tempdso" = "dlfcn"; then # ReliantUnix has dlopen() in libc but dlsym() in libdl :( AC_CHECK_FUNCS(dlsym, [ tempdso="dlfcn" ], [ tempdso="no" ]) if test "$tempdso" = "no"; then AC_CHECK_LIB(dl, dlsym, [ tempdso="dlfcn" APR_ADDTO(LIBS, -ldl) ], tempdso="no") fi if test "$tempdso" = "no"; then echo "Weird: dlopen() was found but dlsym() was not found!" fi fi if test "$tempdso" = "no"; then AC_CHECK_LIB(root, load_image, tempdso="yes", tempdso="no") fi if test "$tempdso" = "no"; then case $host in *os390|*-os2*|*os400) tempdso="yes" ;; esac fi ] )if test "$tempdso" = "no"; then aprdso="0"else case "$tempdso" in dlfcn) AC_DEFINE(DSO_USE_DLFCN, 1, [Define if DSO support uses dlfcn.h]);; shl) AC_DEFINE(DSO_USE_SHL, 1, [Define if DSO support uses shl_load]);; dyld) AC_DEFINE(DSO_USE_DYLD, 1, [Define if DSO support uses dyld.h]);; esac aprdso="1" apr_modules="$apr_modules dso"fiAC_SUBST(aprdso)dnl ----------------------------- Checking for Processesecho "${nl}Checking for Processes..."AC_CHECK_FUNCS(waitpid)AC_ARG_ENABLE(other-child, [ --enable-other-child Enable reliable child processes ], [ if test "$enableval" = "yes"; then oc="1" else oc="0" fi ], [ oc=1 ] ) AC_SUBST(oc) AC_MSG_CHECKING(for Variable Length Arrays)APR_TRY_COMPILE_NO_WARNING([],[ int foo[argc]; foo[0] = 0;], vla_msg=yes, vla_msg=no )AC_MSG_RESULT([$vla_msg])if test "$vla_msg" = "yes"; then AC_DEFINE(HAVE_VLA, 1, [Define if C compiler supports VLA])fiAC_CACHE_CHECK(struct rlimit,ac_cv_struct_rlimit,[AC_TRY_RUN([#include <sys/types.h>#include <sys/time.h>#include <sys/resource.h>main(){ struct rlimit limit; limit.rlim_cur = 0; limit.rlim_max = 0; exit(0);}], [ ac_cv_struct_rlimit=yes ], [ ac_cv_struct_rlimit=no ], [ ac_cv_struct_rlimit=no ] ) ] )struct_rlimit=0test "x$ac_cv_struct_rlimit" = xyes && struct_rlimit=1AC_SUBST(struct_rlimit)dnl ----------------------------- Checking for Locking Characteristics echo "${nl}Checking for Locking..."AC_CHECK_FUNCS(semget semctl flock)AC_CHECK_HEADERS(semaphore.h)AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait)# Some systems return ENOSYS from sem_open.AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[AC_TRY_RUN([#include <errno.h>#include <stdlib.h>#include <fcntl.h>#include <semaphore.h>main(){ sem_t *psem; const char *sem_name = "/apr_autoconf"; if (sizeof(int) < sizeof(sem_t *)) exit(1); psem = sem_open(sem_name, O_CREAT, 0644, 1); if (psem == (sem_t *)SEM_FAILED) { exit(1); } sem_close(psem); sem_unlink(sem_name); exit(0);}], [ac_cv_func_sem_open=yes], [ac_cv_func_sem_open=no],[ac_cv_func_sem_open=no])])# It's stupid, but not all platforms have union semun, even those that need it.AC_MSG_CHECKING(for union semun in sys/sem.h)AC_TRY_COMPILE([#include <sys/types.h>#include <sys/ipc.h>#include <sys/sem.h>],[union semun arg;semctl(0, 0, 0, arg);], [have_union_semun="1" union_semun=yes ]msg=yes, [have_union_semun="0"msg=no ] )AC_MSG_RESULT([$msg])AC_SUBST(have_union_semun)dnl Checks for libraries.APR_CHECK_DEFINE(LOCK_EX, sys/file.h)APR_CHECK_DEFINE(F_SETLK, fcntl.h)APR_CHECK_DEFINE(SEM_UNDO, sys/sem.h)# We are assuming that if the platform doesn't have POLLIN, it doesn't have# any POLL definitions.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) # 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. # Linux and older versions of AIX have this problem. APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED func:pthread_mutexattr_setpshared, [ AC_CACHE_CHECK([for working PROCESS_SHARED locks], apr_cv_process_shared_works, [ AC_TRY_RUN([#include <sys/types.h>#include <pthread.h> int main() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -