autogen.sh revision 285830
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 27RELEASE_MODE="" 28RELEASE_ARGS="" 29SKIP_DEPS="" 30while 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 49done 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 62libtoolize="`./build/PrintPath glibtoolize libtoolize libtoolize15`" 63lt_major_version=`$libtoolize --version 2>/dev/null | sed -e 's/^[^0-9]*//' -e 's/\..*//' -e '/^$/d' -e 1q` 64 65if [ "x$libtoolize" = "x" ]; then 66 echo "libtoolize not found in path" 67 exit 1 68fi 69 70rm -f build/config.guess build/config.sub 71$libtoolize --copy --automake --force 72 73ltpath="`dirname $libtoolize`" 74ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4} 75 76if [ ! -f $ltfile ]; then 77 echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)" 78 exit 1 79fi 80 81echo "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: 87rm -f build/libtool.m4 88cp $ltfile build/libtool.m4 89 90for 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 104done 105 106if [ $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 117fi 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 125PYTHON="`./build/find_python.sh`" 126if 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 132fi 133 134# Compile SWIG headers into standalone C files if we are in release mode 135if 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 146fi 147 148if 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 151else 152 echo "Creating build-outputs.mk..." 153 "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1 154fi 155 156if test -n "$RELEASE_MODE"; then 157 find build/ -name '*.pyc' -exec rm {} \; 158fi 159 160rm autogen-standalone.mk 161 162if test -n "$gen_failed"; then 163 echo "ERROR: gen-make.py failed" 164 exit 1 165fi 166 167# Produce config.h.in 168echo "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. 173if [ -f config.cache ] && [ -f configure ]; then 174 cp configure configure.$$.tmp 175fi 176 177# Produce ./configure 178echo "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. 183if [ -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 191fi 192 193# Remove autoconf 2.5x's cache directory 194rm -rf autom4te*.cache 195 196echo "" 197echo "You can run ./configure now." 198echo "" 199echo "Running autogen.sh implies you are a maintainer. You may prefer" 200echo "to run configure in one of the following ways:" 201echo "" 202echo "./configure --enable-maintainer-mode" 203echo "./configure --disable-shared" 204echo "./configure --enable-maintainer-mode --disable-shared" 205echo "./configure --disable-optimize --enable-debug" 206echo "./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'" 207echo "" 208echo "Note: If you wish to run a Subversion HTTP server, you will need" 209echo "Apache 2.x. See the INSTALL file for details." 210echo "" 211