2008-03-05 15:38:33 +03:00
|
|
|
#!/bin/bash
|
2006-07-14 20:14:48 +04:00
|
|
|
|
2007-05-23 11:34:50 +04:00
|
|
|
# NOTE:
|
|
|
|
# Versions 1.9 (or higher) of aclocal and automake are required.
|
2011-05-16 18:26:56 +04:00
|
|
|
# And version >=2.60 of autoconf
|
|
|
|
# And version >=1.4.7 of m4
|
2007-05-23 11:34:50 +04:00
|
|
|
|
|
|
|
# For Mac OSX users:
|
|
|
|
# Standard distribution usually includes versions 1.6.
|
|
|
|
# Get versions 1.9 or higher
|
|
|
|
# Set the following variable to the correct paths
|
|
|
|
#ACLOCAL="/path/to/aclocal-1.9"
|
|
|
|
#AUTOMAKE="/path/to/automake-1.9"
|
|
|
|
|
2007-02-15 04:50:26 +03:00
|
|
|
function die () {
|
|
|
|
echo "$@" >&2
|
2011-09-26 18:56:47 +04:00
|
|
|
|
|
|
|
# Try to be as helpful as possible by detecting OS and making recommendations
|
|
|
|
if (( $(lsb_release -a | fgrep -ci "ubuntu") > 0 )); then
|
|
|
|
echo >&2
|
|
|
|
echo >&2 "Need to install build autotools on Ubuntu? Use:"
|
|
|
|
echo >&2 "sudo aptitude install autoconf automake libtool build-essential"
|
|
|
|
fi
|
|
|
|
if (( $(uname -a | fgrep -ci "darwin") > 0 )); then
|
|
|
|
echo >&2
|
|
|
|
echo >&2 "Having problems on Mac OSX?"
|
|
|
|
echo >&2 "You might have an old version of aclocal/automake. You'll need to upgrade these."
|
|
|
|
fi
|
2007-02-15 04:50:26 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2011-09-26 18:56:47 +04:00
|
|
|
if [ -z "$ACLOCAL" ]; then
|
2007-03-31 19:18:01 +04:00
|
|
|
ACLOCAL=`which aclocal`
|
2011-09-26 18:56:47 +04:00
|
|
|
[ -n "$ACLOCAL" ] || die "aclocal not found on your system. Please install it or set $ACLOCAL"
|
2007-03-31 19:18:01 +04:00
|
|
|
fi
|
|
|
|
|
2011-09-26 18:56:47 +04:00
|
|
|
if [ -z "$AUTOMAKE" ]; then
|
2007-03-31 19:18:01 +04:00
|
|
|
AUTOMAKE=`which automake`
|
2011-09-26 18:56:47 +04:00
|
|
|
[ -n "$AUTOMAKE" ] || die "automake not found on your system. Please install it or set $AUTOMAKE"
|
2007-03-31 19:18:01 +04:00
|
|
|
fi
|
|
|
|
|
2011-09-26 18:56:47 +04:00
|
|
|
if [ -z "$AUTOCONF" ]; then
|
2007-03-31 19:18:01 +04:00
|
|
|
AUTOCONF=`which autoconf`
|
2011-09-26 18:56:47 +04:00
|
|
|
[ -n "$AUTOCONF" ] || die "autoconf not found on your system. Please install it or set $AUTOCONF"
|
2007-03-31 19:18:01 +04:00
|
|
|
fi
|
|
|
|
|
2011-09-26 18:56:47 +04:00
|
|
|
if [ -z "$LIBTOOLIZE" ]; then
|
2010-02-24 12:27:18 +03:00
|
|
|
LIBTOOLIZE=`which libtoolize`
|
2011-11-11 12:47:07 +04:00
|
|
|
|
2011-09-26 18:56:47 +04:00
|
|
|
if [ -z "$LIBTOOLIZE" ]; then
|
2010-05-22 05:04:44 +04:00
|
|
|
LIBTOOLIZE=`which glibtoolize`
|
|
|
|
fi
|
2011-09-26 18:56:47 +04:00
|
|
|
|
|
|
|
[ -n "$LIBTOOLIZE" ] || die "libtoolize/glibtoolize not found on your system. Please install it or set $LIBTOOLIZE"
|
2010-02-24 12:27:18 +03:00
|
|
|
fi
|
|
|
|
|
2011-09-26 18:56:47 +04:00
|
|
|
echo >&2 "Detected aclocal: $($ACLOCAL --version | head -n1)"
|
|
|
|
echo >&2 "Detected autoconf: $($AUTOCONF --version | head -n1)"
|
|
|
|
echo >&2 "Detected automake: $($AUTOMAKE --version | head -n1)"
|
|
|
|
echo >&2 "Detected libtoolize: $($LIBTOOLIZE --version | head -n1)"
|
2007-03-31 19:18:01 +04:00
|
|
|
|
|
|
|
echo "Calling $ACLOCAL..."
|
2009-08-07 20:47:54 +04:00
|
|
|
$ACLOCAL -I m4 || die "aclocal failed"
|
2007-03-31 19:18:01 +04:00
|
|
|
echo "Calling $AUTOCONF..."
|
2009-08-07 20:47:54 +04:00
|
|
|
$AUTOCONF || die "autoconf failed"
|
2011-10-20 19:20:58 +04:00
|
|
|
rm ltmain.sh 2>/dev/null
|
2011-10-19 13:05:48 +04:00
|
|
|
touch ltmain.sh
|
2007-03-31 19:18:01 +04:00
|
|
|
echo "Calling $AUTOMAKE..."
|
|
|
|
$AUTOMAKE || die "automake failed"
|
2010-02-24 12:27:18 +03:00
|
|
|
echo "Calling $LIBTOOLIZE"
|
|
|
|
$LIBTOOLIZE || die "libtoolize failed"
|
|
|
|
|
2011-11-11 12:47:07 +04:00
|
|
|
case `uname -s` in
|
|
|
|
Darwin)
|
|
|
|
cores=$(sysctl -n hw.ncpu)
|
|
|
|
;;
|
|
|
|
Linux)
|
|
|
|
cores=$(cat /proc/cpuinfo | fgrep -c processor)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown platform."
|
|
|
|
cores=
|
|
|
|
;;
|
|
|
|
esac
|
2006-07-14 20:14:48 +04:00
|
|
|
|
2011-09-26 19:00:14 +04:00
|
|
|
if [ -z "$cores" ]; then
|
|
|
|
cores=2 # assume 2 cores if we can't figure it out
|
|
|
|
echo >&2 "Assuming 2 cores"
|
|
|
|
else
|
|
|
|
echo >&2 "Detected $cores cores"
|
|
|
|
fi
|
|
|
|
|
2006-07-14 20:14:48 +04:00
|
|
|
echo
|
|
|
|
echo "You should now be able to configure and build:"
|
2011-11-17 16:49:55 +04:00
|
|
|
echo " ./configure [--with-srilm=/path/to/srilm] [--with-irstlm=/path/to/irstlm] [--with-randlm=/path/to/randlm] [--with-synlm] [--with-xmlrpc-c=/path/to/xmlrpc-c-config]"
|
2011-09-26 19:00:14 +04:00
|
|
|
echo " make -j ${cores}"
|
2006-07-14 20:14:48 +04:00
|
|
|
echo
|
2006-08-23 19:18:53 +04:00
|
|
|
|