$OpenBSD: patch-configure,v 1.55 2010/02/23 19:59:13 phessler Exp $
--- configure.orig	Thu Jun 25 01:31:17 2009
+++ configure	Sat Feb 13 11:34:11 2010
@@ -420,6 +420,7 @@ Audio output:
   --disable-nas          disable NAS audio output [autodetect]
   --disable-sgiaudio     disable SGI audio output [autodetect]
   --disable-sunaudio     disable Sun audio output [autodetect]
+  --disable-sndio        disable sndio audio output [autodetect]
   --disable-dart         disable DART audio output [autodetect]
   --disable-win32waveout disable Windows waveout audio output [autodetect]
   --disable-coreaudio    disable CoreAudio audio output [autodetect]
@@ -651,6 +652,7 @@ _xf86keysym=auto
 _mlib=no #broken, thus disabled
 _sgiaudio=auto
 _sunaudio=auto
+_sndio=auto
 _alsa=auto
 _fastmemcpy=yes
 _unrar_exec=auto
@@ -1075,6 +1077,8 @@ for ac_option do
   --disable-mlib)	_mlib=no	;;
   --enable-sunaudio)	_sunaudio=yes	;;
   --disable-sunaudio)	_sunaudio=no	;;
+  --enable-sndio)	_sndio=yes	;;
+  --disable-sndio)	_sndio=no	;;
   --enable-sgiaudio)	_sgiaudio=yes	;;
   --disable-sgiaudio)	_sgiaudio=no	;;
   --enable-alsa)	_alsa=yes	;;
@@ -1408,7 +1412,7 @@ if test -z "$_target" ; then
       sh3|sh4|sh4a) host_arch=sh ;;
       s390) host_arch=s390 ;;
       s390x) host_arch=s390x ;;
-      mips*) host_arch=mips ;;
+      sgi|mips*|loongson) host_arch=mips ;;
       vax) host_arch=vax ;;
       xtensa*) host_arch=xtensa ;;
       *) host_arch=UNKNOWN ;;
@@ -2374,7 +2378,7 @@ cat > $TMPC << EOF
 int ff_extern;
 EOF
 cc_check -c || die "Symbol mangling check failed."
-sym=$($_nm -P -g $TMPEXE)
+sym=$($_nm -g $TMPEXE | grep ff_extern | cut -d ' ' -f 3)
 extern_prefix=${sym%%ff_extern*}
 def_extern_prefix="#define EXTERN_PREFIX \"$extern_prefix\""
 echores $extern_prefix
@@ -3347,7 +3351,7 @@ int main(void) { pthread_t tid; return pthread_create(
 EOF
 _pthreads=no
 if ! hpux ; then
-  for _ld_tmp in "-lpthreadGC2" "" "-lpthread" "-pthread" ; do
+  for _ld_tmp in "-lpthreadGC2" "" "-pthread" "-lpthread" ; do
     # for crosscompilation, we cannot execute the program, be happy if we can link statically
     cc_check $THREAD_CFLAGS $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break
   done
@@ -4666,6 +4670,8 @@ if test "$_aa" = yes ; then
   def_aa='#define CONFIG_AA 1'
   if cygwin ; then
     libs_mplayer="$libs_mplayer $(aalib-config --libs | cut -d " " -f 2,5,6)"
+  else
+    libs_mplayer="$libs_mplayer $(aalib-config --libs)"
   fi
   _vomodules="aa $_vomodules"
 else
@@ -4911,14 +4917,14 @@ int main(void) {
   return !p_ver || p_ver[0] == 0;
 }
 EOF
-  if cc_check -lmng -lz $_ld_lm ; then
+  if cc_check -lmng -llcms -ljpeg -lz -lm $_ld_lm ; then
     _mng=yes
   fi
 fi
 echores "$_mng"
 if test "$_mng" = yes ; then
   def_mng='#define CONFIG_MNG 1'
-  extra_ldflags="$extra_ldflags -lmng -lz"
+  extra_ldflags="$extra_ldflags -lmng -llcms -ljpeg -lz -lm"
 else
   def_mng='#undef CONFIG_MNG'
 fi
@@ -5510,6 +5516,7 @@ fi
 if test "$_jack" = yes ; then
   def_jack='#define CONFIG_JACK 1'
   _aomodules="jack $_aomodules"
+  libs_mplayer="$libs_mplayer $(pkg-config --libs jack)"
 else
   _noaomodules="jack $_noaomodules"
 fi
@@ -5672,6 +5679,26 @@ fi
 echores "$_sunaudio"
 
 
+echocheck "sndio audio"
+if test "$_sndio" = auto ; then
+  cat > $TMPC << EOF
+#include <sndio.h>
+int main(void) { struct sio_par par; sio_initpar(&par); return 0; }
+EOF
+  _sndio=no
+  cc_check -lsndio && _sndio=yes
+fi
+if test "$_sndio" = yes ; then
+  def_sndio='#define CONFIG_SNDIO_AUDIO 1'
+  _aomodules="sndio $_aomodules"
+  extra_ldflags="$extra_ldflags -lsndio"
+else
+  def_sndio='#undef CONFIG_SNDIO_AUDIO'
+  _noaomodules="sndio $_noaomodules"
+fi
+echores "$_sndio"
+
+
 def_mlib='#define CONFIG_MLIB 0'
 if sunos; then
 echocheck "Sun mediaLib"
@@ -5767,7 +5794,7 @@ elif dragonfly ; then
 elif freebsd ; then
   default_cdrom_device="/dev/acd0"
 elif openbsd ; then
-  default_cdrom_device="/dev/rcd0a"
+  default_cdrom_device="/dev/rcd0c"
 elif sunos ; then
   default_cdrom_device="/vol/dev/aliases/cdrom0"
   # Modern Solaris versions use HAL instead of the vold daemon, the volfs
@@ -6507,7 +6534,7 @@ if test "$_libdca" = auto ; then
 #include <dts.h>
 int main(void) { dts_init(0); return 0; }
 EOF
-  for _ld_dca in -ldts -ldca ; do
+  for _ld_dca in -ldca ; do
     cc_check $_ld_dca $_ld_lm && extra_ldflags="$extra_ldflags $_ld_dca" \
       && _libdca=yes && break
   done
@@ -6557,7 +6584,7 @@ int main(void) { unsigned long x, y; faacEncOpen(48000
 EOF
   _faac=no
   for _ld_faac in "-lfaac" "-lfaac -lmp4v2 -lstdc++" ; do
-    cc_check -O4 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
+    cc_check $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
   done
 fi
 if test "$_faac" = yes ; then
@@ -7560,6 +7587,15 @@ if test "$_tv_v4l2" = auto ; then
 int main(void) { return 0; }
 EOF
     cc_check && _tv_v4l2=yes
+  else
+    cat > $TMPC <<EOF
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/videoio.h>
+int main(void) { return 0; }
+EOF
+    cc_check && _tv_v4l2=yes
   fi
 fi
 if test "$_tv_v4l2" = yes ; then
@@ -8303,6 +8339,7 @@ SPEEX = $_speex
 STREAM_CACHE = $_stream_cache
 SGIAUDIO = $_sgiaudio
 SUNAUDIO = $_sunaudio
+SNDIO = $_sndio
 SVGA = $_svga
 TDFXFB = $_tdfxfb
 TDFXVID = $_tdfxvid
@@ -8677,6 +8714,7 @@ $def_ossaudio_devmixer
 $def_pulse
 $def_sgiaudio
 $def_sunaudio
+$def_sndio
 $def_win32waveout
 
 $def_ladspa
