From 064e8ce58b385e8fe79b29ce84294adcf8c12a6f Mon Sep 17 00:00:00 2001 From: Roelf Wichertjes Date: Mon, 16 Dec 2019 20:48:53 +0100 Subject: [PATCH] Add BSD support to bootstrap. --- bootstrap | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/bootstrap b/bootstrap index b9c4f0e..0f97478 100755 --- a/bootstrap +++ b/bootstrap @@ -3,4 +3,40 @@ # Script to help bootstrap the build system when checked out from git # -autoreconf -i +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 + + 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"