meson: add types check

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-30 14:07:07 +02:00
parent 44ac9e688a
commit f46965b5f5
2 changed files with 27 additions and 15 deletions

View File

@ -51,8 +51,6 @@ AC_PROG_CPP
dnl get 64-int interfaces on 32-bit platforms dnl get 64-int interfaces on 32-bit platforms
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
AC_TYPE_UID_T
dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL) dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
AC_LIBTOOL_WIN32_DLL AC_LIBTOOL_WIN32_DLL
@ -207,19 +205,6 @@ LIBVIRT_CHECK_YAJL
AC_CHECK_SIZEOF([long]) 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([intl],[gettext],[])
AC_CHECK_LIB([util],[openpty],[]) AC_CHECK_LIB([util],[openpty],[])

View File

@ -821,6 +821,33 @@ if (cc.has_header_symbol('mach/clock.h', 'clock_serv_t') and
endif 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 # define top include directory
top_inc_dir = include_directories('.') top_inc_dir = include_directories('.')