[PATCH iproute2-next 0/2] configure: convert global env to command-line options

STALE1889d

4 messages, 2 authors, 2021-06-03 · open the first message on its own page

[PATCH iproute2-next 0/2] configure: convert global env to command-line options

From: Hangbin Liu <hidden>
Date: 2021-05-31 09:48:18

This path set converts the global environment to command-line options
to make it easier for users to learn or remember the config options.

I only convert environment INCLUDE, LIBBPF_DIR, LIBBPF_FORCE at first.
The IPTC and IPTL are not converted as I don't know what they stand for.

Hangbin Liu (2):
  configure: add options ability
  configure: convert LIBBPF environment variables to command-line
    options

 configure | 49 +++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 6 deletions(-)

-- 
2.26.3

[PATCH iproute2-next 1/2] configure: add options ability

From: Hangbin Liu <hidden>
Date: 2021-05-31 09:48:12

There are more and more global environment variables that land everywhere
in configure, which is making user hard to know which one does what.
Using command-line options would make it easier for users to learn or
remember the config options.

This patch converts the INCLUDE variable to command option first. Check
if the first variable has '-' to compile with the old INCLUDE path
setting method.

Signed-off-by: Hangbin Liu <redacted>
---
 configure | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 179eae08..c58419c2 100755
--- a/configure
+++ b/configure
@@ -7,7 +7,7 @@
 #                           off: disable libbpf probing
 #   LIBBPF_DIR              Path to libbpf DESTDIR to use
 
-INCLUDE=${1:-"$PWD/include"}
+INCLUDE="$PWD/include"
 
 # Output file which is input to Makefile
 CONFIG=config.mk
@@ -486,6 +486,35 @@ endif
 EOF
 }
 
+usage()
+{
+	cat <<EOF
+Usage: $0 [OPTIONS]
+	--include_dir		Path to iproute2 include dir
+	-h | --help		Show this usage info
+EOF
+	exit $1
+}
+
+# Compat with the old INCLUDE path setting method.
+if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
+	INCLUDE="$1"
+else
+	while true; do
+		case "$1" in
+			--include_dir)
+				INCLUDE=$2
+				shift 2 ;;
+			-h | --help)
+				usage 0 ;;
+			"")
+				break ;;
+			*)
+				usage 1 ;;
+		esac
+	done
+fi
+
 echo "# Generated config based on" $INCLUDE >$CONFIG
 quiet_config >> $CONFIG
 
-- 
2.26.3

[PATCH iproute2-next 2/2] configure: convert LIBBPF environment variables to command-line options

From: Hangbin Liu <hidden>
Date: 2021-05-31 09:48:22

Signed-off-by: Hangbin Liu <redacted>
---
 configure | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index c58419c2..0a4a0fc9 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # This is not an autoconf generated configure
-#
-# Influential LIBBPF environment variables:
-#   LIBBPF_FORCE={on,off}   on: require link against libbpf;
-#                           off: disable libbpf probing
-#   LIBBPF_DIR              Path to libbpf DESTDIR to use
 
 INCLUDE="$PWD/include"
 
@@ -491,6 +486,10 @@ usage()
 	cat <<EOF
 Usage: $0 [OPTIONS]
 	--include_dir		Path to iproute2 include dir
+	--libbpf_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
 EOF
 	exit $1
@@ -505,6 +504,15 @@ else
 			--include_dir)
 				INCLUDE=$2
 				shift 2 ;;
+			--libbpf_dir)
+				LIBBPF_DIR="$2"
+				shift 2 ;;
+			--libbpf_force)
+				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
+					usage 1
+				fi
+				LIBBPF_FORCE=$2
+				shift 2 ;;
 			-h | --help)
 				usage 0 ;;
 			"")
-- 
2.26.3

Re: [PATCH iproute2-next 0/2] configure: convert global env to command-line options

From: David Ahern <hidden>
Date: 2021-06-03 03:41:48

On 5/31/21 3:47 AM, Hangbin Liu wrote:
This path set converts the global environment to command-line options
to make it easier for users to learn or remember the config options.

I only convert environment INCLUDE, LIBBPF_DIR, LIBBPF_FORCE at first.
The IPTC and IPTL are not converted as I don't know what they stand for.

Hangbin Liu (2):
  configure: add options ability
  configure: convert LIBBPF environment variables to command-line
    options

 configure | 49 +++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 6 deletions(-)
applied to iproute2-next. Thanks,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help