]> granicus.if.org Git - apache/blob - configure.in
Fix typo.
[apache] / configure.in
1 dnl
2 dnl Autoconf configuration for Apache httpd
3 dnl
4 dnl     Use ./buildconf to produce a configure script
5 dnl
6
7 AC_PREREQ(2.13)
8 AC_INIT(ABOUT_APACHE)
9
10 AC_CONFIG_HEADER(include/ap_config_auto.h)
11 AC_CONFIG_AUX_DIR(srclib/apr/build)
12
13 dnl #
14 dnl # Include our own M4 macros along with those for APR and libtool
15 dnl #
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)
21 sinclude(hints.m4)
22 sinclude(acinclude.m4)
23
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
29
30 dnl Generate ./config.nice for reproducing runs of configure
31 dnl
32 APR_CONFIG_NICE(config.nice)
33
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}'
40
41 dnl Absolute source/build directory
42 abs_srcdir=`(cd $srcdir && pwd)`
43 abs_builddir=`pwd`
44
45 dnl If the source dir is not equal to the build dir, 
46 dnl then we are running in VPATH mode.
47
48 if test "$abs_builddir" != "$abs_srcdir"; then
49   USE_VPATH=1
50 fi
51
52 AC_CANONICAL_SYSTEM
53
54 case "$host_alias" in
55   *os2*)
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"
62       MK_IMPLIB="emximp"
63       other_targets="$other_targets os2core"
64       ;;
65   *)
66       SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool --silent'
67       ;;
68 esac
69
70 dnl
71 dnl ## Preload our OS configuration
72 APR_PRELOAD
73 APACHE_PRELOAD
74
75 dnl
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.
78 dnl
79 dnl ### need to move some of the arguments "up here"
80
81 dnl ## Check for programs
82
83 AC_PATH_PROG(RM, rm)
84 AC_PROG_AWK
85 AC_PROG_CC
86 AC_PROG_CPP
87 AC_PROG_INSTALL
88 AC_PROG_LN_S
89 AC_CHECK_TOOL(RANLIB, ranlib, true)
90 dnl AC_PATH_PROG(PERL_PATH, perl)
91
92 #
93 # Play with CPPFLAGS given what was learned from APR_PRELOAD.
94 #
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.
97 #
98 if test -n "$THREAD_CPPFLAGS"; then
99     CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
100 fi
101
102 dnl various OS checks that apparently set required flags
103 AC_AIX
104 AC_ISC_POSIX
105 AC_MINIX
106
107 dnl ## Check for libraries
108
109 dnl ## Check for header files
110
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)
114
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.
118
119 AC_HEADER_STDC
120 AC_CHECK_HEADERS( \
121 string.h \
122 limits.h \
123 unistd.h \
124 sys/socket.h \
125 pwd.h \
126 grp.h \
127 strings.h
128 )
129 AC_HEADER_SYS_WAIT
130
131 dnl ## Check for typedefs, structures, and compiler characteristics.
132
133 AC_C_CONST
134
135 dnl ## Check for library functions
136
137 dnl See Comment #Spoon
138
139 AC_CHECK_FUNCS( \
140 initgroups \
141 )
142
143 AC_CHECK_LIB(nsl, gethostbyname)
144 AC_CHECK_LIB(nsl, gethostname)
145 AC_CHECK_LIB(socket, socket)
146
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')])
149
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],
152         [PORT=80])
153
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])
156
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])
159
160 APACHE_ENABLE_LAYOUT
161 APACHE_ENABLE_MODULES
162
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"
166 fi
167
168 dnl reading config stubs
169 esyscmd(./build/config-stubs .)
170
171 INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
172 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
173 EXTRA_LDFLAGS="$LDFLAGS"
174 LIBS=""
175 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)
182 APACHE_SUBST(OS)
183 APACHE_SUBST(OS_DIR)
184 APACHE_SUBST(BUILTIN_LIBS)
185
186 AM_DISABLE_SHARED
187 if test -z "$LIBTOOL"; then
188   AM_PROG_LIBTOOL
189   APACHE_LIBTOOL_SILENT
190 fi
191
192 PRE_SHARED_CMDS='echo ""'
193 POST_SHARED_CMDS='echo ""'
194
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
197   case $PLATFORM in
198     *-ibm-aix*)
199       HTTPD_LDFLAGS="$HTTPD_LDFLAGS -Wl,-bE:$abs_srcdir/support/httpd.exp"
200       SH_LDFLAGS="$SH_LDFLAGS -Wl,-bI:$abs_srcdir/support/httpd.exp"
201       ;;
202     *beos)
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_'
206       ;;
207     *os390)
208       CFLAGS="$CFLAGS -Wc,DLL,EXPORTALL"
209       ;;
210   esac
211   shared_build="shared-modules"
212 fi
213
214 APACHE_SUBST(PRE_SHARED_CMDS)
215 APACHE_SUBST(POST_SHARED_CMDS)
216 APACHE_SUBST(shared_build)
217
218 AC_ARG_WITH(program-name,
219 [  --with-program-name     alternate executable name],[
220   progname="$withval" ], [
221   progname="httpd"] )
222
223 # SuExec parameters
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] ) ] )
227
228 AC_ARG_WITH(suexec-userdir,
229 [  --with-suexec-userdir   User subdirectory],[
230   AC_DEFINE_UNQUOTED(AP_USERDIR_SUFFIX, "$withval", [User subdirectory] ) ] )
231
232 AC_ARG_WITH(suexec-docroot,
233 [  --with-suexec-docroot   SuExec root directory],[
234   AC_DEFINE_UNQUOTED(AP_DOC_ROOT, "$withval", [SuExec root directory] ) ] )
235
236 AC_ARG_WITH(suexec-uidmin,
237 [  --with-suexec-uidmin    Minimal allowed UID],[
238   AC_DEFINE_UNQUOTED(AP_UID_MIN, $withval, [Minimum allowed UID] ) ] )
239
240 AC_ARG_WITH(suexec-gidmin,
241 [  --with-suexec-gidmin    Minimal allowed GID],[
242   AC_DEFINE_UNQUOTED(AP_GID_MIN, $withval, [Minimum allowed GID] ) ] )
243
244 AC_ARG_WITH(suexec-logfile,
245 [  --with-suexec-logfile   Set the logfile],[
246   AC_DEFINE_UNQUOTED(AP_LOG_EXEC, "$withval", [SuExec log file] ) ] )
247
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] ) ] )
251
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] ) ] )
255
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"
259
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)
264
265 AC_DEFINE(AP_USING_AUTOCONF, 1,
266                 [Using autoconf to configure Apache])
267
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])
271 fi
272
273 dnl check for endianness
274 if test "$cross_compiling" = "no"; then
275   AC_C_BIGENDIAN
276 else
277   AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,
278                 [byte order is unknown due to cross-compilation])
279 fi
280
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)
287 done
288
289 if test -d ./test; then
290     APACHE_FAST_OUTPUT(test/Makefile)
291 fi
292
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"
297
298 APACHE_GEN_CONFIG_VARS
299
300 dnl ## Build modules.c
301 rm -f modules.c
302 echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c
303
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])
310
311 perlbin=`$ac_aux_dir/PrintPath perl`
312 if test "x$perlbin" = "x"; then
313     perlbin="/replace/with/path/to/perl/interpreter"
314 fi
315 AC_SUBST(perlbin)
316
317 dnl If we are running on BSD/OS, we need to use the BSD .include syntax.
318
319 BSD_MAKEFILE=no
320 case "$host_alias" in
321 *bsdi*)
322     # Check whether they've installed GNU make
323     if make --version > /dev/null 2>&1; then
324         true
325     else
326         BSD_MAKEFILE=yes
327     fi
328     ;;
329 esac
330
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,,[
332   APACHE_GEN_MAKEFILES
333 ])
334