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 |
| 21 | if test -f "$autolib"/"$prg"; then |
| 22 | cp -f "$autolib"/"$prg" autoconf/helpers |
| 23 | fi |
| 24 | done |
| 25 | fi |
| 26 | mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old |
H. Peter Anvin | b0121dc | 2018-12-22 18:17:16 -0800 | [diff] [blame] | 27 | mkdir -p autoconf/m4.old autoconf/m4 |
| 28 | mv -f autoconf/m4/*.m4 autoconf/m4.old/ 2>/dev/null || true |
| 29 | ACLOCAL_PATH="${ACLOCAL_PATH}${ACLOCAL_PATH:+:}`pwd`/autoconf/m4.old" |
| 30 | export ACLOCAL_PATH |
H. Peter Anvin (Intel) | dea9038 | 2019-08-07 17:43:20 -0700 | [diff] [blame] | 31 | "$ACLOCAL" --install --output=autoconf/aclocal.m4 -I autoconf/m4 |
| 32 | if test ! -f autoconf/aclocal.m4; then |
| 33 | # aclocal failed, revert to previous files |
| 34 | mv -f autoconf/m4.old/*.m4 autoconf/m4/ |
| 35 | mv -f autoconf/aclocal.m4.old autoconf/aclocal.m4 |
| 36 | fi |
| 37 | rm -rf autoconf/*m4.old |
| 38 | "$AUTOHEADER" -B autoconf |
| 39 | "$AUTOCONF" -B autoconf |
H. Peter Anvin | b0121dc | 2018-12-22 18:17:16 -0800 | [diff] [blame] | 40 | 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] | 41 | |
| 42 | if $recheck; then |
| 43 | # This bizarre statement has to do with how config.status quotes its output |
| 44 | echo exec sh configure $config | sh - |
| 45 | fi |