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-278-


From: Ralf Wildenhues
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-278-gf74062b
Date: Sun, 01 Aug 2010 07:39:47 +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=f74062b38c05dcb9c187601ca922d9091ebf7360

The branch, master has been updated
       via  f74062b38c05dcb9c187601ca922d9091ebf7360 (commit)
       via  da15b997559fa4f64d6adb300fd95515adceb9ff (commit)
      from  b0f2ede9807465c3238f40ea00d7355f9de90856 (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 f74062b38c05dcb9c187601ca922d9091ebf7360
Merge: b0f2ede da15b99
Author: Ralf Wildenhues <address@hidden>
Date:   Sun Aug 1 09:38:34 2010 +0200

    Merge branch 'msvc'
    
    * msvc:
      Wrap some MSVC options in the compile script.

commit da15b997559fa4f64d6adb300fd95515adceb9ff
Author: Peter Rosin <address@hidden>
Date:   Sun Aug 1 08:38:05 2010 +0200

    Wrap some MSVC options in the compile script.
    
    * lib/compile: MSVC supports naming the output file, the option
    is just not called -o, so transform -o into the appropriate form
    for MSVC. Also wrap some other options while at it (-L, -l, -Wl,
    -Xlinker and -I) and convert file names to windows form where
    needed for those options to make MSVC more usable in an
    autotooled environment.
    * doc/automake.texi (Auxiliary Programs): Document the above
    extension of the compile script.
    * NEWS: Updated.
    * tests/defs.in: New required entry 'cl'.
    * tests/compile3.test: New test.
    * tests/compile4.test: New test.
    * tests/compile5.test: New test.
    * tests/Makefile.am: Update.
    
    Signed-off-by: Ralf Wildenhues <address@hidden>

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

Summary of changes:
 ChangeLog                            |   18 +++++
 NEWS                                 |    3 +
 doc/automake.texi                    |    6 ++-
 lib/compile                          |  122 +++++++++++++++++++++++++++++++++-
 tests/Makefile.am                    |    3 +
 tests/Makefile.in                    |    3 +
 tests/{tags2.test => compile3.test}  |   33 +++++-----
 tests/{clean2.test => compile4.test} |   63 +++++++++++++-----
 tests/compile5.test                  |   81 ++++++++++++++++++++++
 tests/defs.in                        |    6 ++
 10 files changed, 302 insertions(+), 36 deletions(-)
 copy tests/{tags2.test => compile3.test} (50%)
 copy tests/{clean2.test => compile4.test} (52%)
 create mode 100755 tests/compile5.test

diff --git a/ChangeLog b/ChangeLog
index 5ed00c6..f113915 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-01  Peter Rosin  <address@hidden>
+
+       Wrap some MSVC options in the compile script.
+       * lib/compile: MSVC supports naming the output file, the option
+       is just not called -o, so transform -o into the appropriate form
+       for MSVC. Also wrap some other options while at it (-L, -l, -Wl,
+       -Xlinker and -I) and convert file names to windows form where
+       needed for those options to make MSVC more usable in an
+       autotooled environment.
+       * doc/automake.texi (Auxiliary Programs): Document the above
+       extension of the compile script.
+       * NEWS: Updated.
+       * tests/defs.in: New required entry 'cl'.
+       * tests/compile3.test: New test.
+       * tests/compile4.test: New test.
+       * tests/compile5.test: New test.
+       * tests/Makefile.am: Update.
+
 2010-07-31  Ralf Wildenhues  <address@hidden>
 
        Add example git work flow; discuss merge --log in HACKING.
diff --git a/NEWS b/NEWS
index 1c19909..19e4548 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,9 @@ New in 1.11a:
   - Messages of types warning or error from `automake' and `aclocal' are now
     prefixed with the respective type, and presence of -Werror is noted.
 
+  - The `compile' script now converts some options for MSVC for a better
+    user experience.
+
 Bugs fixed in 1.11a:
 
   - Lots of minor bugfixes.
diff --git a/doc/automake.texi b/doc/automake.texi
index b79e955..bce52d4 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -2171,7 +2171,11 @@ These two files are used for de-ANSI-fication support 
(obsolete
 @item compile
 This is a wrapper for compilers that do not accept options @option{-c}
 and @option{-o} at the same time.  It is only used when absolutely
-required.  Such compilers are rare.
+required.  Such compilers are rare, with the Microsoft C/C++ Compiler
+as the most notable exception. This wrapper also makes the following
+common options available for that compiler, while performing file name
+translation where needed: @option{-I}, @option{-L}, @option{-l},
address@hidden,} and @option{-Xlinker}.
 
 @item config.guess
 @itemx config.sub
diff --git a/lib/compile b/lib/compile
index c0096a7..ae47d8b 100755
--- a/lib/compile
+++ b/lib/compile
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand `-c -o'.
 
-scriptversion=2009-10-06.20; # UTC
+scriptversion=2010-08-01.07; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
 # Foundation, Inc.
 # Written by Tom Tromey <address@hidden>.
 #
@@ -29,6 +29,121 @@ scriptversion=2009-10-06.20; # UTC
 # bugs to <address@hidden> or send patches to
 # <address@hidden>.
 
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""       $nl"
+
+file_conv=
+
+# func_file_conv build_file
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Win32 hosts.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[^/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+       # lazily determine how to convert abs files
+       case `uname -s` in
+         MINGW*)
+           file_conv=mingw
+           ;;
+         CYGWIN*)
+           file_conv=cygwin
+           ;;
+         *)
+           file_conv=wine
+           ;;
+       esac
+      fi
+      case $file_conv in
+       mingw)
+         file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+         ;;
+       cygwin)
+         file=`cygpath -m "$file" || echo "$file"`
+         ;;
+       wine)
+         file=`winepath -w "$file" || echo "$file"`
+         ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suite cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+       -o)
+         # configure might choose to run compile as `compile cc -o foo foo.c'.
+         eat=1
+         case $2 in
+           *.o | *.[oO][bB][jJ])
+             func_file_conv "$2"
+             set x "$@" -Fo"$file"
+             shift
+             ;;
+           *)
+             func_file_conv "$2"
+             set x "$@" -Fe"$file"
+             shift
+             ;;
+         esac
+         ;;
+       -I*)
+         func_file_conv "${1#-I}"
+         set x "$@" -I"$file"
+         shift
+         ;;
+       -l*)
+         set x "$@" "${1#-l}.lib"
+         shift
+         ;;
+       -L*)
+         func_file_conv "${1#-L}"
+         linker_opts="$linker_opts -LIBPATH:$file"
+         ;;
+       -Wl,*)
+         arg=${1#-Wl,}
+         save_ifs="$IFS"; IFS=','
+         for flag in $arg; do
+           IFS="$save_ifs"
+           linker_opts="$linker_opts $flag"
+         done
+         IFS="$save_ifs"
+         ;;
+       -Xlinker)
+         eat=1
+         linker_opts="$linker_opts $2"
+         ;;
+       *)
+         set x "$@" "$1"
+         shift
+         ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
 case $1 in
   '')
      echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
