netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Hangbin Liu <haliu@redhat.com>
Subject: [Draft iproute2-next PATCH] configure: add options ability
Date: Fri, 28 May 2021 08:35:43 -0400	[thread overview]
Message-ID: <20210528123543.3836-1-liuhangbin@gmail.com> (raw)

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


             reply	other threads:[~2021-05-28 12:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 12:35 Hangbin Liu [this message]
2021-05-29 17:48 ` [Draft iproute2-next PATCH] configure: add options ability David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528123543.3836-1-liuhangbin@gmail.com \
    --to=liuhangbin@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=haliu@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).