summaryrefslogtreecommitdiff
path: root/autogen.sh
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-07 17:43:20 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-08-07 17:43:20 -0700
commitdea90380f42ae3318e54fc9afd59c6dbc90aa55e (patch)
treea9ec1758b9ac17eb22603cac5045a1e3537ac450 /autogen.sh
parent287964d54b64bed833adba307e1d920f8fcf0cbc (diff)
downloadnasm-dea90380f42ae3318e54fc9afd59c6dbc90aa55e.tar.gz
autogen.sh: allow overriding autotools location, and handle missing
Allow overriding the autotools install location via environment variables. Handle missing aclocal or automake, which aren't mandatory as we cache the files we get from them. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'autogen.sh')
-rwxr-xr-xautogen.sh36
1 files changed, 25 insertions, 11 deletions
diff --git a/autogen.sh b/autogen.sh
index 6fb1693e..e07324cd 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -xe
+#!/bin/sh -x
#
# Run this script to regenerate autoconf files
#
@@ -8,21 +8,35 @@ if [ x"$1" = x--recheck ]; then
config=$(sh config.status --config 2>/dev/null)
fi
+# This allows for overriding the default autoconf programs
+AUTOCONF="${AUTOCONF:-${AUTOTOOLS_PREFIX}autoconf}"
+AUTOMAKE="${AUTOMAKE:-${AUTOTOOLS_PREFIX}automake}"
+ACLOCAL="${ACLOCAL:-${AUTOTOOLS_PREFIX}aclocal}"
+AUTOHEADER="${AUTOHEADER:-${AUTOTOOLS_PREFIX}autoheader}"
+
mkdir -p autoconf autoconf/helpers config
-autolib="`automake --print-libdir`"
-for prg in install-sh compile config.guess config.sub; do
- cp -f "$autolib"/"$prg" autoconf/helpers
-done
-rm -f autoconf/aclocal.m4
+autolib="`"$AUTOMAKE" --print-libdir`"
+if test ! x"$autolib" = x; then
+ for prg in install-sh compile config.guess config.sub; do
+ if test -f "$autolib"/"$prg"; then
+ cp -f "$autolib"/"$prg" autoconf/helpers
+ fi
+ done
+fi
+mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old
mkdir -p autoconf/m4.old autoconf/m4
mv -f autoconf/m4/*.m4 autoconf/m4.old/ 2>/dev/null || true
ACLOCAL_PATH="${ACLOCAL_PATH}${ACLOCAL_PATH:+:}`pwd`/autoconf/m4.old"
export ACLOCAL_PATH
-aclocal --install --output=autoconf/aclocal.m4 -I autoconf/m4
-test -f autoconf/aclocal.m4
-rm -rf autoconf/m4.old
-autoheader -B autoconf
-autoconf -B autoconf
+"$ACLOCAL" --install --output=autoconf/aclocal.m4 -I autoconf/m4
+if test ! -f autoconf/aclocal.m4; then
+ # aclocal failed, revert to previous files
+ mv -f autoconf/m4.old/*.m4 autoconf/m4/
+ mv -f autoconf/aclocal.m4.old autoconf/aclocal.m4
+fi
+rm -rf autoconf/*m4.old
+"$AUTOHEADER" -B autoconf
+"$AUTOCONF" -B autoconf
rm -rf autom4te.cache config.log config.status config/config.h Makefile
if $recheck; then