--- CMakeLists.txt.orig	2023-03-18 16:34:44.301362000 -0400
+++ CMakeLists.txt	2023-03-18 16:35:14.513869000 -0400
@@ -90,15 +90,16 @@
 option ( enable-sdl2 "compile SDL2 audio support (if it is available)" on )
 option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
 option ( enable-pipewire "compile PipeWire support (if it is available)" on )
+option ( enable-sndio "compile Sndio support (if it is available)" on )
 option ( enable-readline "compile readline lib line editing (if it is available)" on )
 option ( enable-threads "enable multi-threading support (such as parallel voice synthesis)" on )
 option ( enable-openmp "enable OpenMP support (parallelization of soundfont decoding, vectorization of voice mixing, etc.)" on )
 
 # Platform specific options
-if ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" )
+if ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly|MidnightBSD" )
     option ( enable-lash "compile LASH support (if it is available)" on )
     option ( enable-alsa "compile ALSA support (if it is available)" on )
-endif ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" )
+endif ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly|MidnightBSD" )
 
 if ( CMAKE_SYSTEM MATCHES "Linux" )
     option ( enable-systemd "compile systemd support (if it is available)" on )
@@ -531,6 +532,11 @@
     unset_pkg_config ( PULSE )
 endif ( enable-pulseaudio )
 
+unset ( SNDIO_SUPPORT CACHE )
+if ( enable-sndio )
+    set ( SNDIO_SUPPORT 1 )
+endif ( enable-sndio )
+
 unset ( ALSA_SUPPORT CACHE )
 if ( enable-alsa )
     pkg_check_modules ( ALSA alsa>=0.9.1 IMPORTED_TARGET )
