]> granicus.if.org Git - apache/blob - buildconf
Start from svn httpd/httpd/win32-msi/trunk/InstallConf22.awk
[apache] / 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 ../apr"
26 apu_src_dir="srclib/apr-util ../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 apr_found=0
57 apu_found=0
58
59 for dir in $apr_src_dir
60 do
61     if [ -f "${dir}/build/apr_common.m4" ]; then
62         echo "found apr source: ${dir}"
63         apr_src_dir=$dir
64         apr_found=1
65         break
66     fi
67 done
68
69 if [ $apr_found -lt 1 ]; then
70     echo ""
71     echo "You don't have a copy of the apr source in srclib/apr. "
72     echo "Please get the source using the following instructions," 
73     echo "or specify the location of the source with " 
74     echo "--with-apr=[path to apr] :"
75     echo ""
76     echo "   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
77     echo ""
78     should_exit=1
79 fi
80
81 for dir in $apu_src_dir
82 do
83     if [ -f "${dir}/Makefile.in" ]; then
84         echo "found apr-util source: ${dir}"
85         apu_src_dir=$dir
86         apu_found=1
87         break
88     fi
89 done
90
91 if [ $apu_found -lt 1 ]; then
92     echo ""
93     echo "You don't have a copy of the apr-util source in srclib/apr-util. "
94     echo "Please get one the source using the following instructions, "
95     echo "or specify the location of the source with "
96     echo "--with-apr-util=[path to apr-util]:"
97     echo ""
98     echo "   svn co http://svn.apache.org/repos/asf/apr/apr-util/trunk srclib/apr-util"
99     echo ""
100     should_exit=1
101 fi
102
103 if [ $should_exit -gt 0 ]; then
104     exit 1
105 fi
106
107 # These are temporary until Roy finishes the other build changes
108 #
109 touch .deps
110 rm -f aclocal.m4
111 rm -f generated_lists
112 rm -f srclib/pcre/aclocal.m4
113
114 # Remove autoconf 2.5x cache directories
115 rm -rf autom4te*.cache srclib/pcre/autom4te*.cache
116
117 case "`uname`" in
118 *BSD/OS*)
119     ./build/bsd_makefile;;
120 esac
121 #
122 # end temporary stuff
123
124 apr_configure="$apr_src_dir/configure"
125 aprutil_configure="$apu_src_dir/configure"
126 pcre_configure="srclib/pcre/configure"
127 config_h_in="include/ap_config_auto.h.in"
128
129 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
130
131 if [ "$apr_src_dir" = "srclib/apr" ]; then
132     echo rebuilding $apr_configure
133     (cd srclib/apr && ./buildconf) || {
134         echo "./buildconf failed for apr"
135         exit 1
136     }
137     rm -f srclib/apr/apr.spec
138 fi
139
140 apr_src_dir=`cd $apr_src_dir && pwd` 
141
142 if [ "$apu_src_dir" = "srclib/apr-util" ]; then
143     echo rebuilding $aprutil_configure
144     (cd srclib/apr-util && ./buildconf --with-apr=$apr_src_dir) || {
145         echo "./buildconf failed for apr-util" 
146         exit 1
147     }
148     rm -f srclib/apr-util/apr-util.spec
149 fi
150
151 apu_src_dir=`cd $apu_src_dir && pwd` 
152
153 echo copying build files
154 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
155    $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
156    $apr_src_dir/build/find_apr.m4 $apu_src_dir/build/find_apu.m4 build
157
158 # Remove any libtool files so one can switch between libtool 1.3
159 # and libtool 1.4 by simply rerunning the buildconf script.
160 (cd build ; rm -f ltconfig ltmain.sh)
161
162 # Optionally copy libtool-1.3.x files
163 if [ -f $apr_src_dir/build/ltconfig ]; then
164     cp $apr_src_dir/build/ltconfig build
165 fi
166 if [ -f $apr_src_dir/build/ltmain.sh ]; then
167     cp $apr_src_dir/build/ltmain.sh build
168 fi
169
170 echo rebuilding $pcre_configure
171 (cd srclib/pcre && ${AUTOCONF:-autoconf})
172
173 echo rebuilding $config_h_in
174 rm -f $config_h_in
175 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
176
177 echo rebuilding configure
178 rm -f config.cache
179 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
180
181 # Remove autoconf 2.5x cache directories
182 rm -rf autom4te*.cache srclib/pcre/autom4te*.cache
183
184 if [ -f `which cut` ]; then
185   echo rebuilding rpm spec file
186   ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
187     REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
188     VERSION=`echo $REVISION | cut -d- -s -f1`
189     RELEASE=`echo $REVISION | cut -d- -s -f2`
190     if [ "x$VERSION" = "x" ]; then
191       VERSION=$REVISION
192       RELEASE=1
193     fi
194     cat ./build/rpm/httpd.spec.in | \
195     sed -e "s/APACHE_VERSION/$VERSION/" \
196         -e "s/APACHE_RELEASE/$RELEASE/" \
197         -e "s/APACHE_MMN/$VMMN/" \
198     > httpd.spec )
199 fi
200
201 # ensure that the mod_ssl expression parser sources are never regenerated
202 # when running make
203 echo fixing timestamps for mod_ssl sources
204 cd modules/ssl
205 touch ssl_expr_parse.y
206 sleep 1
207 touch ssl_expr_parse.c ssl_expr_parse.h ssl_expr_scan.l
208 sleep 1
209 touch ssl_expr_scan.c
210 cd ../..
211
212 exit 0