$OpenBSD: patch-configure_ac,v 1.1 2021/01/31 22:14:02 sthen Exp $

- relies on AM_PATH_ALSA (from ALSA devel files) and AM_PATH_SDL
(from SDL devel files); hack around to allow generating autoconf
without them

- add sndio

Index: configure.ac
--- configure.ac.orig
+++ configure.ac
@@ -156,7 +156,8 @@ AS_HELP_STRING([--disable-alsa], [Disable ALSA driver 
 alsa_support=no)
 
 if test x$alsa_support != xno; then
-  AM_PATH_ALSA([1.0.29], have_alsa=yes, have_alsa=no)
+dnl  AM_PATH_ALSA([1.0.29], have_alsa=yes, have_alsa=no)
+  have_alsa=no
   if test x$have_alsa = xyes; then
     AC_DEFINE([DRIVER_ALSA], 1, [Set if ALSA driver wanted])
     CFLAGS="$CFLAGS $ALSA_CFLAGS"
@@ -239,7 +240,8 @@ AS_HELP_STRING([--disable-sdl], [Disable SDL driver (d
 sdl_support=no)
 
 if test x$sdl_support != xno; then
-  AM_PATH_SDL(1.2.0, have_sdl=yes, have_sdl=no)
+dnl  AM_PATH_SDL(1.2.0, have_sdl=yes, have_sdl=no)
+  have_sdl=no
   if test x$have_sdl = xyes; then
     AC_DEFINE([DRIVER_SDL], 1, [Set if SDL audio driver wanted])
     CFLAGS="$CFLAGS $SDL_CFLAGS"
@@ -248,6 +250,25 @@ if test x$sdl_support != xno; then
 fi
 
 AM_CONDITIONAL(DRIVER_SDL, test x$have_sdl = xyes)
+
+dnl -----------------------------------------------------------------------
+dnl Test for SNDIO
+dnl -----------------------------------------------------------------------
+
+AC_ARG_ENABLE(sndio,
+AS_HELP_STRING([--disable-sndio], [Disable sndio driver (default = try)]),
+sndio_support=no)
+
+if test x$sndio_support != xno; then
+  AC_CHECK_HEADERS(sndio.h)
+  if test "${ac_cv_header_sndio_h}" = "yes"; then
+    AC_DEFINE([DRIVER_SNDIO], 1, [Set if sndio audio driver wanted])
+    LIBS="$LIBS -lsndio"
+  fi
+fi
+
+AM_CONDITIONAL(DRIVER_SNDIO, test "${ac_cv_header_sndio_h}" = "yes")
+
 
 dnl -----------------------------------------------------------------------
 dnl Selecting graphics backend
