meson: check for libsocket and libnsl
authorTim Mooney <Tim.Mooney@ndsu.edu>
Sat, 15 Jan 2022 06:04:05 +0000 (00:04 -0600)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 17 Feb 2022 18:44:49 +0000 (18:44 +0000)
If present, add '-lsocket' and '-lnsl' to network_deps.

ext/curl/meson.build: add network_deps to dependencies
gst/festival/meson.build: same
sys/shm/meson.build: same

Fixes linking issues on Illumos distros.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1525>

subprojects/gst-plugins-bad/ext/curl/meson.build
subprojects/gst-plugins-bad/gst/festival/meson.build
subprojects/gst-plugins-bad/meson.build
subprojects/gst-plugins-bad/sys/shm/meson.build

index c14504f..85f59a9 100644 (file)
@@ -23,7 +23,7 @@ if curl_dep.found()
     curl_sources,
     c_args : gst_plugins_bad_args,
     include_directories : [configinc, libsinc],
-    dependencies : [gstbase_dep, curl_dep] + winsock2,
+    dependencies : [gstbase_dep, curl_dep] + winsock2 + network_deps,
     install : true,
     install_dir : plugins_install_dir,
   )
index aab9624..ab77c07 100644 (file)
@@ -6,7 +6,7 @@ gstfestival = library('gstfestival',
   festival_sources,
   c_args : gst_plugins_bad_args,
   include_directories : [configinc],
-  dependencies : [gstbase_dep, gstaudio_dep] + winsock2,
+  dependencies : [gstbase_dep, gstaudio_dep] + winsock2 + network_deps,
   install : true,
   install_dir : plugins_install_dir,
 )
index 782a0df..4ad6317 100644 (file)
@@ -392,6 +392,20 @@ if x11_dep.found()
   cdata.set('HAVE_X11', 1)
 endif
 
+#
+# Solaris and Illumos distros split a lot of networking-related code
+# into '-lsocket -lnsl'.  Anything that calls socketpair(), getifaddr(),
+# etc. probably needs to include network_deps
+#
+if host_machine.system() == 'sunos'
+  network_deps = [
+    cc.find_library('socket', required: false),
+    cc.find_library('nsl',    required: false)
+  ]
+else
+  network_deps = []
+endif
+
 if host_machine.system() == 'windows'
   winsock2 = [cc.find_library('ws2_32')]
 else
index 6c6493e..8445e1f 100644 (file)
@@ -36,7 +36,7 @@ if shm_enabled
     shm_sources,
     c_args : gst_plugins_bad_args + ['-DSHM_PIPE_USE_GLIB'],
     include_directories : [configinc],
-    dependencies : [gstbase_dep, rt_dep],
+    dependencies : [gstbase_dep, rt_dep] + network_deps,
     install : true,
     install_dir : plugins_install_dir,
   )