Fix compiler warning due to missing function prototype.
[svn.git] / autogen.sh
blob64c2b8a2c8d7688caab613702e1e75d1ff644fb1
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`"
43 lt_major_version=`$libtoolize --version 2>/dev/null | sed -e 's/^[^0-9]*//' -e 's/\..*//' -e '/^$/d' -e 1q`
45 if [ "x$libtoolize" = "x" ]; then
46 echo "libtoolize not found in path"
47 exit 1
50 rm -f build/config.guess build/config.sub
51 $libtoolize --copy --automake --force
53 ltpath="`dirname $libtoolize`"
54 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
56 if [ ! -f $ltfile ]; then
57 echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
58 exit 1
61 echo "Copying libtool helper: $ltfile"
62 # An ancient helper might already be present from previous builds,
63 # and it might be write-protected (e.g. mode 444, seen on FreeBSD).
64 # This would cause cp to fail and print an error message, but leave
65 # behind a potentially outdated libtool helper. So, remove before
66 # copying:
67 rm -f build/libtool.m4
68 cp $ltfile build/libtool.m4
70 for file in ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4; do
71 rm -f build/$file
73 if [ $lt_major_version -ge 2 ]; then
74 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/$file}
76 if [ ! -f $ltfile ]; then
77 echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
78 exit 1
81 echo "Copying libtool helper: $ltfile"
82 cp $ltfile build/$file
84 done
86 if [ $lt_major_version -ge 2 ]; then
87 for file in config.guess config.sub; do
88 configfile=${LIBTOOL_CONFIG-`cd $ltpath/../share/libtool/config ; pwd`/$file}
90 if [ ! -f $configfile ]; then
91 echo "$configfile not found (try setting the LIBTOOL_CONFIG environment variable)"
92 exit 1
95 cp $configfile build/$file
96 done
99 # Create the file detailing all of the build outputs for SVN.
101 # Note: this dependency on Python is fine: only SVN developers use autogen.sh
102 # and we can state that dev people need Python on their machine. Note
103 # that running gen-make.py requires Python 2.X or newer.
105 PYTHON="`./build/find_python.sh`"
106 if test -z "$PYTHON"; then
107 echo "Python 2.2 or later is required to run autogen.sh"
108 echo "If you have a suitable Python installed, but not on the"
109 echo "PATH, set the environment variable PYTHON to the full path"
110 echo "to the Python executable, and re-run autogen.sh"
111 exit 1
114 # Compile SWIG headers into standalone C files if we are in release mode
115 if test -n "$RELEASE_MODE"; then
116 echo "Generating SWIG code..."
117 # Generate build-outputs.mk in non-release-mode, so that we can
118 # build the SWIG-related files
119 "$PYTHON" ./gen-make.py build.conf || gen_failed=1
121 # Build the SWIG-related files
122 make -f autogen-standalone.mk autogen-swig
125 if test -n "$SKIP_DEPS"; then
126 echo "Creating build-outputs.mk (no dependencies)..."
127 "$PYTHON" ./gen-make.py $RELEASE_ARGS -s build.conf || gen_failed=1
128 else
129 echo "Creating build-outputs.mk..."
130 "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1
133 if test -n "$RELEASE_MODE"; then
134 find build/ -name '*.pyc' -exec rm {} \;
137 rm autogen-standalone.mk
139 if test -n "$gen_failed"; then
140 echo "ERROR: gen-make.py failed"
141 exit 1
144 # Produce config.h.in
145 echo "Creating svn_private_config.h.in..."
146 ${AUTOHEADER:-autoheader}
148 # If there's a config.cache file, we may need to delete it.
149 # If we have an existing configure script, save a copy for comparison.
150 if [ -f config.cache ] && [ -f configure ]; then
151 cp configure configure.$$.tmp
154 # Produce ./configure
155 echo "Creating configure..."
156 ${AUTOCONF:-autoconf}
158 # If we have a config.cache file, toss it if the configure script has
159 # changed, or if we just built it for the first time.
160 if [ -f config.cache ]; then
162 [ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1
163 ) || (
164 echo "Tossing config.cache, since configure has changed."
165 rm config.cache
167 rm -f configure.$$.tmp
170 # Remove autoconf 2.5x's cache directory
171 rm -rf autom4te*.cache
173 echo ""
174 echo "You can run ./configure now."
175 echo ""
176 echo "Running autogen.sh implies you are a maintainer. You may prefer"
177 echo "to run configure in one of the following ways:"
178 echo ""
179 echo "./configure --enable-maintainer-mode"
180 echo "./configure --disable-shared"
181 echo "./configure --enable-maintainer-mode --disable-shared"
182 echo ""
183 echo "Note: If you wish to run a Subversion HTTP server, you will need"
184 echo "Apache 2.x. See the INSTALL file for details."
185 echo ""