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 # Run tests to ensure that our build requirements are met
30 while test $# != 0; do
34 RELEASE_ARGS="--release"
41 --) # end of option parsing
45 echo "invalid parameter: '$1'"
50 # ### The order of parameters is important; buildcheck.sh depends on it and
51 # ### we don't want to copy the fancy option parsing loop there. For the
52 # ### same reason, all parameters should be quoted, so that buildcheck.sh
53 # ### sees an empty arg rather than missing one.
54 ./build/buildcheck.sh "$RELEASE_MODE" || exit 1
56 # Handle some libtool helper files
58 # ### eventually, we can/should toss this in favor of simply using
59 # ### APR's libtool. deferring to a second round of change...
62 libtoolize="`./build/PrintPath glibtoolize libtoolize libtoolize15`"
63 lt_major_version=`$libtoolize --version 2>/dev/null | sed -e 's/^[^0-9]*//' -e 's/\..*//' -e '/^$/d' -e 1q`
65 if [ "x$libtoolize" = "x" ]; then
66 echo "libtoolize not found in path"
70 rm -f build/config.guess build/config.sub
71 $libtoolize --copy --automake --force
73 ltpath="`dirname $libtoolize`"
74 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
76 if [ ! -f $ltfile ]; then
77 echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
81 echo "Copying libtool helper: $ltfile"
82 # An ancient helper might already be present from previous builds,
83 # and it might be write-protected (e.g. mode 444, seen on FreeBSD).
84 # This would cause cp to fail and print an error message, but leave
85 # behind a potentially outdated libtool helper. So, remove before
87 rm -f build/libtool.m4
88 cp $ltfile build/libtool.m4
90 for file in ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4; do
93 if [ $lt_major_version -ge 2 ]; then
94 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/$file}
96 if [ ! -f $ltfile ]; then
97 echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
101 echo "Copying libtool helper: $ltfile"
102 cp $ltfile build/$file
106 if [ $lt_major_version -ge 2 ]; then
107 for file in config.guess config.sub; do
108 configfile=${LIBTOOL_CONFIG-`cd $ltpath/../share/libtool/config ; pwd`/$file}
110 if [ ! -f $configfile ]; then
111 echo "$configfile not found (try setting the LIBTOOL_CONFIG environment variable)"
115 cp $configfile build/$file
119 # Create the file detailing all of the build outputs for SVN.
121 # Note: this dependency on Python is fine: only SVN developers use autogen.sh
122 # and we can state that dev people need Python on their machine. Note
123 # that running gen-make.py requires Python 2.5 or newer.
125 PYTHON="`./build/find_python.sh`"
126 if test -z "$PYTHON"; then
127 echo "Python 2.5 or later is required to run autogen.sh"
128 echo "If you have a suitable Python installed, but not on the"
129 echo "PATH, set the environment variable PYTHON to the full path"
130 echo "to the Python executable, and re-run autogen.sh"
134 # Compile SWIG headers into standalone C files if we are in release mode
135 if test -n "$RELEASE_MODE"; then
136 echo "Generating SWIG code..."
137 # Generate build-outputs.mk in non-release-mode, so that we can
138 # build the SWIG-related files
139 "$PYTHON" ./gen-make.py build.conf || gen_failed=1
141 # Build the SWIG-related files
142 make -f autogen-standalone.mk autogen-swig
144 # Remove the .swig_checked file
148 if test -n "$SKIP_DEPS"; then
149 echo "Creating build-outputs.mk (no dependencies)..."
150 "$PYTHON" ./gen-make.py $RELEASE_ARGS -s build.conf || gen_failed=1
152 echo "Creating build-outputs.mk..."
153 "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1
156 if test -n "$RELEASE_MODE"; then
157 find build/ -name '*.pyc' -exec rm {} \;
160 rm autogen-standalone.mk
162 if test -n "$gen_failed"; then
163 echo "ERROR: gen-make.py failed"
167 # Produce config.h.in
168 echo "Creating svn_private_config.h.in..."
169 ${AUTOHEADER:-autoheader}
171 # If there's a config.cache file, we may need to delete it.
172 # If we have an existing configure script, save a copy for comparison.
173 if [ -f config.cache ] && [ -f configure ]; then
174 cp configure configure.$$.tmp
177 # Produce ./configure
178 echo "Creating configure..."
179 ${AUTOCONF:-autoconf}
181 # If we have a config.cache file, toss it if the configure script has
182 # changed, or if we just built it for the first time.
183 if [ -f config.cache ]; then
185 [ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1
187 echo "Tossing config.cache, since configure has changed."
190 rm -f configure.$$.tmp
193 # Remove autoconf 2.5x's cache directory
194 rm -rf autom4te*.cache
197 echo "You can run ./configure now."
199 echo "Running autogen.sh implies you are a maintainer. You may prefer"
200 echo "to run configure in one of the following ways:"
202 echo "./configure --enable-maintainer-mode"
203 echo "./configure --disable-shared"
204 echo "./configure --enable-maintainer-mode --disable-shared"
205 echo "./configure --disable-optimize --enable-debug"
206 echo "./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'"
208 echo "Note: If you wish to run a Subversion HTTP server, you will need"
209 echo "Apache 2.x. See the INSTALL file for details."