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

2019-02-07 Thread Christian Ehrhardt
On Fri, Feb 8, 2019 at 4:55 AM Ben Pfaff  wrote:
>
> On Thu, Feb 07, 2019 at 12:00:39PM +0100, Christian Ehrhardt wrote:
> > [...]
> >
> > >  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"
> >
> > While working fine in all my builds (and it seems on travis now) I got
> > reports of the statements above creating a colon in the assignment on
> > some builds - thanks James (on CC now).
> > It was adding a trailing colon to the FLAGS which broke his build.
> >
> > I wanted to ask the more experienced autoconf users if that makes any sense?
>
> I don't see any colons above.  I do see commas.

commas I meant, sorry :-/

> They look weird to me.
> In Bourne shell, spaces are used to separate assignments, not commas.  I
> would remove them.
>
> Other white space, like new-lines, works too.

Thanks Ben,
in V4 sent yesterday I used newlines - so that should be good now I hope.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


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

2019-02-07 Thread Ben Pfaff
On Thu, Feb 07, 2019 at 12:00:39PM +0100, Christian Ehrhardt wrote:
> [...]
> 
> >  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"
> 
> While working fine in all my builds (and it seems on travis now) I got
> reports of the statements above creating a colon in the assignment on
> some builds - thanks James (on CC now).
> It was adding a trailing colon to the FLAGS which broke his build.
> 
> I wanted to ask the more experienced autoconf users if that makes any sense?

I don't see any colons above.  I do see commas.  They look weird to me.
In Bourne shell, spaces are used to separate assignments, not commas.  I
would remove them.

Other white space, like new-lines, works too.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


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

2019-02-07 Thread Luca Boccassi
On Thu, 2019-02-07 at 12:00 +0100, Christian Ehrhardt wrote:
> [...]
> 
> >  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"
> 
> While working fine in all my builds (and it seems on travis now) I
> got
> reports of the statements above creating a colon in the assignment on
> some builds - thanks James (on CC now).
> It was adding a trailing colon to the FLAGS which broke his build.
> 
> I wanted to ask the more experienced autoconf users if that makes any
> sense?
> 
> We wondered if instead of colon actions inside the action sections
> would better be newline [1] separated instead:
> dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-
> FOUND],
> dnl   [ACTION-IF-NOT-FOUND])
> 
> [1]: https://stackoverflow.com/questions/12735432/how-to-pack-multipl
> e-statements
> 
> Like the following then:
> 
> -+ [DPDK_INCLUDE="$DPDK_CFLAGS",
> DPDK_LIB="$DPDK_LIBS"],
> -+
> [DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk",
> DPDK_LIB="-ldpdk"])
> ++ [DPDK_INCLUDE="$DPDK_CFLAGS"
> ++  DPDK_LIB="$DPDK_LIBS"],
> ++
> [DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk"
> ++  DPDK_LIB="-ldpdk"])
> 
> If that assumption could be backed by some autoconf experience I'd
> make a v4 which splits by newlines instead of the colon.

Hi,

Yes using newlines will work, I've used it before. Or rather should, we
are talking about autoconf after all :-)

https://github.com/zeromq/libzmq/blob/master/configure.ac#L559

-- 
Kind regards,
Luca Boccassi___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


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

2019-02-07 Thread Christian Ehrhardt
[...]

>  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"

While working fine in all my builds (and it seems on travis now) I got
reports of the statements above creating a colon in the assignment on
some builds - thanks James (on CC now).
It was adding a trailing colon to the FLAGS which broke his build.

I wanted to ask the more experienced autoconf users if that makes any sense?

We wondered if instead of colon actions inside the action sections
would better be newline [1] separated instead:

dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl   [ACTION-IF-NOT-FOUND])

[1]: 
https://stackoverflow.com/questions/12735432/how-to-pack-multiple-statements

Like the following then:

-+ [DPDK_INCLUDE="$DPDK_CFLAGS",
DPDK_LIB="$DPDK_LIBS"],
-+
[DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk",
DPDK_LIB="-ldpdk"])
++ [DPDK_INCLUDE="$DPDK_CFLAGS"
++  DPDK_LIB="$DPDK_LIBS"],
++
[DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk"
++  DPDK_LIB="-ldpdk"])

If that assumption could be backed by some autoconf experience I'd
make a v4 which splits by newlines instead of the colon.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


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

2019-02-06 Thread Aaron Conole
Christian Ehrhardt  writes:

> 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.
>
> Finally make configure.ac use the locally provided pkg.m4 before
> calling the PKG_PROG_PKG_CONFIG macro.
>
> Signed-off-by: Christian Ehrhardt 
> ---

LGTM

Acked-by: Aaron Conole 

I think Timothy should give it a quick glance over, if possible.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


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

2019-02-04 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.

Finally make configure.ac use the locally provided pkg.m4 before
calling the PKG_PROG_PKG_CONFIG macro.

Signed-off-by: Christian Ehrhardt 
---
 acinclude.m4 |  17 ++--
 configure.ac |   2 +
 m4/pkg.m4| 217 +--
 3 files changed, 153 insertions(+), 83 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 95241b142..f82b989e6 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -223,9 +223,9 @@ 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 +238,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 +346,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 505e3d041..dc6eebbf5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,8 @@ AC_PROG_CPP
 AC_PROG_MKDIR_P
 AC_PROG_FGREP
 AC_PROG_EGREP
+
+m4_include([m4/pkg.m4])
 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