$NetBSD: patch-ab,v 1.11 2000/09/14 10:20:46 skrll Exp $

--- ltmain.in.orig	Sat May 27 02:53:15 2000
+++ ltmain.in
@@ -819,6 +819,7 @@
     old_convenience=
     deplibs=
     linkopts=
+    wllinkopts=
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
@@ -1154,6 +1155,25 @@
 	continue
 	;;
 
+      -Wl,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+       arg=
+       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case "$flag" in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         linkopts="$linkopts $flag"
+         wllinkopts="$wllinkopts $wl$flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
       # Some other compiler flag.
       -* | +*)
 	# Unknown arguments in both finalize_command and compile_command need
@@ -2146,6 +2166,7 @@
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
 	  linkopts="$linkopts $flag"
+          wllinkopts="$wllinkopts $wl$flag"
 	fi
 
 	# Do each of the archive commands.
