From 35bd52c1e8451ceed54b0b8fb68562ce11c99dfa Mon Sep 17 00:00:00 2001 From: Reinhard Prix Date: Wed, 19 Oct 2005 14:46:26 +0000 Subject: [PATCH] put explicit version-checks into _autosetup so the user knows right-away if he needs to installer newer versions of autoconf&automake&Cie. [taken from E@H-buildscript 'eah_build.sh'] svn path=/trunk/boinc/; revision=8702 --- _autosetup | 123 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 23 deletions(-) diff --git a/_autosetup b/_autosetup index 0546c0c2e2..7dc391be24 100755 --- a/_autosetup +++ b/_autosetup @@ -2,35 +2,112 @@ ## $Id$ -# this file is only for bootstrapping the "Makefile.in" files and "Makefile" -# files; you probably don't need to run this if the Makefile.in files were -# correctly checked into the repository. +## ---------- some portability checks/adjustments [stolen from configure] ---------- +## 'echo -n' is not portable.. +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +##---------- -if [ -d autom4te.cache ]; then - /bin/rm -rf autom4te.cache -fi +## ---------------------------------------------------------------------- +## Check that given command $1 has version >= $2.$3 +## return 0 if ok, 1 too old or not found (-> shell conventions). +## ---------------------------------------------------------------------- +check_version() +{ + local foundit + ## get current version of $1 + echo $ECHO_N "Checking version of '$1' >= $2.$3... $ECHO_C" + fullpath=`type -p $1`; + if [ -x "$fullpath" ]; then + foundit=yes; + fi + if [ "$foundit" != yes ]; then + echo "Didn't find application"; + ac_major=0; ac_minor=0; + else + cmdline="$fullpath --version 2> /dev/null"; + version=`$cmdline`; + if [ -n "${version}" ]; then + ## HACK: the pre-pended space "x " is important for the following regexp + ## to always work even if the version-number comes back without text prepended + version="x ${version}" + else + version=0 + fi + ac_major=`echo $version | sed 's/.* v*\([0-9]*\)[.]\([0-9]*\).*/\1/g'` + ac_minor=`echo $version | sed 's/.* v*\([0-9]*\)[.]\([0-9]*\).*/\2/g'` + fi + + if [ ${ac_major} -ge $2 ] && [ ${ac_minor} -ge $3 ]; then + echo "ok. (${ac_major}.${ac_minor})" + return 0; + else + echo "failed. (${ac_major}.${ac_minor})" + return 1; + fi + +} ## check_version() + + +## -------------------------------------------------------------------------------- +## 'MAIN' starts here +## -------------------------------------------------------------------------------- echo "Bootstrapping configure script and makefiles:" -ACLOCAL=aclocal -AUTOHEADER=autoheader -AUTOMAKE=automake -AUTOCONF=autoconf +## ---------- first check santity of the installed versions of the build-system -if $ACLOCAL -I m4 && $AUTOHEADER && $AUTOMAKE && $AUTOCONF; then - ## We don't always run ./configure ourselves here, because the user may not - ## want to run it, or may want to run with custom parameters. +## some sorry systems don't have proper GNU-make... build one +if ! check_version make 3 79; then + echo "Couldn't find a new-enough version of GNU 'make', please install one!"; + exit 1; + # build_lsc_aux "make-3.80" +fi - if [ "$1" = "-a" ]; then - ./configure -C --enable-maintainer-mode - elif [ "$1" = "-c" ]; then - ./configure -C - else - echo "Done, now run ./configure" - echo " ./configure -C to enable caching" - echo " ./configure --enable-maintainer-mode to enable maintainer depedencies" - exit 0 - fi +## FreeBSD's m4 seems to be broken? Download a fresh one +if ! check_version m4 1 4; then + echo "Couldn't find a new-enough version of 'm4', please install one!"; + exit 1; + # build_lsc_aux "m4-1.4.1" +fi + +if ! check_version libtool 1 4; then + echo "Couldn't find a new-enough version of 'libtool', please install one!"; + exit 1; + # build_lsc_aux "libtool-1.5.6" +fi + +if ! check_version pkg-config 0 15; then + echo "Couldn't find a new-enough version of 'pkg-config', please install one!"; + exit 1; + # build_lsc_aux "pkgconfig-0.15.0" +fi + +if ! check_version autoconf 2 58; then + echo "Couldn't find a new-enough version of 'autoconf', please install one!"; + echo "If you have a newer version, set the environment-variable 'AUTOCONF' to its path"; + exit 1; + # build_lsc_aux "autoconf-2.59" +fi +if ! check_version automake 1 8; then + echo "Couldn't find a new-enough version of 'automake', please install one!"; + echo "If you have a newer version, set the environment-variable 'AUTOMAKE' to its path"; + exit 1; + # build_lsc_aux "automake-1.8.5" +fi + +## ---------- ok, now run aclocal, automake, autohead and autoconf +cmdline="aclocal -I m4 && autoheader && automake && autoconf"; +echo "$cmdline" +if eval $cmdline; then + echo "Done, now run ./configure" + echo " ./configure -C to enable caching" + echo " ./configure --enable-maintainer-mode to enable maintainer depedencies" + exit 0 else echo "Something failed .... please check error-message and re-run when fixed." echo "exiting..."