That seems to work on most my systems. I do get an error with slightly older automake. how about this for a fix? error to fix is
******************** configure.ac:19: warning: macro `AM_PROG_AR' not found in library autoreconf: running: /usr/bin/autoconf configure.ac:19: error: possibly undefined macro: AM_PROG_AR If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. autoreconf: /usr/bin/autoconf failed with exit status: 1 ******************** diff --git a/configure.ac b/configure.ac index d7820d5..2be64b2 100644 --- a/configure.ac +++ b/configure.ac @@ -9,14 +9,12 @@ AC_CONFIG_FILES([Makefile src/Makefile pevent/Makefile po/Make AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) -#AC_SUBST(LIBTOOL_DEPS) -#AC_LTDL_DLLIB GETTEXT_PACKAGE=powertop AC_SUBST(GETTEXT_PACKAGE) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.18]) -AM_PROG_AR +m4_pattern_allow([AM_PROG_AR], [AM_PROG_AR]) # Checks for programs. AC_PROG_CPP AC_PROG_CXX > > Fix libnl-3 detection and rework libnl configure check (v3) > > Patch replaces AC_CHECK_LIB with AC_SEARCH_LIBS, as proposed at the end of > AC_CHECK_LIB docs: > >> AC_CHECK_LIB requires some care in usage, and should be avoided in some >> common cases. Many standard functions >> like gethostbyname appear in the standard C library on some hosts, and >> in special libraries like nsl on other >> hosts. On some hosts the special libraries contain variant >> implementations that you may not want to use. >> These days it is normally better to use AC_SEARCH_LIBS([gethostbyname], >> [nsl]) instead of AC_CHECK_LIB([nsl], [gethostbyname]). > > > > Thanks to Magnus Fromreide and to Chris Ferron. > Signed-off-by: Sergey Senozhatsky <sergey.senozhat...@gmail.com> > > --- > > configure.ac | 36 +++++++++++++++++------------------- > 1 file changed, 17 insertions(+), 19 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 753a374..d7820d5 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -16,6 +16,7 @@ AC_SUBST(GETTEXT_PACKAGE) > AM_GNU_GETTEXT([external]) > AM_GNU_GETTEXT_VERSION([0.18]) > > +AM_PROG_AR > # Checks for programs. > AC_PROG_CPP > AC_PROG_CXX > @@ -46,33 +47,30 @@ AC_FUNC_REALLOC > AC_FUNC_STRTOD > AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir > munmap pow realpath regcomp select setlocale socket sqrt strcasecmp > strchr strdup strerror strncasecmp strstr strtoul strtoull]) > > -PKG_CHECK_MODULES([NCURSES], [ncurses],[],[ > - AC_CHECK_LIB([ncurses], [main],[AC_SUBST(NCURSES_LIBS, "-lncurses"," > ")],AC_MSG_ERROR([ncurses is required but was not found])) > -]) > +AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is > required but was not found]), []) > + > PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[ > - AC_CHECK_LIB([libpci], [main],[AC_SUBST(PCIUTILS_LIBS, "-lpci"," > ")],AC_MSG_ERROR([libpci is required but was not found])) > + AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is > required but was not found]), []) > ]) > PKG_CHECK_MODULES([LIBZ], [zlib],[],[ > - AC_CHECK_LIB([zlib], [main],[AC_SUBST(LIBZ_LIBS, "-lz"," > ")],AC_MSG_ERROR([zlib is required but was not found])) > + AC_SEARCH_LIBS([deflate], [z], [], AC_MSG_ERROR([zlib is required but > was not found]), []) > ]) > > -has_libnl=no > -PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl=yes],[ > - AC_CHECK_LIB([libnl], [main],[has_libnl=yes AC_SUBST(LIBNL_LIBS, > "-lnl","Update LIBNL_LIBS based on AC_CHECK_LIB")],[ > - PKG_CHECK_MODULES([LIBNL], [libnl-2.0 libnl-3.0 libnl-genl-3.0], > [has_libnl=yes AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 > or higher])],[ > - AC_CHECK_LIB([libnl>= 2.0 libnl-genl], > [main],[has_libnl=yes > AC_SUBST(LIBNL_LIBS, "-lnl","Update LIBNL_LIBS based on AC_CHECK_LIB") > AC_DEFINE([HAVE_LIBNL20],[1],[Define if you have libnl-2.0 or > higher])],[dummy=no]) > - ]) > - ]) > +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], [], [])]) > + ], []) > ]) > -if (test "${has_libnl}" = "no"); then > +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_CHECK_LIB([pthread], [pthread_create],[AC_SUBST(PTHREAD_LIBS, > "-lpthread"," ")] , AC_MSG_ERROR([libpthread is required but was not > found])) > - > -# FIXME: Replace `main' with a function in `-lresolv': > -AC_CHECK_LIB([resolv], [main],[AC_SUBST(RESOLV_LIBS, "-lresolv"," ")], > AC_MSG_ERROR([libresolv is required but was not found])) > - > - > +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]), []) > > AC_OUTPUT > > _______________________________________________ Power mailing list Power@bughost.org https://bughost.org/mailman/listinfo/power