From 49a5d48d0a43bac313c8b8d1b167e60da9eaadf6 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 18 Jun 2024 16:54:13 -0400 Subject: configure: Fix VAR=value before --option Previously we were not shifting all arguments, leading to $ ./configure CC=gcc --enable-release make: unrecognized option '--enable-release' as the loop would shift the CC=gcc argument instead of --enable-release. --- configure | 153 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 77 insertions(+), 76 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 40eb313..bed7df2 100755 --- a/configure +++ b/configure @@ -7,22 +7,62 @@ set -eu -# Save the ./configure command line for bfs --version -export CONFIG="$0 $*" +# Print the help message() +help() { + cat </dev/null +} + +# Save the ./configure command line for bfs --version +export CONFIG="$0 $*" + +# Default to `make` +MAKE="${MAKE-make}" + +# Parse the command-line arguments for arg; do + shift + # --[(enable|disable|with|without)-]$name[=$value] value="${arg#*=}" name="${arg%%=*}" @@ -80,67 +139,13 @@ for arg; do case "$arg" in -h|--help) - cat <&2 ;; MAKE=*) - shift MAKE="$value" ;; # make flag (-j2) or variable (CC=clang) -*|*=*) - continue + set -- "$@" "$arg" ;; *) @@ -196,6 +197,6 @@ for f in Makefile build completions docs src tests; do done # Set MAKEFLAGS to -j$(nproc) if it's unset -export MAKEFLAGS="${MAKEFLAGS-$j}" +export MAKEFLAGS="${MAKEFLAGS--j$(nproc)}" $MAKE -rf build/config.mk "$@" -- cgit v1.2.3