]> granicus.if.org Git - apache/blob - configure.in
Switch to the APR-provided APR_CHARSET_EBCDIC feature test macro.
[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 APACHE_CONFIG_NICE(config.nice)
25
26 dnl If the source dir is not equal to the build dir, 
27 dnl then we are running in VPATH mode.
28
29 if test "$abs_builddir" != "$abs_srcdir"; then
30   USE_VPATH=1
31 fi
32
33 AC_CANONICAL_SYSTEM
34
35 dnl
36 dnl ## Preload our OS configuration
37 APR_PRELOAD
38 APACHE_PRELOAD
39
40 dnl
41 dnl Process command line arguments. This is done early in the process so the
42 dnl user can get feedback quickly in case of an error.
43 dnl
44 dnl ### need to move some of the arguments "up here"
45
46 dnl ## Check for programs
47
48 AC_PATH_PROG(RM, rm)
49 AC_PROG_AWK
50 AC_PROG_CC
51 AC_PROG_CPP
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54 AC_CHECK_TOOL(RANLIB, ranlib, true)
55 dnl AC_PATH_PROG(PERL_PATH, perl)
56
57 REENTRANCY_FLAGS
58
59 dnl various OS checks that apparently set required flags
60 AC_AIX
61 AC_ISC_POSIX
62 AC_MINIX
63
64 dnl ## Check for libraries
65
66 dnl ## Check for header files
67
68 dnl I think these are just used all over the place, so just check for
69 dnl them at the base of the tree. If some are specific to a single
70 dnl directory, they should be moved (Comment #Spoon)
71
72 dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
73 dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
74 dnl explicitly so that the normal HAVE_xxx_H symbol is defined.
75
76 AC_HEADER_STDC
77 AC_CHECK_HEADERS( \
78 string.h \
79 stdlib.h \
80 ctype.h \
81 limits.h \
82 unistd.h \
83 sys/time.h \
84 sys/types.h \
85 sys/socket.h \
86 netinet/in.h \
87 netinet/tcp.h \
88 arpa/inet.h \
89 netdb.h \
90 pwd.h \
91 grp.h \
92 strings.h
93 )
94 AC_HEADER_SYS_WAIT
95
96 dnl ## Check for typedefs, structures, and compiler characteristics.
97
98 AC_C_CONST
99
100 dnl ## Check for library functions
101
102 dnl See Comment #Spoon
103
104 AC_CHECK_FUNCS( \
105 initgroups \
106 )
107
108 AC_CHECK_LIB(nsl, gethostbyname)
109 AC_CHECK_LIB(nsl, gethostname)
110 AC_CHECK_LIB(socket, socket)
111 AC_CHECK_LIB(resolv, sethostent)
112
113 AC_ARG_WITH(optim,[  --with-optim="FLAGS"      compiler optimisation flags],
114         [OPTIM="$withval"])
115
116 AC_ARG_WITH(port,[  --with-port=PORT        Port on which to listen (default is 80)],
117         [PORT="$withval"],
118         [PORT=80])
119
120 AC_ARG_WITH(debug,[  --with-debug            Turn on debugging and compile time warnings],
121         [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -g -Wall"; else CFLAGS="$CFLAGS -g"; fi])
122
123 AC_ARG_WITH(maintainer-mode,[  --with-maintainer-mode   Turn on debugging and compile time warnings],
124         [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DAP_DEBUG"; else CFLAGS="$CFLAGS -g"; fi])
125
126 APACHE_ENABLE_LAYOUT
127 APACHE_ENABLE_MODULES
128 APACHE_ENABLE_SHARED
129
130 INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include"
131 if test -n "$USE_VPATH"; then
132   INCLUDES="$INCLUDES -I\$(top_builddir)/include -I\$(top_builddir)/srclib/apr/include"
133 fi
134
135 dnl reading config stubs
136 esyscmd(./build/config-stubs .)
137
138 INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
139 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
140 EXTRA_LDFLAGS="$LDFLAGS"
141 LIBS=""
142 LDFLAGS=""
143 APACHE_SUBST(progname)
144 APACHE_SUBST(EXTRA_CFLAGS)
145 APACHE_SUBST(EXTRA_LDFLAGS)
146 APACHE_SUBST(EXTRA_LIBS)
147 APACHE_SUBST(INCLUDES)
148 APACHE_SUBST(MPM_LIB)
149 APACHE_SUBST(OS)
150 APACHE_SUBST(OS_DIR)
151 APACHE_SUBST(BUILTIN_LIBS)
152 APACHE_SUBST(LIBPRE)
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 dnl ### util_xml is always included, so we always need Expat (for now)
173 apache_need_expat=yes
174
175 dnl AP_LIB_DIRS specifies the additional libs from srclib/ that we need
176 dnl AP_LIBS specifies the actual libraries. note we have some required libs.
177 AP_LIBS="srclib/pcre/libpcre.la srclib/apr-util/libaprutil.la"
178
179 if test "$apache_need_expat" = "yes"; then
180   AP_LIB_DIRS="$AP_LIB_DIRS expat-lite"
181   AP_LIBS="$AP_LIBS srclib/expat-lite/libexpat.la"
182   INCLUDES="$INCLUDES -I\$(top_srcdir)/srclib/expat-lite"
183 fi
184
185 dnl APR should go after the other libs, so the right symbols can be picked up
186 AP_LIBS="$AP_LIBS srclib/apr/\$(LIBPRE)apr.a"
187 APACHE_SUBST(AP_LIB_DIRS)
188 APACHE_SUBST(AP_LIBS)
189
190 AC_DEFINE(AP_USING_AUTOCONF, 1,
191                 [Using autoconf to configure Apache])
192
193 if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
194     AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1, 
195               [This platform doesn't suffer from the thundering herd problem])
196 fi
197
198 dnl check for endianness
199 if test "$cross_compiling" = "no"; then
200   AC_C_BIGENDIAN
201 else
202   AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,
203                 [byte order is unknown due to cross-compilation])
204 fi
205
206 APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile) 
207 APACHE_FAST_OUTPUT(os/beos/Makefile os/os2/Makefile os/Makefile)
208 APACHE_FAST_OUTPUT(os/unix/Makefile server/Makefile)
209 APACHE_FAST_OUTPUT(support/Makefile test/Makefile srclib/pcre/Makefile)
210 for i in $AP_LIB_DIRS; do
211   APACHE_FAST_OUTPUT(srclib/$i/Makefile)
212 done
213
214 dnl ## Run configure for packages Apache uses
215 dnl ## This has been placed at this location for a reason.  This allows
216 dnl ## Apache to set some variable that APR needs (like whether to enable
217 dnl ## or disable threads), while still allowing APR to run and generate
218 dnl ## APRVARS before Apache generates it's Makefiles and the related files.
219 dnl ## This allows APR to detect libraries like dl and tell Apache that it
220 dnl ## needs to include or not include them.
221 RUN_SUBDIR_CONFIG_NOW(srclib/apr, $apache_apr_flags)
222 RUN_SUBDIR_CONFIG_NOW(srclib/apr-util, "--with-apr=../apr")
223 RUN_SUBDIR_CONFIG_NOW(srclib/pcre)
224 . ./srclib/apr/APRVARS
225
226 dnl get the exported vars from APRUTIL
227 . ./srclib/apr-util/export_vars.sh
228 EXTRA_LIBS="$EXTRA_LIBS $APRUTIL_EXPORT_LIBS"
229
230 APACHE_GEN_CONFIG_VARS
231
232 dnl ## Build modules.c
233 rm -f modules.c
234 echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c
235
236 AC_OUTPUT_COMMANDS([
237 echo '/* Generated by configure */' > ${path_h}.new
238 echo "#define HTTPD_ROOT \"$prefix\"" >> ${path_h}.new
239 echo "#define SUEXEC_BIN \"$bindir/suexec\"" >> ${path_h}.new
240 echo "#define SERVER_CONFIG_FILE \"conf/$progname.conf\"" >> ${path_h}.new
241 echo "#define APACHE_MPM_DIR \"$mpmdir\"" >> ${path_h}.new
242
243 cmp ${path_h}.new ${path_h} >/dev/null 2>&1
244 if test $? -ne 0 ; then
245     rm -f ${path_h} && mv ${path_h}.new ${path_h} && \
246     echo "Updated ${path_h}"
247 else
248     rm -f ${path_h}.new && \
249     echo "${path_h} unchanged"
250 fi
251 ],[
252 path_h=./include/ap_config_path.h
253 prefix=$prefix
254 exec_prefix=$exec_prefix
255 bindir=$bindir
256 progname=$progname
257 mpmdir=$MPM_DIR
258 ])
259
260 AC_TYPE_RLIM_T
261
262 perlbin=`$srcdir/build/PrintPath perl`
263 AC_SUBST(perlbin)
264
265 dnl If we are running on BSD/OS, we need to use the BSD .include syntax.
266
267 BSD_MAKEFILE=no
268 case "$host_alias" in
269 *bsdi*)
270     BSD_MAKEFILE=yes;;
271 esac
272
273 AC_OUTPUT($APACHE_OUTPUT_FILES support/apxs support/apachectl,,[
274   APACHE_GEN_MAKEFILES
275 ])
276