detect-autoconf.sh 3.01 KB
Newer Older
Joachim Eibl's avatar
Joachim Eibl committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#! /bin/sh

# Global variables...
AUTOCONF="autoconf"
AUTOHEADER="autoheader"
AUTOM4TE="autom4te"
AUTOMAKE="automake"
ACLOCAL="aclocal"


# We don't use variable here for remembering the type ... strings.
# local variables are not that portable, but we fear namespace issues with
# our includer.  The repeated type calls are not that expensive.
checkAutoconf()
{
Joachim Eibl's avatar
Joachim Eibl committed
16
  if test -x "`$WHICH autoconf-2.5x 2>/dev/null`" ; then	
Joachim Eibl's avatar
Joachim Eibl committed
17
    AUTOCONF="`$WHICH autoconf-2.5x`"
Joachim Eibl's avatar
Joachim Eibl committed
18 19 20 21 22 23 24
  elif test -x "`$WHICH autoconf-2.57 2>/dev/null`" ; then
    AUTOCONF="`$WHICH autoconf-2.57`"
  elif test -x "`$WHICH autoconf-2.56 2>/dev/null`" ; then
    AUTOCONF="`$WHICH autoconf-2.56`"
  elif test -x "`$WHICH autoconf-2.55 2>/dev/null`" ; then
    AUTOCONF="`$WHICH autoconf-2.55`"
  elif test -x "`$WHICH autoconf-2.54 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
25
    AUTOCONF="`$WHICH autoconf-2.54`"
Joachim Eibl's avatar
Joachim Eibl committed
26
  elif test -x "`$WHICH autoconf-2.53 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
27
    AUTOCONF="`$WHICH autoconf-2.53`"
Joachim Eibl's avatar
Joachim Eibl committed
28
  elif test -x "`$WHICH autoconf-2.53a 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
29
    AUTOCONF="`$WHICH autoconf-2.53a`"
Joachim Eibl's avatar
Joachim Eibl committed
30
  elif test -x "`$WHICH autoconf-2.52 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
31
    AUTOCONF="`$WHICH autoconf-2.52`"
Joachim Eibl's avatar
Joachim Eibl committed
32
  elif test -x "`$WHICH autoconf2.50 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
33 34 35 36 37 38
    AUTOCONF="`$WHICH autoconf2.50`"
  fi
}

checkAutoheader()
{
Joachim Eibl's avatar
Joachim Eibl committed
39
  if test -x "`$WHICH autoheader-2.5x 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
40 41
    AUTOHEADER="`$WHICH autoheader-2.5x`"
    AUTOM4TE="`$WHICH autom4te-2.5x`"
Joachim Eibl's avatar
Joachim Eibl committed
42 43 44 45 46 47 48 49 50 51
  elif test -x "`$WHICH autoheader-2.57 2>/dev/null`" ; then
    AUTOHEADER="`$WHICH autoheader-2.57`"
    AUTOM4TE="`$WHICH autom4te-2.57`"
  elif test -x "`$WHICH autoheader-2.56 2>/dev/null`" ; then
    AUTOHEADER="`$WHICH autoheader-2.56`"
    AUTOM4TE="`$WHICH autom4te-2.56`"
  elif test -x "`$WHICH autoheader-2.55 2>/dev/null`" ; then
    AUTOHEADER="`$WHICH autoheader-2.55`"
    AUTOM4TE="`$WHICH autom4te-2.55`"
  elif test -x "`$WHICH autoheader-2.54 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
52 53
    AUTOHEADER="`$WHICH autoheader-2.54`"
    AUTOM4TE="`$WHICH autom4te-2.54`"
Joachim Eibl's avatar
Joachim Eibl committed
54
  elif test -x "`$WHICH autoheader-2.53 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
55 56
    AUTOHEADER="`$WHICH autoheader-2.53`"
    AUTOM4TE="`$WHICH autom4te-2.53`"
Joachim Eibl's avatar
Joachim Eibl committed
57
  elif test -x "`$WHICH autoheader-2.53a 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
58 59
    AUTOHEADER="`$WHICH autoheader-2.53a`"
    AUTOM4TE="`$WHICH autom4te-2.53a`"
Joachim Eibl's avatar
Joachim Eibl committed
60
  elif test -x "`$WHICH autoheader-2.52 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
61
    AUTOHEADER="`$WHICH autoheader-2.52`"
Joachim Eibl's avatar
Joachim Eibl committed
62
  elif test -x "`$WHICH autoheader2.50 2>/dev/null`" ; then
Joachim Eibl's avatar
Joachim Eibl committed
63 64 65 66 67 68
    AUTOHEADER="`$WHICH autoheader2.50`"
  fi
}

checkAutomakeAclocal ()
{
Joachim Eibl's avatar
Joachim Eibl committed
69 70 71 72 73 74 75 76
 if test -x "`$WHICH automake-1.6 2>/dev/null`" ; then
    AUTOMAKE="`$WHICH automake-1.6`"
    ACLOCAL="`$WHICH aclocal-1.6`"
  elif test -x "`$WHICH automake-1.7 2>/dev/null`" ; then
    AUTOMAKE="`$WHICH automake-1.7`"
    ACLOCAL="`$WHICH aclocal-1.7`"
  fi
  if test -n "$UNSERMAKE"; then 
Joachim Eibl's avatar
Joachim Eibl committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
     AUTOMAKE="$UNSERMAKE"
  fi
}

checkWhich ()
{
  WHICH=""
  for i in "type -p" "which" "type" ; do
    T=`$i sh 2> /dev/null`
    test -x "$T" && WHICH="$i" && break
  done
}

checkWhich
checkAutoconf
checkAutoheader
checkAutomakeAclocal

export WHICH AUTOHEADER AUTOCONF AUTOM4TE AUTOMAKE ACLOCAL