summaryrefslogtreecommitdiff
path: root/configure.in
blob: f9410ee084d62631e2bc1ac0d2d4be4ba75aeedc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
dnl ## Process this file with autoconf to produce a configure script

AC_PREREQ(2.13)
AC_INIT(acinclude.m4)

AC_CONFIG_HEADER(include/ap_config_auto.h)
AC_CONFIG_AUX_DIR(.)
 
dnl ## This is the central place where Apache's version should be kept.
dnl AM_INIT_AUTOMAKE(apache, 2.0-dev)

VERSION="apache-2.0-dev"
	
APACHE_VERSION=$VERSION
APACHE_SUBST(APACHE_VERSION)

test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
test "$prefix" = "NONE" && prefix='/usr/local'

dnl Absolute source/build directory
abs_srcdir=`(cd $srcdir && pwd)`
abs_builddir=`pwd`

APACHE_CONFIG_NICE(config.nice)

dnl If the source dir is not equal to the build dir, 
dnl then we are running in VPATH mode.

if test "$abs_builddir" != "$abs_srcdir"; then
  USE_VPATH=1
fi

AC_CANONICAL_SYSTEM

dnl
dnl ## Preload our OS configuration
APR_PRELOAD
APACHE_PRELOAD

dnl
dnl Process command line arguments. This is done early in the process so the
dnl user can get feedback quickly in case of an error.
dnl
dnl ### need to move some of the arguments "up here"

dnl ## Check for programs

AC_PATH_PROG(RM, rm)
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_CHECK_TOOL(RANLIB, ranlib, true)
dnl AC_PATH_PROG(PERL_PATH, perl)

REENTRANCY_FLAGS

dnl various OS checks that apparently set required flags
AC_AIX
AC_ISC_POSIX
AC_MINIX

dnl ## Check for libraries

dnl ## Check for header files

