preproc: move %use package parsing to a separate routine
[nasm.git] / autogen.sh
blobe07324cdf66e58d18037abb800158a7b169f5889
1 #!/bin/sh -x
3 # Run this script to regenerate autoconf files
5 recheck=false
6 if [ x"$1" = x--recheck ]; then
7 recheck=true
8 config=$(sh config.status --config 2>/dev/null)
9 fi
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}"
17 mkdir -p autoconf autoconf/helpers config
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
24 done
26 mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old
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
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
37 rm -rf autoconf/*m4.old
38 "$AUTOHEADER" -B autoconf
39 "$AUTOCONF" -B autoconf
40 rm -rf autom4te.cache config.log config.status config/config.h Makefile
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 -