[libvirt PATCH 028/351] meson: add types check

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:54:24 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 configure.ac | 15 ---------------
 meson.build  | 27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1ffa4f931ee..69067091f09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,8 +51,6 @@ AC_PROG_CPP
 dnl get 64-int interfaces on 32-bit platforms
 AC_SYS_LARGEFILE
 
-AC_TYPE_UID_T
-
 dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
 AC_LIBTOOL_WIN32_DLL
 
@@ -207,19 +205,6 @@ LIBVIRT_CHECK_YAJL
 
 AC_CHECK_SIZEOF([long])
 
-AC_CHECK_TYPE([struct ifreq],
-  [AC_DEFINE([HAVE_STRUCT_IFREQ],[1],
-    [Defined if struct ifreq exists in net/if.h])],
-  [], [[#include <sys/socket.h>
-        #include <net/if.h>
-  ]])
-
-AC_CHECK_TYPE([struct sockpeercred],
-  [AC_DEFINE([HAVE_STRUCT_SOCKPEERCRED], [1],
-    [Defined if struct sockpeercred is available])],
-  [], [[#include <sys/socket.h>
-  ]])
-
 
 AC_CHECK_LIB([intl],[gettext],[])
 AC_CHECK_LIB([util],[openpty],[])
diff --git a/meson.build b/meson.build
index c79d557b289..aa492c9549a 100644
--- a/meson.build
+++ b/meson.build
@@ -808,6 +808,33 @@ if (cc.has_header_symbol('mach/clock.h', 'clock_serv_t') and
 endif
 
 
+# check various types
+
+types = [
+  [ 'struct ifreq', '#include <sys/socket.h>\n#include <net/if.h>'] ,
+  [ 'struct sockpeercred', '#include <sys/socket.h' ],
+]
+
+foreach type : types
+  if cc.has_type(type[0], prefix: type[1])
+    name = type[0].underscorify().to_upper()
+    conf.set('HAVE_ at 0@'.format(name), 1)
+  endif
+endforeach
+
+if host_machine.system() == 'windows'
+  uid_types = [
+    'uid_t',
+    'gid_t',
+  ]
+  foreach type : uid_types
+    if not cc.has_type(type, prefix: '#include <sys/types.h>')
+      conf.set(type, 'int')
+    endif
+  endforeach
+endif
+
+
 # define top include directory
 
 top_inc_dir = include_directories('.')
-- 
2.26.2




More information about the libvir-list mailing list