From: Jan Engelhardt <[email protected]>

With my apologies to Jan for delaying this patch for so long, there
are a number of differences between Jan's original patch and what is
being merged in this patch; almost all of the changes are due to
changes in the underlying code base, but there are a few minor fixes
as well.

Signed-off-by: Jan Engelhardt <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
---
 .gitignore             |   25 +++-
 Makefile               |  126 ---------------------
 Makefile.am            |   31 +++++
 autogen.sh             |    6 +
 configure              |  284 ------------------------------------------------
 configure.ac           |   49 ++++++++
 configure.mk           |    8 +
 doc/Makefile           |   74 -------------
 include/Makefile       |   57 ----------
 include/seccomp.h.in   |    6 +
 install.mk             |   31 -----
 libseccomp.pc.in       |    9 +-
 macros.mk              |  235 ----------------------------------------
 src/.gitignore         |    1 
 src/Makefile           |   93 ----------------
 src/Makefile.am        |   17 +++
 src/python/Makefile    |   54 ---------
 src/python/Makefile.am |   24 ++++
 src/python/setup.py    |    2 
 src/system.h           |    4 -
 tests/Makefile         |   96 ----------------
 tests/Makefile.am      |   45 ++++++++
 tools/Makefile         |   70 ------------
 tools/Makefile.am      |   16 +++
 version_info           |    8 -
 25 files changed, 224 insertions(+), 1147 deletions(-)
 delete mode 100644 Makefile
 create mode 100644 Makefile.am
 create mode 100755 autogen.sh
 delete mode 100755 configure
 create mode 100644 configure.ac
 create mode 100644 configure.mk
 delete mode 100644 doc/Makefile
 delete mode 100644 include/Makefile
 delete mode 100644 install.mk
 delete mode 100644 macros.mk
 delete mode 100644 src/.gitignore
 delete mode 100644 src/Makefile
 create mode 100644 src/Makefile.am
 delete mode 100644 src/python/Makefile
 create mode 100644 src/python/Makefile.am
 delete mode 100644 tests/Makefile
 create mode 100644 tests/Makefile.am
 delete mode 100644 tools/Makefile
 create mode 100644 tools/Makefile.am
 delete mode 100644 version_info

diff --git a/.gitignore b/.gitignore
index d01d1a1..ad67217 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,25 @@
 *~
-*.a
+*.la
+*.lo
 *.o
-*.d
-*.dtmp
+*.pc
 *.swp
 *.orig
+.deps
+.dirstamp
+.libs
 .stgit-*
 .stgitmail.txt
+Makefile
+Makefile.in
 cscope.*
 tags
