$NetBSD: patch-as,v 1.4 2013/10/20 18:17:04 joerg Exp $

Treat DragonFly like FreeBSD.
Do not allow access to _res on NetBSD.

--- js/src/configure.in.orig	2012-03-06 14:45:30.000000000 +0000
+++ js/src/configure.in
@@ -1193,8 +1193,8 @@ if test "$GNU_CC"; then
     ASFLAGS="$ASFLAGS -fPIC"
     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
-    _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
-    _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
+    _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
+    _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
 
     # Turn on GNU specific features
     # -Wall - turn on all warnings
@@ -1653,7 +1653,7 @@ case "$target" in
     fi
     ;;
 
-*-freebsd*)
+*-freebsd*|*-dragonfly*)
     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
 	DLL_SUFFIX=".so.1.0"
 	DSO_LDOPTS="-shared"
@@ -2509,7 +2509,7 @@ darwin*)
 solaris*)
     AC_DEFINE(AVMPLUS_UNIX)
     ;;
-freebsd*|kfreebsd*)
+freebsd*|kfreebsd*|netbsd*|dragonfly*)
     AC_DEFINE(AVMPLUS_UNIX)
     ;;
 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
@@ -2724,6 +2724,9 @@ if test "$GNU_CC"; then
   AC_CACHE_CHECK(for visibility(hidden) attribute,
                  ac_cv_visibility_hidden,
                  [cat > conftest.c <<EOF
+#ifdef __clang__
+#error Not supported by old Mozilla
+#endif
                   int foo __attribute__ ((visibility ("hidden"))) = 1;
 EOF
                   ac_cv_visibility_hidden=no
@@ -3182,7 +3185,11 @@ AC_CACHE_CHECK(
         #endif
         #include <resolv.h>
         ],
-        [int foo = res_ninit(&_res);],
+        [
+	#ifdef __NetBSD__
+	#error "_res is not usable in threaded programs"
+	#endif
+	int foo = res_ninit(&_res);],
         [ac_cv_func_res_ninit=yes],
         [ac_cv_func_res_ninit=no])
     ])
@@ -3416,13 +3423,7 @@ if test "$GNU_CXX"; then
   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
   [echo "int main() { return 0; }" | cat > conftest.C
 
-  ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
-
-  if egrep "warning.*renamed" conftest.out >/dev/null; then
-    ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
-  else
-    ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
-  fi
+  ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
 
   rm -f conftest*])
 
@@ -4150,7 +4151,7 @@ if test "$MOZ_MEMORY"; then
   darwin*)
     AC_DEFINE(MOZ_MEMORY_DARWIN)
     ;;
-  *freebsd*)
+  *freebsd*|dragonfly*)
     AC_DEFINE(MOZ_MEMORY_BSD)
     ;;
   *linux*)
