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