]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add types check
authorPavel Hrdina <phrdina@redhat.com>
Tue, 30 Jun 2020 12:07:07 +0000 (14:07 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:26:59 +0000 (09:26 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
configure.ac
meson.build

index 3b8a7e58038d0db62c8f954859017672b3d72496..598e44a36751a8886a240e01a958f0779d8bedac 100644 (file)
@@ -51,8 +51,6 @@ AC_PROG_CPP
 dnl get 64-int interfaces on 32-bit platforms
 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
 
-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],[])
index 97766301282cf1d66ff4a52b6d6ee517742a35c6..18f85ab514d94e1d0306bcb2a94376dbc25d89f2 100644 (file)
@@ -821,6 +821,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_@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('.')