common/autoconf/toolchain_windows.m4

changeset 2223
01cc48ed67f3
parent 2220
47fda751abb6
child 2224
20daa32eec6f
equal deleted inserted replaced
2222:7129b977c4af 2223:01cc48ed67f3
1 # 1 #
2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 # 4 #
5 # This code is free software; you can redistribute it and/or modify it 5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as 6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this 7 # published by the Free Software Foundation. Oracle designates this
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any 22 # or visit www.oracle.com if you need additional information or have any
23 # questions. 23 # questions.
24 # 24 #
25 25
26 ################################################################################
27
28 VALID_VS_VERSIONS="2010 2012 2013"
29
30 VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
31 VS_VERSION_INTERNAL_2010=100
32 VS_MSVCR_2010=msvcr100.dll
33 # We don't use msvcp on Visual Studio 2010
34 #VS_MSVCP_2010=msvcp100.dll
35 VS_ENVVAR_2010="VS100COMNTOOLS"
36 VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
37 VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
38 VS_VS_PLATFORM_NAME_2010="v100"
39 VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
40
41 VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
42 VS_VERSION_INTERNAL_2012=110
43 VS_MSVCR_2012=msvcr110.dll
44 VS_MSVCP_2012=msvcp110.dll
45 VS_ENVVAR_2012="VS110COMNTOOLS"
46 VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
47 VS_SDK_INSTALLDIR_2012=
48 VS_VS_PLATFORM_NAME_2012="v110"
49 VS_SDK_PLATFORM_NAME_2012=
50
51 VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
52 VS_VERSION_INTERNAL_2013=120
53 VS_MSVCR_2013=msvcr120.dll
54 VS_MSVCP_2013=msvcp120.dll
55 VS_ENVVAR_2013="VS120COMNTOOLS"
56 VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
57 VS_SDK_INSTALLDIR_2013=
58 VS_VS_PLATFORM_NAME_2013="v120"
59 VS_SDK_PLATFORM_NAME_2013=
60
61 ################################################################################
62
26 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], 63 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
27 [ 64 [
28 if test "x$VS_ENV_CMD" = x; then 65 if test "x$VS_ENV_CMD" = x; then
29 VS100BASE="$1" 66 VS_VERSION="$1"
30 METHOD="$2" 67 VS_BASE="$2"
31 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE) 68 METHOD="$3"
32 if test -d "$VS100BASE"; then 69
33 if test -f "$VS100BASE/$VCVARSFILE"; then 70 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
34 AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD]) 71 VCVARSFILE="vc/bin/vcvars32.bat"
35 VS_ENV_CMD="$VS100BASE/$VCVARSFILE" 72 else
73 VCVARSFILE="vc/bin/amd64/vcvars64.bat"
74 fi
75
76 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
77 if test -d "$VS_BASE"; then
78 if test -f "$VS_BASE/$VCVARSFILE"; then
79 AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
80 VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
36 # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see 81 # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
37 # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 82 # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
38 # TODO: improve detection for other versions of VS 83 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
39 PLATFORM_TOOLSET="v100" 84 else
40 else 85 AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
41 AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
42 AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring]) 86 AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
43 fi 87 fi
44 fi 88 fi
45 fi 89 fi
46 ]) 90 ])
47 91
92 ################################################################################
93
48 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT], 94 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
49 [ 95 [
50 if test "x$VS_ENV_CMD" = x; then 96 if test "x$VS_ENV_CMD" = x; then
51 WIN_SDK_BASE="$1" 97 VS_VERSION="$1"
52 METHOD="$2" 98 WIN_SDK_BASE="$2"
99 METHOD="$3"
53 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE) 100 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
54 if test -d "$WIN_SDK_BASE"; then 101 if test -d "$WIN_SDK_BASE"; then
55 # There have been cases of partial or broken SDK installations. A missing 102 # There have been cases of partial or broken SDK installations. A missing
56 # lib dir is not going to work. 103 # lib dir is not going to work.
57 if test ! -d "$WIN_SDK_BASE/../lib"; then 104 if test ! -d "$WIN_SDK_BASE/lib"; then
58 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) 105 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
59 AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring]) 106 AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
60 elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then 107 elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
61 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) 108 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
62 VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" 109 VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
63 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 110 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
64 VS_ENV_ARGS="/x86" 111 VS_ENV_ARGS="/x86"
65 else 112 else
66 VS_ENV_ARGS="/x64" 113 VS_ENV_ARGS="/x64"
67 fi 114 fi
68 # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see 115 # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
69 # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK 116 # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
70 # TODO: improve detection for other versions of SDK 117 # TODO: improve detection for other versions of SDK
71 PLATFORM_TOOLSET="Windows7.1SDK" 118 eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
72 else 119 else
73 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) 120 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
74 AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring]) 121 AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
75 fi 122 fi
76 fi 123 fi
77 fi 124 fi
78 ]) 125 ])
79 126
127 ################################################################################
128 # Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
129 # build environment and assigns it to VS_ENV_CMD
80 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE], 130 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
81 [ 131 [
82 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 132 VS_VERSION="$1"
83 VCVARSFILE="vc/bin/vcvars32.bat" 133 eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
84 else 134 eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
85 VCVARSFILE="vc/bin/amd64/vcvars64.bat" 135 eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
136 eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
137
138 # When using --with-tools-dir, assume it points to the correct and default
139 # version of Visual Studio or that --with-toolchain-version was also set.
140 if test "x$with_tools_dir" != x; then
141 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
142 [$with_tools_dir/../..], [--with-tools-dir])
143 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
144 [$with_tools_dir/../../..], [--with-tools-dir])
145 if test "x$VS_ENV_CMD" = x; then
146 # Having specified an argument which is incorrect will produce an instant failure;
147 # we should not go on looking
148 AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
149 AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
150 AC_MSG_NOTICE([directory within the Visual Studio installation])
151 AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
152 fi
86 fi 153 fi
87 154
88 VS_ENV_CMD="" 155 VS_ENV_CMD=""
89 VS_ENV_ARGS="" 156 VS_ENV_ARGS=""
90 if test "x$with_toolsdir" != x; then 157
91 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir]) 158 if test "x$VS_COMNTOOLS" != x; then
92 fi 159 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
93 160 [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
94 if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
95 # Having specified an argument which is incorrect will produce an instant failure;
96 # we should not go on looking
97 AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
98 AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
99 AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
100 fi
101
102 if test "x$VS100COMNTOOLS" != x; then
103 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
104 fi 161 fi
105 if test "x$PROGRAMFILES" != x; then 162 if test "x$PROGRAMFILES" != x; then
106 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name]) 163 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
107 fi 164 [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
108 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name]) 165 fi
109 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name]) 166 # Work around the insanely named ProgramFiles(x86) env variable
110 167 PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
111 if test "x$ProgramW6432" != x; then 168 if test "x$PROGRAMFILES_X86" != x; then
112 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name]) 169 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
113 fi 170 [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
114 if test "x$PROGRAMW6432" != x; then 171 fi
115 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name]) 172 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
116 fi 173 [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
117 if test "x$PROGRAMFILES" != x; then 174 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
118 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name]) 175 [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
119 fi 176
120 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name]) 177 if test "x$SDK_INSTALL_DIR" != x; then
121 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name]) 178 if test "x$ProgramW6432" != x; then
122 ]) 179 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
123 180 [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
181 fi
182 if test "x$PROGRAMW6432" != x; then
183 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
184 [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
185 fi
186 if test "x$PROGRAMFILES" != x; then
187 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
188 [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
189 fi
190 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
191 [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
192 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
193 [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
194 fi
195 ])
196
197 ################################################################################
198
199 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
200 [
201 AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
202 [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
203
204 if test "x$with_toolchain_version" = xlist; then
205 # List all toolchains
206 AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
207 for version in $VALID_VS_VERSIONS; do
208 eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
209 $PRINTF " %-10s %s\n" $version "$VS_DESCRIPTION"
210 done
211
212 exit 0
213 elif test "x$with_toolchain_version" != x; then
214 # User override; check that it is valid
215 if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
216 AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
217 AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
218 AC_MSG_ERROR([Cannot continue.])
219 fi
220 VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
221 else
222 # No flag given, use default
223 VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
224 fi
225
226 for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
227 TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
228 if test "x$VS_ENV_CMD" != x; then
229 TOOLCHAIN_VERSION=$VS_VERSION
230 eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
231 eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
232 eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
233 eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
234 # The rest of the variables are already evaled while probing
235 AC_MSG_NOTICE([Found $VS_DESCRIPTION])
236 break
237 fi
238 done
239 ])
240
241 ################################################################################
124 # Check if the VS env variables were setup prior to running configure. 242 # Check if the VS env variables were setup prior to running configure.
125 # If not, then find vcvarsall.bat and run it automatically, and integrate 243 # If not, then find vcvarsall.bat and run it automatically, and integrate
126 # the set env variables into the spec file. 244 # the set env variables into the spec file.
127 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV], 245 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
128 [ 246 [
140 CYGWIN_LINK="" 258 CYGWIN_LINK=""
141 fi 259 fi
142 fi 260 fi
143 261
144 # First-hand choice is to locate and run the vsvars bat file. 262 # First-hand choice is to locate and run the vsvars bat file.
145 TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE 263 TOOLCHAIN_FIND_VISUAL_STUDIO
264
146 if test "x$VS_ENV_CMD" != x; then 265 if test "x$VS_ENV_CMD" != x; then
147 # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. 266 # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
148 BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD) 267 BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
149 268
150 # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat 269 # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
240 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) 359 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
241 AC_MSG_ERROR([Cannot continue]) 360 AC_MSG_ERROR([Cannot continue])
242 fi 361 fi
243 ]) 362 ])
244 363
245 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL], 364 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
246 [ 365 [
247 POSSIBLE_MSVCR_DLL="$1" 366 DLL_NAME="$1"
248 METHOD="$2" 367 POSSIBLE_MSVC_DLL="$2"
249 if test -e "$POSSIBLE_MSVCR_DLL"; then 368 METHOD="$3"
250 AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD]) 369 if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
251 370 AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD])
371
252 # Need to check if the found msvcr is correct architecture 372 # Need to check if the found msvcr is correct architecture
253 AC_MSG_CHECKING([found msvcr100.dll architecture]) 373 AC_MSG_CHECKING([found $1 architecture])
254 MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"` 374 MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
255 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then 375 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
256 # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit" 376 # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
257 # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems. 377 # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
258 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 378 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
259 CORRECT_MSVCR_ARCH="PE32 executable" 379 CORRECT_MSVCR_ARCH="PE32 executable"
265 CORRECT_MSVCR_ARCH=386 385 CORRECT_MSVCR_ARCH=386
266 else 386 else
267 CORRECT_MSVCR_ARCH=x86-64 387 CORRECT_MSVCR_ARCH=x86-64
268 fi 388 fi
269 fi 389 fi
270 if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then 390 if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
271 AC_MSG_RESULT([ok]) 391 AC_MSG_RESULT([ok])
272 MSVCR_DLL="$POSSIBLE_MSVCR_DLL" 392 MSVC_DLL="$POSSIBLE_MSVC_DLL"
273 AC_MSG_CHECKING([for msvcr100.dll]) 393 AC_MSG_CHECKING([for $1])
274 AC_MSG_RESULT([$MSVCR_DLL]) 394 AC_MSG_RESULT([$MSVC_DLL])
275 else 395 else
276 AC_MSG_RESULT([incorrect, ignoring]) 396 AC_MSG_RESULT([incorrect, ignoring])
277 AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE]) 397 AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE])
278 fi 398 fi
279 fi 399 fi
280 ]) 400 ])
281 401
282 AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], 402 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
283 [ 403 [
284 AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll], 404 VAR_NAME="$1"
285 [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])]) 405 DLL_NAME="$2"
286 406 MSVC_DLL=
287 if test "x$with_msvcr_dll" != x; then 407
288 # If given explicitely by user, do not probe. If not present, fail directly. 408 if test "x$MSVC_DLL" = x; then
289 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
290 if test "x$MSVCR_DLL" = x; then
291 AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
292 fi
293 fi
294
295 if test "x$MSVCR_DLL" = x; then
296 # Probe: Using well-known location from Visual Studio 10.0 409 # Probe: Using well-known location from Visual Studio 10.0
297 if test "x$VCINSTALLDIR" != x; then 410 if test "x$VCINSTALLDIR" != x; then
298 CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR" 411 CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
299 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR) 412 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
300 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 413 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
301 POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll" 414 POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
302 else 415 else
303 POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll" 416 POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
304 fi 417 fi
305 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR]) 418 $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
306 fi 419 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
307 fi 420 [well-known location in VCINSTALLDIR])
308 421 fi
309 if test "x$MSVCR_DLL" = x; then 422 fi
423
424 if test "x$MSVC_DLL" = x; then
310 # Probe: Check in the Boot JDK directory. 425 # Probe: Check in the Boot JDK directory.
311 POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll" 426 POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
312 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK]) 427 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($[DLL_NAME], [$POSSIBLE_MSVC_DLL],
428 [well-known location in Boot JDK])
313 fi 429 fi
314 430
315 if test "x$MSVCR_DLL" = x; then 431 if test "x$MSVC_DLL" = x; then
316 # Probe: Look in the Windows system32 directory 432 # Probe: Look in the Windows system32 directory
317 CYGWIN_SYSTEMROOT="$SYSTEMROOT" 433 CYGWIN_SYSTEMROOT="$SYSTEMROOT"
318 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT) 434 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
319 POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll" 435 POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
320 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT]) 436 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
321 fi 437 [well-known location in SYSTEMROOT])
322 438 fi
323 if test "x$MSVCR_DLL" = x; then 439
440 if test "x$MSVC_DLL" = x; then
324 # Probe: If Visual Studio Express is installed, there is usually one with the debugger 441 # Probe: If Visual Studio Express is installed, there is usually one with the debugger
325 if test "x$VS100COMNTOOLS" != x; then 442 if test "x$VS100COMNTOOLS" != x; then
326 CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.." 443 CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
327 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR) 444 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
328 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 445 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
329 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1` 446 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
330 else 447 | $GREP -i /x64/ | $HEAD --lines 1`
331 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1` 448 else
332 fi 449 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
333 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS]) 450 | $GREP -i /x86/ | $HEAD --lines 1`
451 fi
452 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
453 [search of VS100COMNTOOLS])
334 fi 454 fi
335 fi 455 fi
336 456
337 if test "x$MSVCR_DLL" = x; then 457 if test "x$MSVC_DLL" = x; then
338 # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now. 458 # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
339 # (This was the original behaviour; kept since it might turn up something) 459 # (This was the original behaviour; kept since it might turn something up)
340 if test "x$CYGWIN_VC_INSTALL_DIR" != x; then 460 if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
341 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 461 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
342 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1` 462 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
343 else 463 | $GREP x64 | $HEAD --lines 1`
344 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1` 464 else
345 if test "x$POSSIBLE_MSVCR_DLL" = x; then 465 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
466 | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
467 if test "x$POSSIBLE_MSVC_DLL" = x; then
346 # We're grasping at straws now... 468 # We're grasping at straws now...
347 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1` 469 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
470 | $HEAD --lines 1`
348 fi 471 fi
349 fi 472 fi
350 473
351 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR]) 474 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
475 [search of VCINSTALLDIR])
352 fi 476 fi
353 fi 477 fi
354 478
355 if test "x$MSVCR_DLL" = x; then 479 if test "x$MSVC_DLL" = x; then
356 AC_MSG_CHECKING([for msvcr100.dll]) 480 AC_MSG_CHECKING([for $DLL_NAME])
357 AC_MSG_RESULT([no]) 481 AC_MSG_RESULT([no])
358 AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.]) 482 AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
359 fi 483 fi
360 484
361 BASIC_FIXUP_PATH(MSVCR_DLL) 485 $1=$MSVC_DLL
362 ]) 486 BASIC_FIXUP_PATH($1)
487 AC_SUBST($1, [$]$1)
488 ])
489
490 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
491 [
492 AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
493 [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
494
495 if test "x$with_msvcr_dll" != x; then
496 # If given explicitely by user, do not probe. If not present, fail directly.
497 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll],
498 [--with-msvcr-dll])
499 if test "x$MSVC_DLL" = x; then
500 AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
501 fi
502 else
503 TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}])
504 fi
505
506 AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
507 [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
508
509 if test "x$MSVCP_NAME" != "x"; then
510 if test "x$with_msvcp_dll" != x; then
511 # If given explicitely by user, do not probe. If not present, fail directly.
512 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll],
513 [--with-msvcp-dll])
514 if test "x$MSVC_DLL" = x; then
515 AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
516 fi
517 else
518 TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}])
519 fi
520 fi
521 ])
522

mercurial