Blame configure.ac

Packit 56e23f
dnl ####
Packit 56e23f
dnl # Seccomp Library
Packit 56e23f
dnl #
Packit 56e23f
Packit 56e23f
dnl #
Packit 56e23f
dnl # This library is free software; you can redistribute it and/or modify it
Packit 56e23f
dnl # under the terms of version 2.1 of the GNU Lesser General Public License
Packit 56e23f
dnl # as published by the Free Software Foundation.
Packit 56e23f
dnl #
Packit 56e23f
dnl # This library is distributed in the hope that it will be useful, but
Packit 56e23f
dnl # WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 56e23f
dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
Packit 56e23f
dnl # General Public License for more details.
Packit 56e23f
dnl #
Packit 56e23f
dnl # You should have received a copy of the GNU Lesser General Public License
Packit 56e23f
dnl # along with this library; if not, see <http://www.gnu.org/licenses>.
Packit 56e23f
dnl #
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl libseccomp defines
Packit 56e23f
dnl ####
Packit 56e23f
AC_INIT([libseccomp], [2.4.3])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl autoconf configuration
Packit 56e23f
dnl ####
Packit 56e23f
AC_CONFIG_AUX_DIR([build-aux])
Packit 56e23f
AC_CONFIG_HEADERS([configure.h])
Packit 56e23f
AC_CONFIG_MACRO_DIR([m4])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl automake configuration
Packit 56e23f
dnl ####
Packit 56e23f
dnl NOTE: Automake < 1.12 didn't have serial-tests and gives an error if it
Packit 56e23f
dnl sees this, but for automake >= 1.13 serial-tests is required so we have to
Packit 56e23f
dnl include it.  Solution is to test for the version of automake (by running
Packit 56e23f
dnl an external command) and provide it if necessary.  Note we have to do this
Packit 56e23f
dnl entirely using m4 macros since automake queries this macro by running
Packit 56e23f
dnl 'autoconf --trace ...'.
Packit 56e23f
m4_define([serial_tests], [
Packit 56e23f
    m4_esyscmd([automake --version |
Packit 56e23f
                head -1 |
Packit 56e23f
                awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
Packit 56e23f
    ])
Packit 56e23f
])
Packit 56e23f
dnl # NOTE: do not [quote] this parameter
Packit 56e23f
AM_INIT_AUTOMAKE(-Wall foreign subdir-objects tar-pax serial_tests)
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl build tools
Packit 56e23f
dnl ####
Packit 56e23f
AC_PROG_CC
Packit 56e23f
AM_PROG_CC_C_O
Packit 56e23f
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl libtool configuration
Packit 56e23f
dnl ####
Packit 56e23f
LT_INIT([shared pic-only])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl enable silent builds by default
Packit 56e23f
dnl ####
Packit 56e23f
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl build flags
Packit 56e23f
dnl ####
Packit 56e23f
AM_CPPFLAGS="-I\${top_srcdir}/include"
Packit 56e23f
AM_CFLAGS="-Wall"
Packit 56e23f
AM_LDFLAGS="-Wl,-z -Wl,relro"
Packit 56e23f
AC_SUBST([AM_CPPFLAGS])
Packit 56e23f
AC_SUBST([AM_CFLAGS])
Packit 56e23f
AC_SUBST([AM_LDFLAGS])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl check build system seccomp awareness
Packit 56e23f
dnl ####
Packit 56e23f
AC_CHECK_HEADERS_ONCE([linux/seccomp.h])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl version information
Packit 56e23f
dnl ####
Packit 56e23f
VERSION_MAJOR=$(echo ${VERSION} | cut -d'.' -f 1)
Packit 56e23f
VERSION_MINOR=$(echo ${VERSION} | cut -d'.' -f 2)
Packit 56e23f
VERSION_MICRO=$(echo ${VERSION} | cut -d'.' -f 3)
Packit 56e23f
AC_SUBST([VERSION_MAJOR])
Packit 56e23f
AC_SUBST([VERSION_MINOR])
Packit 56e23f
AC_SUBST([VERSION_MICRO])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl cython checks
Packit 56e23f
dnl ####
Packit 56e23f
AC_CHECK_PROG(have_cython, cython, "yes", "no")
Packit 56e23f
AS_IF([test "$have_cython" = yes], [
Packit 56e23f
	AS_ECHO("checking cython version... $(cython -V 2>&1 | cut -d' ' -f 3)")
Packit 56e23f
	CYTHON_VER_MAJ=$(cython -V 2>&1 | cut -d' ' -f 3 | cut -d'.' -f 1);
Packit 56e23f
	CYTHON_VER_MIN=$(cython -V 2>&1 | cut -d' ' -f 3 | cut -d'.' -f 2);
Packit 56e23f
],[
Packit 56e23f
	CYTHON_VER_MAJ=0
Packit 56e23f
	CYTHON_VER_MIN=0
Packit 56e23f
])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl python binding checks
Packit 56e23f
dnl ####
Packit 56e23f
AC_ARG_ENABLE([python],
Packit 56e23f
	[AS_HELP_STRING([--enable-python],
Packit 56e23f
	[build the python bindings, requires cython])])
Packit 56e23f
AS_IF([test "$enable_python" = yes], [
Packit 56e23f
	# cython version check
Packit 56e23f
	AS_IF([test "$CYTHON_VER_MAJ" -eq 0 -a "$CYTHON_VER_MIN" -lt 29], [
Packit 56e23f
		AC_MSG_ERROR([python bindings require cython 0.29 or higher])
Packit 56e23f
	])
Packit 56e23f
	AM_PATH_PYTHON
Packit 56e23f
])
Packit 56e23f
AM_CONDITIONAL([ENABLE_PYTHON], [test "$enable_python" = yes])
Packit 56e23f
AC_DEFINE_UNQUOTED([ENABLE_PYTHON],
Packit 56e23f
	[$(test "$enable_python" = yes && echo 1 || echo 0)],
Packit 56e23f
	[Python bindings build flag.])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl coverity checks
Packit 56e23f
dnl ####
Packit 56e23f
AC_CHECK_PROG(have_coverity, cov-build, "yes", "no")
Packit 56e23f
AM_CONDITIONAL(COVERITY, test "$have_coverity" = yes)
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl code coverage checks
Packit 56e23f
dnl -> https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
Packit 56e23f
dnl ####
Packit 56e23f
AX_CODE_COVERAGE
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl version dependent files
Packit 56e23f
dnl ####
Packit 56e23f
AC_CONFIG_FILES([
Packit 56e23f
	libseccomp.pc
Packit 56e23f
	include/seccomp.h
Packit 56e23f
])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl makefiles
Packit 56e23f
dnl ####
Packit 56e23f
AC_CONFIG_FILES([
Packit 56e23f
	Makefile
Packit 56e23f
	include/Makefile
Packit 56e23f
	src/Makefile
Packit 56e23f
	src/python/Makefile
Packit 56e23f
	tools/Makefile
Packit 56e23f
	tests/Makefile
Packit 56e23f
	doc/Makefile
Packit 56e23f
])
Packit 56e23f
Packit 56e23f
dnl ####
Packit 56e23f
dnl done
Packit 56e23f
dnl ####
Packit 56e23f
AC_OUTPUT