automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-358-


From: Peter Rosin
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-358-g7b0ff55
Date: Tue, 21 Sep 2010 19:12:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=7b0ff55f0ba84bbb4fad6e2af4d1c3bf03d6cfb8

The branch, master has been updated
       via  7b0ff55f0ba84bbb4fad6e2af4d1c3bf03d6cfb8 (commit)
       via  0431dc4403e5c611bc1009f0cf47b20f26407994 (commit)
      from  35597a759c91a414460eb8d4f9e138a64f317944 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7b0ff55f0ba84bbb4fad6e2af4d1c3bf03d6cfb8
Merge: 35597a7 0431dc4
Author: Peter Rosin <address@hidden>
Date:   Tue Sep 21 21:11:00 2010 +0200

    Merge branch 'msvc'

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |   14 +++++++
 lib/compile         |   36 +++++++++++++++++--
 tests/Makefile.am   |    1 +
 tests/Makefile.in   |    1 +
 tests/compile3.test |    2 +-
 tests/compile6.test |   98 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 148 insertions(+), 4 deletions(-)
 create mode 100755 tests/compile6.test

diff --git a/ChangeLog b/ChangeLog
index 6c0402e..1d4d7d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-21  Peter Rosin  <address@hidden>
+
+       compile: implement library search to support MSVC static linking
+       * lib/compile (func_cl_wrapper): Implement library search and
+       -static option so that the user can select whether to prefer
+       dll import libraries or static libraries.  This enables MSVC to
+       link against dlls generated by libtool without requiring libtool
+       or workarounds such as -lfoo.dll etc.  Makes the tests/static.at
+       test case in libtool pass.
+       * tests/compile3.test: Don't trip up if there happens to exist
+       a "foo" library in the library search path.
+       * tests/compile6.test: New test, verifying the library search.
+       * tests/Makefile.am (TESTS): Update.
+
 2010-09-17  Eric Blake  <address@hidden>
 
        Avoid triple-space after period.
diff --git a/lib/compile b/lib/compile
index 77f8f31..46caccc 100755
--- a/lib/compile
+++ b/lib/compile
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand `-c -o'.
 
-scriptversion=2010-08-31.19; # UTC
+scriptversion=2010-09-21.14; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
 # Foundation, Inc.
@@ -80,10 +80,12 @@ func_file_conv ()
 }
 
 # func_cl_wrapper cl arg...
-# Adjust compile command to suite cl
+# Adjust compile command to suit cl
 func_cl_wrapper ()
 {
   # Assume a capable shell
+  lib_path=
+  shared=:
   linker_opts=
   for arg
   do
@@ -113,13 +115,41 @@ func_cl_wrapper ()
          shift
          ;;
        -l*)
-         set x "$@" "${1#-l}.lib"
+         lib=${1#-l}
+         found=no
+         save_IFS=$IFS
+         IFS=';'
+         for dir in $lib_path $LIB
+         do
+           IFS=$save_IFS
+           if $shared && test -f "$dir/$lib.dll.lib"; then
+             found=yes
+             set x "$@" "$dir/$lib.dll.lib"
+             break
+           fi
+           if test -f "$dir/$lib.lib"; then
+             found=yes
+             set x "$@" "$dir/$lib.lib"
+             break
+           fi
+         done
+         IFS=$save_IFS
+
+         test "$found" != yes && set x "$@" "$lib.lib"
          shift
          ;;
        -L*)
          func_file_conv "${1#-L}"
+         if test -z "$lib_path"; then
+           lib_path=$file
+         else
+           lib_path="$lib_path;$file"
+         fi
          linker_opts="$linker_opts -LIBPATH:$file"
          ;;
+       -static)
+         shared=false
+         ;;
        -Wl,*)
          arg=${1#-Wl,}
          save_ifs="$IFS"; IFS=','
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9e43f33..fefb4c2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -182,6 +182,7 @@ compile2.test \
 compile3.test \
 compile4.test \
 compile5.test \
+compile6.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index d75d6c2..1537318 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -393,6 +393,7 @@ compile2.test \
 compile3.test \
 compile4.test \
 compile5.test \
+compile6.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
diff --git a/tests/compile3.test b/tests/compile3.test
index b77237b..e376800 100755
--- a/tests/compile3.test
+++ b/tests/compile3.test
@@ -31,7 +31,7 @@ END
 chmod +x ./cl
 
 # Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl,
-opts=`./compile ./cl foo.c -o foo -lbar -Lgazonk -Ibaz -Xlinker foobar 
-Wl,-foo,bar`
+opts=`LIB= ./compile ./cl foo.c -o foo -lbar -Lgazonk -Ibaz -Xlinker foobar 
-Wl,-foo,bar`
 test x"$opts" = x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar -foo 
bar"
 
 # Check if compile handles "-o foo.obj"
diff --git a/tests/compile6.test b/tests/compile6.test
new file mode 100755
index 0000000..0f09e84
--- /dev/null
+++ b/tests/compile6.test
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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, or (at your option)
+# any later version.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure `compile' searches libraries correctly
+
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/compile" .
+
+# Use a dummy cl, since cl isn't readily available on all systems
+cat >cl <<'END'
+#! /bin/sh
+echo "$@"
+END
+
+chmod +x ./cl
+
+mkdir syslib
+:> syslib/foo.lib
+
+syslib=`pwd`/syslib
+LIB=$syslib
+export LIB
+
+mkdir lib
+:> lib/bar.lib
+:> lib/bar.dll.lib
+
+# Check if compile library search correctly
+opts=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib"
+
+# Check if -static makes compile avoid bar.dll.lib
+opts=`./compile ./cl foo.c -o foo -Llib -static -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link -LIBPATH:lib"
+
+:> syslib/bar.lib
+:> syslib/bar.dll.lib
+
+# Check if compile finds bar.dll.lib in syslib
+opts=`./compile ./cl foo.c -o foo -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib"
+
+# Check if compile prefers -L over $LIB
+opts=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib"
+
+mkdir lib2
+:> lib2/bar.dll.lib
+
+# Check if compile avoids bar.dll.lib in lib2 when -static
+opts=`./compile ./cl foo.c -o foo -Llib2 -static -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link 
-LIBPATH:lib2"
+
+# Check if compile gets two different bar libraries when -static
+# is added in the middle
+opts=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -static -lbar`
+test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib lib/bar.lib -link 
-LIBPATH:lib2 -LIBPATH:lib"
+
+# Check if compile gets the correct bar.dll.lib
+opts=`./compile ./cl foo.c -o foo -Llib -Llib2 -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib -LIBPATH:lib2"
+
+# Check if compile gets the correct bar.dll.lib
+opts=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib2 -LIBPATH:lib"
+
+mkdir "sys  lib2"
+:> "sys  lib2/foo.dll.lib"
+
+syslib2="`pwd`/sys  lib2"
+LIB="$syslib2;$LIB"
+
+# Check if compile handles spaces in $LIB and that it prefers the order
+# in a multi-component $LIB.
+opts=`./compile ./cl foo.c -o foo -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib2/foo.dll.lib"
+
+# Check if compile handles the 2nd directory in a multi-component $LIB.
+opts=`./compile ./cl foo.c -o foo -static -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib"
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]