diff mbox series

[iproute2,v4,3/5] configure: support --param=value style

Message ID fef1422ef90f7e868a86c15d2bfb1fd35dbdd545.1633612111.git.aclaudi@redhat.com (mailing list archive)
State Changes Requested
Delegated to: David Ahern
Headers show
Series configure: add support for libdir and prefix option | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Andrea Claudi Oct. 7, 2021, 1:40 p.m. UTC
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 <aclaudi@redhat.com>
---
 configure | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)
diff mbox series

Patch

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