Tue, 28 May 2019 18:50:01 +0200
8218020: Fix version number in mesa.md 3rd party legal file
Reviewed-by: clanger
1 #
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.
4 #
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
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
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
23 # questions.
24 #
26 ################################################################################
27 # The order of these defines the priority by which we try to find them.
28 VALID_VS_VERSIONS="2010 2012 2013 2015 2017"
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"
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=
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=
61 VS_DESCRIPTION_2015="Microsoft Visual Studio 2015 - CURRENTLY NOT WORKING"
62 VS_VERSION_INTERNAL_2015=140
63 VS_MSVCR_2015=vcruntime140.dll
64 VS_MSVCP_2015=msvcp140.dll
65 VS_ENVVAR_2015="VS140COMNTOOLS"
66 VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0"
67 VS_SDK_INSTALLDIR_2015=
68 VS_VS_PLATFORM_NAME_2015="v140"
69 VS_SDK_PLATFORM_NAME_2015=
70 # The vcvars of 2015 breaks if 2017 is also installed. Work around this by
71 # explicitly specifying Windows Kit 8.1 to be used.
72 VS_ENV_ARGS_2015="8.1"
74 VS_DESCRIPTION_2017="Microsoft Visual Studio 2017 - CURRENTLY NOT WORKING"
75 VS_VERSION_INTERNAL_2017=141
76 VS_MSVCR_2017=vcruntime140.dll
77 VS_MSVCP_2017=msvcp140.dll
78 VS_ENVVAR_2017="VS150COMNTOOLS"
79 VS_USE_UCRT_2017="true"
80 VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
81 VS_EDITIONS_2017="Community Professional Enterprise"
82 VS_SDK_INSTALLDIR_2017=
83 VS_VS_PLATFORM_NAME_2017="v141"
84 VS_SDK_PLATFORM_NAME_2017=
86 ################################################################################
88 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
89 [
90 if test "x$VS_ENV_CMD" = x; then
91 VS_VERSION="$1"
92 VS_BASE="$2"
93 METHOD="$3"
95 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
96 # In VS 2017, the default installation is in a subdir named after the edition.
97 # Find the first one present and use that.
98 if test "x$VS_EDITIONS" != x; then
99 for edition in $VS_EDITIONS; do
100 if test -d "$VS_BASE/$edition"; then
101 VS_BASE="$VS_BASE/$edition"
102 break
103 fi
104 done
105 fi
107 if test -d "$VS_BASE"; then
108 AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
109 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
110 VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
111 else
112 VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
113 vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
114 fi
116 for VCVARSFILE in $VCVARSFILES; do
117 if test -f "$VS_BASE/$VCVARSFILE"; then
118 VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
119 break
120 fi
121 done
123 if test "x$VS_ENV_CMD" = x; then
124 AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring])
125 else
126 # PLATFORM_TOOLSET is used during the compilation of the freetype sources
127 # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
128 # 'v110' or 'v120' for VS 2010, 2012 or VS2013
129 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
131 fi
132 fi
133 fi
134 ])
136 ################################################################################
138 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
139 [
140 if test "x$VS_ENV_CMD" = x; then
141 VS_VERSION="$1"
142 WIN_SDK_BASE="$2"
143 METHOD="$3"
144 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
145 if test -d "$WIN_SDK_BASE"; then
146 # There have been cases of partial or broken SDK installations. A missing
147 # lib dir is not going to work.
148 if test ! -d "$WIN_SDK_BASE/lib"; then
149 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
150 AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
151 elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
152 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
153 VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
154 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
155 VS_ENV_ARGS="/x86"
156 else
157 VS_ENV_ARGS="/x64"
158 fi
159 # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
160 # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
161 # TODO: improve detection for other versions of SDK
162 eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
163 else
164 AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
165 AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
166 fi
167 fi
168 fi
169 ])
171 ################################################################################
172 # Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
173 # build environment and assigns it to VS_ENV_CMD
174 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
175 [
176 VS_VERSION="$1"
177 eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
178 eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
179 eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
180 eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
181 eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
182 eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
184 # When using --with-tools-dir, assume it points to the correct and default
185 # version of Visual Studio or that --with-toolchain-version was also set.
186 if test "x$with_tools_dir" != x; then
187 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
188 [$with_tools_dir/../..], [--with-tools-dir])
189 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
190 [$with_tools_dir/../../..], [--with-tools-dir])
191 if test "x$VS_ENV_CMD" = x; then
192 # Having specified an argument which is incorrect will produce an instant failure;
193 # we should not go on looking
194 AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
195 AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
196 AC_MSG_NOTICE([directory within the Visual Studio installation])
197 AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
198 fi
199 fi
201 VS_ENV_CMD=""
203 if test "x$VS_COMNTOOLS" != x; then
204 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
205 [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
206 fi
207 if test "x$PROGRAMFILES" != x; then
208 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
209 [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
210 fi
211 # Work around the insanely named ProgramFiles(x86) env variable
212 PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
213 if test "x$PROGRAMFILES_X86" != x; then
214 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
215 [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
216 fi
217 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
218 [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
219 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
220 [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
222 if test "x$SDK_INSTALL_DIR" != x; then
223 if test "x$ProgramW6432" != x; then
224 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
225 [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
226 fi
227 if test "x$PROGRAMW6432" != x; then
228 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
229 [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
230 fi
231 if test "x$PROGRAMFILES" != x; then
232 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
233 [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
234 fi
235 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
236 [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
237 TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
238 [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
239 fi
240 ])
242 ################################################################################
244 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
245 [
246 AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
247 [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
249 if test "x$with_toolchain_version" = xlist; then
250 # List all toolchains
251 AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
252 for version in $VALID_VS_VERSIONS; do
253 eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
254 $PRINTF " %-10s %s\n" $version "$VS_DESCRIPTION"
255 done
257 exit 0
258 elif test "x$DEVKIT_VS_VERSION" != x; then
259 VS_VERSION=$DEVKIT_VS_VERSION
260 TOOLCHAIN_VERSION=$VS_VERSION
261 # If the devkit has a name, use that as description
262 VS_DESCRIPTION="$DEVKIT_NAME"
263 if test "x$VS_DESCRIPTION" = x; then
264 eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
265 fi
266 eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
267 eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
268 eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
269 eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
270 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
271 VS_PATH="$TOOLCHAIN_PATH:$PATH"
273 # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
274 # can still be exported as INCLUDE for compiler invocations without
275 # SYSROOT_CFLAGS
276 OLDIFS="$IFS"
277 IFS=";"
278 for i in $DEVKIT_VS_INCLUDE; do
279 ipath=$i
280 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
281 VS_INCLUDE="$VS_INCLUDE;$ipath"
282 done
283 # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported
284 # as LIB for compiler invocations without SYSROOT_LDFLAGS
285 for i in $DEVKIT_VS_LIB; do
286 libpath=$i
287 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
288 VS_LIB="$VS_LIB;$libpath"
289 done
290 IFS="$OLDIFS"
292 AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION])
294 elif test "x$with_toolchain_version" != x; then
295 # User override; check that it is valid
296 if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
297 AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
298 AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
299 AC_MSG_ERROR([Cannot continue.])
300 fi
301 VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
302 else
303 # No flag given, use default
304 VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
305 fi
307 for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
308 TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
309 if test "x$VS_ENV_CMD" != x; then
310 TOOLCHAIN_VERSION=$VS_VERSION
311 eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
312 eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
313 eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
314 eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
315 eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
316 # The rest of the variables are already evaled while probing
317 AC_MSG_NOTICE([Found $VS_DESCRIPTION])
318 break
319 fi
320 done
322 TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
323 if test "$TOOLCHAIN_VERSION" -gt 2013; then
324 UNSUPPORTED_TOOLCHAIN_VERSION=yes
325 fi
326 ])
328 ################################################################################
329 # Check if the VS env variables were setup prior to running configure.
330 # If not, then find vcvarsall.bat and run it automatically, and integrate
331 # the set env variables into the spec file.
332 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
333 [
334 # Store path to cygwin link.exe to help excluding it when searching for
335 # VS linker. This must be done before changing the PATH when looking for VS.
336 AC_PATH_PROG(CYGWIN_LINK, link)
337 if test "x$CYGWIN_LINK" != x; then
338 AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
339 "$CYGWIN_LINK" --version > /dev/null
340 if test $? -eq 0 ; then
341 AC_MSG_RESULT([yes])
342 else
343 AC_MSG_RESULT([no])
344 # This might be the VS linker. Don't exclude it later on.
345 CYGWIN_LINK=""
346 fi
347 fi
349 # First-hand choice is to locate and run the vsvars bat file.
350 TOOLCHAIN_FIND_VISUAL_STUDIO
352 # If we have a devkit, skip all of the below.
353 if test "x$DEVKIT_VS_VERSION" = x; then
354 if test "x$VS_ENV_CMD" != x; then
355 # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
356 BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
358 # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
359 AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
361 # We need to create a couple of temporary files.
362 VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
363 $MKDIR -p $VS_ENV_TMP_DIR
365 # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
366 # Instead create a shell script which will set the relevant variables when run.
367 WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
368 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
369 WINPATH_BASH="$BASH"
370 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
372 # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
373 # script (executable by bash) that will setup the important variables.
374 EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
375 $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE
376 # This will end up something like:
377 # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
378 $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
379 # In some cases, the VS_ENV_CMD will change directory, change back so
380 # the set-vs-env.sh ends up in the right place.
381 $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
382 # These will end up something like:
383 # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
384 # The trailing space for everyone except PATH is no typo, but is needed due
385 # to trailing \ in the Windows paths. These will be stripped later.
386 $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \
387 >> $EXTRACT_VC_ENV_BAT_FILE
388 $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' \
389 >> $EXTRACT_VC_ENV_BAT_FILE
390 $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' \
391 >> $EXTRACT_VC_ENV_BAT_FILE
392 $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
393 >> $EXTRACT_VC_ENV_BAT_FILE
394 $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
395 >> $EXTRACT_VC_ENV_BAT_FILE
396 $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
397 >> $EXTRACT_VC_ENV_BAT_FILE
399 # Now execute the newly created bat file.
400 # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
401 # Change directory so we don't need to mess with Windows paths in redirects.
402 cd $VS_ENV_TMP_DIR
403 cmd /c extract-vs-env.bat | $CAT
404 cd $CURDIR
406 if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
407 AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
408 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
409 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
410 AC_MSG_ERROR([Cannot continue])
411 fi
413 # Now set all paths and other env variables. This will allow the rest of
414 # the configure script to find and run the compiler in the proper way.
415 AC_MSG_NOTICE([Setting extracted environment variables])
416 . $VS_ENV_TMP_DIR/set-vs-env.sh
417 # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
418 # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
419 else
420 # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
421 AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
422 fi
423 fi
425 # At this point, we should have correct variables in the environment, or we can't continue.
426 AC_MSG_CHECKING([for Visual Studio variables])
428 if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
429 || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
430 if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
431 AC_MSG_RESULT([present but broken])
432 AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
433 else
434 AC_MSG_RESULT([ok])
435 # Remove any trailing "\" and " " from the variables.
436 VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
437 VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
438 VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
439 WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'`
440 WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
441 if test -z "$WINDOWSSDKDIR"; then
442 WINDOWSSDKDIR="$WindowsSdkDir"
443 fi
444 # Remove any paths containing # (typically F#) as that messes up make. This
445 # is needed if visual studio was installed with F# support.
446 VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
448 AC_SUBST(VS_PATH)
449 AC_SUBST(VS_INCLUDE)
450 AC_SUBST(VS_LIB)
451 fi
452 else
453 AC_MSG_RESULT([not found])
455 if test "x$VS_ENV_CMD" = x; then
456 AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
457 AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
458 else
459 AC_MSG_NOTICE([Running the extraction script failed.])
460 fi
461 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
462 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
463 AC_MSG_ERROR([Cannot continue])
464 fi
465 ])
467 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
468 [
469 DLL_NAME="$1"
470 POSSIBLE_MSVC_DLL="$2"
471 METHOD="$3"
472 if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
473 AC_MSG_NOTICE([Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD])
475 # Need to check if the found msvcr is correct architecture
476 AC_MSG_CHECKING([found $DLL_NAME architecture])
477 MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
478 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
479 # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
480 # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
481 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
482 CORRECT_MSVCR_ARCH="PE32 executable"
483 else
484 CORRECT_MSVCR_ARCH="PE32+ executable"
485 fi
486 else
487 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
488 CORRECT_MSVCR_ARCH=386
489 else
490 CORRECT_MSVCR_ARCH=x86-64
491 fi
492 fi
493 if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
494 AC_MSG_RESULT([ok])
495 MSVC_DLL="$POSSIBLE_MSVC_DLL"
496 BASIC_FIXUP_PATH(MSVC_DLL)
497 AC_MSG_CHECKING([for $DLL_NAME])
498 AC_MSG_RESULT([$MSVC_DLL])
499 else
500 AC_MSG_RESULT([incorrect, ignoring])
501 AC_MSG_NOTICE([The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE])
502 fi
503 fi
504 ])
506 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
507 [
508 DLL_NAME="$1"
509 MSVC_DLL=
511 if test "x$MSVC_DLL" = x; then
512 if test "x$VCINSTALLDIR" != x; then
513 CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
514 BASIC_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
515 if test "$VS_VERSION" -lt 2017; then
516 # Probe: Using well-known location from Visual Studio 12.0 and older
517 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
518 POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
519 else
520 POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
521 fi
522 else
523 # Probe: Using well-known location from VS 2017
524 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
525 POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
526 else
527 POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
528 fi
529 fi
530 # In case any of the above finds more than one file, loop over them.
531 for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
532 $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
533 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
534 [well-known location in VCINSTALLDIR])
535 done
536 fi
537 fi
539 if test "x$MSVC_DLL" = x; then
540 # Probe: Check in the Boot JDK directory.
541 POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
542 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($[DLL_NAME], [$POSSIBLE_MSVC_DLL],
543 [well-known location in Boot JDK])
544 fi
546 if test "x$MSVC_DLL" = x; then
547 # Probe: Look in the Windows system32 directory
548 CYGWIN_SYSTEMROOT="$SYSTEMROOT"
549 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
550 POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
551 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
552 [well-known location in SYSTEMROOT])
553 fi
555 if test "x$MSVC_DLL" = x; then
556 # Probe: If Visual Studio Express is installed, there is usually one with the debugger
557 if test "x$VS100COMNTOOLS" != x; then
558 CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
559 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
560 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
561 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
562 | $GREP -i /x64/ | $HEAD --lines 1`
563 else
564 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
565 | $GREP -i /x86/ | $HEAD --lines 1`
566 fi
567 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
568 [search of VS100COMNTOOLS])
569 fi
570 fi
572 if test "x$MSVC_DLL" = x; then
573 # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
574 # (This was the original behaviour; kept since it might turn something up)
575 if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
576 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
577 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
578 | $GREP x64 | $HEAD --lines 1`
579 else
580 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
581 | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
582 if test "x$POSSIBLE_MSVC_DLL" = x; then
583 # We're grasping at straws now...
584 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
585 | $HEAD --lines 1`
586 fi
587 fi
589 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
590 [search of VCINSTALLDIR])
591 fi
592 fi
594 if test "x$MSVC_DLL" = x; then
595 AC_MSG_CHECKING([for $DLL_NAME])
596 AC_MSG_RESULT([no])
597 AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
598 fi
599 ])
601 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
602 [
603 AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
604 [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
606 if test "x$with_msvcr_dll" != x; then
607 # If given explicitely by user, do not probe. If not present, fail directly.
608 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$with_msvcr_dll], [--with-msvcr-dll])
609 if test "x$MSVC_DLL" = x; then
610 AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
611 fi
612 MSVCR_DLL="$MSVC_DLL"
613 elif test "x$DEVKIT_MSVCR_DLL" != x; then
614 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit])
615 if test "x$MSVC_DLL" = x; then
616 AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit])
617 fi
618 MSVCR_DLL="$MSVC_DLL"
619 else
620 TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}])
621 MSVCR_DLL="$MSVC_DLL"
622 fi
623 AC_SUBST(MSVCR_DLL)
625 AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
626 [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
628 if test "x$MSVCP_NAME" != "x"; then
629 if test "x$with_msvcp_dll" != x; then
630 # If given explicitely by user, do not probe. If not present, fail directly.
631 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$with_msvcp_dll], [--with-msvcp-dll])
632 if test "x$MSVC_DLL" = x; then
633 AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
634 fi
635 MSVCP_DLL="$MSVC_DLL"
636 elif test "x$DEVKIT_MSVCP_DLL" != x; then
637 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
638 if test "x$MSVC_DLL" = x; then
639 AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit])
640 fi
641 MSVCP_DLL="$MSVC_DLL"
642 else
643 TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}])
644 MSVCP_DLL="$MSVC_DLL"
645 fi
646 AC_SUBST(MSVCP_DLL)
647 fi
649 AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
650 [path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])
652 if test "x$USE_UCRT" = "xtrue"; then
653 AC_MSG_CHECKING([for UCRT DLL dir])
654 if test "x$with_ucrt_dll_dir" != x; then
655 if test -z "$(ls -d "$with_ucrt_dll_dir/*.dll" 2> /dev/null)"; then
656 AC_MSG_RESULT([no])
657 AC_MSG_ERROR([Could not find any dlls in $with_ucrt_dll_dir])
658 else
659 AC_MSG_RESULT([$with_ucrt_dll_dir])
660 UCRT_DLL_DIR="$with_ucrt_dll_dir"
661 BASIC_FIXUP_PATH([UCRT_DLL_DIR])
662 fi
663 elif test "x$DEVKIT_UCRT_DLL_DIR" != "x"; then
664 UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR"
665 AC_MSG_RESULT($UCRT_DLL_DIR)
666 else
667 CYGWIN_WINDOWSSDKDIR="${WINDOWSSDKDIR}"
668 BASIC_FIXUP_PATH([CYGWIN_WINDOWSSDKDIR])
669 dll_subdir=$OPENJDK_TARGET_CPU
670 if test "x$dll_subdir" = "xx86_64"; then
671 dll_subdir="x64"
672 fi
673 UCRT_DLL_DIR="$CYGWIN_WINDOWSSDKDIR/Redist/ucrt/DLLs/$dll_subdir"
674 if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
675 AC_MSG_RESULT([no])
676 AC_MSG_ERROR([Could not find any dlls in $UCRT_DLL_DIR])
677 else
678 AC_MSG_RESULT($UCRT_DLL_DIR)
679 fi
680 fi
681 else
682 UCRT_DLL_DIR=
683 fi
684 AC_SUBST(UCRT_DLL_DIR)
685 ])