]> granicus.if.org Git - apache/blob - configure.in
Oh bother. OPTIM isn't treated the same in apr and
[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 test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
35 test "$prefix" = "NONE" && prefix='/usr/local'
36
37 dnl Absolute source/build directory
38 abs_srcdir=`(cd $srcdir && pwd)`
39 abs_builddir=`pwd`
40
41 dnl If the source dir is not equal to the build dir, 
42 dnl then we are running in VPATH mode.
43
44 if test "$abs_builddir" != "$abs_srcdir"; then
45   USE_VPATH=1
46 fi
47
48 AC_CANONICAL_SYSTEM
49
50 case "$host_alias" in
51   *os2*)
52       # Use a custom made libtool replacement
53       echo "using aplibtool"
54       LIBTOOL="$abs_srcdir/srclib/apr/build/aplibtool"
55       SH_LIBTOOL="$LIBTOOL --shared --export-all"
56       CORE_IMPLIB_FILE="ApacheCoreOS2.la"
57       CORE_IMPLIB="$abs_srcdir/server/$CORE_IMPLIB_FILE"
58       MK_IMPLIB="emximp"
59       SHMOD_EXPORT_EXT="def"
60       other_targets="$other_targets os2core"
61       ;;
62   *)
63       SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool --silent'
64       ;;
65 esac
66
67 dnl
68 dnl ## Preload our OS configuration
69 APR_PRELOAD
70 APACHE_PRELOAD
71
72 dnl
73 dnl Process command line arguments. This is done early in the process so the
74 dnl user can get feedback quickly in case of an error.
75 dnl
76 dnl ### need to move some of the arguments "up here"
77
78 dnl ## Check for programs
79
80 AC_PATH_PROG(RM, rm)
81 AC_PROG_AWK
82 AC_PROG_CC
83 AC_PROG_CPP
84 AC_PROG_INSTALL
85 AC_PROG_LN_S
86 AC_CHECK_TOOL(RANLIB, ranlib, true)
87 dnl AC_PATH_PROG(PERL_PATH, perl)
88
89 #
90 # Play with CPPFLAGS given what was learned from APR_PRELOAD.
91 #
92 # XXX: APR only sets this if threads are enabled.  Either APR should be
93 # fixed to always set it (most likely), or we should test for threads.
94 #
95 if test -n "$THREAD_CPPFLAGS"; then
96     CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
97 fi
98
99 dnl various OS checks that apparently set required flags
100 AC_AIX
101 AC_ISC_POSIX
102 AC_MINIX
103
104 dnl ## Check for libraries
105
106 dnl ## Check for header files
107
108 dnl I think these are just used all over the place, so just check for
109 dnl them at the base of the tree. If some are specific to a single
110 dnl directory, they should be moved (Comment #Spoon)
111
112 dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
113 dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
114 dnl explicitly so that the normal HAVE_xxx_H symbol is defined.
115
116 AC_HEADER_STDC
117 AC_CHECK_HEADERS( \
118 string.h \
119 limits.h \
120 unistd.h \
121 sys/socket.h \
122 pwd.h \
123 grp.h \
124 strings.h
125 )
126 AC_HEADER_SYS_WAIT
127
128 dnl ## Check for typedefs, structures, and compiler characteristics.
129
130 AC_C_CONST
131
132 dnl ## Check for library functions
133
134 dnl See Comment #Spoon
135
136 AC_CHECK_FUNCS( \
137 initgroups \
138 )
139
140 AC_CHECK_LIB(nsl, gethostbyname)
141 AC_CHECK_LIB(nsl, gethostname)
142 AC_CHECK_LIB(socket, socket)
143
144 AC_ARG_WITH(optim,[  --with-optim="FLAG"       obsolete (use OPTIM environment variable)],
145         [AC_MSG_ERROR('option --with-optim is obsolete; use OPTIM environment variable instead')])
146
147 AC_ARG_WITH(port,[  --with-port=PORT        Port on which to listen (default is 80)],
148         [if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-port requires a value (the TCP port number)'); else PORT="$withval"; fi],
149         [PORT=80])
150
151 AC_ARG_ENABLE(debug,[  --enable-debug            Turn on debugging and compile time warnings],
152         [CFLAGS="$CFLAGS -g"; if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi])
153
154 AC_ARG_ENABLE(maintainer-mode,[  --enable-maintainer-mode  Turn on debugging and compile time warnings],
155         [CFLAGS="$CFLAGS -g"; if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DAP_DEBUG"; fi])
156
157 APACHE_ENABLE_LAYOUT
158 APACHE_ENABLE_MODULES
159
160 INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include"
161 if test -n "$USE_VPATH"; then
162   INCLUDES="$INCLUDES -I\$(top_builddir)/include -I\$(top_builddir)/srclib/apr/include"
163 fi
164
165 dnl reading config stubs
166 esyscmd(./build/config-stubs .)
167
168 INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
169 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
170 EXTRA_LDFLAGS="$LDFLAGS"
171 LIBS=""
172 LDFLAGS=""
173 APACHE_SUBST(progname)
174 APACHE_SUBST(EXTRA_CFLAGS)
175 APACHE_SUBST(EXTRA_LDFLAGS)
176 APACHE_SUBST(EXTRA_LIBS)
177 APACHE_SUBST(INCLUDES)
178 APACHE_SUBST(MPM_LIB)
179 APACHE_SUBST(OS)
180 APACHE_SUBST(OS_DIR)
181 APACHE_SUBST(BUILTIN_LIBS)
182
183 AM_DISABLE_SHARED
184 if test -z "$LIBTOOL"; then
185   AM_PROG_LIBTOOL
186   APACHE_LIBTOOL_SILENT
187 fi
188
189 if test "$apache_need_shared" = "yes"; then
190   $SHELL $ac_aux_dir/ltconfig --output=shlibtool --disable-static --srcdir=$ac_aux_dir --cache-file=./config.cache $ac_aux_dir/ltmain.sh
191   case $PLATFORM in
192     *-ibm-aix*)
193       HTTPD_LDFLAGS="$HTTPD_LDFLAGS -Wl,-bE:$abs_srcdir/support/httpd.exp"
194       SH_LDFLAGS="$SH_LDFLAGS -Wl,-bI:$abs_srcdir/support/httpd.exp"
195       ;;
196     *os390)
197       CFLAGS="$CFLAGS -Wc,DLL,EXPORTALL"
198       ;;
199   esac
200 fi
201
202 AC_ARG_WITH(program-name,
203 [  --with-program-name     alternate executable name],[
204   progname="$withval" ], [
205   progname="httpd"] )
206
207 # SuExec parameters
208 AC_ARG_WITH(suexec-caller,
209 [  --with-suexec-caller    User allowed to call SuExec],[
210   AC_DEFINE_UNQUOTED(AP_HTTPD_USER, "$withval", [User allowed to call SuExec] ) ] )
211
212 AC_ARG_WITH(suexec-userdir,
213 [  --with-suexec-userdir   User subdirectory],[
214   AC_DEFINE_UNQUOTED(AP_USERDIR_SUFFIX, "$withval", [User subdirectory] ) ] )
215
216 AC_ARG_WITH(suexec-docroot,
217 [  --with-suexec-docroot   SuExec root directory],[
218   AC_DEFINE_UNQUOTED(AP_DOC_ROOT, "$withval", [SuExec root directory] ) ] )
219
220 AC_ARG_WITH(suexec-uidmin,
221 [  --with-suexec-uidmin    Minimal allowed UID],[
222   AC_DEFINE_UNQUOTED(AP_UID_MIN, $withval, [Minimum allowed UID] ) ] )
223
224 AC_ARG_WITH(suexec-gidmin,
225 [  --with-suexec-gidmin    Minimal allowed GID],[
226   AC_DEFINE_UNQUOTED(AP_GID_MIN, $withval, [Minimum allowed GID] ) ] )
227
228 AC_ARG_WITH(suexec-logfile,
229 [  --with-suexec-logfile   Set the logfile],[
230   AC_DEFINE_UNQUOTED(AP_LOG_EXEC, "$withval", [SuExec log file] ) ] )
231
232 AC_ARG_WITH(suexec-safepath,
233 [  --with-suexec-safepath  Set the safepath],[
234   AC_DEFINE_UNQUOTED(AP_SAFE_PATH, "$withval", [safe shell path for SuExec] ) ] )
235
236 AC_ARG_WITH(suexec-umask,
237 [  --with-suexec-umask     umask for suexec'd process],[
238   AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] )
239
240 dnl AP_LIB_DIRS specifies the additional libs from srclib/ that we need
241 dnl AP_LIBS specifies the actual libraries. note we have some required libs.
242 AP_LIBS="srclib/pcre/libpcre.la srclib/apr-util/libaprutil.la $AP_LIBS"
243
244 dnl APR should go after the other libs, so the right symbols can be picked up
245 AP_LIBS="$AP_LIBS srclib/apr/libapr.la"
246 APACHE_SUBST(AP_LIB_DIRS)
247 APACHE_SUBST(AP_LIBS)
248
249 AC_DEFINE(AP_USING_AUTOCONF, 1,
250                 [Using autoconf to configure Apache])
251
252 if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
253     AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1, 
254               [This platform doesn't suffer from the thundering herd problem])
255 fi
256
257 dnl check for endianness
258 if test "$cross_compiling" = "no"; then
259   AC_C_BIGENDIAN
260 else
261   AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,
262                 [byte order is unknown due to cross-compilation])
263 fi
264
265 APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile) 
266 APACHE_FAST_OUTPUT(os/beos/Makefile os/os2/Makefile os/Makefile)
267 APACHE_FAST_OUTPUT(os/unix/Makefile server/Makefile)
268 APACHE_FAST_OUTPUT(support/Makefile srclib/pcre/Makefile)
269 for i in $AP_LIB_DIRS; do
270   APACHE_FAST_OUTPUT(srclib/$i/Makefile)
271 done
272
273 if test -d ./test; then
274     APACHE_FAST_OUTPUT(test/Makefile)
275 fi
276
277 dnl get the exported vars from APRUTIL
278 . ./srclib/apr-util/export_vars.sh
279 EXTRA_LIBS="$EXTRA_LIBS $APRUTIL_EXPORT_LIBS"
280 AP_LIBS="$AP_LIBS $LIBTOOL_LIBS"
281
282 APACHE_GEN_CONFIG_VARS
283
284 dnl ## Build modules.c
285 rm -f modules.c
286 echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c
287
288 AC_DEFINE_UNQUOTED(HTTPD_ROOT, "$prefix",
289         [Root directory of the Apache install area])
290 AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "conf/$progname.conf",
291         [Location of the config file, relative to the Apache root directory])
292 AC_DEFINE_UNQUOTED(APACHE_MPM_DIR, "$MPM_DIR",
293         [Location of the source for the current MPM])
294
295 perlbin=`$ac_aux_dir/PrintPath perl`
296 if test "x$perlbin" = "x"; then
297     perlbin="/replace/with/path/to/perl/interpreter"
298 fi
299 AC_SUBST(perlbin)
300
301 dnl If we are running on BSD/OS, we need to use the BSD .include syntax.
302
303 BSD_MAKEFILE=no
304 case "$host_alias" in
305 *bsdi*)
306     # Check whether they've installed GNU make
307     if make --version > /dev/null 2>&1; then
308         true
309     else
310         BSD_MAKEFILE=yes
311     fi
312     ;;
313 esac
314
315 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,,[
316   APACHE_GEN_MAKEFILES
317 ])
318