$OpenBSD: patch-configure_in,v 1.34 2013/01/11 15:12:55 zhuk Exp $
--- configure.in.orig	Wed Aug 20 19:46:24 2008
+++ configure.in	Tue Nov 20 18:41:22 2012
@@ -164,22 +164,22 @@ AC_DEFUN([KDE_CHECK_OGGVORBIS],
     [:], [have_oggvorbis=no])
 
   KDE_CHECK_LIB(vorbis, vorbis_info_init,
-    [:], [have_oggvorbis=no])
+    [:], [have_oggvorbis=no], -logg -lm)
 
   KDE_CHECK_LIB(vorbisfile, ov_open,
-    [:], [have_oggvorbis=no], -lvorbis -logg)
+    [:], [have_oggvorbis=no], -lvorbis -logg -lm)
 
   KDE_CHECK_LIB(vorbisenc, vorbis_encode_init,
-    [:], [have_oggvorbis=no], -lvorbis -logg)
+    [:], [have_oggvorbis=no], -lvorbis -logg -lm)
 
   KDE_CHECK_LIB(vorbis, vorbis_bitrate_addblock,
-    [have_vorbis_value=2], [have_vorbis_value=1])
+    [have_vorbis_value=2], [have_vorbis_value=1], -lvorbis -logg -lm)
 
   if test "x$have_oggvorbis" = xyes; then
     # for akode/plugins/xiph_decoder/ kioslave/audiocd/plugins/ and krec/ogg_export/
-    VORBIS_LIBS="-lvorbis -logg"
-    VORBISFILE_LIBS="-lvorbisfile"
-    VORBISENC_LIBS="-lvorbisenc"
+    VORBIS_LIBS="-lvorbis -logg -lm"
+    VORBISFILE_LIBS="-lvorbisfile -lm"
+    VORBISENC_LIBS="-lvorbisenc -lm"
 
     # for akode/plugins/xiph_decoder/
     AC_DEFINE_UNQUOTED(HAVE_OGG_VORBIS, 1, [Define if you have ogg/vorbis installed])
