3 define([AC_INIT_NOTICE],
4 [### Generated automatically using autoconf version] AC_ACVERSION [
5 ### Copyright 2009-2023 Steve Grubb <sgrubb@redhat.com>
7 ### Permission is hereby granted, free of charge, to any person obtaining a
8 ### copy of this software and associated documentation files (the "Software"),
9 ### to deal in the Software without restriction, including without limitation
10 ### the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 ### and/or sell copies of the Software, and to permit persons to whom the
12 ### Software is furnished to do so, subject to the following conditions:
14 ### The above copyright notice and this permission notice shall be included
15 ### in all copies or substantial portions of the Software.
17 ### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 ### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 ### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 ### THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 ### OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 ### ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 ### OTHER DEALINGS IN THE SOFTWARE.
25 ### For usage, run `./configure --help'
26 ### For more detailed information on installation, read the file `INSTALL'.
28 ### If configuration succeeds, status is in the file `config.status'.
29 ### A log of configuration tests is in `config.log'.
32 AC_REVISION($Revision: 1.3 $)dnl
33 AC_INIT([libcap-ng],[0.8.4])
35 AC_CONFIG_HEADERS([config.h])
36 AC_CONFIG_MACRO_DIR([m4])
38 echo Configuring libcap-ng $VERSION
43 AC_SUBST(LIBTOOL_DEPS)
46 echo Checking for programs
53 echo Checking for header files
54 AC_CHECK_HEADERS(linux/capability.h, [], [AC_MSG_ERROR(linux/capability.h is required in order to build libcap-ng.)])
55 AC_CHECK_HEADERS(sys/xattr.h, [], [
56 AC_CHECK_HEADERS(attr/xattr.h, [], [AC_MSG_WARN(attr/xattr.h not found, disabling file system capabilities.)])
58 AC_CHECK_HEADERS(linux/securebits.h, [], [])
59 AC_CHECK_HEADERS(pthread.h,
60 [AC_SEARCH_LIBS(pthread_atfork, pthread)],
61 [AC_MSG_WARN(pthread.h not found, disabling pthread_atfork.)])
62 AC_CHECK_HEADERS(sys/vfs.h, [
63 AC_CHECK_HEADERS(linux/magic.h, [], [AC_MSG_WARN(linux/magic.h is required in order to verify procfs.)])
64 ], [AC_MSG_WARN(sys/vfs.h is required in order to verify procfs.)])
66 AC_ARG_WITH([capability_header],
67 [AS_HELP_STRING([--with-capability_header=path : path to capability.h])],
68 [CAPABILITY_HEADER=$withval],
69 [CAPABILITY_HEADER=/usr/include/linux/capability.h])
70 AC_SUBST(CAPABILITY_HEADER)
75 if test x"$GCC" = x"yes"; then
79 ALLWARNS="-W -Wall -Wundef -Wpointer-arith -Wcast-align \
80 -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
81 -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
82 -Wnested-externs -Winline -Wfloat-equal -Wchar-subscripts"
89 [ --with-debug turn on debugging [[default=no]]],
91 if test "x${withval}" = xyes; then
94 AM_CONDITIONAL(DEBUG, true)
97 AM_CONDITIONAL(DEBUG, false)
100 [ DEBUG="-DNDEBUG"; AM_CONDITIONAL(DEBUG, false) ])
102 AC_MSG_CHECKING(__attr_dealloc_free support)
107 extern char *test(const char *name) __attr_dealloc_free;
108 int main(void) { return 0; }]])],
112 AC_MSG_RESULT($DEALLOC)
115 [ --with-warn turn on warnings [[default=yes]]],
117 if test "x${withval}" = xyes; then
126 AC_MSG_CHECKING(for -Wformat-truncation)
127 TMPCFLAGS="${CFLAGS}"
128 CFLAGS="${CFLAGS} -Wformat-truncation"
129 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[WFLAGS="-Wno-format-truncation"
132 CFLAGS="${TMPCFLAGS}"
135 AC_CHECK_HEADER(sys/syscall.h,
136 [AC_DEFINE([HAVE_SYSCALL_H], [1],
137 [Define to 1 if you have <sys/syscall.h>.])], [],)
139 dnl; This is to record in the build logs what options are being taken
140 AC_CHECK_DECLS([PR_CAP_AMBIENT], [], [], [[#include <sys/prctl.h>]])
141 AC_CHECK_DECLS([VFS_CAP_REVISION_2], [], [], [[#include <linux/capability.h>]])
142 AC_CHECK_DECLS([VFS_CAP_REVISION_3], [], [], [[#include <linux/capability.h>]])
143 AC_CHECK_DECLS([CAP_EPOLLWAKEUP], [], [], [[#include <linux/capability.h>]])
144 AC_CHECK_DECLS([CAP_WAKE_ALARM], [], [], [[#include <linux/capability.h>]])
145 AC_CHECK_DECLS([CAP_BLOCK_SUSPEND], [], [], [[#include <linux/capability.h>]])
146 AC_CHECK_DECLS([CAP_AUDIT_READ], [], [], [[#include <linux/capability.h>]])
147 AC_CHECK_DECLS([CAP_PERFMON], [], [], [[#include <linux/capability.h>]])
148 AC_CHECK_DECLS([CAP_BPF], [], [], [[#include <linux/capability.h>]])
149 AC_CHECK_DECLS([CAP_CHECKPOINT_RESTORE], [], [], [[#include <linux/capability.h>]])
151 dnl only build libdrop_ambient if support for ambient capabilities was found (which is normal)
152 if test x"${ac_cv_have_decl_PR_CAP_AMBIENT}" = x"no" ; then
153 AC_MSG_WARN("PR_CAP_AMBIENT not available - libdrop_ambient will not be built")
155 AM_CONDITIONAL(BUILD_LIBDROP_AMBIENT, test x"${ac_cv_have_decl_PR_CAP_AMBIENT}" = x"yes")
157 AC_CHECK_PROG(swig_found, swig, yes, no)
158 if test x"${swig_found}" = x"no" ; then
159 AC_MSG_WARN("Swig not found - python bindings will not be made")
161 AM_CONDITIONAL(HAVE_SWIG, test x"${swig_found}" = x"yes")
164 AC_MSG_CHECKING(whether to create python3 bindings)
166 AS_HELP_STRING([--with-python3],[enable building python3 bindings]),
167 use_python3=$withval,
169 if test x$use_python3 = xno ; then
172 AC_MSG_RESULT(investigating)
173 AC_PATH_PROG([use_python3], [python3-config], [no])
174 if test ${use_python3} = no ; then
175 if test ${withval} = yes ; then
176 echo "Python3 bindings were selected but python3-config was not found."
177 echo "Please ensure that it's installed or pass --without-python3 to ./configure"
180 echo "Python3 bindings will NOT be built"
182 echo "Python3 bindings WILL be built"
184 AC_PATH_PROG([PYTHON3], [python3], [no])
185 if test "x$PYTHON3" == "xno" ; then
186 echo "The python3 program was not found in the search path. Please ensure"
187 echo "that it is installed and its directory is included in the search path or"
188 echo "pass --without-python3 to ./configure."
191 PYTHON3_CFLAGS=`python3-config --cflags 2> /dev/null`
192 PYTHON3_LIBS=`python3-config --libs 2> /dev/null`
193 PYTHON3_INCLUDES=`python3-config --includes 2> /dev/null`
194 AC_SUBST([PYTHON3_PREFIX], ['${prefix}'])
195 PYTHON3_EXECDIR=`$PYTHON3 -c "import sysconfig; print(sysconfig.get_path('platlib'))"`
196 AC_SUBST(PYTHON3_CFLAGS)
197 AC_SUBST(PYTHON3_LIBS)
198 AC_SUBST(PYTHON3_INCLUDES)
199 AC_SUBST(py3execdir, $PYTHON3_EXECDIR)
202 AM_CONDITIONAL(USE_PYTHON3, test ${use_python3} = "yes")
204 AC_CONFIG_FILES([Makefile src/Makefile src/libcap-ng.pc src/test/Makefile
206 bindings/python3/Makefile bindings/src/Makefile
207 bindings/python3/test/Makefile utils/Makefile
208 m4/Makefile docs/Makefile])
214 libcap-ng Version: $VERSION
216 Installation prefix: $prefix
217 PYTHON3_PREFIX: $PYTHON3_PREFIX
220 `echo $CFLAGS | fmt -w 50 | sed 's,^, ,'`
221 __attr_dealloc_free support: $DEALLOC