--- old-configure.in.orig
+++ old-configure.in
@@ -2839,6 +2839,22 @@
 
 AC_SUBST(MOZ_ALSA)
 
+dnl ==================================
+dnl = Check sndio availability
+dnl ==================================
+
+MOZ_ARG_ENABLE_BOOL(sndio,
+[  --enable-sndio         Enable sndio support],
+   MOZ_SNDIO=1,
+   MOZ_SNDIO=)
+
+if test -n "$MOZ_SNDIO"; then
+    MOZ_SNDIO_LIBS="-lsndio"
+    AC_SUBST_LIST(MOZ_SNDIO_LIBS)
+fi
+
+AC_SUBST(MOZ_SNDIO)
+
 dnl ========================================================
 dnl = Disable PulseAudio
 dnl ========================================================
--- toolkit/library/moz.build.orig
+++ toolkit/library/moz.build
@@ -235,10 +235,8 @@
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
     OS_LIBS += CONFIG['TK_LIBS']
 
-if CONFIG['OS_ARCH'] == 'OpenBSD':
-    OS_LIBS += [
-        'sndio',
-    ]
+if CONFIG['MOZ_SNDIO']:
+    OS_LIBS += CONFIG['MOZ_SNDIO_LIBS']
 
 if CONFIG['MOZ_ENABLE_DBUS']:
     OS_LIBS += CONFIG['MOZ_DBUS_GLIB_LIBS']
--- media/libcubeb/src/moz.build.orig
+++ media/libcubeb/src/moz.build
@@ -43,7 +43,7 @@
     ]
     DEFINES['USE_JACK'] = True
 
-if CONFIG['OS_ARCH'] == 'OpenBSD':
+if CONFIG['MOZ_SNDIO']:
     SOURCES += [
         'cubeb_sndio.c',
     ]
--- build/moz.configure/old.configure.orig
+++ build/moz.configure/old.configure
@@ -159,6 +159,7 @@
     '--cache-file',
     '--datadir',
     '--enable-accessibility',
+    '--enable-sndio',
     '--enable-bundled-fonts',
     '--enable-content-sandbox',
     '--enable-cookies',
--- security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp.orig
+++ security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
@@ -349,6 +349,21 @@
         }
       }
     }
+
+#ifdef MOZ_SNDIO
+    // ~/.aucat_cookie (sndio)
+    rv = homeDir->Clone(getter_AddRefs(confDir));
+    if (NS_SUCCEEDED(rv)) {
+      rv = confDir->AppendNative(NS_LITERAL_CSTRING(".aucat_cookie"));
+      if (NS_SUCCEEDED(rv)) {
+        nsAutoCString tmpPath;
+        rv = confDir->GetNativePath(tmpPath);
+        if (NS_SUCCEEDED(rv)) {
+          policy->AddPath(rdwrcr, tmpPath.get());
+        }
+      }
+    }
+#endif
   }
 
   // Firefox binary dir.
--- security/sandbox/linux/moz.build.orig
+++ security/sandbox/linux/moz.build
@@ -81,6 +81,9 @@
 if CONFIG['MOZ_ALSA']:
     DEFINES['MOZ_ALSA'] = True
 
+if CONFIG['MOZ_SNDIO']:
+    DEFINES['MOZ_SNDIO'] = True
+
 # This copy of SafeSPrintf doesn't need to avoid the Chromium logging
 # dependency like the one in libxul does, but this way the behavior is
 # consistent.  See also the comment in SandboxLogging.h.
