4 # Licensed to the Apache Software Foundation (ASF) under one
5 # or more contributor license agreements. See the NOTICE file
6 # distributed with this work for additional information
7 # regarding copyright ownership. The ASF licenses this file
8 # to you under the Apache License, Version 2.0 (the
9 # "License"); you may not use this file except in compliance
10 # with the License. You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing,
15 # software distributed under the License is distributed on an
16 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 # KIND, either express or implied. See the License for the
18 # specific language governing permissions and limitations
23 ### Run this to produce everything needed for configuration. ###
26 # Some shells can produce output when running 'cd' which interferes
27 # with the construct 'abs=`cd dir && pwd`'.
28 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
30 # Run tests to ensure that our build requirements are met
34 while test $# != 0; do
38 RELEASE_ARGS="--release"
45 --) # end of option parsing
49 echo "invalid parameter: '$1'"
54 # ### The order of parameters is important; buildcheck.sh depends on it and
55 # ### we don't want to copy the fancy option parsing loop there. For the
56 # ### same reason, all parameters should be quoted, so that buildcheck.sh
57 # ### sees an empty arg rather than missing one.
58 ./build/buildcheck.sh "$RELEASE_MODE" || exit 1
60 # Handle some libtool helper files
62 # ### eventually, we can/should toss this in favor of simply using
63 # ### APR's libtool. deferring to a second round of change...
66 libtoolize="`./build/PrintPath glibtoolize libtoolize libtoolize15`"
67 lt_major_version=`$libtoolize --version 2>/dev/null | sed -e 's/^[^0-9]*//' -e 's/\..*//' -e '/^$/d' -e 1q`
69 if [ "x$libtoolize" = "x" ]; then
70 echo "libtoolize not found in path"
74 rm -f build/config.guess build/config.sub
75 $libtoolize --copy --automake --force
77 ltpath="`dirname $libtoolize`"
79 if [ "x$LIBTOOL_M4" = "x" ]; then
80 ltm4_error='(try setting the LIBTOOL_M4 environment variable)'
81 if [ -d "$ltpath/../share/aclocal/." ]; then
82 ltm4=`cd "$ltpath/../share/aclocal" && pwd`
84 echo "Libtool helper path not found $ltm4_error"
85 echo " expected at: '$ltpath/../share/aclocal'"
89 ltm4_error="(the LIBTOOL_M4 environment variable is: $LIBTOOL_M4)"
93 ltfile="$ltm4/libtool.m4"
94 if [ ! -f "$ltfile" ]; then
95 echo "$ltfile not found $ltm4_error"
99 echo "Copying libtool helper: $ltfile"
100 # An ancient helper might already be present from previous builds,
101 # and it might be write-protected (e.g. mode 444, seen on FreeBSD).
102 # This would cause cp to fail and print an error message, but leave
103 # behind a potentially outdated libtool helper. So, remove before
105 rm -f build/libtool.m4
106 cp "$ltfile" build/libtool.m4
108 for file in ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4; do
111 if [ $lt_major_version -ge 2 ]; then
114 if [ ! -f "$ltfile" ]; then
115 echo "$ltfile not found $ltm4_error"
119 echo "Copying libtool helper: $ltfile"
120 cp "$ltfile" "build/$file"
124 if [ $lt_major_version -ge 2 ]; then
125 if [ "x$LIBTOOL_CONFIG" = "x" ]; then
126 ltconfig_error='(try setting the LIBTOOL_CONFIG environment variable)'
127 if [ -d "$ltpath/../share/libtool/config/." ]; then
128 ltconfig=`cd "$ltpath/../share/libtool/config" && pwd`
129 elif [ -d "$ltpath/../share/libtool/build-aux/." ]; then
130 ltconfig=`cd "$ltpath/../share/libtool/build-aux" && pwd`
132 echo "Autoconf helper path not found $ltconfig_error"
133 echo " expected at: '$ltpath/../share/libtool/config'"
134 echo " or: '$ltpath/../share/libtool/build-aux'"
138 ltconfig_error="(the LIBTOOL_CONFIG environment variable is: $LIBTOOL_CONFIG)"
139 ltconfig="$LIBTOOL_CONFIG"
142 for file in config.guess config.sub; do
143 configfile="$ltconfig/$file"
145 if [ ! -f "$configfile" ]; then
146 echo "$configfile not found $ltconfig_error"
150 echo "Copying autoconf helper: $configfile"
151 cp "$configfile" build/$file
155 # Create the file detailing all of the build outputs for SVN.
157 # Note: this dependency on Python is fine: only SVN developers use autogen.sh
158 # and we can state that dev people need Python on their machine. Note
159 # that running gen-make.py requires Python 2.5 or newer.
161 PYTHON="`./build/find_python.sh`"
162 if test -z "$PYTHON"; then
163 echo "Python 2.5 or later is required to run autogen.sh"
164 echo "If you have a suitable Python installed, but not on the"
165 echo "PATH, set the environment variable PYTHON to the full path"
166 echo "to the Python executable, and re-run autogen.sh"
170 # Compile SWIG headers into standalone C files if we are in release mode
171 if test -n "$RELEASE_MODE"; then
172 echo "Generating SWIG code..."
173 # Generate build-outputs.mk in non-release-mode, so that we can
174 # build the SWIG-related files
175 "$PYTHON" ./gen-make.py build.conf || gen_failed=1
177 # Build the SWIG-related files
178 make -f autogen-standalone.mk autogen-swig
180 # Remove the .swig_checked file
184 if test -n "$SKIP_DEPS"; then
185 echo "Creating build-outputs.mk (no dependencies)..."
186 "$PYTHON" ./gen-make.py $RELEASE_ARGS -s build.conf || gen_failed=1
188 echo "Creating build-outputs.mk..."
189 "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1
192 if test -n "$RELEASE_MODE"; then
193 find build/ -name '*.pyc' -exec rm {} \;
196 rm autogen-standalone.mk
198 if test -n "$gen_failed"; then
199 echo "ERROR: gen-make.py failed"
203 # Produce config.h.in
204 echo "Creating svn_private_config.h.in..."
205 ${AUTOHEADER:-autoheader}
207 # If there's a config.cache file, we may need to delete it.
208 # If we have an existing configure script, save a copy for comparison.
209 if [ -f config.cache ] && [ -f configure ]; then
210 cp configure configure.$$.tmp
213 # Produce ./configure
214 echo "Creating configure..."
215 ${AUTOCONF:-autoconf}
217 # If we have a config.cache file, toss it if the configure script has
218 # changed, or if we just built it for the first time.
219 if [ -f config.cache ]; then
221 [ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1
223 echo "Tossing config.cache, since configure has changed."
226 rm -f configure.$$.tmp
229 # Remove autoconf 2.5x's cache directory
230 rm -rf autom4te*.cache
233 echo "You can run ./configure now."
235 echo "Running autogen.sh implies you are a maintainer. You may prefer"
236 echo "to run configure in one of the following ways:"
238 echo "./configure --enable-maintainer-mode"
239 echo "./configure --disable-shared"
240 echo "./configure --enable-maintainer-mode --disable-shared"
241 echo "./configure --disable-optimize --enable-debug"
242 echo "./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'"
244 echo "Note: If you wish to run a Subversion HTTP server, you will need"
245 echo "Apache 2.x. See the INSTALL file for details."