* [Powertop] [PATCH] configure: rework libnl detection and fix libnl-2 case (v2)
@ 2012-11-13 15:48 Sergey Senozhatsky
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2012-11-13 15:48 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]
Rework libnl detection.
PKG_CHECK_MODULES macro appends FOO_CFLAGS and FOO_LIBS flags
Example:
LIBNL_CFLAGS = -I/usr/include/libnl3
LIBNL_LIBS = -lnl-genl-3 -lnl-3
while AC_SEARCH_LIBS only prepends -llibrary to LIBS, so AC_SEARCH_LIBS
is not helpful.
Use pkg-config PC file names to search for minimum package versions:
libnl 3.+ -- libnl-3.0.pc
libnl 2.+ -- libnl-2.0.pc
libnl 1.+ -- libnl-1.0.pc
Patch also changes $has_libnl_ver == 0 error message and suppresses
failed PKG_CHECK_MODULES output.
Austin pointed out that libnl-2.0 provide only libnl-2.0.pc pkg-config
file, while libnl-3 has at least 5 of them (for every `so').
This is why we check libnl-3.0.pc and libnl-genl-3.0.pc in libnl-3 case.
Many thanks to Austin Zhang for help.
v2: Namhyung Kim reported that libnl-1.0.pc on Ubuntu is named libnl-1.pc.
Reported-and-tested-by: Austin Zhang <zhang.austin(a)gmail.com>
Tested-by: Namhyung Kim <namhyung(a)gmail.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
---
configure.ac | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index b8c183f..02952b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,15 +54,14 @@ PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
has_libnl_ver=0
-PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0], [
- has_libnl_ver=3], [
- AC_SEARCH_LIBS([nl_socket_alloc], [nl-3 nl-genl-3], [
- has_libnl_ver=3], [
- AC_SEARCH_LIBS([nl_socket_alloc], [nl], [
- has_libnl_ver=2], [
- PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [])])])])
+# libnl-2 provides only libnl-2.0.pc file, so we check for separate libnl-genl-3.0.pc
+# pkg-config file just for libnl-3.0 case.
+#
+PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0], [has_libnl_ver=3], [
+ PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
+ PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])])])
if (test "$has_libnl_ver" -eq 0); then
- AC_MSG_ERROR(libnl is required but not found)
+ AC_MSG_ERROR(libnl and libnl-genl are required but were not found)
fi
if (test "$has_libnl_ver" -gt 1); then
AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Powertop] [PATCH] configure: rework libnl detection and fix libnl-2 case (v2)
@ 2012-11-13 19:16 Chris Ferron
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ferron @ 2012-11-13 19:16 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 2744 bytes --]
On 11/13/2012 07:48 AM, Sergey Senozhatsky wrote:
> Rework libnl detection.
>
> PKG_CHECK_MODULES macro appends FOO_CFLAGS and FOO_LIBS flags
>
> Example:
> LIBNL_CFLAGS = -I/usr/include/libnl3
> LIBNL_LIBS = -lnl-genl-3 -lnl-3
>
> while AC_SEARCH_LIBS only prepends -llibrary to LIBS, so AC_SEARCH_LIBS
> is not helpful.
>
> Use pkg-config PC file names to search for minimum package versions:
> libnl 3.+ -- libnl-3.0.pc
> libnl 2.+ -- libnl-2.0.pc
> libnl 1.+ -- libnl-1.0.pc
>
> Patch also changes $has_libnl_ver == 0 error message and suppresses
> failed PKG_CHECK_MODULES output.
>
> Austin pointed out that libnl-2.0 provide only libnl-2.0.pc pkg-config
> file, while libnl-3 has at least 5 of them (for every `so').
> This is why we check libnl-3.0.pc and libnl-genl-3.0.pc in libnl-3 case.
>
> Many thanks to Austin Zhang for help.
> v2: Namhyung Kim reported that libnl-1.0.pc on Ubuntu is named libnl-1.pc.
>
> Reported-and-tested-by: Austin Zhang <zhang.austin(a)gmail.com>
> Tested-by: Namhyung Kim <namhyung(a)gmail.com>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>
> ---
>
> configure.ac | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
> Sergey Senozhatsky
>
> diff --git a/configure.ac b/configure.ac
> index b8c183f..02952b3 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -54,15 +54,14 @@ PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
>
>
> has_libnl_ver=0
> -PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0], [
> - has_libnl_ver=3], [
> - AC_SEARCH_LIBS([nl_socket_alloc], [nl-3 nl-genl-3], [
> - has_libnl_ver=3], [
> - AC_SEARCH_LIBS([nl_socket_alloc], [nl], [
> - has_libnl_ver=2], [
> - PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [])])])])
> +# libnl-2 provides only libnl-2.0.pc file, so we check for separate libnl-genl-3.0.pc
> +# pkg-config file just for libnl-3.0 case.
> +#
> +PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0], [has_libnl_ver=3], [
> + PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
> + PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])])])
> if (test "$has_libnl_ver" -eq 0); then
> - AC_MSG_ERROR(libnl is required but not found)
> + AC_MSG_ERROR(libnl and libnl-genl are required but were not found)
> fi
> if (test "$has_libnl_ver" -gt 1); then
> AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
this patch has been merged as it is signed off by Sergey
Thanks,
Chris
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-13 19:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 19:16 [Powertop] [PATCH] configure: rework libnl detection and fix libnl-2 case (v2) Chris Ferron
-- strict thread matches above, loose matches on Subject: below --
2012-11-13 15:48 Sergey Senozhatsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.