From patchwork Thu Oct 7 13:40:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12541893 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 E3841C433F5 for ; Thu, 7 Oct 2021 13:41:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9A6560F5C for ; Thu, 7 Oct 2021 13:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241651AbhJGNnE (ORCPT ); Thu, 7 Oct 2021 09:43:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41619 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233331AbhJGNnD (ORCPT ); Thu, 7 Oct 2021 09:43:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633614069; 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=DgBi3Druetslx5g2ciQQaglcF4Ow88WfWN70lF9LRi4=; b=VUtAkB1kewmuBnxp59i8qoo04KkP3PiwpqlZNgqNapRWSqiJNDI+pInMtkrom7kbH52MuU UF6CCej+sqi8ULwTwrLyV523AtDuqQp7WLP8ApNcJOthTqUSXwJnkpHObtAyGvDcZKmfN+ dgekSscuUFdXYtNpozRKQvu/iPRcKY8= 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-590-QxPrpJosNtmLbBrcEmvpWA-1; Thu, 07 Oct 2021 09:41:08 -0400 X-MC-Unique: QxPrpJosNtmLbBrcEmvpWA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F0531084691; Thu, 7 Oct 2021 13:41:07 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18C305D9DE; Thu, 7 Oct 2021 13:41:03 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v4 1/5] configure: fix parsing issue on include_dir option Date: Thu, 7 Oct 2021 15:40:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com configure is stuck in an endless loop if '--include_dir' option is used without a value: $ ./configure --include_dir ./configure: line 506: shift: 2: shift count out of range ./configure: line 506: shift: 2: shift count out of range [...] Fix it checking that a value is provided with the option. A dedicated function is used to avoid code duplication, as this check will be needed for further options that may be introduced in the future. Fixes: a9c3d70d902a ("configure: add options ability") Signed-off-by: Andrea Claudi --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 7f4f3bd9..05f75437 100755 --- a/configure +++ b/configure @@ -485,7 +485,7 @@ usage() { cat < Path to iproute2 include dir --libbpf_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 @@ -495,6 +495,11 @@ EOF exit $1 } +check_value() +{ + [ -z "$1" ] && usage 1 +} + # Compat with the old INCLUDE path setting method. if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then INCLUDE="$1" @@ -503,6 +508,7 @@ else case "$1" in --include_dir) INCLUDE=$2 + check_value "$INCLUDE" shift 2 ;; --libbpf_dir) LIBBPF_DIR="$2" From patchwork Thu Oct 7 13:40:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12541895 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 BD815C433F5 for ; Thu, 7 Oct 2021 13:41:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FC4C60F5C for ; Thu, 7 Oct 2021 13:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241676AbhJGNnI (ORCPT ); Thu, 7 Oct 2021 09:43:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41248 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241655AbhJGNnG (ORCPT ); Thu, 7 Oct 2021 09:43:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633614072; 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=klvv3kfqavr7YnpR/CjGTpKmxzuVGLSx1u+UMDfyoYs=; b=A1irEnVQzAuss39yTzLLUutpKE65GCx05R5YOpq6qHs1KJ2lXu7D0dQnsGnFMrZEk/4Qq1 SkVoVNuOA/N55uDzNUZwnu99Ya6kyvYjdmkRwldhY+R/Tg4ZapLJf/B6CAGmAeFxYFiziV 3ef8IIiruZI2t53XmE3EiN+WqEtopiE= 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-272-CH2mdepPOEKlJaKMSiL2ig-1; Thu, 07 Oct 2021 09:41:11 -0400 X-MC-Unique: CH2mdepPOEKlJaKMSiL2ig-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3246319251A1; Thu, 7 Oct 2021 13:41:10 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id E86D15D9DE; Thu, 7 Oct 2021 13:41:07 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v4 2/5] configure: fix parsing issue on libbpf_dir option Date: Thu, 7 Oct 2021 15:40:02 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com configure is stuck in an endless loop if '--libbpf_dir' option is used without a value: $ ./configure --libbpf_dir ./configure: line 515: shift: 2: shift count out of range ./configure: line 515: shift: 2: shift count out of range [...] Fix it checking that a value is provided with the option. Fixes: 7ae2585b865a ("configure: convert LIBBPF environment variables to command-line options") Signed-off-by: Andrea Claudi --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 05f75437..27db3ecb 100755 --- a/configure +++ b/configure @@ -486,7 +486,7 @@ usage() cat < Path to iproute2 include dir - --libbpf_dir Path to libbpf DESTDIR + --libbpf_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 @@ -512,6 +512,7 @@ else shift 2 ;; --libbpf_dir) LIBBPF_DIR="$2" + check_value "$LIBBPF_DIR" shift 2 ;; --libbpf_force) if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then From patchwork Thu Oct 7 13:40:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12541897 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 68DC4C433EF for ; Thu, 7 Oct 2021 13:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47C0D60F5C for ; Thu, 7 Oct 2021 13:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241682AbhJGNnL (ORCPT ); Thu, 7 Oct 2021 09:43:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44826 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241659AbhJGNnJ (ORCPT ); Thu, 7 Oct 2021 09:43:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633614075; 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=vN1uHcF1oVjLVWuIs+t6ltA9/hK+/MVYK89c14WatLE=; b=dx0Rdjct4jGWGsCyPbJTSRAo1dxxJwTB/AfdhfSojYViq+Uzy1PnMJrEz58QC4Ry95josl cOeuHoLqLF/8hndj8Lyi6JZrcxekpSQLNKXZw2+tb+rsuwZ47y3oQ44iC8aBgf77umJabC PhfeYHxFB/DcpU85ocUZ48837I+aHkA= 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-537-himycNtRNKyBdfkjvYOdQQ-1; Thu, 07 Oct 2021 09:41:14 -0400 X-MC-Unique: himycNtRNKyBdfkjvYOdQQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6789284A5E0; Thu, 7 Oct 2021 13:41:13 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id C871C5D9C6; Thu, 7 Oct 2021 13:41:10 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v4 3/5] configure: support --param=value style Date: Thu, 7 Oct 2021 15:40:03 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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'. To avoid code duplication, semantic check on libbpf_force is moved to a dedicated function. Signed-off-by: Andrea Claudi --- configure | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 27db3ecb..08e7410b 100755 --- a/configure +++ b/configure @@ -485,12 +485,12 @@ usage() { cat < Path to iproute2 include dir - --libbpf_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 Path to iproute2 include dir + --libbpf_dir Path to libbpf DESTDIR + --libbpf_force 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 From patchwork Thu Oct 7 13:40: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: 12541899 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 B3B20C433EF for ; Thu, 7 Oct 2021 13:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95A6C6112D for ; Thu, 7 Oct 2021 13:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbhJGNnN (ORCPT ); Thu, 7 Oct 2021 09:43:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25474 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241635AbhJGNnM (ORCPT ); Thu, 7 Oct 2021 09:43:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633614079; 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=DpiTnn7Y1d+mwMkTdgXA5/J37cC45axULgFVdDICv7A=; b=WKCVbS68neUB1JLzRlN6zKyhXLcpeW1QZ4bp8jxKvbaWnLYcMg5SZ3W5R+5sBsiKJb4j89 8bXXbHXZ7avu8Wn2PUUpQl6YGfl30Ht6NSU1Rrq5w3lTbLRBnhhCpP7O60M/1UNSTEZAIS Ivlm3XlEpfGHlgWv65khrNzSQ2b0ToY= 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-477-Zw01pNSNNf2saxmCrD4SIw-1; Thu, 07 Oct 2021 09:41:17 -0400 X-MC-Unique: Zw01pNSNNf2saxmCrD4SIw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 928281084683; Thu, 7 Oct 2021 13:41:16 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04F695D9C6; Thu, 7 Oct 2021 13:41:13 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v4 4/5] configure: add the --prefix option Date: Thu, 7 Oct 2021 15:40:04 +0200 Message-Id: <6bc05f1c06c4440aebbe433aa499d3158335af14.1633612111.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configure b/configure index 08e7410b..2e5ed87e 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. 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 @@ -537,6 +547,14 @@ else LIBBPF_FORCE="${1#*=}" check_onoff "$LIBBPF_FORCE" shift ;; + --prefix) + PREFIX="$2" + check_value "$PREFIX" + shift 2 ;; + --prefix=*) + PREFIX="${1#*=}" + check_value "$PREFIX" + shift ;; -h | --help) usage 0 ;; "") @@ -571,6 +589,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 Thu Oct 7 13:40: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: 12541903 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 37C85C433F5 for ; Thu, 7 Oct 2021 13:41:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25AEA60F5C for ; Thu, 7 Oct 2021 13:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241734AbhJGNnU (ORCPT ); Thu, 7 Oct 2021 09:43:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38098 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241718AbhJGNnQ (ORCPT ); Thu, 7 Oct 2021 09:43:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633614081; 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=k/q+n/Kc30q6Q2HaVnnw/JGAnS2P/FCF4GVkPiSGOYI=; b=QQEr9oVhi2CAgwTWbhLeHGYHBaCtFgACnjs1WvZJ7WZetxMpFz1dnabPLabwsjdhvZ0O+M 3PlaFmAhZhzO/j3GEEdD35yi8htydAZHipxv3LPpT9Ek7SenQj4EE6U/XMzM1Y9RS43epc GkXsmCNgDKFbHwpbPkU1dHg97cdp0i4= 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-562-_B-EFVwkMrifPvfMcjLWTQ-1; Thu, 07 Oct 2021 09:41:20 -0400 X-MC-Unique: _B-EFVwkMrifPvfMcjLWTQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7677084A5E0; Thu, 7 Oct 2021 13:41:19 +0000 (UTC) Received: from renaissance-vector.redhat.com (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35C435D9C6; Thu, 7 Oct 2021 13:41:16 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, bluca@debian.org, phil@nwl.cc, haliu@redhat.com Subject: [PATCH iproute2 v4 5/5] configure: add the --libdir option Date: Thu, 7 Oct 2021 15:40:05 +0200 Message-Id: <772c1b2b04d975828e1f1ea3610ae3fbe379045e.1633612111.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 | 23 +++++++++++++++++++++++ 2 files changed, 27 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 2e5ed87e..edd03467 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 < Path to iproute2 include dir + --libdir Path to iproute2 lib dir --libbpf_dir Path to libbpf DESTDIR --libbpf_force Enable/disable libbpf by force. on: require link against libbpf, quit config if no libbpf support @@ -531,6 +545,14 @@ else INCLUDE="${1#*=}" check_value "$INCLUDE" shift ;; + --libdir) + LIBDIR="$2" + check_value "$LIBDIR" + shift 2 ;; + --libdir=*) + LIBDIR="${1#*=}" + check_value "$LIBDIR" + shift ;; --libbpf_dir) LIBBPF_DIR="$2" check_value "$LIBBPF_DIR" @@ -590,6 +612,7 @@ fi echo check_prefix +check_lib_dir if ! grep -q TC_CONFIG_NO_XT $CONFIG; then echo -n "iptables modules directory: " check_ipt_lib_dir