File configure-find-seccomp-using-pkg-config.patch of Package lxc.openSUSE_13.1_Update

From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 24 Apr 2013 10:46:21 +0200
Subject: configure: find seccomp using pkg-config
Patch-mainline: no

On suse we have the header in a subdir inside /usr/include, so
pkgconfig has t obe used to find out proper CFLAGS.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 configure.ac        | 12 +++++++++---
 src/lxc/Makefile.am |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef6122e..630027a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,12 +113,18 @@ fi
 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
 
 AM_COND_IF([ENABLE_SECCOMP],
-	[AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
-	AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
-	AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
+	[PKG_CHECK_MODULES([SECCOMP],[libseccomp],[],[
+		AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
+		AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
+		AC_SUBST([SECCOMP_LIBS], [-lseccomp])
+		])
+	])
 
 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $SECCOMP_CFLAGS"
 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
+CFLAGS="$OLD_CFLAGS"
 
 # Configuration examples
 AC_ARG_ENABLE([examples],
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index ebeca466..5798c93 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -104,7 +104,7 @@ AM_CFLAGS += -DUSE_CONFIGPATH_LOGS
 endif
 
 if ENABLE_SECCOMP
-AM_CFLAGS += -DHAVE_SECCOMP
+AM_CFLAGS += -DHAVE_SECCOMP $(SECCOMP_CFLAGS)
 liblxc_so_SOURCES += seccomp.c
 endif
 
-- 
1.8.2.1

openSUSE Build Service is sponsored by