1# libcap-ng.m4 - Checks for the libcap-ng support
2# 	Copyright (c) 2009 Steve Grubb sgrubb@redhat.com
3#
4AC_DEFUN([LIBCAP_NG_PATH],
5[
6  AC_ARG_WITH(libcap-ng,
7    [  --with-libcap-ng=[auto/yes/no]  Add Libcap-ng support [default=auto]],,
8    with_libcap_ng=auto)
9
10  # Check for Libcap-ng API
11  #
12  # libcap-ng detection
13
14  if test x$with_libcap_ng = xno ; then
15      have_libcap_ng=no;
16  else
17      # Start by checking for header file
18      AC_CHECK_HEADER(cap-ng.h, capng_headers=yes, capng_headers=no)
19
20      # See if we have libcap-ng library
21      AC_CHECK_LIB(cap-ng, capng_clear,
22	         CAPNG_LDADD=-lcap-ng,)
23
24      # Check results are usable
25      if test x$with_libcap_ng = xyes -a x$CAPNG_LDADD = x ; then
26         AC_MSG_ERROR(libcap-ng support was requested and the library was not found)
27      fi
28      if test x$CAPNG_LDADD != x -a $capng_headers = no ; then
29         AC_MSG_ERROR(libcap-ng libraries found but headers are missing)
30      fi
31  fi
32  AC_SUBST(CAPNG_LDADD)
33  AC_MSG_CHECKING(whether to use libcap-ng)
34  if test x$CAPNG_LDADD != x ; then
35      AC_DEFINE(HAVE_LIBCAP_NG,1,[libcap-ng support])
36      AC_MSG_RESULT(yes)
37  else
38      AC_MSG_RESULT(no)
39  fi
40])
41