>From 8ad9d6ddfb664a527be7e3030a43b822363bc71a Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Fri, 13 Aug 2010 15:09:14 +0200 Subject: [PATCH] Support more C++ extensions for MSVC in the compile script. * lib/compile (func_cl_wrapper): MSVC only recognizes the .cpp extension as C++, unless it's given a hint. So hint about .cc, .cxx, c++ and C++. Also do path conversion on .c, .cpp and .lib files. * lib/compile3.test: Test the C++ hinting. Signed-off-by: Peter Rosin --- ChangeLog | 9 +++++++++ lib/compile | 12 +++++++++++- tests/compile3.test | 4 ++++ 3 files changed, 24 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a1c514..7a89be5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-08-13 Peter Rosin + + Support more C++ extensions for MSVC in the compile script. + * lib/compile (func_cl_wrapper): MSVC only recognizes the .cpp + extension as C++, unless it's given a hint. So hint about + .cc, .cxx, c++ and C++. Also do path conversion on .c, .cpp + and .lib files. + * lib/compile3.test: Test the C++ hinting. + 2010-08-12 Peter Rosin Enable the use of "link -lib" as the wrapped archiver. diff --git a/lib/compile b/lib/compile index bdb4ccb..1920723 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-07.06; # UTC +scriptversion=2010-08-13.13; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software # Foundation, Inc. @@ -129,6 +129,16 @@ func_cl_wrapper () eat=1 linker_opts="$linker_opts $2" ;; + [!-]*.cc | [!-]*.cxx | [!-]*.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + [!-]*.c | [!-]*.cpp | [!-]*.lib | [!-]*.LIB | [!-]*.Lib) + func_file_conv "$1" + set x "$@" "$file" + shift + ;; *) set x "$@" "$1" shift diff --git a/tests/compile3.test b/tests/compile3.test index fc5cd8e..b77237b 100755 --- a/tests/compile3.test +++ b/tests/compile3.test @@ -42,4 +42,8 @@ test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz" 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" + : -- 1.6.4.2