2 dnl Autoconf configuration for Apache httpd
4 dnl Use ./buildconf to produce a configure script
10 AC_CONFIG_HEADER(include/ap_config_auto.h)
11 AC_CONFIG_AUX_DIR(srclib/apr/build)
14 dnl # Include our own M4 macros along with those for APR and libtool
16 sinclude(srclib/apr/build/apr_common.m4)
17 sinclude(srclib/apr/build/apr_network.m4)
18 sinclude(srclib/apr/build/apr_threads.m4)
19 sinclude(srclib/apr/build/apr_hints.m4)
20 sinclude(srclib/apr/build/libtool.m4)
22 sinclude(acinclude.m4)
24 dnl ## Run configure for packages Apache uses
25 APR_SUBDIR_CONFIG(srclib/apr, "$apache_apr_flags --disable-shared")
26 APR_SUBDIR_CONFIG(srclib/apr-util, "--with-apr=../apr --disable-shared")
27 APR_SUBDIR_CONFIG(srclib/pcre)
28 . ./srclib/apr/APRVARS
30 dnl Generate ./config.nice for reproducing runs of configure
32 APR_CONFIG_NICE(config.nice)
34 dnl XXX we can't just use AC_PREFIX_DEFAULT because that isn't subbed in
35 dnl by configure until it is too late. Is that how it should be or not?
36 dnl Something seems broken here.
37 AC_PREFIX_DEFAULT(/usr/local/apache2)
38 test "$prefix" = "NONE" && prefix='/usr/local/apache2'
39 test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
41 dnl Absolute source/build directory
42 abs_srcdir=`(cd $srcdir && pwd)`
45 dnl If the source dir is not equal to the build dir,
46 dnl then we are running in VPATH mode.
48 if test "$abs_builddir" != "$abs_srcdir"; then
56 # Use a custom made libtool replacement
57 echo "using aplibtool"
58 LIBTOOL="$abs_srcdir/srclib/apr/build/aplibtool"
59 SH_LIBTOOL="$LIBTOOL --shared --export-all"
60 CORE_IMPLIB_FILE="ApacheCoreOS2.la"
61 CORE_IMPLIB="$abs_srcdir/server/$CORE_IMPLIB_FILE"
63 SHMOD_EXPORT_EXT="def"
64 other_targets="$other_targets os2core"
67 SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool --silent'
72 dnl ## Preload our OS configuration
77 dnl Process command line arguments. This is done early in the process so the
78 dnl user can get feedback quickly in case of an error.
80 dnl ### need to move some of the arguments "up here"
82 dnl ## Check for programs
90 AC_CHECK_TOOL(RANLIB, ranlib, true)
91 dnl AC_PATH_PROG(PERL_PATH, perl)
94 # Play with CPPFLAGS given what was learned from APR_PRELOAD.
96 # XXX: APR only sets this if threads are enabled. Either APR should be
97 # fixed to always set it (most likely), or we should test for threads.
99 if test -n "$THREAD_CPPFLAGS"; then
100 CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
103 dnl various OS checks that apparently set required flags
108 dnl ## Check for libraries
110 dnl ## Check for header files
112 dnl I think these are just used all over the place, so just check for
113 dnl them at the base of the tree. If some are specific to a single
114 dnl directory, they should be moved (Comment #Spoon)
116 dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
117 dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
118 dnl explicitly so that the normal HAVE_xxx_H symbol is defined.
132 dnl ## Check for typedefs, structures, and compiler characteristics.
136 dnl ## Check for library functions
138 dnl See Comment #Spoon
144 AC_CHECK_LIB(nsl, gethostbyname)
145 AC_CHECK_LIB(nsl, gethostname)
146 AC_CHECK_LIB(socket, socket)
148 AC_ARG_WITH(optim,[ --with-optim="FLAG" obsolete (use OPTIM environment variable)],
149 [AC_MSG_ERROR('option --with-optim is obsolete; use OPTIM environment variable instead')])
151 AC_ARG_WITH(port,[ --with-port=PORT Port on which to listen (default is 80)],
152 [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-port requires a value (the TCP port number)'); else PORT="$withval"; fi],
155 AC_ARG_ENABLE(debug,[ --enable-debug Turn on debugging and compile time warnings],
156 [CFLAGS="$CFLAGS -g"; if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi])
158 AC_ARG_ENABLE(maintainer-mode,[ --enable-maintainer-mode Turn on debugging and compile time warnings],
159 [CFLAGS="$CFLAGS -g"; if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DAP_DEBUG"; fi])
162 APACHE_ENABLE_MODULES
164 INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include"
165 if test -n "$USE_VPATH"; then
166 INCLUDES="$INCLUDES -I\$(top_builddir)/include -I\$(top_builddir)/srclib/apr/include"
169 dnl reading config stubs
170 esyscmd(./build/config-stubs .)
172 INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
173 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
174 EXTRA_LDFLAGS="$LDFLAGS"
177 APACHE_SUBST(progname)
178 APACHE_SUBST(EXTRA_CFLAGS)
179 APACHE_SUBST(EXTRA_LDFLAGS)
180 APACHE_SUBST(EXTRA_LIBS)
181 APACHE_SUBST(INCLUDES)
182 APACHE_SUBST(MPM_LIB)
185 APACHE_SUBST(BUILTIN_LIBS)
188 if test -z "$LIBTOOL"; then
190 APACHE_LIBTOOL_SILENT
193 if test "$apache_need_shared" = "yes"; then
194 $SHELL $ac_aux_dir/ltconfig --output=shlibtool --disable-static --srcdir=$ac_aux_dir --cache-file=./config.cache $ac_aux_dir/ltmain.sh
197 HTTPD_LDFLAGS="$HTTPD_LDFLAGS -Wl,-bE:$abs_srcdir/support/httpd.exp"
198 SH_LDFLAGS="$SH_LDFLAGS -Wl,-bI:$abs_srcdir/support/httpd.exp"
201 CFLAGS="$CFLAGS -Wc,DLL,EXPORTALL"
206 AC_ARG_WITH(program-name,
207 [ --with-program-name alternate executable name],[
208 progname="$withval" ], [
212 AC_ARG_WITH(suexec-caller,
213 [ --with-suexec-caller User allowed to call SuExec],[
214 AC_DEFINE_UNQUOTED(AP_HTTPD_USER, "$withval", [User allowed to call SuExec] ) ] )
216 AC_ARG_WITH(suexec-userdir,
217 [ --with-suexec-userdir User subdirectory],[
218 AC_DEFINE_UNQUOTED(AP_USERDIR_SUFFIX, "$withval", [User subdirectory] ) ] )
220 AC_ARG_WITH(suexec-docroot,
221 [ --with-suexec-docroot SuExec root directory],[
222 AC_DEFINE_UNQUOTED(AP_DOC_ROOT, "$withval", [SuExec root directory] ) ] )
224 AC_ARG_WITH(suexec-uidmin,
225 [ --with-suexec-uidmin Minimal allowed UID],[
226 AC_DEFINE_UNQUOTED(AP_UID_MIN, $withval, [Minimum allowed UID] ) ] )
228 AC_ARG_WITH(suexec-gidmin,
229 [ --with-suexec-gidmin Minimal allowed GID],[
230 AC_DEFINE_UNQUOTED(AP_GID_MIN, $withval, [Minimum allowed GID] ) ] )
232 AC_ARG_WITH(suexec-logfile,
233 [ --with-suexec-logfile Set the logfile],[
234 AC_DEFINE_UNQUOTED(AP_LOG_EXEC, "$withval", [SuExec log file] ) ] )
236 AC_ARG_WITH(suexec-safepath,
237 [ --with-suexec-safepath Set the safepath],[
238 AC_DEFINE_UNQUOTED(AP_SAFE_PATH, "$withval", [safe shell path for SuExec] ) ] )
240 AC_ARG_WITH(suexec-umask,
241 [ --with-suexec-umask umask for suexec'd process],[
242 AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] )
244 dnl AP_LIB_DIRS specifies the additional libs from srclib/ that we need
245 dnl AP_LIBS specifies the actual libraries. note we have some required libs.
246 AP_LIBS="srclib/pcre/libpcre.la srclib/apr-util/libaprutil.la $AP_LIBS"
248 dnl APR should go after the other libs, so the right symbols can be picked up
249 AP_LIBS="$AP_LIBS srclib/apr/libapr.la"
250 APACHE_SUBST(AP_LIB_DIRS)
251 APACHE_SUBST(AP_LIBS)
253 AC_DEFINE(AP_USING_AUTOCONF, 1,
254 [Using autoconf to configure Apache])
256 if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
257 AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1,
258 [This platform doesn't suffer from the thundering herd problem])
261 dnl check for endianness
262 if test "$cross_compiling" = "no"; then
265 AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,
266 [byte order is unknown due to cross-compilation])
269 APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile)
270 APACHE_FAST_OUTPUT(os/beos/Makefile os/os2/Makefile os/Makefile)
271 APACHE_FAST_OUTPUT(os/unix/Makefile server/Makefile)
272 APACHE_FAST_OUTPUT(support/Makefile srclib/pcre/Makefile)
273 for i in $AP_LIB_DIRS; do
274 APACHE_FAST_OUTPUT(srclib/$i/Makefile)
277 if test -d ./test; then
278 APACHE_FAST_OUTPUT(test/Makefile)
281 dnl get the exported vars from APRUTIL
282 . ./srclib/apr-util/export_vars.sh
283 EXTRA_LIBS="$EXTRA_LIBS $APRUTIL_EXPORT_LIBS"
284 AP_LIBS="$AP_LIBS $LIBTOOL_LIBS"
286 APACHE_GEN_CONFIG_VARS
288 dnl ## Build modules.c
290 echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c
292 AC_DEFINE_UNQUOTED(HTTPD_ROOT, "$prefix",
293 [Root directory of the Apache install area])
294 AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "conf/$progname.conf",
295 [Location of the config file, relative to the Apache root directory])
296 AC_DEFINE_UNQUOTED(APACHE_MPM_DIR, "$MPM_DIR",
297 [Location of the source for the current MPM])
299 perlbin=`$ac_aux_dir/PrintPath perl`
300 if test "x$perlbin" = "x"; then
301 perlbin="/replace/with/path/to/perl/interpreter"
305 dnl If we are running on BSD/OS, we need to use the BSD .include syntax.
308 case "$host_alias" in
310 # Check whether they've installed GNU make
311 if make --version > /dev/null 2>&1; then
319 AC_OUTPUT($APACHE_OUTPUT_FILES support/apxs support/apachectl support/dbmmanage support/log_server_status support/logresolve.pl support/phf_abuse_log.cgi support/split-logfile,,[