#!/usr/bin/env bash
# $Id: bootstrap 184 2026-08-08 14:33:50Z peter $
#
# bootstrap - regenerate the autotools machinery for dvi3v
#
# Copyright (C) 2026  Peter Felecan
# Copyright (C) 2026  Anthropic AI (Claude Sonnet 5)
#
# Licensed under GNU GPL v3
#
# Run this once after a fresh checkout (or after editing configure.ac
# / Makefile.am) to produce 'configure' and 'Makefile.in'. Then run
# ./configure as usual.

set -euo pipefail

# Refuse to run from anywhere other than the project root.
if [[ ! -f configure.ac ]]
then
	echo "bootstrap: must be run from the project root (configure.ac not found)" >&2
	exit 1
fi

# --install copies (or symlinks) auxiliary build files; --symlink uses
# symlinks during development so that updates to system-wide autotools
# data are picked up without re-bootstrapping. --force is required:
# configure.ac reads VERSION via m4_esyscmd_s at regeneration time, but
# autoreconf's own staleness check only looks at configure.ac/aclocal.m4
# timestamps, not at VERSION --- without --force, a VERSION bump with no
# other configure.ac change would leave a stale PACKAGE_VERSION baked
# into an unchanged 'configure'.
exec autoreconf --install --symlink --force --verbose
