automake-commit
[Top][All Lists]
Advanced

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

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


From: Peter Rosin
Subject: [Automake-commit] [SCM] GNU Automake branch, branch-1.11, updated. v1.11.3-30-g0092d1f
Date: Tue, 06 Mar 2012 08:32:27 +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=0092d1f9114b740cc4bb64186f33429773355b45

The branch, branch-1.11 has been updated
       via  0092d1f9114b740cc4bb64186f33429773355b45 (commit)
       via  8902f83dcd7874d57d88f742bd4c62724634cc82 (commit)
      from  44565da0b256d670e8d1f8b62943099e2aafa0d2 (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 0092d1f9114b740cc4bb64186f33429773355b45
Merge: 44565da 8902f83
Author: Peter Rosin <address@hidden>
Date:   Tue Mar 6 09:24:49 2012 +0100

    Merge branch 'msvc' into branch-1.11
    
    * msvc:
      scripts: support -I <dir> -L <dir> and -l <lib> for cl in compile

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

Summary of changes:
 NEWS                |    4 ++
 lib/compile         |   91 ++++++++++++++++++++++++++++++--------------
 tests/compile3.test |   43 ++++++++++++---------
 tests/compile4.test |   11 ++++-
 tests/compile5.test |   25 +++++++-----
 tests/compile6.test |  103 +++++++++++++++++++++++++++------------------------
 6 files changed, 169 insertions(+), 108 deletions(-)

diff --git a/NEWS b/NEWS
index 12beca9..8570b10 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,10 @@ New in 1.11.3a:
     action is now a synonym for "r" (replace).  Also, the script has been
     ignoring the "v" (verbose) modifier already since Automake 1.11.3.
 
+  - When the 'compile' script is used to wrap MSVC, it now accepts an
+    optional space between the -I, -L and -l options and their respective
+    arguments, for better POSIX compliance.
+
 Bugs fixed in 1.11.3a:
 
 * Bugs introduced by 1.11.3:
diff --git a/lib/compile b/lib/compile
index b1f4749..862a14e 100755
--- a/lib/compile
+++ b/lib/compile
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-01-04.17; # UTC
+scriptversion=2012-03-05.13; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
 # Software Foundation, Inc.
@@ -79,6 +79,48 @@ func_file_conv ()
   esac
 }
 
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  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
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
 # func_cl_wrapper cl arg...
 # Adjust compile command to suit cl
 func_cl_wrapper ()
@@ -109,43 +151,34 @@ func_cl_wrapper ()
              ;;
          esac
          ;;
+       -I)
+         eat=1
+         func_file_conv "$2" mingw
+         set x "$@" -I"$file"
+         shift
+         ;;
        -I*)
          func_file_conv "${1#-I}" mingw
          set x "$@" -I"$file"
          shift
          ;;
+       -l)
+         eat=1
+         func_cl_dashl "$2"
+         set x "$@" "$lib"
+         shift
+         ;;
        -l*)
-         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"
+         func_cl_dashl "${1#-l}"
+         set x "$@" "$lib"
          shift
          ;;
+       -L)
+         eat=1
+         func_cl_dashL "$2"
+         ;;
        -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"
+         func_cl_dashL "${1#-L}"
          ;;
        -static)
          shared=false
diff --git a/tests/compile3.test b/tests/compile3.test
index 15064a6..5f2df7d 100755
--- a/tests/compile3.test
+++ b/tests/compile3.test
@@ -31,24 +31,29 @@ END
 
 chmod +x ./cl
 
-# Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl,
-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"
-opts=`./compile ./cl -c foo.c -o foo.obj -Ibaz`
-test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
-
-# Check if compile handles "-o foo.o"
-opts=`./compile ./cl -c foo.c -o foo.o -Ibaz`
-test x"$opts" = x"-c foo.c -Fofoo.o -Ibaz"
-
-# Check if compile handles "foo.cc" as C++.
-opts=`./compile ./cl -c foo.cc -o foo.o -Ibaz`
-test x"$opts" = x"-c -Tpfoo.cc -Fofoo.o -Ibaz"
-
-# Check if compile clears the "eat" variable properly.
-opts=`eat=1 ./compile ./cl -c foo.c -o foo.obj -Ibaz`
-test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
+# POSIX mandates that the compiler accepts a space between the -I,
+# -l and -L options and their respective arguments.  Traditionally,
+# this should work also without a space.  Try both usages.
+for sp in '' ' '; do
+  # Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl,
+  opts=`LIB= ./compile ./cl foo.c -o foo -l${sp}bar -L${sp}gazonk -I${sp}baz 
-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"
+  opts=`./compile ./cl -c foo.c -o foo.obj -I${sp}baz`
+  test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
+
+  # Check if compile handles "-o foo.o"
+  opts=`./compile ./cl -c foo.c -o foo.o -I${sp}baz`
+  test x"$opts" = x"-c foo.c -Fofoo.o -Ibaz"
+
+  # Check if compile handles "foo.cc" as C++.
+  opts=`./compile ./cl -c foo.cc -o foo.o -I${sp}baz`
+  test x"$opts" = x"-c -Tpfoo.cc -Fofoo.o -Ibaz"
+
+  # Check if compile clears the "eat" variable properly.
+  opts=`eat=1 ./compile ./cl -c foo.c -o foo.obj -I${sp}baz`
+  test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
+done
 
 :
diff --git a/tests/compile4.test b/tests/compile4.test
index 0b3e981..bac8a54 100755
--- a/tests/compile4.test
+++ b/tests/compile4.test
@@ -79,8 +79,15 @@ if test -f sub/libfoo.a; then
   cp sub/libfoo.a sub/foo.lib
 fi
 
-./compile cl $CFLAGS $LDFLAGS -L"$absfoodir" "$absmainobj" -o main -lfoo
+# POSIX mandates that the compiler accepts a space between the -I,
+# -l and -L options and their respective arguments.  Traditionally,
+# this should work also without a space.  Try both usages.
+for sp in '' ' '; do
+  rm -f main
 
-./main
+  ./compile cl $CFLAGS $LDFLAGS -L${sp}"$absfoodir" "$absmainobj" -o main 
-l${sp}foo
+
+  ./main
+done
 
 :
diff --git a/tests/compile5.test b/tests/compile5.test
index cd1468f..e80a76f 100755
--- a/tests/compile5.test
+++ b/tests/compile5.test
@@ -65,17 +65,22 @@ $AUTOMAKE -a
 
 pwd=`pwd`
 
-# Check if "compile cl" transforms absolute file names to
-# host format (e.g /somewhere -> c:/msys/1.0/somewhere).
+# POSIX mandates that the compiler accepts a space between the -I,
+# -l and -L options and their respective arguments.  Traditionally,
+# this should work also without a space.  Try both usages.
+for sp in '' ' '; do
+  # Check if "compile cl" transforms absolute file names to
+  # host format (e.g /somewhere -> c:/msys/1.0/somewhere).
 
-res=`./compile ./cl -L"$pwd" | sed -e 's/-link -LIBPATH://'`
+  res=`./compile ./cl -L${sp}"$pwd" | sed -e 's/-link -LIBPATH://'`
 
-case $res in
-  ?:[\\/]*)
-    ;;
-  *)
-    Exit 1
-    ;;
-esac
+  case $res in
+    ?:[\\/]*)
+      ;;
+    *)
+      Exit 1
+      ;;
+  esac
+done
 
 :
diff --git a/tests/compile6.test b/tests/compile6.test
index f45a534..c2eadc0 100755
--- a/tests/compile6.test
+++ b/tests/compile6.test
@@ -31,69 +31,76 @@ END
 
 chmod +x ./cl
 
-mkdir syslib
-:> syslib/foo.lib
+# POSIX mandates that the compiler accepts a space between the -I,
+# -l and -L options and their respective arguments.  Traditionally,
+# this should work also without a space.  Try both usages.
+for sp in '' ' '; do
+  rm -rf lib lib2 syslib "sys  lib2"
 
-syslib=`pwd`/syslib
-LIB=$syslib
-export LIB
+  mkdir syslib
+  :> syslib/foo.lib
 
-mkdir lib
-:> lib/bar.lib
-:> lib/bar.dll.lib
+  syslib=`pwd`/syslib
+  LIB=$syslib
+  export 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"
+  mkdir lib
+  :> lib/bar.lib
+  :> lib/bar.dll.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"
+  # Check if compile library search correctly
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib"
 
-:> syslib/bar.lib
-:> syslib/bar.dll.lib
+  # Check if -static makes compile avoid bar.dll.lib
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib -static -l${sp}bar -l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link 
-LIBPATH: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"
+  :> syslib/bar.lib
+  :> syslib/bar.dll.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"
+  # Check if compile finds bar.dll.lib in syslib
+  opts=`./compile ./cl foo.c -o foo -l${sp}bar -l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib"
 
-mkdir lib2
-:> lib2/bar.dll.lib
+  # Check if compile prefers -L over $LIB
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib -l${sp}bar -l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH: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"
+  mkdir lib2
+  :> lib2/bar.dll.lib
 
-# 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 avoids bar.dll.lib in lib2 when -static
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -static -l${sp}bar -l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link 
-LIBPATH:lib2"
 
-# 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 two different bar libraries when -static
+  # is added in the middle
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar -static 
-l${sp}bar`
+  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 -Llib2 -Llib -lbar -lfoo`
-test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib2 -LIBPATH:lib"
+  # Check if compile gets the correct bar.dll.lib
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib -L${sp}lib2 -l${sp}bar 
-l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib -LIBPATH:lib2"
 
-mkdir "sys  lib2"
-:> "sys  lib2/foo.dll.lib"
+  # Check if compile gets the correct bar.dll.lib
+  opts=`./compile ./cl foo.c -o foo -L${sp}lib2 -L${sp}lib -l${sp}bar 
-l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link 
-LIBPATH:lib2 -LIBPATH:lib"
 
-syslib2="`pwd`/sys  lib2"
-LIB="$syslib2;$LIB"
+  mkdir "sys  lib2"
+  :> "sys  lib2/foo.dll.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"
+  syslib2="`pwd`/sys  lib2"
+  LIB="$syslib2;$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"
+  # 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 -l${sp}foo`
+  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 -l${sp}foo`
+  test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib"
+done
 
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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