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 "You don't have a copy of the apr source in srclib/apr. "
152 echo "Please get the source using the following instructions,"
153 echo "or specify the location of the source with "
154 echo "--with-apr=[path to apr] :"
156 echo " svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
159 elif [ -n "${apr_config}" ]; then
160 apr_major_version=`echo "${apr_major_version}" | sed 's/\..*//'`
162 apr_major_version=`grep "#define APR_MAJOR_VERSION" \
163 $apr_src_dir/include/apr_version.h | sed 's/[^0-9]//g'`
166 # Find APR-util. Note: if we're using apr-config, we can completely skip this,
167 # even if APR is version 1. That's because we only end up caring about
168 # find_apu.m4, which is not actually installed in the standard APR-util
169 # distribution to begin with.
170 if [ -z "${apr_config}" -a $apr_major_version -lt 2 ] ; then
171 if test -z "$apu_src_dir"; then
172 apu_src_dir=`echo $apr_src_dir | sed -e 's#/apr#/apr-util#g;'`
173 apu_src_dir="$apu_src_dir `echo $apr_src_dir | sed -e 's#/apr#/aprutil#;g'`"
174 apu_src_dir="$apu_src_dir srclib/apr-util ../apr-util"
177 for dir in $apu_src_dir
179 if [ -f "${dir}/Makefile.in" ]; then
180 echo "found apr-util source: ${dir}"
187 if [ $apu_found -lt 1 ]; then
189 echo "You don't have a copy of the apr-util source in srclib/apr-util. "
190 echo "Please get one the source using the following instructions, "
191 echo "or specify the location of the source with "
192 echo "--with-apr-util=[path to apr-util]:"
194 echo " svn co http://svn.apache.org/repos/asf/apr/apr-util/branches/1.5.x srclib/apr-util"
200 if [ $should_exit -gt 0 ]; then
204 # These are temporary until Roy finishes the other build changes
208 rm -f generated_lists
210 # Remove autoconf 2.5x cache directories
211 rm -rf autom4te*.cache
215 ./build/bsd_makefile;;
218 # end temporary stuff
220 apr_configure="$apr_src_dir/configure"
221 if [ $apr_major_version -lt 2 ] ; then
222 aprutil_configure="$apu_src_dir/configure"
224 config_h_in="include/ap_config_auto.h.in"
226 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
228 if [ "$apr_src_dir" = "srclib/apr" ]; then
229 echo rebuilding $apr_configure
230 (cd srclib/apr && ./buildconf) || {
231 echo "./buildconf failed for apr"
234 rm -f srclib/apr/apr.spec
237 apr_src_dir=`cd $apr_src_dir && pwd`
239 if [ $apr_major_version -lt 2 ] ; then
240 if [ "$apu_src_dir" = "srclib/apr-util" ]; then
241 echo rebuilding $aprutil_configure
242 (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || {
243 echo "./buildconf failed for apr-util"
246 rm -f srclib/apr-util/apr-util.spec
249 apu_src_dir=`cd $apu_src_dir && pwd`
252 echo copying build files
253 if [ -n "${apr_config}" ]; then
254 # If we're using apr-config, we switch things up a little bit:
255 # - use automake's config.* scripts instead of APR's
256 # - use the included PrintPath instead of copying from APR
257 # - assume find_apu.m4 is also in APR's --installbuilddir
259 # Figure out where to copy config.* from.
260 automake=${AUTOMAKE:-automake}
261 am_libdir=`"${automake}" --print-libdir`
262 cp "${am_libdir}/config.guess" "${am_libdir}/config.sub" build
264 # Remember that in this case, $apr_src_dir points to the build directory.
265 cp "$apr_src_dir/apr_common.m4" "$apr_src_dir/find_apr.m4" build
266 if [ $apr_major_version -lt 2 ] ; then
267 cp "$apr_src_dir/find_apu.m4" build
270 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
271 $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
272 $apr_src_dir/build/find_apr.m4 build
273 if [ $apr_major_version -lt 2 ] ; then
274 cp $apu_src_dir/build/find_apu.m4 build
278 # Remove any libtool files so one can switch between libtool 1.3
279 # and libtool 1.4 by simply rerunning the buildconf script.
280 (cd build ; rm -f ltconfig ltmain.sh)
282 if [ -z "${apr_config}" ]; then
283 # Optionally copy libtool-1.3.x files
284 if [ -f $apr_src_dir/build/ltconfig ]; then
285 cp $apr_src_dir/build/ltconfig build
287 if [ -f $apr_src_dir/build/ltmain.sh ]; then
288 cp $apr_src_dir/build/ltmain.sh build
292 echo rebuilding $config_h_in
294 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
296 echo rebuilding configure
298 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
300 # Remove autoconf 2.5x cache directories
301 rm -rf autom4te*.cache
303 if [ -f `which cut` ]; then
304 echo rebuilding rpm spec file
305 ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
306 EPOCH=`build/get-version.sh epoch include/ap_release.h AP_SERVER`
307 REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
308 VERSION=`echo $REVISION | cut -d- -s -f1`
309 RELEASE=`echo $REVISION | cut -d- -s -f2`
310 if [ "x$VERSION" = "x" ]; then
314 cat ./build/rpm/httpd.spec.in | \
315 sed -e "s/APACHE_VERSION/$VERSION/" \
316 -e "s/APACHE_RELEASE/$RELEASE/" \
317 -e "s/APACHE_MMN/$VMMN/" \
318 -e "s/APACHE_EPOCH/$EPOCH/" \
322 # ensure that the ap_expr expression parser sources are never regenerated
324 echo fixing timestamps for ap_expr sources
326 touch util_expr_parse.y util_expr_scan.l
328 touch util_expr_parse.c util_expr_parse.h util_expr_scan.c