buildconf revision 5a3fb2c128b4671fb5091eaea8861c759f50a4e6
7cb128dc4cae2a03a742f63ba7afee23c78e3af0Phil Carmody#!/bin/sh
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen#
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Copyright 1999-2004 The Apache Software Foundation
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen#
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Licensed under the Apache License, Version 2.0 (the "License");
a99b64f7d63812806ee40c2e8a347343fa3b84a7Timo Sirainen# you may not use this file except in compliance with the License.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# You may obtain a copy of the License at
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen#
0371406d952fe51367c7be91703e5634b7d9d225Timo Sirainen# http://www.apache.org/licenses/LICENSE-2.0
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen#
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Unless required by applicable law or agreed to in writing, software
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# distributed under the License is distributed on an "AS IS" BASIS,
a99b64f7d63812806ee40c2e8a347343fa3b84a7Timo Sirainen# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a99b64f7d63812806ee40c2e8a347343fa3b84a7Timo Sirainen# See the License for the specific language governing permissions and
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# limitations under the License.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen#
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen#
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# buildconf: Build the support scripts needed to compile from a
22627da0fb77c1d0d9a8e8bc485ef5540b6f2e69Timo Sirainen# checked-out version of the source code.
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# set a couple of defaults for where we should be looking for our support libs.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainenapr_src_dir=srclib/apr
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenapu_src_dir=srclib/apr-util
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainenwhile test $# -gt 0
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainendo
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen # Normalize
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen case "$1" in
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainen *) optarg= ;;
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen esac
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen case "$1" in
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen --with-apr=*)
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen apr_src_dir=$optarg
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen ;;
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen esac
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen case "$1" in
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen --with-apr-util=*)
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen apu_src_dir=$optarg
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ;;
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen esac
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen shift
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainendone
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen#
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Check to be sure that we have the srclib dependencies checked-out
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen#
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenshould_exit=0
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
68f0dfb4b2815ecbc1bd8d8a68adcfd577ec55aeTimo Sirainenif [ ! -d "$apr_src_dir" -o ! -f "$apr_src_dir/build/apr_common.m4" ]; then
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen echo ""
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen echo "You don't have a copy of the apr source in $apr_src_dir. "
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen echo "Please get the source using the following instructions,"
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo "or specify the location of the source with "
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo "--with-apr=[path to apr] :"
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen echo ""
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo " svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo ""
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen should_exit=1
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainenfi
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainenif [ ! -d "$apu_src_dir" -o ! -f "$apu_src_dir/Makefile.in" ]; then
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo ""
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo "You don't have a copy of the apr-util source in $apu_src_dir. "
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainen echo "Please get one the source using the following instructions, "
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainen echo "or specify the location of the source with "
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo "--with-apr-util=[path to apr-util]:"
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo ""
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen echo " svn co http://svn.apache.org/repos/asf/apr/apr-util/trunk srclib/apr-util"
0db5b158a00c08955bdacc99b1e2cd1ec07f4311Timo Sirainen echo ""
0db5b158a00c08955bdacc99b1e2cd1ec07f4311Timo Sirainen should_exit=1
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenfi
d16b506f5540e3407d256bda35624b38a5ecf88fTimo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenif [ $should_exit -gt 0 ]; then
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen exit 1
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainenfi
554c1c792dc6fce1e25c74555c2da786bffde75fTimo Sirainen
554c1c792dc6fce1e25c74555c2da786bffde75fTimo Sirainen# These are temporary until Roy finishes the other build changes
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen#
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainentouch .deps
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainenrm -f aclocal.m4
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainenrm -f generated_lists
6df2db16b3920346ed07cefb86e8bdcb7e1faec5Timo Sirainenrm -f srclib/pcre/aclocal.m4
6df2db16b3920346ed07cefb86e8bdcb7e1faec5Timo Sirainen
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen# Remove autoconf 2.5x cache directories
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainenrm -rf autom4te*.cache srclib/pcre/autom4te*.cache
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen
35f3b7e05afecacd0332c210c6e253911c2813d8Timo Sirainencase "`uname`" in
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen*BSD/OS*)
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen ./build/bsd_makefile;;
35f3b7e05afecacd0332c210c6e253911c2813d8Timo Sirainenesac
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen#
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen# end temporary stuff
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainenapr_configure="$apr_src_dir/configure"
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainenaprutil_configure="$apu_src_dir/configure"
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainenpcre_configure="srclib/pcre/configure"
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainenconfig_h_in="include/ap_config_auto.h.in"
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainencross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenif [ -d srclib/apr ]; then
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen echo rebuilding $apr_configure
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen (cd srclib/apr && ./buildconf) || {
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen echo "./buildconf failed for apr"
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen exit 1
407caeb5d0c8a6b158e2caef48dd909011d40340Timo Sirainen }
407caeb5d0c8a6b158e2caef48dd909011d40340Timo Sirainenfi
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenif [ -d srclib/apr-util ]; then
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen echo rebuilding $aprutil_configure
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen (cd srclib/apr-util && ./buildconf) || {
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen echo "./buildconf failed for apr-util"
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen exit 1
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen }
a54fa00087ba926a3d966a8449d8d7579e89911cTimo Sirainenfi
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainenecho copying build files
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainencp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen $apr_src_dir/build/find_apr.m4 $apu_src_dir/build/find_apu.m4 build
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Remove any libtool files so one can switch between libtool 1.3
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# and libtool 1.4 by simply rerunning the buildconf script.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen(cd build ; rm -f ltconfig ltmain.sh)
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Optionally copy libtool-1.3.x files
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenif [ -f $apr_src_dir/build/ltconfig ]; then
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen cp $apr_src_dir/build/ltconfig build
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenfi
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenif [ -f $apr_src_dir/build/ltmain.sh ]; then
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen cp $apr_src_dir/build/ltmain.sh build
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenfi
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenecho rebuilding $pcre_configure
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen(cd srclib/pcre && ${ACLOCAL:-aclocal} && ${AUTOCONF:-autoconf})
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainenecho rebuilding $config_h_in
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenrm -f $config_h_in
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenecho rebuilding configure
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainenrm -f config.cache
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen# Remove autoconf 2.5x cache directories
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenrm -rf autom4te*.cache srclib/pcre/autom4te*.cache
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenif [ -f `which cut` ]; then
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainen echo rebuilding rpm spec file
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen VERSION=`echo $REVISION | cut -d- -s -f1`
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainen RELEASE=`echo $REVISION | cut -d- -s -f2`
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen if [ "x$VERSION" = "x" ]; then
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen VERSION=$REVISION
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen RELEASE=1
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen fi
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen cat ./build/rpm/httpd.spec.in | \
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainen sed -e "s/APACHE_VERSION/$VERSION/" \
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainen -e "s/APACHE_RELEASE/$RELEASE/" \
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -e "s/APACHE_MMN/$VMMN/" \
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen > httpd.spec )
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenfi
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen# ensure that the mod_ssl expression parser sources are never regenerated
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen# when running make
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenecho fixing timestamps for mod_ssl sources
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainencd modules/ssl
d16b506f5540e3407d256bda35624b38a5ecf88fTimo Sirainentouch ssl_expr_parse.y
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainensleep 1
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainentouch ssl_expr_parse.c ssl_expr_parse.h ssl_expr_scan.l
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainensleep 1
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainentouch ssl_expr_scan.c
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainencd ../..
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainenexit 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen