$OpenBSD: patch-configure,v 1.62 2019/08/18 06:56:07 ajacoutot Exp $

sndio module

Index: configure
--- configure.orig
+++ configure
@@ -847,8 +847,8 @@ NetBSD)
 OpenBSD)
   bsd="yes"
   make="${MAKE-gmake}"
-  audio_drv_list="try-sdl"
-  audio_possible_drivers="sdl"
+  audio_drv_list="sndio"
+  audio_possible_drivers="sndio"
   HOST_VARIANT_DIR="openbsd"
   supported_os="yes"
 ;;
@@ -3398,6 +3398,25 @@ fi
 ##########################################
 # Sound support libraries probe
 
+audio_drv_probe()
+{
+    drv=$1
+    hdr=$2
+    lib=$3
+    exp=$4
+    cfl=$5
+        cat > $TMPC << EOF
+#include <$hdr>
+int main(void) { $exp }
+EOF
+    if compile_prog "$cfl" "$lib" ; then
+        :
+    else
+        error_exit "$drv check failed" \
+            "Make sure to have the $drv libs and headers installed."
+    fi
+}
+
 audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
 for drv in $audio_drv_list; do
     case $drv in
@@ -3448,6 +3467,12 @@ for drv in $audio_drv_list; do
     fi
     ;;
 
+    sndio)
+    audio_drv_probe $drv sndio.h "-lsndio" \
+        "sio_open(0, SIO_PLAY, 0); return 0;"
+    sndio_libs="-lsndio"
+    ;;
+
     coreaudio)
       coreaudio_libs="-framework CoreAudio"
     ;;
@@ -5980,10 +6005,6 @@ write_c_skeleton
 if test "$gcov" = "yes" ; then
   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
-elif test "$fortify_source" = "yes" ; then
-  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
-  CFLAGS="-O2 $CFLAGS"
 fi
 
 if test "$have_asan" = "yes"; then
@@ -6643,7 +6664,7 @@ echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config
 for drv in $audio_drv_list; do
     def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
     case "$drv" in
-	alsa | oss | pa | sdl)
+	alsa | oss | pa | sdl | sndio)
 	    echo "$def=m" >> $config_host_mak ;;
 	*)
 	    echo "$def=y" >> $config_host_mak ;;
@@ -6657,6 +6678,7 @@ echo "OSS_LIBS=$oss_libs" >> $config_host_mak
 if test "$audio_pt_int" = "yes" ; then
   echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
 fi
+echo "SNDIO_LIBS=$sndio_libs" >> $config_host_mak
 if test "$audio_win_int" = "yes" ; then
   echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
 fi
