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 other_targets="$other_targets os2core"
66 SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool --silent'
71 dnl ## Preload our OS configuration
76 dnl Process command line arguments. This is done early in the process so the
77 dnl user can get feedback quickly in case of an error.
79 dnl ### need to move some of the arguments "up here"
81 dnl ## Check for programs
89 AC_CHECK_TOOL(RANLIB, ranlib, true)
90 dnl AC_PATH_PROG(PERL_PATH, perl)
93 # Play with CPPFLAGS given what was learned from APR_PRELOAD.
95 # XXX: APR only sets this if threads are enabled. Either APR should be
96 # fixed to always set it (most likely), or we should test for threads.
98 if test -n "$THREAD_CPPFLAGS"; then
99 CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
102 dnl various OS checks that apparently set required flags
107 dnl ## Check for libraries
109 dnl ## Check for header files
111 dnl I think these are just used all over the place, so just check for
112 dnl them at the base of the tree. If some are specific to a single
113 dnl directory, they should be moved (Comment #Spoon)
115 dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
116 dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
117 dnl explicitly so that the normal HAVE_xxx_H symbol is defined.
131 dnl ## Check for typedefs, structures, and compiler characteristics.
135 dnl ## Check for library functions
137 dnl See Comment #Spoon
143 AC_CHECK_LIB(nsl, gethostbyname)
144 AC_CHECK_LIB(nsl, gethostname)
145 AC_CHECK_LIB(socket, socket)
147 AC_ARG_WITH(optim,[ --with-optim="FLAG" obsolete (use OPTIM environment variable)],
148 [AC_MSG_ERROR('option --with-optim is obsolete; use OPTIM environment variable instead')])
150 AC_ARG_WITH(port,[ --with-port=PORT Port on which to listen (default is 80)],
151 [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-port requires a value (the TCP port number)'); else PORT="$withval"; fi],
154 AC_ARG_ENABLE(debug,[ --enable-debug Turn on debugging and compile time warnings],
155 [CFLAGS="$CFLAGS -g"; if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi])
157 AC_ARG_ENABLE(maintainer-mode,[ --enable-maintainer-mode Turn on debugging and compile time warnings],
158 [CFLAGS="$CFLAGS -g"; if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DAP_DEBUG"; fi])
161 APACHE_ENABLE_MODULES
163 INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include"
164 if test -n "$USE_VPATH"; then
165 INCLUDES="$INCLUDES -I\$(top_builddir)/include -I\$(top_builddir)/srclib/apr/include"
168 dnl reading config stubs
169 esyscmd(./build/config-stubs .)
171 INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
172 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
173 EXTRA_LDFLAGS="$LDFLAGS"
176 APACHE_SUBST(progname)
177 APACHE_SUBST(EXTRA_CFLAGS)
178 APACHE_SUBST(EXTRA_LDFLAGS)
179 APACHE_SUBST(EXTRA_LIBS)
180 APACHE_SUBST(INCLUDES)
181 APACHE_SUBST(MPM_LIB)
184 APACHE_SUBST(BUILTIN_LIBS)
187 if test -z "$LIBTOOL"; then
189 APACHE_LIBTOOL_SILENT
192 PRE_SHARED_CMDS='echo ""'
193 POST_SHARED_CMDS='echo ""'
195 if test "$apache_need_shared" = "yes"; then
196 $SHELL $ac_aux_dir/ltconfig --output=shlibtool --disable-static --srcdir=$ac_aux_dir --cache-file=./config.cache $ac_aux_dir/ltmain.sh
199 HTTPD_LDFLAGS="$HTTPD_LDFLAGS -Wl,-bE:$abs_srcdir/support/httpd.exp"
200 SH_LDFLAGS="$SH_LDFLAGS -Wl,-bI:$abs_srcdir/support/httpd.exp"
203 SH_LDFLAGS='$(top_builddir)/_APP_'
204 PRE_SHARED_CMDS='ln -s $(top_builddir)/httpd $(top_builddir)/_APP_'
205 POST_SHARED_CMDS='rm $(top_builddir)/_APP_'
208 CFLAGS="$CFLAGS -Wc,DLL,EXPORTALL"
211 shared_build="shared-modules"
214 APACHE_SUBST(PRE_SHARED_CMDS)
215 APACHE_SUBST(POST_SHARED_CMDS)
216 APACHE_SUBST(shared_build)
218 AC_ARG_WITH(program-name,
219 [ --with-program-name alternate executable name],[
220 progname="$withval" ], [
224 AC_ARG_WITH(suexec-caller,
225 [ --with-suexec-caller User allowed to call SuExec],[
226 AC_DEFINE_UNQUOTED(AP_HTTPD_USER, "$withval", [User allowed to call SuExec] ) ] )
228 AC_ARG_WITH(suexec-userdir,
229 [ --with-suexec-userdir User subdirectory],[
230 AC_DEFINE_UNQUOTED(AP_USERDIR_SUFFIX, "$withval", [User subdirectory] ) ] )
232 AC_ARG_WITH(suexec-docroot,
233 [ --with-suexec-docroot SuExec root directory],[
234 AC_DEFINE_UNQUOTED(AP_DOC_ROOT, "$withval", [SuExec root directory] ) ] )
236 AC_ARG_WITH(suexec-uidmin,
237 [ --with-suexec-uidmin Minimal allowed UID],[
238 AC_DEFINE_UNQUOTED(AP_UID_MIN, $withval, [Minimum allowed UID] ) ] )
240 AC_ARG_WITH(suexec-gidmin,
241 [ --with-suexec-gidmin Minimal allowed GID],[
242 AC_DEFINE_UNQUOTED(AP_GID_MIN, $withval, [Minimum allowed GID] ) ] )
244 AC_ARG_WITH(suexec-logfile,
245 [ --with-suexec-logfile Set the logfile],[
246 AC_DEFINE_UNQUOTED(AP_LOG_EXEC, "$withval", [SuExec log file] ) ] )
248 AC_ARG_WITH(suexec-safepath,
249 [ --with-suexec-safepath Set the safepath],[
250 AC_DEFINE_UNQUOTED(AP_SAFE_PATH, "$withval", [safe shell path for SuExec] ) ] )
252 AC_ARG_WITH(suexec-umask,
253 [ --with-suexec-umask umask for suexec'd process],[
254 AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] )
256 dnl AP_LIB_DIRS specifies the additional libs from srclib/ that we need
257 dnl AP_LIBS specifies the actual libraries. note we have some required libs.
258 AP_LIBS="srclib/pcre/libpcre.la srclib/apr-util/libaprutil.la $AP_LIBS"
260 dnl APR should go after the other libs, so the right symbols can be picked up
261 AP_LIBS="$AP_LIBS srclib/apr/libapr.la"
262 APACHE_SUBST(AP_LIB_DIRS)
263 APACHE_SUBST(AP_LIBS)
265 AC_DEFINE(AP_USING_AUTOCONF, 1,
266 [Using autoconf to configure Apache])
268 if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
269 AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1,
270 [This platform doesn't suffer from the thundering herd problem])
273 dnl check for endianness
274 if test "$cross_compiling" = "no"; then
277 AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,
278 [byte order is unknown due to cross-compilation])
281 APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile)
282 APACHE_FAST_OUTPUT(os/beos/Makefile os/os2/Makefile os/Makefile)
283 APACHE_FAST_OUTPUT(os/unix/Makefile server/Makefile)
284 APACHE_FAST_OUTPUT(support/Makefile srclib/pcre/Makefile)
285 for i in $AP_LIB_DIRS; do
286 APACHE_FAST_OUTPUT(srclib/$i/Makefile)
289 if test -d ./test; then
290 APACHE_FAST_OUTPUT(test/Makefile)
293 dnl get the exported vars from APRUTIL
294 . ./srclib/apr-util/export_vars.sh
295 EXTRA_LIBS="$EXTRA_LIBS $APRUTIL_EXPORT_LIBS"
296 AP_LIBS="$AP_LIBS $LIBTOOL_LIBS"
298 APACHE_GEN_CONFIG_VARS
300 dnl ## Build modules.c
302 echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c
304 AC_DEFINE_UNQUOTED(HTTPD_ROOT, "$prefix",
305 [Root directory of the Apache install area])
306 AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "conf/$progname.conf",
307 [Location of the config file, relative to the Apache root directory])
308 AC_DEFINE_UNQUOTED(APACHE_MPM_DIR, "$MPM_DIR",
309 [Location of the source for the current MPM])
311 perlbin=`$ac_aux_dir/PrintPath perl`
312 if test "x$perlbin" = "x"; then
313 perlbin="/replace/with/path/to/perl/interpreter"
317 dnl If we are running on BSD/OS, we need to use the BSD .include syntax.
320 case "$host_alias" in
322 # Check whether they've installed GNU make
323 if make --version > /dev/null 2>&1; then
331 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,,[