From c2cc5c054547b8b9dfa284ebadd51b38c35ecf0c Mon Sep 17 00:00:00 2001 From: Job Snijders Date: Mon, 4 Dec 2023 12:56:35 +0000 Subject: [PATCH] Take advantage of autotools in BSD environments Taken from https://github.com/bgp/bgpq4/blob/main/bootstrap --- autogen.sh | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) 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" -- 2.47.2