[ovs-dev] [PATCH v5 1/1] acinclude: Also use LIBS from dpkg pkg-config

2019-02-11 Thread Christian Ehrhardt
DPDK 18.11 builds using the more modern meson build system no more
provide the -ldpdk linker script. Instead it is expected to use
pkgconfig for linker options as well.

This change will set DPDK_LIB from pkg-config (if pkg-config was
available) and since that already carries the whole-archive flags
around the PMDs skips the further wrapping in more whole-archive
if that is already part of DPDK_LIB.

To work reliable in all environments this needs pkg-config 0.29.1.
We want to be able to use PKG_CHECK_MODULES_STATIC which
is not yet available in 0.24. Therefore update pkg.m4
to pkg-config 0.29.1.

This should be backport-safe as these macro files are all versioned.
autoconf is smart enough to check the version if you have it locally,
and if the system's is higher, it will use that one instead.

Acked-by: Luca Boccassi 
Acked-by: Aaron Conole 
Signed-off-by: Christian Ehrhardt 
---
 acinclude.m4 |  21 +++--
 configure.ac |   1 +
 m4/pkg.m4| 217 +--
 3 files changed, 156 insertions(+), 83 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 8b43d2bfe..f000cbb3e 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -223,9 +223,13 @@ AC_DEFUN([OVS_CHECK_DPDK], [
 case "$with_dpdk" in
   yes)
 DPDK_AUTO_DISCOVER="true"
-PKG_CHECK_MODULES([DPDK], [libdpdk],
-  [DPDK_INCLUDE="$DPDK_CFLAGS"],
-  [DPDK_INCLUDE="-I/usr/local/include/dpdk 
-I/usr/include/dpdk"])
+PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [
+DPDK_INCLUDE="$DPDK_CFLAGS"
+DPDK_LIB="$DPDK_LIBS"
+ ], [
+DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk"
+DPDK_LIB="-ldpdk"
+ ])
 ;;
   *)
 DPDK_AUTO_DISCOVER="false"
@@ -238,10 +242,10 @@ AC_DEFUN([OVS_CHECK_DPDK], [
DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk"
 fi
 DPDK_LIB_DIR="$with_dpdk/lib"
+DPDK_LIB="-ldpdk"
 ;;
 esac
 
-DPDK_LIB="-ldpdk"
 DPDK_EXTRA_LIB=""
 
 ovs_save_CFLAGS="$CFLAGS"
@@ -346,7 +350,14 @@ AC_DEFUN([OVS_CHECK_DPDK], [
 #
 # These options are specified inside a single -Wl directive to prevent
 # autotools from reordering them.
-DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive
+#
+# OTOH newer versions of dpdk pkg-config (generated with Meson)
+# will already have flagged just the right set of libs with
+# --whole-archive - in those cases do not wrap it once more.
+case "$DPDK_LIB" in
+  *whole-archive*) DPDK_vswitchd_LDFLAGS=$DPDK_LIB;;
+  *) DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive
+esac
 AC_SUBST([DPDK_vswitchd_LDFLAGS])
 AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
   fi
diff --git a/configure.ac b/configure.ac
index 8a05870a4..6ed8415b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ AC_PROG_CPP
 AC_PROG_MKDIR_P
 AC_PROG_FGREP
 AC_PROG_EGREP
+
 PKG_PROG_PKG_CONFIG
 
 AM_MISSING_PROG([AUTOM4TE], [autom4te])
diff --git a/m4/pkg.m4 b/m4/pkg.m4
index c5b26b52e..82bea96ee 100644
--- a/m4/pkg.m4
+++ b/m4/pkg.m4
@@ -1,29 +1,60 @@
-# pkg.m4 - Macros to locate and utilise pkg-config.-*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-# 
-# Copyright © 2004 Scott James Remnant .
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# --
+dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+dnl serial 11 (pkg-config-0.29.1)
+dnl
+dnl Copyright © 2004 Scott James Remnant .
+dnl Copyright © 2012-2015 Dan Nicholson 
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distrib

Re: [ovs-dev] [PATCH v5 1/1] acinclude: Also use LIBS from dpkg pkg-config

2019-02-11 Thread Ben Pfaff
On Mon, Feb 11, 2019 at 08:36:47PM +0100, Christian Ehrhardt wrote:
> DPDK 18.11 builds using the more modern meson build system no more
> provide the -ldpdk linker script. Instead it is expected to use
> pkgconfig for linker options as well.
> 
> This change will set DPDK_LIB from pkg-config (if pkg-config was
> available) and since that already carries the whole-archive flags
> around the PMDs skips the further wrapping in more whole-archive
> if that is already part of DPDK_LIB.
> 
> To work reliable in all environments this needs pkg-config 0.29.1.
> We want to be able to use PKG_CHECK_MODULES_STATIC which
> is not yet available in 0.24. Therefore update pkg.m4
> to pkg-config 0.29.1.
> 
> This should be backport-safe as these macro files are all versioned.
> autoconf is smart enough to check the version if you have it locally,
> and if the system's is higher, it will use that one instead.
> 
> Acked-by: Luca Boccassi 
> Acked-by: Aaron Conole 
> Signed-off-by: Christian Ehrhardt 

Like the robot, I wasn't able to apply this.  I guess it needs a rebase.

Thank you!
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v5 1/1] acinclude: Also use LIBS from dpkg pkg-config

2019-02-11 Thread Christian Ehrhardt
On Tue, Feb 12, 2019 at 2:52 AM Ben Pfaff  wrote:
>
> On Mon, Feb 11, 2019 at 08:36:47PM +0100, Christian Ehrhardt wrote:
> > DPDK 18.11 builds using the more modern meson build system no more
> > provide the -ldpdk linker script. Instead it is expected to use
> > pkgconfig for linker options as well.
> >
> > This change will set DPDK_LIB from pkg-config (if pkg-config was
> > available) and since that already carries the whole-archive flags
> > around the PMDs skips the further wrapping in more whole-archive
> > if that is already part of DPDK_LIB.
> >
> > To work reliable in all environments this needs pkg-config 0.29.1.
> > We want to be able to use PKG_CHECK_MODULES_STATIC which
> > is not yet available in 0.24. Therefore update pkg.m4
> > to pkg-config 0.29.1.
> >
> > This should be backport-safe as these macro files are all versioned.
> > autoconf is smart enough to check the version if you have it locally,
> > and if the system's is higher, it will use that one instead.
> >
> > Acked-by: Luca Boccassi 
> > Acked-by: Aaron Conole 
> > Signed-off-by: Christian Ehrhardt 
>
> Like the robot, I wasn't able to apply this.  I guess it needs a rebase.

I rebased minutes before I sent it, but by accident to "another"
master branch I from another remote :-)
But anyway, we are already at V5 so a V6 isn't far away

> Thank you!



-- 
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev