autogen.sh revision 251881
1251881Speter#!/bin/sh 2251881Speter# 3251881Speter# 4251881Speter# Licensed to the Apache Software Foundation (ASF) under one 5251881Speter# or more contributor license agreements. See the NOTICE file 6251881Speter# distributed with this work for additional information 7251881Speter# regarding copyright ownership. The ASF licenses this file 8251881Speter# to you under the Apache License, Version 2.0 (the 9251881Speter# "License"); you may not use this file except in compliance 10251881Speter# with the License. You may obtain a copy of the License at 11251881Speter# 12251881Speter# http://www.apache.org/licenses/LICENSE-2.0 13251881Speter# 14251881Speter# Unless required by applicable law or agreed to in writing, 15251881Speter# software distributed under the License is distributed on an 16251881Speter# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17251881Speter# KIND, either express or implied. See the License for the 18251881Speter# specific language governing permissions and limitations 19251881Speter# under the License. 20251881Speter# 21251881Speter# 22251881Speter 23251881Speter### Run this to produce everything needed for configuration. ### 24251881Speter 25251881Speter 26251881Speter# Run tests to ensure that our build requirements are met 27251881SpeterRELEASE_MODE="" 28251881SpeterRELEASE_ARGS="" 29251881SpeterSKIP_DEPS="" 30251881Speterwhile test $# != 0; do 31251881Speter case "$1" in 32251881Speter --release) 33251881Speter RELEASE_MODE="$1" 34251881Speter RELEASE_ARGS="--release" 35251881Speter shift 36251881Speter ;; 37251881Speter -s) 38251881Speter SKIP_DEPS="yes" 39251881Speter shift 40251881Speter ;; 41251881Speter --) # end of option parsing 42251881Speter break 43251881Speter ;; 44251881Speter *) 45251881Speter echo "invalid parameter: '$1'" 46251881Speter exit 1 47251881Speter ;; 48251881Speter esac 49251881Speterdone 50251881Speter# ### The order of parameters is important; buildcheck.sh depends on it and 51251881Speter# ### we don't want to copy the fancy option parsing loop there. For the 52251881Speter# ### same reason, all parameters should be quoted, so that buildcheck.sh 53251881Speter# ### sees an empty arg rather than missing one. 54251881Speter./build/buildcheck.sh "$RELEASE_MODE" || exit 1 55251881Speter 56251881Speter# Handle some libtool helper files 57251881Speter# 58251881Speter# ### eventually, we can/should toss this in favor of simply using 59251881Speter# ### APR's libtool. deferring to a second round of change... 60251881Speter# 61251881Speter 62251881Speterlibtoolize="`./build/PrintPath glibtoolize libtoolize libtoolize15`" 63251881Speterlt_major_version=`$libtoolize --version 2>/dev/null | sed -e 's/^[^0-9]*//' -e 's/\..*//' -e '/^$/d' -e 1q` 64251881Speter 65251881Speterif [ "x$libtoolize" = "x" ]; then 66251881Speter echo "libtoolize not found in path" 67251881Speter exit 1 68251881Speterfi 69251881Speter 70251881Speterrm -f build/config.guess build/config.sub 71251881Speter$libtoolize --copy --automake --force 72251881Speter 73251881Speterltpath="`dirname $libtoolize`" 74251881Speterltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4} 75251881Speter 76251881Speterif [ ! -f $ltfile ]; then 77251881Speter echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)" 78251881Speter exit 1 79251881Speterfi 80251881Speter 81251881Speterecho "Copying libtool helper: $ltfile" 82251881Speter# An ancient helper might already be present from previous builds, 83251881Speter# and it might be write-protected (e.g. mode 444, seen on FreeBSD). 84251881Speter# This would cause cp to fail and print an error message, but leave 85251881Speter# behind a potentially outdated libtool helper. So, remove before 86251881Speter# copying: 87251881Speterrm -f build/libtool.m4 88251881Spetercp $ltfile build/libtool.m4 89251881Speter 90251881Speterfor file in ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4; do 91251881Speter rm -f build/$file 92251881Speter 93251881Speter if [ $lt_major_version -ge 2 ]; then 94251881Speter ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/$file} 95251881Speter 96251881Speter if [ ! -f $ltfile ]; then 97251881Speter echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)" 98251881Speter exit 1 99251881Speter fi 100251881Speter 101251881Speter echo "Copying libtool helper: $ltfile" 102251881Speter cp $ltfile build/$file 103251881Speter fi 104251881Speterdone 105251881Speter 106251881Speterif [ $lt_major_version -ge 2 ]; then 107251881Speter for file in config.guess config.sub; do 108251881Speter configfile=${LIBTOOL_CONFIG-`cd $ltpath/../share/libtool/config ; pwd`/$file} 109251881Speter 110251881Speter if [ ! -f $configfile ]; then 111251881Speter echo "$configfile not found (try setting the LIBTOOL_CONFIG environment variable)" 112251881Speter exit 1 113251881Speter fi 114251881Speter 115251881Speter cp $configfile build/$file 116251881Speter done 117251881Speterfi 118251881Speter 119251881Speter# Create the file detailing all of the build outputs for SVN. 120251881Speter# 121251881Speter# Note: this dependency on Python is fine: only SVN developers use autogen.sh 122251881Speter# and we can state that dev people need Python on their machine. Note 123251881Speter# that running gen-make.py requires Python 2.5 or newer. 124251881Speter 125251881SpeterPYTHON="`./build/find_python.sh`" 126251881Speterif test -z "$PYTHON"; then 127251881Speter echo "Python 2.5 or later is required to run autogen.sh" 128251881Speter echo "If you have a suitable Python installed, but not on the" 129251881Speter echo "PATH, set the environment variable PYTHON to the full path" 130251881Speter echo "to the Python executable, and re-run autogen.sh" 131251881Speter exit 1 132251881Speterfi 133251881Speter 134251881Speter# Compile SWIG headers into standalone C files if we are in release mode 135251881Speterif test -n "$RELEASE_MODE"; then 136251881Speter echo "Generating SWIG code..." 137251881Speter # Generate build-outputs.mk in non-release-mode, so that we can 138251881Speter # build the SWIG-related files 139251881Speter "$PYTHON" ./gen-make.py build.conf || gen_failed=1 140251881Speter 141251881Speter # Build the SWIG-related files 142251881Speter make -f autogen-standalone.mk autogen-swig 143251881Speter 144251881Speter # Remove the .swig_checked file 145251881Speter rm -f .swig_checked 146251881Speterfi 147251881Speter 148251881Speterif test -n "$SKIP_DEPS"; then 149251881Speter echo "Creating build-outputs.mk (no dependencies)..." 150251881Speter "$PYTHON" ./gen-make.py $RELEASE_ARGS -s build.conf || gen_failed=1 151251881Speterelse 152251881Speter echo "Creating build-outputs.mk..." 153251881Speter "$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1 154251881Speterfi 155251881Speter 156251881Speterif test -n "$RELEASE_MODE"; then 157251881Speter find build/ -name '*.pyc' -exec rm {} \; 158251881Speterfi 159251881Speter 160251881Speterrm autogen-standalone.mk 161251881Speter 162251881Speterif test -n "$gen_failed"; then 163251881Speter echo "ERROR: gen-make.py failed" 164251881Speter exit 1 165251881Speterfi 166251881Speter 167251881Speter# Produce config.h.in 168251881Speterecho "Creating svn_private_config.h.in..." 169251881Speter${AUTOHEADER:-autoheader} 170251881Speter 171251881Speter# If there's a config.cache file, we may need to delete it. 172251881Speter# If we have an existing configure script, save a copy for comparison. 173251881Speterif [ -f config.cache ] && [ -f configure ]; then 174251881Speter cp configure configure.$$.tmp 175251881Speterfi 176251881Speter 177251881Speter# Produce ./configure 178251881Speterecho "Creating configure..." 179251881Speter${AUTOCONF:-autoconf} 180251881Speter 181251881Speter# If we have a config.cache file, toss it if the configure script has 182251881Speter# changed, or if we just built it for the first time. 183251881Speterif [ -f config.cache ]; then 184251881Speter ( 185251881Speter [ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1 186251881Speter ) || ( 187251881Speter echo "Tossing config.cache, since configure has changed." 188251881Speter rm config.cache 189251881Speter ) 190251881Speter rm -f configure.$$.tmp 191251881Speterfi 192251881Speter 193251881Speter# Remove autoconf 2.5x's cache directory 194251881Speterrm -rf autom4te*.cache 195251881Speter 196251881Speterecho "" 197251881Speterecho "You can run ./configure now." 198251881Speterecho "" 199251881Speterecho "Running autogen.sh implies you are a maintainer. You may prefer" 200251881Speterecho "to run configure in one of the following ways:" 201251881Speterecho "" 202251881Speterecho "./configure --enable-maintainer-mode" 203251881Speterecho "./configure --disable-shared" 204251881Speterecho "./configure --enable-maintainer-mode --disable-shared" 205251881Speterecho "./configure --disable-optimize --enable-debug" 206251881Speterecho "./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'" 207251881Speterecho "" 208251881Speterecho "Note: If you wish to run a Subversion HTTP server, you will need" 209251881Speterecho "Apache 2.x. See the INSTALL file for details." 210251881Speterecho "" 211