make/autoconf/toolchain_windows.m4
author ihse
Mon, 04 Nov 2019 11:15:45 +0100
changeset 58909 66f7d2494d4e
parent 58560 5a4b4544b810
child 58679 9c3209ff7550
permissions -rw-r--r--
8233383: Various minor fixes Reviewed-by: erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#
54635
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
     2
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     4
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    10
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    15
# accompanied this code).
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    16
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    20
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    23
# questions.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    24
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    25
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    26
################################################################################
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
    27
# The order of these defines the priority by which we try to find them.
54635
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    28
VALID_VS_VERSIONS="2017 2019 2013 2015 2012 2010"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    29
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    30
VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    31
VS_VERSION_INTERNAL_2010=100
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    32
VS_MSVCR_2010=msvcr100.dll
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    33
# We don't use msvcp on Visual Studio 2010
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    34
#VS_MSVCP_2010=msvcp100.dll
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    35
VS_ENVVAR_2010="VS100COMNTOOLS"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    36
VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    37
VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    38
VS_VS_PLATFORM_NAME_2010="v100"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    39
VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
    40
VS_SUPPORTED_2010=false
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    41
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    42
VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    43
VS_VERSION_INTERNAL_2012=110
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    44
VS_MSVCR_2012=msvcr110.dll
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    45
VS_MSVCP_2012=msvcp110.dll
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    46
VS_ENVVAR_2012="VS110COMNTOOLS"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    47
VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    48
VS_SDK_INSTALLDIR_2012=
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    49
VS_VS_PLATFORM_NAME_2012="v110"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    50
VS_SDK_PLATFORM_NAME_2012=
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
    51
VS_SUPPORTED_2012=false
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    52
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    53
VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    54
VS_VERSION_INTERNAL_2013=120
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    55
VS_MSVCR_2013=msvcr120.dll
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    56
VS_MSVCP_2013=msvcp120.dll
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    57
VS_ENVVAR_2013="VS120COMNTOOLS"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    58
VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    59
VS_SDK_INSTALLDIR_2013=
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    60
VS_VS_PLATFORM_NAME_2013="v120"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    61
VS_SDK_PLATFORM_NAME_2013=
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
    62
VS_SUPPORTED_2013=false
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    63
50273
737a17045ffe 8203795: Change default compiler on Windows to VS2017
erikj
parents: 50073
diff changeset
    64
VS_DESCRIPTION_2015="Microsoft Visual Studio 2015"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    65
VS_VERSION_INTERNAL_2015=140
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    66
VS_MSVCR_2015=vcruntime140.dll
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    67
VS_MSVCP_2015=msvcp140.dll
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    68
VS_ENVVAR_2015="VS140COMNTOOLS"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    69
VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    70
VS_SDK_INSTALLDIR_2015=
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    71
VS_VS_PLATFORM_NAME_2015="v140"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    72
VS_SDK_PLATFORM_NAME_2015=
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    73
# The vcvars of 2015 breaks if 2017 is also installed. Work around this by
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    74
# explicitly specifying Windows Kit 8.1 to be used.
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    75
VS_ENV_ARGS_2015="8.1"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
    76
VS_SUPPORTED_2015=false
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    77
50273
737a17045ffe 8203795: Change default compiler on Windows to VS2017
erikj
parents: 50073
diff changeset
    78
VS_DESCRIPTION_2017="Microsoft Visual Studio 2017"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    79
VS_VERSION_INTERNAL_2017=141
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    80
VS_MSVCR_2017=vcruntime140.dll
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    81
VS_MSVCP_2017=msvcp140.dll
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    82
VS_ENVVAR_2017="VS150COMNTOOLS"
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
    83
VS_USE_UCRT_2017="true"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    84
VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
49208
a9d89773efca 8199473: Support Visual Studio BuildTools with VS2017
erikj
parents: 48678
diff changeset
    85
VS_EDITIONS_2017="BuildTools Community Professional Enterprise"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    86
VS_SDK_INSTALLDIR_2017=
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    87
VS_VS_PLATFORM_NAME_2017="v141"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    88
VS_SDK_PLATFORM_NAME_2017=
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
    89