-configure.h
-configure.mk
-version_info.mk
-version.h
-libseccomp.pc
+/autom4te.cache
+/aclocal.m4
+/build-aux
+/config.*
+/configure
+/configure.h*
+/libtool
+/m4
+/stamp-h1
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 1f61f20..0000000
--- a/Makefile
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Enhanced Seccomp Library Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include macros.mk
-
-#
-# configuration
-#
-
--include version_info.mk
--include configure.mk
-include install.mk
-
-#
-# targets
-#
-
-CONFIGS = configure.mk configure.h version_info.mk libseccomp.pc
-SUBDIRS_BUILD = include src tests tools
-SUBDIRS_INSTALL = include src tools doc
-
-.PHONY: tarball install check check-syntax ctags cstags clean dist-clean \
-       $(SUBDIRS_BUILD)
-
-all: $(SUBDIRS_BUILD)
-
-$(CONFIGS): version_info
-       @$(ECHO_INFO) "automatically generating configuration ..."
-       @./configure
-
-tarball: dist-clean
-       @ver=$(VERSION_RELEASE); \
-       tarball=libseccomp-$$ver.tar.gz; \
-       $(ECHO_INFO) "creating the tarball ../$$tarball"; \
-       tmp_dir=$$(mktemp -d /tmp/libseccomp.XXXXX); \
-       rel_dir=$$tmp_dir/libseccomp-$$ver; \
-       $(MKDIR) $$rel_dir; \
-       $(TAR) cf - --exclude=*~ --exclude=.git* --exclude=.stgit* . | \
-               (cd $$rel_dir; tar xf -); \
-       (cd $$tmp_dir; $(TAR) zcf $$tarball libseccomp-$$ver); \
-       $(MV) $$tmp_dir/$$tarball ..; \
-       $(RM) -rf $$tmp_dir;
-
-$(VERSION_HDR): version_info.mk
-       @$(ECHO_INFO) "creating the version header file"
-       @hdr="$(VERSION_HDR)"; \
-       $(ECHO) "/* automatically generated - do not edit */" > $$hdr; \
-       $(ECHO) "#ifndef _VERSION_H" >> $$hdr; \
-       $(ECHO) "#define _VERSION_H" >> $$hdr; \
-       $(ECHO) "#define VERSION_RELEASE \"$(VERSION_RELEASE)\"" >> $$hdr; \
-       $(ECHO) "#define VERSION_MAJOR $(VERSION_MAJOR)" >> $$hdr; \
-       $(ECHO) "#define VERSION_MINOR $(VERSION_MINOR)" >> $$hdr; \
-       $(ECHO) "#define VERSION_MICRO $(VERSION_MICRO)" >> $$hdr; \
-       $(ECHO) "#endif" >> $$hdr;
-
-include: $(VERSION_HDR) $(CONFIGS)
-       @$(ECHO_INFO) "building in directory $@/ ..."
-       @$(MAKE) -C $@
-
-src: $(VERSION_HDR) $(CONFIGS) include
-       @$(ECHO_INFO) "building in directory $@/ ..."
-       @$(MAKE) -C $@
-
-tests: src include
-       @$(ECHO_INFO) "building in directory $@/ ..."
-       @$(MAKE) -C $@
-
-tools: src include
-       @$(ECHO_INFO) "building in directory $@/ ..."
-       @$(MAKE) -C $@
-
-install: $(SUBDIRS_BUILD)
-       @$(ECHO_INFO) "installing in $(INSTALL_PREFIX) ..."
-       $(INSTALL_PC_MACRO) libseccomp.pc
-       @for dir in $(SUBDIRS_INSTALL); do \
-               $(ECHO_INFO) "installing from $$dir/"; \
-               $(MAKE) -C $$dir install; \
-       done
-
-check: tools tests
-       @$(ECHO_INFO) "checking in directory tests/ ..."
-       @$(MAKE) -C tests check
-
-check-syntax:
-       @./tools/check-syntax
-
-ctags:
-       @$(ECHO_INFO) "generating ctags for the project ..."
-       @ctags -R *
-
-cstags:
-       @$(ECHO_INFO) "generating cscope tags for the project ..."
-       @find -iname *.[ch] > cscope.files
-       @cscope -b -q -k
-
-clean:
-       @$(ECHO_INFO) "cleaning up libseccomp"
-       @for dir in $(SUBDIRS_BUILD); do \
-               $(MAKE) -C $$dir clean; \
-       done
-
-dist-clean: clean
-       @$(ECHO_INFO) "removing the configuration files"
-       @$(RM) $(CONFIGS)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..bf0a4ea
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,31 @@
+# -*- Makefile -*-
+
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = src tools tests
+
+pkgconfdir = ${libdir}/pkgconfig
+pkgconf_DATA = libseccomp.pc
+
+nodist_include_HEADERS = include/seccomp.h
+
+dist_man_MANS = \
+       doc/man/man1/scmp_sys_resolver.1 \
+       doc/man/man3/seccomp_arch_add.3 \
+       doc/man/man3/seccomp_arch_exist.3 \
+       doc/man/man3/seccomp_arch_native.3 \
+       doc/man/man3/seccomp_arch_remove.3 \
+       doc/man/man3/seccomp_attr_get.3 \
+       doc/man/man3/seccomp_attr_set.3 \
+       doc/man/man3/seccomp_export_bpf.3 \
+       doc/man/man3/seccomp_export_pfc.3 \
+       doc/man/man3/seccomp_init.3 \
+       doc/man/man3/seccomp_load.3 \
+       doc/man/man3/seccomp_merge.3 \
+       doc/man/man3/seccomp_release.3 \
+       doc/man/man3/seccomp_reset.3 \
+       doc/man/man3/seccomp_rule_add.3 \
+       doc/man/man3/seccomp_rule_add_exact.3 \
+       doc/man/man3/seccomp_syscall_priority.3 \
+       doc/man/man3/seccomp_syscall_resolve_name.3 \
+       doc/man/man3/seccomp_syscall_resolve_name_arch.3 \
+       doc/man/man3/seccomp_syscall_resolve_num_arch.3
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..1b46ee4
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+test -d m4 || mkdir m4
+autoreconf -fi;
+rm -Rf autom4te.cache;
+# do not call configure - this is unexpected
diff --git a/configure b/configure
deleted file mode 100755
index 50bdcca..0000000
--- a/configure
+++ /dev/null
@@ -1,284 +0,0 @@
-#!/bin/bash
-
-#
-# Enhanced Seccomp Library Configure Script
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-# configuration defaults
-opt_prefix="/usr/local"
-opt_libdir=""
-opt_sysinc_seccomp="yes"
-opt_bindings_python="no"
-
-# output files
-cnf_mk_file="configure.mk"
-cnf_h_file="configure.h"
-
-####
-# functions
-
-function test_deps() {
-       [[ -z "$1" ]] && return 0
-       which "$1" >& /dev/null && return 0
-       return 1
-}
-
-function verify_deps() {
-       [[ -z "$1" ]] && return
-       if ! test_deps "$1"; then
-               echo "error: install \"$1\" and include it in your \$PATH"
-               exit 1
-       fi
-}
-
-function msg_usage() {
-       cat << EOF
-Configure the enhanced seccomp library, libseccomp, for this system.
-
-Usage:
-  ./configure <options>
-
-Options:
-* general configuration
-  -h, --help           display this help and exit
-* installation configuration
-  --prefix=PREFIX      installation base [/usr/local]
-  --libdir=DIR         library directory [/usr/local/lib]
-* build options
-  --enable-python      build the python bindings, requires cython
-EOF
-}
-
-function msg_summary() {
-       cat << EOF
- CONFIGURATION SUMMARY
-  libseccomp version:  ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}
-  installation base:   $opt_prefix
-  library directory:   $opt_libdir
-  use system includes: $opt_sysinc_seccomp
-  python bindings:     $opt_bindings_python
-EOF
-}
-
-function msg_error() {
-       echo "error: $@"
-}
-
-function cnf_mk_header() {
-       echo "# generated by configure on $(date -R)" >> $cnf_mk_file
-       echo "#   options: \"$opt_str\"" >> $cnf_mk_file
-       echo "" >> $cnf_mk_file
-}
-
-function cnf_mk_footer() {
-       echo "" >> $cnf_mk_file
-}
-
-function cnf_mk_entry() {
-       [[ $# -ne 2 ]] && return
-       case "$2" in
-       no)
-               echo "$1 = 0" >> $cnf_mk_file
-               ;;
-       yes)
-               echo "$1 = 1" >> $cnf_mk_file
-               ;;
-       *)
-               echo "$1 = \"$2\"" >> $cnf_mk_file
-       esac
-}
-
-function cnf_h_header() {
-       echo "/* generated by configure on $(date -R) */" >> $cnf_h_file
-       echo "/*   options: \"$opt_str\" */" >> $cnf_h_file
-       echo "" >> $cnf_h_file
-       echo "#ifndef _CONFIGURE_H" >> $cnf_h_file
-       echo "#define _CONFIGURE_H" >> $cnf_h_file
-       echo "" >> $cnf_h_file
-}
-
-function cnf_h_footer() {
-       echo "" >> $cnf_h_file
-       echo "#endif" >> $cnf_h_file
-       echo "" >> $cnf_h_file
-}
-
-function cnf_h_entry() {
-       [[ $# -ne 2 ]] && return
-       case "$2" in
-       no)
-               echo "#undef $1" >> $cnf_h_file
-               ;;
-       yes)
-               echo "#define $1        1" >> $cnf_h_file
-               ;;
-       *)
-               echo "#define $1        $2" >> $cnf_h_file
-       esac
-}
-
-function cnf_reset() {
-       cat /dev/null > $cnf_mk_file
-       cat /dev/null > $cnf_h_file
-}
-
-function cnf_header() {
-       cnf_mk_header
-       cnf_h_header
-}
-
-function cnf_entry() {
-       cnf_mk_entry "$1" "$2"
-       cnf_h_entry "$1" "$2"
-}
-
-function cnf_footer() {
-       cnf_mk_footer
-       cnf_h_footer
-}
-
-function tmpl_filter() {
-       name="echo \$$1"
-       val="$(eval $name)"
-       cat - | sed -e 's/%%'"$1"'%%/'"${val//\//\\/}"'/g;'
-}
-
-####
-# main
-
-#
-# setup
-#
-
-# verify script dependencies
-verify_deps getopt
-
-# parse the command line options
-opt_str="$@"
-opt=$(getopt -n "$0" --options "h" --longoptions 
"help,prefix:,libdir:,enable-python" -- "$@")
-eval set -- "$opt"
-while [[ $# -gt 0 ]]; do
-       case "$1" in
-       --prefix)
-               opt_prefix="$2"
-               shift 2
-               ;;
-       --libdir)
-               opt_libdir="$2"
-               shift 2
-               ;;
-       --enable-python)
-               opt_bindings_python="yes"
-               shift
-               ;;
-       -h|--help)
-               msg_usage
-               exit 0
-               ;;
-       --)
-               shift
-               ;;
-       *)
-               msg_usage
-               exit 1
-       esac
-done
-
-#
-# validate the command line options
-#
-
-if [[ -e "$opt_prefix" && ! -d "$opt_prefix" ]]; then
-       msg_error "install prefix ($opt_prefix) is not a directory"
-       exit 1
-fi
-
-if [[ -z $opt_libdir ]]; then
-       opt_libdir="$opt_prefix/lib"
-fi
-if [[ -e "$opt_libdir" && ! -d "$opt_libdir" ]]; then
-       msg_error "libdir ($opt_libdir) is not a directory"
-       exit 1
-fi
-
-if [[ "$opt_bindings_python" = "yes" ]]; then
-       if ! test_deps cython; then
-               msg_error "python bindings require the cython package"
-               exit 1
-       fi
-       cython_ver=$(cython -V 2>&1 | cut -d' ' -f 3)
-       if [[ $(echo $cython_ver | cut -d'.' -f 1) -lt 1 &&
-             $(echo $cython_ver | cut -d'.' -f 2) -lt 16 ]]; then
-               msg_error "python bindings require cython 0.16 or higher"
-               exit 1
-       fi
-fi
-
-#
-# automatic configuration
-#
-
-# system seccomp includes
-if [[ -r "/usr/include/linux/seccomp.h" ]]; then
-       opt_sysinc_seccomp="yes"
-else
-       opt_sysinc_seccomp="no"
-fi
-
-# generate the version files
-. ./version_info
-VERSION_RELEASE="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}"
-rm -f ./version_info.mk
-echo "# generated by configure on $(date -R)" >> ./version_info.mk
-echo "VERSION_MAJOR=$VERSION_MAJOR" >> ./version_info.mk
-echo "VERSION_MINOR=$VERSION_MINOR" >> ./version_info.mk
-echo "VERSION_MICRO=$VERSION_MICRO" >> ./version_info.mk
-echo "VERSION_RELEASE=$VERSION_RELEASE" >> ./version_info.mk
-
-# generate the pkg-config metadata
-INSTALL_PREFIX="$opt_prefix"
-INSTALL_LIBDIR="$opt_libdir"
-rm -f ./libseccomp.pc
-cat ./libseccomp.pc.in | \
-       tmpl_filter INSTALL_PREFIX | \
-       tmpl_filter INSTALL_LIBDIR | \
-       tmpl_filter VERSION_RELEASE \
-       >> ./libseccomp.pc
-
-#
-# finish
-#
-
-# reset the configuration files
-cnf_reset
-cnf_header
-
-# output the configuration files
-cnf_mk_entry "CONF_INSTALL_PREFIX" "$opt_prefix"
-cnf_mk_entry "CONF_INSTALL_LIBDIR" "$opt_libdir"
-cnf_entry "CONF_SYSINC_SECCOMP" "$opt_sysinc_seccomp"
-cnf_entry "CONF_BINDINGS_PYTHON" "$opt_bindings_python"
-
-# configuration footer
-cnf_footer
-
-# display a summary and exit
-msg_summary
-exit 0
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..fa7bd5b
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,49 @@
+AC_INIT([libseccomp], [2.1.0])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_HEADERS([configure.h])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax no-dist-gzip dist-xz])
+AC_PROG_CC
+AM_PROG_CC_C_O
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+AC_DISABLE_STATIC
+LT_INIT
+
+AC_CHECK_HEADER([linux/seccomp.h])
+
+AM_CPPFLAGS="-I\${top_srcdir}/include"
+AM_CFLAGS="-Wall"
+AM_LDFLAGS="-Wl,-z -Wl,relro"
+AC_SUBST([AM_CPPFLAGS])
+AC_SUBST([AM_CFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
+VERSION_MAJOR="${VERSION%%.*}"
+VERSION_MINOR="${VERSION#*.}"
+VERSION_MICRO="${VERSION_MINOR#*.}"
+VERSION_MINOR="${VERSION_MINOR%%.*}"
+VERSION_MICRO="${VERSION_MICRO%%.*}"
+AC_SUBST([VERSION_MAJOR])
+AC_SUBST([VERSION_MINOR])
+AC_SUBST([VERSION_MICRO])
+
+dnl AC_ARG_ENABLE([python],
+dnl    [AS_HELP_STRING([--enable-python], [build the python bindings, requires 
cython])])
+enable_python=no
+AM_CONDITIONAL([ENABLE_PYTHON], [test "$enable_python" = yes])
+cython_ver=$(which cython >/dev/null 2>/dev/null && cython -V 2>&1 | cut -d' ' 
-f3)
+cython_maj=$(echo "$cython_ver" | cut -d'.' -f1)
+cython_min=$(echo "$cython_ver" | cut -d'.' -f2)
+AS_IF([test "$enable_python" = yes], [
+       recent=""
+       AS_IF([test -n "$cython_maj" -a -n "$cython_min" &&
+         ! test "$cython_maj" -eq 0 -a "$cython_min" -lt 16], [recent=yes])
+       AS_IF([test -z "$recent"], [
+               AC_MSG_ERROR([python bindings require cython 0.16 or higher])
+       ])
+])
+
+AC_CONFIG_FILES([Makefile src/Makefile src/python/Makefile tools/Makefile
+       tests/Makefile include/seccomp.h libseccomp.pc])
+AC_OUTPUT
diff --git a/configure.mk b/configure.mk
new file mode 100644
index 0000000..9639c71
--- /dev/null
+++ b/configure.mk
@@ -0,0 +1,8 @@
+# generated by configure on Thu, 17 Apr 2014 11:25:02 -0400
+#   options: "--enable-python"
+
+CONF_INSTALL_PREFIX = "/usr/local"
+CONF_INSTALL_LIBDIR = "/usr/local/lib"
+CONF_SYSINC_SECCOMP = 1
+CONF_BINDINGS_PYTHON = 1
+
diff --git a/doc/Makefile b/doc/Makefile
deleted file mode 100644
index 2cef056..0000000
--- a/doc/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# Enhanced Seccomp Library Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include ../macros.mk
-
-#
-# configuration
-#
-
-include $(TOPDIR)/version_info.mk
-include $(TOPDIR)/configure.mk
-include $(TOPDIR)/install.mk
-
-MAN1 = \
-       man/man1/scmp_sys_resolver.1
-
-MAN3 = \
-       man/man3/seccomp_init.3 \
-       man/man3/seccomp_load.3 \
-       man/man3/seccomp_release.3 \
-       man/man3/seccomp_reset.3 \
-       man/man3/seccomp_rule_add.3 \
-       man/man3/seccomp_rule_add_exact.3 \
-       man/man3/seccomp_syscall_priority.3 \
-       man/man3/seccomp_syscall_resolve_name.3 \
-       man/man3/seccomp_syscall_resolve_name_arch.3 \
-       man/man3/seccomp_syscall_resolve_num_arch.3 \
-       man/man3/seccomp_export_bpf.3 \
-       man/man3/seccomp_export_pfc.3 \
-       man/man3/seccomp_attr_set.3 \
-       man/man3/seccomp_attr_get.3 \
-       man/man3/seccomp_arch_add.3 \
-       man/man3/seccomp_arch_exist.3 \
-       man/man3/seccomp_arch_native.3 \
-       man/man3/seccomp_arch_remove.3 \
-       man/man3/seccomp_merge.3
-
-#
-# targets
-#
-
-.PHONY: all install install_man1 install_man3
-
-all:
-
-install: install_man1 install_man3
-
-install_man1: $(MAN1)
-       $(INSTALL_MAN1_MACRO)
-
-install_man3: $(MAN3)
-       $(INSTALL_MAN3_MACRO)
diff --git a/include/Makefile b/include/Makefile
deleted file mode 100644
index aba3f71..0000000
--- a/include/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Enhanced Seccomp Library Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include ../macros.mk
-
-#
-# configuration
-#
-
-include $(TOPDIR)/version_info.mk
-include $(TOPDIR)/configure.mk
-include $(TOPDIR)/install.mk
-
-HDR_BUILD = seccomp.h
-
-#
-# targets
-#
-
-.PHONY: all install clean
-
-all: $(HDR_BUILD)
-
-install: $(HDR_BUILD)
-       $(INSTALL_INC_MACRO)
-
-seccomp.h: seccomp.h.in
-       @$(ECHO) " GEN $@"
-       $(CAT) $< | \
-       $(SED) -e 's/%%VERSION_MAJOR%%/$(VERSION_MAJOR)/g' | \
-       $(SED) -e 's/%%VERSION_MINOR%%/$(VERSION_MINOR)/g' | \
-       $(SED) -e 's/%%VERSION_MICRO%%/$(VERSION_MICRO)/g' > $@
-
-clean:
-       @$(RM) $(HDR_BUILD)
diff --git a/include/seccomp.h.in b/include/seccomp.h.in
index 8fcfc2c..07336e6 100644
--- a/include/seccomp.h.in
+++ b/include/seccomp.h.in
@@ -35,9 +35,9 @@ extern "C" {
  * version information
  */
 
-#define SCMP_VER_MAJOR         %%VERSION_MAJOR%%
-#define SCMP_VER_MINOR         %%VERSION_MINOR%%
-#define SCMP_VER_MICRO         %%VERSION_MICRO%%
+#define SCMP_VER_MAJOR         @VERSION_MAJOR@
+#define SCMP_VER_MINOR         @VERSION_MINOR@
+#define SCMP_VER_MICRO         @VERSION_MICRO@
 
 /*
  * types
diff --git a/install.mk b/install.mk
deleted file mode 100644
index 123af33..0000000
--- a/install.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Enhanced Seccomp Library Installation Defaults
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-INSTALL_PREFIX ?= $(CONF_INSTALL_PREFIX)
-
-INSTALL_SBIN_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/sbin
-INSTALL_BIN_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/bin
-INSTALL_LIB_DIR ?= $(DESTDIR)/$(CONF_INSTALL_LIBDIR)
-INSTALL_INC_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/include
-INSTALL_MAN_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/share/man
-
-INSTALL_OWNER ?= $$(id -u)
-INSTALL_GROUP ?= $$(id -g)
diff --git a/libseccomp.pc.in b/libseccomp.pc.in
index c195831..a863351 100644
--- a/libseccomp.pc.in
+++ b/libseccomp.pc.in
@@ -19,13 +19,14 @@
 # along with this library; if not, see <http://www.gnu.org/licenses>.
 #
 
-prefix=%%INSTALL_PREFIX%%
-libdir=%%INSTALL_LIBDIR%%
-includedir=${prefix}/include
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
 
 Name: libseccomp
 Description: The enhanced seccomp library
 URL: http://libseccomp.sf.net
-Version: %%VERSION_RELEASE%%
+Version: @PACKAGE_VERSION@
 Cflags: -I${includedir}
 Libs: -L${libdir} -lseccomp
diff --git a/macros.mk b/macros.mk
deleted file mode 100644
index 763c4df..0000000
--- a/macros.mk
+++ /dev/null
@@ -1,235 +0,0 @@
-#
-# Enhanced Seccomp Library Build Macros
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-SHELL = /bin/bash
-
-#
-# simple /bin/bash script to find the top of the tree
-#
-
-TOPDIR := $(shell \
-       ftd() { \
-               cd $$1; \
-               if [[ -r "macros.mk" ]]; then \
-                       pwd; \
-               else \
-                       ftd "../"; \
-                fi \
-       }; \
-       ftd .)
-
-#
-# build configuration
-#
-
-V ?= 0
-
-CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/include
-LIBFLAGS +=
-
-CFLAGS ?= -Wl,-z,relro -Wall -O0 -g -fvisibility=hidden
-CFLAGS += -fPIC
-PYCFLAGS ?= -fvisibility=default
-LDFLAGS ?= -z relro -g
-
-#
-# build tools
-#
-
-LN ?= ln
-MV ?= mv
-CAT ?= cat
-ECHO ?= echo
-TAR ?= tar
-MKDIR ?= mkdir
-
-SED ?= sed
-AWK ?= awk
-
-PYTHON ?= /usr/bin/env python
-
-# we require gcc specific functionality
-GCC ?= gcc
-OBJDUMP ?= objdump
-
-INSTALL ?= install
-
-ifeq ($(V),0)
-       MAKE += --quiet --no-print-directory
-       ECHO_INFO ?= $(ECHO) ">> INFO:"
-else
-       ECHO_INFO ?= /bin/true || $(ECHO) ">> INFO:"
-endif
-
-#
-# auto dependencies
-#
-
-MAKEDEP = @$(GCC) $(CPPFLAGS) -MM -MF $(patsubst %.o,%.d,$@) $<;
-MAKEDEP_EXEC = \
-       @$(GCC) $(CPPFLAGS) -MM -MT $(patsubst %.d,%,$@) \
-               -MF $@ $(patsubst %.d,%.c,$@);
-
-ADDDEP = \
-       @adddep_func() { \
-               $(MV) $$1 $$1.dtmp; \
-               $(CAT) $$1.dtmp | $(SED) -e 's/\([^\]\)$$/\1 \\/' | \
-                       ( $(CAT) - && $(ECHO) " $$2" ) > $$1; \
-               $(RM) -f [email protected]; \
-       }; \
-       adddep_func
-
-#
-# build constants
-#
-
-VERSION_HDR = version.h
-
-#
-# build macros
-#
-
-PY_DISTUTILS = \
-       VERSION_RELEASE="$(VERSION_RELEASE)" \
-       CFLAGS="$(CFLAGS) $(CPPFLAGS) $(PYCFLAGS)" LDFLAGS="$(LDFLAGS)" \
-       $(PYTHON) ./setup.py
-
-ifeq ($(V),0)
-       PY_BUILD = @echo " PYTHON build";
-endif
-PY_BUILD += $(PY_DISTUTILS)
-ifeq ($(V),0)
-       PY_BUILD += -q
-endif
-PY_BUILD += build
-
-ifeq ($(V),0)
-       PY_INSTALL = @echo " PYTHON install";
-endif
-PY_INSTALL += $(PY_DISTUTILS)
-ifeq ($(V),0)
-       PY_INSTALL += -q
-endif
-PY_INSTALL += install
-
-ifeq ($(V),0)
-       COMPILE = @echo " CC $@";
-endif
-COMPILE += $(GCC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<;
-
-ifeq ($(V),0)
-       COMPILE_EXEC = @echo " CC $@";
-endif
-COMPILE_EXEC += $(GCC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(LIBFLAGS);
-
-ifeq ($(V),0)
-       ARCHIVE = @echo " AR $@";
-endif
-ARCHIVE += $(AR) -cru $@ $?;
-
-ifeq ($(V),0)
-       LINK_EXEC = @echo " LD $@";
-endif
-LINK_EXEC += $(GCC) $(LDFLAGS) -o $@ $^ $(LIBFLAGS);
-
-ifeq ($(V),0)
-       LINK_LIB = @echo " LD $@" \
-              "($(patsubst %.so.$(VERSION_RELEASE),%.so.$(VERSION_MAJOR),$@))";
-endif
-LINK_LIB += $(GCC) $(LDFLAGS) -o $@ $^ -shared \
-       -Wl,-soname=$(patsubst %.so.$(VERSION_RELEASE),%.so.$(VERSION_MAJOR),$@)
-
-#
-# install macros
-#
-
-ifeq ($(V),0)
-       INSTALL_LIB_MACRO = @echo " INSTALL $^ ($(INSTALL_LIB_DIR)/$^)";
-endif
-INSTALL_LIB_MACRO += \
-               basename=$$(echo $^ | sed -e 's/.so.*$$/.so/'); \
-               soname=$$($(OBJDUMP) -p $^ | grep "SONAME" | awk '{print 
$$2}'); \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
-                       -d "$(INSTALL_LIB_DIR)"; \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0755 \
-                       $^ "$(INSTALL_LIB_DIR)"; \
-               (cd "$(INSTALL_LIB_DIR)"; $(RM) $$soname); \
-               (cd "$(INSTALL_LIB_DIR)"; $(LN) -s $^ $$soname); \
-               (cd "$(INSTALL_LIB_DIR)"; $(RM) $$basname); \
-               (cd "$(INSTALL_LIB_DIR)"; $(LN) -s $^ $$basename);
-
-ifeq ($(V),0)
-       INSTALL_BIN_MACRO = @echo " INSTALL $^ ($(INSTALL_BIN_DIR)/$^)";
-endif
-INSTALL_BIN_MACRO += \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
-                       -d "$(INSTALL_BIN_DIR)"; \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0755 \
-                       $^ "$(INSTALL_BIN_DIR)";
-
-ifeq ($(V),0)
-       INSTALL_PC_MACRO = \
-           @echo " INSTALL $$(cat /proc/$$$$/cmdline | awk '{print $$(NF)}')" \
-                 " ($(INSTALL_LIB_DIR)/pkgconfig)";
-endif
-INSTALL_PC_MACRO += \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
-                       -d "$(INSTALL_LIB_DIR)/pkgconfig"; \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0644 \
-                       "$$(cat /proc/$$$$/cmdline | awk '{print $$(NF)}')" \
-                       "$(INSTALL_LIB_DIR)/pkgconfig"; \#
-
-ifeq ($(V),0)
-       INSTALL_INC_MACRO = @echo " INSTALL $^ ($(INSTALL_INC_DIR))";
-endif
-INSTALL_INC_MACRO += \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
-                       -d "$(INSTALL_INC_DIR)"; \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0644 \
-                       $^ "$(INSTALL_INC_DIR)";
-
-ifeq ($(V),0)
-       INSTALL_MAN1_MACRO = \
-               @echo " INSTALL manpages ($(INSTALL_MAN_DIR)/man1)";
-endif
-INSTALL_MAN1_MACRO += \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
-                       -d "$(INSTALL_MAN_DIR)/man1"; \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0644 \
-                       $^ "$(INSTALL_MAN_DIR)/man1";
-
-ifeq ($(V),0)
-       INSTALL_MAN3_MACRO = \
-               @echo " INSTALL manpages ($(INSTALL_MAN_DIR)/man3)";
-endif
-INSTALL_MAN3_MACRO += \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
-                       -d "$(INSTALL_MAN_DIR)/man3"; \
-               $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0644 \
-                       $^ "$(INSTALL_MAN_DIR)/man3";
-
-#
-# default build targets
-#
-
-%.o: %.c
-       $(MAKEDEP)
-       $(COMPILE)
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 98755dd..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-libseccomp.so.*
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index fc0fba0..0000000
--- a/src/Makefile
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# Enhanced Seccomp Library Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include ../macros.mk
-
-#
-# configuration
-#
-
-include $(TOPDIR)/version_info.mk
-include $(TOPDIR)/configure.mk
-include $(TOPDIR)/install.mk
-
-LIB_STATIC = libseccomp.a
-LIB_SHARED = libseccomp.so.$(VERSION_RELEASE)
-
-OBJS = \
-       api.o db.o arch.o \
-       arch-x86.o arch-x86-syscalls.o \
-       arch-x86_64.o arch-x86_64-syscalls.o \
-       arch-x32.o arch-x32-syscalls.o \
-       arch-arm.o arch-arm-syscalls.o \
-       arch-mips.o arch-mips-syscalls.o \
-       hash.o \
-       gen_pfc.o gen_bpf.o
-
-DEPS = $(OBJS:%.o=%.d)
-
-#
-# bindings configuration
-#
-
-BINDINGS =
-
-ifeq ($(CONF_BINDINGS_PYTHON), 1)
-       BINDINGS += python
-endif
-
-#
-# targets
-#
-
-.PHONY: all install clean python
-
-all: $(LIB_STATIC) $(LIB_SHARED) $(BINDINGS)
-
--include $(DEPS)
-
-$(LIB_STATIC): $(OBJS)
-       $(ARCHIVE)
-
-$(LIB_SHARED): $(OBJS)
-       $(LINK_LIB)
-
-python: $(LIB_STATIC)
-       @$(ECHO_INFO) "building in directory $@/ ..."
-       @$(MAKE) -C $@
-
-install: $(LIB_SHARED)
-       $(INSTALL_LIB_MACRO)
-       @for dir in $(BINDINGS); do \
-               $(ECHO) ">> INFO: installing from $$dir/"; \
-               $(MAKE) -C $$dir install; \
-       done
-
-clean:
-       $(RM) $(DEPS) $(OBJS) $(LIB_STATIC) libseccomp.so.*
-       @for dir in python; do \
-               $(MAKE) -C $$dir clean; \
-       done
-
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..61e421b
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,17 @@
+# -*- Makefile -*-
+
+SUBDIRS = .
+if ENABLE_PYTHON
+SUBDIRS += python
+endif
+
+lib_LTLIBRARIES = libseccomp.la
+
+libseccomp_la_SOURCES = api.c arch.c arch-x86.c arch-x86-syscalls.c \
+       arch-x86_64.c arch-x86_64-syscalls.c arch-x32.c arch-x32-syscalls.c \
+       arch-arm.c arch-arm-syscalls.c arch-mips.c arch-mips-syscalls.c \
+       db.c hash.c gen_pfc.c gen_bpf.c \
+       \
+       arch-mips.h arch-arm.h arch-x32.h arch-x86.h arch-x86_64.h arch.h \
+       db.h gen_bpf.h gen_pfc.h hash.h system.h
+libseccomp_la_LDFLAGS = -version-number 2:1:0
diff --git a/src/python/Makefile b/src/python/Makefile
deleted file mode 100644
index 3543a65..0000000
--- a/src/python/Makefile
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Enhanced Seccomp Library Python Bindings Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include ../../macros.mk
-
-#
-# configuration
-#
-
-include $(TOPDIR)/version_info.mk
-include $(TOPDIR)/configure.mk
-include $(TOPDIR)/install.mk
-
-LIB_STATIC = ../libseccomp.a
-
-#
-# targets
-#
-
-.PHONY: all install clean
-
-all: build
-
-build: $(LIB_STATIC) libseccomp.pxd seccomp.pyx
-       @$(RM) seccomp.c
-       $(PY_BUILD) && touch build
-
-install: build
-       $(PY_INSTALL) install --prefix=$(DESTDIR)/$(INSTALL_PREFIX)
-
-clean:
-       $(RM) -rf build seccomp.c
diff --git a/src/python/Makefile.am b/src/python/Makefile.am
new file mode 100644
index 0000000..400b354
--- /dev/null
+++ b/src/python/Makefile.am
@@ -0,0 +1,24 @@
+# -*- Makefile -*-
+
+PYTHON = /usr/bin/env python
+pyverbose_0 = -q
+pyverbose_ = ${pyverbose_0}
+
+PY_DISTUTILS = \
+       VERSION_RELEASE="${VERSION_RELEASE}" \
+       CFLAGS="-I\${top_srcdir}/include ${CFLAGS} ${CPPFLAGS}" \
+       LDFLAGS="${LDFLAGS}" \
+       ${PYTHON} ./setup.py
+PY_BUILD = ${PY_DISTUTILS} build ${pyverbose_${V}}
+PY_INSTALL = ${PY_DISTUTILS} install ${pyverbose_${V}}
+
+all-local: python-build
+
+python-build: ../libseccomp.la libseccomp.pxd seccomp.pyx
+       ${AM_V_GEN}${PY_DISTUTILS} build && touch $@
+
+install-exec-local:
+       ${PY_DISTUTILS} install --prefix=${DESTDIR}/${prefix}
+
+clean-local:
+       rm -Rf python-build seccomp.c
diff --git a/src/python/setup.py b/src/python/setup.py
index 872642e..62ba24a 100644
--- a/src/python/setup.py
+++ b/src/python/setup.py
@@ -40,6 +40,6 @@ setup(
        cmdclass = {'build_ext': build_ext},
        ext_modules = [
                Extension("seccomp", ["seccomp.pyx"],
-                       extra_objects=["../libseccomp.a"])
+                       extra_objects=["../.libs/libseccomp.so"])
                ]
 )
diff --git a/src/system.h b/src/system.h
index cb14f65..11303cf 100644
--- a/src/system.h
+++ b/src/system.h
@@ -25,9 +25,9 @@
 #include <linux/filter.h>
 #include <linux/prctl.h>
 
-#include <configure.h>
+#include "configure.h"
 
-#ifdef CONF_SYSINC_SECCOMP
+#ifdef HAVE_LINUX_SECCOMP_H
 
 /* system header file */
 #include <linux/seccomp.h>
diff --git a/tests/Makefile b/tests/Makefile
deleted file mode 100644
index 16ce726..0000000
--- a/tests/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Enhanced Seccomp Library Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include ../macros.mk
-
-#
-# configuration
-#
-
-include $(TOPDIR)/version_info.mk
-include $(TOPDIR)/configure.mk
-
-OBJS = util.o
-
-LIBFLAGS := ../src/libseccomp.a $(OBJS)
-
-TEST_PRIVATE = 00-test
-
-TESTS = 01-sim-allow \
-       02-sim-basic \
-       03-sim-basic_chains \
-       04-sim-multilevel_chains \
-       05-sim-long_jumps \
-       06-sim-actions \
-       07-sim-db_bug_looping \
-       08-sim-subtree_checks \
-       09-sim-syscall_priority_pre \
-       10-sim-syscall_priority_post \
-       11-basic-basic_errors \
-       12-sim-basic_masked_ops \
-       13-basic-attrs \
-       14-sim-reset \
-       15-basic-resolver \
-       16-sim-arch_basic \
-       17-sim-arch_merge \
-       18-sim-basic_whitelist \
-       19-sim-missing_syscalls \
-       20-live-basic_die \
-       21-live-basic_allow \
-       22-sim-basic_chains_array \
-       23-sim-arch_all_le_basic \
-       24-live-arg_allow \
-       25-sim-multilevel_chains_adv \
-       26-sim-arch_all_be_basic
-
-DEPS_OBJS = $(OBJS:%.o=%.d)
-DEPS_TESTS = $(TESTS:%=%.d)
-
-#
-# targets
-#
-
-.PHONY: check clean
-
-all: $(TESTS) $(OBJS)
-
--include $(DEPS_TESTS) $(DEPS_OBJS)
-
-$(DEPS_TESTS):
-       $(MAKEDEP_EXEC)
-       $(ADDDEP) $@ ../src/libseccomp.a
-       $(ADDDEP) $@ $(OBJS)
-
-$(TESTS):
-       $(COMPILE_EXEC)
-
-$(TEST_PRIVATE): 00-test.c $(OBJS) ../src/libseccomp.a
-       $(COMPILE_EXEC)
-
-check: $(TESTS)
-       ./regression
-
-clean:
-       $(RM) $(DEPS_TESTS) $(DEPS_OBJS) $(TESTS) $(TEST_PRIVATE) $(OBJS) *.pyc
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..d0c6a44
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,45 @@
+# -*- Makefile -*-
+
+AM_LDFLAGS = -static
+LDADD = util.la ../src/libseccomp.la
+
+check_LTLIBRARIES = util.la
+util_la_SOURCES = util.c util.h
+util_la_LDFLAGS = -module
+
+TESTS = regression
+
+EXTRA_DIST = regression *.tests
+BUILT_SOURCES = 00-test.c
+
+check_PROGRAMS = \
+       00-test \
+       01-sim-allow \
+       02-sim-basic \
+       03-sim-basic_chains \
+       04-sim-multilevel_chains \
+       05-sim-long_jumps \
+       06-sim-actions \
+       07-sim-db_bug_looping \
+       08-sim-subtree_checks \
+       09-sim-syscall_priority_pre \
+       10-sim-syscall_priority_post \
+       11-basic-basic_errors \
+       12-sim-basic_masked_ops \
+       13-basic-attrs \
+       14-sim-reset \
+       15-basic-resolver \
+       16-sim-arch_basic \
+       17-sim-arch_merge \
+       18-sim-basic_whitelist \
+       19-sim-missing_syscalls \
+       20-live-basic_die \
+       21-live-basic_allow \
+       22-sim-basic_chains_array \
+       23-sim-arch_all_le_basic \
+       24-live-arg_allow \
+       25-sim-multilevel_chains_adv \
+       26-sim-arch_all_be_basic
+
+00-test.c:
+       if ! test -e $@; then echo "int main(void) { return 0; }" >$@; fi
diff --git a/tools/Makefile b/tools/Makefile
deleted file mode 100644
index 6e3101f..0000000
--- a/tools/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# Enhanced Seccomp Library Makefile
-#
-# Copyright (c) 2012 Red Hat <[email protected]>
-# Author: Paul Moore <[email protected]>
-#
-
-#
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License as
-# published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, see <http://www.gnu.org/licenses>.
-#
-
-#
-# macros
-#
-
-include ../macros.mk
-
-#
-# configuration
-#
-
-include $(TOPDIR)/configure.mk
-include $(TOPDIR)/install.mk
-
-OBJS = util.o
-
-LIBFLAGS := ../src/libseccomp.a $(OBJS)
-
-TOOLS = scmp_bpf_disasm \
-       scmp_bpf_sim \
-       scmp_sys_resolver \
-       scmp_arch_detect
-
-TOOLS_INSTALL = scmp_sys_resolver
-
-DEPS_OBJS = $(OBJS:%.o=%.d)
-DEPS_TOOLS = $(TOOLS:%=%.d)
-
-#
-# targets
-#
-
-.PHONY: install clean
-
-all: $(TOOLS) $(OBJS)
-
--include $(DEPS_TOOLS) $(DEPS_OBJS)
-
-$(DEPS_TOOLS):
-       $(MAKEDEP_EXEC)
-       $(ADDDEP) $@ $(OBJS)
-
-$(TOOLS):
-       $(COMPILE_EXEC)
-
-install: $(TOOLS_INSTALL)
-       $(INSTALL_BIN_MACRO)
-
-clean:
-       $(RM) $(DEPS_TOOLS) $(DEPS_OBJS) $(TOOLS) $(OBJS)
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644
index 0000000..28087e9
--- /dev/null
+++ b/tools/Makefile.am
@@ -0,0 +1,16 @@
+# -*- Makefile -*-
+
+noinst_LTLIBRARIES = util.la
+
+util_la_SOURCES = util.c util.h
+util_la_LDFLAGS = -module
+
+bin_PROGRAMS    = scmp_sys_resolver
+noinst_PROGRAMS = scmp_arch_detect scmp_bpf_disasm scmp_bpf_sim
+
+scmp_sys_resolver_LDADD   = ../src/libseccomp.la
+scmp_arch_detect_LDADD    = ../src/libseccomp.la
+scmp_bpf_disasm_LDADD = util.la
+scmp_bpf_sim_LDADD = util.la
+
+EXTRA_DIST = bpf.h
diff --git a/version_info b/version_info
deleted file mode 100644
index 7520e4f..0000000
--- a/version_info
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# version_info - version information for seccomp library
-#
-
-# version components
-VERSION_MAJOR=0
-VERSION_MINOR=0
-VERSION_MICRO=0


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
libseccomp-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss

Reply via email to