1#!/bin/sh
2# Run this to set up the build system: configure, makefiles, etc.
3# (based on the version in enlightenment's cvs)
4
5package="vorbis"
6
7ACLOCAL_FLAGS="-I m4"
8
9olddir=`pwd`
10srcdir=`dirname $0`
11test -z "$srcdir" && srcdir=.
12
13cd "$srcdir"
14DIE=0
15
16echo "checking for autoconf... "
17(autoconf --version) < /dev/null > /dev/null 2>&1 || {
18        echo
19        echo "You must have autoconf installed to compile $package."
20        echo "Download the appropriate package for your distribution,"
21        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
22        DIE=1
23}
24
25VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
26VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
27VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"
28
29# do we need automake?
30if test -r Makefile.am; then
31  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
32  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
33  if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
34    AM_NEEDED=""
35  fi
36  if test -z $AM_NEEDED; then
37    echo -n "checking for automake... "
38    AUTOMAKE=automake
39    ACLOCAL=aclocal
40    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
41      echo "yes"
42    else
43      echo "no"
44      AUTOMAKE=
45    fi
46  else
47    echo -n "checking for automake $AM_NEEDED or later... "
48    majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
49    minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
50    for am in automake-$AM_NEEDED automake$AM_NEEDED \
51	automake-1.10 automake-1.9 automake-1.8 automake-1.7 automake; do
52      ($am --version < /dev/null > /dev/null 2>&1) || continue
53      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
54      maj=`echo $ver | $VERSIONMKMAJ`
55      min=`echo $ver | $VERSIONMKMIN`
56      if test $maj -eq $majneeded -a $min -ge $minneeded; then
57        AUTOMAKE=$am
58        echo $AUTOMAKE
59        break
60      fi
61    done
62    test -z $AUTOMAKE &&  echo "no"
63    echo -n "checking for aclocal $AM_NEEDED or later... "
64    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
65	aclocal-1.10 aclocal-1.9 aclocal-1.8 aclocal-1.7 aclocal; do
66      ($ac --version < /dev/null > /dev/null 2>&1) || continue
67      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
68      maj=`echo $ver | $VERSIONMKMAJ`
69      min=`echo $ver | $VERSIONMKMIN`
70      if test $maj -eq $majneeded -a $min -ge $minneeded; then
71        ACLOCAL=$ac
72        echo $ACLOCAL
73        break
74      fi
75    done
76    test -z $ACLOCAL && echo "no"
77  fi
78  test -z $AUTOMAKE || test -z $ACLOCAL && {
79        echo
80        echo "You must have automake installed to compile $package."
81        echo "Download the appropriate package for your distribution,"
82        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
83        exit 1
84  }
85fi
86
87echo -n "checking for libtool... "
88for LIBTOOLIZE in libtoolize glibtoolize nope; do
89  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
90done
91if test x$LIBTOOLIZE = xnope; then
92  echo "nope."
93  LIBTOOLIZE=libtoolize
94else
95  echo $LIBTOOLIZE
96fi
97($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
98	echo
99	echo "You must have libtool installed to compile $package."
100	echo "Download the appropriate package for your system,"
101	echo "or get the source from one of the GNU ftp sites"
102	echo "listed in http://www.gnu.org/order/ftp.html"
103	DIE=1
104}
105
106if test "$DIE" -eq 1; then
107        exit 1
108fi
109
110if test -z "$*"; then
111        echo "I am going to run ./configure with no arguments - if you wish "
112        echo "to pass any to it, please specify them on the $0 command line."
113fi
114
115echo "Generating configuration files for $package, please wait...."
116
117echo "  $ACLOCAL $ACLOCAL_FLAGS"
118$ACLOCAL $ACLOCAL_FLAGS || exit 1
119echo "  $LIBTOOLIZE --automake"
120$LIBTOOLIZE --automake || exit 1
121echo "  autoheader"
122autoheader || exit 1
123echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
124$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
125echo "  autoconf"
126autoconf || exit 1
127
128cd $olddir
129$srcdir/configure --enable-maintainer-mode "$@" && echo
130