# check for kernel headers required by src/util/virnetdevbridge.c
if host_machine.system() == 'linux'
- # Various kernel versions have headers that are not self-standing, but
- # yet are incompatible with the corresponding glibc headers. In order
- # to guarantee compilation across a wide range of versions (from RHEL 5
- # to rawhide), we first have to probe whether glibc and kernel can be
- # used in tandem; and if not, provide workarounds that ensure that
- # ABI-compatible IPv6 types are present for use by the kernel headers.
- netinet_workaround_code = '''
- #include <netinet/in.h>
- #include <linux/in6.h>
-
- int main(void) { return 0; }
- '''
- if not cc.compiles(netinet_workaround_code)
- conf.set('NETINET_LINUX_WORKAROUND', 1)
- endif
-
required_headers = [
'linux/param.h',
'linux/sockios.h',
# endif
# include <linux/sockios.h>
# include <linux/param.h> /* HZ */
-# if NETINET_LINUX_WORKAROUND
-/* Depending on the version of kernel vs. glibc, there may be a collision
- * between <net/in.h> and kernel IPv6 structures. The different types
- * are ABI compatible, but choke the C type system; work around it by
- * using temporary redefinitions. */
-# define in6_addr in6_addr_
-# define sockaddr_in6 sockaddr_in6_
-# define ipv6_mreq ipv6_mreq_
-# define in6addr_any in6addr_any_
-# define in6addr_loopback in6addr_loopback_
-# endif
# include <linux/in6.h>
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
-# if NETINET_LINUX_WORKAROUND
-# undef in6_addr
-# undef sockaddr_in6
-# undef ipv6_mreq
-# undef in6addr_any
-# undef in6addr_loopback
-# endif
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)