On Wed, 24 Feb 2010 22:31:07 +0100
Ralf Wildenhues <ralf.wildenh...@gmx.de> wrote:

> I managed to send out a broken version of the patch.  Please forget that
> one, this one has a testcase that should work better.  Can you retry
> with it?  You can use something like
> 
>   make all check-local TESTSUITEFLAGS='-v -d -x -k "deplibs without file 
> command"'
> 
> and it should pass if your libtool.m4 change is included and fail
> without.  With a cross compiler and wine, it skips, native it should
> fail, but I can't test that ATM.
> 

I'm afraid I don't understand the principle of your test, as it seems
to me that it should succeed in every case (it'll just link against a
static libb instead of a dynamic one).

I've changed the test to instead try to determine if it was able to
create a dynamic libb or not. It does this by looking at the
library_names field in libb.la.

I've confirmed that this test catches the bug here.

diff --git a/Makefile.am b/Makefile.am
index 29a639a..a7de46d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -504,7 +504,8 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/configure-iface.at \
                  tests/stresstest.at \
                  tests/cmdline_wrap.at \
-                 tests/darwin.at
+                 tests/darwin.at \
+                 tests/deplibs-mingw.at
 
 EXTRA_DIST     += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) 
$(srcdir)/tests/package.m4
 
diff --git a/tests/deplibs-mingw.at b/tests/deplibs-mingw.at
new file mode 100644
index 0000000..55a88fc
--- /dev/null
+++ b/tests/deplibs-mingw.at
@@ -0,0 +1,91 @@
+# deplibs-mingw.at --                         -*- Autotest -*-
+
+#   Copyright (C) 2010 Free Software Foundation, Inc.
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+# Check that deplibs are detected correctly even if there is no `file'
+# command installed.
+
+AT_SETUP([deplibs without file command])
+AT_KEYWORDS([libtool])
+
+cwd=`pwd`
+instdir=$cwd/inst
+libdir=$instdir/lib
+bindir=$instdir/bin
+LDFLAGS="$LDFLAGS -no-undefined"
+
+mkdir inst inst/bin inst/lib
+
+AT_DATA([a.c],
+[[int a () { return 0; }
+]])
+AT_DATA([b.c],
+[[extern int a ();
+int b () { return a (); }
+]])
+
+for file in a.c b.c; do
+  $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
+done
+AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath 
$libdir],
+        [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir], [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --mode=clean rm -f liba.la], [], [ignore], [ignore])
+rm -f $libdir/liba.la
+
+# check once with `file' (if present) and once without, if on MinGW.
+for try in with-file without-file; do
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath 
$libdir ]dnl
+          [-L$libdir -la],
+          [], [ignore], [ignore])
+  AT_CHECK([. libb.la && if test -z "$library_names"; then exit 99; fi ],
+          [], [ignore], [ignore])
+
+  case $host_os in
+  mingw*)
+    if file /; then
+      mkdir bin new-libtool
+
+      cat >bin/file <<\EOF
+#! /bin/sh
+exit 1
+EOF
+      chmod +x bin/file
+      PATH=`pwd`/bin${PATH_SEPARATOR-:}$PATH
+      cd new-libtool
+      AT_CHECK(["$abs_top_srcdir"/configure $configure_options || exit 77],
+              [], [ignore], [ignore])
+      cd ..
+      LIBTOOL=new-libtool/libtool
+      export LIBTOOL
+      # Check whether the generated script is usable; otherwise, skip.
+      AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libunrelated.la 
a.lo -rpath $libdir] dnl
+              [|| exit 77], [], [ignore], [ignore])
+    else
+      break;
+    fi;;
+  *)
+    break;;
+  esac
+done
+
+AT_CLEANUP


-- 
Pierre Ossman            OpenSource-based Thin Client Technology
System Developer         Telephone: +46-13-21 46 00
Cendio AB                Web: http://www.cendio.com

Attachment: signature.asc
Description: PGP signature

Reply via email to