@@ -53,6 +168,9 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
 esac
 
 ofile=
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 051fcdf..6d00b42 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -177,6 +177,9 @@ commen10.test \
 commen11.test \
 compile.test \
 compile2.test \
+compile3.test \
+compile4.test \
+compile5.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 09da716..56407dd 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -388,6 +388,9 @@ commen10.test \
 commen11.test \
 compile.test \
 compile2.test \
+compile3.test \
+compile4.test \
+compile5.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
diff --git a/tests/tags2.test b/tests/compile3.test
similarity index 50%
copy from tests/tags2.test
copy to tests/compile3.test
index f6e018c..fc5cd8e 100755
--- a/tests/tags2.test
+++ b/tests/compile3.test
@@ -14,31 +14,32 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# TAGS_DEPENDENCIES only make sense if other tag-worthy things (such as
-# sources) exist.
+# Make sure `compile' wraps the Microsoft C/C++ compiler (cl) correctly
 
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in << 'END'
-AC_PROG_CC
-AC_OUTPUT
-END
+cp "$testsrcdir/../lib/compile" .
 
-cat >Makefile.am << 'END'
-TAGS_DEPENDENCIES = foo
+# Use a dummy cl, since cl isn't readily available on all systems
+cat >cl <<'END'
+#! /bin/sh
+echo "$@"
 END
 
