#!/bin/sh -x

# Copyright 2024 Bob Proulx <bob@proulx.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, see <http://www.gnu.org/licenses/>.

# Since this bootstrap is a maintainer tool we assume that the user
# running this script has the maintainer tools available.  Force
# removal of generated files and then bring everything up to date.

for prog in autoconf automake libtoolize; do
    if ! ($prog --version) >/dev/null 2>&1; then
        echo "Error: Missing: $prog" 1>&2
        exit 1
    fi
done

# Remove generated files to force a complete rebuild.
rm -f aclocal.m4 config.log config.status config.h stamp-h*
rm -f Makefile Makefile.in configure
rm -f src/Makefile src/Makefile.in
rm -f t/Makefile t/Makefile.in
rm -rf build-aux m4

# Bring the build framework up to date.
mkdir -p build-aux m4
autoreconf --install # --verbose
