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