H. Peter Anvin (Intel) | dea9038 | 2019-08-07 17:43:20 -0700 | [diff] [blame] | 1 | #!/bin/sh -x |
H. Peter Anvin | 2030bd2 | 2007-04-12 16:25:58 +0000 | [diff] [blame] | 2 | # |
H. Peter Anvin | b0121dc | 2018-12-22 18:17:16 -0800 | [diff] [blame] | 3 | # Run this script to regenerate autoconf files |
H. Peter Anvin | 2030bd2 | 2007-04-12 16:25:58 +0000 | [diff] [blame] | 4 | # |
H. Peter Anvin | 54d5078 | 2018-12-22 18:51:59 -0800 | [diff] [blame] | 5 | recheck=false |
| 6 | if [ x"$1" = x--recheck ]; then |
| 7 | recheck=true |
| 8 | config=$(sh config.status --config 2>/dev/null) |
| 9 | fi |
| 10 | |
H. Peter Anvin (Intel) | dea9038 | 2019-08-07 17:43:20 -0700 | [diff] [blame] | 11 | # This allows for overriding the default autoconf programs |
| 12 | AUTOCONF="${AUTOCONF:-${AUTOTOOLS_PREFIX}autoconf}" |
| 13 | AUTOMAKE="${AUTOMAKE:-${AUTOTOOLS_PREFIX}automake}" |
| 14 | ACLOCAL="${ACLOCAL:-${AUTOTOOLS_PREFIX}aclocal}" |
| 15 | AUTOHEADER="${AUTOHEADER:-${AUTOTOOLS_PREFIX}autoheader}" |
| 16 | |
H. Peter Anvin | 0bddd0f | 2019-02-22 01:13:52 -0800 | [diff] [blame] | 17 | mkdir -p autoconf autoconf/helpers config |
H. Peter Anvin (Intel) | dea9038 | 2019-08-07 17:43:20 -0700 | [diff] [blame] | 18 | autolib="`"$AUTOMAKE" --print-libdir`" |
| 19 | if test ! x"$autolib" = x; then |
| 20 | for prg in install-sh compile config.guess config.sub; do |
H. Peter Anvin (Intel) | 01a67a1 | 2019-09-24 11:13:43 -0700 | [diff] [blame] | 21 | # Update autoconf helpers if and only if newer ones are available |
| 22 | if test -f "$autolib"/"$prg" && \ |
| 23 | ( test -f "$autolib"/"$prg" && \ |
| 24 | sed -n -r -e \ |
| 25 | 's/^(scriptver(|sion)|timestamp)=['\''"]?([^'\''"]+).*$/\3/p' \ |
| 26 | "$autolib"/"$prg" autoconf/helpers/"$prg" | \ |
| 27 | sort --check=quiet; test $? -ne 0 ) |
| 28 | then |
H. Peter Anvin (Intel) | dea9038 | 2019-08-07 17:43:20 -0700 | [diff] [blame] | 29 | cp -f "$autolib"/"$prg" autoconf/helpers |
| 30 | fi |
| 31 | done |
| 32 | fi |
| 33 | mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old |
H. Peter Anvin | b0121dc | 2018-12-22 18:17:16 -0800 | [diff] [blame] | 34 | mkdir -p autoconf/m4.old autoconf/m4 |
| 35 | mv -f autoconf/m4/*.m4 autoconf/m4.old/ 2>/dev/null || true |
| 36 | ACLOCAL_PATH="${ACLOCAL_PATH}${ACLOCAL_PATH:+:}`pwd`/autoconf/m4.old" |
| 37 | export ACLOCAL_PATH |
H. Peter Anvin (Intel) | dea9038 | 2019-08-07 17:43:20 -0700 | [diff] [blame] | 38 | "$ACLOCAL" --install --output=autoconf/aclocal.m4 -I autoconf/m4 |
| 39 | if test ! -f autoconf/aclocal.m4; then |
| 40 | # aclocal failed, revert to previous files |
| 41 | mv -f autoconf/m4.old/*.m4 autoconf/m4/ |
| 42 | mv -f autoconf/aclocal.m4.old autoconf/aclocal.m4 |
| 43 | fi |
| 44 | rm -rf autoconf/*m4.old |
| 45 | "$AUTOHEADER" -B autoconf |
| 46 | "$AUTOCONF" -B autoconf |
H. Peter Anvin | b0121dc | 2018-12-22 18:17:16 -0800 | [diff] [blame] | 47 | rm -rf autom4te.cache config.log config.status config/config.h Makefile |
H. Peter Anvin | 54d5078 | 2018-12-22 18:51:59 -0800 | [diff] [blame] | 48 | |
| 49 | if $recheck; then |
| 50 | # This bizarre statement has to do with how config.status quotes its output |
| 51 | echo exec sh configure $config | sh - |
| 52 | fi |