1#!/bin/sh 2# 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 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 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. 17# 18# 19# buildconf: Build the support scripts needed to compile from a 20# checked-out version of the source code. 21 22# version check for AC_PROG_CC_C99 23ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'` 24case "$ac_version" in 25# versions older than 2.50 are denied by AC_PREREQ 262.5*) 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. 30 sleep 1 31 ;; 32esac 33 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] 36 37apr_src_dir="srclib/apr ../apr" 38apu_src_dir="" 39 40while test $# -gt 0 41do 42 # Normalize 43 case "$1" in 44 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 45 *) optarg= ;; 46 esac 47 48 case "$1" in 49 --with-apr=*) 50 apr_src_dir=$optarg 51 ;; 52 esac 53 54 case "$1" in 55 --with-apr-util=*) 56 apu_src_dir=$optarg 57 ;; 58 esac 59 60 shift 61done 62 63# 64# Check to be sure that we have the srclib dependencies checked-out 65# 66 67should_exit=0 68apr_found=0 69apu_found=0 70apr_major_version=2 71 72for dir in $apr_src_dir 73do 74 if [ -f "${dir}/build/apr_common.m4" ]; then 75 echo "found apr source: ${dir}" 76 apr_src_dir=$dir 77 apr_found=1 78 break 79 fi 80done 81 82if [ $apr_found -lt 1 ]; then 83 echo "" 84 echo "You don't have a copy of the apr source in srclib/apr. " 85 echo "Please get the source using the following instructions," 86 echo "or specify the location of the source with " 87 echo "--with-apr=[path to apr] :" 88 echo "" 89 echo " svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr" 90 echo "" 91 should_exit=1 92else 93 apr_major_version=`grep "#define APR_MAJOR_VERSION" \ 94 $apr_src_dir/include/apr_version.h | sed 's/[^0-9]//g'` 95fi 96 97if [ $apr_major_version -lt 2 ] ; then 98 if test -z "$apu_src_dir"; then 99 apu_src_dir=`echo $apr_src_dir | sed -e 's#/apr#/apr-util#g;'` 100 apu_src_dir="$apu_src_dir `echo $apr_src_dir | sed -e 's#/apr#/aprutil#;g'`" 101 apu_src_dir="$apu_src_dir srclib/apr-util ../apr-util" 102 fi 103 104 for dir in $apu_src_dir 105 do 106 if [ -f "${dir}/Makefile.in" ]; then 107 echo "found apr-util source: ${dir}" 108 apu_src_dir=$dir 109 apu_found=1 110 break 111 fi 112 done 113 114 if [ $apu_found -lt 1 ]; then 115 echo "" 116 echo "You don't have a copy of the apr-util source in srclib/apr-util. " 117 echo "Please get one the source using the following instructions, " 118 echo "or specify the location of the source with " 119 echo "--with-apr-util=[path to apr-util]:" 120 echo "" 121 echo " svn co http://svn.apache.org/repos/asf/apr/apr-util/branches/1.5.x srclib/apr-util" 122 echo "" 123 should_exit=1 124 fi 125fi 126 127if [ $should_exit -gt 0 ]; then 128 exit 1 129fi 130 131# These are temporary until Roy finishes the other build changes 132# 133touch .deps 134rm -f aclocal.m4 135rm -f generated_lists 136 137# Remove autoconf 2.5x cache directories 138rm -rf autom4te*.cache 139 140case "`uname`" in 141*BSD/OS*) 142 ./build/bsd_makefile;; 143esac 144# 145# end temporary stuff 146 147apr_configure="$apr_src_dir/configure" 148if [ $apr_major_version -lt 2 ] ; then 149 aprutil_configure="$apu_src_dir/configure" 150fi 151config_h_in="include/ap_config_auto.h.in" 152 153cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling" 154 155if [ "$apr_src_dir" = "srclib/apr" ]; then 156 echo rebuilding $apr_configure 157 (cd srclib/apr && ./buildconf) || { 158 echo "./buildconf failed for apr" 159 exit 1 160 } 161 rm -f srclib/apr/apr.spec 162fi 163 164apr_src_dir=`cd $apr_src_dir && pwd` 165 166if [ $apr_major_version -lt 2 ] ; then 167 if [ "$apu_src_dir" = "srclib/apr-util" ]; then 168 echo rebuilding $aprutil_configure 169 (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || { 170 echo "./buildconf failed for apr-util" 171 exit 1 172 } 173 rm -f srclib/apr-util/apr-util.spec 174 fi 175 176 apu_src_dir=`cd $apu_src_dir && pwd` 177fi 178 179echo copying build files 180cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \ 181 $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \ 182 $apr_src_dir/build/find_apr.m4 build 183if [ $apr_major_version -lt 2 ] ; then 184 cp $apu_src_dir/build/find_apu.m4 build 185fi 186 187# Remove any libtool files so one can switch between libtool 1.3 188# and libtool 1.4 by simply rerunning the buildconf script. 189(cd build ; rm -f ltconfig ltmain.sh) 190 191# Optionally copy libtool-1.3.x files 192if [ -f $apr_src_dir/build/ltconfig ]; then 193 cp $apr_src_dir/build/ltconfig build 194fi 195if [ -f $apr_src_dir/build/ltmain.sh ]; then 196 cp $apr_src_dir/build/ltmain.sh build 197fi 198 199echo rebuilding $config_h_in 200rm -f $config_h_in 201${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning" 202 203echo rebuilding configure 204rm -f config.cache 205${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning" 206 207# Remove autoconf 2.5x cache directories 208rm -rf autom4te*.cache 209 210if [ -f `which cut` ]; then 211 echo rebuilding rpm spec file 212 ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER` 213 EPOCH=`build/get-version.sh epoch include/ap_release.h AP_SERVER` 214 REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER` 215 VERSION=`echo $REVISION | cut -d- -s -f1` 216 RELEASE=`echo $REVISION | cut -d- -s -f2` 217 if [ "x$VERSION" = "x" ]; then 218 VERSION=$REVISION 219 RELEASE=1 220 fi 221 cat ./build/rpm/httpd.spec.in | \ 222 sed -e "s/APACHE_VERSION/$VERSION/" \ 223 -e "s/APACHE_RELEASE/$RELEASE/" \ 224 -e "s/APACHE_MMN/$VMMN/" \ 225 -e "s/APACHE_EPOCH/$EPOCH/" \ 226 > httpd.spec ) 227fi 228 229# ensure that the ap_expr expression parser sources are never regenerated 230# when running make 231echo fixing timestamps for ap_expr sources 232cd server 233touch util_expr_parse.y util_expr_scan.l 234sleep 1 235touch util_expr_parse.c util_expr_parse.h util_expr_scan.c 236cd .. 237 238exit 0 239