1#!/bin/sh
2#
3# setup/re-init the autoconf files on a raw checkout
4# minimalistic version
5#
6
7fail() {
8    echo "FAIL: $@" >&2
9    exit 1
10}
11
12# check location
13
14if [ ! -f ./configure.ac ]; then
15    fail "$0 needs to run fromt the top level directory where configure.ac resides."
16fi
17
18# check tools we need
19
20AUTOCONF="${AUTOCONF:-autoconf}"
21AUTORECONF="${AUTORECONF:-autoreconf}"
22AUTOMAKE="${AUTOMAKE:-automake}"
23
24for tool in "$AUTOCONF" "$AUTORECONF" "$AUTOMAKE"; do
25    type "$tool" 2>&1 >/dev/null
26    if test $? -ne 0; then
27        fail "need ${tool} installed."
28    fi
29done
30
31for i in .configured .deps compile aclocal.m4 autom4te.cache \
32    autoscan.log config.guess config.status config.sub \
33    config.h config.h.in config.h.in~ configure configure.scan \
34    depcomp install-sh libtool ltmain.sh missing stamp-h1 \
35    Makefile.in Makefile \
36    src/Makefile.in src/Makefile \
37    test/Makefile.in test/Makefile \
38    ; do
39    test -z "$i" || rm -rf "$i"
40done
41
42"$AUTORECONF" -i || exit $?
43"$AUTOMAKE" || exit $?
44"$AUTOCONF" || exit $?
45