make/autoconf/toolchain_windows.m4
author erikj
Wed, 02 Jan 2019 12:59:26 +0100
changeset 53110 50677f43ac3d
parent 52804 28094715ae71
child 53240 f6ab4cc4c70e
permissions -rw-r--r--
8215445: Enable building for Windows in WSL Reviewed-by: ihse Contributed-by: andrewluotechnologies@outlook.com, erik.joelsson@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#
52804
28094715ae71 8214718: Update missing copyright year in build system
ihse
parents: 50639
diff changeset
     2
# Copyright (c) 2011, 2018, 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.
50273
737a17045ffe 8203795: Change default compiler on Windows to VS2017
erikj
parents: 50073
diff changeset
    28
VALID_VS_VERSIONS="2017 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
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
    90
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    91
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    92
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    93
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    94
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    95
  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
    96
    VS_VERSION="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    97
    VS_BASE="$2"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    98
    METHOD="$3"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
    99
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   100
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   101
    # In VS 2017, the default installation is in a subdir named after the edition.
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   102
    # Find the first one present and use that.
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   103
    if test "x$VS_EDITIONS" != x; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   104
      for edition in $VS_EDITIONS; do
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   105
        if test -d "$VS_BASE/$edition"; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   106
          VS_BASE="$VS_BASE/$edition"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   107
          break
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   108
        fi
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   109
      done
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   110
    fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   111
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   112
    if test -d "$VS_BASE"; then
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   113
      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
   114
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   115
        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   116
      else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   117
        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
   118
            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
   119
      fi
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   120
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   121
      for VCVARSFILE in $VCVARSFILES; do
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   122
        if test -f "$VS_BASE/$VCVARSFILE"; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   123
          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   124
          break
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   125
        fi
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   126
      done
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   127
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   128
      if test "x$VS_ENV_CMD" = x; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   129
        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
   130
      else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   131
        # 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
   132
        # (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
   133
        # '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
   134
        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   135
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   136
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   137
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   138
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   139
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   140
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   141
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   142
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   143
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   144
  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
   145
    VS_VERSION="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   146
    WIN_SDK_BASE="$2"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   147
    METHOD="$3"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   148
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   149
    if test -d "$WIN_SDK_BASE"; then
14565
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
   150
      # 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
   151
      # 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
   152
      if test ! -d "$WIN_SDK_BASE/lib"; then
14565
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
   153
        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
   154
        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
   155
      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   156
        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
   157
        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   158
        if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   159
          VS_ENV_ARGS="/x86"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   160
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   161
          VS_ENV_ARGS="/x64"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   162
        fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
   163
        # 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
   164
        # '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
   165
        # 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
   166
        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   167
      else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   168
        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   169
        AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   170
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   171
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   172
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   173
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   174
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   175
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   176
# 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
   177
