From patchwork Tue Oct 5 22:08:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12538111 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFE85C433EF for ; Tue, 5 Oct 2021 22:10:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97394611C5 for ; Tue, 5 Oct 2021 22:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236852AbhJEWLw (ORCPT ); Tue, 5 Oct 2021 18:11:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26016 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236855AbhJEWLt (ORCPT ); Tue, 5 Oct 2021 18:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633471797; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nMjVuiQcE0V1O7GzOw8C7RAWrrBYO/rEIuNH5hSn8Gg=; b=gZCjgBBNgkA6ETgjiUtbvja5QOv0qoK/BnXjwlbNFtlcE8eu9U3P3cFMvVk3OSz0KfQngB ee7AAp6ZUIMZYIS0Wd7nMGvHcgqkIKWaK/jOM6cRMPLTuDI3CUrYYIBnr0kwR+dgGOir7K 3LS9Kl+kegu3rkdlUx1JINMANlRYyPU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-umoR-0W8NhWGtwlUnEMDEQ-1; Tue, 05 Oct 2021 18:09:56 -0400 X-MC-Unique: umoR-0W8NhWGtwlUnEMDEQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2C3C18414A7; Tue, 5 Oct 2021 22:09:43 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 342F2652BA; Tue, 5 Oct 2021 22:09:42 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org Subject: [PATCH iproute2 v3 1/3] configure: support --param=value style Date: Wed, 6 Oct 2021 00:08:04 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com This commit makes it possible to specify values for configure params using the common autotools configure syntax '--param=value'. Signed-off-by: Andrea Claudi --- configure | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 7f4f3bd9..d57ce0f8 100755 --- a/configure +++ b/configure @@ -501,18 +501,30 @@ if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then else while true; do case "$1" in - --include_dir) - INCLUDE=$2 - shift 2 ;; - --libbpf_dir) - LIBBPF_DIR="$2" - shift 2 ;; - --libbpf_force) - if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then + --include_dir | --include_dir=*) + INCLUDE="${1#*=}" + if [ "$INCLUDE" == "--include_dir" ]; then + INCLUDE=$2 + shift + fi + shift ;; + --libbpf_dir | --libbpf_dir=*) + LIBBPF_DIR="${1#*=}" + if [ "$LIBBPF_DIR" == "--libbpf_dir" ]; then + LIBBPF_DIR="$2" + shift + fi + shift ;; + --libbpf_force | --libbpf_force=*) + LIBBPF_FORCE="${1#*=}" + if [ "$LIBBPF_FORCE" == "--libbpf_force" ]; then + LIBBPF_FORCE="$2" + shift + fi + if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then usage 1 fi - LIBBPF_FORCE=$2 - shift 2 ;; + shift ;; -h | --help) usage 0 ;; "") From patchwork Tue Oct 5 22:08:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12538113 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0036C433F5 for ; Tue, 5 Oct 2021 22:10:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8250A611C5 for ; Tue, 5 Oct 2021 22:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbhJEWLy (ORCPT ); Tue, 5 Oct 2021 18:11:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43860 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236844AbhJEWLt (ORCPT ); Tue, 5 Oct 2021 18:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633471798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=se6Vzn8R2jh8d5TGQ4NFPjldNf0Gh0tNsZUON1pB9tM=; b=GNWPmRBLnHq6c/K3eGcukgl77cWQ6BVzlbHVOZeUoFGiTlsmPFzW8qxnIJ4xQyO3XOnwPi Ks8waBmrz60Uz57rsGfMcocjCQAcmYWz42sRtGS0Ep9k7YcGP7Aig245Qikhcyv21vV4dp R9cR5AvFlRrqtrN/Z94C5LAapmXQoaI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-Kklw3IAJMTefEoFyfoBfSw-1; Tue, 05 Oct 2021 18:09:57 -0400 X-MC-Unique: Kklw3IAJMTefEoFyfoBfSw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 504AD100793C; Tue, 5 Oct 2021 22:09:45 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A882652BA; Tue, 5 Oct 2021 22:09:43 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org Subject: [PATCH iproute2 v3 2/3] configure: add the --prefix option Date: Wed, 6 Oct 2021 00:08:05 +0200 Message-Id: <712dcd1a0541ab82602e775db57b178dfc78c031.1633455436.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com This commit add the '--prefix' option to the iproute2 configure script. This mimics the '--prefix' option that autotools configure provides, and will be used later to allow users or packagers to set the lib directory. Signed-off-by: Andrea Claudi --- configure | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/configure b/configure index d57ce0f8..8be7e40b 100755 --- a/configure +++ b/configure @@ -148,6 +148,15 @@ EOF rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest } +check_prefix() +{ + if [ -n "$PREFIX" ]; then + prefix="$PREFIX" + else + prefix="/usr" + fi +} + check_ipt() { if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then @@ -490,6 +499,7 @@ Usage: $0 [OPTIONS] --libbpf_force Enable/disable libbpf by force. Available options: on: require link against libbpf, quit config if no libbpf support off: disable libbpf probing + --prefix Path prefix of the lib files to install -h | --help Show this usage info EOF exit $1 @@ -525,6 +535,13 @@ else usage 1 fi shift ;; + --prefix | --prefix=*) + PREFIX="${1#*=}" + if [ "$PREFIX" == "--prefix" ]; then + PREFIX="$2" + shift + fi + shift ;; -h | --help) usage 0 ;; "") @@ -558,6 +575,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then fi echo +check_prefix if ! grep -q TC_CONFIG_NO_XT $CONFIG; then echo -n "iptables modules directory: " check_ipt_lib_dir From patchwork Tue Oct 5 22:08:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12538115 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7816C433EF for ; Tue, 5 Oct 2021 22:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDBA561244 for ; Tue, 5 Oct 2021 22:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236902AbhJEWME (ORCPT ); Tue, 5 Oct 2021 18:12:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22499 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236894AbhJEWMC (ORCPT ); Tue, 5 Oct 2021 18:12:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633471811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8GkNzl61HcLQvh0Hg2BBx5+s1fCKoWModcB2jt/xuOo=; b=RGUMvn6Hb0VouaF1lDaFQeFj64fkbqDI/VDM0ImDHFtz/tWRLS45hGlGTMWUsx0jXWk3qK 40aqet/R8cKyRwYXyagMaSPhr49oDxFVSIT35Nrq+UIZCs6XCWCIvzviZtYdgfdl/L167s ajlYkgH9hA4xokWRocgRNzS8BSNw2zo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-kmfdd5ACM9CJCG0ZdU964g-1; Tue, 05 Oct 2021 18:10:01 -0400 X-MC-Unique: kmfdd5ACM9CJCG0ZdU964g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E7A81100CD04; Tue, 5 Oct 2021 22:09:46 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9D5A652AE; Tue, 5 Oct 2021 22:09:45 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org Subject: [PATCH iproute2 v3 3/3] configure: add the --libdir option Date: Wed, 6 Oct 2021 00:08:06 +0200 Message-Id: <59f39788fe40ce93f659540c83a303d12cdbefdc.1633455436.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com This commit allows users/packagers to choose a lib directory to store iproute2 lib files. At the moment iproute2 ship lib files in /usr/lib and offers no way to modify this setting. However, according to the FHS, distros may choose "one or more variants of the /lib directory on systems which support more than one binary format" (e.g. /usr/lib64 on Fedora). As Luca states in commit a3272b93725a ("configure: restore backward compatibility"), packaging systems may assume that 'configure' is from autotools, and try to pass it some parameters. Allowing the '--libdir=/path/to/libdir' syntax, we can use this to our advantage, and let the lib directory to be chosen by the distro packaging system. Signed-off-by: Andrea Claudi --- Makefile | 7 ++++--- configure | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5bc11477..45655ca4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # Top level Makefile for iproute2 +-include config.mk + ifeq ("$(origin V)", "command line") VERBOSE = $(V) endif @@ -13,7 +15,6 @@ MAKEFLAGS += --no-print-directory endif PREFIX?=/usr -LIBDIR?=$(PREFIX)/lib SBINDIR?=/sbin CONFDIR?=/etc/iproute2 NETNS_RUN_DIR?=/var/run/netns @@ -60,7 +61,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a LDLIBS += $(LIBNETLINK) -all: config +all: config.mk @set -e; \ for i in $(SUBDIRS); \ do echo; echo $$i; $(MAKE) -C $$i; done @@ -80,7 +81,7 @@ help: @echo "Make Arguments:" @echo " V=[0|1] - set build verbosity level" -config: +config.mk: @if [ ! -f config.mk -o configure -nt config.mk ]; then \ sh configure $(KERNEL_INCLUDE); \ fi diff --git a/configure b/configure index 8be7e40b..858d2e41 100755 --- a/configure +++ b/configure @@ -157,6 +157,19 @@ check_prefix() fi } +check_lib_dir() +{ + echo -n "lib directory: " + if [ -n "$LIBDIR" ]; then + eval echo "$LIBDIR" + eval echo "LIBDIR:=$LIBDIR" >> $CONFIG + return + fi + + eval echo "${prefix}/lib" + eval echo "LIBDIR:=${prefix}/lib" >> $CONFIG +} + check_ipt() { if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then @@ -495,6 +508,7 @@ usage() cat <