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([
80 '-D_WIN32_WINNT=0x601', # Enables inet_ntop and friends
84 warning('Unknown system: @0@'.format(system))
85 usrsctp_dep = dependency('', required: false)
90 if compiler.has_header('sys/queue.h')
91 compile_args += ['-DHAVE_SYS_QUEUE_H']
94 # Feature: sys/socket, linux/ifaddr, linux/rtnetlink
95 if compiler.has_header('sys/socket.h')
96 if compiler.has_header('linux/if_addr.h')
97 compile_args += ['-DHAVE_LINUX_IF_ADDR_H']
100 if compiler.has_header('linux/rtnetlink.h')
101 compile_args += ['-DHAVE_LINUX_RTNETLINK_H']
106 have_sys_types = compiler.has_header('sys/types.h')
107 have_netinet_in = compiler.has_header('netinet/in.h')
108 have_netinet_ip = compiler.has_header('netinet/ip.h')
109 have_netinet_ip_icmp = compiler.has_header('netinet/ip_icmp.h')
110 if have_sys_types and have_netinet_in and have_netinet_ip and have_netinet_ip_icmp
111 compile_args += ['-DHAVE_NETINET_IP_ICMP_H']
115 if compiler.has_header('stdatomic.h')
116 compile_args += ['-DHAVE_STDATOMIC_H']
119 # Feature: sockaddr.sa_len
121 #include <sys/types.h>
122 #include <sys/socket.h>
124 have_sa_len = compiler.has_member('struct sockaddr', 'sa_len', prefix: prefix)
126 compile_args += ['-DHAVE_SA_LEN']
129 # Feature: sockaddr_in.sin_len / sockaddr_in6.sin6_len / sockaddr_conn.sconn_len
131 #include <sys/types.h>
132 #include <netinet/in.h>
134 have_sin_len = compiler.has_member('struct sockaddr_in', 'sin_len', prefix: prefix)
136 compile_args += ['-DHAVE_SIN_LEN']
138 have_sin6_len = compiler.has_member('struct sockaddr_in6', 'sin6_len', prefix: prefix)
140 compile_args += ['-DHAVE_SIN6_LEN']
142 have_sconn_len = compiler.has_member('struct sockaddr_conn', 'sconn_len', prefix: '#include "usrsctp.h"', include_directories: include_directories('usrsctplib'))
144 compile_args += ['-DHAVE_SCONN_LEN']
149 compile_args += ['-DINVARIANTS']
151 if not gst_debug_disabled
152 compile_args += ['-DSCTP_DEBUG']
154 # We do not need the socket API in GStreamer since we will wrap inside a
155 # DTLS packet anyway, because we use SCTP for WebRTC data channels.
157 compile_args += ['-DINET']
160 compile_args += ['-DINET6']
163 compile_args += ['-DSCTP_STDINT_INCLUDE=<stdint.h>']
169 usrsctp_static = static_library('usrsctp-static', sources,
170 c_args: compile_args,
171 dependencies: dependencies,
172 include_directories: include_dirs,
176 usrsctp_dep = declare_dependency(
177 include_directories: include_dirs,
178 link_with: usrsctp_static)