]> granicus.if.org Git - apache/blob - buildconf
Use -export-dynamic only when linking an httpd which includes mod_so,
[apache] / buildconf
1 #!/bin/sh
2 # ====================================================================
3 # The Apache Software License, Version 1.1
4 #
5 # Copyright (c) 2000-2004 The Apache Software Foundation.  All rights
6 # reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # 1. Redistributions of source code must retain the above copyright
13 #    notice, this list of conditions and the following disclaimer.
14 #
15 # 2. Redistributions in binary form must reproduce the above copyright
16 #    notice, this list of conditions and the following disclaimer in
17 #    the documentation and/or other materials provided with the
18 #    distribution.
19 #
20 # 3. The end-user documentation included with the redistribution,
21 #    if any, must include the following acknowledgment:
22 #       "This product includes software developed by the
23 #        Apache Software Foundation (http://www.apache.org/)."
24 #    Alternately, this acknowledgment may appear in the software itself,
25 #    if and wherever such third-party acknowledgments normally appear.
26 #
27 # 4. The names "Apache" and "Apache Software Foundation" must
28 #    not be used to endorse or promote products derived from this
29 #    software without prior written permission. For written
30 #    permission, please contact apache@apache.org.
31 #
32 # 5. Products derived from this software may not be called "Apache",
33 #    nor may "Apache" appear in their name, without prior written
34 #    permission of the Apache Software Foundation.
35 #
36 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 # DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40 # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 # SUCH DAMAGE.
48 # ====================================================================
49 #
50 # This software consists of voluntary contributions made by many
51 # individuals on behalf of the Apache Software Foundation.  For more
52 # information on the Apache Software Foundation, please see
53 # <http://www.apache.org/>.
54 #
55
56 # buildconf: Build the support scripts needed to compile from a
57 #            checked-out version of the source code.
58
59 # set a couple of defaults for where we should be looking for our support libs.
60 # can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
61
62 apr_src_dir=srclib/apr
63 apu_src_dir=srclib/apr-util
64
65 while test $# -gt 0 
66 do
67   # Normalize
68   case "$1" in
69   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
70   *) optarg= ;;
71   esac
72
73   case "$1" in
74   --with-apr=*)
75   apr_src_dir=$optarg
76   ;;
77   esac
78
79   case "$1" in
80   --with-apr-util=*)
81   apu_src_dir=$optarg
82   ;;
83   esac
84
85   shift
86 done
87
88 #
89 # Check to be sure that we have the srclib dependencies checked-out
90 #
91
92 if [ ! -d "$apr_src_dir" -o ! -f "$apr_src_dir/build/apr_common.m4" ]; then
93     echo ""
94     echo "You don't have a copy of the apr source in $apr_src_dir. " 
95     echo "Please get the source using the following instructions," 
96     echo "or specify the location of the source with " 
97     echo "--with-apr=[path to apr] :"
98     echo ""
99     echo "   cd srclib"
100     echo "   cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login"
101     echo "      (password 'anoncvs')"
102     echo "   cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co apr"
103     echo ""
104     exit 1
105 fi
106 if [ ! -d "$apu_src_dir" -o ! -f "$apu_src_dir/Makefile.in" ]; then
107     echo ""
108     echo "You don't have a copy of the apr-util source in $apu_src_dir. "
109     echo "Please get one the source using the following instructions, "
110     echo "or specify the location of the source with "
111     echo "--with-apr-util=[path to apr-util]:"
112     echo ""
113     echo "   cd srclib"
114     echo "   cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login"
115     echo "      (password 'anoncvs')"
116     echo "   cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co apr-util"
117     echo ""
118     exit 1
119 fi
120
121 # These are temporary until Roy finishes the other build changes
122 #
123 touch .deps
124 rm -f aclocal.m4
125 rm -f generated_lists
126
127 # Remove autoconf 2.5x's cache directory
128 rm -rf autom4te*.cache
129
130 case "`uname`" in
131 *BSD/OS*)
132     ./build/bsd_makefile;;
133 esac
134 #
135 # end temporary stuff
136
137 apr_configure="$apr_src_dir/configure"
138 aprutil_configure="$apu_src_dir/configure"
139 pcre_configure="srclib/pcre/configure"
140 config_h_in="include/ap_config_auto.h.in"
141
142 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
143
144 if [ -d srclib/apr ]; then
145     echo rebuilding $apr_configure
146     (cd srclib/apr && ./buildconf) || {
147         echo "./buildconf failed for apr"
148         exit 1
149     }
150 fi
151
152 if [ -d srclib/apr-util ]; then
153     echo rebuilding $aprutil_configure
154     (cd srclib/apr-util && ./buildconf) || {
155         echo "./buildconf failed for apr-util" 
156         exit 1
157     }
158 fi
159
160 echo copying build files
161 cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
162    $apr_src_dir/build/PrintPath $apr_src_dir/build/apr_common.m4 \
163    $apr_src_dir/build/find_apr.m4 $apu_src_dir/build/find_apu.m4 build
164
165 # Remove any libtool files so one can switch between libtool 1.3
166 # and libtool 1.4 by simply rerunning the buildconf script.
167 (cd build ; rm -f ltconfig ltmain.sh)
168
169 # Optionally copy libtool-1.3.x files
170 if [ -f $apr_src_dir/build/ltconfig ]; then
171     cp $apr_src_dir/build/ltconfig build
172 fi
173 if [ -f $apr_src_dir/build/ltmain.sh ]; then
174     cp $apr_src_dir/build/ltmain.sh build
175 fi
176
177 echo rebuilding $pcre_configure
178 (cd srclib/pcre && ${AUTOCONF:-autoconf})
179
180 echo rebuilding $config_h_in
181 rm -f $config_h_in
182 ${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning"
183
184 echo rebuilding configure
185 rm -f config.cache
186 ${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning"
187
188 if [ -f `which cut` ]; then
189   echo rebuilding rpm spec file
190   ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
191     REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
192     VERSION=`echo $REVISION | cut -d- -s -f1`
193     RELEASE=`echo $REVISION | cut -d- -s -f2`
194     if [ "x$VERSION" = "x" ]; then
195       VERSION=$REVISION
196       RELEASE=1
197     fi
198     cat ./build/rpm/httpd.spec.in | \
199     sed -e "s/APACHE_VERSION/$VERSION/" \
200         -e "s/APACHE_RELEASE/$RELEASE/" \
201         -e "s/APACHE_MMN/$VMMN/" \
202     > httpd.spec )
203 fi
204
205 # ensure that the mod_ssl expression parser sources are never regenerated
206 # when running make
207 echo fixing timestamps for mod_ssl sources
208 cd modules/ssl
209 touch ssl_expr_parse.y
210 sleep 1
211 touch ssl_expr_parse.c ssl_expr_parse.h ssl_expr_scan.l
212 sleep 1
213 touch ssl_expr_scan.c
214 cd ../..
215
216 exit 0