The include file "vzsyscalls.h" have a comprehensive list of vz-syscalls
and which architectures support them. If that file is included in a not
supported architecture, it will trigger an #error, which is a very
reliable way to determine that vz-specific code should not be compiled
in at all.

Signed-off-by: Glauber Costa <[email protected]>
---
 configure.ac | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3c04300..59e7384 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,14 @@ CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-qual -Winline 
-Wextra"
 CFLAGS="${CFLAGS} -Wcast-align -Wno-unused-parameter"
 CFLAGS="${CFLAGS} -Wno-missing-field-initializers"
 CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
+# to test for the usability of some of our headers
+CFLAGS="${CFLAGS} -Iinclude/"
+
+# Those are the pre-processor flags. Failure to set it, can lead to messages
+# like "accepted by the compiler, rejected by the preprocessor", meaning the
+# compiler found the headers, but the pre-processor did not.
+CPPFLAGS="${CFLAGS}"
+
 
 # We need -m64 for ppc64 in order to get proper ioctls
 if test x$target_cpu = xppc64 -o x$target_cpu = xpowerpc64; then
@@ -188,6 +196,16 @@ AM_CONDITIONAL(HAVE_CGROUP, [test "x$with_cgroup" = 
"x+cgroup"])
 AC_SUBST(CGROUP_LIBS)
 AC_SUBST(CGROUP_CFLAGS)
 
+
+# vzsyscalls.h will encode the knowledge of which syscalls are supported in
+# which archs, and determine whether or not the VZ_KERNEL is usable. For now
+# we will only disable it if we can't really use it.
+AC_CHECK_HEADERS([vzsyscalls.h],
+       [AC_DEFINE(VZ_KERNEL_SUPPORTED)
+        AM_CONDITIONAL(HAVE_VZ_KERNEL, true)],
+       [AM_CONDITIONAL(HAVE_VZ_KERNEL, false)]
+)
+
 # A way to redefine /vz is ./configure vzdir=/some/dir
 AS_IF([test "x$vzdir" = "x"], vzdir=/vz)
 AC_ARG_VAR(vzdir, [Common prefix for a few OpenVZ-related directories,
-- 
1.7.11.7

_______________________________________________
Devel mailing list
[email protected]
http://lists.openvz.org/mailman/listinfo/devel

Reply via email to