@@ -188,7 +188,7 @@ AC_DEFUN([KDE_CHECK_OGGVORBIS],
     AC_DEFINE_UNQUOTED(HAVE_VORBIS, $have_vorbis_value, [Define if you ogg/vorbis installed])
 
     # for mpeglib/
-    OGG_VORBISLIBS="-lvorbisfile -lvorbis -logg"
+    OGG_VORBISLIBS="-lvorbisfile -lvorbis -logg -lm"
     AC_DEFINE(OGG_VORBIS, 1, [Define if you have ogg/vorbis installed])
   fi
 
@@ -628,10 +628,13 @@ if test x$build_arts != xyes || test x$have_akode != x
 then
   DO_NOT_COMPILE="$DO_NOT_COMPILE akode_artsplugin"
 else
-  KDE_CHECK_LIB(akode_mpeg_decoder,   mpeg_decoder,   have_akode_mpeg=yes,   have_akode_mpeg=no,   -lakode)
-  KDE_CHECK_LIB(akode_mpc_decoder,    mpc_decoder,    have_akode_mpc=yes,    have_akode_mpc=no,    -lakode)
-  KDE_CHECK_LIB(akode_xiph_decoder,   xiph_decoder,   have_akode_xiph=yes,   have_akode_xiph=no,   -lakode)
-  KDE_CHECK_LIB(akode_ffmpeg_decoder, ffmpeg_decoder, have_akode_ffmpeg=yes, have_akode_ffmpeg=no, -lakode)
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  KDE_CHECK_LIB(akode_mpeg_decoder,   mpeg_decoder,   have_akode_mpeg=yes,   have_akode_mpeg=no,   $akode_libs)
+  KDE_CHECK_LIB(akode_mpc_decoder,    mpc_decoder,    have_akode_mpc=yes,    have_akode_mpc=no,    $akode_libs)
+  KDE_CHECK_LIB(akode_xiph_decoder,   xiph_decoder,   have_akode_xiph=yes,   have_akode_xiph=no,   $akode_libs)
+  KDE_CHECK_LIB(akode_ffmpeg_decoder, ffmpeg_decoder, have_akode_ffmpeg=yes, have_akode_ffmpeg=no, $akode_libs)
+  AC_LANG_RESTORE
 fi
 
 # This must always be called to handle the --without-akode case, as autoconf
@@ -910,7 +913,7 @@ KDE_CHECK_HEADER(theora/theora.h,
   [], [have_theora=no])
 
 KDE_CHECK_LIB(theora, theora_info_init,
-  [], [have_theora=no], [-lvorbis -logg])
+  [], [have_theora=no], [-lvorbis -logg -lm])
 ])
 
 AC_ARG_WITH(theora,
@@ -937,38 +940,20 @@ AC_DEFUN([AC_CHECK_LIBFLAC],
   AC_LANG_SAVE
   AC_LANG_C
   have_libFLAC=no
-  KDE_CHECK_HEADER(FLAC/metadata.h,
+  KDE_CHECK_HEADER(FLAC/stream_decoder.h,
   [
-     KDE_CHECK_LIB(FLAC,FLAC__seekable_stream_decoder_process_single,
-	          have_libFLAC=yes)
+     KDE_CHECK_LIB(FLAC,FLAC__stream_decoder_init_ogg_stream,
+	          have_libFLAC=yes,,[-logg])
 
     ])
   if test "x$have_libFLAC" = "xyes"; then
-      LIBFLAC="-lFLAC"
+      LIBFLAC="-lFLAC -logg"
       AC_DEFINE(HAVE_LIBFLAC, 1,
         [Define if you have libFLAC (required for loading FLAC files)])
-  fi
-  AC_SUBST(LIBFLAC)
-  AC_LANG_RESTORE
-])
-
-AC_DEFUN([AC_CHECK_LIBOGGFLAC],
-[
-  AC_LANG_SAVE
-  AC_LANG_C
-  have_libOggFLAC=no
-  KDE_CHECK_HEADER(OggFLAC/seekable_stream_decoder.h,
-  [
-     KDE_CHECK_LIB(OggFLAC,OggFLAC__seekable_stream_decoder_process_single,
-	          have_libOggFLAC=yes,,[-lm -lOggFLAC -lFLAC])
-
-    ])
-  if test "x$have_libOggFLAC" = "xyes"; then
-      LIBOGGFLAC="-lOggFLAC"
       AC_DEFINE(HAVE_LIBOGGFLAC, 1,
         [Define if you have libOggFLAC (required for loading OggFLAC files)])
   fi
-  AC_SUBST(LIBOGGFLAC)
+  AC_SUBST(LIBFLAC)
   AC_LANG_RESTORE
 ])
 
@@ -976,7 +961,6 @@ AC_ARG_WITH(flac,AC_HELP_STRING([--with-flac],[Enable 
 
 if test "x$flac_test" = "xyes" ; then
   AC_CHECK_LIBFLAC
-  AC_CHECK_LIBOGGFLAC
 fi
 dnl =======================================================
 dnl FILE: ./kmid/configure.in.in
@@ -1316,6 +1300,9 @@ case "$OS_TYPE" in
   NetBSD)
     kde_mpeglib_compiles=yes
     ;;
+  OpenBSD)
+    kde_mpeglib_compiles=yes
+    ;;
   Linux)
     kde_mpeglib_compiles=yes
     ;;
@@ -1346,6 +1333,12 @@ case "$OS_TYPE" in
     AC_DEFINE(OS_Linux,1,[Define if you have linux pthread])
     ;;
 
+  OpenBSD)
+    OS_TYPE="BSD"
+    AC_CHECK_LIB(c_r, pthread_create, [LIBPTHREAD="-pthread"])
+    AC_DEFINE(OS_BSD,1,[Define if you have BSD pthread])
+    ;;
+
   FreeBSD | DragonFly)
     OS_TYPE="BSD"
     AC_DEFINE(OS_BSD,1,[Define if you have BSD pthread])
@@ -1768,7 +1761,7 @@ dnl Check for new internal xine symbol names
 KDE_CHECK_LIB(xine, _x_ao_new_port, :, 
 [
   AC_DEFINE(_x_ao_new_port, ao_new_port, [Compatibility with older version of xine])
-])
+], -pthread)
 AC_CHECK_FUNC([ao_new_port])
 
 AC_ARG_WITH([xine],
