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