Discussion:
[PATCH 1/2] configure: fix to support libnl-3.0
Sergey Senozhatsky
2012-04-27 13:29:13 UTC
Permalink
configure: fix to support libnl-3.0

Rename previously used CONFIG_LIBNL20 define to HAVE_LIBNL20 and move it
to generated config.h file.

HAVE_LIBNL20 should be defined for both libnl-2.0 and libnl-3.0 cases.
For libnl3 we should also add libnl-3.0 and libnl-genl-3.0 libs.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky-***@public.gmane.org>

---

configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index c18a000..ff344f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,8 +49,8 @@ PKG_CHECK_MODULES([NCURSES], [ncurses])
PKG_CHECK_MODULES([PCIUTILS], [libpci])

PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])] ,[
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0, libnl-genl-3.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])] ,[AC_MSG_ERROR([libnl is required but was not found])])
])
])
Mike Frysinger
2012-04-27 14:35:35 UTC
Permalink
Post by Sergey Senozhatsky
--- a/configure.ac
+++ b/configure.ac
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])] ,[
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0, libnl-genl-3.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])] ,[AC_MSG_ERROR([libnl is required but was not found])])
])
])
that really needs some line wrapping

i don't think there should be a comma between libnl-3.0 and libnl-genl-3.0
-mike
Arjan van de Ven
2012-04-27 14:51:22 UTC
Permalink
Post by Mike Frysinger
Post by Sergey Senozhatsky
--- a/configure.ac
+++ b/configure.ac
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])] ,[
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0, libnl-genl-3.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])] ,[AC_MSG_ERROR([libnl is required but was not found])])
])
])
that really needs some line wrapping
nah my screen is -> <- this wide..

we're not google+....

if it makes it more readable, I rather have things on one line than
artificially broken up.
Mike Frysinger
2012-04-27 16:03:01 UTC
Permalink
Post by Arjan van de Ven
Post by Mike Frysinger
Post by Sergey Senozhatsky
--- a/configure.ac
+++ b/configure.ac
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[]
,[AC_MSG_ERROR([libnl is required but was not found])]) +
PKG_CHECK_MODULES([LIBNIL],
[libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0
or higher])] ,[ + PKG_CHECK_MODULES([LIBNIL], [libnl-3.0,
libnl-genl-3.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have
libnl-3.0 or higher])] ,[AC_MSG_ERROR([libnl is required but was not
found])])
])
])
that really needs some line wrapping
nah my screen is -> <- this wide..
we're not google+....
if it makes it more readable, I rather have things on one line than
artificially broken up.
wrapping+indenting at "[" boundaries is accepted autoconf practice, and which
you've already done here:
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
PKG_CHECK_MODULES([LIBNIL], [libnl-3.0 ...

so continuing that practice makes sense
-mike
Sergey Senozhatsky
2012-04-27 15:02:34 UTC
Permalink
Post by Mike Frysinger
Post by Sergey Senozhatsky
--- a/configure.ac
+++ b/configure.ac
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])] ,[
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0, libnl-genl-3.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])] ,[AC_MSG_ERROR([libnl is required but was not found])])
])
])
that really needs some line wrapping
i don't think there should be a comma between libnl-3.0 and libnl-genl-3.0
Thank you.
Well, seems you're right. I suck at those autotools things.


----8<----8<-----

configure: fix to support libnl-3.0

Rename previously used CONFIG_LIBNL20 define to HAVE_LIBNL20 and move it
to generated config.h file.

HAVE_LIBNL20 should be defined for both libnl-2.0 and libnl-3.0 cases.
For libnl3 we should also add libnl-3.0 and libnl-genl-3.0 libs.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky-***@public.gmane.org>

---

configure.ac | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index c18a000..22da9a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,8 +49,11 @@ PKG_CHECK_MODULES([NCURSES], [ncurses])
PKG_CHECK_MODULES([PCIUTILS], [libpci])

PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])],
+ [
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0 libnl-genl-3.0],
+ [AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])],
+ [AC_MSG_ERROR([libnl is required but was not found])])
])
])
Mike Frysinger
2012-04-27 16:06:02 UTC
Permalink
Post by Sergey Senozhatsky
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])],
+ [
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0 libnl-genl-3.0],
+ [AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])],
+ [AC_MSG_ERROR([libnl is required but was not found])])
])
])
does autoheader allow the same symbol to be defined multiple times ? how about:

PKG_CHECK_MODULES([LIBNIL], [libnl-1],[libnl_ver=1],[
PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[libnl_ver=2],[
PKG_CHECK_MODULES([LIBNIL], [libnl-3.0 libnl-genl-3.0], [libnl_ver=3],[
AC_MSG_ERROR([libnl is required but was not found])
])
])
])
AS_IF([test 1 != "$libnl_ver"], [
AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
])
-mike
Sergey Senozhatsky
2012-04-27 19:08:24 UTC
Permalink
Post by Mike Frysinger
Post by Sergey Senozhatsky
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[],[
- PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[] ,[
- PKG_CHECK_MODULES([LIBNIL], [libnl-3.0],[] ,[AC_MSG_ERROR([libnl is required but was not found])])
+ PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or higher])],
+ [
+ PKG_CHECK_MODULES([LIBNIL], [libnl-3.0 libnl-genl-3.0],
+ [AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-3.0 or higher])],
+ [AC_MSG_ERROR([libnl is required but was not found])])
])
])
Good catch.
I think this is undocumented behavior, which is translated to `do not do that'.
It seems, however, that the last AC_DEFINE() executed wins, and sice we only set
HAVE_LIBNL20 to 1, there is unlikely probability of HAVE_LIBNL20 having some
suprsing value at the end.

Yet I agree, that only one AC_DEFINE() should be reached for HAVE_LIBNL20.
Post by Mike Frysinger
PKG_CHECK_MODULES([LIBNIL], [libnl-1],[libnl_ver=1],[
PKG_CHECK_MODULES([LIBNIL], [libnl-2.0],[libnl_ver=2],[
PKG_CHECK_MODULES([LIBNIL], [libnl-3.0 libnl-genl-3.0], [libnl_ver=3],[
AC_MSG_ERROR([libnl is required but was not found])
])
])
])
AS_IF([test 1 != "$libnl_ver"], [
AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
])
-ss

Loading...