$OpenBSD: patch-ltconfig,v 1.1 2003/05/23 05:03:46 pvalchev Exp $
--- ltconfig.orig	Thu Feb 24 19:28:35 2000
+++ ltconfig	Mon May 19 19:19:34 2003
@@ -962,7 +962,9 @@ cygwin* | mingw*)
     with_gnu_ld=no
   fi
   ;;
-
+openbsd*)
+  with_gnu_ld=no
+  ;;
 esac
 
 ld_shlibs=yes
@@ -1292,10 +1294,28 @@ else
     ;;
 
   openbsd*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
+    case "$host_os" in
+    openbsd*)
+      archive_cmds="$archive_cmds~\$RANLIB -t \$lib"
+      postinstall_cmds='$RANLIB -t $lib'
+      ;;
+    *)
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+      ;;
+    esac
+    case "$host_cpu" in
+    m88k|hppa|vax)
+      ld_shlibs=no
+      ;;
+    *)
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts'
+      hardcode_libdir_flag_spec='${wl}-R$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+    esac
     ;;
 
   os2*)
@@ -1684,9 +1704,25 @@ netbsd*)
 
 openbsd*)
   version_type=sunos
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-    need_version=no
+  need_lib_prefix=no
+  need_version=yes
+  sys_lib_search_path_spec="/usr/lib"
+  sys_lib_dlsearch_path_spec="/usr/lib /usr/local/lib"
+  file_magic_cmd=/usr/bin/file
+  file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test "`echo __ELF__ | $CC -E - | grep __ELF__`" = "" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+    case "$host_os" in
+    openbsd2.[89] | openbsd2.[89].*)
+      shlibpath_overrides_runpath=no
+    ;;
+    *)
+      shlibpath_overrides_runpath=yes
+    ;;
+    esac
+  else
+    deplibs_check_method='file_magic OpenBSD.* shared library'
+    shlibpath_overrides_runpath=yes
   fi
   library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
