1#!/bin/sh
2
3# Get the initial version.
4perl version.pl
5
6die() {
7    echo "$@"
8    exit 1
9}
10
11# Try to locate a program by using which, and verify that the file is an
12# executable
13locate_binary() {
14  for f in $@
15  do
16    file=`which $f 2>/dev/null | grep -v '^no '`
17    if test -n "$file" -a -x "$file"; then
18      echo $file
19      return 0
20    fi
21  done
22
23  echo ""
24  return 1
25}
26
27echo "aclocal..."
28if test x$ACLOCAL = x; then
29  ACLOCAL=`locate_binary aclocal-1.14 aclocal-1.13 aclocal-1.12 aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19 aclocal-1.7 aclocal17 aclocal-1.5 aclocal15 aclocal`
30  if test x$ACLOCAL = x; then
31    die "Did not find a supported aclocal"
32  fi
33fi
34$ACLOCAL || exit 1
35
36echo "autoheader..."
37AUTOHEADER=${AUTOHEADER:-autoheader}
38$AUTOHEADER || exit 1
39
40echo "automake..."
41if test x$AUTOMAKE = x; then
42  AUTOMAKE=`locate_binary automake-1.14 automake-1.13 automake-1.12 automake-1.11 automake-1.10 automake-1.9 automake-1.7 automake`
43  if test x$AUTOMAKE = x; then
44    die "Did not find a supported automake"
45  fi
46fi
47$AUTOMAKE --foreign --add-missing || $AUTOMAKE --gnu --add-missing || exit 1
48
49echo "autoconf..."
50AUTOCONF=${AUTOCONF:-autoconf}
51$AUTOCONF || exit 1
52
53