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]*=//'` ;;
64 # Check to be sure that we have the srclib dependencies checked-out
72 for dir in $apr_src_dir
74 if [ -f "${dir}/build/apr_common.m4" ]; then
75 echo "found apr source: ${dir}"
82 if [ $apr_found -lt 1 ]; then
84 echo "APR could not be found automatically."
86 echo "Please refer to the documentation on APR in the httpd INSTALL file."
90 apr_major_version=`grep "#define APR_MAJOR_VERSION" \
91 $apr_src_dir/include/apr_version.h | sed 's/[^0-9]//g'`
94 if [ $apr_major_version -lt 2 ] ; then
95 if test -z "$apu_src_dir"; then
96 apu_src_dir=`echo $apr_src_dir | sed -e 's#/apr#/apr-util#g;'`
97 apu_src_dir="$apu_src_dir `echo $apr_src_dir | sed -e 's#/apr#/aprutil#;g'`"
98 apu_src_dir="$apu_src_dir srclib/apr-util ../apr-util"
101 for dir in $apu_src_dir
103 if [ -f "${dir}/Makefile.in" ]; then
104 echo "found apr-util source: ${dir}"
111 if [ $apu_found -lt 1 ]; then
113 echo "You are using APR 1.x but APR-util 1.x was not found."
115 echo "Please refer to the documentation on APR in the httpd INSTALL file."
121 if [ $should_exit -gt 0 ]; then
125 # These are temporary until Roy finishes the other build changes
129 rm -f generated_lists
131 # Remove autoconf 2.5x cache directories
132 rm -rf autom4te*.cache
136 ./build/bsd_makefile;;
139 # end temporary stuff
141 apr_configure="$apr_src_dir/configure"
142 if [ $apr_major_version -lt 2 ] ; then
143 aprutil_configure="$apu_src_dir/configure"
145 config_h_in="include/ap_config_auto.h.in"
147 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
149 if [ "$apr_src_dir" = "srclib/apr" ]; then
150 echo rebuilding $apr_configure
151 (cd srclib/apr && ./buildconf) || {
152 echo "./buildconf failed for apr"
155 rm -f srclib/apr/apr.spec
158 apr_src_dir=`cd $apr_src_dir && pwd`
160 if [ $apr_major_version -lt 2 ] ; then
161 if [ "$apu_src_dir" = "srclib/apr-util" ]; then
162 echo rebuilding $aprutil_configure
163 (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || {
164 echo "./buildconf failed for apr-util"
167 rm -f srclib/apr-util/apr-util.spec
170 apu_src_dir=`cd $apu_src_dir && pwd`
173 echo copying build files
174 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
175 $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
176 $apr_src_dir/build/find_apr.m4 build
177 if [ $apr_major_version -lt 2 ] ; then
178 cp $apu_src_dir/build/find_apu.m4 build
181 # Remove any libtool files so one can switch between libtool 1.3
182 # and libtool 1.4 by simply rerunning the buildconf script.
183 (cd build ; rm -f ltconfig ltmain.sh)
185 # Optionally copy libtool-1.3.x files
186 if [ -f $apr_src_dir/build/ltconfig ]; then
187 cp $apr_src_dir/build/ltconfig build
189 if [ -f $apr_src_dir/build/ltmain.sh ]; then
190 cp $apr_src_dir/build/ltmain.sh build
193 echo rebuilding $config_h_in
195 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
197 echo rebuilding configure
199 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
201 # Remove autoconf 2.5x cache directories
202 rm -rf autom4te*.cache
204 if [ -f `which cut` ]; then
205 echo rebuilding rpm spec file
206 ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
207 EPOCH=`build/get-version.sh epoch include/ap_release.h AP_SERVER`
208 REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
209 VERSION=`echo $REVISION | cut -d- -s -f1`
210 RELEASE=`echo $REVISION | cut -d- -s -f2`
211 if [ "x$VERSION" = "x" ]; then
215 cat ./build/rpm/httpd.spec.in | \
216 sed -e "s/APACHE_VERSION/$VERSION/" \
217 -e "s/APACHE_RELEASE/$RELEASE/" \
218 -e "s/APACHE_MMN/$VMMN/" \
219 -e "s/APACHE_EPOCH/$EPOCH/" \
223 # ensure that the ap_expr expression parser sources are never regenerated
225 echo fixing timestamps for ap_expr sources
227 touch util_expr_parse.y util_expr_scan.l
229 touch util_expr_parse.c util_expr_parse.h util_expr_scan.c