toolchain_windows.m4 revision 1315:32470a815f99
153642Sguido#
2255332Scy# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
353642Sguido# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
480482Sdarrenr#
553642Sguido# This code is free software; you can redistribute it and/or modify it
653642Sguido# under the terms of the GNU General Public License version 2 only, as
757126Sguido# published by the Free Software Foundation.  Oracle designates this
8172776Sdarrenr# particular file as subject to the "Classpath" exception as provided
953642Sguido# by Oracle in the LICENSE file that accompanied this code.
1053642Sguido#
1153642Sguido# This code is distributed in the hope that it will be useful, but WITHOUT
1253642Sguido# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1353642Sguido# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1453642Sguido# version 2 for more details (a copy is included in the LICENSE file that
1553642Sguido# accompanied this code).
1653642Sguido#
1753642Sguido# You should have received a copy of the GNU General Public License version
1853642Sguido# 2 along with this work; if not, write to the Free Software Foundation,
1953642Sguido# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2053642Sguido#
2153642Sguido# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2253642Sguido# or visit www.oracle.com if you need additional information or have any
23305138Sdim# questions.
24344833Scy#
25305138Sdim
26305138SdimAC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
27305138Sdim[
28305138Sdim  if test "x$VS_ENV_CMD" = x; then
29305138Sdim    VS100BASE="$1"
30145522Sdarrenr    METHOD="$2"
31145522Sdarrenr    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
32344833Scy    if test -d "$VS100BASE"; then
33145522Sdarrenr      if test -f "$VS100BASE/$VCVARSFILE"; then
34145522Sdarrenr        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
3553642Sguido        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
3653642Sguido        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
3753642Sguido        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
3853642Sguido        # TODO: improve detection for other versions of VS
3953642Sguido        PLATFORM_TOOLSET="v100"
4053642Sguido      else
41145522Sdarrenr        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
42145522Sdarrenr        AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
4392685Sdarrenr      fi
4492685Sdarrenr    fi
4592685Sdarrenr  fi
4692685Sdarrenr])
4792685Sdarrenr
4892685SdarrenrAC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
4992685Sdarrenr[
5092685Sdarrenr  if test "x$VS_ENV_CMD" = x; then
5192685Sdarrenr    WIN_SDK_BASE="$1"
5292685Sdarrenr    METHOD="$2"
53145522Sdarrenr    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
5453642Sguido    if test -d "$WIN_SDK_BASE"; then
5553642Sguido      # There have been cases of partial or broken SDK installations. A missing
5692685Sdarrenr      # lib dir is not going to work.
5792685Sdarrenr      if test ! -d "$WIN_SDK_BASE/../lib"; then
5892685Sdarrenr        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
59369246Scy        AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
60369246Scy      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
61369246Scy        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
62369246Scy        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
63369246Scy        if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
64369246Scy          VS_ENV_ARGS="/x86"
65369246Scy        else
66369246Scy          VS_ENV_ARGS="/x64"
67369246Scy        fi
68369246Scy        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
6992685Sdarrenr        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
70255332Scy        # TODO: improve detection for other versions of SDK
71255332Scy        PLATFORM_TOOLSET="Windows7.1SDK"
72255332Scy      else
73255332Scy        AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
74255332Scy        AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
75255332Scy      fi
76145522Sdarrenr    fi
77145522Sdarrenr  fi
78145522Sdarrenr])
79145522Sdarrenr
80145522SdarrenrAC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
81369246Scy[
82369246Scy  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
83369246Scy    VCVARSFILE="vc/bin/vcvars32.bat"
84369246Scy  else
85369246Scy    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
86369246Scy  fi
8760857Sdarrenr
88369246Scy  VS_ENV_CMD=""
89369246Scy  VS_ENV_ARGS=""
90369246Scy  if test "x$with_toolsdir" != x; then
91369246Scy    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
92369246Scy  fi
93145522Sdarrenr
94369246Scy  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
95369246Scy    # Having specified an argument which is incorrect will produce an instant failure;
96369246Scy    # we should not go on looking
97369246Scy    AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
98255332Scy    AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
9953642Sguido    AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
100145522Sdarrenr  fi
101145522Sdarrenr
10253642Sguido  if test "x$VS100COMNTOOLS" != x; then
103369246Scy    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
104369277Scy  fi
105369246Scy  if test "x$PROGRAMFILES" != x; then
106369246Scy    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
107369246Scy  fi
108369246Scy  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
109145522Sdarrenr  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
110369246Scy
111369246Scy  if test "x$ProgramW6432" != x; then
112369246Scy    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
113145522Sdarrenr  fi
114369246Scy  if test "x$PROGRAMW6432" != x; then
115369246Scy    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
116369246Scy  fi
117369246Scy  if test "x$PROGRAMFILES" != x; then
118369246Scy    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
119369246Scy  fi
120369246Scy  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
121369246Scy  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
122369246Scy])
123281192Sglebius
124281192Sglebius# Check if the VS env variables were setup prior to running configure.
125369246Scy# If not, then find vcvarsall.bat and run it automatically, and integrate
126369246Scy# the set env variables into the spec file.
127369246ScyAC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
128369246Scy[
129369246Scy  # Store path to cygwin link.exe to help excluding it when searching for
130369246Scy  # VS linker. This must be done before changing the PATH when looking for VS.
131369246Scy  AC_PATH_PROG(CYGWIN_LINK, link)
132172776Sdarrenr  if test "x$CYGWIN_LINK" != x; then
133255332Scy    AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
134255332Scy    "$CYGWIN_LINK" --version > /dev/null
135172776Sdarrenr    if test $? -eq 0 ; then
136172776Sdarrenr      AC_MSG_RESULT([yes])
137369246Scy    else
138369246Scy      AC_MSG_RESULT([no])
139145522Sdarrenr      # This might be the VS linker. Don't exclude it later on.
140369246Scy      CYGWIN_LINK=""
141369246Scy    fi
142369246Scy  fi
143145522Sdarrenr
144369246Scy  # First-hand choice is to locate and run the vsvars bat file.
145369246Scy  TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
146369246Scy  if test "x$VS_ENV_CMD" != x; then
147369246Scy    # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
148145522Sdarrenr    BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
149369246Scy
150369246Scy    # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
151255332Scy    AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
152255332Scy
153255332Scy    # We need to create a couple of temporary files.
154255332Scy    VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
155255332Scy    $MKDIR -p $VS_ENV_TMP_DIR
156369246Scy
157369246Scy    # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
158255332Scy    # Instead create a shell script which will set the relevant variables when run.
159369246Scy    WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
160255332Scy    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
161369246Scy    WINPATH_BASH="$BASH"
162369246Scy    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
163369246Scy
164369246Scy    # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
165369246Scy    # script (executable by bash) that will setup the important variables.
166369246Scy    EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
167369246Scy    $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
168369246Scy    # This will end up something like:
169369246Scy    # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
170369246Scy    $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
171369246Scy    # These will end up something like:
172369246Scy    # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
173369246Scy    # The trailing space for everyone except PATH is no typo, but is needed due
174369246Scy    # to trailing \ in the Windows paths. These will be stripped later.
175369246Scy    $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
176369246Scy    $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
177369246Scy    $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
178145522Sdarrenr    $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
179145522Sdarrenr    $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
180281192Sglebius    $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
181369246Scy
182281192Sglebius    # Now execute the newly created bat file.
183281192Sglebius    # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
184281192Sglebius    # Change directory so we don't need to mess with Windows paths in redirects.
185281192Sglebius    cd $VS_ENV_TMP_DIR
186281192Sglebius    cmd /c extract-vs-env.bat | $CAT
187281192Sglebius    cd $CURDIR
188281192Sglebius
189281192Sglebius    if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
190281192Sglebius      AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
191281192Sglebius      AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
192281192Sglebius      AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
193369246Scy      AC_MSG_ERROR([Cannot continue])
194281192Sglebius    fi
195145522Sdarrenr
196369246Scy    # Now set all paths and other env variables. This will allow the rest of
197369246Scy    # the configure script to find and run the compiler in the proper way.
198369246Scy    AC_MSG_NOTICE([Setting extracted environment variables])
199369246Scy    . $VS_ENV_TMP_DIR/set-vs-env.sh
200369246Scy    # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
201281192Sglebius    # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
202145522Sdarrenr  else
203145522Sdarrenr    # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
204145522Sdarrenr    AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
205145522Sdarrenr  fi
206145522Sdarrenr
207145522Sdarrenr  # At this point, we should have correct variables in the environment, or we can't continue.
208145522Sdarrenr  AC_MSG_CHECKING([for Visual Studio variables])
209145522Sdarrenr
210145522Sdarrenr  if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then
211145522Sdarrenr    if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
212145522Sdarrenr      AC_MSG_RESULT([present but broken])
213145522Sdarrenr      AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
214145522Sdarrenr    else
215145522Sdarrenr      AC_MSG_RESULT([ok])
216145522Sdarrenr      # Remove any trailing "\" ";" and " " from the variables.
217153876Sguido      VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
218153876Sguido      VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
219153876Sguido      VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
220153876Sguido      WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
221153876Sguido      WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
222145522Sdarrenr      # Remove any paths containing # (typically F#) as that messes up make. This
223145522Sdarrenr      # is needed if visual studio was installed with F# support.
224145522Sdarrenr      VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
225145522Sdarrenr
226145522Sdarrenr      AC_SUBST(VS_PATH)
227255332Scy      AC_SUBST(VS_INCLUDE)
228369246Scy      AC_SUBST(VS_LIB)
229369246Scy
230369246Scy      # Convert VS_INCLUDE into SYSROOT_CFLAGS
231369246Scy      OLDIFS="$IFS"
232369246Scy      IFS=";"
233369246Scy      for i in $VS_INCLUDE; do
234255332Scy        ipath=$i
235255332Scy	IFS="$OLDIFS"
236145522Sdarrenr        BASIC_FIXUP_PATH([ipath])
237145522Sdarrenr	IFS=";"
238145522Sdarrenr      	SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
239145522Sdarrenr      done
240145522Sdarrenr      # Convert VS_LIB into SYSROOT_LDFLAGS
241145522Sdarrenr      for i in $VS_LIB; do
242145522Sdarrenr        libpath=$i
243145522Sdarrenr	IFS="$OLDIFS"
244145522Sdarrenr        BASIC_FIXUP_PATH([libpath])
245145522Sdarrenr	IFS=";"
246145522Sdarrenr      	SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
247145522Sdarrenr      done
248145522Sdarrenr      IFS="$OLDIFS"
249145522Sdarrenr    fi
250145522Sdarrenr  else
251145522Sdarrenr    AC_MSG_RESULT([not found])
252145522Sdarrenr
253145522Sdarrenr    if test "x$VS_ENV_CMD" = x; then
254255332Scy      AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
255145522Sdarrenr      AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
256145522Sdarrenr    else
257145522Sdarrenr      AC_MSG_NOTICE([Running the extraction script failed.])
258255332Scy    fi
259145522Sdarrenr    AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
260145522Sdarrenr    AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
261145522Sdarrenr    AC_MSG_ERROR([Cannot continue])
262145522Sdarrenr  fi
263145522Sdarrenr])
264145522Sdarrenr
265255332ScyAC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
266145522Sdarrenr[
267145522Sdarrenr  POSSIBLE_MSVCR_DLL="$1"
268145522Sdarrenr  METHOD="$2"
269255332Scy  if test -e "$POSSIBLE_MSVCR_DLL"; then
270145522Sdarrenr    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
271145522Sdarrenr
272145522Sdarrenr    # Need to check if the found msvcr is correct architecture
273145522Sdarrenr    AC_MSG_CHECKING([found msvcr100.dll architecture])
274145522Sdarrenr    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
275145522Sdarrenr    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
276145522Sdarrenr      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
277145522Sdarrenr      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
278145522Sdarrenr      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
279145522Sdarrenr        CORRECT_MSVCR_ARCH="PE32 executable"
280145522Sdarrenr      else
281145522Sdarrenr        CORRECT_MSVCR_ARCH="PE32+ executable"
282145522Sdarrenr      fi
283145522Sdarrenr    else
284369277Scy      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
285145522Sdarrenr        CORRECT_MSVCR_ARCH=386
286145522Sdarrenr      else
287145522Sdarrenr        CORRECT_MSVCR_ARCH=x86-64
288145522Sdarrenr      fi
289145522Sdarrenr    fi
290145522Sdarrenr    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
291145522Sdarrenr      AC_MSG_RESULT([ok])
292369277Scy      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
293255332Scy      AC_MSG_CHECKING([for msvcr100.dll])
294255332Scy      AC_MSG_RESULT([$MSVCR_DLL])
295145522Sdarrenr    else
296145522Sdarrenr      AC_MSG_RESULT([incorrect, ignoring])
297255332Scy      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
298145522Sdarrenr    fi
299145522Sdarrenr  fi
300145522Sdarrenr])
301145522Sdarrenr
302145522SdarrenrAC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
303145522Sdarrenr[
304145522Sdarrenr  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
305145522Sdarrenr      [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
306255332Scy
307255332Scy  if test "x$with_msvcr_dll" != x; then
308145522Sdarrenr    # If given explicitely by user, do not probe. If not present, fail directly.
309255332Scy    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
310145522Sdarrenr    if test "x$MSVCR_DLL" = x; then
311145522Sdarrenr      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
312145522Sdarrenr    fi
313145522Sdarrenr  fi
314255332Scy
315255332Scy  if test "x$MSVCR_DLL" = x; then
316255332Scy    # Probe: Using well-known location from Visual Studio 10.0
317255332Scy    if test "x$VCINSTALLDIR" != x; then
318255332Scy      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
319255332Scy      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
320255332Scy      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
321255332Scy        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
322255332Scy      else
323255332Scy        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
324255332Scy      fi
325255332Scy      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
326255332Scy    fi
327255332Scy  fi
328255332Scy
329255332Scy  if test "x$MSVCR_DLL" = x; then
330255332Scy    # Probe: Check in the Boot JDK directory.
331145522Sdarrenr    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
332255332Scy    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
333255332Scy  fi
334255332Scy
335255332Scy  if test "x$MSVCR_DLL" = x; then
336255332Scy    # Probe: Look in the Windows system32 directory
337255332Scy    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
338255332Scy    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
339255332Scy    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
340145522Sdarrenr    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
341145522Sdarrenr  fi
342161356Sguido
343145522Sdarrenr  if test "x$MSVCR_DLL" = x; then
344145522Sdarrenr    # Probe: If Visual Studio Express is installed, there is usually one with the debugger
345170268Sdarrenr    if test "x$VS100COMNTOOLS" != x; then
346145522Sdarrenr      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
347145522Sdarrenr      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
348145522Sdarrenr      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
349145522Sdarrenr        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
350145522Sdarrenr      else
351145522Sdarrenr        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
352145522Sdarrenr      fi
353145522Sdarrenr      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
354255332Scy    fi
355255332Scy  fi
356153876Sguido
357153876Sguido  if test "x$MSVCR_DLL" = x; then
358145522Sdarrenr    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
359145522Sdarrenr    # (This was the original behaviour; kept since it might turn up something)
360145522Sdarrenr    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
361145522Sdarrenr      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
362145522Sdarrenr        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
363172776Sdarrenr      else
364369245Sgit2svn        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
365369245Sgit2svn        if test "x$POSSIBLE_MSVCR_DLL" = x; then
366369245Sgit2svn          # We're grasping at straws now...
367369245Sgit2svn          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
368369245Sgit2svn        fi
369369245Sgit2svn      fi
370145522Sdarrenr
371255332Scy      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
372255332Scy    fi
373145522Sdarrenr  fi
374145522Sdarrenr
375255332Scy  if test "x$MSVCR_DLL" = x; then
376255332Scy    AC_MSG_CHECKING([for msvcr100.dll])
377255332Scy    AC_MSG_RESULT([no])
378255332Scy    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
379145522Sdarrenr  fi
380145522Sdarrenr
381145522Sdarrenr  BASIC_FIXUP_PATH(MSVCR_DLL)
382145522Sdarrenr])
383314251Scy