#!/bin/sh
#
# Copyright 2001 horms <horms@vergenet.net>
# (heavily mangled by alanr)
#
# bootstrap: set up the project and get it ready to make
#
# Basically, we run autoconf, automake and libtool in the
# right way to get things set up for this environment.
#
# We also look and see if those tools are installed, and
# tell you where to get them if they're not.
#
# Our goal is to not require dragging along anything
# more than we need. If this doesn't work on your system,
# (i.e., your /bin/sh is broken) send us a patch.
#
# This code loosely based on the corresponding named script in
# enlightenment, and also on the sort-of-standard autoconf
# bootstrap script.
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
CONFIG=$srcdir/configure
if
[ X$srcdir = "X" ]
then
srcdir=.
fi
case "$*" in
--help) IsHelp=yes;;
-?) IsHelp=yes; set -- --help;;
*) IsHelp=no;;
esac
set -e
#
# All errors are fatal from here on out...
# The shell will complain and exit on any "uncaught" error code.
#
#
# And the trap will ensure sure some kind of error message comes out.
#
trap 'echo ""; echo "$0 exiting due to error (sorry!)." >&2' 0
HERE=`pwd`
cd $srcdir
RC=0
gnu="ftp://ftp.gnu.org/pub/gnu/"
for command in autoconf automake libtoolize
do
pkg=$command
case $command in
libtoolize) pkg=libtool;;
esac
URL=$gnu/$pkg/
if
$command --version </dev/null >/dev/null 2>&1
then
: OK $pkg is installed
else
RC=$?
cat <<-!EOF >&2
You must have $pkg installed to compile the linux-ha package.
Download the appropriate package for your system,
or get the source tarball at: $URL
!EOF
fi
done
case $RC in
0) ;;
*) exit $RC;;
esac
case $IsHelp in
yes) $CONFIG "$@"; trap '' 0; exit 0;;
esac
if
[ $# -lt 1 ]
then
cat <<-!
Running $CONFIG with no arguments.
If you wish to pass any arguments to $CONFIG please
specify them on the $0 command line.
!
fi
oneline() {
read x; echo "$x"
}
AC_version=`autoconf --version | oneline | sed -e 's%^[^0-9]*%%'`
AC_majvers=`echo "$AC_version" | sed 's%\..*%%'`
AC_minvers=`echo "$AC_version" | sed 's%^.*\.%%'`
AC_minnum=`echo "$AC_minvers" | sed 's%[^0-9].*%%'`
if
[ $AC_majvers -gt 2 -o $AC_majvers -eq 2 -a $AC_minnum -ge 53 ]
then
needspatch=yes
else
needspatch=no
fi
if
grep 'AC_PREREQ.*2.53' configure.in >/dev/null 2>&1
then
haspatch=yes
else
haspatch=no
fi
if
[ $haspatch = no -a $needspatch = yes ]
then
echo "Applying 2.53 patch for autoconf version $AC_version"
patch < autoconf-2.53.diff
elif
[ $haspatch = yes -a $needspatch = no ]
then
echo "Applying pre-2.53 patch for autoconf version $AC_version"
patch --reverse < autoconf-2.53.diff
fi
LT_version=`libtool --version | oneline | sed -e 's%^[^0-9]*%%' -e s'% .*%%'`
LT_majvers=`echo "$LT_version" | sed -e 's%\..*%%'`
LT_minvers=`echo "$LT_version" | sed -e 's%^[^.]*\.%%' `
LT_minnum=`echo "$LT_minvers" | sed -e 's%[^0-9].*%%'`
if
[ $LT_majvers -lt 1 -o $LT_minnum -lt 4 ]
then
echo "Minimum version of libtool is 1.4. You have $LT_version installed."
exit 1
fi
echo aclocal $ACLOCAL_FLAGS
aclocal $ACLOCAL_FLAGS
if
echo autoheader --version < /dev/null > /dev/null 2>&1
autoheader --version < /dev/null > /dev/null 2>&1
then
echo autoheader
autoheader
fi
echo libtoolize --ltdl --force --copy
libtoolize --ltdl --force --copy
echo automake --add-missing --include-deps --copy
automake --add-missing --include-deps --copy
echo autoconf
autoconf
test -f libtool.m4 || touch libtool.m4
test -f ltdl.m4 || touch ltdl.m4
cd $HERE
echo $CONFIG "$@"
$CONFIG "$@"
echo "Now type 'gmake' to compile the system, noting that"
echo "'gmake' is often available as 'make'."
echo
trap '' 0
syntax highlighted by Code2HTML, v. 0.9.1