VS_SUPPORTED_2017=true
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
    90
VS_TOOLSET_SUPPORTED_2017=true
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    91
54635
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    92
VS_DESCRIPTION_2019="Microsoft Visual Studio 2019"
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    93
VS_VERSION_INTERNAL_2019=141
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    94
VS_MSVCR_2019=vcruntime140.dll
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    95
VS_MSVCP_2019=msvcp140.dll
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    96
VS_ENVVAR_2019="VS160COMNTOOLS"
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    97
VS_USE_UCRT_2019="true"
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    98
VS_VS_INSTALLDIR_2019="Microsoft Visual Studio/2019"
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
    99
VS_EDITIONS_2019="BuildTools Community Professional Enterprise"
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   100
VS_SDK_INSTALLDIR_2019=
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   101
VS_VS_PLATFORM_NAME_2019="v142"
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   102
VS_SDK_PLATFORM_NAME_2019=
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   103
VS_SUPPORTED_2019=false
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   104
VS_TOOLSET_SUPPORTED_2019=false
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   105
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   106
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   107
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   108
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   109
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   110
  if test "x$VS_ENV_CMD" = x; then
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   111
    VS_VERSION="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   112
    VS_BASE="$2"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   113
    METHOD="$3"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   114
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   115
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
54635
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   116
    # In VS 2017 and VS 2019, the default installation is in a subdir named after the edition.
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   117
    # Find the first one present and use that.
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   118
    if test "x$VS_EDITIONS" != x; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   119
      for edition in $VS_EDITIONS; do
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   120
        if test -d "$VS_BASE/$edition"; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   121
          VS_BASE="$VS_BASE/$edition"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   122
          break
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   123
        fi
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   124
      done
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   125
    fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   126
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   127
    if test -d "$VS_BASE"; then
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   128
      AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   129
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   130
        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   131
      else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   132
        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   133
            VC/Auxiliary/Build/vcvarsx86_amd64.bat VC/Auxiliary/Build/vcvars64.bat"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   134
      fi
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   135
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   136
      for VCVARSFILE in $VCVARSFILES; do
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   137
        if test -f "$VS_BASE/$VCVARSFILE"; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   138
          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   139
          break
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   140
        fi
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   141
      done
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   142
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   143
      if test "x$VS_ENV_CMD" = x; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   144
        AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring])
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   145
      else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   146
        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   147
        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   148
        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   149
        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   150
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   151
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   152
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   153
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   154
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   155
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   156
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   157
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   158
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   159
  if test "x$VS_ENV_CMD" = x; then
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   160
    VS_VERSION="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   161
    WIN_SDK_BASE="$2"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   162
    METHOD="$3"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   163
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   164
    if test -d "$WIN_SDK_BASE"; then
14565
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
   165
      # There have been cases of partial or broken SDK installations. A missing
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
   166
      # lib dir is not going to work.
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   167
      if test ! -d "$WIN_SDK_BASE/lib"; then
