$OpenBSD: patch-configure_ac,v 1.14 2012/06/27 06:15:47 espie Exp $
--- configure.ac.orig	Sat Jun  9 18:40:10 2012
+++ configure.ac	Wed Jun 27 08:12:38 2012
@@ -558,9 +558,9 @@ t q
 b
 :q
 q"
-x_lib_location="`ls -1 "${x_libraries:-/usr/local/lib}/libX11.so"* "${x_libraries:-/usr/lib}/libX11.so"* 2>/dev/null | sed -e \"${soname_script}\"`"
+x_lib_location="`ls -1 "${x_libraries:-/usr/local/lib}/libX11.so"* "${x_libraries:-/usr/lib}/libX11.so"* 2>/dev/null | sed 1q`"
 AC_DEFINE_UNQUOTED([LIBX11_SO], "${x_lib_location:-libX11.so}", [The soname of libX11, needed for dlopen()])
-x_lib_location="`ls -1 "${x_libraries:-/usr/local/lib}/libXv.so"*  "${x_libraries:-/usr/lib}/libXv.so"*  2>/dev/null | sed -e \"${soname_script}\"`"
+x_lib_location="`ls -1 "${x_libraries:-/usr/local/lib}/libXv.so"*  "${x_libraries:-/usr/lib}/libXv.so"*  2>/dev/null | sed 1q`"
 AC_DEFINE_UNQUOTED([LIBXV_SO],  "${x_lib_location:-libXv.so}",  [The soname of libXv, needed for dlopen()])
 
 
@@ -1369,7 +1369,7 @@ if test "x$enable_musepack" = "xno"; then
    AC_MSG_RESULT([musepack support disabled])
 elif test "x$with_external_libmpcdec" = "xyes"; then
    AC_CHECK_LIB([mpcdec], [mpc_demux_decode], [have_mpcdec=yes],
-   [AC_CHECK_LIB([mpcdec], [mpc_decoder_decode], [have_mpcdec=yes])])
+   [AC_CHECK_LIB([mpcdec], [mpc_decoder_decode], [have_mpcdec=yes])], [-lm])
    AC_CHECK_HEADERS([mpc/mpcdec.h], [],
    [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [], [have_mpcdec=no])])
    if test "x$have_mpcdec" != "xyes"; then
@@ -1395,9 +1395,10 @@ if test "x$with_mng" = "xyes"; then
   AC_CHECK_LIB(mng, mng_initialize,
 	[ AC_CHECK_HEADER(libmng.h,
 		[ have_libmng=yes
-		  MNG_LIBS="-lmng" ], 
+		  MNG_LIBS="-lmng -llcms -ljpeg -lz -lm" ], 
 		AC_MSG_RESULT([*** All libmng dependent parts will be disabled ***]))],
-	AC_MSG_RESULT([*** All libmng dependent parts will be disabled ***]))
+	AC_MSG_RESULT([*** All libmng dependent parts will be disabled ***]),
+	[-llcms -ljpeg -lz -lm])
   AC_SUBST(MNG_LIBS)
 else
   have_libmng=no
@@ -2255,7 +2256,7 @@ if test "x$some_snprintf" != "xyes" -o \
   AC_MSG_ERROR([required function not found])
 fi
 AC_FUNC_FSEEKO
-AC_CHECK_HEADERS(assert.h byteswap.h malloc.h execinfo.h ucontext.h sys/mman.h sys/mixer.h libgen.h netdb.h dirent.h sys/times.h sys/ioctl.h sys/param.h alloca.h)
+AC_CHECK_HEADERS(assert.h byteswap.h malloc.h ucontext.h sys/mman.h sys/mixer.h libgen.h netdb.h dirent.h sys/times.h sys/ioctl.h sys/param.h alloca.h)
 AC_REPLACE_FUNCS(asprintf basename gettimeofday setenv strcasestr strndup strpbrk strsep strtok_r timegm unsetenv memmem)
 
 AC_LIBSOURCE(hstrerror.c)
