add sndio driver

backport commit 0b3496f:
Add support for SDL3 joystick input driver

Index: platform/linuxbsd/detect.py
--- platform/linuxbsd/detect.py.orig
+++ platform/linuxbsd/detect.py
@@ -42,6 +42,7 @@ def get_opts():
         BoolVariable("use_sowrap", "Dynamically load system libraries", True),
         BoolVariable("alsa", "Use ALSA", True),
         BoolVariable("pulseaudio", "Use PulseAudio", True),
+        BoolVariable("sndio", "Detect and use sndio", True),
         BoolVariable("dbus", "Use D-Bus to handle screensaver and portal desktop settings", True),
         BoolVariable("speechd", "Use Speech Dispatcher for Text-to-Speech support", True),
         BoolVariable("fontconfig", "Use fontconfig for system fonts support", True),
@@ -336,6 +337,12 @@ def configure(env: "SConsEnvironment"):
         else:
             env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
 
+    if env["sndio"]:
+        if os.system("pkg-config --exists sndio") == 0:  # 0 means found
+            print("Enabling sndio")
+            env.Append(CPPDEFINES=["SNDIO_ENABLED"])
+            env.ParseConfig("pkg-config --cflags --libs sndio")
+
     if env["dbus"]:
         if not env["use_sowrap"]:
             if os.system("pkg-config --exists dbus-1") == 0:  # 0 means found
@@ -388,6 +395,18 @@ def configure(env: "SConsEnvironment"):
     else:
         env["udev"] = False  # Linux specific
 
+    if env["sdl"]:
+        if env["builtin_sdl"]:
+            env.Append(CPPDEFINES=["SDL_ENABLED"])
+        elif os.system("pkg-config --exists fontconfig") == 0:  # 0 means found
+            env.ParseConfig("pkg-config sdl3 --cflags --libs")
+            env.Append(CPPDEFINES=["SDL_ENABLED"])
+        else:
+            print_warning(
+                "SDL3 development libraries not found, and `builtin_sdl` was explicitly disabled. Disabling SDL input driver support."
+            )
+            env["sdl"] = False
+
     # Linkflags below this line should typically stay the last ones
     if not env["builtin_zlib"]:
         env.ParseConfig("pkg-config zlib --cflags --libs")
@@ -472,7 +491,7 @@ def configure(env: "SConsEnvironment"):
             env.ParseConfig("pkg-config vulkan --cflags --libs")
         if not env["builtin_glslang"]:
             # No pkgconfig file so far, hardcode expected lib name.
-            env.Append(LIBS=["glslang", "SPIRV"])
+            env.Append(LIBS=["glslang", "SPIRV", "glslang-default-resource-limits"])
 
     if env["opengl3"]:
         env.Append(CPPDEFINES=["GLES3_ENABLED"])
