[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210528123543.3836-1-liuhangbin@gmail.com>
Date: Fri, 28 May 2021 08:35:43 -0400
From: Hangbin Liu <liuhangbin@...il.com>
To: netdev@...r.kernel.org
Cc: David Ahern <dsahern@...il.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Hangbin Liu <haliu@...hat.com>
Subject: [Draft iproute2-next PATCH] configure: add options ability
From: Hangbin Liu <haliu@...hat.com>
Hi David,
As we talked in my previous libbpf support patchset. You'd like to make
configure with option settings. Here is a draft patch. Not sure if this
is what you want.
There are also a lot variables that I not sure if we should add options
for them. e.g. PKG_CONFIG, CC, IPTC, IPT_LIB_DIR, etc. Do you have any
suggestions?
---
As there are more and more global environment variables in configures.
it would be more clear with options for users. Add related options for
variables. Keep using the same name so the old way (set global env) is
still working.
Signed-off-by: Hangbin Liu <haliu@...hat.com>
---
configure | 45 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index 179eae08..aae324c9 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,8 @@
#!/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=${1:-"$PWD/include"}
+INCLUDE="$PWD/include"
# Output file which is input to Makefile
CONFIG=config.mk
@@ -486,6 +481,44 @@ endif
EOF
}
+usage()
+{
+ cat <<EOF
+Usage: $0 [OPTIONS]
+ --libbpf_force enable/disable libbpf by force.
+ on: require link against libbpf, quite config if no libbpf support
+ off: disable libbpf probing
+ --libbpf_dir Path to libbpf DESTDIR to use
+ --include_dir Path to iproute2 include dir
+ -h | --help Show this usage info
+EOF
+ exit $1
+}
+
+while true; do
+ case "$1" in
+ --libbpf_force)
+ if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
+ usage 1
+ fi
+ LIBBPF_FORCE=$2
+ shift 2 ;;
+ --libbpf_dir)
+ LIBBPF_DIR="$2"
+ shift 2 ;;
+ --include_dir)
+ # How to deal with the old INCLUDE usage?
+ INCLUDE=$2
+ shift 2 ;;
+ -h | --help)
+ usage 0 ;;
+ "")
+ break ;;
+ *)
+ usage 1 ;;
+ esac
+done
+
echo "# Generated config based on" $INCLUDE >$CONFIG
quiet_config >> $CONFIG
--
2.26.3
Powered by blists - more mailing lists