$OpenBSD: patch-m4_lib-link_m4,v 1.2 2009/01/07 16:35:08 jasper Exp $
--- m4/lib-link.m4.orig	Tue Dec 23 14:20:59 2008
+++ m4/lib-link.m4	Tue Dec 23 14:37:44 2008
@@ -199,12 +199,14 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
           found_a=
           if test $use_additional = yes; then
             if test -n "$shlibext" \
-               && { test -f "$additional_libdir/lib$name.$shlibext" \
+               && { test "`echo $additional_libdir/lib$name.$shlibext*`" != \
+	       "$additional_libdir/lib$name.$shlibext*" \
                     || { test "$shlibext" = dll \
                          && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
               found_dir="$additional_libdir"
-              if test -f "$additional_libdir/lib$name.$shlibext"; then
-                found_so="$additional_libdir/lib$name.$shlibext"
+              if test "`echo $additional_libdir/lib$name.$shlibext*`" != \
+		      "$additional_libdir/lib$name.$shlibext*"; then
+                found_so="-l$name"
               else
                 found_so="$additional_libdir/lib$name.dll.a"
               fi
@@ -228,12 +230,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
                 -L*)
                   dir=`echo "X$x" | sed -e 's/^X-L//'`
                   if test -n "$shlibext" \
-                     && { test -f "$dir/lib$name.$shlibext" \
+                     && { test "`echo $dir/lib$name.$shlibext*`" != "$dir/lib$name.$shlibext*" \
                           || { test "$shlibext" = dll \
                                && test -f "$dir/lib$name.dll.a"; }; }; then
                     found_dir="$dir"
-                    if test -f "$dir/lib$name.$shlibext"; then
-                      found_so="$dir/lib$name.$shlibext"
+                    if test "`echo $dir/lib$name.$shlibext*`" != "$dir/lib$name.$shlibext*"; then
+                      found_so="-l$name"
                     else
                       found_so="$dir/lib$name.dll.a"
                     fi
