Tue, 05 Mar 2013 13:16:40 -0800
8006988: build-infra: Configure fails if 'cl' is in path on linux
Summary: Respect user CC and CXX environment variables; use cl iff on windows
Reviewed-by: erikj
common/autoconf/generated-configure.sh | file | annotate | diff | comparison | revisions | |
common/autoconf/toolchain.m4 | file | annotate | diff | comparison | revisions |
1.1 --- a/common/autoconf/generated-configure.sh Tue Feb 26 09:25:44 2013 -0800 1.2 +++ b/common/autoconf/generated-configure.sh Tue Mar 05 13:16:40 2013 -0800 1.3 @@ -3733,7 +3733,7 @@ 1.4 #CUSTOM_AUTOCONF_INCLUDE 1.5 1.6 # Do not change or remove the following line, it is needed for consistency checks: 1.7 -DATE_WHEN_GENERATED=1361899489 1.8 +DATE_WHEN_GENERATED=1362517596 1.9 1.10 ############################################################################### 1.11 # 1.12 @@ -18105,14 +18105,18 @@ 1.13 1.14 ### Locate C compiler (CC) 1.15 1.16 -# gcc is almost always present, but on Windows we 1.17 -# prefer cl.exe and on Solaris we prefer CC. 1.18 -# Thus test for them in this order. 1.19 -if test "x$OPENJDK_TARGET_OS" = xmacosx; then 1.20 - # Do not probe for cc on MacOSX. 1.21 - COMPILER_CHECK_LIST="cl gcc" 1.22 -else 1.23 - COMPILER_CHECK_LIST="cl cc gcc" 1.24 +# On windows, only cl.exe is supported. 1.25 +# On Solaris, cc is preferred to gcc. 1.26 +# Elsewhere, gcc is preferred to cc. 1.27 + 1.28 +if test "x$CC" != x; then 1.29 + COMPILER_CHECK_LIST="$CC" 1.30 +elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then 1.31 + COMPILER_CHECK_LIST="cl" 1.32 +elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 1.33 + COMPILER_CHECK_LIST="cc gcc" 1.34 +else 1.35 + COMPILER_CHECK_LIST="gcc cc" 1.36 fi 1.37 1.38 1.39 @@ -19076,7 +19080,7 @@ 1.40 $as_echo "$as_me: Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)" >&6;} 1.41 1.42 1.43 -# Now that we have resolved CC ourself, let autoconf have it's go at it 1.44 +# Now that we have resolved CC ourself, let autoconf have its go at it 1.45 ac_ext=c 1.46 ac_cpp='$CPP $CPPFLAGS' 1.47 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 1.48 @@ -19678,12 +19682,16 @@ 1.49 1.50 ### Locate C++ compiler (CXX) 1.51 1.52 -if test "x$OPENJDK_TARGET_OS" = xmacosx; then 1.53 - # Do not probe for CC on MacOSX. 1.54 - COMPILER_CHECK_LIST="cl g++" 1.55 -else 1.56 - COMPILER_CHECK_LIST="cl CC g++" 1.57 -fi 1.58 +if test "x$CXX" != x; then 1.59 + COMPILER_CHECK_LIST="$CXX" 1.60 +elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then 1.61 + COMPILER_CHECK_LIST="cl" 1.62 +elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 1.63 + COMPILER_CHECK_LIST="CC g++" 1.64 +else 1.65 + COMPILER_CHECK_LIST="g++ CC" 1.66 +fi 1.67 + 1.68 1.69 COMPILER_NAME=C++ 1.70 1.71 @@ -20645,7 +20653,7 @@ 1.72 $as_echo "$as_me: Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)" >&6;} 1.73 1.74 1.75 -# Now that we have resolved CXX ourself, let autoconf have it's go at it 1.76 +# Now that we have resolved CXX ourself, let autoconf have its go at it 1.77 ac_ext=cpp 1.78 ac_cpp='$CXXCPP $CPPFLAGS' 1.79 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2.1 --- a/common/autoconf/toolchain.m4 Tue Feb 26 09:25:44 2013 -0800 2.2 +++ b/common/autoconf/toolchain.m4 Tue Mar 05 13:16:40 2013 -0800 2.3 @@ -248,30 +248,38 @@ 2.4 2.5 ### Locate C compiler (CC) 2.6 2.7 -# gcc is almost always present, but on Windows we 2.8 -# prefer cl.exe and on Solaris we prefer CC. 2.9 -# Thus test for them in this order. 2.10 -if test "x$OPENJDK_TARGET_OS" = xmacosx; then 2.11 - # Do not probe for cc on MacOSX. 2.12 - COMPILER_CHECK_LIST="cl gcc" 2.13 +# On windows, only cl.exe is supported. 2.14 +# On Solaris, cc is preferred to gcc. 2.15 +# Elsewhere, gcc is preferred to cc. 2.16 + 2.17 +if test "x$CC" != x; then 2.18 + COMPILER_CHECK_LIST="$CC" 2.19 +elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then 2.20 + COMPILER_CHECK_LIST="cl" 2.21 +elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 2.22 + COMPILER_CHECK_LIST="cc gcc" 2.23 else 2.24 - COMPILER_CHECK_LIST="cl cc gcc" 2.25 + COMPILER_CHECK_LIST="gcc cc" 2.26 fi 2.27 2.28 TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST]) 2.29 -# Now that we have resolved CC ourself, let autoconf have it's go at it 2.30 +# Now that we have resolved CC ourself, let autoconf have its go at it 2.31 AC_PROG_CC([$CC]) 2.32 2.33 ### Locate C++ compiler (CXX) 2.34 2.35 -if test "x$OPENJDK_TARGET_OS" = xmacosx; then 2.36 - # Do not probe for CC on MacOSX. 2.37 - COMPILER_CHECK_LIST="cl g++" 2.38 +if test "x$CXX" != x; then 2.39 + COMPILER_CHECK_LIST="$CXX" 2.40 +elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then 2.41 + COMPILER_CHECK_LIST="cl" 2.42 +elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 2.43 + COMPILER_CHECK_LIST="CC g++" 2.44 else 2.45 - COMPILER_CHECK_LIST="cl CC g++" 2.46 + COMPILER_CHECK_LIST="g++ CC" 2.47 fi 2.48 + 2.49 TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST]) 2.50 -# Now that we have resolved CXX ourself, let autoconf have it's go at it 2.51 +# Now that we have resolved CXX ourself, let autoconf have its go at it 2.52 AC_PROG_CXX([$CXX]) 2.53 2.54 ### Locate other tools