# build environment and assigns it to VS_ENV_CMD
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   178
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   179
[
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   180
  VS_VERSION="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   181
  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
   182
  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
   183
  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   184
  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
   185
  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   186
  eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   187
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   188
  # 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
   189
  # 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
   190
  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
   191
    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
   192
        [$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
   193
    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
   194
        [$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
   195
    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
   196
      # 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
   197
      # 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
   198
      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
   199
      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
   200
      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
   201
      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
   202
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   203
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   204
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   205
  VS_ENV_CMD=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   206
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   207
  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
   208
    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
   209
        [$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
   210
  fi
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   211
  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
   212
    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
   213
        [$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
   214
  fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   215
  # 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
   216
  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
   217
  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
   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
        [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   220
  fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   221
  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
   222
      [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
   223
  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
   224
      [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
   225
  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
   226
    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
   227
      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
   228
          [$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
   229
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   230
    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
   231
      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
   232
          [$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
   233
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   234
    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
   235
      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
   236
          [$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
   237
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   238
    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
   239
        [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
   240
    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
   241
        [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   242
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   243
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   244
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   245
################################################################################
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   246
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   247
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
   248
[
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   249
  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
   250
      [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
   251
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   252
  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
   253
    # List all toolchains
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   254
    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
   255
    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
   256
      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
   257
      $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
   258
    done
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   259
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   260
    exit 0
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   261
  elif test "x$DEVKIT_VS_VERSION" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   262
    VS_VERSION=$DEVKIT_VS_VERSION
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   263
    TOOLCHAIN_VERSION=$VS_VERSION
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   264
    # If the devkit has a name, use that as description
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   265
    VS_DESCRIPTION="$DEVKIT_NAME"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   266
    if test "x$VS_DESCRIPTION" = x; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   267
      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   268
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   269
    eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   270
    eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   271
    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
   272
    eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
   273
    eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   274
    eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   275
    VS_PATH="$TOOLCHAIN_PATH:$PATH"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   276
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   277
    # 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
   278
    # can still be exported as INCLUDE for compiler invocations without
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   279
    # SYSROOT_CFLAGS
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   280
    OLDIFS="$IFS"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   281
    IFS=";"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   282
    for i in $DEVKIT_VS_INCLUDE; do
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   283
      ipath=$i
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   284
      BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   285
      VS_INCLUDE="$VS_INCLUDE;$ipath"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   286
    done
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   287
    # 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
   288
    # as LIB for compiler invocations without SYSROOT_LDFLAGS
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   289
    for i in $DEVKIT_VS_LIB; do
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   290
      libpath=$i
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   291
      BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   292
      VS_LIB="$VS_LIB;$libpath"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   293
    done
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   294
    IFS="$OLDIFS"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   295
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   296
    AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   297
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   298
  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
   299
    # 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
   300
    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
   301
      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
   302
      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
   303
      AC_MSG_ERROR([Cannot continue.])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   304
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   305
    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
   306
  else
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   307
    # No flag given, use default
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   308
    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
   309
  fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   310
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   311
  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
   312
    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
   313
    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
   314
      TOOLCHAIN_VERSION=$VS_VERSION
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   315
      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
   316
      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
   317
      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
   318
      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
   319
      eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
   320
      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
   321
      # 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
   322
      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
   323
      break
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   324
    fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   325
  done
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   326
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   327
  TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
50639
c12c79a49ca2 8205183: Warning about using VS2017 should be removed
erikj
parents: 50273
diff changeset
   328
  if test "x$VS_SUPPORTED" = "xfalse"; then
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   329
    UNSUPPORTED_TOOLCHAIN_VERSION=yes
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   330
  fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   331
])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   332
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   333
################################################################################
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   334
# Check if the VS env variables were setup prior to running configure.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   335
# If not, then find vcvarsall.bat and run it automatically, and integrate
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   336
# the set env variables into the spec file.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   337
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   338
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   339
  # 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
   340
  # 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
   341
  AC_PATH_PROG(CYGWIN_LINK, link.exe)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   342
  if test "x$CYGWIN_LINK" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   343
    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
   344
    "$CYGWIN_LINK" --version > /dev/null
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   345
    if test $? -eq 0 ; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   346
      AC_MSG_RESULT([yes])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   347
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   348
      AC_MSG_RESULT([no])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   349
      # This might be the VS linker. Don't exclude it later on.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   350
      CYGWIN_LINK=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   351
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   352
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   353
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   354
  # 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
   355
  TOOLCHAIN_FIND_VISUAL_STUDIO
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   356
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   357
  # If we have a devkit, skip all of the below.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   358
  if test "x$DEVKIT_VS_VERSION" = x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   359
    if test "x$VS_ENV_CMD" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   360
      # 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
   361
      BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   362
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   363
      # 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
   364
      AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   365
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   366
      # We need to create a couple of temporary files.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   367
      VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   368
      $MKDIR -p $VS_ENV_TMP_DIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   369
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   370
      # 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
   371
      # 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
   372
      WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   373
      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
   374
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   375
      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   376
        WINPATH_BASH="bash"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   377
      else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   378
        WINPATH_BASH="$BASH"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   379
        BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   380
      fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   381
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   382
      # 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
   383
      # script (executable by bash) that will setup the important variables.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   384
      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
   385
      $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   386
      # This will end up something like:
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   387
      # 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
   388
      $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
   389
      # 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
   390
      # 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
   391
      $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   392
      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   393
        # These will end up something like:
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   394
        # echo VS_PATH=\"$PATH\" > set-vs-env.sh
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   395
        # 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
   396
        # to trailing \ in the Windows paths. These will be stripped later.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   397
        # 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
   398
        # be converted post extraction, but a simpler script.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   399
        $ECHO 'echo VS_PATH="%PATH%" > set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   400
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   401
        $ECHO 'echo VS_INCLUDE="%INCLUDE% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   402
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   403
        $ECHO 'echo VS_LIB="%LIB% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   404
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   405
        $ECHO 'echo VCINSTALLDIR="%VCINSTALLDIR% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   406
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   407
        $ECHO 'echo WindowsSdkDir="%WindowsSdkDir% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   408
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   409
        $ECHO 'echo WINDOWSSDKDIR="%WINDOWSSDKDIR% " >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   410
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   411
      else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   412
        # These will end up something like:
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   413
        # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   414
        # 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
   415
        # to trailing \ in the Windows paths. These will be stripped later.
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   416
        $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
   417
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   418
        $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
   419
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   420
        $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
   421
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   422
        $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   423
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   424
        $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   425
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   426
        $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   427
            >> $EXTRACT_VC_ENV_BAT_FILE
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   428
      fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   429
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   430
      # Now execute the newly created bat file.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   431
      # 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
   432
      # 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
   433
      cd $VS_ENV_TMP_DIR
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   434
      $CMD /c extract-vs-env.bat | $CAT
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   435
      cd $CURDIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   436
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   437
      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
   438
        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
   439
        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
   440
        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
   441
        AC_MSG_ERROR([Cannot continue])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   442
      fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   443
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   444
      # Remove windows line endings
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   445
      $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
   446
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   447
      # 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
   448
      # 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
   449
      AC_MSG_NOTICE([Setting extracted environment variables])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   450
      . $VS_ENV_TMP_DIR/set-vs-env.sh
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   451
      # 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
   452
      # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   453
    else
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   454
      # 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
   455
      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
   456
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   457
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   458
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   459
  # 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
   460
  AC_MSG_CHECKING([for Visual Studio variables])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   461
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   462
  if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   463
      || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   464
    if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   465
      AC_MSG_RESULT([present but broken])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   466
      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
   467
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   468
      AC_MSG_RESULT([ok])
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   469
      # Remove any trailing "\" ";" and " " from the variables.
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   470
      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   471
      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   472
      VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $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
   473
      WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   474
      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
   475
      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
   476
        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
   477
      fi
23432
f8964bac59db 8039030: 9-dev windows-i586 build failed with mktemp: command not found
erikj
parents: 23429
diff changeset
   478
      # 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
   479
      # 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
   480
      VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   481
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   482
      AC_SUBST(VS_PATH)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   483
      AC_SUBST(VS_INCLUDE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   484
      AC_SUBST(VS_LIB)
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   485
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   486
      OLDIFS="$IFS"
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   487
      IFS=";"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   488
      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   489
        # Convert VS_PATH to unix style
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   490
        VS_PATH_WINDOWS="$VS_PATH"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   491
        VS_PATH=""
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   492
        for i in $VS_PATH_WINDOWS; do
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   493
          path=$i
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   494
          # Only process non-empty elements
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   495
          if test "x$path" != x; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   496
            IFS="$OLDIFS"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   497
            # Check that directory exists before calling fixup_path
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   498
            testpath=$path
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   499
            BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   500
            if test -d "$testpath"; then
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   501
              BASIC_FIXUP_PATH([path])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   502
              BASIC_APPEND_TO_PATH(VS_PATH, $path)
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   503
            fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   504
            IFS=";"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   505
          fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   506
        done
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   507
      fi
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   508
      # Convert VS_INCLUDE into SYSROOT_CFLAGS
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   509
      for i in $VS_INCLUDE; do
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   510
        ipath=$i
29065
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   511
        # Only process non-empty elements
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   512
        if test "x$ipath" != x; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   513
          IFS="$OLDIFS"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   514
          # 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
   515
          testpath=$ipath
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   516
          BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   517
          if test -d "$testpath"; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   518
            BASIC_FIXUP_PATH([ipath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   519
            SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   520
          fi
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   521
          IFS=";"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   522
        fi
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   523
      done
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   524
      # Convert VS_LIB into SYSROOT_LDFLAGS
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   525
      for i in $VS_LIB; do
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   526
        libpath=$i
29065
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   527
        # Only process non-empty elements
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   528
        if test "x$libpath" != x; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   529
          IFS="$OLDIFS"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   530
          # 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
   531
          testpath=$libpath
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   532
          BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   533
          if test -d "$testpath"; then
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   534
            BASIC_FIXUP_PATH([libpath])
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   535
            SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   536
          fi
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   537
          IFS=";"
907bcc4ce290 8073864: Configure must handle invalid elements on INCLUDE/LIB for visualstudio
ihse
parents: 28908
diff changeset
   538
        fi
28809
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   539
      done
6481e27e00ee 8071329: Stop exporting INCLUDE and LIB when building on windows
erikj
parents: 28287
diff changeset
   540
      IFS="$OLDIFS"
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   541
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   542
      AC_SUBST(VS_PATH_WINDOWS)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   543
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   544
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   545
    AC_MSG_RESULT([not found])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   546
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   547
    if test "x$VS_ENV_CMD" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   548
      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
   549
      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
   550
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   551
      AC_MSG_NOTICE([Running the extraction script failed.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   552
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   553
    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
   554
    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
   555
    AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   556
  fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   557
])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   558
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   559
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   560
[
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   561
  DLL_NAME="$1"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   562
  POSSIBLE_MSVC_DLL="$2"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   563
  METHOD="$3"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   564
  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
   565
    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
   566
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   567
    # Need to check if the found msvcr is correct architecture
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   568
    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
   569
    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   570
    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   571
      # 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
   572
      # 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
   573
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   574
        CORRECT_MSVCR_ARCH="PE32 executable"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   575
      else
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   576
        CORRECT_MSVCR_ARCH="PE32+ executable"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   577
      fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   578
    else
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   579
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   580
        CORRECT_MSVCR_ARCH=386
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   581
      else
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   582
        CORRECT_MSVCR_ARCH=x86-64
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   583
      fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   584
    fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   585
    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
   586
      AC_MSG_RESULT([ok])
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   587
      MSVC_DLL="$POSSIBLE_MSVC_DLL"
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   588
      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
   589
      AC_MSG_RESULT([$MSVC_DLL])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   590
    else
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   591
      AC_MSG_RESULT([incorrect, ignoring])
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   592
      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
   593
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   594
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   595
])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   596
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   597
AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   598
[
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   599
  DLL_NAME="$1"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   600
  MSVC_DLL=
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   601
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   602
  if test "x$MSVC_DLL" = x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   603
    if test "x$VCINSTALLDIR" != x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   604
      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
   605
      BASIC_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   606
      if test "$VS_VERSION" -lt 2017; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   607
        # 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
   608
        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   609
          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
   610
        else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   611
          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
   612
        fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   613
      else
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   614
        # Probe: Using well-known location from VS 2017
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   615
        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   616
          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   617
        else
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   618
          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   619
        fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   620
      fi
48678
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   621
      # 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
   622
      for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   623
        $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   624
        TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   625
            [well-known location in VCINSTALLDIR])
bcce1fa183e7 8196108: Add build support for VS 2015/2017
erikj
parents: 47216
diff changeset
   626
      done
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   627
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   628
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   629
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   630
  if test "x$MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   631
    # 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
   632
    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
   633
    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
   634
        [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
   635
  fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   636
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   637
  if test "x$MSVC_DLL" = x; then
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   638
    # 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
   639
    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   640
    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
   641
    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
   642
    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
   643
        [well-known location in SYSTEMROOT])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   644
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   645
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   646
  if test "x$MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   647
    # 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
   648
    if test "x$VS100COMNTOOLS" != x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   649
      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   650
      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   651
      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
   652
        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
   653
        | $GREP -i /x64/ | $HEAD --lines 1`
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   654
      else
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   655
        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
   656
        | $GREP -i /x86/ | $HEAD --lines 1`
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   657
      fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   658
      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
   659
          [search of VS100COMNTOOLS])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   660
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   661
  fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   662
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   663
  if test "x$MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   664
    # 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
   665
    # (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
   666
    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   667
      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
   668
        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
   669
        | $GREP x64 | $HEAD --lines 1`
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   670
      else
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   671
        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
   672
        | $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
   673
        if test "x$POSSIBLE_MSVC_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   674
          # 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
   675
          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
   676
          | $HEAD --lines 1`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   677
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   678
      fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   679
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   680
      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
   681
          [search of VCINSTALLDIR])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   682
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   683
  fi
29643
89e91c724316 8076531: Switch default compiler on Windows to VS2013
erikj
parents: 29065
diff changeset
   684
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   685
  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
   686
    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
   687
    AC_MSG_RESULT([no])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   688
    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
   689
  fi
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   690
])
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   691
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   692
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
   693
[
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   694
  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
   695
      [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
   696
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   697
  if test "x$with_msvcr_dll" != x; then
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 30022
diff changeset
   698
    # 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
   699
    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
   700
    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
   701
      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
   702
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   703
    MSVCR_DLL="$MSVC_DLL"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   704
  elif test "x$DEVKIT_MSVCR_DLL" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   705
    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   706
    if test "x$MSVC_DLL" = x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   707
      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
   708
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   709
    MSVCR_DLL="$MSVC_DLL"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   710
  else
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   711
    TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   712
    MSVCR_DLL="$MSVC_DLL"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   713
  fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   714
  AC_SUBST(MSVCR_DLL)
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   715
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   716
  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
   717
      [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
   718
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   719
  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
   720
    if test "x$with_msvcp_dll" != x; then
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 30022
diff changeset
   721
      # 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
   722
      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
   723
      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
   724
        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
   725
      fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   726
      MSVCP_DLL="$MSVC_DLL"
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   727
    elif test "x$DEVKIT_MSVCP_DLL" != x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   728
      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   729
      if test "x$MSVC_DLL" = x; then
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   730
        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
   731
      fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   732
      MSVCP_DLL="$MSVC_DLL"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   733
    else
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   734
      TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}])
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   735
      MSVCP_DLL="$MSVC_DLL"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   736
    fi
30022
362d77fbf008 8078437: Enable use of devkits for Windows
erikj
parents: 29790
diff changeset
   737
    AC_SUBST(MSVCP_DLL)
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 28287
diff changeset
   738
  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
   739
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   740
  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
   741
      [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
   742
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   743
  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
   744
    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
   745
    if test "x$with_ucrt_dll_dir" != x; then
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   746
      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
   747
        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
   748
        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
   749
      else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   750
        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
   751
        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
   752
        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
   753
      fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   754
    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
   755
      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
   756
      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
   757
    else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   758
      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
   759
      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
   760
      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
   761
      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
   762
        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
   763
      fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   764
      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
   765
      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
   766
        # Try with version subdir
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   767
        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
   768
            2> /dev/null | $SORT -d | $HEAD -n1`"
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   769
        if test -z "$UCRT_DLL_DIR" \
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   770
            || 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
   771
          AC_MSG_RESULT([no])
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   772
          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
   773
        else
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   774
          AC_MSG_RESULT($UCRT_DLL_DIR)
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52804
diff changeset
   775
        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
   776
      else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   777
        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
   778
      fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   779
    fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   780
  else
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   781
    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
   782
  fi
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   783
  AC_SUBST(UCRT_DLL_DIR)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   784
])