1 dnl Autoconf file for Serf
6 AC_CONFIG_AUX_DIR(build)
8 sinclude(build/apr_common.m4)
9 sinclude(build/find_apr.m4)
10 sinclude(build/find_apu.m4)
12 AC_PREFIX_DEFAULT(/usr/local/serf)
14 dnl Get the layout here, so we can pass the required variables to apr
15 APR_ENABLE_LAYOUT(Serf, [])
17 dnl reparse the configure arguments.
20 APR_CONFIG_NICE(config.nice)
24 dnl Check that mkdir -p works
25 APR_MKDIR_P_CHECK($top_srcdir/build/mkdir.sh)
28 dnl ## Run configure for packages Apache uses
30 dnl shared library support for these packages doesn't currently
31 dnl work on some platforms
37 echo $ac_n "${nl}Configuring Apache Portable Runtime library...${nl}"
39 APR_FIND_APR("$srcdir/apr", "./apr", 1, [0 1])
41 if test "$apr_found" = "no"; then
42 AC_MSG_ERROR([APR not found. Please read the documentation.])
45 if test "$apr_found" = "reconfig"; then
46 APR_SUBDIR_CONFIG(apr,
47 [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir],
48 [--enable-layout=*|\'--enable-layout=*])
49 dnl We must be the first to build and the last to be cleaned
50 SERF_BUILD_SRCLIB_DIRS="apr $SERF_BUILD_SRCLIB_DIRS"
51 SERF_CLEAN_SRCLIB_DIRS="$SERF_CLEAN_SRCLIB_DIRS apr"
54 APR_SETIFNULL(CC, `$apr_config --cc`)
55 APR_SETIFNULL(CPP, `$apr_config --cpp`)
56 APR_SETIFNULL(APR_LIBTOOL, `$apr_config --apr-libtool`)
57 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
58 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
59 APR_ADDTO(LDFLAGS, `$apr_config --ldflags`)
60 SHLIBPATH_VAR=`$apr_config --shlib-path-var`
61 APR_BINDIR=`$apr_config --bindir`
62 APR_INCLUDEDIR=`$apr_config --includedir`
63 APR_VERSION=`$apr_config --version`
64 APR_CONFIG="$apr_config"
68 AC_SUBST(APR_INCLUDEDIR)
72 echo $ac_n "${nl}Configuring Apache Portable Runtime Utility library...${nl}"
74 APR_FIND_APU("$srcdir/apr-util", "./apr-util", 1, [0 1])
76 if test "$apu_found" = "no"; then
77 AC_MSG_ERROR([APR-util not found. Please read the documentation.])
80 # Catch some misconfigurations:
81 case ${apr_found}.${apu_found} in
83 AC_MSG_ERROR([Cannot use an external APR-util with the bundled APR])
86 AC_MSG_ERROR([Cannot use an external APR with the bundled APR-util])
90 if test "$apu_found" = "reconfig"; then
91 APR_SUBDIR_CONFIG(apr-util,
92 [--with-apr=../apr --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir],
93 [--enable-layout=*|\'--enable-layout=*])
94 dnl We must be the last to build and the first to be cleaned
95 SERF_BUILD_SRCLIB_DIRS="$SERF_BUILD_SRCLIB_DIRS apr-util"
96 SERF_CLEAN_SRCLIB_DIRS="apr-util $SERF_CLEAN_SRCLIB_DIRS"
99 APR_ADDTO(LDFLAGS, `$apu_config --ldflags`)
100 APU_BINDIR=`$apu_config --bindir`
101 APU_INCLUDEDIR=`$apu_config --includedir`
102 APU_VERSION=`$apu_config --version`
103 APU_CONFIG="$APU_BINDIR/apu-`echo ${APU_VERSION} | sed 's,\..*,,'`-config"
106 AC_SUBST(APU_INCLUDEDIR)
107 AC_SUBST(APU_VERSION)
110 dnl In case we picked up CC and CPP from APR, get that info into the
111 dnl config cache so that PCRE uses it. Otherwise, CC and CPP used for
112 dnl PCRE and for our config tests will be whatever PCRE determines.
117 if test "x${cache_file}" = "x/dev/null"; then
118 # Likewise, ensure that CC and CPP are passed through to the pcre
119 # configure script iff caching is disabled (the autoconf 2.5x default).
120 export CC; export CPP
123 echo $ac_n "Configuring Serf...${nl}"
125 dnl Absolute source/build directory
126 abs_srcdir=`(cd $srcdir && pwd)`
129 dnl get our version information
130 get_version="$abs_srcdir/build/get-version.sh"
131 version_hdr="$abs_srcdir/serf.h"
132 SERF_MAJOR_VERSION="`$get_version major $version_hdr SERF`"
133 SERF_DOTTED_VERSION="`$get_version all $version_hdr SERF`"
135 AC_SUBST(SERF_MAJOR_VERSION)
136 AC_SUBST(SERF_DOTTED_VERSION)
138 AC_SUBST(SERF_BUILD_SRCLIB_DIRS)
139 AC_SUBST(SERF_CLEAN_SRCLIB_DIRS)
142 APR_HELP_STRING([--with-openssl=PATH],[Path to OpenSSL (eg. /usr/local/ssl)]),
144 if test "$withval" = "yes"; then
145 AC_MSG_ERROR([--with-openssl requires a path])
147 openssl_prefix=$withval
149 if test "x$openssl_prefix" != "x" -a ! -d "$openssl_prefix"; then
150 AC_MSG_ERROR('--with-openssl requires a path to a directory')
153 APR_ADDTO(CPPFLAGS, "-I${openssl_prefix}/include")
154 APR_ADDTO(LDFLAGS, "-L${openssl_prefix}/lib")
155 APR_ADDTO(LDFLAGS, "-R${openssl_prefix}/lib")
160 AC_CHECK_HEADER([openssl/opensslv.h], [],
161 [AC_MSG_ERROR([We require OpenSSL; try --with-openssl])])
163 libs="`$apu_config --link-libtool --libs` `$apr_config --link-libtool --libs`"
164 APR_ADDTO(SERF_LIBS, [$libs])
167 AC_CONFIG_FILES([Makefile])
168 AC_CONFIG_COMMANDS([mkdir-vpath],[make mkdir-vpath])