8035725: Must keep microsoft VS_PATH on PATH after toolchain detection

Thu, 05 Apr 2018 08:14:51 -0700

author
kevinw
date
Thu, 05 Apr 2018 08:14:51 -0700
changeset 2207
ddf2d8bf87c0
parent 2206
7ba4e17574e0
child 2208
feba63b3fa36

8035725: Must keep microsoft VS_PATH on PATH after toolchain detection
Reviewed-by: ihse, 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	Thu Apr 05 07:59:52 2018 -0700
     1.2 +++ b/common/autoconf/generated-configure.sh	Thu Apr 05 08:14:51 2018 -0700
     1.3 @@ -769,13 +769,13 @@
     1.4  PROPER_COMPILER_CC
     1.5  TOOLS_DIR_CC
     1.6  POTENTIAL_CC
     1.7 +SDKPATH
     1.8 +XCODEBUILD
     1.9 +SET_DEVELOPER_DIR
    1.10  VS_PATH
    1.11  VS_LIB
    1.12  VS_INCLUDE
    1.13  CYGWIN_LINK
    1.14 -SDKPATH
    1.15 -XCODEBUILD
    1.16 -SET_DEVELOPER_DIR
    1.17  EXE_SUFFIX
    1.18  OBJ_SUFFIX
    1.19  STATIC_LIBRARY
    1.20 @@ -4219,7 +4219,7 @@
    1.21  #CUSTOM_AUTOCONF_INCLUDE
    1.22  
    1.23  # Do not change or remove the following line, it is needed for consistency checks:
    1.24 -DATE_WHEN_GENERATED=1522940332
    1.25 +DATE_WHEN_GENERATED=1522941269
    1.26  
    1.27  ###############################################################################
    1.28  #
    1.29 @@ -24928,145 +24928,10 @@
    1.30    ORG_CXXFLAGS="$CXXFLAGS"
    1.31    ORG_OBJCFLAGS="$OBJCFLAGS"
    1.32  
    1.33 -  # autoconf magic only relies on PATH, so update it if tools dir is specified
    1.34 -  OLD_PATH="$PATH"
    1.35 -
    1.36 -  # Before we locate the compilers, we need to sanitize the Xcode build environment
    1.37 -  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
    1.38 -    # determine path to Xcode developer directory
    1.39 -    # can be empty in which case all the tools will rely on a sane Xcode 4 installation
    1.40 -    SET_DEVELOPER_DIR=
    1.41 -
    1.42 -    if test -n "$XCODE_PATH"; then
    1.43 -      DEVELOPER_DIR="$XCODE_PATH"/Contents/Developer
    1.44 -    fi
    1.45 -
    1.46 -    # DEVELOPER_DIR could also be provided directly
    1.47 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Determining if we need to set DEVELOPER_DIR" >&5
    1.48 -$as_echo_n "checking Determining if we need to set DEVELOPER_DIR... " >&6; }
    1.49 -    if test -n "$DEVELOPER_DIR"; then
    1.50 -      if test ! -d "$DEVELOPER_DIR"; then
    1.51 -        as_fn_error $? "Xcode Developer path does not exist: $DEVELOPER_DIR, please provide a path to the Xcode 4 application bundle using --with-xcode-path" "$LINENO" 5
    1.52 -      fi
    1.53 -      if test ! -f "$DEVELOPER_DIR"/usr/bin/xcodebuild; then
    1.54 -        as_fn_error $? "Xcode Developer path is not valid: $DEVELOPER_DIR, it must point to Contents/Developer inside an Xcode application bundle" "$LINENO" 5
    1.55 -      fi
    1.56 -      # make it visible to all the tools immediately
    1.57 -      export DEVELOPER_DIR
    1.58 -      SET_DEVELOPER_DIR="export DEVELOPER_DIR := $DEVELOPER_DIR"
    1.59 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($DEVELOPER_DIR)" >&5
    1.60 -$as_echo "yes ($DEVELOPER_DIR)" >&6; }
    1.61 -    else
    1.62 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    1.63 -$as_echo "no" >&6; }
    1.64 -    fi
    1.65 -
    1.66 -
    1.67 -    # Extract the first word of "xcodebuild", so it can be a program name with args.
    1.68 -set dummy xcodebuild; ac_word=$2
    1.69 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
    1.70 -$as_echo_n "checking for $ac_word... " >&6; }
    1.71 -if ${ac_cv_path_XCODEBUILD+:} false; then :
    1.72 -  $as_echo_n "(cached) " >&6
    1.73 -else
    1.74 -  case $XCODEBUILD in
    1.75 -  [\\/]* | ?:[\\/]*)
    1.76 -  ac_cv_path_XCODEBUILD="$XCODEBUILD" # Let the user override the test with a path.
    1.77 -  ;;
    1.78 -  *)
    1.79 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
    1.80 -for as_dir in $PATH
    1.81 -do
    1.82 -  IFS=$as_save_IFS
    1.83 -  test -z "$as_dir" && as_dir=.
    1.84 -    for ac_exec_ext in '' $ac_executable_extensions; do
    1.85 -  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    1.86 -    ac_cv_path_XCODEBUILD="$as_dir/$ac_word$ac_exec_ext"
    1.87 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    1.88 -    break 2
    1.89 -  fi
    1.90 -done
    1.91 -  done
    1.92 -IFS=$as_save_IFS
    1.93 -
    1.94 -  ;;
    1.95 -esac
    1.96 -fi
    1.97 -XCODEBUILD=$ac_cv_path_XCODEBUILD
    1.98 -if test -n "$XCODEBUILD"; then
    1.99 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODEBUILD" >&5
   1.100 -$as_echo "$XCODEBUILD" >&6; }
   1.101 -else
   1.102 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.103 -$as_echo "no" >&6; }
   1.104 -fi
   1.105 -
   1.106 -
   1.107 -    if test -z "$XCODEBUILD"; then
   1.108 -      as_fn_error $? "The xcodebuild tool was not found, the Xcode command line tools are required to build on Mac OS X" "$LINENO" 5
   1.109 -    fi
   1.110 -
   1.111 -    # Fail-fast: verify we're building on Xcode 4, we cannot build with Xcode 5 or later
   1.112 -    XCODE_VERSION=`$XCODEBUILD -version | grep '^Xcode ' | sed 's/Xcode //'`
   1.113 -    XC_VERSION_PARTS=( ${XCODE_VERSION//./ } )
   1.114 -    if test ! "${XC_VERSION_PARTS[0]}" = "4"; then
   1.115 -      as_fn_error $? "Xcode 4 is required to build JDK 8, the version found was $XCODE_VERSION. Use --with-xcode-path to specify the location of Xcode 4 or make Xcode 4 active by using xcode-select." "$LINENO" 5
   1.116 -    fi
   1.117 -
   1.118 -    # Some versions of Xcode 5 command line tools install gcc and g++ as symlinks to
   1.119 -    # clang and clang++, which will break the build. So handle that here if we need to.
   1.120 -    if test -L "/usr/bin/gcc" -o -L "/usr/bin/g++"; then
   1.121 -      # use xcrun to find the real gcc and add it's directory to PATH
   1.122 -      # then autoconf magic will find it
   1.123 -      { $as_echo "$as_me:${as_lineno-$LINENO}: Found gcc symlinks to clang in /usr/bin, adding path to real gcc to PATH" >&5
   1.124 -$as_echo "$as_me: Found gcc symlinks to clang in /usr/bin, adding path to real gcc to PATH" >&6;}
   1.125 -      XCODE_BIN_PATH=$(dirname `xcrun -find gcc`)
   1.126 -      PATH="$XCODE_BIN_PATH":$PATH
   1.127 -    fi
   1.128 -
   1.129 -    # Determine appropriate SDKPATH, don't use SDKROOT as it interferes with the stub tools
   1.130 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Determining Xcode SDK path" >&5
   1.131 -$as_echo_n "checking Determining Xcode SDK path... " >&6; }
   1.132 -    # allow SDKNAME to be set to override the default SDK selection
   1.133 -    SDKPATH=`"$XCODEBUILD" -sdk ${SDKNAME:-macosx} -version | grep '^Path: ' | sed 's/Path: //'`
   1.134 -    if test -n "$SDKPATH"; then
   1.135 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDKPATH" >&5
   1.136 -$as_echo "$SDKPATH" >&6; }
   1.137 -    else
   1.138 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none, will use system headers and frameworks)" >&5
   1.139 -$as_echo "(none, will use system headers and frameworks)" >&6; }
   1.140 -    fi
   1.141 -
   1.142 -
   1.143 -    # Perform a basic sanity test
   1.144 -    if test ! -f "$SDKPATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
   1.145 -      as_fn_error $? "Unable to find required framework headers, provide a valid path to Xcode 4 using --with-xcode-path" "$LINENO" 5
   1.146 -    fi
   1.147 -
   1.148 -    # if SDKPATH is non-empty then we need to add -isysroot and -iframework for gcc and g++
   1.149 -    if test -n "$SDKPATH"; then
   1.150 -      # We need -isysroot <path> and -iframework<path>/System/Library/Frameworks
   1.151 -      CFLAGS_JDK="${CFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   1.152 -      CXXFLAGS_JDK="${CXXFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   1.153 -      LDFLAGS_JDK="${LDFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   1.154 -    fi
   1.155 -
   1.156 -    # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
   1.157 -    # setting this here means it doesn't have to be peppered throughout the forest
   1.158 -    CFLAGS_JDK="$CFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   1.159 -    CXXFLAGS_JDK="$CXXFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   1.160 -    LDFLAGS_JDK="$LDFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   1.161 -  fi
   1.162 -
   1.163 -  # For solaris we really need solaris tools, and not the GNU equivalent.
   1.164 -  # The build tools on Solaris reside in /usr/ccs (C Compilation System),
   1.165 -  # so add that to path before starting to probe.
   1.166 -  # FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
   1.167 -  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   1.168 -    PATH="/usr/ccs/bin:$PATH"
   1.169 -  fi
   1.170 -
   1.171    # On Windows, we need to detect the visual studio installation first.
   1.172 +  # This will change the PATH, but we need to keep that new PATH even
   1.173 +  # after toolchain detection is done, since the compiler (on x86) uses
   1.174 +  # it for DLL resolution in runtime.
   1.175    if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
   1.176  
   1.177    # Store path to cygwin link.exe to help excluding it when searching for
   1.178 @@ -25877,6 +25742,144 @@
   1.179  
   1.180    fi
   1.181  
   1.182 +  # autoconf magic only relies on PATH, so update it if tools dir is specified
   1.183 +  OLD_PATH="$PATH"
   1.184 +
   1.185 +  # Before we locate the compilers, we need to sanitize the Xcode build environment
   1.186 +  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   1.187 +    # determine path to Xcode developer directory
   1.188 +    # can be empty in which case all the tools will rely on a sane Xcode 4 installation
   1.189 +    SET_DEVELOPER_DIR=
   1.190 +
   1.191 +    if test -n "$XCODE_PATH"; then
   1.192 +      DEVELOPER_DIR="$XCODE_PATH"/Contents/Developer
   1.193 +    fi
   1.194 +
   1.195 +    # DEVELOPER_DIR could also be provided directly
   1.196 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Determining if we need to set DEVELOPER_DIR" >&5
   1.197 +$as_echo_n "checking Determining if we need to set DEVELOPER_DIR... " >&6; }
   1.198 +    if test -n "$DEVELOPER_DIR"; then
   1.199 +      if test ! -d "$DEVELOPER_DIR"; then
   1.200 +        as_fn_error $? "Xcode Developer path does not exist: $DEVELOPER_DIR, please provide a path to the Xcode 4 application bundle using --with-xcode-path" "$LINENO" 5
   1.201 +      fi
   1.202 +      if test ! -f "$DEVELOPER_DIR"/usr/bin/xcodebuild; then
   1.203 +        as_fn_error $? "Xcode Developer path is not valid: $DEVELOPER_DIR, it must point to Contents/Developer inside an Xcode application bundle" "$LINENO" 5
   1.204 +      fi
   1.205 +      # make it visible to all the tools immediately
   1.206 +      export DEVELOPER_DIR
   1.207 +      SET_DEVELOPER_DIR="export DEVELOPER_DIR := $DEVELOPER_DIR"
   1.208 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($DEVELOPER_DIR)" >&5
   1.209 +$as_echo "yes ($DEVELOPER_DIR)" >&6; }
   1.210 +    else
   1.211 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.212 +$as_echo "no" >&6; }
   1.213 +    fi
   1.214 +
   1.215 +
   1.216 +    # Extract the first word of "xcodebuild", so it can be a program name with args.
   1.217 +set dummy xcodebuild; ac_word=$2
   1.218 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.219 +$as_echo_n "checking for $ac_word... " >&6; }
   1.220 +if ${ac_cv_path_XCODEBUILD+:} false; then :
   1.221 +  $as_echo_n "(cached) " >&6
   1.222 +else
   1.223 +  case $XCODEBUILD in
   1.224 +  [\\/]* | ?:[\\/]*)
   1.225 +  ac_cv_path_XCODEBUILD="$XCODEBUILD" # Let the user override the test with a path.
   1.226 +  ;;
   1.227 +  *)
   1.228 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.229 +for as_dir in $PATH
   1.230 +do
   1.231 +  IFS=$as_save_IFS
   1.232 +  test -z "$as_dir" && as_dir=.
   1.233 +    for ac_exec_ext in '' $ac_executable_extensions; do
   1.234 +  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
   1.235 +    ac_cv_path_XCODEBUILD="$as_dir/$ac_word$ac_exec_ext"
   1.236 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.237 +    break 2
   1.238 +  fi
   1.239 +done
   1.240 +  done
   1.241 +IFS=$as_save_IFS
   1.242 +
   1.243 +  ;;
   1.244 +esac
   1.245 +fi
   1.246 +XCODEBUILD=$ac_cv_path_XCODEBUILD
   1.247 +if test -n "$XCODEBUILD"; then
   1.248 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODEBUILD" >&5
   1.249 +$as_echo "$XCODEBUILD" >&6; }
   1.250 +else
   1.251 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.252 +$as_echo "no" >&6; }
   1.253 +fi
   1.254 +
   1.255 +
   1.256 +    if test -z "$XCODEBUILD"; then
   1.257 +      as_fn_error $? "The xcodebuild tool was not found, the Xcode command line tools are required to build on Mac OS X" "$LINENO" 5
   1.258 +    fi
   1.259 +
   1.260 +    # Fail-fast: verify we're building on Xcode 4, we cannot build with Xcode 5 or later
   1.261 +    XCODE_VERSION=`$XCODEBUILD -version | grep '^Xcode ' | sed 's/Xcode //'`
   1.262 +    XC_VERSION_PARTS=( ${XCODE_VERSION//./ } )
   1.263 +    if test ! "${XC_VERSION_PARTS[0]}" = "4"; then
   1.264 +      as_fn_error $? "Xcode 4 is required to build JDK 8, the version found was $XCODE_VERSION. Use --with-xcode-path to specify the location of Xcode 4 or make Xcode 4 active by using xcode-select." "$LINENO" 5
   1.265 +    fi
   1.266 +
   1.267 +    # Some versions of Xcode 5 command line tools install gcc and g++ as symlinks to
   1.268 +    # clang and clang++, which will break the build. So handle that here if we need to.
   1.269 +    if test -L "/usr/bin/gcc" -o -L "/usr/bin/g++"; then
   1.270 +      # use xcrun to find the real gcc and add it's directory to PATH
   1.271 +      # then autoconf magic will find it
   1.272 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found gcc symlinks to clang in /usr/bin, adding path to real gcc to PATH" >&5
   1.273 +$as_echo "$as_me: Found gcc symlinks to clang in /usr/bin, adding path to real gcc to PATH" >&6;}
   1.274 +      XCODE_BIN_PATH=$(dirname `xcrun -find gcc`)
   1.275 +      PATH="$XCODE_BIN_PATH":$PATH
   1.276 +    fi
   1.277 +
   1.278 +    # Determine appropriate SDKPATH, don't use SDKROOT as it interferes with the stub tools
   1.279 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Determining Xcode SDK path" >&5
   1.280 +$as_echo_n "checking Determining Xcode SDK path... " >&6; }
   1.281 +    # allow SDKNAME to be set to override the default SDK selection
   1.282 +    SDKPATH=`"$XCODEBUILD" -sdk ${SDKNAME:-macosx} -version | grep '^Path: ' | sed 's/Path: //'`
   1.283 +    if test -n "$SDKPATH"; then
   1.284 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDKPATH" >&5
   1.285 +$as_echo "$SDKPATH" >&6; }
   1.286 +    else
   1.287 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: (none, will use system headers and frameworks)" >&5
   1.288 +$as_echo "(none, will use system headers and frameworks)" >&6; }
   1.289 +    fi
   1.290 +
   1.291 +
   1.292 +    # Perform a basic sanity test
   1.293 +    if test ! -f "$SDKPATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
   1.294 +      as_fn_error $? "Unable to find required framework headers, provide a valid path to Xcode 4 using --with-xcode-path" "$LINENO" 5
   1.295 +    fi
   1.296 +
   1.297 +    # if SDKPATH is non-empty then we need to add -isysroot and -iframework for gcc and g++
   1.298 +    if test -n "$SDKPATH"; then
   1.299 +      # We need -isysroot <path> and -iframework<path>/System/Library/Frameworks
   1.300 +      CFLAGS_JDK="${CFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   1.301 +      CXXFLAGS_JDK="${CXXFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   1.302 +      LDFLAGS_JDK="${LDFLAGS_JDK} -isysroot \"$SDKPATH\" -iframework\"$SDKPATH/System/Library/Frameworks\""
   1.303 +    fi
   1.304 +
   1.305 +    # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
   1.306 +    # setting this here means it doesn't have to be peppered throughout the forest
   1.307 +    CFLAGS_JDK="$CFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   1.308 +    CXXFLAGS_JDK="$CXXFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   1.309 +    LDFLAGS_JDK="$LDFLAGS_JDK -F\"$SDKPATH/System/Library/Frameworks/JavaVM.framework/Frameworks\""
   1.310 +  fi
   1.311 +
   1.312 +  # For solaris we really need solaris tools, and not the GNU equivalent.
   1.313 +  # The build tools on Solaris reside in /usr/ccs (C Compilation System),
   1.314 +  # so add that to path before starting to probe.
   1.315 +  # FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
   1.316 +  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   1.317 +    PATH="/usr/ccs/bin:$PATH"
   1.318 +  fi
   1.319 +
   1.320    # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to
   1.321    # override all other locations.
   1.322    if test "x$TOOLS_DIR" != x; then
     2.1 --- a/common/autoconf/toolchain.m4	Thu Apr 05 07:59:52 2018 -0700
     2.2 +++ b/common/autoconf/toolchain.m4	Thu Apr 05 08:14:51 2018 -0700
     2.3 @@ -217,6 +217,14 @@
     2.4    ORG_CXXFLAGS="$CXXFLAGS"
     2.5    ORG_OBJCFLAGS="$OBJCFLAGS"
     2.6  
     2.7 +  # On Windows, we need to detect the visual studio installation first.
     2.8 +  # This will change the PATH, but we need to keep that new PATH even 
     2.9 +  # after toolchain detection is done, since the compiler (on x86) uses
    2.10 +  # it for DLL resolution in runtime.
    2.11 +  if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
    2.12 +    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
    2.13 +  fi
    2.14 +
    2.15    # autoconf magic only relies on PATH, so update it if tools dir is specified
    2.16    OLD_PATH="$PATH"
    2.17  
    2.18 @@ -309,11 +317,6 @@
    2.19      PATH="/usr/ccs/bin:$PATH"
    2.20    fi
    2.21  
    2.22 -  # On Windows, we need to detect the visual studio installation first.
    2.23 -  if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
    2.24 -    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
    2.25 -  fi
    2.26 -
    2.27    # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to 
    2.28    # override all other locations.
    2.29    if test "x$TOOLS_DIR" != x; then

mercurial