[Devel] [PATCH 2/6] test for vz-kernel support in the target architecture

Glauber Costa glommer at parallels.com
Wed Dec 5 06:24:45 PST 2012


On 12/05/2012 04:57 PM, Kir Kolyshkin wrote:
> On 11/26/2012 06:35 PM, Glauber Costa wrote:
>> 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 <glommer at parallels.com>
>> ---
>>   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)]
>> +)
>> +
> 
> This is dirty in multiple ways.
> 1. AC_CHECK_HEADERS should be used for _system_ headers, so it tries
> compiling
> a program with #include <vzsyscalls.h>, while we need it to have
> #include "vzsyscalls.h".
> 
> 2. You worked around that by adding -Iinclude setting to CFLAGS and
> CPPFLAGS, which
> itself is dirty in multiple ways.
> 
> 3. The output that this part of configure produces is very cryptic -- it
> shows us whether
> vzsyscalls.h is present and usable or not, instead of saying whether
> this architecture
> can possibly be supported by OpenVZ.
> 
> I suggest using AC_COMPILE_IFELSE or even AC_PREPROC_IFELSE to make this
> cleaner.
> 
> 2.
> 
>>   # 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,
> 
> 
All reasonable.

Please consider the following patch instead. Let me know if you would
like any of the others in the series to be changed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-test-for-vz-kernel-support-in-the-target-architectur.patch
Type: text/x-patch
Size: 2852 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20121205/e66e941e/attachment-0001.bin>


More information about the Devel mailing list