$NetBSD: patch-ag,v 1.3 2001/04/15 18:10:47 manu Exp $
--- hints/netbsd.sh.orig	Sun Feb  6 15:57:09 2000
+++ hints/netbsd.sh	Sat Apr  7 22:23:39 2001
@@ -20,9 +20,13 @@
 *)
 	if [ -f /usr/libexec/ld.elf_so ]; then
 		d_dlopen=$define
 		d_dlerror=$define
-		ccdlflags="-Wl,-E -Wl,-R${PREFIX}/lib $ccdlflags"
+		# Include the whole libgcc.a, requiered for Xerces-P, which 
+		# needs __eh_alloc, __pure_virtual, and others. This should 
+		# be obsoleted by gcc-3.0
+		ccdlflags="-Wl,-whole-archive -lgcc -Wl,-no-whole-archive \
+		    -Wl,-E -Wl,-R${PREFIX}/lib $ccdlflags"
 		cccdlflags="-DPIC -fPIC $cccdlflags"
 		lddlflags="--whole-archive -shared $lddlflags"
 	elif [ "`uname -m`" = "pmax" ]; then
 # NetBSD 1.3 and 1.3.1 on pmax shipped an `old' ld.so, which will not work.
@@ -61,8 +65,25 @@
 # there's no problem with vfork.
 case "$usevfork" in
 '') usevfork=true ;;
 esac
+
+# Using perl's malloc leads to trouble on some toolchain versions...
+test "$usemymalloc" || usemymalloc='n'
+
+# The toolchain on sparc64 is not realy production quality right now,
+# but gcc 2.96 is supposed to fix most problems.
+# The -g triggers -DDEBUGGING, which plays the real trick and circumvents
+# code generation bugs. So we add -g everywhere, to at least have a
+# realy debuggable build.
+if [ "`uname -m`" = "sparc64" ]; then
+	if $cc -v 2>&1 | grep "gcc version" | grep "2.95.2" > /dev/null; then
+		ccdlflags="-g $ccdlflags"
+		cccdlflags="-g $cccdlflags"
+		lddlflags="-g $lddlflags"
+		optimize='-g -msoft-quad-float -O2 -DGCC2952_SPARC64_WORKAROUND'
+	fi
+fi
 
 # Pre-empt the /usr/bin/perl question of installperl.
 installusrbinperl='n'
 
