1 # Set compiler warning flags
2 compiler = meson.get_compiler('c')
3 if compiler.get_argument_syntax() == 'msvc'
4 compiler_args = compiler.get_supported_arguments([
5 '/wd4100', # 'identifier' : unreferenced formal parameter
6 '/wd4127', # conditional expression is constant
7 '/wd4200', # nonstandard extension used : zero-sized array in struct/union
8 '/wd4214', # bit field types other than int
9 '/wd4706', # assignment within conditional expression
10 '/wd4245', # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
11 '/wd4389', # 'operator' : signed/unsigned mismatch
12 '/wd4702', # unreachable code
13 '/wd4701', # Potentially uninitialized local variable 'name' used
14 '/wd4244', # 'conversion' conversion from 'type1' to 'type2', possible loss of data
17 compiler_args = compiler.get_supported_arguments([
22 '-Wno-unused-function',
23 '-Wno-unused-parameter',
24 '-Wno-unreachable-code',
25 '-Wstrict-prototypes',
26 # fix GStreamer build with -Werror
27 '-Wno-missing-prototypes',
28 '-Wno-incompatible-pointer-types-discards-qualifiers',
29 '-Wno-address-of-packed-member',
30 '-Wno-discarded-qualifiers',
31 '-Wno-missing-declarations',
32 '-Wno-old-style-definition',
33 '-Wno-redundant-decls',
40 compile_args = [compiler_args]
43 thread_dep = dependency('threads', required: true)
53 '-DSCTP_SIMPLE_ALLOCATOR',
54 '-DSCTP_PROCESS_LEVEL_LOCKS',
57 # OS-specific settings
58 system = host_machine.system()
59 if system in ['linux', 'android']
63 elif system == 'freebsd'
64 compile_args += [compiler.get_supported_arguments([
65 '-Wno-address-of-packed-member',
67 elif system in ['darwin', 'ios']
69 '-D__APPLE_USE_RFC_2292',
70 ] + compiler.get_supported_arguments([
71 '-Wno-address-of-packed-member',
72 '-Wno-deprecated-declarations',
74 elif system == 'windows'
75 dependencies += compiler.find_library('ws2_32', required: true)
76 dependencies += compiler.find_library('iphlpapi', required: true)
77 if compiler.get_id() == 'gcc'
78 compile_args += [compiler.get_supported_arguments([
83 warning('Unknown system: @0@'.format(system))
84 usrsctp_dep = dependency('', required: false)
89 if compiler.has_header('sys/queue.h')
90 compile_args += ['-DHAVE_SYS_QUEUE_H']
93 # Feature: sys/socket, linux/ifaddr, linux/rtnetlink
94 if compiler.has_header('sys/socket.h')
95 if compiler.has_header('linux/if_addr.h')
96 compile_args += ['-DHAVE_LINUX_IF_ADDR_H']
99 if compiler.has_header('linux/rtnetlink.h')
100 compile_args += ['-DHAVE_LINUX_RTNETLINK_H']
105 have_sys_types = compiler.has_header('sys/types.h')
106 have_netinet_in = compiler.has_header('netinet/in.h')
107 have_netinet_ip = compiler.has_header('netinet/ip.h')
108 have_netinet_ip_icmp = compiler.has_header('netinet/ip_icmp.h')
109 if have_sys_types and have_netinet_in and have_netinet_ip and have_netinet_ip_icmp
110 compile_args += ['-DHAVE_NETINET_IP_ICMP_H']
114 if compiler.has_header('stdatomic.h')
115 compile_args += ['-DHAVE_STDATOMIC_H']
118 # Feature: sockaddr.sa_len
120 #include <sys/types.h>
121 #include <sys/socket.h>
123 have_sa_len = compiler.has_member('struct sockaddr', 'sa_len', prefix: prefix)
125 compile_args += ['-DHAVE_SA_LEN']
128 # Feature: sockaddr_in.sin_len / sockaddr_in6.sin6_len / sockaddr_conn.sconn_len
130 #include <sys/types.h>
131 #include <netinet/in.h>
133 have_sin_len = compiler.has_member('struct sockaddr_in', 'sin_len', prefix: prefix)
135 compile_args += ['-DHAVE_SIN_LEN']
137 have_sin6_len = compiler.has_member('struct sockaddr_in6', 'sin6_len', prefix: prefix)
139 compile_args += ['-DHAVE_SIN6_LEN']
141 have_sconn_len = compiler.has_member('struct sockaddr_conn', 'sconn_len', prefix: '#include "usrsctp.h"', include_directories: include_directories('usrsctplib'))
143 compile_args += ['-DHAVE_SCONN_LEN']
148 compile_args += ['-DINVARIANTS']
150 if not gst_debug_disabled
151 compile_args += ['-DSCTP_DEBUG']
153 # We do not need the socket API in GStreamer since we will wrap inside a
154 # DTLS packet anyway, because we use SCTP for WebRTC data channels.
156 compile_args += ['-DINET']
159 compile_args += ['-DINET6']
162 compile_args += ['-DSCTP_STDINT_INCLUDE=<stdint.h>']
168 usrsctp_static = static_library('usrsctp-static', sources,
169 c_args: compile_args,
170 dependencies: dependencies,
171 include_directories: include_dirs,
175 usrsctp_dep = declare_dependency(
176 include_directories: include_dirs,
177 link_with: usrsctp_static)