--- ltmain.sh.orig	Thu Sep 25 08:22:11 1997
+++ ltmain.sh	Tue Feb 20 20:16:56 2001
@@ -365,7 +365,28 @@
 	deplibs="$deplibs $arg"
 	;;
 
-      -l*) deplibs="$deplibs $arg" ;;
+      -l*)
+        if test "$arg" = "-lc"; then
+          case "$host" in
+          *-*-openbsd*)
+            # Do not include libc due to us having libc/libc_r.
+            continue
+            ;;
+          esac
+        elif test "$arg" = "-lc_r"; then
+          case "$host" in
+          *-*-openbsd*)
+            # Do not include libc_r directly, use -pthread flag.
+            continue
+            ;;
+          esac
+        fi
+        deplibs="$deplibs $arg"
+        ;;
+ 
+      -?thread)
+        deplibs="$deplibs $arg"
+        ;;
 
       -o) prev=output ;;
 
@@ -1575,11 +1596,6 @@
       done
     fi
 
-    echo "To link against installed libraries in LIBDIR, users may have to:"
-    if test -n "$shlibpath_var"; then
-      echo "   - add LIBDIR to their \`$shlibpath_var' environment variable"
-    fi
-    echo "   - use the \`-LLIBDIR' linker flag"
     exit 0
     ;;
 
