summaryrefslogtreecommitdiff
path: root/autogen.sh
diff options
context:
space:
mode:
authorTrond Norbye <Trond.Norbye@gmail.com>2009-12-29 13:46:09 +0100
committerDustin Sallings <dustin@spy.net>2009-12-30 21:12:32 -0800
commitfcc093052812b8ee87bd954fcdb124f86f722385 (patch)
treea8b17346861c4761935e403eaa0259c5beb1ae75 /autogen.sh
parent57ce793d888c2fc4803b1ade16426df308dc035d (diff)
downloadmemcached-fcc093052812b8ee87bd954fcdb124f86f722385.tar.gz
Rewrote tools detection to work with a non-gnu which
Diffstat (limited to 'autogen.sh')
-rwxr-xr-xautogen.sh39
1 files changed, 29 insertions, 10 deletions
diff --git a/autogen.sh b/autogen.sh
index 24e0c29..9f372b4 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,17 +1,31 @@
#!/bin/sh
-#
-# This is hacky, because there are so many damn versions
-# of autoconf/automake. It works with Debian woody, at least.
-#
-# Debian sarge:
-# apt-get install automake1.7 autoconf
-#
# Get the initial version.
perl version.pl
+# Try to locate a program by using which, and verify that the file is an
+# executable
+locate_binary() {
+ for f in $@
+ do
+ file=`which $f 2>/dev/null | grep -v '^no '`
+ if test -n "$file" -a -x "$file"; then
+ echo $file
+ return 0
+ fi
+ done
+
+ echo ""
+ return 1
+}
+
echo "aclocal..."
-ACLOCAL=`which aclocal-1.11 || which aclocal-1.10 || which aclocal-1.9 || which aclocal19 || which aclocal-1.7 || which aclocal17 || which aclocal-1.5 || which aclocal15 || which aclocal || exit 1`
+if test x$ACLOCAL = x; then
+ ACLOCAL=`locate_binary aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19 aclocal-1.7 aclocal17 aclocal-1.5 aclocal15 aclocal`
+ if test x$ACLOCAL = x; then
+ die "Did not find a supported aclocal"
+ fi
+fi
$ACLOCAL || exit 1
echo "autoheader..."
@@ -19,8 +33,13 @@ AUTOHEADER=${AUTOHEADER:-autoheader}
$AUTOHEADER || exit 1
echo "automake..."
-AUTOMAKE=`which automake-1.11 || which automake-1.10 || which automake-1.9 || which automake-1.7 || exit 1`
-$AUTOMAKE --foreign --add-missing || automake --gnu --add-missing || exit 1
+if test x$AUTOMAKE = x; then
+ AUTOMAKE=`locate_binary automake-1.11 automake-1.10 automake-1.9 automake-1.7`
+ if test x$AUTOMAKE = x; then
+ die "Did not find a supported automake"
+ fi
+fi
+$AUTOMAKE --foreign --add-missing || $AUTOMAKE --gnu --add-missing || exit 1
echo "autoconf..."
AUTOCONF=${AUTOCONF:-autoconf}