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