As written _autosetup was very bash + linux 'type'+GNU sed specific. As such

it wouldn't run on most non-GNU systems.   I've modified it to make it more
portable.  I hope....

svn path=/trunk/boinc/; revision=8868
This commit is contained in:
Eric J. Korpela 2005-11-16 22:17:01 +00:00
parent eeec435dad
commit e183687ed3
1 changed files with 77 additions and 58 deletions

View File

@ -18,90 +18,109 @@ esac
## ---------------------------------------------------------------------- ## ----------------------------------------------------------------------
check_version() check_version()
{ {
local foundit dir=`pwd`
cd /tmp
foundit=
## get current version of $1 ## get current version of $1
echo $ECHO_N "Checking version of '$1' >= $2.$3... $ECHO_C" desired=$2
fullpath=`type -p $1`; echo $ECHO_N "Checking version of '$1' >= $desired... $ECHO_C"
name=$1
fullpath=`type $name | awk '{ print $(NF) }'`;
if [ -x "$fullpath" ]; then if [ -x "$fullpath" ]; then
foundit=yes; foundit=yes;
fi fi
if [ "$foundit" != yes ]; then if [ "$foundit" != yes ]; then
echo "Didn't find application"; echo "Didn't find application";
ac_major=0; ac_minor=0; version=0
success=no
else else
cmdline="$fullpath --version 2> /dev/null"; cmdline="$fullpath --version 2>/dev/null";
version=`$cmdline`; version=`$cmdline`;
if [ -n "${version}" ]; then if [ -n "${version}" ]; then
## HACK: the pre-pended space "x " is important for the following regexp version=`echo $version | awk '{ for (i=1;i<=NF;i++) { split($i,j,"."); m=j[1]"."j[2] ; if ((m*1)>0) { print m ; break; } } }'`
## to always work even if the version-number comes back without text prepended success=`echo $version $desired | awk '{ if ($1 >= $2) { print "yes";} else {print "no";}} '`
version="x ${version}"
else else
version=0 version=0
success=no
fi 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 fi
cd $dir
if [ ${ac_major} -ge $2 ] && [ ${ac_minor} -ge $3 ]; then if [ $success = "yes" ] ; then
echo "ok. (${ac_major}.${ac_minor})" echo "succeeded. ($version)"
return 0; return 0;
else else
echo "failed. (${ac_major}.${ac_minor})" echo "failed. ($version)"
return 1; return 1;
fi fi
} ## check_version() } ## check_version()
## -------------------------------------------------------------------------------- ## --------------------------------------------------------------------------------
## 'MAIN' starts here ## 'MAIN' starts here
## -------------------------------------------------------------------------------- ## --------------------------------------------------------------------------------
echo "Bootstrapping configure script and makefiles:" echo "Bootstrapping configure script and makefiles:"
## ---------- first check santity of the installed versions of the build-system ## ---------- first check santity of the installed versions of the build-system
## some sorry systems don't have proper GNU-make... build one ## some sorry systems don't have proper GNU-make... build one
if ! check_version make 3 79; then if check_version make 3.79; then
echo "Couldn't find a new-enough version of GNU 'make', please install one!"; echo >/dev/null
exit 1; else
# build_lsc_aux "make-3.80" if check_version gmake 3.79; then
fi echo >/dev/null
else
echo "Couldn't find a new-enough version of GNU 'make', please install one!";
exit 1;
# build_lsc_aux "make-3.80"
fi
fi
## FreeBSD's m4 seems to be broken? Download a fresh one ## FreeBSD's m4 seems to be broken? Download a fresh one
if ! check_version m4 1 4; then if check_version m4 1.4; then
echo "Couldn't find a new-enough version of 'm4', please install one!"; echo >/dev/null
exit 1; else
# build_lsc_aux "m4-1.4.1" echo "Couldn't find a new-enough version of 'm4', please install one!";
fi exit 1;
# build_lsc_aux "m4-1.4.1"
fi
if ! check_version libtool 1 4; then if check_version libtool 1.4; then
echo "Couldn't find a new-enough version of 'libtool', please install one!"; echo >/dev/null
exit 1; else
# build_lsc_aux "libtool-1.5.6" echo "Couldn't find a new-enough version of 'libtool', please install one!";
fi exit 1;
# build_lsc_aux "libtool-1.5.6"
fi
if ! check_version pkg-config 0 15; then if check_version pkg-config 0.15; then
echo "Couldn't find a new-enough version of 'pkg-config', please install one!"; echo >/dev/null
exit 1; else
# build_lsc_aux "pkgconfig-0.15.0" echo "Couldn't find a new-enough version of 'pkg-config', please install one!";
fi exit 1;
# build_lsc_aux "pkgconfig-0.15.0"
fi
if ! check_version autoconf 2 58; then if check_version autoconf 2.58; then
echo "Couldn't find a new-enough version of 'autoconf', please install one!"; echo >/dev/null
echo "If you have a newer version, set the environment-variable 'AUTOCONF' to its path"; else
exit 1; echo "Couldn't find a new-enough version of 'autoconf', please install one!";
# build_lsc_aux "autoconf-2.59" echo "If you have a newer version, set the environment-variable 'AUTOCONF' to its path";
fi exit 1;
if ! check_version automake 1 8; then # build_lsc_aux "autoconf-2.59"
echo "Couldn't find a new-enough version of 'automake', please install one!"; fi
echo "If you have a newer version, set the environment-variable 'AUTOMAKE' to its path"; if check_version automake 1.8; then
exit 1; echo >/dev/null
# build_lsc_aux "automake-1.8.5" else
fi 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 ## ---------- ok, now run aclocal, automake, autohead and autoconf
cmdline="aclocal -I m4 && autoheader && automake && autoconf"; cmdline="aclocal -I m4 && autoheader && automake && autoconf";
echo "$cmdline" echo "$cmdline"
if eval $cmdline; then if eval $cmdline; then
echo "Done, now run ./configure" echo "Done, now run ./configure"