#! /bin/sh
#
# Extended Template Library Bootstrap Script
# $Id: bootstrap,v 1.2 2005/01/04 01:54:14 darco Exp $
#
# This script creates the configure script and Makefile.in files,
# and also fixes a few things in both to ensure a smooth build
# on all compilers and platforms.
#
# Grab the current directory and move to our own
CURR_DIR=$(pwd)
cd $(dirname $0)
# Environment Variables
BOOTSTRAP_NAME=$(basename $0)
CONFIG_DIR=$(pwd)/config
. $CONFIG_DIR/build.cfg
SED_SCRIPT="
s/@PACKAGE@/$PACKAGE/g;
s/@PACKAGE_NAME@/$PACKAGE_NAME/g;
s/@PACKAGE_BUGREPORT@/$PACKAGE_BUGREPORT/g;
s/@PACKAGE_TARNAME@/$PACKAGE_TARNAME/g;
s/@PACKAGE_VERSION@/$PACKAGE_VERSION/g;
s/@VERSION@/$VERSION/g;
s/@VERSION_MAJ@/$VERSION_MAJ/g;
s/@VERSION_MIN@/$VERSION_MIN/g;
s/@VERSION_REV@/$VERSION_REV/g;
s/@VERSION_REL@/$VERSION_REL/g;
s/@CFLAGS@//g;
"
# Required automake and autoconf versions
AUTOCONF_VERSION=2.5
AUTOMAKE_VERSION=1.6
LIBTOOL_VERSION=1.4
export WANT_AUTOMAKE=1.6;
export WANT_AUTOCONF_2_5=1;
# Define the output function
output () {
echo $BOOTSTRAP_NAME: $*
}
# Define the cleanup function
cleanup () {
output Cleaning up...
rm -fr config.cache autom4te.cache configure.in $TEMPFILE
}
output Prepairing build environment for $PACKAGE-$VERSION...
# Look for the CVS directory. If we don't find it, we need to
# ask the user if they know what they are doing.
test -d CVS ||
{
echo "
$BOOTSTRAP_NAME: warning: This shell script is intended for those
$BOOTSTRAP_NAME: warning: who either know what they are doing or
$BOOTSTRAP_NAME: warning: or downloaded this program from the CVS
$BOOTSTRAP_NAME: warning: repository. See README for more details.
$BOOTSTRAP_NAME: warning: To avoid seeing this message in the future,
$BOOTSTRAP_NAME: warning: create an empty directory called 'CVS'."
echo Waiting for 15 seconds...
sleep 15
}
# Create the temporary file
output Creating temporary file...
TEMPFILE=`mktemp /tmp/$BOOTSTRAP_NAME.XXXXXX` ||
{
output ERROR: Unable to create temporary file!
exit 1
}
# Check for autoconf
(which autoconf > /dev/null 2>&1 ) ||
{
output error: 'Could not find GNU autoconf!'
output You need to download and install GNU autoconf v2.52 or higher.
output '<ftp://ftp.gnu.org/gnu/autoconf>'
cleanup;
exit 1
}
# Check autoconf version
output Using $(autoconf --version | grep utoconf)
autoconf --version | grep -q "$AUTOCONF_VERSION" || echo \
"$BOOTSTRAP_NAME: warning: Unexpected version of GNU Autoconf (expected $AUTOCONF_VERSION)
$BOOTSTRAP_NAME: warning: *** Bootstrap process may fail!"
# Check for automake
(which automake > /dev/null 2>&1 ) ||
{
output error: 'Could not find GNU automake!'
output You need to download and install GNU automake v1.5 or higher.
output '<ftp://ftp.gnu.org/gnu/automake>'
cleanup;
exit 1
}
# Check automake version
output Using $(automake --version | grep utomake)
automake --version | grep -q "$AUTOMAKE_VERSION" || echo \
"$BOOTSTRAP_NAME: warning: Unexpected version of GNU Automake (expected $AUTOMAKE_VERSION)
$BOOTSTRAP_NAME: warning: *** Bootstrap process may fail!"
for FILENAME in doxygen.cfg pkgconfig.pc project.spec ; do {
output Creating $FILENAME...
sed "$SED_SCRIPT" < $CONFIG_DIR/$FILENAME.in > $FILENAME;
} ; done
output Renaming pkgconfig.pc to $PACKAGE_TARNAME.pc.in...
mv pkgconfig.pc "$PACKAGE_TARNAME.pc.in"
output Renaming project.spec to $PACKAGE-$VERSION.spec...
mv project.spec "$PACKAGE-$VERSION.spec"
output Finishing up $PACKAGE-$VERSION.spec...
echo %changelog >> "$PACKAGE-$VERSION.spec"
cat ChangeLog >> "$PACKAGE-$VERSION.spec"
output Creating configure.in from configure.ac...
sed "$SED_SCRIPT" < $CONFIG_DIR/configure.ac > configure.in;
output Setting up build environment...
# Set the shell to output what we are doing
set -x
# Create all of the build environment files
(
aclocal -I $CONFIG_DIR $ACLOCAL_FLAGS &&
autoheader &&
autoconf -o configure &&
automake --foreign --add-missing --copy --include-deps
) ||
{
# Something went wrong...
set +x
echo $BOOTSTRAP_NAME: Failure.
cleanup;
exit 1
}
# Turn off echoing of commands
set +x
#output Patching configure script to look for gcc3...
#sed "
#s/g++ c++/g++3 g++ c++/;
#s/gcc cc/gcc3 gcc cc/;
#s:PREFIX/include:PREFIX/include/ETL:;
#" < configure > $TEMPFILE
#cp $TEMPFILE configure
# Patch the Makefile.am files
for filename in $(find Makefile.in ETL test -name Makefile.in) ; do {
echo $BOOTSTRAP_NAME: Patching $filename
(
cp $filename $TEMPFILE &&
sed "
s;-I. ;;
s;-I"'$(srcdir)'" ;-I"'$(top_srcdir)'" ;
s;configure.in;config/configure.ac;
" < $TEMPFILE > $filename
) ||
{
# Patch failure
echo $BOOTSTRAP_NAME: Failure. Unable to patch $filename.
cleanup;
exit 1
}
}; done
echo $BOOTSTRAP_NAME: Creating Makefile...
( echo "
all:
./configure --enable-maintainer-mode
make all
install:
./configure --enable-maintainer-mode
make install
check:
./configure --enable-maintainer-mode
make check
distcheck:
./configure --enable-maintainer-mode
make check
dist:
./configure --enable-maintainer-mode
make dist
docs: doxygen.cfg
doxygen doxygen.cfg
" ) > Makefile
echo $BOOTSTRAP_NAME: Complete.
cleanup;
# Move back to the current directory
cd $CURR_DIR