sctp: hook up internal copy of libusrsctp to build
[platform/upstream/gstreamer.git] / ext / sctp / meson.build
1 sctp_sources = [
2   'gstsctpdec.c',
3   'gstsctpenc.c',
4   'gstsctpplugin.c',
5   'sctpassociation.c'
6 ]
7
8 if get_option('sctp').disabled()
9   subdir_done()
10 endif
11
12 sctp_platform_deps = []
13
14 found_system_usrsctp = false
15
16 if not get_option('sctp-internal-usrsctp').enabled()
17   sctp_dep = cc.find_library('usrsctp', required: false)
18   sctp_header = cc.has_header('usrsctp.h')
19   if host_system == 'windows'
20     sctp_platform_deps += [cc.find_library('ws2_32')]
21   endif
22
23   found_system_usrsctp = sctp_dep.found() and sctp_header
24
25   if get_option('sctp-internal-usrsctp').disabled() and not found_system_usrsctp
26     if get_option('sctp').enabled()
27       error('sctp plugin enabled but could not find libusrsctp or usrsctp.h, and internal libusrsctp disabled')
28     else
29       message('Could not find libusrsctp or usrsctp.h, and internal libusrsctp disabled - not building sctp plugin')
30       subdir_done()
31     endif
32   endif
33 endif
34
35 if not found_system_usrsctp
36   message('Using internal libusrsctp')
37   subdir('usrsctp')
38   sctp_dep = usrsctp_dep
39   sctp_header = true
40   if get_option('sctp').enabled() and not sctp_dep.found()
41     error('sctp plugin enabled but could not find system libusrsctp or configure internal libusrsctp')
42   endif
43 endif
44
45 if not gst_debug_disabled
46   sctp_args = ['-DSCTP_DEBUG']
47 else
48   sctp_args = []
49 endif
50
51 if sctp_dep.found() and sctp_header
52   gstsctp = library('gstsctp',
53     sctp_sources,
54     c_args : gst_plugins_bad_args + sctp_args,
55     include_directories : [configinc],
56     dependencies : [sctp_dep, gst_dep, gstbase_dep, gstsctp_dep, sctp_platform_deps],
57     install : true,
58     install_dir : plugins_install_dir,
59   )
60   pkgconfig.generate(gstsctp, install_dir : plugins_pkgconfig_install_dir)
61   plugins += [gstsctp]
62 endif