common/autoconf/toolchain_windows.m4
author ihse
Fri, 09 Jan 2015 16:59:36 +0100
changeset 28287 d031becc9e35
parent 27595 cff167b3bfa2
child 28809 6481e27e00ee
child 28901 5acc0ec03d06
permissions -rw-r--r--
8068735: Configure fails on Windows if Visual Studio $LIB/$INCLUDE is lower case Reviewed-by: erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
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
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    26
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    27
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    28
  if test "x$VS_ENV_CMD" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    29
    VS100BASE="$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    30
    METHOD="$2"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    31
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    32
    if test -d "$VS100BASE"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    33
      if test -f "$VS100BASE/$VCVARSFILE"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    34
        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    35
        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
    36
        # 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
    37
        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
    38
        # TODO: improve detection for other versions of VS
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
    39
        PLATFORM_TOOLSET="v100"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    40
      else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    41
        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    42
        AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    43
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    44
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    45
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    46
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    47
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    48
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    49
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    50
  if test "x$VS_ENV_CMD" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    51
    WIN_SDK_BASE="$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    52
    METHOD="$2"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    53
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    54
    if test -d "$WIN_SDK_BASE"; then
14565
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
    55
      # 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
    56
      # lib dir is not going to work.
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
    57
      if test ! -d "$WIN_SDK_BASE/../lib"; then
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
    58
        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
    59
        AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
