1#! /bin/sh 2AUTOHEADER=${AUTOHEADER:-autoheader} 3AUTOCONF=${AUTOCONF:-autoconf} 4MPE_AUTOHEADER=${MPE_AUTOHEADER:-$AUTOHEADER} 5MPE_AUTOCONF=${MPE_AUTOCONF:-$AUTOCONF} 6 7# Check that we have a workable autoconf 8acWorks=no 9if test -d .tmp ; then rm -rf .tmp ; fi 10if test -s .tmp ; then rm -f .tmp ; fi 11if test ! -d .tmp ; then 12 mkdir .tmp 2>&1 >/dev/null 13fi 14rm -f .tmp/configure.ac .tmp/configure 15cat >.tmp/configure.ac <<EOF 16AC_PREREQ(2.52) 17EOF 18if (cd .tmp && $MPE_AUTOCONF >/dev/null 2>&1 ) ; then 19 acWorks=yes 20fi 21if [ "$acWorks" != yes ] ; then 22 echo "Selected version of autoconf cannot handle version 2.52" 23 echo "Trying to find an autoconf-2.xx..." 24 acver_min=59 25 acver_max=69 26 ver="$acver_max" 27 while [ "$ver" -ge "$acver_min" ] ; do 28 autoconf="autoconf-2.$ver" 29 if (cd .tmp && $autoconf >/dev/null 2>&1 ) ; then 30 MPE_AUTOCONF=$autoconf 31 MPE_AUTOHEADER="autoheader-2.$ver" 32 echo "Found $autoconf" 33 acWorks=yes 34 break 35 fi 36 ver="`expr $ver - 1`" 37 done 38 if [ "$acWorks" != yes ] ; then 39 echo "Unable to find workable autoconf" 40 exit 1 41 fi 42fi 43rm -rf .tmp 44 45# We cannot use "find . -name 'configre.in'" to locate configure.acs 46# because "." is the working directory not the top-level MPE2 source 47# directory. So we use the full-pathname of this script to locate the 48# MPE2's top-level directory. 'dirname' does not return the full-pathname 49# and may not be reliable in general, so we cd to the directory and 50# use pwd to get the full-pathname of the top-level MPE2 source directory. 51pgmdir="`dirname $0`" 52master_dir=`(cd $pgmdir && pwd)` 53 54# Remove all the configure first so we can track if the autoconf has been run. 55find $master_dir -name 'configure' -exec rm -f {} \; 56 57# Locate all the autogen.sh and invoke the script accordingly. 58atgs=`find $master_dir -name 'autogen.sh' -print` 59for atg in $atgs ; do 60 dir="`dirname $atg`" 61 if [ "$atg" != "$master_dir/autogen.sh" ] ; then 62 echo "Running autogen.sh in $dir/ ..." 63 $atg || exit 1 64 fi 65done 66 67# Locate all the configure.ac and invoke autoconf if no configure is found. 68cfgins=`find $master_dir -name 'configure.ac' -print` 69for cfgin in $cfgins ; do 70 dir="`dirname $cfgin`" 71 if [ ! -x "$dir/configure" ] ; then 72 if [ -n "`grep AC_CONFIG_HEADER $cfgin`" ] ; then 73 echo "Running autoheader/autoconf in $dir/ ..." 74 (cd $dir && $MPE_AUTOHEADER && $MPE_AUTOCONF && rm -rf autom4te*.cache) || exit 1 75 else 76 echo "Running autoconf in $dir/ ..." 77 (cd $dir && $MPE_AUTOCONF && rm -rf autom4te*.cache) || exit 1 78 fi 79 fi 80done 81