| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
# autogoat! |
|---|
| 4 |
# an omnivorous assistant for autotools |
|---|
| 5 |
# |
|---|
| 6 |
# (__) |
|---|
| 7 |
# (oo) |
|---|
| 8 |
# /------\/ |
|---|
| 9 |
# / | || |
|---|
| 10 |
# * /\---/\ |
|---|
| 11 |
# ~~ ~~ |
|---|
| 12 |
|
|---|
| 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 mkinstalldirs compile depcomp install-sh |
|---|
| 21 |
# remove libtool cruft |
|---|
| 22 |
rm -f ltmain.sh libtool ltconfig |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
# |
|---|
| 27 |
# option checking |
|---|
| 28 |
# |
|---|
| 29 |
|
|---|
| 30 |
if test "x$1" = "xclean"; then |
|---|
| 31 |
set -x |
|---|
| 32 |
clean |
|---|
| 33 |
set +x |
|---|
| 34 |
exit 0 |
|---|
| 35 |
fi |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 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 |
|---|
| 60 |
fi |
|---|
| 61 |
|
|---|
| 62 |
if test "x${automake_version}" = "xnone"; then |
|---|
| 63 |
set +x |
|---|
| 64 |
echo "you need automake version 1.5 or later" |
|---|
| 65 |
exit 1 |
|---|
| 66 |
fi |
|---|
| 67 |
|
|---|
| 68 |
automake_version_major=`echo "$automake_version" | cut -d. -f2` |
|---|
| 69 |
automake_version_minor=`echo "$automake_version" | cut -d. -f3` |
|---|
| 70 |
|
|---|
| 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 |
|---|
| 76 |
|
|---|
| 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" |
|---|
| 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 |
|
|---|