[gssdp/wip/meson: 7/17] meson: Port compile tests
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp/wip/meson: 7/17] meson: Port compile tests
- Date: Fri, 26 Oct 2018 14:45:23 +0000 (UTC)
commit 1856b60593bd5621a2b0eba6d6128f8f222b75fb
Author: Jens Georg <mail jensge org>
Date: Fri Oct 26 16:43:40 2018 +0200
meson: Port compile tests
libgssdp/meson.build | 7 +++++++
meson.build | 41 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 47 insertions(+), 1 deletion(-)
---
diff --git a/libgssdp/meson.build b/libgssdp/meson.build
index 4e6cdd8..779ec16 100644
--- a/libgssdp/meson.build
+++ b/libgssdp/meson.build
@@ -29,6 +29,13 @@ sources = introspection_sources + [
'gssdp-socket-functions.h'
]
+if pktinfo_available
+ sources += [
+ 'gssdp-pktinfo-message.c',
+ 'gssdp-pktinfo-message.h'
+ ]
+endif
+
if host_machine.system() == 'windows'
sources += 'gssdp-net-win32.c'
endif
diff --git a/meson.build b/meson.build
index c8563b1..7c9d3d3 100644
--- a/meson.build
+++ b/meson.build
@@ -8,13 +8,52 @@ as_major_version = ver_arr[0]
as_minor_version = ver_arr[1]
as_micro_version = ver_arr[2]
+cc = meson.get_compiler('c')
+
conf = configuration_data()
conf.set('VERSION', '"@0@"'.format(meson.project_version()))
+
+# Check for struct in_pktinfo
+pktinfo_test = '''#include <netinet/ip.h>
+struct in_pktinfo pktinfo;
+'''
+
+pktinfo_available = cc.compiles(pktinfo_test,
+ name : 'struct in_pktinfo is available')
+if pktinfo_available
+ conf.set('HAVE_PKTINFO', '1')
+endif
+
+# Check for if_nametoindex
+if_nametoindex_test = '''#include <net/if.h>
+int main(int argc, char *argv[]) {
+ (void) argc;
+ (void) argv;
+ if_nametoindex("lo");
+ return 0;
+}
+'''
+
+ifnametoindex_available = cc.compiles(if_nametoindex_test,
+ name : 'if_nametoindex is available')
+if ifnametoindex_available
+ conf.set('HAVE_IFNAMETOINDEX', '1')
+endif
+
+# Check for SIOCGIFINDEX
+siocgifindex_test = '''#include <sys/ioctl.h>
+static const int foo = SIOCGIFINDEX;
+'''
+siocgifindex_available = cc.compiles(siocgifindex_test,
+ name : 'SIOCGIFINDEX is available')
+if siocgifindex_available
+ conf.set('HAVE_SIOCGIFINDEX', '1')
+endif
+
configure_file(output : 'config.h', configuration : conf)
add_global_arguments('-DHAVE_CONFIG_H=1', language : 'c')
-cc = meson.get_compiler('c')
system_deps = []
# Check whether we are compiling against Android libc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]