-$ACLOCAL
-AUTOMAKE_fails
-grep 'define.*TAGS_DEPENDENCIES.*without' stderr
+chmod +x ./cl
 
-cat >>Makefile.am << 'END'
-bin_PROGRAMS = bar
-END
+# 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`
+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"
 
-AUTOMAKE_run 0
-grep 'define.*TAGS_DEPENDENCIES.*without' stderr && Exit 1
+# 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"
 
 :
diff --git a/tests/clean2.test b/tests/compile4.test
similarity index 52%
copy from tests/clean2.test
copy to tests/compile4.test
index 99e4c2e..9e7bcbb 100755
--- a/tests/clean2.test
+++ b/tests/compile4.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# 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
@@ -14,15 +14,40 @@
 # 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 distclean works in cygnus mode.
-# Report from Daniel Jacobowitz
+# Make sure `compile' wraps the Microsoft C/C++ compiler (cl) correctly
+# with respect to absolute paths.
 
+required='cl'
 . ./defs || Exit 1
 
 set -e
 
+mkdir sub
+
+cat >sub/foo.c <<'EOF'
+int
+foo ()
+{
+  return 0;
+}
+EOF
+
+cat >main.c <<'EOF'
+extern int foo ();
+int
+main ()
+{
+  return foo ();
+}
+EOF
+
+absfoodir=`pwd`/sub
+absmain=`pwd`/main.c
+
 cat >> configure.in << 'END'
-AM_MAINTAINER_MODE
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_RANLIB
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 END
@@ -31,23 +56,27 @@ cat > Makefile.am << 'END'
 SUBDIRS = sub
 END
 
-mkdir sub
-
 cat > sub/Makefile.am << 'END'
-data_DATA = foo
-
-foo:
-       touch $@
-
-CLEANFILES = $(data_DATA)
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
 END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --cygnus
-
+$AUTOMAKE -a
 ./configure
 $MAKE
-test -f sub/foo
-$MAKE distclean
-test ! -f sub/foo
+
+# cl expects archives to be named foo.lib, not libfoo.a so
+# make a simple copy here if needed. This is a severe case
+# of badness, but ignore that since this is not what is
+# being tested here...
+if test -f sub/libfoo.a; then
+  cp sub/libfoo.a sub/foo.lib
+fi
+
+./compile cl $CPPFLAGS $CFLAGS $LDFLAGS -L"$absfoodir" "$absmain" -o main -lfoo
+
+./main
+
+:
diff --git a/tests/compile5.test b/tests/compile5.test
new file mode 100755
index 0000000..cd1468f
--- /dev/null
+++ b/tests/compile5.test
@@ -0,0 +1,81 @@
+#! /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 the file name translation in the `compile' script works
+# 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
+
+cat >>configure.in << 'END'
+AC_CANONICAL_HOST
+AC_CONFIG_FILES([check_host], [chmod +x check_host])
+AC_OUTPUT
+END
+
+: >Makefile.am
+
+cat >check_host.in << 'END'
+#! /bin/sh
+case @host_os@ in
+  mingw*)
+    ;;
+  *)
+    exit 77
+    ;;
+esac
+case @build_os@ in
+  mingw* | cygwin*)
+    ;;
+  *)
+    winepath -w / || exit 77
+    ;;
+esac
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+./check_host
+
+pwd=`pwd`
+
+# 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://'`
+
+case $res in
+  ?:[\\/]*)
+    ;;
+  *)
+    Exit 1
+    ;;
+esac
+
+:
diff --git a/tests/defs.in b/tests/defs.in
index 9bb6333..b5cc99e 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -105,6 +105,12 @@ do
       echo "$me: running bzip2 --help"
       ( bzip2 --help ) || exit 77
       ;;
+    cl)
+      CC=cl
+      export CC
+      echo "$me: running $CC -?"
+      ( $CC -? ) || exit 77
+      ;;
     etags)
       # Exuberant Ctags will create a TAGS file even
       # when asked for --help or --version.  (Emacs's etags


hooks/post-receive
-- 
GNU Automake



reply via email to

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