remap: *actually* build, and fix masked logic errors
[tftp-hpa.git] / autogen.sh
blob0c892cc2a0495504326415f26d991004d4fd639a
1 #!/bin/sh -x
3 # Run this script to regenerate autoconf files
5 recheck=false
6 for arg; do
7 case x"$arg" in
8 x--recheck)
9 recheck=true
10 config=$(sh config.status --config 2>/dev/null)
12 x--clearenv)
13 unset AUTOCONF AUTOMAKE ACLOCAL AUTOHEADER ACLOCAL_PATH
16 echo "$0: unknown option: $arg" 1>&2
18 esac
19 done
21 # This allows for overriding the default autoconf programs
22 AUTOCONF="${AUTOCONF:-${AUTOTOOLS_PREFIX}autoconf}"
23 AUTOMAKE="${AUTOMAKE:-${AUTOTOOLS_PREFIX}automake}"
24 ACLOCAL="${ACLOCAL:-${AUTOTOOLS_PREFIX}aclocal}"
25 AUTOHEADER="${AUTOHEADER:-${AUTOTOOLS_PREFIX}autoheader}"
27 mkdir -p autoconf autoconf/helpers config
28 autolib="`"$AUTOMAKE" --print-libdir`"
29 if test ! x"$autolib" = x; then
30 for prg in install-sh compile config.guess config.sub; do
31 # Update autoconf helpers if and only if newer ones are available
32 if test -f "$autolib"/"$prg" && \
33 ( set -e ; \
34 test -f autoconf/helpers/"$prg" && sed -n \
35 -e 's/^scriptver=/scriptversion=/' \
36 -e 's/^timestamp=/scriptversion=/' \
37 -e 's/^scriptversion=['\''"]?\([^'\''"]*\).*$/\1/p' \
38 "$autolib"/"$prg" autoconf/helpers/"$prg" | \
39 sort -c 2>/dev/null ; \
40 test $? -ne 0 )
41 then
42 cp -f "$autolib"/"$prg" autoconf/helpers
44 done
46 mv -f autoconf/aclocal.m4 autoconf/aclocal.m4.old
47 mkdir -p autoconf/m4.old autoconf/m4
48 mv -f autoconf/m4/*.m4 autoconf/m4.old/ 2>/dev/null || true
49 ACLOCAL_PATH="${ACLOCAL_PATH}${ACLOCAL_PATH:+:}`pwd`/autoconf/m4.old"
50 export ACLOCAL_PATH
51 "$ACLOCAL" --install --output=autoconf/aclocal.m4 -I autoconf/m4
52 if test ! -f autoconf/aclocal.m4; then
53 # aclocal failed, revert to previous files
54 mv -f autoconf/m4.old/*.m4 autoconf/m4/
55 mv -f autoconf/aclocal.m4.old autoconf/aclocal.m4
56 exit 1
58 rm -rf autoconf/*m4.old
59 "$AUTOHEADER" -B autoconf
60 "$AUTOCONF" -B autoconf
62 echo '#!/bin/sh'
63 "$AUTOCONF" -B autoconf \
64 -t AC_CONFIG_HEADERS:'rm -f $*' \
65 -t AC_CONFIG_FILES:'rm -f $*'
66 echo 'rm -f config.log config.status'
67 echo 'rm -rf autom4te.cache'
68 ) > autoconf/clean.sh
69 chmod +x autoconf/clean.sh
70 sh autoconf/clean.sh
72 rm -f configure~ || true
74 # Try to regenerate unconfig.h if Perl is available and unconfig.pl
75 # is present in the autoconf directory.
76 if [ -n "$(which perl)" -a -f autoconf/unconfig.pl ]; then
77 perl autoconf/unconfig.pl . config/config.h.in config/unconfig.h
80 if $recheck; then
81 # This bizarre statement has to do with how config.status quotes its output
82 echo exec sh configure $config | sh -