[Libguestfs] [libnbd PATCH 3/5] libev: Check for old compiler

Eric Blake eblake at redhat.com
Fri May 7 13:41:44 UTC 2021


On 5/7/21 8:23 AM, Martin Kletzander wrote:

>>> +    AC_MSG_CHECKING([if the compiler is new enough for good aliasing
>>> rules])
>>> +    AC_COMPILE_IFELSE([
>>> +        AC_LANG_PROGRAM([
>>> +            #include <ev.h>
>>> +
>>> +            static void cb (struct ev_loop *l, ev_timer *t, int e) { }
>>> +            static ev_timer timer;
>>> +        ], [
>>> +            ev_timer_init (&timer, cb, 0, .1);
>>> +        ])
>>> +    ], [
>>> +        AC_MSG_RESULT([yes])
>>> +    ], [
>>> +        AC_MSG_RESULT([no])
>>> +        AC_SUBST([LIBEV_CFLAGS], [""])
>>> +        AC_SUBST([LIBEV_LIBS], [""])
>>> +        AC_MSG_WARN([compiler is probably too old to compile with
>>> libev without errors, some examples will not be compiled])
>>
>> Do we really need to skip compiling the example altogether, or can we
>> just modify CFLAGS to add -Wno-strict-aliasing to prevent the failure?
>>
> 
> This is one of the results that I was not sure about.  We could just add
> no-strict-aliasing for that one particular example of course.  I figured
> it is just an example and it only causes an issue on CentOS 7, OpenSUSE
> Leap 15.2, Ubuntu 18.04 and some similarly old systems if I remember
> correctly.  But changing the LIBEV_CFLAGS seems more fit for the purpose.

Sounds even better!

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list