Permalink
Browse files

update autogen.sh to allow out-of-tree builds

git-svn-id: http://svn.metadecks.org/libremix/trunk@649 e2d53364-18fc-0310-981e-b60a84739af0
  • Loading branch information...
1 parent 92e0f74 commit 4e96486ff7af9cbb371d4555bf5bfb448b7f7b66 conrad committed Nov 7, 2009
Showing with 112 additions and 148 deletions.
  1. +112 −148 autogen.sh
View
260 autogen.sh
@@ -1,166 +1,130 @@
#!/bin/sh
+# Run this to set up the build system: configure, makefiles, etc.
+# (based on the version in enlightenment's cvs)
-# autogoat!
-# an omnivorous assistant for autotools
-#
-# (__)
-# (oo)
-# /------\/
-# / | ||
-# * /\---/\
-# ~~ ~~
+package="libremix"
-# clean function
-clean ()
-{
- # remove autotools cruft
- rm -f aclocal.m4 configure config.log
- rm -Rf autom4te.cache
- # remove old autotools extra cruft
- rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
- # remove libtool cruft
- rm -f ltmain.sh libtool ltconfig
-}
-
-
-#
-# option checking
-#
-
-if test "x$1" = "xclean"; then
- set -x
- clean
- set +x
- exit 0
-fi
-
-
-
-#
-# check automake version number -- we require >= 1.5
-#
-
-automake_version="none"
-if automake-1.7 --version >/dev/null 2>&1; then
- automake_version="-1.7"
-elif automake-1.6 --version >/dev/null 2>&1; then
- automake_version="-1.6"
-elif automake-1.5 --version >/dev/null 2>&1; then
- automake_version="-1.5"
-elif automake --version > /dev/null 2>&1; then
- automake_version=""
- case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
- 0|0.*|1|1.[01234]|1.[01234][-.]*) automake_version="none" ;;
- 1.5*) automake_version="-1.5" ;;
- 1.6*) automake_version="-1.6" ;;
- 1.7*) automake_version="-1.7" ;;
- 1.8*) automake_version="-1.8" ;;
- 1.9*) automake_version="-1.9" ;;
- esac
-fi
-
-if test "x${automake_version}" = "xnone"; then
- set +x
- echo "you need automake version 1.5 or later"
- exit 1
-fi
-
-automake_version_major=`echo "$automake_version" | cut -d. -f2`
-automake_version_minor=`echo "$automake_version" | cut -d. -f3`
-
-# need at least automake >= 1.5
-if test "$automake_version_major" -lt "5"; then
- echo "$0"': this project requires automake >= 1.5. Please upgrade your version of automake to at least 1.5'
- exit 1
-fi
-
-
-#
-# do we need pkg-config?
-#
-
-if grep -q PKG_CHECK_MODULES configure.*; then
- if ! pkg-config --version > /dev/null 2> /dev/null; then
- cat << EOF
-pkg-config is required, but it's not installed or can't be found in your
-search path.
+olddir=`pwd`
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
-EOF
- # be nice to the user if they have fink!
- if test -d /sw ; then
- cat << EOF
-You can install it via Fink with the command:
+cd "$srcdir"
+DIE=0
- apt-get install pkgconfig
+#ACLOCAL_FLAGS="-I $srcdir/m4"
-EOF
- fi
- exit 1
- fi
-fi
-
-
-#
-# autogoat bootstrap process
-#
-
-ACLOCAL=${ACLOCAL:-aclocal}
-AUTOCONF=${AUTOCONF:-autoconf}
-AUTOHEADER=${AUTOHEADER:-autoheader}
-AUTOMAKE=${AUTOMAKE:-automake}
-
-# clean out old cruft
-clean
-
-# add Fink's /sw path to various search directories
-if [ -d /sw ]; then
- ACLOCAL="$ACLOCAL -I /sw/share/aclocal"
- FINK_DETECTED=1
-fi
+echo "checking for autoconf... "
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ 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
+}
-eval "$ACLOCAL"
+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]*\.//"
-# do we need libtool?
-if grep -q PROG_LIBTOOL configure.*; then
- # what's libtoolize called?
- if glibtoolize --version > /dev/null 2> /dev/null; then
- LIBTOOLIZE="glibtoolize"
- elif libtoolize --version > /dev/null 2> /dev/null; then
- LIBTOOLIZE="libtoolize"
+# do we need automake?
+if test -r Makefile.am; then
+ 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
-
- # check libtool version -- only support 1.4 or 1.5 for now
- if "$LIBTOOLIZE" --version | egrep -q '1\.4|1\.5'; then
- if grep -q AC_LIBLTDL_CONVENIENCE configure.*; then
- "$LIBTOOLIZE" --ltdl --copy --force
+ 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
+ echo "yes"
else
- "$LIBTOOLIZE" --copy --force
+ echo "no"
+ AUTOMAKE=
fi
else
- # libtool version is too old :(
- echo "$0: need libtool >= 1.4 installed"
- exit 1
+ echo -n "checking for automake $AM_NEEDED or later... "
+ majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
+ minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
+ for am in automake-$AM_NEEDED automake$AM_NEEDED \
+ automake automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
+ ($am --version < /dev/null > /dev/null 2>&1) || continue
+ 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
+ AUTOMAKE=$am
+ echo $AUTOMAKE
+ break
+ fi
+ done
+ test -z $AUTOMAKE && echo "no"
+ echo -n "checking for aclocal $AM_NEEDED or later... "
+ for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
+ aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
+ ($ac --version < /dev/null > /dev/null 2>&1) || continue
+ 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
+ ACLOCAL=$ac
+ echo $ACLOCAL
+ break
+ fi
+ done
+ test -z $ACLOCAL && echo "no"
fi
+ test -z $AUTOMAKE || test -z $ACLOCAL && {
+ echo
+ echo "You must have automake 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/"
+ exit 1
+ }
fi
-eval "$AUTOCONF"
-grep -q CONFIG_HEADER configure.* && "$AUTOHEADER"
-eval "$AUTOMAKE" --add-missing --copy
-
-# Print warning message if Fink detected
-if test "$FINK_DETECTED" = 1; then
- cat << EOF
-
-Fink detected; added /sw/share/aclocal to aclocal's include directories.
-Make sure you have CPPFLAGS, LDFLAGS and PKG_CONFIG_PATH including Fink's
-distribution directories, e.g.:
-
- export CPPFLAGS="-I/sw/include \$CPPFLAGS"
- export LDFLAGS="-L/sw/lib \$LDFLAGS"
- export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/sw/lib/pkgconfig:\$PKG_CONFIG_PATH"
-
- ./configure
+echo -n "checking for libtool... "
+for LIBTOOLIZE in libtoolize glibtoolize nope; do
+ ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
+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
+}
-EOF
+if test "$DIE" -eq 1; then
+ exit 1
fi
+#if test -z "$*"; then
+# 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."
+#fi
+
+echo "Generating configuration files for $package, please wait...."
+
+echo " $ACLOCAL $ACLOCAL_FLAGS"
+$ACLOCAL $ACLOCAL_FLAGS || exit 1
+echo " $LIBTOOLIZE --automake"
+$LIBTOOLIZE --automake || exit 1
+echo " autoheader"
+autoheader || exit 1
+echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
+$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
+echo " autoconf"
+autoconf || exit 1
+
+cd $olddir
+#$srcdir/configure --enable-maintainer-mode "$@" && echo
+echo "Now run ./configure, followed by make." && echo

0 comments on commit 4e96486

Please sign in to comment.