Clear a bunch of error leaks in the svnserve Cyrus SASL
[svn.git] / autogen.sh
blob0770d202332a3c57940418b0c6686213d07d932b
1 #!/bin/sh
3 ### Run this to produce everything needed for configuration. ###
6 # Run tests to ensure that our build requirements are met
7 RELEASE_MODE=""
8 RELEASE_ARGS=""
9 SKIP_DEPS=""
10 while test $# != 0; do
11 case "$1" in
12 --release)
13 RELEASE_MODE="$1"
14 RELEASE_ARGS="--release"
15 shift
17 -s)
18 SKIP_DEPS="yes"
19 shift
21 --) # end of option parsing
22 break
25 echo "invalid parameter: '$1'"
26 exit 1
28 esac
29 done
30 # ### The order of parameters is important; buildcheck.sh depends on it and
31 # ### we don't want to copy the fancy option parsing loop there. For the
32 # ### same reason, all parameters should be quoted, so that buildcheck.sh
33 # ### sees an empty arg rather than missing one.
34 ./build/buildcheck.sh "$RELEASE_MODE" || exit 1
36 # Handle some libtool helper files
38 # ### eventually, we can/should toss this in favor of simply using
39 # ### APR's libtool. deferring to a second round of change...
42 libtoolize="`./build/PrintPath glibtoolize libtoolize libtoolize15`"
44 if [ "x$libtoolize" = "x" ]; then
45 echo "libtoolize not found in path"
46 exit 1
49 $libtoolize --copy --automake
51 ltpath="`dirname $libtoolize`"
52 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
54 if [ ! -f $ltfile ]; then
55 echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
56 exit 1
59 echo "Copying libtool helper: $ltfile"
60 # An ancient helper might already be present from previous builds,
61 # and it might be write-protected (e.g. mode 444, seen on FreeBSD).
62 # This would cause cp to fail and print an error message, but leave
63 # behind a potentially outdated libtool helper. So, remove before
64 # copying:
65 rm -f build/libtool.m4
66 cp $ltfile build/libtool.m4
68 # Create the file detailing all of the build outputs for SVN.
70 # Note: this dependency on Python is fine: only SVN developers use autogen.sh
71 # and we can state that dev people need Python on their machine. Note
72 # that running gen-make.py requires Python 2.X or newer.
74 PYTHON="`./build/find_python.sh`"
75 if test -z "$PYTHON"; then
76 echo "Python 2.2 or later is required to run autogen.sh"
77 echo "If you have a suitable Python installed, but not on the"
78 echo "PATH, set the environment variable PYTHON to the full path"
79 echo "to the Python executable, and re-run autogen.sh"
80 exit 1
83 # Compile SWIG headers into standalone C files if we are in release mode
84 if test -n "$RELEASE_MODE"; then
85 echo "Generating SWIG code..."
86 # Generate build-outputs.mk in non-release-mode, so that we can
87 # build the SWIG-related files
88 "$PYTHON" ./gen-make.py build.conf || gen_failed=1
90 # Build the SWIG-related files
91 make -f autogen-standalone.mk autogen-swig
94 if test -n "$SKIP_DEPS"; then
95 echo "Creating build-outputs.mk (no dependencies)..."
96 "$PYTHON" ./gen-make.py $RELEASE_ARGS -s build.conf || gen_failed=1
97 else
98 echo "Creating build-outputs.mk..."
99 "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1
102 if test -n "$RELEASE_MODE"; then
103 find build/ -name '*.pyc' -exec rm {} \;
106 rm autogen-standalone.mk
108 if test -n "$gen_failed"; then
109 echo "ERROR: gen-make.py failed"
110 exit 1
113 # Produce config.h.in
114 echo "Creating svn_private_config.h.in..."
115 ${AUTOHEADER:-autoheader}
117 # If there's a config.cache file, we may need to delete it.
118 # If we have an existing configure script, save a copy for comparison.
119 if [ -f config.cache ] && [ -f configure ]; then
120 cp configure configure.$$.tmp
123 # Produce ./configure
124 echo "Creating configure..."
125 ${AUTOCONF:-autoconf}
127 # If we have a config.cache file, toss it if the configure script has
128 # changed, or if we just built it for the first time.
129 if [ -f config.cache ]; then
131 [ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1
132 ) || (
133 echo "Tossing config.cache, since configure has changed."
134 rm config.cache
136 rm -f configure.$$.tmp
139 # Remove autoconf 2.5x's cache directory
140 rm -rf autom4te*.cache
142 echo ""
143 echo "You can run ./configure now."
144 echo ""
145 echo "Running autogen.sh implies you are a maintainer. You may prefer"
146 echo "to run configure in one of the following ways:"
147 echo ""
148 echo "./configure --enable-maintainer-mode"
149 echo "./configure --disable-shared"
150 echo "./configure --enable-maintainer-mode --disable-shared"
151 echo ""
152 echo "Note: If you wish to run a Subversion HTTP server, you will need"
153 echo "Apache 2.x. See the INSTALL file for details."
154 echo ""