From c88c47ad0e7f48a39189db630cbcc9f85ee82da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 9 Apr 2012 11:57:10 -0700 Subject: [PATCH] build: use pkg-config to discover libcap-ng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're already relying on the pkg.m4 macro file for glib, so we can rely on the same for libcap-ng. Signed-off-by: Diego Elio Pettenò --- Makefile.am | 9 ++++----- configure.ac | 20 +++++++++++++++++++- m4/cap-ng.m4 | 40 ---------------------------------------- 3 files changed, 23 insertions(+), 46 deletions(-) delete mode 100644 m4/cap-ng.m4 diff --git a/Makefile.am b/Makefile.am index a79c239..a507bdd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,18 +22,17 @@ AUTOMAKE_OPTIONS = no-dependencies ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = INSTALL COPYING autogen.sh m4/cap-ng.m4 misc/irqbalance.service - +EXTRA_DIST = INSTALL COPYING autogen.sh misc/irqbalance.service + INCLUDES = -I${top_srcdir} -LIBS = $(CAPNG_LDADD) @LIBS@ -AM_CFLAGS = $(GLIB_CFLAGS) +AM_CFLAGS = $(LIBCAP_NG_CFLAGS) $(GLIB_CFLAGS) AM_CPPFLAGS = -W -Wall -Wshadow -Wformat -Wundef -D_GNU_SOURCE noinst_HEADERS = bitmap.h constants.h cpumask.h irqbalance.h non-atomic.h \ types.h sbin_PROGRAMS = irqbalance irqbalance_SOURCES = activate.c bitmap.c classify.c cputree.c irqbalance.c \ irqlist.c numa.c placement.c powermode.c procinterrupts.c -irqbalance_LDADD = $(CAPNG_LDADD) $(GLIB_LIBS) +irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB_LIBS) dist_man_MANS = irqbalance.1 CONFIG_CLEAN_FILES = debug*.list config/* diff --git a/configure.ac b/configure.ac index 527aad4..1230d66 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,25 @@ AS_IF( AM_CONDITIONAL([LOCAL_GLIB], [test "x$local_glib2" = "xyes"]) -LIBCAP_NG_PATH +AC_ARG_WITH([libcap-ng], + AS_HELP_STRING([libcap-ng], [Add libcap-ng-support @<:@default=auto@:>@])) + +AS_IF( + [test "x$libcap_ng" != "xno"], + [ + PKG_CHECK_MODULES([LIBCAP_NG], [libcap-ng], + [AC_DEFINE(HAVE_LIBCAP_NG,1,[libcap-ng support])], + [ + AS_IF( + [test "x$libcap_ng" = "xyes"], + [ + AC_MSG_ERROR([libcap-ng not found]) + ] + ) + ] + ) + ] +) AC_OUTPUT(Makefile glib-local/Makefile) diff --git a/m4/cap-ng.m4 b/m4/cap-ng.m4 deleted file mode 100644 index 0024edc..0000000 --- a/m4/cap-ng.m4 +++ /dev/null @@ -1,40 +0,0 @@ -# libcap-ng.m4 - Checks for the libcap-ng support -# Copyright (c) 2009 Steve Grubb sgrubb@redhat.com -# -AC_DEFUN([LIBCAP_NG_PATH], -[ - AC_ARG_WITH(libcap-ng, - [ --with-libcap-ng=[auto/yes/no] Add Libcap-ng support [default=auto]],, - with_libcap_ng=auto) - - # Check for Libcap-ng API - # - # libcap-ng detection - - if test x$with_libcap_ng = xno ; then - have_libcap_ng=no; - else - # Start by checking for header file - AC_CHECK_HEADER(cap-ng.h, capng_headers=yes, capng_headers=no) - - # See if we have libcap-ng library - AC_CHECK_LIB(cap-ng, capng_clear, - CAPNG_LDADD=-lcap-ng,) - - # Check results are usable - if test x$with_libcap_ng = xyes -a x$CAPNG_LDADD = x ; then - AC_MSG_ERROR(libcap-ng support was requested and the library was not found) - fi - if test x$CAPNG_LDADD != x -a $capng_headers = no ; then - AC_MSG_ERROR(libcap-ng libraries found but headers are missing) - fi - fi - AC_SUBST(CAPNG_LDADD) - AC_MSG_CHECKING(whether to use libcap-ng) - if test x$CAPNG_LDADD != x ; then - AC_DEFINE(HAVE_LIBCAP_NG,1,[libcap-ng support]) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -])