autogen.sh 3.86 KB
Newer Older
1
#!/bin/sh
jm's avatar
jm committed
2 3
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
4

jm's avatar
jm committed
5 6 7
package="Speex"

olddir=`pwd`
8 9 10
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.

jm's avatar
jm committed
11
cd "$srcdir"
12 13
DIE=0

jm's avatar
jm committed
14
echo "checking for autoconf... "
15
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
jm's avatar
jm committed
16 17 18 19 20
        echo
        echo "You must have autoconf installed to compile $package."
        echo "Download the appropriate package for your distribution,"
        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
        DIE=1
21 22
}

23 24 25 26
VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"

conrad's avatar
conrad committed
27 28
# do we need automake?
if test -r Makefile.am; then
29 30 31 32 33
  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
  if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
    AM_NEEDED=""
  fi
conrad's avatar
conrad committed
34 35 36 37 38
  if test -z $AM_NEEDED; then
    echo -n "checking for automake... "
    AUTOMAKE=automake
    ACLOCAL=aclocal
    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
39 40
      echo "yes"
    else
conrad's avatar
conrad committed
41 42 43 44 45
      echo "no"
      AUTOMAKE=
    fi
  else
    echo -n "checking for automake $AM_NEEDED or later... "
46 47
    majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
    minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
48
    for am in automake-$AM_NEEDED automake$AM_NEEDED \
49
	automake automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
conrad's avatar
conrad committed
50
      ($am --version < /dev/null > /dev/null 2>&1) || continue
51 52 53 54
      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
      maj=`echo $ver | $VERSIONMKMAJ`
      min=`echo $ver | $VERSIONMKMIN`
      if test $maj -eq $majneeded -a $min -ge $minneeded; then
conrad's avatar
conrad committed
55 56 57 58 59 60 61
        AUTOMAKE=$am
        echo $AUTOMAKE
        break
      fi
    done
    test -z $AUTOMAKE &&  echo "no"
    echo -n "checking for aclocal $AM_NEEDED or later... "
62
    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
63
	aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
conrad's avatar
conrad committed
64
      ($ac --version < /dev/null > /dev/null 2>&1) || continue
65 66 67 68
      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
      maj=`echo $ver | $VERSIONMKMAJ`
      min=`echo $ver | $VERSIONMKMIN`
      if test $maj -eq $majneeded -a $min -ge $minneeded; then
conrad's avatar
conrad committed
69 70 71 72 73 74 75 76
        ACLOCAL=$ac
        echo $ACLOCAL
        break
      fi
    done
    test -z $ACLOCAL && echo "no"
  fi
  test -z $AUTOMAKE || test -z $ACLOCAL && {
jm's avatar
jm committed
77 78
        echo
        echo "You must have automake installed to compile $package."
conrad's avatar
conrad committed
79 80 81 82 83
        echo "Download the appropriate package for your distribution,"
        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
        exit 1
  }
fi
84

jm's avatar
jm committed
85 86
echo -n "checking for libtool... "
for LIBTOOLIZE in libtoolize glibtoolize nope; do
conrad's avatar
conrad committed
87
  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
jm's avatar
jm committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101
done
if test x$LIBTOOLIZE = xnope; then
  echo "nope."
  LIBTOOLIZE=libtoolize
else
  echo $LIBTOOLIZE
fi
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
	echo
	echo "You must have libtool installed to compile $package."
	echo "Download the appropriate package for your system,"
	echo "or get the source from one of the GNU ftp sites"
	echo "listed in http://www.gnu.org/order/ftp.html"
	DIE=1
102 103 104
}

if test "$DIE" -eq 1; then
jm's avatar
jm committed
105
        exit 1
106 107 108
fi

if test -z "$*"; then
jm's avatar
jm committed
109 110
        echo "I am going to run ./configure with no arguments - if you wish "
        echo "to pass any to it, please specify them on the $0 command line."
111 112
fi

jm's avatar
jm committed
113 114
echo "Generating configuration files for $package, please wait...."

conrad's avatar
conrad committed
115 116
echo "  $ACLOCAL $ACLOCAL_FLAGS"
$ACLOCAL $ACLOCAL_FLAGS || exit 1
jm's avatar
jm committed
117
echo "  $LIBTOOLIZE --automake"
conrad's avatar
conrad committed
118
$LIBTOOLIZE --automake || exit 1
119 120
echo "  autoheader"
autoheader || exit 1
conrad's avatar
conrad committed
121 122
echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
jm's avatar
jm committed
123
echo "  autoconf"
conrad's avatar
conrad committed
124
autoconf || exit 1
jm's avatar
jm committed
125 126

cd $olddir
127 128
#$srcdir/configure --enable-maintainer-mode "$@" && echo
echo "You can now run configure"