$NetBSD: patch-ag,v 1.5 2001/10/26 10:58:03 skrll Exp $

--- ltcf-cxx.sh.orig	Wed May 23 05:05:06 2001
+++ ltcf-cxx.sh
@@ -383,7 +383,23 @@
     esac
     ;;
   netbsd*)
-    # NetBSD uses g++ - do we need to do anything?
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      # Surely {pre|post}dep_objects should be added here!
+      archive_cmds='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      # Determine if we need to override the c++rt0 that is
+      # picked up by analysing output_verbose_link_cmds
+      if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then
+        cpprt0_file="${PREFIX}/lib/c++rt0/c++rt0.o.PIC"
+      else
+        cpprt0_file=
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpathvar_var=no
+    fi
+    # Workaround for some pre-1.5 ELF toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep conftest.$objext | sed -e "s/-lgcc -lc -lgcc//"'
     ;;
   osf3*)
     if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
@@ -982,6 +998,14 @@
 
     esac
   done
+
+  case "$host_os" in
+  netbsd*)
+    if test -n "$cpprt0_file"; then
+      predep_objects=`eval echo $predep_objects | sed -e 's:/usr/lib/c++rt0.o:$cpprt0_file:'`
+    fi
+    ;;
+  esac
 
   # Clean up.
   rm -f a.out
