[libvirt PATCH 027/351] meson: add symbols check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac | 87 ----------------------------------------------------
 meson.build  | 72 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 87 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4a40f3fc34e..1ffa4f931ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,9 +207,6 @@ LIBVIRT_CHECK_YAJL
 
 AC_CHECK_SIZEOF([long])
 
-dnl Check whether endian provides handy macros.
-AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
-
 AC_CHECK_TYPE([struct ifreq],
   [AC_DEFINE([HAVE_STRUCT_IFREQ],[1],
     [Defined if struct ifreq exists in net/if.h])],
@@ -223,16 +220,6 @@ AC_CHECK_TYPE([struct sockpeercred],
   [], [[#include <sys/socket.h>
   ]])
 
-AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO,
-                ETHTOOL_GGSO, ETHTOOL_GGRO, ETHTOOL_GFLAGS, ETHTOOL_GFEATURES,
-                ETHTOOL_SCOALESCE, ETHTOOL_GCOALESCE],
-  [], [], [[#include <linux/ethtool.h>
-  ]])
-
-AC_CHECK_DECLS([SEEK_HOLE], [], [],
-               [#include <sys/types.h>
-                #include <unistd.h>])
-
 
 AC_CHECK_LIB([intl],[gettext],[])
 AC_CHECK_LIB([util],[openpty],[])
@@ -407,27 +394,6 @@ if test $with_storage = yes; then
 fi
 AM_CONDITIONAL([WITH_STORAGE], [test "$with_storage" = "yes"])
 
-dnl
-dnl check for DEVLINK_CMD_ESWITCH_GET
-dnl
-dnl Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is also
-dnl available, as it was introudced in kernel 4.8
-dnl along with the original spelling of this constant
-dnl (DEVLINK_CMD_ESWITCH_MODE_GET, not supported by libvirt)
-dnl
-if test "$with_linux" = "yes"; then
-    AC_CHECK_DECLS([DEVLINK_CMD_ESWITCH_GET], [], [],
-                   [[#include <linux/devlink.h>]])
-fi
-
-dnl
-dnl check for VHOST_VSOCK_SET_GUEST_CID
-dnl
-if test "$with_linux" = "yes"; then
-    AC_CHECK_DECLS([VHOST_VSOCK_SET_GUEST_CID], [], [],
-                   [[#include <linux/vhost.h>]])
-fi
-
 dnl Allow perl/python overrides
 AC_PATH_PROGS([PYTHON], [python3])
 if test -z "$PYTHON"; then
@@ -478,9 +444,6 @@ then
 fi
 AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
 
-dnl GET_VLAN_VID_CMD is required for virNetDevGetVLanID
-AC_CHECK_DECLS([GET_VLAN_VID_CMD], [], [], [[#include <linux/if_vlan.h>]])
-
 # Check for Linux vs. BSD ifreq members
 AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
                   struct ifreq.ifr_ifindex,
@@ -491,41 +454,6 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
                   #include <net/if.h>
                  ])
 
-# Check for BSD approach for setting MAC addr
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-     [[
-        #include <sys/types.h>
-        #include <sys/socket.h>
-        #include <net/if_dl.h>
-     ]],
-     [[
-        link_addr(0, 0)]])],
-     [AC_DEFINE([HAVE_DECL_LINK_ADDR],
-                [1],
-                [whether link_addr is available])])
-
-# Check for BSD approach for bridge management
-AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
-               [AC_DEFINE([HAVE_BSD_BRIDGE_MGMT],
-                          [1],
-                          [whether BSD style bridge management is available])],
-               [],
-               [#include <stdint.h>
-                #include <net/if.h>
-                #include <net/ethernet.h>
-                #include <net/if_bridgevar.h>
-               ])
-
-# Check for BSD CPU affinity availability
-AC_CHECK_DECLS([cpuset_getaffinity],
-               [AC_DEFINE([HAVE_BSD_CPU_AFFINITY],
-                          [1],
-                          [whether BSD CPU affinity management is available])],
-               [],
-               [#include <sys/param.h>
-                #include <sys/cpuset.h>
-               ])
-
 # Check for BSD kvm (kernel memory interface)
 if test $with_freebsd = yes; then
      AC_CHECK_LIB([kvm], [kvm_getprocs], [],
@@ -533,21 +461,6 @@ if test $with_freebsd = yes; then
                  )
 fi
 
-AC_CHECK_DECLS([clock_serv_t, host_get_clock_service, clock_get_time],
-               [AC_DEFINE([HAVE_MACH_CLOCK_ROUTINES],
-                          [1],
-                          [whether Mach clock routines are available])],
-               [],
-               [#include <mach/clock.h>
-                #include <mach/mach.h>
-               ])
-
-# Check if we have new enough kernel to support BPF devices for cgroups v2
-if test "$with_linux" = "yes"; then
-    AC_CHECK_DECLS([BPF_PROG_QUERY, BPF_CGROUP_DEVICE],
-                   [], [], [#include <linux/bpf.h>])
-fi
-
 # Check if we need to look for ifconfig
 if test "$want_ifconfig" = "yes"; then
      AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
diff --git a/meson.build b/meson.build
index 62e51230888..c79d557b289 100644
--- a/meson.build
+++ b/meson.build
@@ -736,6 +736,78 @@ if host_machine.system() == 'linux'
 endif
 
 
+# check various symbols
+
+symbols = [
+  # Check whether endian provides handy macros.
+  [ 'endian.h', 'htole64' ],
+
+  [ 'linux/ethtool.h', 'ETH_FLAG_TXVLAN' ],
+  [ 'linux/ethtool.h', 'ETH_FLAG_NTUPLE' ],
+  [ 'linux/ethtool.h', 'ETH_FLAG_RXHASH' ],
+  [ 'linux/ethtool.h', 'ETH_FLAG_LRO' ],
+  [ 'linux/ethtool.h', 'ETHTOOL_GGSO' ],
+  [ 'linux/ethtool.h', 'ETHTOOL_GGRO' ],
+  [ 'linux/ethtool.h', 'ETHTOOL_GFLAGS' ],
+  [ 'linux/ethtool.h', 'ETHTOOL_GFEATURES' ],
+  [ 'linux/ethtool.h', 'ETHTOOL_SCOALESCE' ],
+  [ 'linux/ethtool.h', 'ETHTOOL_GCOALESCE' ],
+
+  # GET_VLAN_VID_CMD is required for virNetDevGetVLanID
+  [ 'linux/if_vlan.h', 'GET_VLAN_VID_CMD' ],
+
+  [ 'unistd.h', 'SEEK_HOLE' ],
+
+  # GET_VLAN_VID_CMD is required for virNetDevGetVLanID
+  [ 'linux/if_vlan.h', 'GET_VLAN_VID_CMD' ],
+
+  # Check for BSD approach for setting MAC addr
+  [ 'net/if_dl.h', 'link_addr' ],
+]
+
+if host_machine.system() == 'linux'
+  symbols += [
+    # check for DEVLINK_CMD_ESWITCH_GET
+    # Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is also available, as it was
+    # introudced in kernel 4.8 along with the original spelling of this
+    # constant (DEVLINK_CMD_ESWITCH_MODE_GET, not supported by libvirt).
+    [ 'linux/devlink.h', 'DEVLINK_CMD_ESWITCH_GET' ],
+
+    # check for VHOST_VSOCK_SET_GUEST_CID
+    [ 'linux/vhost.h', 'VHOST_VSOCK_SET_GUEST_CID' ],
+
+    # Check if we have new enough kernel to support BPF devices for cgroups v2
+    [ 'linux/bpf.h', 'BPF_PROG_QUERY' ],
+    [ 'linux/bpf.h', 'BPF_CGROUP_DEVICE' ],
+  ]
+endif
+
+foreach symbol : symbols
+  if cc.has_header_symbol(symbol[0], symbol[1])
+    conf.set('HAVE_DECL_@0@'.format(symbol[1].to_upper()), 1)
+  endif
+endforeach
+
+# Check for BSD approach for bridge management
+if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD') and
+    cc.has_header_symbol('net/if_bridgevar.h', 'BRDGADD') and
+    cc.has_header_symbol('net/if_bridgevar.h', 'BRDGDEL'))
+  conf.set('HAVE_BSD_BRIDGE_MGMT', 1)
+endif
+
+# Check for BSD CPU affinity availability
+if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity')
+  conf.set('HAVE_BSD_CPU_AFFINITY', 1)
+endif
+
+# whether Mach clock routines are available
+if (cc.has_header_symbol('mach/clock.h', 'clock_serv_t') and
+    cc.has_header_symbol('mach/clock.h', 'host_get_clock_service') and
+    cc.has_header_symbol('mach/clock.h', 'clock_get_time'))
+  conf.set('HAVE_MACH_CLOCK_ROUTINES', 1)
+endif
+
+
 # define top include directory
 
 top_inc_dir = include_directories('.')
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux