$NetBSD: patch-aa,v 1.14 2000/10/12 19:07:07 skrll Exp $

--- ltconfig.in.orig	Sat May 27 02:58:57 2000
+++ ltconfig.in
@@ -1194,11 +1194,17 @@
 
   netbsd*)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+      wlarc=
+      # Add in C++ constructor/destructor support
+      if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then
+        archive_cmds="$archive_cmds ${PREFIX}/lib/c++rt0/c++rt0.o.PIC"
+      elif test -f /usr/lib/c++rt0.o; then
+        archive_cmds="$archive_cmds /usr/lib/c++rt0.o"
+      fi
     else
-      archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
-      # can we support soname and/or expsyms with a.out? -oliva
+      archive_cmds='$CC -shared $libobjs $deplibs $wllinkopts ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $wllinkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     fi
     ;;
 
@@ -1392,11 +1398,19 @@
 
   netbsd*)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'  # a.out
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+      # Add in C++ constructor/destructor support
+      if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then
+        archive_cmds="$archive_cmds ${PREFIX}/lib/c++rt0/c++rt0.o.PIC"
+      elif test -f /usr/lib/c++rt0.o; then
+        archive_cmds="$archive_cmds /usr/lib/c++rt0.o"
+      fi
     else
+      # I don't think there are any ELF toolchains with non-gnu ld.
+      # I'm not touching this just in case!
       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts'      # ELF
     fi
-    hardcode_libdir_flag_spec='${wl}-R$libdir'
+    hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
     hardcode_shlibpath_var=no
     ;;
@@ -2012,6 +2026,9 @@
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
+    deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+    file_magic_cmd=/usr/bin/file
+    file_magic_test_file=`echo /usr/lib/libc.so*`
     library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
     soname_spec='${libname}${release}.so$major'
     dynamic_linker='NetBSD ld.elf_so'
@@ -2069,7 +2086,7 @@
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=sunos
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
