subversion now) source and versioned autoFoo Message-ID: <200407191939.i6JJd6g01573@Mail.NOSPAM.DynDNS.dK> [I don't think I sent this; if so, ignore. This was written over a month ago. Feedback probably won't work as I'm offline, but I'll patiently browse the archives when they're available again. Sorry.] Howdy. When building the CVS source using autogen.sh, in particular on FreeBSD, there are a number of things which it would be nice if they could be specified on the command line, rather than being hardcoded into autogen.sh. For example, automake 1.6 or greater is needed in the `ogg' source directory. A search is made for automake-1.6 and automake1.6, as well as bog-standard automake. But this doesn't find automake-1.7, or the way that the FreeBSD ports system has decided to number the various versions (allowing them to coexist, but not making them available as simple `automake' as far as I can tell). In fact, if one has installed a recent `autoconf' on FreeBSD from the ports collection, there is no `autoconf' in ones path, but rather `autoconf259'. So, to work around these issues, I decided to allow the user to specify a particular path or name, a la AUTOCONF=autoconf259, and allow autogen.sh to use that instead. I did this for the autogen.sh scripts in `ogg' and `vorbis' plus `vorbis-tools' source directories, but haven't yet tackled any others. All binaries that are tested for can be specified as above. (Note that this alone does not assure successful running of the script; in fact, one also needs to specify the path -- if not the standard name -- for other binaries that get invoked, under FreeBSD, if they too have version suffixes. Perhaps I have not grasped all the details of the FreeBSD ports system for autoconf and its ilk.) As the following hacks can be useful on other systems (as noted, if a later version of a program is installed with suffix, later than the required version, so that it isn't found by the simple check, or if one happens not to have those programs installed in a standard path location), I proclaim this idea to be useful in general, and submit it for contemplation. Unfortunately, this isn't a clean patch, since I had already hacked my `ogg' autogen.sh to hardcode various of my binaries, and I can't find a virginal source at the time I compose this, in order to make a clean patch. Nonetheless, you can get a general idea for what I'm trying to do, and decide whether it's worth it or not. For now, I'm just including the hack I did to the `ogg' source autogen.sh; if this is decided to be a Good Thing, I can submit the clean patches I have for `vorbis' and `vorbis-tools'... The hacks are as follows: --- /stand/work/src/vorbis-build-src/ogg/autogen.sh-NEW_HACKED Wed Mar 17 03:48:24 2004 +++ /stand/work/src/vorbis-build-src/ogg/autogen.sh-useme Thu Jun 17 07:39:49 2004 @@ -12,25 +12,33 @@ DIE=0 echo "checking for autoconf... " -(autoconf257 --version) < /dev/null > /dev/null 2>&1 || { +AUTOCONF=${AUTOCONF:-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/" + echo + echo "If the installed autoconf is not in your search path" + echo "as \`\`autoconf'', you may specify the path to the autoconf" + echo "you wish to use in the environment used to invoke $0," + echo "for example:" + echo " $ env AUTOCONF=/path/to/autoconf $0" + echo " or $ env AUTOCONF=autoconf259 $0" DIE=1 } VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/" VERSIONMKINT="sed -e s/[^0-9]//" - + # do we need automake? if test -r Makefile.am; then AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP` if test -z $AM_NEEDED; then echo -n "checking for automake... " - AUTOMAKE=automake17 - ACLOCAL=aclocal17 - if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then + AUTOMAKE=${AUTOMAKE:-automake} + ACLOCAL=${ACLOCAL:-aclocal} + if (${AUTOMAKE} --version < /dev/null > /dev/null 2>&1); then echo "no" AUTOMAKEelse @@ -38,19 +46,20 @@ fi else echo -n "checking for automake $AM_NEEDED or later... " - for am in automake-$AM_NEEDED automake$AM_NEEDED automake automake17; do + for am in automake-$AM_NEEDED automake$AM_NEEDED ${AUTOMAKE}; do ($am --version < /dev/null > /dev/null 2>&1) || continue ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT` verneeded=`echo $AM_NEEDED | $VERSIONMKINT` if test $ver -ge $verneeded; then AUTOMAKE=$am echo $AUTOMAKE + AM_SUFFIX=${AUTOMAKE##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 aclocal17; do + for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal$AM_SUFFIX ${ACLOCAL}; do ($ac --version < /dev/null > /dev/null 2>&1) || continue ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT` verneeded=`echo $AM_NEEDED | $VERSIONMKINT` @@ -67,26 +76,43 @@ 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/" + echo + echo "If the installed automake is not in your search path" + echo "as \`\`automake'', or with version in the format of" + echo "\`\`automake-$AM_NEEDED'' or \`\`automake$AM_NEEDED''," + echo "you may specify the path to the automake you wish to" + echo "use in the environment used to invoke $0," + echo "for example:" + echo " $ env AUTOMAKE=/path/to/automake ACLOCAL=/path/to/aclocal $0" + echo " or $ env AUTOMAKE=automake18 $0" exit 1 } fi echo -n "checking for libtool... " -for LIBTOOLIZE in libtoolize glibtoolize nope; do - ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break +LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} +for libtoolize in ${LIBTOOLIZE} libtoolize glibtoolize nope; do + ($libtoolize --version) < /dev/null > /dev/null 2>&1 && break done -if test x$LIBTOOLIZE = xnope; then +if test x$libtoolize = xnope; then echo "nope." - LIBTOOLIZE=libtoolize + libtoolize=libtoolize else - echo $LIBTOOLIZE + echo $libtoolize fi -($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || { +($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" + echo + echo "If the installed libtool is not in your search path," + echo "you may specify the path to the libtoolize you wish to" + echo "use in the environment used to invoke $0," + echo "for example:" + echo " $ env LIBTOOLIZE=/path/to/libtoolize $0" + echo " or $ env LIBTOOLIZE=libtoolize13 $0" DIE=1 } @@ -105,12 +131,12 @@ $ACLOCAL $ACLOCAL_FLAGS #echo " autoheader" #autoheader -echo " $LIBTOOLIZE --automake" -$LIBTOOLIZE --automake +echo " $libtoolize --automake" +$libtoolize --automake echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS" $AUTOMAKE --add-missing $AUTOMAKE_FLAGS -echo " autoconf257 " -autoconf257 +echo " autoconf " +${AUTOCONF} cd $olddir $srcdir/configure "$@" && echo Again, sorry this isn't a clean patch. I'm instead seeking feedback whether this is a good idea or not. thanks barry bouwsma