3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
19 # buildconf: Build the support scripts needed to compile from a
20 # checked-out version of the source code.
22 # version check for AC_PROG_CC_C99
23 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'`
25 # versions older than 2.50 are denied by AC_PREREQ
27 echo WARNING: You are using an outdated version of autoconf.
28 echo WARNING: This may lead to less than optimal performance of httpd.
29 echo WARNING: You should use autoconf 2.60 or newer.
34 # set a couple of defaults for where we should be looking for our support libs.
35 # can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
37 apr_src_dir="srclib/apr ../apr"
44 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
59 buildconf: generates the files needed to configure httpd.
64 -h, --help display this help and exit
66 --with-apr=SRCDIR define a space-separated list of directories to
67 search for the APR source code. If, instead of a
68 directory, an apr-config executable name is passed,
69 APR-Config Mode is enabled (see below). Defaults to
71 --with-apr-util=SRCDIR define a space-separated list of directories to
72 search for the APR-util source code. Defaults to the
73 same location as the --with-apr SRCDIR, but with
74 "apr" replaced with "apr-util" or "aprutil". Ignored
79 When passing an apr-config executable to --with-apr, buildconf will attempt to
80 copy build scripts from various installed locations on your system instead of
81 an APR source tree. This allows you to configure httpd from source without
82 also requiring you to download the APR and/or APR-util sources.
86 ./buildconf --with-apr=apr-1-config
88 For this functionality to work reliably, you must have automake >= 1.12 and be
89 using a distribution that includes both find_apr.m4 and find_apu.m4 in the
90 --installbuilddir pointed to by apr-config.
92 Environment variables used by buildconf:
93 AUTOCONF autoconf executable name [autoconf]
94 AUTOMAKE automake executable name [automake]
95 AUTOHEADER autoheader executable name [autoheader]
101 echo "unknown option $1 (try --help for usage)"
110 # Check to be sure that we have the srclib dependencies checked-out, or that a
111 # working apr-config installation has been specified.
115 apr_config= # path to apr-config (empty if using a source directory)
120 for dir in $apr_src_dir
122 if [ -f "${dir}/build/apr_common.m4" ]; then
123 echo "found apr source: ${dir}"
127 elif which "${dir}" >/dev/null 2>&1; then
128 # We're using apr-config. Do a sanity check.
129 apr_config=`which "${dir}"`
130 echo "testing apr-config executable: ${apr_config}"
132 version=`"${apr_config}" --version`
133 version=`echo "${version}" | sed -n '/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/p'`
135 if [ -z "${version}" ]; then
136 echo "apr-config gave us an invalid --version"
141 echo "using apr-config version ${version}"
142 apr_major_version=${version} # we'll make a real "major version" later
143 apr_src_dir=`"${apr_config}" --installbuilddir`
149 if [ $apr_found -lt 1 ]; then
151 echo "APR could not be found automatically."
153 echo "Please refer to the documentation on APR in the httpd INSTALL file."
156 elif [ -n "${apr_config}" ]; then
157 apr_major_version=`echo "${apr_major_version}" | sed 's/\..*//'`
159 apr_major_version=`grep "#define APR_MAJOR_VERSION" \
160 $apr_src_dir/include/apr_version.h | sed 's/[^0-9]//g'`
163 # Find APR-util. Note: if we're using apr-config, we can completely skip this,
164 # even if APR is version 1. That's because we only end up caring about
165 # find_apu.m4, which is not actually installed in the standard APR-util
166 # distribution to begin with.
167 if [ -z "${apr_config}" -a $apr_major_version -lt 2 ] ; then
168 if test -z "$apu_src_dir"; then
169 apu_src_dir=`echo $apr_src_dir | sed -e 's#/apr#/apr-util#g;'`
170 apu_src_dir="$apu_src_dir `echo $apr_src_dir | sed -e 's#/apr#/aprutil#;g'`"
171 apu_src_dir="$apu_src_dir srclib/apr-util ../apr-util"
174 for dir in $apu_src_dir
176 if [ -f "${dir}/Makefile.in" ]; then
177 echo "found apr-util source: ${dir}"
184 if [ $apu_found -lt 1 ]; then
186 echo "You are using APR 1.x but APR-util 1.x was not found."
188 echo "Please refer to the documentation on APR in the httpd INSTALL file."
194 if [ $should_exit -gt 0 ]; then
198 # These are temporary until Roy finishes the other build changes
202 rm -f generated_lists
204 # Remove autoconf 2.5x cache directories
205 rm -rf autom4te*.cache
209 ./build/bsd_makefile;;
212 # end temporary stuff
214 apr_configure="$apr_src_dir/configure"
215 if [ $apr_major_version -lt 2 ] ; then
216 aprutil_configure="$apu_src_dir/configure"
218 config_h_in="include/ap_config_auto.h.in"
220 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
222 if [ "$apr_src_dir" = "srclib/apr" ]; then
223 echo rebuilding $apr_configure
224 (cd srclib/apr && ./buildconf) || {
225 echo "./buildconf failed for apr"
228 rm -f srclib/apr/apr.spec
231 apr_src_dir=`cd $apr_src_dir && pwd`
233 if [ $apr_major_version -lt 2 ] ; then
234 if [ "$apu_src_dir" = "srclib/apr-util" ]; then
235 echo rebuilding $aprutil_configure
236 (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || {
237 echo "./buildconf failed for apr-util"
240 rm -f srclib/apr-util/apr-util.spec
243 apu_src_dir=`cd $apu_src_dir && pwd`
246 echo copying build files
247 if [ -n "${apr_config}" ]; then
248 # If we're using apr-config, we switch things up a little bit:
249 # - use automake's config.* scripts instead of APR's
250 # - use the included PrintPath instead of copying from APR
251 # - assume find_apu.m4 is also in APR's --installbuilddir
253 # Figure out where to copy config.* from.
254 automake=${AUTOMAKE:-automake}
255 am_libdir=`"${automake}" --print-libdir`
256 cp "${am_libdir}/config.guess" "${am_libdir}/config.sub" build
258 # Remember that in this case, $apr_src_dir points to the build directory.
259 cp "$apr_src_dir/apr_common.m4" "$apr_src_dir/find_apr.m4" build
260 if [ $apr_major_version -lt 2 ] ; then
261 cp "$apr_src_dir/find_apu.m4" build
264 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
265 $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
266 $apr_src_dir/build/find_apr.m4 build
267 if [ $apr_major_version -lt 2 ] ; then
268 cp $apu_src_dir/build/find_apu.m4 build
272 # Remove any libtool files so one can switch between libtool 1.3
273 # and libtool 1.4 by simply rerunning the buildconf script.
274 (cd build ; rm -f ltconfig ltmain.sh)
276 if [ -z "${apr_config}" ]; then
277 # Optionally copy libtool-1.3.x files
278 if [ -f $apr_src_dir/build/ltconfig ]; then
279 cp $apr_src_dir/build/ltconfig build
281 if [ -f $apr_src_dir/build/ltmain.sh ]; then
282 cp $apr_src_dir/build/ltmain.sh build
286 echo rebuilding $config_h_in
288 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
290 echo rebuilding configure
292 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
294 # Remove autoconf 2.5x cache directories
295 rm -rf autom4te*.cache
297 # Remove possible bsd_converted file
300 if [ -f `which cut` ]; then
301 echo rebuilding rpm spec file
302 ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
303 EPOCH=`build/get-version.sh epoch include/ap_release.h AP_SERVER`
304 REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
305 VERSION=`echo $REVISION | cut -d- -s -f1`
306 RELEASE=`echo $REVISION | cut -d- -s -f2`
307 if [ "x$VERSION" = "x" ]; then
311 cat ./build/rpm/httpd.spec.in | \
312 sed -e "s/APACHE_VERSION/$VERSION/" \
313 -e "s/APACHE_RELEASE/$RELEASE/" \
314 -e "s/APACHE_MMN/$VMMN/" \
315 -e "s/APACHE_EPOCH/$EPOCH/" \
319 # ensure that the ap_expr expression parser sources are never regenerated
321 echo fixing timestamps for ap_expr sources
323 touch util_expr_parse.y util_expr_scan.l
325 touch util_expr_parse.c util_expr_parse.h util_expr_scan.c