| 13 | | # clean function |
|---|
| 14 | | clean () |
|---|
| 15 | | { |
|---|
| 16 | | # remove autotools cruft |
|---|
| 17 | | rm -f aclocal.m4 configure config.log |
|---|
| 18 | | rm -Rf autom4te.cache |
|---|
| 19 | | # remove old autotools extra cruft |
|---|
| 20 | | rm -f config.guess config.sub missing compile depcomp install-sh |
|---|
| 21 | | # remove libtool cruft |
|---|
| 22 | | rm -f ltmain.sh libtool ltconfig |
|---|
| | 7 | olddir=`pwd` |
|---|
| | 8 | srcdir=`dirname $0` |
|---|
| | 9 | test -z "$srcdir" && srcdir=. |
|---|
| | 10 | |
|---|
| | 11 | cd "$srcdir" |
|---|
| | 12 | DIE=0 |
|---|
| | 13 | |
|---|
| | 14 | ACLOCAL_FLAGS="-I $srcdir/m4" |
|---|
| | 15 | |
|---|
| | 16 | echo "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 |
|---|
| 26 | | # |
|---|
| 27 | | # option checking |
|---|
| 28 | | # |
|---|
| 29 | | |
|---|
| 30 | | if test "x$1" = "xclean"; then |
|---|
| 31 | | set -x |
|---|
| 32 | | clean |
|---|
| 33 | | set +x |
|---|
| 34 | | exit 0 |
|---|
| | 29 | # do we need automake? |
|---|
| | 30 | if 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 automake-1.7 automake-1.8 automake-1.9 automake-1.10; 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 aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; 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 | } |
|---|
| | 87 | echo -n "checking for libtool... " |
|---|
| | 88 | for LIBTOOLIZE in libtoolize glibtoolize nope; do |
|---|
| | 89 | ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break |
|---|
| | 90 | done |
|---|
| | 91 | if test x$LIBTOOLIZE = xnope; then |
|---|
| | 92 | echo "nope." |
|---|
| | 93 | LIBTOOLIZE=libtoolize |
|---|
| | 94 | else |
|---|
| | 95 | echo $LIBTOOLIZE |
|---|
| | 96 | fi |
|---|
| | 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 | } |
|---|
| 38 | | |
|---|
| 39 | | # |
|---|
| 40 | | # check automake version number -- we require >= 1.5 |
|---|
| 41 | | # |
|---|
| 42 | | |
|---|
| 43 | | automake_version="none" |
|---|
| 44 | | if automake-1.7 --version >/dev/null 2>&1; then |
|---|
| 45 | | automake_version="-1.7" |
|---|
| 46 | | elif automake-1.6 --version >/dev/null 2>&1; then |
|---|
| 47 | | automake_version="-1.6" |
|---|
| 48 | | elif automake-1.5 --version >/dev/null 2>&1; then |
|---|
| 49 | | automake_version="-1.5" |
|---|
| 50 | | elif automake --version > /dev/null 2>&1; then |
|---|
| 51 | | automake_version="" |
|---|
| 52 | | case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in |
|---|
| 53 | | 0|0.*|1|1.[01234]|1.[01234][-.]*) automake_version="none" ;; |
|---|
| 54 | | 1.5*) automake_version="-1.5" ;; |
|---|
| 55 | | 1.6*) automake_version="-1.6" ;; |
|---|
| 56 | | 1.7*) automake_version="-1.7" ;; |
|---|
| 57 | | 1.8*) automake_version="-1.8" ;; |
|---|
| 58 | | 1.9*) automake_version="-1.9" ;; |
|---|
| 59 | | esac |
|---|
| | 106 | if test "$DIE" -eq 1; then |
|---|
| | 107 | exit 1 |
|---|
| 71 | | # need at least automake >= 1.5 |
|---|
| 72 | | if test "$automake_version_major" -lt "5"; then |
|---|
| 73 | | echo "$0"': this project requires automake >= 1.5. Please upgrade your version of automake to at least 1.5' |
|---|
| 74 | | exit 1 |
|---|
| 75 | | fi |
|---|
| | 117 | echo " $ACLOCAL $ACLOCAL_FLAGS" |
|---|
| | 118 | $ACLOCAL $ACLOCAL_FLAGS || exit 1 |
|---|
| | 119 | echo " $LIBTOOLIZE --automake" |
|---|
| | 120 | $LIBTOOLIZE --automake || exit 1 |
|---|
| | 121 | echo " autoheader" |
|---|
| | 122 | autoheader || exit 1 |
|---|
| | 123 | echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS" |
|---|
| | 124 | $AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1 |
|---|
| | 125 | echo " autoconf" |
|---|
| | 126 | autoconf || exit 1 |
|---|
| 77 | | |
|---|
| 78 | | # |
|---|
| 79 | | # do we need pkg-config? |
|---|
| 80 | | # |
|---|
| 81 | | |
|---|
| 82 | | if grep -q PKG_CHECK_MODULES configure.*; then |
|---|
| 83 | | if ! pkg-config --version > /dev/null 2> /dev/null; then |
|---|
| 84 | | cat << EOF |
|---|
| 85 | | pkg-config is required, but it's not installed or can't be found in your |
|---|
| 86 | | search path. |
|---|
| 87 | | |
|---|
| 88 | | EOF |
|---|
| 89 | | # be nice to the user if they have fink! |
|---|
| 90 | | if test -d /sw ; then |
|---|
| 91 | | cat << EOF |
|---|
| 92 | | You can install it via Fink with the command: |
|---|
| 93 | | |
|---|
| 94 | | apt-get install pkgconfig |
|---|
| 95 | | |
|---|
| 96 | | EOF |
|---|
| 97 | | fi |
|---|
| 98 | | exit 1 |
|---|
| 99 | | fi |
|---|
| 100 | | fi |
|---|
| 101 | | |
|---|
| 102 | | |
|---|
| 103 | | # |
|---|
| 104 | | # autogoat bootstrap process |
|---|
| 105 | | # |
|---|
| 106 | | |
|---|
| 107 | | ACLOCAL=${ACLOCAL:-aclocal} |
|---|
| 108 | | AUTOCONF=${AUTOCONF:-autoconf} |
|---|
| 109 | | AUTOHEADER=${AUTOHEADER:-autoheader} |
|---|
| 110 | | AUTOMAKE=${AUTOMAKE:-automake} |
|---|
| 111 | | |
|---|
| 112 | | # clean out old cruft |
|---|
| 113 | | clean |
|---|
| 114 | | |
|---|
| 115 | | # add Fink's /sw path to various search directories |
|---|
| 116 | | if [ -d /sw ]; then |
|---|
| 117 | | ACLOCAL="$ACLOCAL -I /sw/share/aclocal" |
|---|
| 118 | | FINK_DETECTED=1 |
|---|
| 119 | | fi |
|---|
| 120 | | |
|---|
| 121 | | eval "$ACLOCAL -I m4" |
|---|
| 122 | | |
|---|
| 123 | | # do we need libtool? |
|---|
| 124 | | if grep -q PROG_LIBTOOL configure.*; then |
|---|
| 125 | | # what's libtoolize called? |
|---|
| 126 | | if glibtoolize --version > /dev/null 2> /dev/null; then |
|---|
| 127 | | LIBTOOLIZE="glibtoolize" |
|---|
| 128 | | elif libtoolize --version > /dev/null 2> /dev/null; then |
|---|
| 129 | | LIBTOOLIZE="libtoolize" |
|---|
| 130 | | fi |
|---|
| 131 | | |
|---|
| 132 | | # check libtool version -- only support 1.4 or 1.5 for now |
|---|
| 133 | | if "$LIBTOOLIZE" --version | egrep -q '1\.4|1\.5'; then |
|---|
| 134 | | if grep -q AC_LIBLTDL_CONVENIENCE configure.*; then |
|---|
| 135 | | "$LIBTOOLIZE" --ltdl --copy --force |
|---|
| 136 | | else |
|---|
| 137 | | "$LIBTOOLIZE" --copy --force |
|---|
| 138 | | fi |
|---|
| 139 | | else |
|---|
| 140 | | # libtool version is too old :( |
|---|
| 141 | | echo "$0: need libtool >= 1.4 installed" |
|---|
| 142 | | exit 1 |
|---|
| 143 | | fi |
|---|
| 144 | | fi |
|---|
| 145 | | |
|---|
| 146 | | eval "$AUTOCONF" |
|---|
| 147 | | grep -q CONFIG_HEADER configure.* && "$AUTOHEADER" |
|---|
| 148 | | eval "$AUTOMAKE" --add-missing --copy |
|---|
| 149 | | |
|---|
| 150 | | # Print warning message if Fink detected |
|---|
| 151 | | if test "$FINK_DETECTED" = 1; then |
|---|
| 152 | | cat << EOF |
|---|
| 153 | | |
|---|
| 154 | | Fink detected; added /sw/share/aclocal to aclocal's include directories. |
|---|
| 155 | | Make sure you have CPPFLAGS, LDFLAGS and PKG_CONFIG_PATH including Fink's |
|---|
| 156 | | distribution directories, e.g.: |
|---|
| 157 | | |
|---|
| 158 | | export CPPFLAGS="-I/sw/include \$CPPFLAGS" |
|---|
| 159 | | export LDFLAGS="-L/sw/lib \$LDFLAGS" |
|---|
| 160 | | export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/sw/lib/pkgconfig:\$PKG_CONFIG_PATH" |
|---|
| 161 | | |
|---|
| 162 | | ./configure |
|---|
| 163 | | |
|---|
| 164 | | EOF |
|---|
| 165 | | fi |
|---|
| 166 | | |
|---|
| | 128 | cd $olddir |
|---|
| | 129 | #$srcdir/configure --enable-maintainer-mode "$@" && echo |
|---|