From patchwork Wed Jul 5 09:19:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Ehrhardt X-Patchwork-Id: 784493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x2b16675wz9s8V for ; Wed, 5 Jul 2017 19:19:38 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 08747ABA; Wed, 5 Jul 2017 09:19:34 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EC9A489F for ; Wed, 5 Jul 2017 09:19:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0987E1AE for ; Wed, 5 Jul 2017 09:19:29 +0000 (UTC) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dSgT2-00007c-6j; Wed, 05 Jul 2017 09:19:28 +0000 From: Christian Ehrhardt To: dev@openvswitch.org Date: Wed, 5 Jul 2017 11:19:25 +0200 Message-Id: <1499246365-9633-1-git-send-email-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Luca Boccassi Subject: [ovs-dev] [PATCH] acinclude: netdev-dpdk: use pkg-config of libdpdk X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org If available use dpdk pkg-config info of libdpdk to set the right include paths. That for example, allows packagers to provide non default include paths in a common way (pkg-config). Signed-off-by: Christian Ehrhardt Suggested-by: Luca Boccassi Acked-by: Luca Boccassi --- Documentation/intro/install/dpdk.rst | 6 +++++- acinclude.m4 | 18 +++++++++++------- configure.ac | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst index e83f852..097cd56 100644 --- a/Documentation/intro/install/dpdk.rst +++ b/Documentation/intro/install/dpdk.rst @@ -124,7 +124,11 @@ has to be configured with DPDK support (``--with-dpdk``). $ ./configure --with-dpdk=$DPDK_BUILD where ``DPDK_BUILD`` is the path to the built DPDK library. This can be - skipped if DPDK library is installed in its default location + skipped if DPDK library is installed in its default location. + + If no path is provided to ``--with-dpdk``, but a pkg-config configuration + for libdpdk is available the include paths will be generated via an + equivalent ``pkg-config --cflags libdpdk``. .. note:: While ``--with-dpdk`` is required, you can pass any other configuration diff --git a/acinclude.m4 b/acinclude.m4 index 7d7b683..3a388e2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -199,16 +199,20 @@ AC_DEFUN([OVS_CHECK_DPDK], [ case "$with_dpdk" in yes) DPDK_AUTO_DISCOVER="true" - DPDK_INCLUDE="/usr/local/include/dpdk -I/usr/include/dpdk" + PKG_CHECK_MODULES([DPDK], [libdpdk], + [DPDK_INCLUDE="$DPDK_CFLAGS"], + [DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk"]) ;; *) DPDK_AUTO_DISCOVER="false" - DPDK_INCLUDE="$with_dpdk/include" + DPDK_INCLUDE_PATH="$with_dpdk/include" # If 'with_dpdk' is passed install directory, point to headers # installed in $DESTDIR/$prefix/include/dpdk - AC_CHECK_FILE([$DPDK_INCLUDE/rte_config.h], [], - [AC_CHECK_FILE([$DPDK_INCLUDE/dpdk/rte_config.h], - [DPDK_INCLUDE=$DPDK_INCLUDE/dpdk], [])]) + AC_CHECK_FILE([$DPDK_INCLUDE_PATH/rte_config.h], + [DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH"], + [AC_CHECK_FILE([$DPDK_INCLUDE_PATH/dpdk/rte_config.h], + [DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk"], + [])]) DPDK_LIB_DIR="$with_dpdk/lib" ;; esac @@ -218,7 +222,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [ ovs_save_CFLAGS="$CFLAGS" ovs_save_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS -I$DPDK_INCLUDE" + CFLAGS="$CFLAGS $DPDK_INCLUDE" if test "$DPDK_AUTO_DISCOVER" = "false"; then LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" fi @@ -294,7 +298,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [ if test "$DPDK_AUTO_DISCOVER" = "false"; then OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" fi - OVS_CFLAGS="$OVS_CFLAGS -I$DPDK_INCLUDE" + OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" OVS_ENABLE_OPTION([-mssse3]) # DPDK pmd drivers are not linked unless --whole-archive is used. diff --git a/configure.ac b/configure.ac index 6404b5f..b364f28 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,7 @@ AC_PROG_CPP AC_PROG_MKDIR_P AC_PROG_FGREP AC_PROG_EGREP +PKG_PROG_PKG_CONFIG AC_ARG_VAR([PERL], [path to Perl interpreter]) AC_PATH_PROG([PERL], perl, no)