From: Peter Rosin Date: Mon, 16 Aug 2010 07:59:10 +0000 (+0200) Subject: Support more C++ file extensions for MSVC in the compile script. X-Git-Tag: ng-0.5a~385^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a89953333a36b8b8ebce393fe74034e4bfb739ab;p=thirdparty%2Fautomake.git Support more C++ file extensions for MSVC in the compile script. * lib/compile (func_cl_wrapper): MSVC only recognizes the .cpp file extension as C++, unless it's given a hint. So hint about .cc, .CC, .cxx, .CXX, c++ and C++. Also do path conversion on .c, .cpp, .CPP, .lib, .LIB and .Lib files. * lib/compile3.test: Test the C++ hinting. Signed-off-by: Peter Rosin --- diff --git a/ChangeLog b/ChangeLog index 2a1c51471..0f90bd0ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-08-16 Peter Rosin + + Support more C++ file extensions for MSVC in the compile script. + * lib/compile (func_cl_wrapper): MSVC only recognizes the .cpp + file extension as C++, unless it's given a hint. So hint about + .cc, .CC, .cxx, .CXX, c++ and C++. Also do path conversion on + .c, .cpp, .CPP, .lib, .LIB 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 bdb4ccbb5..cd3b801cf 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-16.07; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software # Foundation, Inc. @@ -129,6 +129,20 @@ func_cl_wrapper () eat=1 linker_opts="$linker_opts $2" ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.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 fc5cd8eba..b77237b93 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" + :