common/autoconf/toolchain_windows.m4

changeset 2223
01cc48ed67f3
parent 2220
47fda751abb6
child 2224
20daa32eec6f
     1.1 --- a/common/autoconf/toolchain_windows.m4	Fri May 04 11:00:26 2018 +0100
     1.2 +++ b/common/autoconf/toolchain_windows.m4	Wed May 16 15:52:51 2018 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  #
     1.5 -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 +# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     1.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8  #
     1.9  # This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,43 +23,90 @@
    1.11  # questions.
    1.12  #
    1.13  
    1.14 +################################################################################
    1.15 +
    1.16 +VALID_VS_VERSIONS="2010 2012 2013"
    1.17 +
    1.18 +VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
    1.19 +VS_VERSION_INTERNAL_2010=100
    1.20 +VS_MSVCR_2010=msvcr100.dll
    1.21 +# We don't use msvcp on Visual Studio 2010
    1.22 +#VS_MSVCP_2010=msvcp100.dll
    1.23 +VS_ENVVAR_2010="VS100COMNTOOLS"
    1.24 +VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
    1.25 +VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
    1.26 +VS_VS_PLATFORM_NAME_2010="v100"
    1.27 +VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
    1.28 +
    1.29 +VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
    1.30 +VS_VERSION_INTERNAL_2012=110
    1.31 +VS_MSVCR_2012=msvcr110.dll
    1.32 +VS_MSVCP_2012=msvcp110.dll
    1.33 +VS_ENVVAR_2012="VS110COMNTOOLS"
    1.34 +VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
    1.35 +VS_SDK_INSTALLDIR_2012=
    1.36 +VS_VS_PLATFORM_NAME_2012="v110"
    1.37 +VS_SDK_PLATFORM_NAME_2012=
    1.38 +
    1.39 +VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
    1.40 +VS_VERSION_INTERNAL_2013=120
    1.41 +VS_MSVCR_2013=msvcr120.dll
    1.42 +VS_MSVCP_2013=msvcp120.dll
    1.43 +VS_ENVVAR_2013="VS120COMNTOOLS"
    1.44 +VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
    1.45 +VS_SDK_INSTALLDIR_2013=
    1.46 +VS_VS_PLATFORM_NAME_2013="v120"
    1.47 +VS_SDK_PLATFORM_NAME_2013=
    1.48 +
    1.49 +################################################################################
    1.50 +
    1.51  AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
    1.52  [
    1.53    if test "x$VS_ENV_CMD" = x; then
    1.54 -    VS100BASE="$1"
    1.55 -    METHOD="$2"
    1.56 -    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
    1.57 -    if test -d "$VS100BASE"; then
    1.58 -      if test -f "$VS100BASE/$VCVARSFILE"; then
    1.59 -        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
    1.60 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
    1.61 +    VS_VERSION="$1"
    1.62 +    VS_BASE="$2"
    1.63 +    METHOD="$3"
    1.64 +
    1.65 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
    1.66 +      VCVARSFILE="vc/bin/vcvars32.bat"
    1.67 +    else
    1.68 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
    1.69 +    fi
    1.70 +  
    1.71 +    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
    1.72 +    if test -d "$VS_BASE"; then
    1.73 +      if test -f "$VS_BASE/$VCVARSFILE"; then
    1.74 +        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    1.75 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
    1.76          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
    1.77          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
    1.78 -        # TODO: improve detection for other versions of VS
    1.79 -        PLATFORM_TOOLSET="v100"
    1.80 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
    1.81        else
    1.82 -        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
    1.83 +        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    1.84          AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
    1.85        fi
    1.86      fi
    1.87    fi
    1.88  ])
    1.89  
    1.90 +################################################################################
    1.91 +
    1.92  AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
    1.93  [
    1.94    if test "x$VS_ENV_CMD" = x; then
    1.95 -    WIN_SDK_BASE="$1"
    1.96 -    METHOD="$2"
    1.97 +    VS_VERSION="$1"
    1.98 +    WIN_SDK_BASE="$2"
    1.99 +    METHOD="$3"
   1.100      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
   1.101      if test -d "$WIN_SDK_BASE"; then
   1.102        # There have been cases of partial or broken SDK installations. A missing
   1.103        # lib dir is not going to work.
   1.104 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   1.105 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   1.106          AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
   1.107          AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
   1.108 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   1.109 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   1.110          AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
   1.111 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   1.112 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   1.113          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   1.114            VS_ENV_ARGS="/x86"
   1.115          else
   1.116 @@ -68,7 +115,7 @@
   1.117          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   1.118          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   1.119          # TODO: improve detection for other versions of SDK
   1.120 -        PLATFORM_TOOLSET="Windows7.1SDK"
   1.121 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   1.122        else
   1.123          AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
   1.124          AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
   1.125 @@ -77,50 +124,121 @@
   1.126    fi
   1.127  ])
   1.128  
   1.129 +################################################################################
   1.130 +# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
   1.131 +# build environment and assigns it to VS_ENV_CMD
   1.132  AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
   1.133  [
   1.134 -  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   1.135 -    VCVARSFILE="vc/bin/vcvars32.bat"
   1.136 -  else
   1.137 -    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   1.138 +  VS_VERSION="$1"
   1.139 +  eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
   1.140 +  eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
   1.141 +  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
   1.142 +  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
   1.143 +
   1.144 +  # When using --with-tools-dir, assume it points to the correct and default
   1.145 +  # version of Visual Studio or that --with-toolchain-version was also set.
   1.146 +  if test "x$with_tools_dir" != x; then
   1.147 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.148 +        [$with_tools_dir/../..], [--with-tools-dir])
   1.149 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.150 +        [$with_tools_dir/../../..], [--with-tools-dir])
   1.151 +    if test "x$VS_ENV_CMD" = x; then
   1.152 +      # Having specified an argument which is incorrect will produce an instant failure;
   1.153 +      # we should not go on looking
   1.154 +      AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
   1.155 +      AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
   1.156 +      AC_MSG_NOTICE([directory within the Visual Studio installation])
   1.157 +      AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
   1.158 +    fi
   1.159    fi
   1.160  
   1.161    VS_ENV_CMD=""
   1.162    VS_ENV_ARGS=""
   1.163 -  if test "x$with_toolsdir" != x; then
   1.164 -    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
   1.165 +
   1.166 +  if test "x$VS_COMNTOOLS" != x; then
   1.167 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.168 +        [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
   1.169 +  fi
   1.170 +  if test "x$PROGRAMFILES" != x; then
   1.171 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.172 +        [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
   1.173 +  fi
   1.174 +  # Work around the insanely named ProgramFiles(x86) env variable
   1.175 +  PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
   1.176 +  if test "x$PROGRAMFILES_X86" != x; then
   1.177 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.178 +        [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
   1.179 +  fi
   1.180 +  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.181 +      [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
   1.182 +  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   1.183 +      [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
   1.184 +
   1.185 +  if test "x$SDK_INSTALL_DIR" != x; then
   1.186 +    if test "x$ProgramW6432" != x; then
   1.187 +      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   1.188 +          [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
   1.189 +    fi
   1.190 +    if test "x$PROGRAMW6432" != x; then
   1.191 +      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   1.192 +          [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
   1.193 +    fi
   1.194 +    if test "x$PROGRAMFILES" != x; then
   1.195 +      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   1.196 +          [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
   1.197 +    fi
   1.198 +    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   1.199 +        [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
   1.200 +    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   1.201 +        [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
   1.202 +  fi
   1.203 +])
   1.204 +
   1.205 +################################################################################
   1.206 +
   1.207 +AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
   1.208 +[
   1.209 +  AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
   1.210 +      [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
   1.211 +
   1.212 +  if test "x$with_toolchain_version" = xlist; then
   1.213 +    # List all toolchains
   1.214 +    AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
   1.215 +    for version in $VALID_VS_VERSIONS; do
   1.216 +      eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
   1.217 +      $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
   1.218 +    done
   1.219 +
   1.220 +    exit 0
   1.221 +  elif test "x$with_toolchain_version" != x; then
   1.222 +    # User override; check that it is valid
   1.223 +    if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
   1.224 +      AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
   1.225 +      AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
   1.226 +      AC_MSG_ERROR([Cannot continue.])
   1.227 +    fi
   1.228 +    VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
   1.229 +  else
   1.230 +    # No flag given, use default
   1.231 +    VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
   1.232    fi
   1.233  
   1.234 -  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
   1.235 -    # Having specified an argument which is incorrect will produce an instant failure;
   1.236 -    # we should not go on looking
   1.237 -    AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
   1.238 -    AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
   1.239 -    AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
   1.240 -  fi
   1.241 -
   1.242 -  if test "x$VS100COMNTOOLS" != x; then
   1.243 -    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
   1.244 -  fi
   1.245 -  if test "x$PROGRAMFILES" != x; then
   1.246 -    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
   1.247 -  fi
   1.248 -  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
   1.249 -  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
   1.250 -
   1.251 -  if test "x$ProgramW6432" != x; then
   1.252 -    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   1.253 -  fi
   1.254 -  if test "x$PROGRAMW6432" != x; then
   1.255 -    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   1.256 -  fi
   1.257 -  if test "x$PROGRAMFILES" != x; then
   1.258 -    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   1.259 -  fi
   1.260 -  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   1.261 -  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   1.262 +  for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
   1.263 +    TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
   1.264 +    if test "x$VS_ENV_CMD" != x; then
   1.265 +      TOOLCHAIN_VERSION=$VS_VERSION
   1.266 +      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   1.267 +      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
   1.268 +      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
   1.269 +      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
   1.270 +      # The rest of the variables are already evaled while probing
   1.271 +      AC_MSG_NOTICE([Found $VS_DESCRIPTION])
   1.272 +      break
   1.273 +    fi
   1.274 +  done
   1.275  ])
   1.276  
   1.277 +################################################################################
   1.278  # Check if the VS env variables were setup prior to running configure.
   1.279  # If not, then find vcvarsall.bat and run it automatically, and integrate
   1.280  # the set env variables into the spec file.
   1.281 @@ -142,7 +260,8 @@
   1.282    fi
   1.283  
   1.284    # First-hand choice is to locate and run the vsvars bat file.
   1.285 -  TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
   1.286 +  TOOLCHAIN_FIND_VISUAL_STUDIO
   1.287 +
   1.288    if test "x$VS_ENV_CMD" != x; then
   1.289      # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
   1.290      BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
   1.291 @@ -242,16 +361,17 @@
   1.292    fi
   1.293  ])
   1.294  
   1.295 -AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
   1.296 +AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
   1.297  [
   1.298 -  POSSIBLE_MSVCR_DLL="$1"
   1.299 -  METHOD="$2"
   1.300 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
   1.301 -    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
   1.302 -    
   1.303 +  DLL_NAME="$1"
   1.304 +  POSSIBLE_MSVC_DLL="$2"
   1.305 +  METHOD="$3"
   1.306 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
   1.307 +    AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD])
   1.308 +
   1.309      # Need to check if the found msvcr is correct architecture
   1.310 -    AC_MSG_CHECKING([found msvcr100.dll architecture])
   1.311 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
   1.312 +    AC_MSG_CHECKING([found $1 architecture])
   1.313 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
   1.314      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   1.315        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
   1.316        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
   1.317 @@ -267,96 +387,136 @@
   1.318          CORRECT_MSVCR_ARCH=x86-64
   1.319        fi
   1.320      fi
   1.321 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   1.322 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   1.323        AC_MSG_RESULT([ok])
   1.324 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
   1.325 -      AC_MSG_CHECKING([for msvcr100.dll])
   1.326 -      AC_MSG_RESULT([$MSVCR_DLL])
   1.327 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
   1.328 +      AC_MSG_CHECKING([for $1])
   1.329 +      AC_MSG_RESULT([$MSVC_DLL])
   1.330      else
   1.331        AC_MSG_RESULT([incorrect, ignoring])
   1.332 -      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
   1.333 +      AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE])
   1.334      fi
   1.335    fi
   1.336  ])
   1.337  
   1.338 -AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
   1.339 +AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
   1.340  [
   1.341 -  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
   1.342 -      [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
   1.343 +  VAR_NAME="$1"
   1.344 +  DLL_NAME="$2"
   1.345 +  MSVC_DLL=
   1.346  
   1.347 -  if test "x$with_msvcr_dll" != x; then
   1.348 -    # If given explicitely by user, do not probe. If not present, fail directly.
   1.349 -    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
   1.350 -    if test "x$MSVCR_DLL" = x; then
   1.351 -      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
   1.352 -    fi
   1.353 -  fi
   1.354 -  
   1.355 -  if test "x$MSVCR_DLL" = x; then
   1.356 +  if test "x$MSVC_DLL" = x; then
   1.357      # Probe: Using well-known location from Visual Studio 10.0
   1.358      if test "x$VCINSTALLDIR" != x; then
   1.359        CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
   1.360        BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
   1.361        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.362 -        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
   1.363 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   1.364        else
   1.365 -        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
   1.366 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   1.367        fi
   1.368 -      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
   1.369 +      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
   1.370 +        TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   1.371 +            [well-known location in VCINSTALLDIR])
   1.372      fi
   1.373    fi
   1.374  
   1.375 -  if test "x$MSVCR_DLL" = x; then
   1.376 +  if test "x$MSVC_DLL" = x; then
   1.377      # Probe: Check in the Boot JDK directory.
   1.378 -    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
   1.379 -    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
   1.380 +    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
   1.381 +    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($[DLL_NAME], [$POSSIBLE_MSVC_DLL],
   1.382 +        [well-known location in Boot JDK])
   1.383    fi
   1.384    
   1.385 -  if test "x$MSVCR_DLL" = x; then
   1.386 +  if test "x$MSVC_DLL" = x; then
   1.387      # Probe: Look in the Windows system32 directory 
   1.388      CYGWIN_SYSTEMROOT="$SYSTEMROOT"
   1.389      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
   1.390 -    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
   1.391 -    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
   1.392 +    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
   1.393 +    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   1.394 +        [well-known location in SYSTEMROOT])
   1.395    fi
   1.396  
   1.397 -  if test "x$MSVCR_DLL" = x; then
   1.398 +  if test "x$MSVC_DLL" = x; then
   1.399      # Probe: If Visual Studio Express is installed, there is usually one with the debugger
   1.400      if test "x$VS100COMNTOOLS" != x; then
   1.401        CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
   1.402        BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
   1.403        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.404 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
   1.405 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
   1.406 +            | $GREP -i /x64/ | $HEAD --lines 1`
   1.407        else
   1.408 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
   1.409 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
   1.410 +            | $GREP -i /x86/ | $HEAD --lines 1`
   1.411        fi
   1.412 -      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
   1.413 +      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   1.414 +          [search of VS100COMNTOOLS])
   1.415      fi
   1.416    fi
   1.417        
   1.418 -  if test "x$MSVCR_DLL" = x; then
   1.419 +  if test "x$MSVC_DLL" = x; then
   1.420      # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
   1.421 -    # (This was the original behaviour; kept since it might turn up something)
   1.422 +    # (This was the original behaviour; kept since it might turn something up)
   1.423      if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
   1.424        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.425 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
   1.426 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
   1.427 +          | $GREP x64 | $HEAD --lines 1`
   1.428        else
   1.429 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
   1.430 -        if test "x$POSSIBLE_MSVCR_DLL" = x; then
   1.431 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
   1.432 +          | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
   1.433 +        if test "x$POSSIBLE_MSVC_DLL" = x; then
   1.434            # We're grasping at straws now...
   1.435 -          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
   1.436 +          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
   1.437 +              | $HEAD --lines 1`
   1.438          fi
   1.439        fi
   1.440        
   1.441 -      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
   1.442 +      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   1.443 +          [search of VCINSTALLDIR])
   1.444      fi
   1.445    fi
   1.446    
   1.447 -  if test "x$MSVCR_DLL" = x; then
   1.448 -    AC_MSG_CHECKING([for msvcr100.dll])
   1.449 +  if test "x$MSVC_DLL" = x; then
   1.450 +    AC_MSG_CHECKING([for $DLL_NAME])
   1.451      AC_MSG_RESULT([no])
   1.452 -    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
   1.453 +    AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
   1.454    fi
   1.455  
   1.456 -  BASIC_FIXUP_PATH(MSVCR_DLL)
   1.457 +  $1=$MSVC_DLL
   1.458 +  BASIC_FIXUP_PATH($1)
   1.459 +  AC_SUBST($1, [$]$1)
   1.460  ])
   1.461 +
   1.462 +AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
   1.463 +[
   1.464 +  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
   1.465 +      [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
   1.466 +
   1.467 +  if test "x$with_msvcr_dll" != x; then
   1.468 +    # If given explicitely by user, do not probe. If not present, fail directly.
   1.469 +    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll],
   1.470 +        [--with-msvcr-dll])
   1.471 +    if test "x$MSVC_DLL" = x; then
   1.472 +      AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
   1.473 +    fi
   1.474 +  else
   1.475 +    TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}])
   1.476 +  fi
   1.477 +
   1.478 +  AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
   1.479 +      [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
   1.480 +
   1.481 +  if test "x$MSVCP_NAME" != "x"; then
   1.482 +    if test "x$with_msvcp_dll" != x; then
   1.483 +      # If given explicitely by user, do not probe. If not present, fail directly.
   1.484 +      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll],
   1.485 +          [--with-msvcp-dll])
   1.486 +      if test "x$MSVC_DLL" = x; then
   1.487 +        AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
   1.488 +      fi
   1.489 +    else
   1.490 +      TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}])
   1.491 +    fi
   1.492 +  fi
   1.493 +])
   1.494 +

mercurial