5 kx dnl
5 kx define([AC_INIT_NOTICE],
5 kx [### Generated automatically using autoconf version] AC_ACVERSION [
5 kx ### Copyright 2009-2020 Steve Grubb <sgrubb@redhat.com>
5 kx ###
5 kx ### Permission is hereby granted, free of charge, to any person obtaining a
5 kx ### copy of this software and associated documentation files (the "Software"),
5 kx ### to deal in the Software without restriction, including without limitation
5 kx ### the rights to use, copy, modify, merge, publish, distribute, sublicense,
5 kx ### and/or sell copies of the Software, and to permit persons to whom the
5 kx ### Software is furnished to do so, subject to the following conditions:
5 kx ###
5 kx ### The above copyright notice and this permission notice shall be included
5 kx ### in all copies or substantial portions of the Software.
5 kx ###
5 kx ### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5 kx ### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5 kx ### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
5 kx ### THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
5 kx ### OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
5 kx ### ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5 kx ### OTHER DEALINGS IN THE SOFTWARE.
5 kx ###
5 kx ### For usage, run `./configure --help'
5 kx ### For more detailed information on installation, read the file `INSTALL'.
5 kx ###
5 kx ### If configuration succeeds, status is in the file `config.status'.
5 kx ### A log of configuration tests is in `config.log'.
5 kx ])
5 kx
5 kx AC_REVISION($Revision: 1.3 $)dnl
5 kx AC_INIT(libcap-ng,0.8.2)
5 kx AC_PREREQ(2.12)dnl
5 kx AM_CONFIG_HEADER(config.h)
5 kx AC_CONFIG_MACRO_DIR([m4])
5 kx
5 kx echo Configuring libcap-ng $VERSION
5 kx
5 kx AC_CANONICAL_TARGET
5 kx AM_INIT_AUTOMAKE
5 kx AM_PROG_LIBTOOL
5 kx AC_SUBST(LIBTOOL_DEPS)
5 kx
5 kx echo .
5 kx echo Checking for programs
5 kx
5 kx AC_PROG_CC
5 kx AC_PROG_INSTALL
5 kx AC_PROG_AWK
5 kx
5 kx echo .
5 kx echo Checking for header files
5 kx AC_HEADER_STDC
5 kx AC_CHECK_HEADERS(linux/capability.h, [], [AC_MSG_ERROR(linux/capability.h is required in order to build libcap-ng.)])
5 kx AC_CHECK_HEADERS(sys/xattr.h, [], [
5 kx AC_CHECK_HEADERS(attr/xattr.h, [], [AC_MSG_WARN(attr/xattr.h not found, disabling file system capabilities.)])
5 kx ])
5 kx AC_CHECK_HEADERS(linux/securebits.h, [], [])
5 kx AC_CHECK_HEADERS(pthread.h,
5 kx [AC_SEARCH_LIBS(pthread_atfork, pthread)],
5 kx [AC_MSG_WARN(pthread.h not found, disabling pthread_atfork.)])
5 kx AC_CHECK_HEADERS(sys/vfs.h, [
5 kx AC_CHECK_HEADERS(linux/magic.h, [] [AC_MSG_WARN(linux/magic.h is required in order to verify procfs.)])
5 kx ], [AC_MSG_WARN(sys/vfs.h is required in order to verify procfs.)])
5 kx
5 kx AC_C_CONST
5 kx AC_C_INLINE
5 kx AM_PROG_CC_C_O
5 kx
5 kx ALLWARNS=""
5 kx ALLDEBUG="-g"
5 kx OPT="-O"
5 kx if test x"$GCC" = x"yes"; then
5 kx OPT="-O2 -pipe"
5 kx case "$target" in
5 kx *linux*)
5 kx ALLWARNS="-W -Wall -Wundef -Wpointer-arith -Wcast-align \
5 kx -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
5 kx -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
5 kx -Wnested-externs -Winline -Wfloat-equal -Wchar-subscripts"
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx ALLDEBUG="-g"
5 kx AC_ARG_WITH(debug,
5 kx [ --with-debug turn on debugging [[default=no]]],
5 kx [
5 kx if test "x${withval}" = xyes; then
5 kx DEBUG="$ALLDEBUG"
5 kx OPT="-O"
5 kx AM_CONDITIONAL(DEBUG, true)
5 kx else
5 kx DEBUG="-DNDEBUG"
5 kx AM_CONDITIONAL(DEBUG, false)
5 kx fi
5 kx ],
5 kx [ DEBUG="-DNDEBUG"; AM_CONDITIONAL(DEBUG, false) ])
5 kx
5 kx AC_ARG_WITH(warn,
5 kx [ --with-warn turn on warnings [[default=yes]]],
5 kx [
5 kx if test "x${withval}" = xyes; then
5 kx WARNS="$ALLWARNS"
5 kx else
5 kx WARNS=""
5 kx fi
5 kx ],WARNS="$ALLWARNS")
5 kx AC_SUBST(DEBUG)
5 kx
5 kx AC_CHECK_HEADER(sys/syscall.h,
5 kx [AC_DEFINE([HAVE_SYSCALL_H], [1],
5 kx [Define to 1 if you have <sys/syscall.h>.])], [],)
5 kx
5 kx dnl; This is to record in the build logs what options are being taken
5 kx AC_CHECK_DECLS([PR_CAP_AMBIENT], [], [], [[#include <sys/prctl.h>]])
5 kx AC_CHECK_DECLS([VFS_CAP_REVISION_2], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([VFS_CAP_REVISION_3], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_EPOLLWAKEUP], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_WAKE_ALARM], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_BLOCK_SUSPEND], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_AUDIT_READ], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_PERFMON], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_BPF], [], [], [[#include <linux/capability.h>]])
5 kx AC_CHECK_DECLS([CAP_CHECKPOINT_RESTORE], [], [], [[#include <linux/capability.h>]])
5 kx
5 kx dnl only build libdrop_ambient if support for ambient capabilities was found (which is normal)
5 kx if test x"${ac_cv_have_decl_PR_CAP_AMBIENT}" = x"no" ; then
5 kx AC_MSG_WARN("PR_CAP_AMBIENT not available - libdrop_ambient will not be built")
5 kx fi
5 kx AM_CONDITIONAL(BUILD_LIBDROP_AMBIENT, test x"${ac_cv_have_decl_PR_CAP_AMBIENT}" = x"yes")
5 kx
5 kx AC_CHECK_PROG(swig_found, swig, yes, no)
5 kx if test x"${swig_found}" = x"no" ; then
5 kx AC_MSG_WARN("Swig not found - python bindings will not be made")
5 kx fi
5 kx AM_CONDITIONAL(HAVE_SWIG, test x"${swig_found}" = x"yes")
5 kx
5 kx AC_MSG_CHECKING(whether to create python bindings)
5 kx AC_ARG_WITH(python,
5 kx AS_HELP_STRING([--with-python],[enable building python bindings]),
5 kx use_python=$withval,
5 kx use_python=auto)
5 kx if test "x$use_python" = xno ; then
5 kx python_found="no"
5 kx AC_MSG_RESULT(no)
5 kx else
5 kx AC_MSG_RESULT(testing)
5 kx
5 kx # Try to find a versioned Python2 interpreter,
5 kx # if not explicitly specified by the user.
5 kx if test "x$PYTHON" = "x"; then
5 kx AC_MSG_CHECKING([for versioned Python2 interpreter])
5 kx AC_MSG_RESULT([])
5 kx for python2 in python2 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0; do
5 kx AC_PATH_PROG([PYTHON], [$python2])
5 kx if test "x$PYTHON" != "x"; then
5 kx break;
5 kx fi
5 kx done
5 kx fi
5 kx
5 kx # Setup Python2 with the interpreter found previously.
5 kx AM_PATH_PYTHON
5 kx @PYINCLUDEDIR=`python${am_cv_python_version} -c "from distutils import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"`
5 kx if test -f ${PYINCLUDEDIR}/Python.h ; then
5 kx python_found="yes"
5 kx AC_SUBST(PYINCLUDEDIR)
5 kx pybind_dir="python"
5 kx AC_SUBST(pybind_dir)
5 kx AC_MSG_NOTICE(Python bindings will be built)
5 kx else
5 kx python_found="no"
5 kx if test "x$use_python" = xyes ; then
5 kx AC_MSG_ERROR([Python explicitly requested and python headers were not found])
5 kx else
5 kx AC_MSG_WARN("Python headers not found - python bindings will not be made")
5 kx fi
5 kx fi
5 kx fi
5 kx AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
5 kx
5 kx withval=""
5 kx AC_MSG_CHECKING(whether to create python3 bindings)
5 kx AC_ARG_WITH(python3,
5 kx AS_HELP_STRING([--with-python3],[enable building python3 bindings]),
5 kx use_python3=$withval,
5 kx use_python3=auto)
5 kx if test x$use_python3 = xno ; then
5 kx AC_MSG_RESULT(no)
5 kx else
5 kx AC_MSG_RESULT(investigating)
5 kx AC_PATH_PROG([use_python3], [python3-config], [no])
5 kx if test ${use_python3} = no ; then
5 kx if test ${withval} = yes ; then
5 kx echo "Python3 bindings were selected but python3-config was not found."
5 kx echo "Please ensure that it's installed or pass --without-python3 to ./configure"
5 kx exit 1
5 kx fi
5 kx echo "Python3 bindings will NOT be built"
5 kx else
5 kx echo "Python3 bindings WILL be built"
5 kx use_python3=yes
5 kx AC_PATH_PROG([PYTHON3], [python3], [no])
5 kx if test "x$PYTHON3" == "xno" ; then
5 kx echo "The python3 program was not found in the search path. Please ensure"
5 kx echo "that it is installed and its directory is included in the search path or"
5 kx echo "pass --without-python3 to ./configure."
5 kx exit 1
5 kx fi
5 kx PYTHON3_CFLAGS=`python3-config --cflags 2> /dev/null`
5 kx PYTHON3_LIBS=`python3-config --libs 2> /dev/null`
5 kx PYTHON3_INCLUDES=`python3-config --includes 2> /dev/null`
5 kx AC_SUBST([PYTHON3_PREFIX], ['${prefix}'])
5 kx AC_SUBST([PYTHON3_EXEC_PREFIX], ['${exec_prefix}'])
5 kx # PYTHON3_DIR=`$PYTHON3 -c "import distutils.sysconfig; \
5 kx # print(distutils.sysconfig.get_python_lib(0,0,prefix='$PYTHON3_PREFIX'))"`
5 kx # PYTHON3_EXECDIR=`$PYTHON3 -c "import distutils.sysconfig; \
5 kx # print(distutils.sysconfig.get_python_lib(1,0,prefix='$PYTHON3_EXEC_PREFIX'))"`
5 kx AC_SUBST(PYTHON3_CFLAGS)
5 kx AC_SUBST(PYTHON3_LIBS)
5 kx AC_SUBST(PYTHON3_INCLUDES)
5 kx AC_SUBST(python3dir, $PYTHON3_DIR)
5 kx AC_SUBST(py3execdir, $PYTHON3_EXECDIR)
5 kx fi
5 kx fi
5 kx AM_CONDITIONAL(USE_PYTHON3, test ${use_python3} = "yes")
5 kx
5 kx AC_OUTPUT(Makefile src/Makefile src/libcap-ng.pc src/test/Makefile
5 kx bindings/Makefile bindings/python/Makefile
5 kx bindings/python3/Makefile bindings/src/Makefile
5 kx bindings/python/test/Makefile utils/Makefile
5 kx m4/Makefile docs/Makefile)
5 kx
5 kx echo .
5 kx echo "
5 kx
5 kx libcap-ng Version: $VERSION
5 kx Target: $target
5 kx Installation prefix: $prefix
5 kx Compiler: $CC
5 kx Compiler flags:
5 kx `echo $CFLAGS | fmt -w 50 | sed 's,^, ,'`
5 kx "