netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Draft iproute2-next PATCH] configure: add options ability
@ 2021-05-28 12:35 Hangbin Liu
  2021-05-29 17:48 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Hangbin Liu @ 2021-05-28 12:35 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Stephen Hemminger, Hangbin Liu

From: Hangbin Liu <haliu@redhat.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@redhat.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-29 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-28 12:35 [Draft iproute2-next PATCH] configure: add options ability Hangbin Liu
2021-05-29 17:48 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).