bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / buildconf
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 # set a couple of defaults for where we should be looking for our support libs.
23 # can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
24
25 apr_src_dir=srclib/apr
26 apu_src_dir=srclib/apr-util
27
28 while test $# -gt 0 
29 do
30   # Normalize
31   case "$1" in
32   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
33   *) optarg= ;;
34   esac
35
36   case "$1" in
37   --with-apr=*)
38   apr_src_dir=$optarg
39   ;;
40   esac
41
42   case "$1" in
43   --with-apr-util=*)
44   apu_src_dir=$optarg
45   ;;
46   esac
47
48   shift
49 done
50
51 #
52 # Check to be sure that we have the srclib dependencies checked-out
53 #
54
55 should_exit=0
56
57 if [ ! -f "$apr_src_dir/build/apr_common.m4" ]; then
58     echo ""
59     echo "You don't have a copy of the apr source in $apr_src_dir. " 
60     echo "Please get the source using the following instructions," 
61     echo "or specify the location of the source with " 
62     echo "--with-apr=[path to apr] :"
63     echo ""
64     echo "   cd srclib"
65     echo "   svn co https://svn.apache.org/repos/asf/apr/apr/branches/0.9.x apr"
66     echo "" 
67     should_exit=1
68 fi
69
70 if [ ! -f "$apu_src_dir/Makefile.in" ]; then
71     echo ""
72     echo "You don't have a copy of the apr-util source in $apu_src_dir. "
73     echo "Please get one the source using the following instructions, "
74     echo "or specify the location of the source with "
75     echo "--with-apr-util=[path to apr-util]:"
76     echo ""
77     echo "   cd srclib"
78     echo "   svn co https://svn.apache.org/repos/asf/apr/apr-util/branches/0.9.x apr-util"
79     echo ""
80     should_exit=1
81 fi
82
83 if [ $should_exit -gt 0 ]; then
84     exit 1
85 fi
86
87 # These are temporary until Roy finishes the other build changes
88 #
89 touch .deps
90 rm -f aclocal.m4
91 rm -f generated_lists
92
93 # Remove autoconf 2.5x's cache directory
94 rm -rf autom4te*.cache
95
96 case "`uname`" in
97 *BSD/OS*)
98     ./build/bsd_makefile;;
99 esac
100 #
101 # end temporary stuff
102
103 apr_configure="$apr_src_dir/configure"
104 aprutil_configure="$apu_src_dir/configure"
105 pcre_configure="srclib/pcre/configure"
106 config_h_in="include/ap_config_auto.h.in"
107
108 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
109
110 if [ "$apr_src_dir" = "srclib/apr" ]; then
111     echo rebuilding $apr_configure
112     (cd srclib/apr && ./buildconf) || {
113         echo "./buildconf failed for apr"
114         exit 1
115     }
116     rm -f srclib/apr/apr.spec
117 fi
118
119 apr_src_dir=`cd $apr_src_dir && pwd` 
120
121 if [ "$apu_src_dir" = "srclib/apr-util" ]; then
122     echo rebuilding $aprutil_configure
123     (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || {
124         echo "./buildconf failed for apr-util" 
125         exit 1
126     }
127     rm -f srclib/apr-util/apr-util.spec
128 fi
129
130 apu_src_dir=`cd $apu_src_dir && pwd` 
131
132 echo copying build files
133 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
134    $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
135    $apr_src_dir/build/find_apr.m4 $apu_src_dir/build/find_apu.m4 build
136
137 # Remove any libtool files so one can switch between libtool 1.3
138 # and libtool 1.4 by simply rerunning the buildconf script.
139 (cd build ; rm -f ltconfig ltmain.sh)
140
141 # Optionally copy libtool-1.3.x files
142 if [ -f $apr_src_dir/build/ltconfig ]; then
143     cp $apr_src_dir/build/ltconfig build
144 fi
145 if [ -f $apr_src_dir/build/ltmain.sh ]; then
146     cp $apr_src_dir/build/ltmain.sh build
147 fi
148
149 # ensure that the mod_ssl expression parser sources are never regenerated
150 # when running make
151 echo fixing timestamps for mod_ssl sources
152 cd modules/ssl
153 touch ssl_expr_parse.y
154 sleep 1
155 touch ssl_expr_parse.c ssl_expr_parse.h ssl_expr_scan.l
156 sleep 1
157 touch ssl_expr_scan.c
158 cd ../..
159
160 echo rebuilding $pcre_configure
161 (cd srclib/pcre && ${AUTOCONF:-autoconf})
162
163 echo rebuilding $config_h_in
164 rm -f $config_h_in
165 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
166
167 echo rebuilding configure
168 rm -f config.cache
169 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
170
171 # Remove autoconf 2.5x's cache directory
172 rm -rf autom4te*.cache
173
174 echo rebuilding rpm spec file
175 ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
176   REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
177   VERSION=`echo $REVISION | cut -d- -s -f1`
178   RELEASE=`echo $REVISION | cut -d- -s -f2`
179   if [ "x$VERSION" = "x" ]; then
180     VERSION=$REVISION
181     RELEASE=1
182   fi
183   cat ./build/rpm/httpd.spec.in | \
184   sed -e "s/APACHE_VERSION/$VERSION/" \
185       -e "s/APACHE_RELEASE/$RELEASE/" \
186       -e "s/APACHE_MMN/$VMMN/" \
187   > httpd.spec )
188
189 exit 0