14565
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
   168
        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
   169
        AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   170
      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   171
        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   172
        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   173
        if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   174
          VS_ENV_ARGS="/x86"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   175
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   176
          VS_ENV_ARGS="/x64"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   177
        fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
   178
        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
   179
        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
   180
        # TODO: improve detection for other versions of SDK
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   181
        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   182
      else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   183
        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   184
        AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   185
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   186
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   187
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   188
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   189
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   190
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   191
# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   192
# build environment and assigns it to VS_ENV_CMD
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   193
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   194
[
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   195
  # VS2017 provides the option to install previous minor versions of the MSVC
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   196
  # toolsets. It is not possible to directly download earlier minor versions of
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   197
  # VS2017 and in order to build with a previous minor compiler toolset version,
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   198
  # it is now possible to compile with earlier minor versions by passing
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   199
  # -vcvars_ver=<toolset_version> argument to vcvarsall.bat.
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   200
  AC_ARG_WITH(msvc-toolset-version, [AS_HELP_STRING([--with-msvc-toolset-version],
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   201
      [specific MSVC toolset version to use, passed as -vcvars_ver argument to
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   202
       pass to vcvarsall.bat (Windows only)])])
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   203
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   204
  VS_VERSION="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   205
  eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   206
  eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   207
  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   208
  eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   209
  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   210
  eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   211
  eval VS_TOOLSET_SUPPORTED="\${VS_TOOLSET_SUPPORTED_${VS_VERSION}}"
58560
5a4b4544b810 8232167: Visual Studio install found through --with-tools-dir value is discarded
jvernee
parents: 58139
diff changeset
   212
    
5a4b4544b810 8232167: Visual Studio install found through --with-tools-dir value is discarded
jvernee
parents: 58139
diff changeset
   213
  VS_ENV_CMD="" 
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   214
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   215
  # When using --with-tools-dir, assume it points to the correct and default
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   216
  # version of Visual Studio or that --with-toolchain-version was also set.
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   217
  if test "x$with_tools_dir" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   218
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   219
        [$with_tools_dir/../..], [--with-tools-dir])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   220
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   221
        [$with_tools_dir/../../..], [--with-tools-dir])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   222
    if test "x$VS_ENV_CMD" = x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   223
      # Having specified an argument which is incorrect will produce an instant failure;
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   224
      # we should not go on looking
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   225
      AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   226
      AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   227
      AC_MSG_NOTICE([directory within the Visual Studio installation])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   228
      AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   229
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   230
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   231
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   232
  if test "x$VS_COMNTOOLS" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   233
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   234
        [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
17818
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   235
  fi
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   236
  if test "x$PROGRAMFILES" != x; then
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   237
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   238
        [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
17818
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   239
  fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   240
  # Work around the insanely named ProgramFiles(x86) env variable
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   241
  PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   242
  if test "x$PROGRAMFILES_X86" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   243
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   244
        [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   245
  fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   246
  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   247
      [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   248
  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   249
      [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   250
  if test "x$SDK_INSTALL_DIR" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   251
    if test "x$ProgramW6432" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   252
      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   253
          [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   254
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   255
    if test "x$PROGRAMW6432" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   256
      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   257
          [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   258
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   259
    if test "x$PROGRAMFILES" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   260
      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   261
          [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   262
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   263
    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   264
        [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   265
    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   266
        [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   267
  fi
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   268
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   269
  if test "x$VS_TOOLSET_SUPPORTED" != x; then
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   270
    if test "x$with_msvc_toolset_version" != x; then
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   271
      VS_ENV_ARGS="$VS_ENV_ARGS -vcvars_ver=$with_msvc_toolset_version"
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   272
    fi
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   273
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   274
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   275
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   276
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   277
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   278
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   279
[
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   280
  AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   281
      [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   282
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   283
  if test "x$with_toolchain_version" = xlist; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   284
    # List all toolchains
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   285
    AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   286
    for version in $VALID_VS_VERSIONS; do
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   287
      eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   288
      $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   289
    done
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   290
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   291
    exit 0
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   292
  elif test "x$DEVKIT_VS_VERSION" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   293
    VS_VERSION=$DEVKIT_VS_VERSION
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   294
    TOOLCHAIN_VERSION=$VS_VERSION
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   295
    # If the devkit has a name, use that as description
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   296
    VS_DESCRIPTION="$DEVKIT_NAME"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   297
    if test "x$VS_DESCRIPTION" = x; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   298
      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   299
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   300
    eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   301
    eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   302
    eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   303
    eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
   304
    eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   305
    eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
53240
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   306
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   307
    # The TOOLCHAIN_PATH from a devkit is in Unix format. In WSL we need a
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   308
    # windows version of the complete VS_PATH as VS_PATH_WINDOWS
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   309
    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   310
      # Convert the toolchain path
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   311
      OLDIFS="$IFS"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   312
      IFS=":"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   313
      VS_PATH_WINDOWS=""
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   314
      for i in $TOOLCHAIN_PATH; do
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   315
        path=$i
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   316
        BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([path])
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   317
        VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$path"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   318
      done
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   319
      IFS="$OLDIFS"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   320
      # Append the current path from Windows env
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   321
      WINDOWS_PATH="`$CMD /c echo %PATH%`"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   322
      VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$WINDOWS_PATH"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   323
    else
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   324
      VS_PATH="$TOOLCHAIN_PATH:$PATH"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   325
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   326
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   327
    # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   328
    # can still be exported as INCLUDE for compiler invocations without
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   329
    # SYSROOT_CFLAGS
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   330
    OLDIFS="$IFS"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   331
    IFS=";"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   332
    for i in $DEVKIT_VS_INCLUDE; do
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   333
      ipath=$i
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   334
      BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   335
      VS_INCLUDE="$VS_INCLUDE;$ipath"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   336
    done
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   337
    # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   338
    # as LIB for compiler invocations without SYSROOT_LDFLAGS
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   339
    for i in $DEVKIT_VS_LIB; do
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   340
      libpath=$i
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   341
      BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   342
      VS_LIB="$VS_LIB;$libpath"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   343
    done
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   344
    IFS="$OLDIFS"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   345
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   346
    AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   347
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   348
  elif test "x$with_toolchain_version" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   349
    # User override; check that it is valid
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   350
    if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   351
      AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   352
      AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   353
      AC_MSG_ERROR([Cannot continue.])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   354
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   355
    VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   356
  else
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   357
    # No flag given, use default
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   358
    VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   359
  fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   360
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   361
  for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   362
    TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   363
    if test "x$VS_ENV_CMD" != x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   364
      TOOLCHAIN_VERSION=$VS_VERSION
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   365
      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   366
      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   367
      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   368
      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   369
      eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
   370
      eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   371
      # The rest of the variables are already evaled while probing
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   372
      AC_MSG_NOTICE([Found $VS_DESCRIPTION])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   373
      break
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   374
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   375
  done
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   376
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   377
  TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
   378
  if test "x$VS_SUPPORTED" = "xfalse"; then
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   379
    UNSUPPORTED_TOOLCHAIN_VERSION=yes
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   380
  fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   381
])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   382
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   383
################################################################################
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   384
# Check if the VS env variables were setup prior to running configure.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   385
# If not, then find vcvarsall.bat and run it automatically, and integrate
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   386
# the set env variables into the spec file.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   387
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   388
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   389
  # Store path to cygwin link.exe to help excluding it when searching for
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   390
  # VS linker. This must be done before changing the PATH when looking for VS.
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   391
  AC_PATH_PROG(CYGWIN_LINK, link.exe)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   392
  if test "x$CYGWIN_LINK" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   393
    AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   394
    "$CYGWIN_LINK" --version > /dev/null
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   395
    if test $? -eq 0 ; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   396
      AC_MSG_RESULT([yes])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   397
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   398
      AC_MSG_RESULT([no])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   399
      # This might be the VS linker. Don't exclude it later on.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   400
      CYGWIN_LINK=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   401
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   402
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   403
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   404
  # First-hand choice is to locate and run the vsvars bat file.
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   405
  TOOLCHAIN_FIND_VISUAL_STUDIO
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   406
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   407
  # If we have a devkit, skip all of the below.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   408
  if test "x$DEVKIT_VS_VERSION" = x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   409
    if test "x$VS_ENV_CMD" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   410
      # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   411
      BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   412
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   413
      # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   414
      AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   415
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   416
      # We need to create a couple of temporary files.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   417
      VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   418
      $MKDIR -p $VS_ENV_TMP_DIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   419
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   420
      # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   421
      # Instead create a shell script which will set the relevant variables when run.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   422
      WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   423
      BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   424
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   425
      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   426
        WINPATH_BASH="bash"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   427
      else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   428
        WINPATH_BASH="$BASH"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   429
        BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   430
      fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   431
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   432
      # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   433
      # script (executable by bash) that will setup the important variables.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   434
      EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   435
      $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   436
      # This will end up something like:
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   437
      # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   438
      $ECHO "call \"$WINPATH_VS_ENV_CMD\" $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   439
      # In some cases, the VS_ENV_CMD will change directory, change back so
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   440
      # the set-vs-env.sh ends up in the right place.
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   441
      $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   442
      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   443
        # These will end up something like:
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   444
        # echo VS_PATH=\"$PATH\" > set-vs-env.sh
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   445
        # The trailing space for everyone except PATH is no typo, but is needed due
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   446
        # to trailing \ in the Windows paths. These will be stripped later.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   447
        # Trying pure CMD extract. This results in windows paths that need to
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   448
        # be converted post extraction, but a simpler script.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   449
        $ECHO 'echo VS_PATH="%PATH%" > set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   450
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   451
        $ECHO 'echo VS_INCLUDE="%INCLUDE% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   452
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   453
        $ECHO 'echo VS_LIB="%LIB% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   454
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   455
        $ECHO 'echo VCINSTALLDIR="%VCINSTALLDIR% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   456
            >> $EXTRACT_VC_ENV_BAT_FILE
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   457
        $ECHO 'echo VCToolsRedistDir="%VCToolsRedistDir% " >> set-vs-env.sh' \
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   458
            >> $EXTRACT_VC_ENV_BAT_FILE
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   459
        $ECHO 'echo WindowsSdkDir="%WindowsSdkDir% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   460
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   461
        $ECHO 'echo WINDOWSSDKDIR="%WINDOWSSDKDIR% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   462
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   463
      else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   464
        # These will end up something like:
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   465
        # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   466
        # The trailing space for everyone except PATH is no typo, but is needed due
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   467
        # to trailing \ in the Windows paths. These will be stripped later.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   468
        $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   469
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   470
        $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   471
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   472
        $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   473
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   474
        $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   475
            >> $EXTRACT_VC_ENV_BAT_FILE
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   476
        $ECHO "$WINPATH_BASH -c 'echo VCToolsRedistDir="'\"$VCToolsRedistDir \" >> set-vs-env.sh' \
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   477
            >> $EXTRACT_VC_ENV_BAT_FILE
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   478
        $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   479
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   480
        $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   481
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   482
      fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   483
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   484
      # Now execute the newly created bat file.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   485
      # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   486
      # Change directory so we don't need to mess with Windows paths in redirects.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   487
      cd $VS_ENV_TMP_DIR
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   488
      $CMD /c extract-vs-env.bat | $CAT
54455
542735f2a53e 8221907: make reconfigure breaks when configured with relative paths
erikj
parents: 54265
diff changeset
   489
      cd $CONFIGURE_START_DIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   490
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   491
      if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   492
        AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.])
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   493
        AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   494
        AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   495
        AC_MSG_ERROR([Cannot continue])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   496
      fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   497
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   498
      # Remove windows line endings
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   499
      $SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   500
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   501
      # Now set all paths and other env variables. This will allow the rest of
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   502
      # the configure script to find and run the compiler in the proper way.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   503
      AC_MSG_NOTICE([Setting extracted environment variables])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   504
      . $VS_ENV_TMP_DIR/set-vs-env.sh
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   505
      # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   506
      # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
53240
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   507
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   508
      # In WSL, the extracted VS_PATH is Windows style. This needs to be
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   509
      # rewritten as Unix style and the Windows style version is saved
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   510
      # in VS_PATH_WINDOWS.
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   511
      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   512
        OLDIFS="$IFS"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   513
        IFS=";"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   514
        # Convert VS_PATH to unix style
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   515
        VS_PATH_WINDOWS="$VS_PATH"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   516
        VS_PATH=""
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   517
        for i in $VS_PATH_WINDOWS; do
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   518
          path=$i
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   519
          # Only process non-empty elements
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   520
          if test "x$path" != x; then
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   521
            IFS="$OLDIFS"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   522
            # Check that directory exists before calling fixup_path
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   523
            testpath=$path
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   524
            BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   525
            if test -d "$testpath"; then
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   526
              BASIC_FIXUP_PATH([path])
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   527
              BASIC_APPEND_TO_PATH(VS_PATH, $path)
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   528
            fi
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   529
            IFS=";"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   530
          fi
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   531
        done
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   532
        IFS="$OLDIFS"
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   533
      fi
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   534
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   535
    else
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   536
      # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   537
      AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   538
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   539
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   540
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   541
  # At this point, we should have correct variables in the environment, or we can't continue.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   542
  AC_MSG_CHECKING([for Visual Studio variables])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   543
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   544
  if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   545
      || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   546
    if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   547
      AC_MSG_RESULT([present but broken])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   548
      AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   549
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   550
      AC_MSG_RESULT([ok])
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   551
      # Remove any trailing "\" ";" and " " from the variables.
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   552
      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   553
      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   554
      VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   555
      VCToolsRedistDir=`$ECHO "$VCToolsRedistDir" | $SED 's/\\\\* *$//'`
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   556
      WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   557
      WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   558
      if test -z "$WINDOWSSDKDIR"; then
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   559
        WINDOWSSDKDIR="$WindowsSdkDir"
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   560
      fi
23432
f8964bac59db 8039030: 9-dev windows-i586 build failed with mktemp: command not found
erikj
parents: 23429
diff changeset
   561
      # Remove any paths containing # (typically F#) as that messes up make. This
f8964bac59db 8039030: 9-dev windows-i586 build failed with mktemp: command not found
erikj
parents: 23429
diff changeset
   562
      # is needed if visual studio was installed with F# support.
f8964bac59db 8039030: 9-dev windows-i586 build failed with mktemp: command not found
erikj
parents: 23429
diff changeset
   563
      VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   564
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   565
      AC_SUBST(VS_PATH)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   566
      AC_SUBST(VS_INCLUDE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   567
      AC_SUBST(VS_LIB)
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   568
53240
f6ab4cc4c70e 8216278: Fix devkit and basic Jib support on WSL
erikj
parents: 53110
diff changeset
   569
      # Convert VS_INCLUDE into SYSROOT_CFLAGS
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   570
      OLDIFS="$IFS"
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   571
      IFS=";"
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   572
      for i in $VS_INCLUDE; do
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   573
        ipath=$i
29065
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   574
        # Only process non-empty elements
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   575
        if test "x$ipath" != x; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   576
          IFS="$OLDIFS"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   577
          # Check that directory exists before calling fixup_path
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   578
          testpath=$ipath
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   579
          BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   580
          if test -d "$testpath"; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   581
            BASIC_FIXUP_PATH([ipath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   582
            SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   583
          fi
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   584
          IFS=";"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   585
        fi
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   586
      done
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   587
      # Convert VS_LIB into SYSROOT_LDFLAGS
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   588
      for i in $VS_LIB; do
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   589
        libpath=$i
29065
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   590
        # Only process non-empty elements
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   591
        if test "x$libpath" != x; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   592
          IFS="$OLDIFS"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   593
          # Check that directory exists before calling fixup_path
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   594
          testpath=$libpath
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   595
          BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   596
          if test -d "$testpath"; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   597
            BASIC_FIXUP_PATH([libpath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   598
            SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   599
          fi
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   600
          IFS=";"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   601
        fi
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   602
      done
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   603
      IFS="$OLDIFS"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   604
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   605
      AC_SUBST(VS_PATH_WINDOWS)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   606
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   607
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   608
    AC_MSG_RESULT([not found])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   609
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   610
    if test "x$VS_ENV_CMD" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   611
      AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   612
      AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   613
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   614
      AC_MSG_NOTICE([Running the extraction script failed.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   615
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   616
    AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   617
    AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   618
    AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   619
  fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   620
])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   621
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   622
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   623
[
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   624
  DLL_NAME="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   625
  POSSIBLE_MSVC_DLL="$2"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   626
  METHOD="$3"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   627
  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   628
    AC_MSG_NOTICE([Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD])
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   629
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   630
    # Need to check if the found msvcr is correct architecture
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   631
    AC_MSG_CHECKING([found $DLL_NAME architecture])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   632
    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   633
    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   634
      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   635
      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   636
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   637
        CORRECT_MSVCR_ARCH="PE32 executable"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   638
      else
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   639
        CORRECT_MSVCR_ARCH="PE32+ executable"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   640
      fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   641
    else
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   642
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   643
        CORRECT_MSVCR_ARCH=386
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   644
      else
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   645
        CORRECT_MSVCR_ARCH=x86-64
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   646
      fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   647
    fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   648
    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   649
      AC_MSG_RESULT([ok])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   650
      MSVC_DLL="$POSSIBLE_MSVC_DLL"
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   651
      AC_MSG_CHECKING([for $DLL_NAME])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   652
      AC_MSG_RESULT([$MSVC_DLL])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   653
    else
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   654
      AC_MSG_RESULT([incorrect, ignoring])
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   655
      AC_MSG_NOTICE([The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   656
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   657
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   658
])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   659
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   660
AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   661
[
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   662
  DLL_NAME="$1"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   663
  MSVC_DLL=
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   664
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   665
  if test "x$MSVC_DLL" = x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   666
    if test "x$VCINSTALLDIR" != x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   667
      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   668
      BASIC_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   669
      if test "$VS_VERSION" -lt 2017; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   670
        # Probe: Using well-known location from Visual Studio 12.0 and older
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   671
        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   672
          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   673
        else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   674
          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   675
        fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   676
      else
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   677
        CYGWIN_VC_TOOLS_REDIST_DIR="$VCToolsRedistDir"
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   678
        BASIC_FIXUP_PATH(CYGWIN_VC_TOOLS_REDIST_DIR)
54635
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54455
diff changeset
   679
        # Probe: Using well-known location from VS 2017 and VS 2019
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   680
        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   681
          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   682
        else
54265
1b0163c877c0 8220445: Support for side by side MSVC Toolset versions
erikj
parents: 53240
diff changeset
   683
          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   684
        fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   685
      fi
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   686
      # In case any of the above finds more than one file, loop over them.
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   687
      for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   688
        $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   689
        TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   690
            [well-known location in VCINSTALLDIR])
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   691
      done
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   692
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   693
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   694
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   695
  if test "x$MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   696
    # Probe: Check in the Boot JDK directory.
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   697
    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   698
    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   699
        [well-known location in Boot JDK])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   700
  fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   701
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   702
  if test "x$MSVC_DLL" = x; then
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   703
    # Probe: Look in the Windows system32 directory
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   704
    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   705
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   706
    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   707
    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   708
        [well-known location in SYSTEMROOT])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   709
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   710
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   711
  if test "x$MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   712
    # Probe: If Visual Studio Express is installed, there is usually one with the debugger
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   713
    if test "x$VS100COMNTOOLS" != x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   714
      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   715
      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   716
      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   717
        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   718
        | $GREP -i /x64/ | $HEAD --lines 1`
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   719
      else
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   720
        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   721
        | $GREP -i /x86/ | $HEAD --lines 1`
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   722
      fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   723
      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   724
          [search of VS100COMNTOOLS])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   725
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   726
  fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   727
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   728
  if test "x$MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   729
    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   730
    # (This was the original behaviour; kept since it might turn something up)
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   731
    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   732
      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   733
        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   734
        | $GREP x64 | $HEAD --lines 1`
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   735
      else
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   736
        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   737
        | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   738
        if test "x$POSSIBLE_MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   739
          # We're grasping at straws now...
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   740
          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   741
          | $HEAD --lines 1`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   742
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   743
      fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   744
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   745
      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   746
          [search of VCINSTALLDIR])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   747
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   748
  fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   749
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   750
  if test "x$MSVC_DLL" = x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   751
    AC_MSG_CHECKING([for $DLL_NAME])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   752
    AC_MSG_RESULT([no])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   753
    AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   754
  fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   755
])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   756
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   757
AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   758
[
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   759
  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   760
      [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   761
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   762
  if test "x$with_msvcr_dll" != x; then
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 30022
diff changeset
   763
    # If given explicitly by user, do not probe. If not present, fail directly.
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   764
    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$with_msvcr_dll], [--with-msvcr-dll])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   765
    if test "x$MSVC_DLL" = x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   766
      AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   767
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   768
    MSVCR_DLL="$MSVC_DLL"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   769
  elif test "x$DEVKIT_MSVCR_DLL" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   770
    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   771
    if test "x$MSVC_DLL" = x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   772
      AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit])
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   773
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   774
    MSVCR_DLL="$MSVC_DLL"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   775
  else
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   776
    TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   777
    MSVCR_DLL="$MSVC_DLL"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   778
  fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   779
  AC_SUBST(MSVCR_DLL)
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   780
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   781
  AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   782
      [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   783
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   784
  if test "x$MSVCP_NAME" != "x"; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   785
    if test "x$with_msvcp_dll" != x; then
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 30022
diff changeset
   786
      # If given explicitly by user, do not probe. If not present, fail directly.
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   787
      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$with_msvcp_dll], [--with-msvcp-dll])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   788
      if test "x$MSVC_DLL" = x; then
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   789
        AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   790
      fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   791
      MSVCP_DLL="$MSVC_DLL"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   792
    elif test "x$DEVKIT_MSVCP_DLL" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   793
      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   794
      if test "x$MSVC_DLL" = x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   795
        AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit])
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   796
      fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   797
      MSVCP_DLL="$MSVC_DLL"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   798
    else
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   799
      TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   800
      MSVCP_DLL="$MSVC_DLL"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   801
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   802
    AC_SUBST(MSVCP_DLL)
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   803
  fi
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   804
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   805
  AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   806
      [path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   807
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   808
  if test "x$USE_UCRT" = "xtrue"; then
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   809
    AC_MSG_CHECKING([for UCRT DLL dir])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   810
    if test "x$with_ucrt_dll_dir" != x; then
58139
593005ac5a0a 8216354: Syntax error in toolchain_windows.m4
stooke
parents: 54635
diff changeset
   811
      if test -z "$(ls -d "$with_ucrt_dll_dir/"*.dll 2> /dev/null)"; then
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   812
        AC_MSG_RESULT([no])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   813
        AC_MSG_ERROR([Could not find any dlls in $with_ucrt_dll_dir])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   814
      else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   815
        AC_MSG_RESULT([$with_ucrt_dll_dir])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   816
        UCRT_DLL_DIR="$with_ucrt_dll_dir"
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   817
        BASIC_FIXUP_PATH([UCRT_DLL_DIR])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   818
      fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   819
    elif test "x$DEVKIT_UCRT_DLL_DIR" != "x"; then
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   820
      UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR"
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   821
      AC_MSG_RESULT($UCRT_DLL_DIR)
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   822
    else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   823
      CYGWIN_WINDOWSSDKDIR="${WINDOWSSDKDIR}"
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   824
      BASIC_FIXUP_PATH([CYGWIN_WINDOWSSDKDIR])
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   825
      dll_subdir=$OPENJDK_TARGET_CPU
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   826
      if test "x$dll_subdir" = "xx86_64"; then
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   827
        dll_subdir="x64"
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   828
      fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   829
      UCRT_DLL_DIR="$CYGWIN_WINDOWSSDKDIR/Redist/ucrt/DLLs/$dll_subdir"
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   830
      if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   831
        # Try with version subdir
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   832
        UCRT_DLL_DIR="`ls -d $CYGWIN_WINDOWSSDKDIR/Redist/*/ucrt/DLLs/$dll_subdir \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   833
            2> /dev/null | $SORT -d | $HEAD -n1`"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   834
        if test -z "$UCRT_DLL_DIR" \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   835
            || test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   836
          AC_MSG_RESULT([no])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   837
          AC_MSG_ERROR([Could not find any dlls in $UCRT_DLL_DIR])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   838
        else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   839
          AC_MSG_RESULT($UCRT_DLL_DIR)
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   840
        fi
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   841
      else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   842
        AC_MSG_RESULT($UCRT_DLL_DIR)
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   843
      fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   844
    fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   845
  else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   846
    UCRT_DLL_DIR=
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   847
  fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   848
  AC_SUBST(UCRT_DLL_DIR)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   849
])