buildconf revision 4cb8bb9049d1643295ebda12c76dad441ddc2228
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#!/bin/sh
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Licensed to the Apache Software Foundation (ASF) under one or more
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# contributor license agreements. See the NOTICE file distributed with
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# this work for additional information regarding copyright ownership.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# The ASF licenses this file to You under the Apache License, Version 2.0
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# (the "License"); you may not use this file except in compliance with
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# the License. You may obtain a copy of the License at
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# http://www.apache.org/licenses/LICENSE-2.0
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Unless required by applicable law or agreed to in writing, software
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# distributed under the License is distributed on an "AS IS" BASIS,
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# See the License for the specific language governing permissions and
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# limitations under the License.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# buildconf: Build the support scripts needed to compile from a
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# checked-out version of the source code.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
104a37ccc1f0447ab5567644c98d5ed7266d3211Zach Kissel# version check for AC_PROG_CC_C99
14ea4bb737263733ad80a36b4f73f681c30a6b45sdac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'`
14ea4bb737263733ad80a36b4f73f681c30a6b45sdcase "$ac_version" in
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# versions older than 2.50 are denied by AC_PREREQ
14ea4bb737263733ad80a36b4f73f681c30a6b45sd2.5*)
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo WARNING: You are using an outdated version of autoconf.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo WARNING: This may lead to less than optimal performance of httpd.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo WARNING: You should use autoconf 2.60 or newer.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd sleep 1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd ;;
14ea4bb737263733ad80a36b4f73f681c30a6b45sdesac
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# set a couple of defaults for where we should be looking for our support libs.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapr_src_dir="srclib/apr ../apr"
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapu_src_dir=""
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdwhile test $# -gt 0
14ea4bb737263733ad80a36b4f73f681c30a6b45sddo
14ea4bb737263733ad80a36b4f73f681c30a6b45sd # Normalize
14ea4bb737263733ad80a36b4f73f681c30a6b45sd case "$1" in
14ea4bb737263733ad80a36b4f73f681c30a6b45sd -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
14ea4bb737263733ad80a36b4f73f681c30a6b45sd *) optarg= ;;
14ea4bb737263733ad80a36b4f73f681c30a6b45sd esac
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd case "$1" in
14ea4bb737263733ad80a36b4f73f681c30a6b45sd --with-apr=*)
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apr_src_dir=$optarg
14ea4bb737263733ad80a36b4f73f681c30a6b45sd ;;
14ea4bb737263733ad80a36b4f73f681c30a6b45sd esac
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd case "$1" in
14ea4bb737263733ad80a36b4f73f681c30a6b45sd --with-apr-util=*)
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apu_src_dir=$optarg
14ea4bb737263733ad80a36b4f73f681c30a6b45sd ;;
14ea4bb737263733ad80a36b4f73f681c30a6b45sd esac
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd shift
14ea4bb737263733ad80a36b4f73f681c30a6b45sddone
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Check to be sure that we have the srclib dependencies checked-out
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdshould_exit=0
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapr_found=0
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapu_found=0
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapr_major_version=2
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfor dir in $apr_src_dir
14ea4bb737263733ad80a36b4f73f681c30a6b45sddo
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if [ -f "${dir}/build/apr_common.m4" ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "found apr source: ${dir}"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apr_src_dir=$dir
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apr_found=1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd break
14ea4bb737263733ad80a36b4f73f681c30a6b45sd fi
14ea4bb737263733ad80a36b4f73f681c30a6b45sddone
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ $apr_found -lt 1 ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo ""
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "APR could not be found automatically."
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo ""
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "Please refer to the documentation on APR in the httpd INSTALL file."
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo ""
14ea4bb737263733ad80a36b4f73f681c30a6b45sd should_exit=1
14ea4bb737263733ad80a36b4f73f681c30a6b45sdelse
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apr_major_version=`grep "#define APR_MAJOR_VERSION" \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd $apr_src_dir/include/apr_version.h | sed 's/[^0-9]//g'`
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ $apr_major_version -lt 2 ] ; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if test -z "$apu_src_dir"; then
59ac0c1669407488b67ae9e273667a340dccc611davemq apu_src_dir=`echo $apr_src_dir | sed -e 's#/apr#/apr-util#g;'`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apu_src_dir="$apu_src_dir `echo $apr_src_dir | sed -e 's#/apr#/aprutil#;g'`"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apu_src_dir="$apu_src_dir srclib/apr-util ../apr-util"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd fi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd for dir in $apu_src_dir
14ea4bb737263733ad80a36b4f73f681c30a6b45sd do
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if [ -f "${dir}/Makefile.in" ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "found apr-util source: ${dir}"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apu_src_dir=$dir
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apu_found=1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd break
14ea4bb737263733ad80a36b4f73f681c30a6b45sd fi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd done
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if [ $apu_found -lt 1 ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo ""
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "You are using APR 1.x but APR-util 1.x was not found."
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo ""
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "Please refer to the documentation on APR in the httpd INSTALL file."
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo ""
104a37ccc1f0447ab5567644c98d5ed7266d3211Zach Kissel should_exit=1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd fi
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ $should_exit -gt 0 ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd exit 1
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# These are temporary until Roy finishes the other build changes
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sdtouch .deps
14ea4bb737263733ad80a36b4f73f681c30a6b45sdrm -f aclocal.m4
14ea4bb737263733ad80a36b4f73f681c30a6b45sdrm -f generated_lists
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Remove autoconf 2.5x cache directories
14ea4bb737263733ad80a36b4f73f681c30a6b45sdrm -rf autom4te*.cache
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdcase "`uname`" in
14ea4bb737263733ad80a36b4f73f681c30a6b45sd*BSD/OS*)
14ea4bb737263733ad80a36b4f73f681c30a6b45sd ./build/bsd_makefile;;
14ea4bb737263733ad80a36b4f73f681c30a6b45sdesac
14ea4bb737263733ad80a36b4f73f681c30a6b45sd#
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# end temporary stuff
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapr_configure="$apr_src_dir/configure"
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ $apr_major_version -lt 2 ] ; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd aprutil_configure="$apu_src_dir/configure"
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sdconfig_h_in="include/ap_config_auto.h.in"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdcross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
05d7cf284e1a38c8b80fcd4e074f782f3f34717estephhif [ "$apr_src_dir" = "srclib/apr" ]; then
05d7cf284e1a38c8b80fcd4e074f782f3f34717estephh echo rebuilding $apr_configure
14ea4bb737263733ad80a36b4f73f681c30a6b45sd (cd srclib/apr && ./buildconf) || {
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "./buildconf failed for apr"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd exit 1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd }
14ea4bb737263733ad80a36b4f73f681c30a6b45sd rm -f srclib/apr/apr.spec
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdapr_src_dir=`cd $apr_src_dir && pwd`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ $apr_major_version -lt 2 ] ; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if [ "$apu_src_dir" = "srclib/apr-util" ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo rebuilding $aprutil_configure
14ea4bb737263733ad80a36b4f73f681c30a6b45sd (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || {
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo "./buildconf failed for apr-util"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd exit 1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd }
14ea4bb737263733ad80a36b4f73f681c30a6b45sd rm -f srclib/apr-util/apr-util.spec
14ea4bb737263733ad80a36b4f73f681c30a6b45sd fi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd apu_src_dir=`cd $apu_src_dir && pwd`
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
59ac0c1669407488b67ae9e273667a340dccc611davemq
59ac0c1669407488b67ae9e273667a340dccc611davemqecho copying build files
14ea4bb737263733ad80a36b4f73f681c30a6b45sdcp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd $apr_src_dir/build/find_apr.m4 build
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ $apr_major_version -lt 2 ] ; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd cp $apu_src_dir/build/find_apu.m4 build
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Remove any libtool files so one can switch between libtool 1.3
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# and libtool 1.4 by simply rerunning the buildconf script.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd(cd build ; rm -f ltconfig ltmain.sh)
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Optionally copy libtool-1.3.x files
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ -f $apr_src_dir/build/ltconfig ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd cp $apr_src_dir/build/ltconfig build
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ -f $apr_src_dir/build/ltmain.sh ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd cp $apr_src_dir/build/ltmain.sh build
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
104a37ccc1f0447ab5567644c98d5ed7266d3211Zach Kisselecho rebuilding $config_h_in
104a37ccc1f0447ab5567644c98d5ed7266d3211Zach Kisselrm -f $config_h_in
14ea4bb737263733ad80a36b4f73f681c30a6b45sd${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdecho rebuilding configure
14ea4bb737263733ad80a36b4f73f681c30a6b45sdrm -f config.cache
14ea4bb737263733ad80a36b4f73f681c30a6b45sd${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Remove autoconf 2.5x cache directories
14ea4bb737263733ad80a36b4f73f681c30a6b45sdrm -rf autom4te*.cache
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# Remove possible bsd_converted file
14ea4bb737263733ad80a36b4f73f681c30a6b45sdrm -rf bsd_converted
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdif [ -f `which cut` ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd echo rebuilding rpm spec file
14ea4bb737263733ad80a36b4f73f681c30a6b45sd ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd EPOCH=`build/get-version.sh epoch include/ap_release.h AP_SERVER`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd VERSION=`echo $REVISION | cut -d- -s -f1`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RELEASE=`echo $REVISION | cut -d- -s -f2`
14ea4bb737263733ad80a36b4f73f681c30a6b45sd if [ "x$VERSION" = "x" ]; then
14ea4bb737263733ad80a36b4f73f681c30a6b45sd VERSION=$REVISION
14ea4bb737263733ad80a36b4f73f681c30a6b45sd RELEASE=1
14ea4bb737263733ad80a36b4f73f681c30a6b45sd fi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd cat ./build/rpm/httpd.spec.in | \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd sed -e "s/APACHE_VERSION/$VERSION/" \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd -e "s/APACHE_RELEASE/$RELEASE/" \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd -e "s/APACHE_MMN/$VMMN/" \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd -e "s/APACHE_EPOCH/$EPOCH/" \
14ea4bb737263733ad80a36b4f73f681c30a6b45sd > httpd.spec )
14ea4bb737263733ad80a36b4f73f681c30a6b45sdfi
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# ensure that the ap_expr expression parser sources are never regenerated
14ea4bb737263733ad80a36b4f73f681c30a6b45sd# when running make
14ea4bb737263733ad80a36b4f73f681c30a6b45sdecho fixing timestamps for ap_expr sources
14ea4bb737263733ad80a36b4f73f681c30a6b45sdcd server
14ea4bb737263733ad80a36b4f73f681c30a6b45sdtouch util_expr_parse.y util_expr_scan.l
14ea4bb737263733ad80a36b4f73f681c30a6b45sdsleep 1
14ea4bb737263733ad80a36b4f73f681c30a6b45sdtouch util_expr_parse.c util_expr_parse.h util_expr_scan.c
14ea4bb737263733ad80a36b4f73f681c30a6b45sdcd ..
14ea4bb737263733ad80a36b4f73f681c30a6b45sd
14ea4bb737263733ad80a36b4f73f681c30a6b45sdexit 0
14ea4bb737263733ad80a36b4f73f681c30a6b45sd