c499bdf08f27 8003414: build-infra: fails on on windows
erikj
parents: 14562
diff changeset
    60
      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    61
        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    62
        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    63
        if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    64
          VS_ENV_ARGS="/x86"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    65
        else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    66
          VS_ENV_ARGS="/x64"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    67
        fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
    68
        # 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
    69
        # '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
    70
        # TODO: improve detection for other versions of SDK
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25882
diff changeset
    71
        PLATFORM_TOOLSET="Windows7.1SDK"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    72
      else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    73
        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    74
        AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    75
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    76
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    77
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    78
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    79
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    80
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    81
[
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    82
  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    83
    VCVARSFILE="vc/bin/vcvars32.bat"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    84
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    85
    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
    86
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    87
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    88
  VS_ENV_CMD=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    89
  VS_ENV_ARGS=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    90
  if test "x$with_toolsdir" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    91
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    92
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    93
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    94
  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    95
    # Having specified an argument which is incorrect will produce an instant failure;
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    96
    # we should not go on looking
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    97
    AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    98
    AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
    99
    AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   100
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   101
17818
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   102
  if test "x$VS100COMNTOOLS" != x; then
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   103
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   104
  fi
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   105
  if test "x$PROGRAMFILES" != x; then
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   106
    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   107
  fi
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   108
  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   109
  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
cfaa38a17d56 8008707: build-infra: Closed (deploy) can't be built using environment from SDK SetEnv.cmd
erikj
parents: 15844
diff changeset
   110
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   111
  if test "x$ProgramW6432" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   112
    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   113
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   114
  if test "x$PROGRAMW6432" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   115
    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   116
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   117
  if test "x$PROGRAMFILES" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   118
    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   119
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   120
  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   121
  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   122
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   123
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   124
# Check if the VS env variables were setup prior to running configure.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   125
# If not, then find vcvarsall.bat and run it automatically, and integrate
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   126
# the set env variables into the spec file.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   127
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   128
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   129
  # 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
   130
  # VS linker. This must be done before changing the PATH when looking for VS.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   131
  AC_PATH_PROG(CYGWIN_LINK, link)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   132
  if test "x$CYGWIN_LINK" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   133
    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
   134
    "$CYGWIN_LINK" --version > /dev/null
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   135
    if test $? -eq 0 ; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   136
      AC_MSG_RESULT([yes])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   137
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   138
      AC_MSG_RESULT([no])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   139
      # This might be the VS linker. Don't exclude it later on.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   140
      CYGWIN_LINK=""
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   141
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   142
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   143
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   144
  # First-hand choice is to locate and run the vsvars bat file.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   145
  TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   146
  if test "x$VS_ENV_CMD" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   147
    # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   148
    BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   149
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   150
    # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   151
    AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   152
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   153
    # We need to create a couple of temporary files.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   154
    VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   155
    $MKDIR -p $VS_ENV_TMP_DIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   156
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   157
    # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   158
    # Instead create a shell script which will set the relevant variables when run.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   159
    WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   160
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   161
    WINPATH_BASH="$BASH"
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   162
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   163
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   164
    # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   165
    # script (executable by bash) that will setup the important variables.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   166
    EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   167
    $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   168
    # This will end up something like:
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   169
    # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   170
    $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   171
    # These will end up something like:
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   172
    # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   173
    # The trailing space for everyone except PATH is no typo, but is needed due
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   174
    # to trailing \ in the Windows paths. These will be stripped later.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   175
    $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
28287
d031becc9e35 8068735: Configure fails on Windows if Visual Studio $LIB/$INCLUDE is lower case
ihse
parents: 27595
diff changeset
   176
    $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
d031becc9e35 8068735: Configure fails on Windows if Visual Studio $LIB/$INCLUDE is lower case
ihse
parents: 27595
diff changeset
   177
    $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   178
    $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   179
    $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   180
    $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   181
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   182
    # Now execute the newly created bat file.
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   183
    # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   184
    # Change directory so we don't need to mess with Windows paths in redirects.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   185
    cd $VS_ENV_TMP_DIR
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   186
    cmd /c extract-vs-env.bat | $CAT
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   187
    cd $CURDIR
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   188
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   189
    if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   190
      AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   191
      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
   192
      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
   193
      AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   194
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   195
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   196
    # Now set all paths and other env variables. This will allow the rest of
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   197
    # the configure script to find and run the compiler in the proper way.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   198
    AC_MSG_NOTICE([Setting extracted environment variables])
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   199
    . $VS_ENV_TMP_DIR/set-vs-env.sh
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   200
    # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   201
    # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   202
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   203
    # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   204
    AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   205
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   206
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   207
  # 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
   208
  AC_MSG_CHECKING([for Visual Studio variables])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   209
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   210
  if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   211
    if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   212
      AC_MSG_RESULT([present but broken])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   213
      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
   214
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   215
      AC_MSG_RESULT([ok])
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   216
      # Remove any trailing "\" and " " from the variables.
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   217
      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   218
      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   219
      VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   220
      WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   221
      WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
23432
f8964bac59db 8039030: 9-dev windows-i586 build failed with mktemp: command not found
erikj
parents: 23429
diff changeset
   222
      # 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
   223
      # 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
   224
      VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
23429
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   225
fe4f0848a307 8035751: Clean up Visual Studio detection logic
ihse
parents: 20643
diff changeset
   226
      AC_SUBST(VS_PATH)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   227
      AC_SUBST(VS_INCLUDE)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   228
      AC_SUBST(VS_LIB)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   229
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   230
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   231
    AC_MSG_RESULT([not found])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   232
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   233
    if test "x$VS_ENV_CMD" = x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   234
      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
   235
      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
   236
    else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   237
      AC_MSG_NOTICE([Running the extraction script failed.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   238
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   239
    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
   240
    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
   241
    AC_MSG_ERROR([Cannot continue])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   242
  fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   243
])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19758
diff changeset
   244
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   245
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   246
[
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   247
  POSSIBLE_MSVCR_DLL="$1"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   248
  METHOD="$2"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   249
  if test -e "$POSSIBLE_MSVCR_DLL"; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   250
    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   251
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   252
    # Need to check if the found msvcr is correct architecture
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   253
    AC_MSG_CHECKING([found msvcr100.dll architecture])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   254
    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   255
    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   256
      # 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
   257
      # 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
   258
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   259
        CORRECT_MSVCR_ARCH="PE32 executable"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   260
      else
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   261
        CORRECT_MSVCR_ARCH="PE32+ executable"
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   262
      fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   263
    else
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   264
      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   265
        CORRECT_MSVCR_ARCH=386
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   266
      else
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   267
        CORRECT_MSVCR_ARCH=x86-64
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   268
      fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   269
    fi
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 23432
diff changeset
   270
    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   271
      AC_MSG_RESULT([ok])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   272
      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   273
      AC_MSG_CHECKING([for msvcr100.dll])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   274
      AC_MSG_RESULT([$MSVCR_DLL])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   275
    else
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   276
      AC_MSG_RESULT([incorrect, ignoring])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   277
      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   278
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   279
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   280
])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   281
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   282
AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   283
[
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   284
  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   285
      [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   286
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   287
  if test "x$with_msvcr_dll" != x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   288
    # If given explicitely by user, do not probe. If not present, fail directly.
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   289
    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   290
    if test "x$MSVCR_DLL" = x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   291
      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   292
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   293
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   294
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   295
  if test "x$MSVCR_DLL" = x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   296
    # Probe: Using well-known location from Visual Studio 10.0
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   297
    if test "x$VCINSTALLDIR" != x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   298
      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   299
      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   300
      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   301
        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   302
      else
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   303
        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   304
      fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   305
      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   306
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   307
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   308
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   309
  if test "x$MSVCR_DLL" = x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   310
    # Probe: Check in the Boot JDK directory.
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   311
    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   312
    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   313
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   314
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   315
  if test "x$MSVCR_DLL" = x; then
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   316
    # Probe: Look in the Windows system32 directory
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   317
    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   318
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   319
    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   320
    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   321
  fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   322
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   323
  if test "x$MSVCR_DLL" = x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   324
    # 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
   325
    if test "x$VS100COMNTOOLS" != x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   326
      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   327
      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   328
      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   329
        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   330
      else
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   331
        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   332
      fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   333
      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   334
    fi
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   335
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   336
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   337
  if test "x$MSVCR_DLL" = x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   338
    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   339
    # (This was the original behaviour; kept since it might turn up something)
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   340
    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   341
      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   342
        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   343
      else
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   344
        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   345
        if test "x$POSSIBLE_MSVCR_DLL" = x; then
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   346
          # We're grasping at straws now...
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   347
          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   348
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   349
      fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   350
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   351
      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
14111
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
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 26400
diff changeset
   354
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   355
  if test "x$MSVCR_DLL" = x; then
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   356
    AC_MSG_CHECKING([for msvcr100.dll])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   357
    AC_MSG_RESULT([no])
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   358
    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   359
  fi
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   360
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   361
  BASIC_FIXUP_PATH(MSVCR_DLL)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents:
diff changeset
   362
])