$OpenBSD: patch-configure_ac,v 1.5 2009/10/11 14:11:58 ajacoutot Exp $
--- configure.ac.orig	Sat Sep 19 05:05:11 2009
+++ configure.ac	Sun Oct 11 15:58:13 2009
@@ -23,14 +23,14 @@ m4_define([ca_major],[0])
 m4_define([ca_minor],[18])
 m4_define([ca_version],[ca_major.ca_minor])
 
-AC_PREREQ(2.63)
+AC_PREREQ(2.62)
 
 AC_INIT([libcanberra],[ca_version],[mzyvopnaoreen (at) 0pointer (dot) de])
 AC_CONFIG_SRCDIR([src/common.c])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR(m4)
 
-AM_INIT_AUTOMAKE([foreign 1.10 -Wall])
+AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
 
 AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/libcanberra/])
 
@@ -91,7 +91,7 @@ dnl can give the proper place to find libltdl through 
 dnl variables like LDFLAGS and CPPFLAGS.
 
 AC_CHECK_HEADER([ltdl.h],
-    [AC_CHECK_LIB([ltdl], [lt_dladvise_init], [LIBLTDL=-lltdl], [LIBLTDL=])],
+    [AC_CHECK_LIB([ltdl], [lt_dlopen], [LIBLTDL=-lltdl], [LIBLTDL=])],
     [LIBLTDL=])
 
 AS_IF([test "x$LIBLTDL" = "x"],
@@ -246,6 +246,36 @@ else
     HAVE_OSS=0
 fi
 
+### SNDIO support (optional) ###
+
+AC_ARG_ENABLE([sndio],
+    AC_HELP_STRING([--disable-sndio], [Disable optional sndio support]),
+        [
+            case "${enableval}" in
+                yes) sndio=yes ;;
+                no) sndio=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --disable-sndio) ;;
+            esac
+        ],
+        [sndio=auto])
+
+if test "x${sndio}" != xno ; then
+    AC_CHECK_HEADERS(sndio.h)
+    if test "${ac_cv_header_sndio_h}" = "yes"; then
+	HAVE_SNDIO=1
+        AC_DEFINE([HAVE_SNDIO], 1, [Have sndio?])
+        SNDIO_LIBS='-lsndio'
+    else
+	HAVE_SNDIO=0
+        if test "x$sndio" = xyes ; then
+            AC_MSG_ERROR([*** sndio not found ***])
+        fi
+    fi
+else
+    HAVE_SNDIO=0
+fi
+AC_SUBST(SNDIO_LIBS)
+
 ### PulseAudio (optional) ####
 
 AC_ARG_ENABLE([pulse],
@@ -468,6 +498,7 @@ BUILTIN_DSO=0
 BUILTIN_PULSE=0
 BUILTIN_ALSA=0
 BUILTIN_OSS=0
+BUILTIN_SNDIO=0
 BUILTIN_GSTREAMER=0
 BUILTIN_NULL=0
 
@@ -480,6 +511,7 @@ case "x$with_builtin" in
         BUILTIN_PULSE=1
         HAVE_ALSA=0
 	HAVE_OSS=0
+	HAVE_SNDIO=0
 	HAVE_GSTREAMER=0
         HAVE_NULL=0
      ;;
@@ -491,6 +523,7 @@ case "x$with_builtin" in
 
         BUILTIN_ALSA=1
 	HAVE_OSS=0
+	HAVE_SNDIO=0
         HAVE_PULSE=0
 	HAVE_GSTREAMER=0
         HAVE_NULL=0
@@ -504,6 +537,7 @@ case "x$with_builtin" in
         BUILTIN_GSTREAMER=1
         HAVE_ALSA=0
 	HAVE_OSS=0
+	HAVE_SNDIO=0
         HAVE_PULSE=0
         HAVE_NULL=0
      ;;
@@ -515,11 +549,25 @@ case "x$with_builtin" in
 
 	BUILTIN_OSS=1
 	HAVE_ALSA=0
+	HAVE_SNDIO=0
 	HAVE_PULSE=0
 	HAVE_GSTREAMER=0
 	HAVE_NULL=0
      ;;
 
+     xsndio)
+        if test "x$HAV_SNDIO" != x1 ; then
+	        AC_MSG_ERROR([*** sndio selected for builtin driver, but not enabled. ***])
+	fi
+
+	BUILTIN_SNDIO=1
+	HAVE_ALSA=0
+	HAVE_OSS=0
+	HAVE_PULSE=0
+	HAVE_GSTREAMER=0
+	HAVE_NULL=0
+     ;;
+
      xnull)
         if test "x$HAVE_NULL" != x1 ; then
                 AC_MSG_ERROR([*** Null output selected for builtin driver, but not enabled. ***])
