[PATCH iproute2 v4 3/5] configure: support --param=value style
From: Andrea Claudi <hidden>
Date: 2021-10-07 13:41:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
This commit makes it possible to specify values for configure params using the common autotools configure syntax '--param=value'. To avoid code duplication, semantic check on libbpf_force is moved to a dedicated function. Signed-off-by: Andrea Claudi <redacted> --- configure | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/configure b/configure
index 27db3ecb..08e7410b 100755
--- a/configure
+++ b/configure@@ -485,12 +485,12 @@ usage() { cat <<EOF Usage: $0 [OPTIONS] - --include_dir <dir> Path to iproute2 include dir - --libbpf_dir <dir> Path to libbpf DESTDIR - --libbpf_force Enable/disable libbpf by force. Available options: - on: require link against libbpf, quit config if no libbpf support - off: disable libbpf probing - -h | --help Show this usage info + --include_dir <dir> Path to iproute2 include dir + --libbpf_dir <dir> Path to libbpf DESTDIR + --libbpf_force <on|off> Enable/disable libbpf by force. + on: require link against libbpf, quit config if no libbpf support + off: disable libbpf probing + -h | --help Show this usage info EOF exit $1 }
@@ -500,6 +500,13 @@ check_value() [ -z "$1" ] && usage 1 } +check_onoff() +{ + if [ "$1" != 'on' ] && [ "$1" != 'off' ]; then + usage 1 + fi +} + # Compat with the old INCLUDE path setting method. if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then INCLUDE="$1"
@@ -510,16 +517,26 @@ else INCLUDE=$2 check_value "$INCLUDE" shift 2 ;; + --include_dir=*) + INCLUDE="${1#*=}" + check_value "$INCLUDE" + shift ;; --libbpf_dir) LIBBPF_DIR="$2" check_value "$LIBBPF_DIR" shift 2 ;; + --libbpf_dir=*) + LIBBPF_DIR="${1#*=}" + check_value "$LIBBPF_DIR" + shift ;; --libbpf_force) - if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then - usage 1 - fi LIBBPF_FORCE=$2 + check_onoff "$LIBBPF_FORCE" shift 2 ;; + --libbpf_force=*) + LIBBPF_FORCE="${1#*=}" + check_onoff "$LIBBPF_FORCE" + shift ;; -h | --help) usage 0 ;; "")
@@ -528,6 +545,7 @@ else shift 1 ;; esac done + fi echo "# Generated config based on" $INCLUDE >$CONFIG
--
2.31.1