]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/subversion/autogen.sh
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / subversion / autogen.sh
1 #!/bin/sh
2 #
3 #
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
11 #
12 #   http://www.apache.org/licenses/LICENSE-2.0
13 #
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
19 # under the License.
20 #
21 #
22
23 ### Run this to produce everything needed for configuration. ###
24
25
26 # Run tests to ensure that our build requirements are met
27 RELEASE_MODE=""
28 RELEASE_ARGS=""
29 SKIP_DEPS=""
30 while test $# != 0; do
31   case "$1" in
32     --release)
33       RELEASE_MODE="$1"
34       RELEASE_ARGS="--release"
35       shift
36       ;;
37     -s)
38       SKIP_DEPS="yes"
39       shift
40       ;;
41     --)         # end of option parsing
42       break
43       ;;
44     *)
45       echo "invalid parameter: '$1'"
46       exit 1
47       ;;
48   esac
49 done
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
55
56 # Handle some libtool helper files
57 #
58 # ### eventually, we can/should toss this in favor of simply using
59 # ### APR's libtool. deferring to a second round of change...
60 #
61
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`
64
65 if [ "x$libtoolize" = "x" ]; then
66     echo "libtoolize not found in path"
67     exit 1
68 fi
69
70 rm -f build/config.guess build/config.sub
71 $libtoolize --copy --automake --force
72
73 ltpath="`dirname $libtoolize`"
74 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
75
76 if [ ! -f $ltfile ]; then
77     echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
78     exit 1
79 fi
80
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
86 # copying:
87 rm -f build/libtool.m4
88 cp $ltfile build/libtool.m4
89
90 for file in ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4; do
91     rm -f build/$file
92
93     if [ $lt_major_version -ge 2 ]; then
94         ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/$file}
95
96         if [ ! -f $ltfile ]; then
97             echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
98             exit 1
99         fi
100
101         echo "Copying libtool helper: $ltfile"
102         cp $ltfile build/$file
103     fi
104 done
105
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}
109
110         if [ ! -f $configfile ]; then
111             echo "$configfile not found (try setting the LIBTOOL_CONFIG environment variable)"
112             exit 1
113         fi
114
115         cp $configfile build/$file
116     done
117 fi
118
119 # Create the file detailing all of the build outputs for SVN.
120 #
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.
124
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"
131   exit 1
132 fi
133
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
140
141   # Build the SWIG-related files
142   make -f autogen-standalone.mk autogen-swig
143
144   # Remove the .swig_checked file
145   rm -f .swig_checked
146 fi
147
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
151 else
152   echo "Creating build-outputs.mk..."
153   "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1
154 fi
155
156 if test -n "$RELEASE_MODE"; then
157   find build/ -name '*.pyc' -exec rm {} \;
158 fi
159
160 rm autogen-standalone.mk
161
162 if test -n "$gen_failed"; then
163   echo "ERROR: gen-make.py failed"
164   exit 1
165 fi
166
167 # Produce config.h.in
168 echo "Creating svn_private_config.h.in..."
169 ${AUTOHEADER:-autoheader}
170
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
175 fi
176
177 # Produce ./configure
178 echo "Creating configure..."
179 ${AUTOCONF:-autoconf}
180
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
184   (
185     [ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1
186   ) || (
187     echo "Tossing config.cache, since configure has changed."
188     rm config.cache
189   )
190   rm -f configure.$$.tmp
191 fi
192
193 # Remove autoconf 2.5x's cache directory
194 rm -rf autom4te*.cache
195
196 echo ""
197 echo "You can run ./configure now."
198 echo ""
199 echo "Running autogen.sh implies you are a maintainer.  You may prefer"
200 echo "to run configure in one of the following ways:"
201 echo ""
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++'"
207 echo ""
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."
210 echo ""