@@ -527,6 +575,7 @@ case "x$with_builtin" in
 
         BUILTIN_NULL=1
         HAVE_PULSE=0
+	HAVE_SNDIO=0
         HAVE_ALSA=0
 	HAVE_OSS=0
 	HAVE_GSTREAMER=0
@@ -542,7 +591,7 @@ case "x$with_builtin" in
         AC_MSG_ERROR([*** Unknown driver $with_builtin selected for builtin ***])
 esac
 
-if test "x$HAVE_PULSE" != x1 -a "x$HAVE_ALSA" != x1 -a "x$HAVE_OSS" != x1 -a "x$HAVE_GSTREAMER" != x1 -a "x$HAVE_NULL" != x1 ; then
+if test "x$HAVE_PULSE" != x1 -a "x$HAVE_ALSA" != x1 -a "x$HAVE_OSS" != x1 -a "x$HAVE_SNDIO" != x1 -a "x$HAVE_GSTREAMER" != x1 -a "x$HAVE_NULL" != x1 ; then
    AC_MSG_ERROR([*** No backend enabled. ***])
 fi
 
@@ -550,23 +599,27 @@ AC_SUBST(HAVE_DSO)
 AC_SUBST(HAVE_PULSE)
 AC_SUBST(HAVE_ALSA)
 AC_SUBST(HAVE_OSS)
+AC_SUBST(HAVE_SNDIO)
 AC_SUBST(HAVE_GSTREAMER)
 AC_SUBST(HAVE_NULL)
 AC_SUBST(BUILTIN_DSO)
 AC_SUBST(BUILTIN_PULSE)
 AC_SUBST(BUILTIN_ALSA)
 AC_SUBST(BUILTIN_OSS)
+AC_SUBST(BUILTIN_SNDIO)
 AC_SUBST(BUILTIN_GSTREAMER)
 AC_SUBST(BUILTIN_NULL)
 AM_CONDITIONAL([HAVE_PULSE], [test "x$HAVE_PULSE" = x1])
 AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
 AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1])
+AM_CONDITIONAL([HAVE_SNDIO], [test "x$HAVE_SNDIO" = x1])
 AM_CONDITIONAL([HAVE_GSTREAMER], [test "x$HAVE_GSTREAMER" = x1])
 AM_CONDITIONAL([HAVE_NULL], [test "x$HAVE_NULL" = x1])
 AM_CONDITIONAL([BUILTIN_DSO], [test "x$BUILTIN_DSO" = x1])
 AM_CONDITIONAL([BUILTIN_PULSE], [test "x$BUILTIN_PULSE" = x1])
 AM_CONDITIONAL([BUILTIN_ALSA], [test "x$BUILTIN_ALSA" = x1])
 AM_CONDITIONAL([BUILTIN_OSS], [test "x$BUILTIN_OSS" = x1])
+AM_CONDITIONAL([BUILTIN_SNDIO], [test "x$BUILTIN_SNDIO" = x1])
 AM_CONDITIONAL([BUILTIN_GSTREAMER], [test "x$BUILTIN_GSTREAMER" = x1])
 AM_CONDITIONAL([BUILTIN_NULL], [test "x$BUILTIN_NULL" = x1])
 
@@ -624,6 +677,15 @@ if test "x$BUILTIN_OSS" = "x1" ; then
     ENABLE_BUILTIN_OSS=yes
 fi
 
+ENABLE_SNDIO=no
+if test "x$HAVE_SNDIO" = "x1" ; then
+    ENABLE_SNDIO=yes
+fi
+ENABLE_BUILTIN_SNDIO=no
+if test "x$BUILTIN_SNDIO" = "x1" ; then
+    ENABLE_BUILTIN_SNDIO=yes
+fi
+
 ENABLE_GSTREAMER=no
 if test "x$HAVE_GSTREAMER" = "x1" ; then
    ENABLE_GSTREAMER=yes
@@ -674,6 +736,8 @@ echo "
     Builtin ALSA:           ${ENABLE_BUILTIN_ALSA}
     Enable OSS:             ${ENABLE_OSS}
     Builtin OSS:            ${ENABLE_BUILTIN_OSS}
+    Enable SNDIO:           ${ENABLE_SNDIO}
+    Builtin SNDIO:          ${ENABLE_BUILTIN_SNDIO}
     Enable GStreamer:       ${ENABLE_GSTREAMER}
     Builtin GStreamer:      ${ENABLE_BUILTIN_GSTREAMER}
     Enable Null Output:     ${ENABLE_NULL}
