$OpenBSD: patch-ltmain_sh,v 1.1.1.1 2005/01/09 17:07:52 mbalmer Exp $
--- ltmain.sh.orig	Tue Jun 24 00:48:14 2003
+++ ltmain.sh	Tue Jun 24 00:50:20 2003
@@ -1035,39 +1035,45 @@ compiler."
 	;;
 
       -l*)
-	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
-	  case $host in
-	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
-	    # These systems don't actually have a C or math library (as such)
-	    continue
-	    ;;
-	  *-*-mingw* | *-*-os2*)
-	    # These systems don't actually have a C library (as such)
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-openbsd* | *-*-freebsd*)
-	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  esac
-	 # This change is required for -lc_r under FreeBSD / Tomasz Kojm
-	 #elif test "X$arg" = "X-lc_r"; then
-	 # case $host in
-	 #*-*-openbsd* | *-*-freebsd*)
-	 #   # Do not include libc_r directly, use -pthread flag.
-	 #   continue
-	 #   ;;
-	 # esac
-	fi
-	deplibs="$deplibs $arg"
-	continue
-	;;
+        if test "$arg" = "-lc"; then
+          case "$host" in
+          *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+            # These systems don't actually have c library (as such)
+            continue
+            ;;
+          *-*-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
+        elif test "$arg" = "-lm"; then
+          case "$host" in
+          *-*-cygwin* | *-*-beos*)
+            # These systems don't actually have math library (as such)
+            continue
+            ;;
+          esac
+        fi
+        deplibs="$deplibs $arg"
+        ;;
 
-      # We need this change for old -pthread *BSD style / Tomasz Kojm
       -pthread)
-      	deplibs="$deplibs -pthread"
-      	continue
-      	;;
+        case $host in
+        *-*-openbsd*)
+          deplibs="$deplibs $arg"
+          ;;
+        *)
+          continue
+          ;;
+        esac
+        ;;
 
       -module)
 	module=yes
