All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Ferron <chris.e.ferron at linux.intel.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [RFC 2/2] build: use pkg-config for looking for netlink libraries
Date: Wed, 16 May 2012 09:31:34 -0700	[thread overview]
Message-ID: <4FB3D666.7080907@linux.intel.com> (raw)
In-Reply-To: 1337140056-4037-2-git-send-email-vcgomes@gmail.com

[-- Attachment #1: Type: text/plain, Size: 4794 bytes --]

On 05/15/2012 08:47 PM, Vinicius Costa Gomes wrote:
> Also, adds support for using libnl-3.0.
> ---
>
> I guess that it looks nicer, but it is more intrusive.
>
> BTW, I wasn't able to test in the case with just libnl-2.0.
>
>   configure.ac    |   29 +++++++++++++++++------------
>   src/Makefile.am |    6 +++---
>   src/tuning/iw.c |    2 +-
>   src/tuning/iw.h |    2 +-
>   4 files changed, 22 insertions(+), 17 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 2d56684..7b10c65 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -54,19 +54,24 @@ PKG_CHECK_MODULES([LIBZ], [zlib],[],[
>   	AC_SEARCH_LIBS([deflate], [z], [], AC_MSG_ERROR([zlib is required but was not found]), [])
>   ])
>
> -has_libnl_ver=0
> -PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [
> -	AC_SEARCH_LIBS([nl_socket_alloc], [nl], [has_libnl_ver=2], [
> -		     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], [], [])])
> -	], [])
> +PKG_CHECK_MODULES(LIBNL3, libnl-3.0 libnl-genl-3.0, [
> +	NETLINK_CFLAGS=${LIBNL3_CFLAGS}
> +	NETLINK_LIBS=${LIBNL3_LIBS}
> +], [
> +	PKG_CHECK_MODULES(LIBNL2, libnl-2.0, [
> +		NETLINK_CFLAGS=${LIBNL2_CFLAGS}
> +		NETLINK_LIBS=${LIBNL2_LIBS}
> +	], [
> +		PKG_CHECK_MODULES(LIBNL1, libnl-1, dummy=yes,
> +			AC_MSG_ERROR(Netlink library is required))
> +		AC_DEFINE(NEED_LIBNL_COMPAT, 1,
> +			[Define to 1 if you need libnl-1 compat functions.])
> +		NETLINK_CFLAGS=${LIBNL1_CFLAGS}
> +		NETLINK_LIBS=${LIBNL1_LIBS}
Problem exists where PKG_CHECK_MODULES will only work if the 
distribution using it uses pkg configs. This is why we must also use 
search libs is pkg_check_modules fails.
> +	])
>   ])
> -if (test "$has_libnl_ver" -eq 0); then
> -	AC_MSG_ERROR(libnl is required but 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])
> -fi
> +AC_SUBST(NETLINK_CFLAGS)
> +AC_SUBST(NETLINK_LIBS)
>
>   AC_SEARCH_LIBS([pthread_create], [pthread], [], AC_MSG_ERROR([libpthread is required but was not found]), [])
>   AC_SEARCH_LIBS([inet_aton], [resolv], [], AC_MSG_ERROR([libresolv is required but was not found]), [])
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 935bdab..f2adc41 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -34,14 +34,14 @@ powertop_SOURCES = parameters/persistent.cpp parameters/learn.cpp parameters/par
>   		measurement/sysfs.cpp measurement/acpi.h measurement/extech.cpp \
>   		measurement/power_supply.h measurement/extech.h main.cpp css.h powertop.css
>
> -powertop_CXXFLAGS = -O2 -g -fno-omit-frame-pointer -fstack-protector -Wall -Wshadow -Wformat -I/usr/include/ $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(LIBNL_CFLAGS) $(GLIB2_CFLAGS)
> +powertop_CXXFLAGS = -O2 -g -fno-omit-frame-pointer -fstack-protector -Wall -Wshadow -Wformat -I/usr/include/ $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(NETLINK_CFLAGS) $(GLIB2_CFLAGS)
>
>
> -powertop_CPPFLAGS = -D_FORTIFY_SOURCE=2 $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(LIBNL_CFLAGS) $(GLIB2_CFLAGS) $(LIBZ_CFLAGS)
> +powertop_CPPFLAGS = -D_FORTIFY_SOURCE=2 $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(NETLINK_CFLAGS) $(GLIB2_CFLAGS) $(LIBZ_CFLAGS)
>
>   powertop_LDADD = ../pevent/libparseevent.la
>
> -AM_LDFLAGS = $(LIBS) $(NCURSES_LIBS) $(PCIUTILS_LIBS) $(LIBNL_LIBS) $(LIBZ_LIBS) $(NCURES_LIBS) $(PTHREAD_LIBS)  $(RESOLV_LIBS)
> +AM_LDFLAGS = $(LIBS) $(NCURSES_LIBS) $(PCIUTILS_LIBS) $(NETLINK_LIBS) $(LIBZ_LIBS) $(NCURES_LIBS) $(PTHREAD_LIBS)  $(RESOLV_LIBS)
>
>   BUILT_SOURCES = css.h
>   CLEANFILES = css.h
> diff --git a/src/tuning/iw.c b/src/tuning/iw.c
> index aeba3fd..ba40d22 100644
> --- a/src/tuning/iw.c
> +++ b/src/tuning/iw.c
> @@ -50,7 +50,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   #include "iw.h"
>
>
> -#ifndef HAVE_LIBNL20
> +#ifdef NEED_LIBNL_COMPAT
its not just LIBNL compat but LIBNL compat > version 1
>   /* libnl 2.0 compatibility code */
>
>   static inline struct nl_handle *nl_socket_alloc(void)
> diff --git a/src/tuning/iw.h b/src/tuning/iw.h
> index acf132d..3b82aec 100644
> --- a/src/tuning/iw.h
> +++ b/src/tuning/iw.h
> @@ -46,7 +46,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   #include "config.h"
>   #endif
>
> -#ifndef HAVE_LIBNL20
> +#ifdef NEED_LIBNL_COMPAT
>   #define nl_sock nl_handle
>   #endif
so obviously libnl3 is not working? What distro and version are you 
running?
-Chris

> --
> 1.7.10.2
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop


             reply	other threads:[~2012-05-16 16:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 16:31 Chris Ferron [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-16 19:50 [Powertop] [RFC 2/2] build: use pkg-config for looking for netlink libraries Sergey Senozhatsky
2012-05-16  3:47 Vinicius Costa Gomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FB3D666.7080907@linux.intel.com \
    --to=powertop@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.