$NetBSD: patch-aa,v 1.17 2013/03/25 02:55:59 sbd Exp $

--- configure.in.orig	2013-03-07 10:48:37.000000000 +0000
+++ configure.in
@@ -2097,6 +2097,9 @@ ia64*-hpux*)
     if test -z "$MC"; then
         MC=mc.exe
     fi
+    if test "$LIBRUNPATH"; then
+	DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
+    fi
     ;;
 *-mingw*)
     DSO_CFLAGS=
@@ -3035,6 +3038,9 @@ dnl ====================================
 case $target in
 *-hpux11.*)
 	;;
+*-dragonfly*)
+	AC_CHECK_LIB(c, gethostbyname_r)
+	;;
 *)
 	AC_CHECK_LIB(c_r, gethostbyname_r)
 	;;
@@ -3336,6 +3342,9 @@ AC_CACHE_CHECK(
         #ifdef linux
         #define _BSD_SOURCE 1
         #endif
+	#ifdef __NetBSD__
+	#error use of global _res variable in threaded programs is not portable
+	#endif
         #include <resolv.h>
         ],
         [int foo = res_ninit(&_res);],
@@ -4006,6 +4015,14 @@ if test -n "$YASM"; then
   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
 fi
 
+if test -n "${LIBXUL_SDK_DIR}"; then
+    AC_MSG_WARN([pkgsrc: LIBXUL_SDK_DIR is set; assuming we want nss and nspr from xulrunner.])
+    NSPR_CFLAGS="-I${prefix}/include/xulrunner/unstable `pkg-config --cflags mozilla-nspr`"
+    NSPR_LIBS="`pkg-config --libs mozilla-nspr`"
+    NSS_CFLAGS="`pkg-config --cflags mozilla-nss`"
+    NSS_LIBS="`pkg-config --libs mozilla-nss`"
+fi
+
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 dnl system JPEG support
 dnl ========================================================
@@ -5260,8 +5277,8 @@ AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
 AC_SUBST(MOZ_SCTP)
 AC_SUBST(MOZ_SRTP)
 
-case "$target_cpu" in
-arm*)
+case "$target" in
+arm-*-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
     MOZ_SAMPLE_TYPE_S16=1
     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
@@ -5628,7 +5645,7 @@ dnl ====================================
 
 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
-    PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
+    PKG_CHECK_MODULES(MOZ_ALSA, alsa, MOZ_ALSA=1,
          [echo "$MOZ_ALSA_PKG_ERRORS"
           AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux.  Disable with --disable-ogg --disable-wave --disable-webm.  (On Ubuntu, you might try installing the package libasound2-dev.)])])
 fi
@@ -8750,6 +8767,7 @@ AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
 AC_SUBST(MOZ_VP8_ENCODER)
 AC_SUBST(MOZ_VP8)
 AC_SUBST(MOZ_OGG)
+AC_SUBST(MOZ_ALSA)
 AC_SUBST(MOZ_ALSA_LIBS)
 AC_SUBST(MOZ_ALSA_CFLAGS)
 AC_SUBST(VPX_AS)
