blob: 5597c8a01eee725e522c94835db0e5c61a078e77 [file] [log] [blame]
H. Peter Anvin (Intel)dea90382019-08-07 17:43:20 -07001#!/bin/sh -x
H. Peter Anvin2030bd22007-04-12 16:25:58 +00002#
H. Peter Anvinb0121dc2018-12-22 18:17:16 -08003# Run this script to regenerate autoconf files
H. Peter Anvin2030bd22007-04-12 16:25:58 +00004#
H. Peter Anvin54d50782018-12-22 18:51:59 -08005recheck=false
6if [ x"$1" = x--recheck ]; then
7 recheck=true
8 config=$(sh config.status --config 2>/dev/null)
9fi
10
H. Peter Anvin (Intel)dea90382019-08-07 17:43:20 -070011# This allows for overriding the default autoconf programs
12AUTOCONF="${AUTOCONF:-${AUTOTOOLS_PREFIX}autoconf}"
13AUTOMAKE="${AUTOMAKE:-${AUTOTOOLS_PREFIX}automake}"
14ACLOCAL="${ACLOCAL:-${AUTOTOOLS_PREFIX}aclocal}"
15AUTOHEADER="${AUTOHEADER:-${AUTOTOOLS_PREFIX}autoheader}"
16
H. Peter Anvin0bddd0f2019-02-22 01:13:52 -080017mkdir -p autoconf autoconf/helpers config
H. Peter Anvin (Intel)dea90382019-08-07 17:43:20 -070018autolib="`"$AUTOMAKE" --print-libdir`"
19if test ! x"$autolib" = x; then
20 for prg in install-sh compile config.guess config.sub; do
H. Peter Anvin (Intel)01a67a12019-09-24 11:13:43 -070021 # 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)dea90382019-08-07 17:43:20 -070029 cp -f "$autolib"/"$prg" autoconf/helpers
30 fi
31 done
32fi
33mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old
H. Peter Anvinb0121dc2018-12-22 18:17:16 -080034mkdir -p autoconf/m4.old autoconf/m4
35mv -f autoconf/m4/*.m4 autoconf/m4.old/ 2>/dev/null || true
36ACLOCAL_PATH="${ACLOCAL_PATH}${ACLOCAL_PATH:+:}`pwd`/autoconf/m4.old"
37export ACLOCAL_PATH
H. Peter Anvin (Intel)dea90382019-08-07 17:43:20 -070038"$ACLOCAL" --install --output=autoconf/aclocal.m4 -I autoconf/m4
39if 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
43fi
44rm -rf autoconf/*m4.old
45"$AUTOHEADER" -B autoconf
46"$AUTOCONF" -B autoconf
H. Peter Anvinb0121dc2018-12-22 18:17:16 -080047rm -rf autom4te.cache config.log config.status config/config.h Makefile
H. Peter Anvin54d50782018-12-22 18:51:59 -080048
49if $recheck; then
50 # This bizarre statement has to do with how config.status quotes its output
51 echo exec sh configure $config | sh -
52fi