toolchain_windows.m4 revision 1158:5d7de212359d
1139823Simp#
210940Swollman# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3166807Srwatson# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4189657Srwatson#
5222217Srwatson# This code is free software; you can redistribute it and/or modify it
6166807Srwatson# under the terms of the GNU General Public License version 2 only, as
71541Srgrimes# published by the Free Software Foundation.  Oracle designates this
8222217Srwatson# particular file as subject to the "Classpath" exception as provided
9222217Srwatson# by Oracle in the LICENSE file that accompanied this code.
10222217Srwatson#
111541Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT
121541Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131541Srgrimes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141541Srgrimes# version 2 for more details (a copy is included in the LICENSE file that
151541Srgrimes# accompanied this code).
161541Srgrimes#
171541Srgrimes# You should have received a copy of the GNU General Public License version
181541Srgrimes# 2 along with this work; if not, write to the Free Software Foundation,
191541Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
201541Srgrimes#
211541Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
221541Srgrimes# or visit www.oracle.com if you need additional information or have any
231541Srgrimes# questions.
241541Srgrimes#
251541Srgrimes
261541SrgrimesAC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
271541Srgrimes[
281541Srgrimes  if test "x$VS_ENV_CMD" = x; then
291541Srgrimes    VS100BASE="$1"
301541Srgrimes    METHOD="$2"
311541Srgrimes    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
321541Srgrimes    if test -d "$VS100BASE"; then
331541Srgrimes      if test -f "$VS100BASE/$VCVARSFILE"; then
341541Srgrimes        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
3510940Swollman        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
361541Srgrimes        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
371541Srgrimes        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
38172467Ssilby        # TODO: improve detection for other versions of VS
39172467Ssilby        PLATFORM_TOOLSET="v100"
40172467Ssilby      else
41166807Srwatson        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
4255009Sshin        AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
43219579Sbz      fi
4454263Sshin    fi
45222748Srwatson  fi
4654263Sshin])
471541Srgrimes
481541SrgrimesAC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
491541Srgrimes[
501541Srgrimes  if test "x$VS_ENV_CMD" = x; then
51220879Sbz    WIN_SDK_BASE="$1"
5254263Sshin    METHOD="$2"
531541Srgrimes    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
541541Srgrimes    if test -d "$WIN_SDK_BASE"; then
551541Srgrimes      # There have been cases of partial or broken SDK installations. A missing
56164033Srwatson      # lib dir is not going to work.
571541Srgrimes      if test ! -d "$WIN_SDK_BASE/../lib"; then
58222217Srwatson        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
5946155Sphk        AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
6013491Speter      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
6113491Speter        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
621541Srgrimes        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
63166807Srwatson        if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
64166807Srwatson          VS_ENV_ARGS="/x86"
65166807Srwatson        else
66166807Srwatson          VS_ENV_ARGS="/x64"
6792760Sjeff        fi
6834923Sbde        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
691541Srgrimes        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
7054263Sshin        # TODO: improve detection for other versions of SDK
711541Srgrimes        PLATFORM_TOOLSET="Windows7.1SDK"
72196019Srwatson      else
731541Srgrimes        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
74221247Sbz        AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
751541Srgrimes      fi
761541Srgrimes    fi
771541Srgrimes  fi
78111145Sjlemon])
79139558Ssilby
80139558SsilbyAC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
81221247Sbz[
82221247Sbz  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
83221247Sbz    VCVARSFILE="vc/bin/vcvars32.bat"
84221247Sbz  else
8554263Sshin    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
8654263Sshin  fi
87221247Sbz
88221247Sbz  VS_ENV_CMD=""
8954263Sshin  VS_ENV_ARGS=""
9054263Sshin  if test "x$with_toolsdir" != x; then
911541Srgrimes    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
9254263Sshin  fi
93171167Sgnn
94105199Ssam  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
95105199Ssam    # Having specified an argument which is incorrect will produce an instant failure;
96171167Sgnn    # we should not go on looking
97105199Ssam    AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
98163606Srwatson    AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
99163606Srwatson    AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
100220879Sbz  fi
101220879Sbz
10213491Speter  if test "x$VS100COMNTOOLS" != x; then
10313491Speter    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
10413491Speter  fi
10513491Speter  if test "x$PROGRAMFILES" != x; then
106195699Srwatson    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
107195699Srwatson  fi
108195699Srwatson  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
109195699Srwatson  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
110195699Srwatson
111195699Srwatson  if test "x$ProgramW6432" != x; then
11213491Speter    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
113111205Scjc  fi
114111205Scjc  if test "x$PROGRAMW6432" != x; then
115111205Scjc    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
116111205Scjc  fi
117111205Scjc  if test "x$PROGRAMFILES" != x; then
118195699Srwatson    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
119195699Srwatson  fi
120111205Scjc  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
121139558Ssilby  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
122195699Srwatson])
123195699Srwatson
124195699Srwatson# Check if the VS env variables were setup prior to running configure.
125195699Srwatson# If not, then find vcvarsall.bat and run it automatically, and integrate
126195699Srwatson# the set env variables into the spec file.
127215701SdimAC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
128128547Ssilby[
129195727Srwatson  # Store path to cygwin link.exe to help excluding it when searching for
130195699Srwatson  # VS linker. This must be done before changing the PATH when looking for VS.
131222503Sbz  AC_PATH_PROG(CYGWIN_LINK, link)
132222503Sbz  if test "x$CYGWIN_LINK" != x; then
133222488Srwatson    AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
134222488Srwatson    "$CYGWIN_LINK" --version > /dev/null
135222488Srwatson    if test $? -eq 0 ; then
136222488Srwatson      AC_MSG_RESULT([yes])
137221247Sbz    else
13817541Speter      AC_MSG_RESULT([no])
13917541Speter      # This might be the VS linker. Don't exclude it later on.
14017541Speter      CYGWIN_LINK=""
14117541Speter    fi
14217541Speter  fi
14362573Sphk
14417541Speter  # First-hand choice is to locate and run the vsvars bat file.
145127936Sbde  TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
146127936Sbde  if test "x$VS_ENV_CMD" != x; then
147195699Srwatson    # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
148195699Srwatson    BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
149195699Srwatson
150191688Szec    # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
151195699Srwatson    AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
152127936Sbde
153181803Sbz    # We need to create a couple of temporary files.
154181803Sbz    VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
155181803Sbz    $MKDIR -p $VS_ENV_TMP_DIR
156181803Sbz
157181803Sbz    # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
158181803Sbz    # Instead create a shell script which will set the relevant variables when run.
15917541Speter    WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
160127936Sbde    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
16117541Speter    WINPATH_BASH="$BASH"
16217541Speter    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
16317541Speter
16417541Speter    # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
165227309Sed    # script (executable by bash) that will setup the important variables.
166227309Sed    EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
16714195Speter    $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
168195699Srwatson    # This will end up something like:
169195699Srwatson    # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
170183550Szec    $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
171195699Srwatson    # These will end up something like:
172195699Srwatson    # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
173183550Szec    # The trailing space for everyone except PATH is no typo, but is needed due
174195699Srwatson    # to trailing \ in the Windows paths. These will be stripped later.
175195699Srwatson    $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
176183550Szec    $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
177195699Srwatson    $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
178195699Srwatson    $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
179183550Szec    $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
180195699Srwatson    $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
181195699Srwatson
182183550Szec    # Now execute the newly created bat file.
183195699Srwatson    # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
184195699Srwatson    # Change directory so we don't need to mess with Windows paths in redirects.
185183550Szec    cd $VS_ENV_TMP_DIR
186195699Srwatson    cmd /c extract-vs-env.bat | $CAT
187195699Srwatson    cd $CURDIR
188195699Srwatson
189195699Srwatson    if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
190195699Srwatson      AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
191195699Srwatson      AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
192195699Srwatson      AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
193195699Srwatson      AC_MSG_ERROR([Cannot continue])
194183550Szec    fi
195195699Srwatson
196195699Srwatson    # Now set all paths and other env variables. This will allow the rest of
197183550Szec    # the configure script to find and run the compiler in the proper way.
198183550Szec    AC_MSG_NOTICE([Setting extracted environment variables])
199230442Sbz    . $VS_ENV_TMP_DIR/set-vs-env.sh
20013491Speter    # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
20132821Sdg    # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
20232821Sdg  else
20332821Sdg    # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
204148157Srwatson    AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
205148157Srwatson  fi
206148157Srwatson
20732821Sdg  # At this point, we should have correct variables in the environment, or we can't continue.
20832821Sdg  AC_MSG_CHECKING([for Visual Studio variables])
20932821Sdg
210205157Srwatson  if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then
211205157Srwatson    if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
212205157Srwatson      AC_MSG_RESULT([present but broken])
213205157Srwatson      AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
214205157Srwatson    else
215205157Srwatson      AC_MSG_RESULT([ok])
216205157Srwatson      # Remove any trailing "\" and " " from the variables.
217222748Srwatson      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
218205157Srwatson      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
219205157Srwatson      VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
220205157Srwatson      WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
221222488Srwatson      WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
222205157Srwatson      # Remove any paths containing # (typically F#) as that messes up make. This
223205157Srwatson      # is needed if visual studio was installed with F# support.
224205157Srwatson      VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
225205157Srwatson
226205157Srwatson      AC_SUBST(VS_PATH)
227222488Srwatson      AC_SUBST(VS_INCLUDE)
228205157Srwatson      AC_SUBST(VS_LIB)
229205157Srwatson    fi
230205157Srwatson  else
231205157Srwatson    AC_MSG_RESULT([not found])
232222748Srwatson
233222748Srwatson    if test "x$VS_ENV_CMD" = x; then
234222748Srwatson      AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
235205157Srwatson      AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
236205157Srwatson    else
237205157Srwatson      AC_MSG_NOTICE([Running the extraction script failed.])
238205157Srwatson    fi
239244031Spjd    AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
240244031Spjd    AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
241205157Srwatson    AC_MSG_ERROR([Cannot continue])
242205157Srwatson  fi
243205157Srwatson])
244205157Srwatson
245205157SrwatsonAC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
246205157Srwatson[
247205157Srwatson  POSSIBLE_MSVCR_DLL="$1"
248205157Srwatson  METHOD="$2"
249205157Srwatson  if test -e "$POSSIBLE_MSVCR_DLL"; then
250222488Srwatson    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
251222488Srwatson    
252222488Srwatson    # Need to check if the found msvcr is correct architecture
253205157Srwatson    AC_MSG_CHECKING([found msvcr100.dll architecture])
254205157Srwatson    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
255205157Srwatson    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
256222748Srwatson      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
257222748Srwatson      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
258222748Srwatson      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
259205157Srwatson        CORRECT_MSVCR_ARCH="PE32 executable"
260222488Srwatson      else
261205157Srwatson        CORRECT_MSVCR_ARCH="PE32+ executable"
262205157Srwatson      fi
263205157Srwatson    else
264205157Srwatson      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
26532821Sdg        CORRECT_MSVCR_ARCH=386
266160491Sups      else
26732821Sdg        CORRECT_MSVCR_ARCH=x86-64
2681541Srgrimes      fi
269160491Sups    fi
2701541Srgrimes    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
271154666Srwatson      AC_MSG_RESULT([ok])
27280406Sume      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
273122875Srwatson      AC_MSG_CHECKING([for msvcr100.dll])
274122329Ssam      AC_MSG_RESULT([$MSVCR_DLL])
275122875Srwatson    else
276160491Sups      AC_MSG_RESULT([incorrect, ignoring])
2771541Srgrimes      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
2781541Srgrimes    fi
279165634Sjhb  fi
2807684Sdg])
2811541Srgrimes
282183606SbzAC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
283178888Sjulian[
284122875Srwatson  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
285172930Srwatson      [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
286122875Srwatson
287122875Srwatson  if test "x$with_msvcr_dll" != x; then
288172930Srwatson    # If given explicitely by user, do not probe. If not present, fail directly.
289122875Srwatson    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
290171167Sgnn    if test "x$MSVCR_DLL" = x; then
29180406Sume      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
292174857Srwatson    fi
293174857Srwatson  fi
294174857Srwatson  
295174857Srwatson  if test "x$MSVCR_DLL" = x; then
296122875Srwatson    # Probe: Using well-known location from Visual Studio 10.0
297177300Srwatson    if test "x$VCINSTALLDIR" != x; then
298171167Sgnn      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
299164768Srwatson      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
300111145Sjlemon      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
301111145Sjlemon        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
302181803Sbz      else
303111145Sjlemon        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
304111145Sjlemon      fi
30558911Sps      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
306169154Srwatson    fi
30734881Swollman  fi
3081541Srgrimes
30978064Sume  if test "x$MSVCR_DLL" = x; then
310181803Sbz    # Probe: Check in the Boot JDK directory.
31178064Sume    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
31278064Sume    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
313178285Srwatson  fi
314160491Sups  
315222217Srwatson  if test "x$MSVCR_DLL" = x; then
316171167Sgnn    # Probe: Look in the Windows system32 directory 
317122875Srwatson    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
318183606Sbz    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
319183606Sbz    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
320122875Srwatson    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
321183606Sbz  fi
322122875Srwatson
323122875Srwatson  if test "x$MSVCR_DLL" = x; then
3241541Srgrimes    # Probe: If Visual Studio Express is installed, there is usually one with the debugger
3251541Srgrimes    if test "x$VS100COMNTOOLS" != x; then
326221247Sbz      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
3271541Srgrimes      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
328154666Srwatson      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
3291541Srgrimes        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
330105565Siedowse      else
331105565Siedowse        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
332178285Srwatson      fi
333222488Srwatson      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
334122329Ssam    fi
335105565Siedowse  fi
336105565Siedowse      
337245914Snp  if test "x$MSVCR_DLL" = x; then
338105565Siedowse    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
339127505Spjd    # (This was the original behaviour; kept since it might turn up something)
340105565Siedowse    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
341105565Siedowse      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
342105565Siedowse        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
343105565Siedowse      else
344105565Siedowse        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
345105565Siedowse        if test "x$POSSIBLE_MSVCR_DLL" = x; then
346105565Siedowse          # We're grasping at straws now...
347105565Siedowse          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
348105565Siedowse        fi
349105565Siedowse      fi
350105565Siedowse      
351221247Sbz      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
352105565Siedowse    fi
353219579Sbz  fi
354219579Sbz  
355219579Sbz  if test "x$MSVCR_DLL" = x; then
356222215Srwatson    AC_MSG_CHECKING([for msvcr100.dll])
357219579Sbz    AC_MSG_RESULT([no])
358219579Sbz    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
359219579Sbz  fi
360219579Sbz
361219579Sbz  BASIC_FIXUP_PATH(MSVCR_DLL)
362219579Sbz])
363219579Sbz