build: use pkg-config to discover libcap-ng
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ò <flameeyes@flameeyes.eu>
This commit is contained in:
parent
29b049f1f9
commit
c88c47ad0e
3 changed files with 23 additions and 46 deletions
|
@ -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/*
|
||||
|
|
20
configure.ac
20
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)
|
||||
|
||||
|
|
40
m4/cap-ng.m4
40
m4/cap-ng.m4
|
@ -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
|
||||
])
|
Loading…
Add table
Reference in a new issue