]> granicus.if.org Git - apache/blob - buildconf
* Makefile.in (install-build): Fix variable names.
[apache] / buildconf
1 #!/bin/sh
2 #
3 # Copyright 1999-2004 The Apache Software Foundation
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 #
18 # buildconf: Build the support scripts needed to compile from a
19 #            checked-out version of the source code.
20
21 # set a couple of defaults for where we should be looking for our support libs.
22 # can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
23
24 apr_src_dir="srclib/apr ../apr"
25 apu_src_dir="srclib/apr-util ../apr-util"
26
27 while test $# -gt 0 
28 do
29   # Normalize
30   case "$1" in
31   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
32   *) optarg= ;;
33   esac
34
35   case "$1" in
36   --with-apr=*)
37   apr_src_dir=$optarg
38   ;;
39   esac
40
41   case "$1" in
42   --with-apr-util=*)
43   apu_src_dir=$optarg
44   ;;
45   esac
46
47   shift
48 done
49
50 #
51 # Check to be sure that we have the srclib dependencies checked-out
52 #
53
54 should_exit=0
55 apr_found=0
56 apu_found=0
57
58 for dir in $apr_src_dir
59 do
60     if [ -d "${dir}" -a -f "${dir}/build/apr_common.m4" ]; then
61         echo "found apr source: ${dir}"
62         apr_src_dir=$dir
63         apr_found=1
64         break
65     fi
66 done
67
68 if [ $apr_found -lt 1 ]; then
69     echo ""
70     echo "You don't have a copy of the apr source in srclib/apr. "
71     echo "Please get the source using the following instructions," 
72     echo "or specify the location of the source with " 
73     echo "--with-apr=[path to apr] :"
74     echo ""
75     echo "   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
76     echo ""
77     should_exit=1
78 fi
79
80 for dir in $apu_src_dir
81 do
82     if [ -d "${dir}" -a -f "${dir}/Makefile.in" ]; then
83         echo "found apr-util source: ${dir}"
84         apu_src_dir=$dir
85         apu_found=1
86         break
87     fi
88 done
89
90 if [ $apu_found -lt 1 ]; then
91     echo ""
92     echo "You don't have a copy of the apr-util source in srclib/apr-util. "
93     echo "Please get one the source using the following instructions, "
94     echo "or specify the location of the source with "
95     echo "--with-apr-util=[path to apr-util]:"
96     echo ""
97     echo "   svn co http://svn.apache.org/repos/asf/apr/apr-util/trunk srclib/apr-util"
98     echo ""
99     should_exit=1
100 fi
101
102 if [ $should_exit -gt 0 ]; then
103     exit 1
104 fi
105
106 # These are temporary until Roy finishes the other build changes
107 #
108 touch .deps
109 rm -f aclocal.m4
110 rm -f generated_lists
111 rm -f srclib/pcre/aclocal.m4
112
113 # Remove autoconf 2.5x cache directories
114 rm -rf autom4te*.cache srclib/pcre/autom4te*.cache
115
116 case "`uname`" in
117 *BSD/OS*)
118     ./build/bsd_makefile;;
119 esac
120 #
121 # end temporary stuff
122
123 apr_configure="$apr_src_dir/configure"
124 aprutil_configure="$apu_src_dir/configure"
125 pcre_configure="srclib/pcre/configure"
126 config_h_in="include/ap_config_auto.h.in"
127
128 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
129
130 if [ -d srclib/apr ]; then
131     echo rebuilding $apr_configure
132     (cd srclib/apr && ./buildconf) || {
133         echo "./buildconf failed for apr"
134         exit 1
135     }
136     rm -f srclib/apr/apr.spec
137 fi
138
139 if [ -d srclib/apr-util ]; then
140     echo rebuilding $aprutil_configure
141     (cd srclib/apr-util && ./buildconf) || {
142         echo "./buildconf failed for apr-util" 
143         exit 1
144     }
145     rm -f srclib/apr-util/apr-util.spec
146 fi
147
148 echo copying build files
149 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
150    $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
151    $apr_src_dir/build/find_apr.m4 $apu_src_dir/build/find_apu.m4 build
152
153 # Remove any libtool files so one can switch between libtool 1.3
154 # and libtool 1.4 by simply rerunning the buildconf script.
155 (cd build ; rm -f ltconfig ltmain.sh)
156
157 # Optionally copy libtool-1.3.x files
158 if [ -f $apr_src_dir/build/ltconfig ]; then
159     cp $apr_src_dir/build/ltconfig build
160 fi
161 if [ -f $apr_src_dir/build/ltmain.sh ]; then
162     cp $apr_src_dir/build/ltmain.sh build
163 fi
164
165 echo rebuilding $pcre_configure
166 (cd srclib/pcre && ${AUTOCONF:-autoconf})
167
168 echo rebuilding $config_h_in
169 rm -f $config_h_in
170 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
171
172 echo rebuilding configure
173 rm -f config.cache
174 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
175
176 # Remove autoconf 2.5x cache directories
177 rm -rf autom4te*.cache srclib/pcre/autom4te*.cache
178
179 if [ -f `which cut` ]; then
180   echo rebuilding rpm spec file
181   ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
182     REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
183     VERSION=`echo $REVISION | cut -d- -s -f1`
184     RELEASE=`echo $REVISION | cut -d- -s -f2`
185     if [ "x$VERSION" = "x" ]; then
186       VERSION=$REVISION
187       RELEASE=1
188     fi
189     cat ./build/rpm/httpd.spec.in | \
190     sed -e "s/APACHE_VERSION/$VERSION/" \
191         -e "s/APACHE_RELEASE/$RELEASE/" \
192         -e "s/APACHE_MMN/$VMMN/" \
193     > httpd.spec )
194 fi
195
196 # ensure that the mod_ssl expression parser sources are never regenerated
197 # when running make
198 echo fixing timestamps for mod_ssl sources
199 cd modules/ssl
200 touch ssl_expr_parse.y
201 sleep 1
202 touch ssl_expr_parse.c ssl_expr_parse.h ssl_expr_scan.l
203 sleep 1
204 touch ssl_expr_scan.c
205 cd ../..
206
207 exit 0