common/autoconf/toolchain.m4
changeset 22724 072f729936a9
parent 22721 63761da45392
child 23161 85635b5bf0a6
--- a/common/autoconf/toolchain.m4	Mon Feb 24 13:29:26 2014 +0100
+++ b/common/autoconf/toolchain.m4	Tue Feb 25 15:19:32 2014 +0100
@@ -164,6 +164,14 @@
   ORG_CXXFLAGS="$CXXFLAGS"
   ORG_OBJCFLAGS="$OBJCFLAGS"
 
+  # On Windows, we need to detect the visual studio installation first.
+  # This will change the PATH, but we need to keep that new PATH even 
+  # after toolchain detection is done, since the compiler (on x86) uses
+  # it for DLL resolution in runtime.
+  if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
+    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
+  fi
+
   # autoconf magic only relies on PATH, so update it if tools dir is specified
   OLD_PATH="$PATH"
 
@@ -175,11 +183,6 @@
     PATH="/usr/ccs/bin:$PATH"
   fi
 
-  # On Windows, we need to detect the visual studio installation first.
-  if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
-    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
-  fi
-
   # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to 
   # override all other locations.
   if test "x$TOOLS_DIR" != x; then
@@ -663,7 +666,7 @@
   # Check for extra potential brokenness.
   if test  "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     # On Windows, double-check that we got the right compiler.
-    CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`    
+    CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
     if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
       if test "x$COMPILER_CPU_TEST" != "x80x86"; then