dnl I think these are just used all over the place, so just check for
dnl them at the base of the tree. If some are specific to a single
dnl directory, they should be moved (Comment #Spoon)

dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
dnl explicitly so that the normal HAVE_xxx_H symbol is defined.

AC_HEADER_STDC
AC_CHECK_HEADERS( \
string.h \
stdlib.h \
ctype.h \
limits.h \
unistd.h \
sys/time.h \
sys/types.h \
sys/socket.h \
netinet/in.h \
netinet/tcp.h \
arpa/inet.h \
netdb.h \
pwd.h \
grp.h \
strings.h
)
AC_HEADER_SYS_WAIT

dnl ## Check for typedefs, structures, and compiler characteristics.

AC_C_CONST

dnl ## Check for library functions

dnl See Comment #Spoon

AC_CHECK_FUNCS( \
initgroups \
)

AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(nsl, gethostname)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(resolv, sethostent)

APACHE_EBCDIC

AC_ARG_WITH(optim,[  --with-optim="FLAGS"      compiler optimisation flags],
        [OPTIM="$withval"])

AC_ARG_WITH(port,[  --with-port=PORT        Port on which to listen (default is 80)],
        [PORT="$withval"],
	[PORT=80])

AC_ARG_WITH(debug,[  --with-debug            Turn on debugging and compile time warnings],
        [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -g -Wall"; else CFLAGS="$CFLAGS -g"; fi])

AC_ARG_WITH(maintainer-mode,[  --with-maintainer-mode   Turn on debugging and compile time warnings],
        [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DAP_DEBUG"; else CFLAGS="$CFLAGS -g"; fi])

APACHE_ENABLE_LAYOUT
APACHE_ENABLE_MODULES
APACHE_ENABLE_SHARED

INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include"
if test -n "$USE_VPATH"; then
  INCLUDES="$INCLUDES -I\$(top_builddir)/include -I\$(top_builddir)/srclib/apr/include"
fi

dnl reading config stubs
esyscmd(./build/config-stubs .)

INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
EXTRA_LIBS="$EXTRA_LIBS $LIBS"
EXTRA_LDFLAGS="$LDFLAGS"
LIBS=""
LDFLAGS=""
APACHE_SUBST(progname)
APACHE_SUBST(EXTRA_CFLAGS)
APACHE_SUBST(EXTRA_LDFLAGS)
APACHE_SUBST(EXTRA_LIBS)
APACHE_SUBST(INCLUDES)
APACHE_SUBST(MPM_LIB)
APACHE_SUBST(OS)
APACHE_SUBST(OS_DIR)
APACHE_SUBST(BUILTIN_LIBS)
APACHE_SUBST(LIBPRE)

AM_DISABLE_SHARED
AM_PROG_LIBTOOL
APACHE_LIBTOOL_SILENT

if test "$apache_need_shared" = "yes"; then
  $SHELL $srcdir/ltconfig --output=shlibtool --disable-static --srcdir=$srcdir --cache-file=./config.cache $srcdir/ltmain.sh
  case $PLATFORM in
    *os390)
      CFLAGS="$CFLAGS -Wc,DLL,EXPORTALL"
      ;;
  esac
fi

AC_ARG_WITH(program-name,
[  --with-program-name=alternate executable name],[
  progname="$withval" ], [
  progname="httpd"] )

dnl ### util_xml is always included, so we always need Expat (for now)
apache_need_expat=yes

dnl AP_LIB_DIRS specifies the additional libs from srclib/ that we need
dnl AP_LIBS specifies the actual libraries. note we have some required libs.
AP_LIBS="srclib/pcre/libpcre.la srclib/apr-util/libaprutil.la"

if test "$apache_need_expat" = "yes"; then
  AP_LIB_DIRS="$AP_LIB_DIRS expat-lite"
  AP_LIBS="$AP_LIBS srclib/expat-lite/libexpat.la"
  INCLUDES="$INCLUDES -I\$(top_srcdir)/srclib/expat-lite"
fi

dnl APR should go after the other libs, so the right symbols can be picked up
AP_LIBS="$AP_LIBS srclib/apr/\$(LIBPRE)apr.a"
APACHE_SUBST(AP_LIB_DIRS)
APACHE_SUBST(AP_LIBS)

AC_DEFINE(AP_USING_AUTOCONF, 1,
		[Using autoconf to configure Apache])

if test "$SINGLE_LISTEN_UNSERIALIZED_ACCEPT" = "1"; then
    AC_DEFINE(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, 1, 
              [This platform doesn't suffer from the thundering herd problem])
fi

dnl check for endianness
if test "$cross_compiling" = "no"; then
  AC_C_BIGENDIAN
else
  AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,
		[byte order is unknown due to cross-compilation])
fi

APACHE_FAST_OUTPUT(Makefile modules/Makefile srclib/Makefile) 
APACHE_FAST_OUTPUT(os/beos/Makefile os/os2/Makefile os/Makefile)
APACHE_FAST_OUTPUT(os/unix/Makefile server/Makefile)
APACHE_FAST_OUTPUT(support/Makefile test/Makefile srclib/pcre/Makefile)
for i in $AP_LIB_DIRS; do
  APACHE_FAST_OUTPUT(srclib/$i/Makefile)
done

dnl ## Run configure for packages Apache uses
dnl ## This has been placed at this location for a reason.  This allows
dnl ## Apache to set some variable that APR needs (like whether to enable
dnl ## or disable threads), while still allowing APR to run and generate
dnl ## APRVARS before Apache generates it's Makefiles and the related files.
dnl ## This allows APR to detect libraries like dl and tell Apache that it
dnl ## needs to include or not include them.
RUN_SUBDIR_CONFIG_NOW(srclib/apr, $apache_apr_flags)
RUN_SUBDIR_CONFIG_NOW(srclib/apr-util, "--with-apr=../apr")
RUN_SUBDIR_CONFIG_NOW(srclib/pcre)
. ./srclib/apr/APRVARS

dnl get the exported vars from APRUTIL
. ./srclib/apr-util/export_vars.sh
EXTRA_LIBS="$EXTRA_LIBS $APRUTIL_EXPORT_LIBS"

APACHE_GEN_CONFIG_VARS

dnl ## Build modules.c
rm -f modules.c
echo $MODLIST | $AWK -f $srcdir/build/build-modules-c.awk > modules.c

AC_OUTPUT_COMMANDS([
echo '/* Generated by configure */' > ${path_h}.new
echo "#define HTTPD_ROOT \"$prefix\"" >> ${path_h}.new
echo "#define SUEXEC_BIN \"$bindir/suexec\"" >> ${path_h}.new
echo "#define SERVER_CONFIG_FILE \"conf/$progname.conf\"" >> ${path_h}.new
echo "#define APACHE_MPM_DIR \"$mpmdir\"" >> ${path_h}.new

cmp ${path_h}.new ${path_h} >/dev/null 2>&1
if test $? -ne 0 ; then
    rm -f ${path_h} && mv ${path_h}.new ${path_h} && \
    echo "Updated ${path_h}"
else
    rm -f ${path_h}.new && \
    echo "${path_h} unchanged"
fi
],[
path_h=./include/ap_config_path.h
prefix=$prefix
exec_prefix=$exec_prefix
bindir=$bindir
progname=$progname
mpmdir=$MPM_DIR
])

AC_TYPE_RLIM_T

perlbin=`$srcdir/build/PrintPath perl`
AC_SUBST(perlbin)

dnl If we are running on BSD/OS, we need to use the BSD .include syntax.

BSD_MAKEFILE=no
case "$host_alias" in
*bsdi*)
    BSD_MAKEFILE=yes;;
esac

AC_OUTPUT($APACHE_OUTPUT_FILES support/apxs support/apachectl,,[
  APACHE_GEN_MAKEFILES
])