summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy T. Fielding <fielding@apache.org>2001-02-17 11:15:46 +0000
committerRoy T. Fielding <fielding@apache.org>2001-02-17 11:15:46 +0000
commit9aa2ddbe854720317c048b2b565a3546a53e5d99 (patch)
tree7cf9342afd21bdd554abf65cfe8a02896ea90552
parent4aa7f0e452a0a23d335c70015bed125d72875640 (diff)
downloadapr-9aa2ddbe854720317c048b2b565a3546a53e5d99.tar.gz
Moved hints.m4, apr_common.m4, and helpers/apr-conf.m4 into the
new build directory as apr_hints.m4, apr_common.m4, apr_network.m4, and apr_threads.m4. None of the macro code has changed for this pass -- only the location. More changes to come. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61241 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--build/apr_common.m4378
-rw-r--r--build/apr_hints.m4377
-rw-r--r--build/apr_network.m4337
-rw-r--r--build/apr_threads.m4178
-rwxr-xr-xbuildconf14
-rw-r--r--configure.in2
7 files changed, 1286 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 5408f8dd2..ec074d926 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
Changes with APR b1
+ *) Moved hints.m4, apr_common.m4, and helpers/apr-conf.m4 into the
+ new build directory as apr_hints.m4, apr_common.m4, apr_network.m4,
+ and apr_threads.m4. [Roy Fielding]
+
*) Get apr_sendfile() working on HP-UX. This gets APR to build on
HP-UX without having to turn off APR_HAS_SENDFILE. [Jeff Trawick]
diff --git a/build/apr_common.m4 b/build/apr_common.m4
new file mode 100644
index 000000000..12bb83c48
--- /dev/null
+++ b/build/apr_common.m4
@@ -0,0 +1,378 @@
+dnl -----------------------------------------------------------------
+dnl apr_common.m4: APR's general-purpose autoconf macros
+dnl
+
+dnl
+dnl RUN_SUBDIR_CONFIG_NOW(dir [, sub-package-cmdline-args])
+dnl
+AC_DEFUN(RUN_SUBDIR_CONFIG_NOW, [
+ # save our work to this point; this allows the sub-package to use it
+ AC_CACHE_SAVE
+
+ echo "configuring package in $1 now"
+ ac_popdir=`pwd`
+ ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
+ apr_config_subdirs="$1"
+ test -d $1 || $MKDIR $1
+ cd $1
+
+changequote(, )dnl
+ # A "../" for each directory in /$config_subdirs.
+ ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+changequote([, ])dnl
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+
+ # The eval makes quoting arguments work.
+ if eval $ac_abs_srcdir/configure $ac_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
+ then :
+ echo "$1 configured properly"
+ else
+ echo "configure failed for $1"
+ exit 1
+ fi
+
+ cd $ac_popdir
+
+ # grab any updates from the sub-package
+ AC_CACHE_LOAD
+])
+
+
+AC_DEFUN(APR_PREPARE_MM_DIR,[
+dnl #----------------------------- Prepare mm directory for VPATH support
+if test -n "$USE_MM" && test -n "$USE_VPATH"; then
+ test -d $mm_dir || $MKDIR $mm_dir
+
+ for i in shtool config.guess config.sub fbtool ltconfig \
+ ltmain.sh mm_vers.c; do
+ test -r $mm_dir/$i || ln -s $abs_srcdir/$mm_dir/$i $mm_dir/$i
+ done
+fi
+])
+
+dnl
+dnl APR_DOEXTRA
+dnl
+dnl Handle the use of EXTRA_* variables.
+dnl Basically, EXTRA_* vars are added to the
+dnl current settings of their "parents". We
+dnl can expand as needed for additional
+dnl EXTRA_* variables by adding them to the
+dnl "for i in..." line.
+dnl
+dnl To handle recursive configures, the 1st time
+dnl through we need to null out EXTRA_* and then
+dnl export the lot of them, since we want/need
+dnl them to exist in the sub-configures' environment.
+dnl The nasty eval's allow us to use the 'for'
+dnl construct and save some lines of code.
+dnl
+AC_DEFUN(APR_DOEXTRA, [
+ for i in CFLAGS LDFLAGS LIBS
+ do
+ eval APR_TMP=\$EXTRA_$i
+ if test -n "$APR_TMP"; then
+ eval $i=\"\$$i $APR_TMP\"
+ eval export $i
+ eval unset EXTRA_${i}
+ eval export EXTRA_${i}
+ fi
+ done
+])
+
+dnl
+dnl APR_SETIFNULL(variable, value)
+dnl
+dnl Set variable iff it's currently null
+dnl
+AC_DEFUN(APR_SETIFNULL,[
+ if test -z "$$1"; then
+ echo " Setting $1 to \"$2\""
+ $1="$2"; export $1
+ fi
+])
+
+dnl
+dnl APR_SETVAR(variable, value)
+dnl
+dnl Set variable no matter what
+dnl
+AC_DEFUN(APR_SETVAR,[
+ echo " Forcing $1 to \"$2\""
+ $1="$2"; export $1
+])
+
+dnl
+dnl APR_ADDTO(variable, value)
+dnl
+dnl Add value to variable
+dnl
+AC_DEFUN(APR_ADDTO,[
+ echo " Adding \"$2\" to $1"
+ $1="$$1 $2"; export $1
+])
+
+
+define(AC_USE_FUNCTION,[dnl
+AC_CHECK_FUNCS($1)
+if test ".$ac_func_$1" = .yes; then
+AC_DEFINE(USE_$2)
+fi
+])
+
+
+AC_DEFUN(AC_CHECK_DEFINE_FILES,[
+ AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
+ ac_cv_define_$1=no
+ for curhdr in $2
+ do
+ AC_EGREP_CPP(YES_IS_DEFINED, [
+ #include <$curhdr>
+ #ifdef $1
+ YES_IS_DEFINED
+ #endif
+ ], ac_cv_define_$1=yes)
+ done
+ ])
+ if test "$ac_cv_define_$1" = "yes"; then
+ AC_DEFINE(HAVE_$1)
+ fi
+])
+
+
+AC_DEFUN(AC_CHECK_DEFINE,[
+ AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
+ AC_EGREP_CPP(YES_IS_DEFINED, [
+ #include <$2>
+ #ifdef $1
+ YES_IS_DEFINED
+ #endif
+ ], ac_cv_define_$1=yes, ac_cv_define_$1=no)
+ ])
+ if test "$ac_cv_define_$1" = "yes"; then
+ AC_DEFINE(HAVE_$1)
+ fi
+])
+
+
+define(AC_IFALLYES,[dnl
+ac_rc=yes
+for ac_spec in $1; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ $2
+else
+ :
+ $3
+fi
+])
+
+
+define(AC_BEGIN_DECISION,[dnl
+ac_decision_item='$1'
+ac_decision_msg='FAILED'
+ac_decision=''
+])
+
+
+define(AC_DECIDE,[dnl
+ac_decision='$1'
+ac_decision_msg='$2'
+ac_decision_$1=yes
+ac_decision_$1_msg='$2'
+])
+
+
+define(AC_DECISION_OVERRIDE,[dnl
+ ac_decision=''
+ for ac_item in $1; do
+ eval "ac_decision_this=\$ac_decision_${ac_item}"
+ if test ".$ac_decision_this" = .yes; then
+ ac_decision=$ac_item
+ eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
+ fi
+ done
+])
+
+
+define(AC_DECISION_FORCE,[dnl
+ac_decision="$1"
+eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\""
+])
+
+
+define(AC_END_DECISION,[dnl
+if test ".$ac_decision" = .; then
+ echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2
+ exit 1
+else
+ if test ".$ac_decision_msg" = .; then
+ ac_decision_msg="$ac_decision"
+ fi
+ AC_DEFINE_UNQUOTED(${ac_decision_item})
+ AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg])
+fi
+])
+
+dnl ### AC_TRY_RUN had some problems actually using a programs return code,
+dnl ### so I am re-working it here to be used in APR's configure script.
+dnl MY_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE
+dnl [, ACTION-IF-CROSS-COMPILING]]])
+AC_DEFUN(MY_TRY_RUN,
+[if test "$cross_compiling" = yes; then
+ ifelse([$4], ,
+ [errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling
+)dnl
+ AC_MSG_ERROR(can not run test program while cross compiling)],
+ [$4])
+else
+ MY_TRY_RUN_NATIVE([$1], [$2], [$3])
+fi
+])
+
+dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler.
+dnl MY_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
+AC_DEFUN(MY_TRY_RUN_NATIVE,
+[cat > conftest.$ac_ext <<EOF
+[#]line __oline__ "configure"
+#include "confdefs.h"
+ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
+extern "C" void exit(int);
+#endif
+])dnl
+[$1]
+EOF
+if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+dnl Don't remove the temporary files here, so they can be examined.
+ ifelse([$2], , :, [$2])
+else
+ifelse([$3], , , [ $3
+ rm -fr conftest*
+])dnl
+fi
+rm -fr conftest*])
+
+
+dnl A variant of AC_CHECK_SIZEOF which allows the checking of
+dnl sizes of non-builtin types
+dnl AC_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
+AC_DEFUN(AC_CHECK_SIZEOF_EXTENDED,
+[changequote(<<,>>)dnl
+dnl The name to #define
+define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
+dnl The cache variable
+define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *],[<p>]))dnl
+changequote([, ])dnl
+AC_MSG_CHECKING(size of $2)
+AC_CACHE_VAL(AC_CV_NAME,
+[AC_TRY_RUN([#include <stdio.h>
+$1
+main()
+{
+ FILE *f=fopen("conftestval","w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof($2));
+ exit(0);
+}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
+AC_CV_NAME=$3))])dnl
+AC_MSG_RESULT($AC_CV_NAME)
+AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
+undefine([AC_TYPE_NAME])dnl
+undefine([AC_CV_NAME])dnl
+])
+
+dnl
+dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
+dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl
+dnl Tries a compile test with warnings activated so that the result
+dnl is false if the code doesn't compile cleanly.
+dnl
+AC_DEFUN(APR_TRY_COMPILE_NO_WARNING,
+[if test "x$CFLAGS_WARN" = "x"; then
+ apr_tcnw_flags=""
+else
+ apr_tcnw_flags=$CFLAGS_WARN
+fi
+if test "$GCC" = "yes"; then
+ apr_tcnw_flags="$apr_tcnw_flags -Werror"
+fi
+changequote(', ')
+cat > conftest.$ac_ext <<EOTEST
+#include "confdefs.h"
+'$1'
+int main(int argc, const char * const argv[]) {
+'$2'
+; return 0; }
+EOTEST
+changequote([, ])
+if ${CC-cc} -c $CFLAGS $CPPFLAGS $apr_tcnw_flags conftest.$ac_ext 2>&AC_FD_CC ; then
+ ifelse([$3], , :, [rm -rf conftest*
+ $3])
+else
+ echo "configure: failed or warning program:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
+ ifelse([$4], , , [rm -rf conftest*
+ $4])
+fi
+rm -f conftest*])
+
+dnl
+dnl APR_CHECK_ICONV_INBUF
+dnl
+dnl Decide whether or not the inbuf parameter to iconv() is const.
+dnl
+dnl We try to compile something without const. If it fails to
+dnl compile, we assume that the system's iconv() has const.
+dnl Unfortunately, we won't realize when there was a compile
+dnl warning, so we allow a variable -- apr_iconv_inbuf_const -- to
+dnl be set in hints.m4 to specify whether or not iconv() has const
+dnl on this parameter.
+dnl
+AC_DEFUN(APR_CHECK_ICONV_INBUF,[
+AC_MSG_CHECKING(for type of inbuf parameter to iconv)
+if test "x$apr_iconv_inbuf_const" = "x"; then
+ APR_TRY_COMPILE_NO_WARNING([
+ #include <stddef.h>
+ #include <iconv.h>
+ ],[
+ iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0);
+ ], apr_iconv_inbuf_const="0", apr_iconv_inbuf_const="1")
+fi
+if test "$apr_iconv_inbuf_const" = "1"; then
+ AC_DEFINE(APR_ICONV_INBUF_CONST, 1, [Define if the inbuf parm to iconv() is const char **])
+ msg="const char **"
+else
+ msg="char **"
+fi
+AC_MSG_RESULT([$msg])
+])
+
diff --git a/build/apr_hints.m4 b/build/apr_hints.m4
new file mode 100644
index 000000000..89800fb61
--- /dev/null
+++ b/build/apr_hints.m4
@@ -0,0 +1,377 @@
+dnl -----------------------------------------------------------------
+dnl apr_hints.m4: APR's autoconf macros for platform-specific hints
+dnl
+dnl We preload various configure settings depending
+dnl on previously obtained platform knowledge.
+dnl We allow all settings to be overridden from
+dnl the command-line.
+dnl
+dnl We maintain the "format" that we've used
+dnl under 1.3.x, so we don't exactly follow
+dnl what is "recommended" by autoconf.
+
+dnl
+dnl APR_PRELOAD
+dnl
+dnl Preload various ENV/makefile paramsm such as CC, CFLAGS, etc
+dnl based on outside knowledge
+dnl
+dnl Generally, we force the setting of CC, and add flags
+dnl to CFLAGS, LIBS and LDFLAGS.
+dnl
+AC_DEFUN(APR_PRELOAD, [
+if test "$DID_APR_PRELOAD" = "yes" ; then
+
+ echo "APR hints file rules for $host already applied"
+
+else
+
+ DID_APR_PRELOAD="yes"; export DID_APR_PRELOAD
+
+ echo "Applying APR hints file rules for $host"
+
+ case "$host" in
+ *mint)
+ APR_ADDTO(CFLAGS, [-DMINT])
+ APR_ADDTO(LIBS, [-lportlib -lsocket])
+ ;;
+ *MPE/iX*)
+ APR_ADDTO(CFLAGS, [-DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE])
+ APR_ADDTO(LIBS, [-lsocket -lsvipc -lcurses])
+ APR_ADDTO(LDFLAGS, [-Xlinker \"-WL,cap=ia,ba,ph;nmstack=1024000\"])
+ APR_SETVAR(CAT, [/bin/cat])
+ ;;
+ *-apple-aux3*)
+ APR_SETVAR(CC, [gcc])
+ APR_ADDTO(CFLAGS, [-DAUX3 -D_POSIX_SOURCE])
+ APR_ADDTO(LIBS, [-lposix -lbsd])
+ APR_ADDTO(LDFLAGS, [-s])
+ APR_SETVAR(SHELL, [/bin/ksh])
+ ;;
+ *-ibm-aix*)
+ case $host in
+ i386-ibm-aix*)
+ APR_ADDTO(CFLAGS, [-U__STR__ -DUSEBCOPY])
+ ;;
+ *-ibm-aix[1-2].*)
+ APR_ADDTO(CFLAGS, [-DNEED_RLIM_T -U__STR__])
+ ;;
+ *-ibm-aix3.*)
+ APR_ADDTO(CFLAGS, [-DNEED_RLIM_T -U__STR__])
+ ;;
+ *-ibm-aix4.1)
+ APR_ADDTO(CFLAGS, [-DNEED_RLIM_T -U__STR__])
+ ;;
+ *-ibm-aix4.1.*)
+ APR_ADDTO(CFLAGS, [-DNEED_RLIM_T -U__STR__])
+ ;;
+ *-ibm-aix4.2)
+ APR_ADDTO(CFLAGS, [-U__STR__])
+ ;;
+ *-ibm-aix4.2.*)
+ APR_ADDTO(CFLAGS, [-U__STR__])
+ ;;
+ *-ibm-aix4.3)
+ APR_ADDTO(CFLAGS, [-D_USE_IRS -U__STR__])
+ ;;
+ *-ibm-aix4.3.*)
+ APR_ADDTO(CFLAGS, [-D_USE_IRS -U__STR__])
+ ;;
+ *-ibm-aix*)
+ APR_ADDTO(CFLAGS, [-U__STR__])
+ ;;
+ esac
+ dnl Must do a check for gcc or egcs here, to get the right options
+ dnl to the compiler.
+ AC_PROG_CC
+ if test "$GCC" != "yes"; then
+ APR_ADDTO(CFLAGS, [-qHALT=E])
+ APR_ADDTO(CFLAGS, [-qLANGLVL=extended])
+ fi
+ APR_SETIFNULL(apr_iconv_inbuf_const, [1])
+ ;;
+ *-apollo-*)
+ APR_ADDTO(CFLAGS, [-DAPOLLO])
+ ;;
+ *-dg-dgux*)
+ APR_ADDTO(CFLAGS, [-DDGUX])
+ ;;
+ *os2_emx*)
+ APR_SETVAR(SHELL, [sh])
+ ;;
+ *-hi-hiux)
+ APR_ADDTO(CFLAGS, [-DHIUX])
+ ;;
+ *-hp-hpux11.*)
+ APR_ADDTO(CFLAGS, [-DHPUX11])
+ APR_ADDTO(LIBS, [-lpthread])
+ ;;
+ *-hp-hpux10.*)
+ case $host in
+ *-hp-hpux10.01)
+dnl # We know this is a problem in 10.01.
+dnl # Not a problem in 10.20. Otherwise, who knows?
+ APR_ADDTO(CFLAGS, [-DSELECT_NEEDS_CAST])
+ ;;
+ esac
+ ;;
+ *-hp-hpux*)
+ APR_ADDTO(CFLAGS, [-DHPUX])
+ ;;
+ *-linux-*)
+ case `uname -r` in
+ 2.2* ) APR_ADDTO(CFLAGS, [-DLINUX=2])
+ ;;
+ 2.0* ) APR_ADDTO(CFLAGS, [-DLINUX=2])
+ ;;
+ 1.* ) APR_ADDTO(CFLAGS, [-DLINUX=1])
+ ;;
+ * )
+ ;;
+ esac
+ ;;
+ *-GNU*)
+ APR_ADDTO(CFLAGS, [-DHURD])
+ APR_ADDTO(LIBS, [-lcrypt])
+ ;;
+ *-lynx-lynxos)
+ APR_ADDTO(CFLAGS, [-D__NO_INCLUDE_WARN__ -DLYNXOS])
+ APR_ADDTO(LIBS, [-lbsd -lcrypt])
+ ;;
+ *486-*-bsdi*)
+ APR_ADDTO(CFLAGS, [-m486])
+ ;;
+ *-netbsd*)
+ APR_ADDTO(CFLAGS, [-DNETBSD])
+ APR_ADDTO(LIBS, [-lcrypt])
+ ;;
+ *-freebsd*)
+ case $host in
+ *freebsd[2345]*)
+ APR_ADDTO(CFLAGS, [-funsigned-char])
+ ;;
+ esac
+ APR_ADDTO(LIBS, [-lcrypt])
+ APR_SETIFNULL(enable_threads, [no])
+ ;;
+ *-next-nextstep*)
+ APR_SETIFNULL(OPTIM, [-O])
+ APR_ADDTO(CFLAGS, [-DNEXT])
+ ;;
+ *-next-openstep*)
+ APR_SETVAR(CC, [cc])
+ APR_SETIFNULL(OPTIM, [-O])
+ APR_ADDTO(CFLAGS, [-DNEXT])
+ ;;
+dnl *-apple-rhapsody*)
+dnl APR_ADDTO(CFLAGS, [-DDARWIN -DMAC_OS_X_SERVER])
+dnl ;;
+ *-apple-darwin*)
+ APR_ADDTO(CFLAGS, [-DDARWIN])
+ ;;
+ *-dec-osf*)
+ APR_ADDTO(CFLAGS, [-DOSF1])
+ ;;
+ *-qnx)
+ APR_ADDTO(CFLAGS, [-DQNX])
+ APR_ADDTO(LIBS, [-N128k -lsocket -lunix])
+ ;;
+ *-qnx32)
+ APR_SETVAR(CC, [cc -F])
+ APR_ADDTO(CFLAGS, [-DQNX -mf -3])
+ APR_ADDTO(LIBS, [-N128k -lsocket -lunix])
+ ;;
+ *-isc4*)
+ APR_SETVAR(CC, [gcc])
+ APR_ADDTO(CFLAGS, [-posix -DISC])
+ APR_ADDTO(LDFLAGS, [-posix])
+ APR_ADDTO(LIBS, [-linet])
+ ;;
+ *-sco3*)
+ APR_ADDTO(CFLAGS, [-DSCO -Oacgiltz])
+ APR_ADDTO(LIBS, [-lPW -lsocket -lmalloc -lcrypt_i])
+ ;;
+ *-sco5*)
+ APR_ADDTO(CFLAGS, [-DSCO5])
+ APR_ADDTO(LIBS, [-lsocket -lmalloc -lprot -ltinfo -lx])
+ ;;
+ *-sco_sv*|*-SCO_SV*)
+ APR_ADDTO(CFLAGS, [-DSCO])
+ APR_ADDTO(LIBS, [-lPW -lsocket -lmalloc -lcrypt_i])
+ ;;
+ *-solaris2*)
+ PLATOSVERS=`echo $host | sed 's/^.*solaris2.//'`
+ APR_ADDTO(CFLAGS, [-DSOLARIS2=$PLATOSVERS])
+ APR_ADDTO(LIBS, [-lsocket -lnsl])
+ APR_SETIFNULL(apr_iconv_inbuf_const, [1])
+ ;;
+ *-sunos4*)
+ APR_ADDTO(CFLAGS, [-DSUNOS4 -DUSEBCOPY])
+ ;;
+ *-unixware1)
+ APR_ADDTO(CFLAGS, [-DUW=100])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lcrypt])
+ ;;
+ *-unixware2)
+ APR_ADDTO(CFLAGS, [-DUW=200])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lcrypt -lgen])
+ ;;
+ *-unixware211)
+ APR_ADDTO(CFLAGS, [-DUW=211])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lcrypt -lgen])
+ ;;
+ *-unixware212)
+ APR_ADDTO(CFLAGS, [-DUW=212])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lcrypt -lgen])
+ ;;
+ *-unixware7)
+ APR_ADDTO(CFLAGS, [-DUW=700])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lcrypt -lgen])
+ ;;
+ maxion-*-sysv4*)
+ APR_ADDTO(CFLAGS, [-DSVR4])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc -lgen])
+ ;;
+ *-*-powermax*)
+ APR_ADDTO(CFLAGS, [-DSVR4])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lgen])
+ ;;
+ TPF)
+ APR_SETVAR(CC, [c89])
+ APR_ADDTO(CFLAGS, [-DTPF -D_POSIX_SOURCE])
+ ;;
+ BS2000*-siemens-sysv4*)
+ APR_SETVAR(CC, [c89 -XLLML -XLLMK -XL -Kno_integer_overflow])
+ APR_ADDTO(CFLAGS, [-DSVR4 -D_XPG_IV])
+ ;;
+ *-siemens-sysv4*)
+ APR_ADDTO(CFLAGS, [-DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNEED_UNION_SEMUN])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ pyramid-pyramid-svr4)
+ APR_ADDTO(CFLAGS, [-DSVR4 -DNO_LONG_DOUBLE])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ DS/90\ 7000-*-sysv4*)
+ APR_ADDTO(CFLAGS, [-DUXPDS])
+ APR_ADDTO(LIBS, [-lsocket -lnsl])
+ ;;
+ *-tandem-sysv4*)
+ APR_ADDTO(CFLAGS, [-DSVR4])
+ APR_ADDTO(LIBS, [-lsocket -lnsl])
+ ;;
+ *-ncr-sysv4)
+ APR_ADDTO(CFLAGS, [-DSVR4 -DMPRAS])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc -L/usr/ucblib -lucb])
+ ;;
+ *-sysv4*)
+ APR_ADDTO(CFLAGS, [-DSVR4])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ 88k-encore-sysv4)
+ APR_ADDTO(CFLAGS, [-DSVR4 -DENCORE])
+ APR_ADDTO(LIBS, [-lPW])
+ ;;
+ *-uts*)
+ PLATOSVERS=`echo $host | sed 's/^.*,//'`
+ case $PLATOSVERS in
+ 2*) APR_ADDTO(CFLAGS, [-Xa -eft -DUTS21 -DUSEBCOPY])
+ APR_ADDTO(LIBS, [-lsocket -lbsd -la])
+ ;;
+ *) APR_ADDTO(CFLAGS, [-Xa -DSVR4])
+ APR_ADDTO(LIBS, [-lsocket -lnsl])
+ ;;
+ esac
+ ;;
+ *-ultrix)
+ APR_ADDTO(CFLAGS, [-DULTRIX])
+ APR_SETVAR(SHELL, [/bin/sh5])
+ ;;
+ *powerpc-tenon-machten*)
+ APR_ADDTO(LDFLAGS, [-Xlstack=0x14000 -Xldelcsect])
+ ;;
+ *-machten*)
+ APR_ADDTO(LDFLAGS, [-stack 0x14000])
+ ;;
+ *convex-v11*)
+ APR_ADDTO(CFLAGS, [-ext -DCONVEXOS11])
+ APR_SETIFNULL(OPTIM, [-O1])
+ APR_SETVAR(CC, [cc])
+ ;;
+ i860-intel-osf1)
+ APR_ADDTO(CFLAGS, [-DPARAGON])
+ ;;
+ *-sequent-ptx2.*.*)
+ APR_ADDTO(CFLAGS, [-DSEQUENT=20 -Wc,-pw])
+ APR_ADDTO(LIBS, [-lsocket -linet -lnsl -lc -lseq])
+ ;;
+ *-sequent-ptx4.0.*)
+ APR_ADDTO(CFLAGS, [-DSEQUENT=40 -Wc,-pw])
+ APR_ADDTO(LIBS, [-lsocket -linet -lnsl -lc])
+ ;;
+ *-sequent-ptx4.[123].*)
+ APR_ADDTO(CFLAGS, [-DSEQUENT=41 -Wc,-pw])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ *-sequent-ptx4.4.*)
+ APR_ADDTO(CFLAGS, [-DSEQUENT=44 -Wc,-pw])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ *-sequent-ptx4.5.*)
+ APR_ADDTO(CFLAGS, [-DSEQUENT=45 -Wc,-pw])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ *-sequent-ptx5.0.*)
+ APR_ADDTO(CFLAGS, [-DSEQUENT=50 -Wc,-pw])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc])
+ ;;
+ *NEWS-OS*)
+ APR_ADDTO(CFLAGS, [-DNEWSOS])
+ ;;
+ *-riscix)
+ APR_ADDTO(CFLAGS, [-DRISCIX])
+ APR_SETIFNULL(OPTIM, [-O])
+ APR_SETIFNULL(MAKE, [make])
+ ;;
+ *beos*)
+ APR_ADDTO(CFLAGS, [-DBEOS])
+ PLATOSVERS=`uname -r`
+ case $PLATOSVERS in
+ 5.1)
+ APR_ADDTO(CPPFLAGS, [-I/boot/develop/headers/bone])
+ APR_ADDTO(LDFLAGS, [-nodefaultlibs -L/boot/develop/lib/x86 -L/boot/beos/system/lib])
+ APR_ADDTO(EXTRA_LIBS, [-lbind -lsocket -lbe -lroot])
+ ;;
+ esac
+ ;;
+ 4850-*.*)
+ APR_ADDTO(CFLAGS, [-DSVR4 -DMPRAS])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc -L/usr/ucblib -lucb])
+ ;;
+ drs6000*)
+ APR_ADDTO(CFLAGS, [-DSVR4])
+ APR_ADDTO(LIBS, [-lsocket -lnsl -lc -L/usr/ucblib -lucb])
+ ;;
+ m88k-*-CX/SX|CYBER)
+ APR_ADDTO(CFLAGS, [-D_CX_SX -Xa])
+ APR_SETVAR(CC, [cc])
+ ;;
+ *-tandem-oss)
+ APR_ADDTO(CFLAGS, [-D_TANDEM_SOURCE -D_XOPEN_SOURCE_EXTENDED=1])
+ APR_SETVAR(CC, [c89])
+ ;;
+ *-ibm-os390)
+ APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
+ APR_SETIFNULL(apr_process_lock_is_global, [yes])
+ APR_SETIFNULL(CC, [cc])
+ APR_ADDTO(CFLAGS, [-U_NO_PROTO])
+ APR_ADDTO(CFLAGS, [-DPTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR])
+ APR_ADDTO(CFLAGS, [-DPTHREAD_SETS_ERRNO])
+ APR_ADDTO(CFLAGS, [-DPTHREAD_DETACH_ARG1_ADDR])
+ APR_ADDTO(CFLAGS, [-DSIGPROCMASK_SETS_THREAD_MASK])
+ APR_ADDTO(CFLAGS, [-DTCP_NODELAY=1])
+ ;;
+ esac
+ APR_DOEXTRA
+fi
+])
diff --git a/build/apr_network.m4 b/build/apr_network.m4
new file mode 100644
index 000000000..a1a3b6d22
--- /dev/null
+++ b/build/apr_network.m4
@@ -0,0 +1,337 @@
+dnl -----------------------------------------------------------------
+dnl apr_network.m4: APR's autoconf macros for testing network support
+dnl
+
+dnl
+dnl check for working getaddrinfo()
+dnl
+AC_DEFUN(APR_CHECK_WORKING_GETADDRINFO,[
+ AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
+ AC_TRY_RUN( [
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+void main(void) {
+ struct addrinfo hints, *ai;
+ int error;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
+ if (error) {
+ exit(1);
+ }
+ else {
+ exit(0);
+ }
+}
+],[
+ ac_cv_working_getaddrinfo="yes"
+],[
+ ac_cv_working_getaddrinfo="no"
+],[
+ ac_cv_working_getaddrinfo="yes"
+])])
+if test "$ac_cv_working_getaddrinfo" = "yes"; then
+ AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works well enough for APR])
+fi
+])
+
+dnl
+dnl check for gethostbyname() which handles numeric address strings
+dnl
+AC_DEFUN(APR_CHECK_GETHOSTBYNAME_NAS,[
+ AC_CACHE_CHECK(for gethostbyname() which handles numeric address strings, ac_cv_gethostbyname_nas,[
+ AC_TRY_RUN( [
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+void main(void) {
+ struct hostent *he = gethostbyname("127.0.0.1");
+ if (he == NULL) {
+ exit(1);
+ }
+ else {
+ exit(0);
+ }
+}
+],[
+ ac_cv_gethostbyname_nas="yes"
+],[
+ ac_cv_gethostbyname_nas="no"
+],[
+ ac_cv_gethostbyname_nas="yes"
+])])
+if test "$ac_cv_gethostbyname_nas" = "yes"; then
+ AC_DEFINE(GETHOSTBYNAME_HANDLES_NAS, 1, [Define if gethostbyname() handles nnn.nnn.nnn.nnn])
+fi
+])
+
+dnl
+dnl check for socklen_t, fall back to unsigned int
+dnl
+AC_DEFUN(APR_CHECK_SOCKLEN_T,[
+AC_CACHE_CHECK(for socklen_t, ac_cv_socklen_t,[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+],[
+socklen_t foo = (socklen_t) 0;
+],[
+ ac_cv_socklen_t=yes
+],[
+ ac_cv_socklen_t=no
+])
+])
+
+if test "$ac_cv_socklen_t" = "yes"; then
+ AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
+fi
+])
+
+
+
+AC_DEFUN(APR_CHECK_INET_ADDR,[
+AC_CACHE_CHECK(for inet_addr, ac_cv_func_inet_addr,[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+],[
+inet_addr("127.0.0.1");
+],[
+ ac_cv_func_inet_addr=yes
+],[
+ ac_cv_func_inet_addr=no
+])
+])
+
+if test "$ac_cv_func_inet_addr" = "yes"; then
+ have_inet_addr=1
+else
+ have_inet_addr=0
+fi
+])
+
+
+AC_DEFUN(APR_CHECK_INET_NETWORK,[
+AC_CACHE_CHECK(for inet_network, ac_cv_func_inet_network,[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+],[
+inet_network("127.0.0.1");
+],[
+ ac_cv_func_inet_network=yes
+],[
+ ac_cv_func_inet_network=no
+])
+])
+
+if test "$ac_cv_func_inet_network" = "yes"; then
+ have_inet_network=1
+else
+ have_inet_network=0
+fi
+])
+
+
+AC_DEFUN(APR_CHECK_SOCKADDR_IN6,[
+AC_CACHE_CHECK(for sockaddr_in6, ac_cv_define_sockaddr_in6,[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+],[
+struct sockaddr_in6 sa;
+],[
+ ac_cv_define_sockaddr_in6=yes
+],[
+ ac_cv_define_sockaddr_in6=no
+])
+])
+
+if test "$ac_cv_define_sockaddr_in6" = "yes"; then
+ have_sockaddr_in6=1
+else
+ have_sockaddr_in6=0
+fi
+])
+
+dnl
+dnl Check to see if this platform includes sa_len in it's
+dnl struct sockaddr. If it does it changes the length of sa_family
+dnl which could cause us problems
+dnl
+AC_DEFUN(APR_CHECK_SOCKADDR_SA_LEN,[
+AC_CACHE_CHECK(for sockaddr sa_len, ac_cv_define_sockaddr_sa_len,[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+],[
+struct sockaddr_in sai;
+int i = sai.sin_len;
+],[
+ ac_cv_define_sockaddr_sa_len=yes
+],[
+ ac_cv_define_sockaddr_sa_len=no
+])
+])
+
+if test "$ac_cv_define_sockaddr_sa_len" = "yes"; then
+ AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1 ,[Define if we have length field in sockaddr_in])
+fi
+])
+
+
+dnl
+dnl APR_INADDR_NONE
+dnl
+dnl checks for missing INADDR_NONE macro
+dnl
+AC_DEFUN(APR_INADDR_NONE,[
+ AC_CACHE_CHECK(whether system defines INADDR_NONE, ac_cv_inaddr_none,[
+ AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+],[
+unsigned long foo = INADDR_NONE;
+],[
+ ac_cv_inaddr_none=yes
+],[
+ ac_cv_inaddr_none=no
+])])
+ if test "$ac_cv_inaddr_none" = "no"; then
+ apr_inaddr_none="((unsigned int) 0xffffffff)"
+ else
+ apr_inaddr_none="INADDR_NONE"
+ fi
+])
+
+
+dnl
+dnl APR_CHECK_H_ERRNO_FLAG
+dnl
+dnl checks which flags are necessary for <netdb.h> to define h_errno
+dnl
+AC_DEFUN(APR_H_ERRNO_COMPILE_CHECK,[
+ if test x$1 != x; then
+ CFLAGS="-D$1 $CFLAGS"
+ fi
+ AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+],[
+int h_e = h_errno;
+],[
+ if test x$1 != x; then
+ ac_cv_h_errno_cflags="$1"
+ else
+ ac_cv_h_errno_cflags=yes
+ fi
+],[
+ ac_cv_h_errno_cflags=no
+])])
+AC_DEFUN(APR_CHECK_H_ERRNO_FLAG,[
+ AC_MSG_CHECKING([for h_errno in netdb.h])
+ AC_CACHE_VAL(ac_cv_h_errno_cflags,[
+ APR_H_ERRNO_COMPILE_CHECK
+ if test "$ac_cv_h_errno_cflags" = "no"; then
+ ac_save="$CFLAGS"
+ for flag in _XOPEN_SOURCE_EXTENDED; do
+ APR_H_ERRNO_COMPILE_CHECK($flag)
+ if test "$ac_cv_h_errno_cflags" != "no"; then
+ break
+ fi
+ done
+ CFLAGS="$ac_save"
+ fi
+ ])
+ if test "$ac_cv_h_errno_cflags" != "no"; then
+ if test "$ac_cv_h_errno_cflags" != "yes"; then
+ CFLAGS="-D$ac_cv_h_errno_cflags $CFLAGS"
+ AC_MSG_RESULT([yes, with -D$ac_cv_h_errno_cflags])
+ else
+ AC_MSG_RESULT([$ac_cv_h_errno_cflags])
+ fi
+ else
+ AC_MSG_RESULT([$ac_cv_h_errno_cflags])
+ fi
+])
+
+
+AC_DEFUN(APR_EBCDIC,[
+ AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
+ AC_TRY_RUN( [
+int main(void) {
+ return (unsigned char)'A' != (unsigned char)0xC1;
+}
+],[
+ ac_cv_ebcdic="yes"
+],[
+ ac_cv_ebcdic="no"
+],[
+ ac_cv_ebcdic="no"
+])])
+ if test "$ac_cv_ebcdic" = "yes"; then
+ apr_charset_ebcdic=1
+ else
+ apr_charset_ebcdic=0
+ fi
+ AC_SUBST(apr_charset_ebcdic)
+])
diff --git a/build/apr_threads.m4 b/build/apr_threads.m4
new file mode 100644
index 000000000..c1c6074bf
--- /dev/null
+++ b/build/apr_threads.m4
@@ -0,0 +1,178 @@
+dnl -----------------------------------------------------------------
+dnl apr_threads.m4: APR's autoconf macros for testing thread support
+dnl
+
+dnl
+dnl REENTRANCY_FLAGS
+dnl
+dnl Set some magic defines
+dnl
+AC_DEFUN(REENTRANCY_FLAGS,[
+ if test -z "$host_alias"; then
+ host_alias=`$ac_config_guess`
+ fi
+ case "$host_alias" in
+ *solaris*)
+ PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
+ *freebsd*)
+ PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
+ *openbsd*)
+ PTHREAD_FLAGS="-D_POSIX_THREADS";;
+ *linux*)
+ PTHREAD_FLAGS="-D_REENTRANT";;
+ *aix*)
+ PTHREAD_FLAGS="-D_THREAD_SAFE";;
+ *irix*)
+ PTHREAD_FLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS";;
+ *hpux*)
+ PTHREAD_FLAGS="-D_REENTRANT";;
+ *sco*)
+ PTHREAD_FLAGS="-D_REENTRANT";;
+dnl Solves sigwait() problem, creates problems with u_long etc.
+dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
+ esac
+
+ if test -n "$PTHREAD_FLAGS"; then
+ CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
+ THREAD_CPPFLAGS="$THREAD_CPPFLAGS $PTHREAD_FLAGS"
+ fi
+])dnl
+
+dnl gcc issues warnings when parsing AIX 4.3.3's pthread.h
+dnl which causes autoconf to incorrectly conclude that
+dnl pthreads is not available.
+dnl Turn off warnings if we're using gcc.
+AC_DEFUN(CHECK_PTHREADS_H, [
+ if test "$GCC" = "yes"; then
+ SAVE_FL="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -w"
+ AC_CHECK_HEADERS(pthread.h, [ $1 ] , [ $2 ] )
+ CPPFLAGS="$SAVE_FL"
+ else
+ AC_CHECK_HEADERS(pthread.h, [ $1 ] , [ $2 ] )
+ fi
+])dnl
+
+AC_DEFUN(APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS, [
+AC_CACHE_CHECK(whether pthread_getspecific takes two arguments, ac_cv_pthread_getspecific_two_args,[
+AC_TRY_COMPILE([
+#include <pthread.h>
+],[
+pthread_key_t key;
+void *tmp;
+pthread_getspecific(key,&tmp);
+],[
+ ac_cv_pthread_getspecific_two_args=yes
+],[
+ ac_cv_pthread_getspecific_two_args=no
+])
+])
+
+if test "$ac_cv_pthread_getspecific_two_args" = "yes"; then
+ AC_DEFINE(PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS, 1, [Define if pthread_getspecific() has two args])
+fi
+
+])dnl
+
+AC_DEFUN(APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG, [
+AC_CACHE_CHECK(whether pthread_attr_getdetachstate takes one argument, ac_cv_pthread_attr_getdetachstate_one_arg,[
+AC_TRY_COMPILE([
+#include <pthread.h>
+],[
+pthread_attr_t *attr;
+pthread_attr_getdetachstate(attr);
+],[
+ ac_cv_pthread_attr_getdetachstate_one_arg=yes
+],[
+ ac_cv_pthread_attr_getdetachstate_one_arg=no
+])
+])
+
+if test "$ac_cv_pthread_attr_getdetachstate_one_arg" = "yes"; then
+ AC_DEFINE(PTHREAD_ATTR_GETDETACHSTATE_TAKES_ONE_ARG, 1, [Define if pthread_attr_getdetachstate() has one arg])
+fi
+
+])dnl
+dnl
+dnl PTHREADS_CHECK_COMPILE
+dnl
+dnl Check whether the current setup can use POSIX threads calls
+dnl
+AC_DEFUN(PTHREADS_CHECK_COMPILE, [
+AC_TRY_RUN( [
+#include <pthread.h>
+#include <stddef.h>
+
+void *thread_routine(void *data) {
+ return data;
+}
+
+int main() {
+ pthread_t thd;
+ pthread_mutexattr_t mattr;
+ int data = 1;
+ pthread_mutexattr_init(&mattr);
+ return pthread_create(&thd, NULL, thread_routine, &data);
+} ], [
+ pthreads_working="yes"
+ ], [
+ pthreads_working="no"
+ ], pthreads_working="no" ) ] )dnl
+dnl
+dnl PTHREADS_CHECK()
+dnl
+dnl Try to find a way to enable POSIX threads
+dnl
+AC_DEFUN(PTHREADS_CHECK,[
+if test -n "$ac_cv_pthreads_lib"; then
+ LIBS="$LIBS -l$ac_cv_pthreads_lib"
+fi
+
+if test -n "$ac_cv_pthreads_cflags"; then
+ CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
+ THREAD_CFLAGS="$THREAD_CFLAGS $ac_cv_pthreads_cflags"
+fi
+
+PTHREADS_CHECK_COMPILE
+
+AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
+ac_cv_pthreads_cflags=""
+if test "$pthreads_working" != "yes"; then
+ for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt; do
+ ac_save="$CFLAGS"
+ CFLAGS="$CFLAGS $flag"
+ PTHREADS_CHECK_COMPILE
+ if test "$pthreads_working" = "yes"; then
+ ac_cv_pthreads_cflags="$flag"
+ dnl this was already added to CFLAGS; add to THREAD_CFLAGS, too
+ THREAD_CFLAGS="$THREAD_CFLAGS $ac_cv_pthreads_cflags"
+ break
+ fi
+ CFLAGS="$ac_save"
+ done
+fi
+])
+
+AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
+ac_cv_pthreads_lib=""
+if test "$pthreads_working" != "yes"; then
+ for lib in pthread pthreads c_r; do
+ ac_save="$LIBS"
+ LIBS="$LIBS -l$lib"
+ PTHREADS_CHECK_COMPILE
+ if test "$pthreads_working" = "yes"; then
+ ac_cv_pthreads_lib="$lib"
+ break
+ fi
+ LIBS="$ac_save"
+ done
+fi
+])
+
+if test "$pthreads_working" = "yes"; then
+ threads_result="POSIX Threads found"
+else
+ threads_result="POSIX Threads not found"
+fi
+])dnl
+
diff --git a/buildconf b/buildconf
index a3bda267d..5442a7f52 100755
--- a/buildconf
+++ b/buildconf
@@ -7,9 +7,17 @@ libtoolize=`helpers/PrintPath glibtoolize libtoolize`
ltpath=`dirname $libtoolize`
ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
echo "Incorporating $ltfile into aclocal.m4 ..."
-echo "dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf" > aclocal.m4
-echo "dnl edits here will be lost" >> aclocal.m4
-cat helpers/apr-conf.m4 apr_common.m4 hints.m4 $ltfile >> aclocal.m4
+cat > aclocal.m4 <<EOF
+dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf
+dnl Edits here will be lost
+
+sinclude(build/apr_common.m4)
+sinclude(build/apr_network.m4)
+sinclude(build/apr_threads.m4)
+sinclude(build/apr_hints.m4)
+
+EOF
+cat $ltfile >> aclocal.m4
#
# Create the libtool helper files
diff --git a/configure.in b/configure.in
index a66240a1f..84bf41b0e 100644
--- a/configure.in
+++ b/configure.in
@@ -3,7 +3,7 @@ dnl ## Autoconf configuration file for APR
dnl ##
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(apr_common.m4)
+AC_INIT(build/apr_common.m4)
AC_CONFIG_HEADER(include/arch/unix/apr_private.h)
AC_CONFIG_AUX_DIR(helpers)