$OpenBSD: patch-configure_ac,v 1.14 2012/07/05 09:29:43 dcoppa Exp $
--- configure.ac.orig	Sat Jun 30 02:05:33 2012
+++ configure.ac	Tue Jul  3 09:59:40 2012
@@ -45,9 +45,6 @@ PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 3.2],
     [AC_MSG_ERROR([Cannot find Audacious 3.2; have you installed Audacious yet?])]
 )
 
-CPPFLAGS="$CPPFLAGS $AUDACIOUS_CFLAGS"
-LIBS="$LIBS $AUDACIOUS_LIBS"
-
 dnl Default Set of Plugins
 dnl ======================
 
@@ -101,7 +98,7 @@ dnl ===============
 PTHREAD_LIBS=
 PTHREAD_CFLAGS=
 
-AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS="-lpthread",
+AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS="-pthread",
   [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIBS="-lpthreads",
 	[AC_CHECK_LIB(pthreadGC2, pthread_create, PTHREAD_LIBS="-lpthreadGC2")]
   )]
@@ -969,7 +966,7 @@ AC_ARG_ENABLE(filewriter_mp3,
 )
 
 if test "x$enable_filewriter_mp3" = "xyes"; then
-   AC_CHECK_LIB(mp3lame -lm, lame_get_id3v2_tag, [have_lame=yes], [have_lame=no])
+   AC_CHECK_LIB(mp3lame, lame_get_id3v2_tag, [have_lame=yes], [have_lame=no])
    if test "x$have_lame" = "xyes"; then
       AC_DEFINE(FILEWRITER_MP3, 1, [Define if MP3 output part should be built])
 	  FILEWRITER_LIBS="$FILEWRITER_LIBS -lmp3lame"
@@ -1083,8 +1080,32 @@ if test "x$enable_lyricwiki" = "xyes"; then
     GENERAL_PLUGINS="$GENERAL_PLUGINS lyricwiki"
 fi
 
+dnl *** sndio output
+
+AC_ARG_ENABLE(sndio,
+    [  --disable-sndio         disable sndio output plugin (default=enabled) ],
+    [have_sndio=$enableval],
+    [have_sndio=yes]
+)
+
+if test "x$have_sndio" = "xyes"; then
+	AC_CHECK_HEADER(sndio.h,, have_sndio=no)
+	if test x$have_sndio = xyes; then
+		AC_CHECK_LIB(sndio, sio_open, haves_sndio=yes, have_sndio=no)
+	fi
+fi
+
+if test "x$have_sndio" = "xyes"; then
+	OUTPUT_PLUGINS="$OUTPUT_PLUGINS sndio"
+	SNDIO_LIBS="-lsndio"
+	AC_SUBST(SNDIO_LIBS)
+fi
+
 dnl *** End of all plugin checks ***
 
+CPPFLAGS="$CPPFLAGS $AUDACIOUS_CFLAGS"
+LIBS="$LIBS $AUDACIOUS_LIBS"
+
 plugindir=`pkg-config audacious --variable=plugin_dir`
 AC_SUBST(plugindir)
 
@@ -1154,6 +1175,7 @@ echo "    -> FileWriter Vorbis output part:     $enabl
 echo "    -> FileWriter FLAC output part:       $have_writer_flac"
 echo "  Null Audio output (null):               yes"
 echo "  Open Sound System v3 (deprecated):      $enable_oss"
+echo "  Sndio Audio output (sndio):             $have_sndio"
 echo
 echo "  Input Plugins"
 echo "  -------------"
