2019-08-08 08:43:20 +08:00
|
|
|
#!/bin/sh -x
|
2007-04-13 00:25:58 +08:00
|
|
|
#
|
2018-12-23 10:17:16 +08:00
|
|
|
# Run this script to regenerate autoconf files
|
2007-04-13 00:25:58 +08:00
|
|
|
#
|
2018-12-23 10:51:59 +08:00
|
|
|
recheck=false
|
2023-02-20 13:37:37 +08:00
|
|
|
for arg; do
|
|
|
|
case x"$arg" in
|
|
|
|
x--recheck)
|
|
|
|
recheck=true
|
|
|
|
config=$(sh config.status --config 2>/dev/null)
|
|
|
|
;;
|
|
|
|
x--clearenv)
|
|
|
|
unset AUTOCONF AUTOMAKE ACLOCAL AUTOHEADER ACLOCAL_PATH
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$0: unknown option: $arg" 1>&2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2018-12-23 10:51:59 +08:00
|
|
|
|
2019-08-08 08:43:20 +08:00
|
|
|
# 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}"
|
|
|
|
|
2019-02-22 17:13:52 +08:00
|
|
|
mkdir -p autoconf autoconf/helpers config
|
2019-08-08 08:43:20 +08:00
|
|
|
autolib="`"$AUTOMAKE" --print-libdir`"
|
|
|
|
if test ! x"$autolib" = x; then
|
|
|
|
for prg in install-sh compile config.guess config.sub; do
|
2019-09-25 02:13:43 +08:00
|
|
|
# Update autoconf helpers if and only if newer ones are available
|
|
|
|
if test -f "$autolib"/"$prg" && \
|
2020-07-12 12:21:54 +08:00
|
|
|
( set -e ; \
|
|
|
|
test -f autoconf/helpers/"$prg" && sed -n \
|
|
|
|
-e 's/^scriptver=/scriptversion=/' \
|
|
|
|
-e 's/^timestamp=/scriptversion=/' \
|
|
|
|
-e 's/^scriptversion=['\''"]?\([^'\''"]*\).*$/\1/p' \
|
2019-09-25 02:13:43 +08:00
|
|
|
"$autolib"/"$prg" autoconf/helpers/"$prg" | \
|
2020-07-12 12:21:54 +08:00
|
|
|
sort -c 2>/dev/null ; \
|
|
|
|
test $? -ne 0 )
|
2019-09-25 02:13:43 +08:00
|
|
|
then
|
2019-08-08 08:43:20 +08:00
|
|
|
cp -f "$autolib"/"$prg" autoconf/helpers
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old
|
2018-12-23 10:17:16 +08:00
|
|
|
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
|
2019-08-08 08:43:20 +08:00
|
|
|
"$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
|
2023-10-12 01:19:16 +08:00
|
|
|
(
|
|
|
|
echo '#!/bin/sh'
|
|
|
|
"$AUTOCONF" -B autoconf \
|
|
|
|
-t AC_CONFIG_HEADERS:'rm -f $*' \
|
|
|
|
-t AC_CONFIG_FILES:'rm -f $*'
|
|
|
|
echo 'rm -f config.log config.status'
|
|
|
|
echo 'rm -rf autom4te.cache'
|
|
|
|
) > autoconf/clean.sh
|
2024-04-13 03:05:52 +08:00
|
|
|
chmod +x autoconf/clean.sh
|
2023-10-12 01:19:16 +08:00
|
|
|
sh autoconf/clean.sh
|
|
|
|
|
2024-04-13 05:20:59 +08:00
|
|
|
rm -f configure~ || true
|
|
|
|
|
2023-10-12 01:19:16 +08:00
|
|
|
# Try to regenerate unconfig.h if Perl is available and unconfig.pl
|
|
|
|
# is present in the autoconf directory.
|
|
|
|
if [ -n "$(which perl)" -a -f autoconf/unconfig.pl ]; then
|
|
|
|
perl autoconf/unconfig.pl . config/config.h.in config/unconfig.h
|
|
|
|
fi
|
2018-12-23 10:51:59 +08:00
|
|
|
|
|
|
|
if $recheck; then
|
|
|
|
# This bizarre statement has to do with how config.status quotes its output
|
|
|
|
echo exec sh configure $config | sh -
|
|
|
|
fi
|