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