| 1 | dnl #### |
| 2 | dnl # Seccomp Library |
| 3 | dnl # |
| 4 | |
| 5 | dnl # |
| 6 | dnl # This library is free software; you can redistribute it and/or modify it |
| 7 | dnl # under the terms of version 2.1 of the GNU Lesser General Public License |
| 8 | dnl # as published by the Free Software Foundation. |
| 9 | dnl # |
| 10 | dnl # This library is distributed in the hope that it will be useful, but |
| 11 | dnl # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
| 13 | dnl # General Public License for more details. |
| 14 | dnl # |
| 15 | dnl # You should have received a copy of the GNU Lesser General Public License |
| 16 | dnl # along with this library; if not, see <http://www.gnu.org/licenses>. |
| 17 | dnl # |
| 18 | |
| 19 | dnl #### |
| 20 | dnl libseccomp defines |
| 21 | dnl #### |
| 22 | AC_INIT([libseccomp], [2.3.1]) |
| 23 | |
| 24 | dnl #### |
| 25 | dnl autoconf configuration |
| 26 | dnl #### |
| 27 | AC_CONFIG_AUX_DIR([build-aux]) |
| 28 | AC_CONFIG_HEADERS([configure.h]) |
| 29 | AC_CONFIG_MACRO_DIR([m4]) |
| 30 | |
| 31 | dnl #### |
| 32 | dnl automake configuration |
| 33 | dnl #### |
| 34 | dnl NOTE: Automake < 1.12 didn't have serial-tests and gives an error if it |
| 35 | dnl sees this, but for automake >= 1.13 serial-tests is required so we have to |
| 36 | dnl include it. Solution is to test for the version of automake (by running |
| 37 | dnl an external command) and provide it if necessary. Note we have to do this |
| 38 | dnl entirely using m4 macros since automake queries this macro by running |
| 39 | dnl 'autoconf --trace ...'. |
| 40 | m4_define([serial_tests], [ |
| 41 | m4_esyscmd([automake --version | |
| 42 | head -1 | |
| 43 | awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}' |
| 44 | ]) |
| 45 | ]) |
| 46 | dnl # NOTE: do not [quote] this parameter |
| 47 | AM_INIT_AUTOMAKE(-Wall foreign subdir-objects tar-pax serial_tests) |
| 48 | |
| 49 | dnl #### |
| 50 | dnl build tools |
| 51 | dnl #### |
| 52 | AC_PROG_CC |
| 53 | AM_PROG_CC_C_O |
| 54 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
| 55 | |
| 56 | dnl #### |
| 57 | dnl libtool configuration |
| 58 | dnl #### |
| 59 | LT_INIT([shared pic-only]) |
| 60 | |
| 61 | dnl #### |
| 62 | dnl enable silent builds by default |
| 63 | dnl #### |
| 64 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 65 | |
| 66 | dnl #### |
| 67 | dnl build flags |
| 68 | dnl #### |
| 69 | AM_CPPFLAGS="-I\${top_srcdir}/include" |
| 70 | AM_CFLAGS="-Wall" |
| 71 | AM_LDFLAGS="-Wl,-z -Wl,relro" |
| 72 | AC_SUBST([AM_CPPFLAGS]) |
| 73 | AC_SUBST([AM_CFLAGS]) |
| 74 | AC_SUBST([AM_LDFLAGS]) |
| 75 | |
| 76 | dnl #### |
| 77 | dnl check build system seccomp awareness |
| 78 | dnl #### |
| 79 | AC_CHECK_HEADERS_ONCE([linux/seccomp.h]) |
| 80 | |
| 81 | dnl #### |
| 82 | dnl version information |
| 83 | dnl #### |
| 84 | VERSION_MAJOR=$(echo ${VERSION} | cut -d'.' -f 1) |
| 85 | VERSION_MINOR=$(echo ${VERSION} | cut -d'.' -f 2) |
| 86 | VERSION_MICRO=$(echo ${VERSION} | cut -d'.' -f 3) |
| 87 | AC_SUBST([VERSION_MAJOR]) |
| 88 | AC_SUBST([VERSION_MINOR]) |
| 89 | AC_SUBST([VERSION_MICRO]) |
| 90 | |
| 91 | dnl #### |
| 92 | dnl cython checks |
| 93 | dnl #### |
| 94 | AC_CHECK_PROG(have_cython, cython, "yes", "no") |
| 95 | AS_IF([test "$have_cython" = yes], [ |
| 96 | AS_ECHO("checking cython version... $(cython -V 2>&1 | cut -d' ' -f 3)") |
| 97 | CYTHON_VER_MAJ=$(cython -V 2>&1 | cut -d' ' -f 3 | cut -d'.' -f 1); |
| 98 | CYTHON_VER_MIN=$(cython -V 2>&1 | cut -d' ' -f 3 | cut -d'.' -f 2); |
| 99 | ],[ |
| 100 | CYTHON_VER_MAJ=0 |
| 101 | CYTHON_VER_MIN=0 |
| 102 | ]) |
| 103 | |
| 104 | dnl #### |
| 105 | dnl python binding checks |
| 106 | dnl #### |
| 107 | AC_ARG_ENABLE([python], |
| 108 | [AS_HELP_STRING([--enable-python], |
| 109 | [build the python bindings, requires cython])]) |
| 110 | AS_IF([test "$enable_python" = yes], [ |
| 111 | # cython version check |
| 112 | AS_IF([test "$CYTHON_VER_MAJ" -eq 0 -a "$CYTHON_VER_MIN" -lt 16], [ |
| 113 | AC_MSG_ERROR([python bindings require cython 0.16 or higher]) |
| 114 | ]) |
| 115 | ]) |
| 116 | AM_CONDITIONAL([ENABLE_PYTHON], [test "$enable_python" = yes]) |
| 117 | AC_DEFINE_UNQUOTED([ENABLE_PYTHON], |
| 118 | [$(test "$enable_python" = yes && echo 1 || echo 0)], |
| 119 | [Python bindings build flag.]) |
| 120 | |
| 121 | dnl #### |
| 122 | dnl coverity checks |
| 123 | dnl #### |
| 124 | AC_CHECK_PROG(have_coverity, cov-build, "yes", "no") |
| 125 | AM_CONDITIONAL(COVERITY, test "$have_coverity" = yes) |
| 126 | |
| 127 | dnl #### |
| 128 | dnl version dependent files |
| 129 | dnl #### |
| 130 | AC_CONFIG_FILES([ |
| 131 | libseccomp.pc |
| 132 | include/seccomp.h |
| 133 | ]) |
| 134 | |
| 135 | dnl #### |
| 136 | dnl makefiles |
| 137 | dnl #### |
| 138 | AC_CONFIG_FILES([ |
| 139 | Makefile |
| 140 | include/Makefile |
| 141 | src/Makefile |
| 142 | src/python/Makefile |
| 143 | tools/Makefile |
| 144 | tests/Makefile |
| 145 | doc/Makefile |
| 146 | ]) |
| 147 | |
| 148 | dnl #### |
| 149 | dnl done |
| 150 | dnl #### |
| 151 | AC_OUTPUT |