]> granicus.if.org Git - apache/blob - configure.in
use helpers/PrintPath instead of which to find the location of
[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 dnl ## This is the central place where Apache's version should be kept.
7 dnl AM_INIT_AUTOMAKE(apache, 2.0-dev)
8
9 VERSION="apache-2.0-dev"
10         
11 AC_CONFIG_HEADER(include/ap_config_auto.h)
12
13 APACHE_VERSION=$VERSION
14 APACHE_SUBST(APACHE_VERSION)
15
16 test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
17 test "$prefix" = "NONE" && prefix='/usr/local'
18
19 dnl Absolute source/build directory
20 abs_srcdir=`(cd $srcdir && pwd)`
21 abs_builddir=`pwd`
22
23 APACHE_CONFIG_NICE(config.nice)
24
25 dnl If the source dir is not equal to the build dir, 
26 dnl then we are running in VPATH mode.
27
28 if test "$abs_builddir" != "$abs_srcdir"; then
29   USE_VPATH=1
30 fi
31
32 dnl ## Run configure for packages Apache uses
33 AC_CONFIG_SUBDIRS(lib/pcre lib/apr)
34
35 dnl
36 dnl ## Preload our OS configuration
37 APR_PRELOAD
38
39 dnl ## Check for programs
40
41 AC_PROG_AWK
42 AC_PROG_CC
43 AC_PROG_CPP
44 AC_PROG_INSTALL
45 dnl AC_PROG_RANLIB
46 dnl AC_PATH_PROG(PERL_PATH, perl)
47
48 REENTRANCY_FLAGS
49
50 dnl various OS checks that apparently set required flags
51 AC_AIX
52 AC_ISC_POSIX
53 AC_MINIX
54
55 dnl ## Check for libraries
56
57 dnl ## Check for header files
58
59 dnl I think these are just used all over the place, so just check for
60 dnl them at the base of the tree. If some are specific to a single
61 dnl directory, they should be moved (Comment #Spoon)
62
63 dnl Regarding standard header files: AC_HEADER_STDC doesn't set symbols
64 dnl HAVE_STRING_H, HAVE_STDLIB_H, etc., so those are checked for
65 dnl explicitly so that the normal HAVE_xxx_H symbol is defined.
66
67 AC_HEADER_STDC
68 AC_CHECK_HEADERS( \
69 string.h \
70 stdlib.h \
71 ctype.h \
72 limits.h \
73 unistd.h \
74 sys/stat.h \
75 sys/time.h \
76 sys/types.h \
77 sys/socket.h \
78 netinet/in.h \
79 netinet/tcp.h \
80 arpa/inet.h \
81 netdb.h \
82 pwd.h \
83 grp.h \
84 )
85 AC_HEADER_SYS_WAIT
86 AC_STRUCT_TM
87
88 dnl ## Check for C preprocessor symbols
89
90 AC_CHECK_DEFINE(EAGAIN, errno.h)
91
92 dnl ## Check for typedefs, structures, and compiler characteristics.
93
94 AC_C_CONST
95 AC_C_INLINE
96 AC_TYPE_PID_T
97
98 dnl ## Check for library functions
99
100 dnl See Comment #Spoon
101
102 AC_CHECK_FUNCS( \
103 strdup \
104 strcasecmp \
105 strncasecmp \
106 strstr \
107 strerror \
108 initgroups \
109 waitpid \
110 gettimeofday \
111 memmove \
112 bzero \
113 )
114
115 AC_CHECK_LIB(nsl, gethostbyname)
116 AC_CHECK_LIB(nsl, gethostname)
117 AC_CHECK_LIB(socket, socket)
118 AC_CHECK_LIB(resolv, sethostent)
119
120 AC_CHECK_FUNCS(inet_addr inet_network, break, [
121   AC_MSG_ERROR(inet_addr function not found)
122 ])
123
124 APACHE_INADDR_NONE
125
126 APACHE_EBCDIC
127
128 AC_FUNC_SELECT_ARGTYPES
129
130 dnl Check if we'll actually need to cast select args all the time
131 if test "$ac_cv_func_select_arg1" != "int" \
132         -o "$ac_cv_func_select_arg234" != "fd_set *" \
133         -o "$ac_cv_func_select_arg5" != "struct timeval *" ; then
134
135     AC_DEFINE(SELECT_NEEDS_CAST,,
136         [Define if arguments to select() aren't what we expect])
137 fi
138
139 dnl ## Checking command-line options
140 test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
141     EXTRA_CFLAGS="$EXTRA_CFLAGS -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
142 test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "y2" && \
143     EXTRA_CFLAGS="$EXTRA_CFLAGS -g -Wall -Werror -Wmissing-declarations"
144
145 APACHE_ENABLE_LAYOUT
146 APACHE_ENABLE_MODULES
147 APACHE_ENABLE_SHARED
148
149 INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/lib/apr/include"
150 if test -n "$USE_VPATH"; then
151   INCLUDES="$INCLUDES -I\$(top_builddir)/include -I\$(top_builddir)/lib/apr/include"
152 fi
153
154 dnl reading config stubs
155 esyscmd(./helpers/config-stubs .)
156
157 INCLUDES="$INCLUDES -I\$(top_srcdir)/os/\$(OS_DIR)"
158 EXTRA_LIBS="$EXTRA_LIBS $LIBS"
159 EXTRA_LDFLAGS="$LDFLAGS"
160 LIBS=""
161 LDFLAGS=""
162 APACHE_SUBST(progname)
163 APACHE_SUBST(EXTRA_CFLAGS)
164 APACHE_SUBST(EXTRA_LDFLAGS)
165 APACHE_SUBST(EXTRA_LIBS)
166 APACHE_SUBST(INCLUDES)
167 APACHE_SUBST(MPM_LIB)
168 APACHE_SUBST(OS)
169 APACHE_SUBST(OS_DIR)
170 APACHE_SUBST(BUILTIN_LIBS)
171 APACHE_SUBST(LIBPRE)
172
173 AM_DISABLE_SHARED
174 AM_PROG_LIBTOOL
175 APACHE_LIBTOOL_SILENT
176
177 if test "$apache_need_shared" = "yes"; then
178   $SHELL $srcdir/ltconfig --output=shlibtool --disable-static --srcdir=$srcdir --cache-file=./config.cache $srcdir/ltmain.sh
179 fi
180
181 AC_ARG_WITH(program-name,
182 [  --with-program-name=alternate executable name],[
183   progname="$withval" ], [
184   progname="httpd"] )
185
186 APACHE_FAST_OUTPUT(Makefile ap/Makefile lib/Makefile main/Makefile
187             modules/Makefile os/Makefile support/Makefile)
188
189 APACHE_FAST_GENERATE
190
191 dnl There needs to be a .deps file in the top build directory.
192 dnl All others are created dynamically by rules.mk.
193
194 touch .deps
195
196 dnl ## Build modules.c
197 rm -f $srcdir/modules.c
198 echo $MODLIST | $AWK -f $srcdir/helpers/build-modules-c.awk > $srcdir/modules.c
199
200 AC_OUTPUT_COMMANDS([
201 echo '/* Generated by configure */' > ${path_h}.new
202 echo "#define HTTPD_ROOT \"$prefix\"" >> ${path_h}.new
203 echo "#define SUEXEC_BIN \"$bindir/suexec\"" >> ${path_h}.new
204 echo "#define SERVER_CONFIG_FILE \"conf/$progname.conf\"" >> ${path_h}.new
205
206 cmp ${path_h}.new ${path_h} >/dev/null 2>&1
207 if test $? -ne 0 ; then
208     rm -f ${path_h} && mv ${path_h}.new ${path_h} && \
209     echo "Updated ${path_h}"
210 else
211     rm -f ${path_h}.new && \
212     echo "${path_h} unchanged"
213 fi
214 ],[
215 path_h=./include/ap_config_path.h
216 prefix=$prefix
217 exec_prefix=$exec_prefix
218 bindir=$bindir
219 progname=$progname
220 ])
221
222 perlbin=`./helpers/PrintPath perl`
223 AC_SUBST(perlbin)
224
225 AC_OUTPUT($APACHE_OUTPUT_FILES support/apxs)
226
227