From: Job Snijders Date: Mon, 4 Dec 2023 12:56:35 +0000 (+0000) Subject: Take advantage of autotools in BSD environments X-Git-Tag: 1.6.1~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F102%2Fhead;p=thirdparty%2FFORT-validator.git Take advantage of autotools in BSD environments Taken from https://github.com/bgp/bgpq4/blob/main/bootstrap --- diff --git a/autogen.sh b/autogen.sh index d9debd26..15e0846f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,42 @@ #!/bin/sh +# +# Script to help bootstrap the build system when checked out from git +# -# Hello. -# Run this file to generate the configure script. -# You'll need Autoconf and Automake installed! +bsd_environment() { + # Based on https://github.com/rvm/rvm/blob/59fe3b39f0fb5ae01ed5b9aa187201080815ac16/scripts/functions/build_config_system#L123 + if [ -z "${AUTOCONF_VERSION}" ] + then + export AUTOCONF_VERSION + AUTOCONF_VERSION="$( + ls -1 /usr/local/bin/autoreconf-* | + awk -F- '{print $NF}' | + sort | + tail -n 1 + )" + echo "Using autoconf version: $AUTOCONF_VERSION" + fi -autoreconf --install --force + if [ -z "${AUTOMAKE_VERSION}" ] + then + export AUTOMAKE_VERSION + # FreeBSD might have automake-wrapper + AUTOMAKE_VERSION="$( + ls -1 /usr/local/bin/automake-1* | + awk -F- '{print $NF}' | + sort | + tail -n 1 + )" + echo "Using automake version: $AUTOMAKE_VERSION" + fi +} + +# Use the uname string to figure out if this is a BSD +case "$(uname)" in + *BSD*) bsd_environment ;; +esac + +test -n "$srcdir" || srcdir="$(dirname "$0")" +test -n "$srcdir" || srcdir=. + +autoreconf --force --install --verbose "$srcdir"