common/autoconf/toolchain_windows.m4

changeset 972
f3697e0783e2
parent 857
5b4f14990dd1
child 1133
50aaf272884f
child 2208
feba63b3fa36
equal deleted inserted replaced
971:584dc2e95e04 972:f3697e0783e2
73 [ 73 [
74 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 74 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
75 VCVARSFILE="vc/bin/vcvars32.bat" 75 VCVARSFILE="vc/bin/vcvars32.bat"
76 else 76 else
77 VCVARSFILE="vc/bin/amd64/vcvars64.bat" 77 VCVARSFILE="vc/bin/amd64/vcvars64.bat"
78 fi 78 fi
79 79
80 VS_ENV_CMD="" 80 VS_ENV_CMD=""
81 VS_ENV_ARGS="" 81 VS_ENV_ARGS=""
82 if test "x$with_toolsdir" != x; then 82 if test "x$with_toolsdir" != x; then
83 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir]) 83 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
87 # Having specified an argument which is incorrect will produce an instant failure; 87 # Having specified an argument which is incorrect will produce an instant failure;
88 # we should not go on looking 88 # we should not go on looking
89 AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation]) 89 AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
90 AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation]) 90 AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
91 AC_MSG_ERROR([Cannot locate a valid Visual Studio installation]) 91 AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
92 fi 92 fi
93 93
94 if test "x$VS100COMNTOOLS" != x; then 94 if test "x$VS100COMNTOOLS" != x; then
95 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable]) 95 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
96 fi 96 fi
97 if test "x$PROGRAMFILES" != x; then 97 if test "x$PROGRAMFILES" != x; then
116 # Check if the VS env variables were setup prior to running configure. 116 # Check if the VS env variables were setup prior to running configure.
117 # If not, then find vcvarsall.bat and run it automatically, and integrate 117 # If not, then find vcvarsall.bat and run it automatically, and integrate
118 # the set env variables into the spec file. 118 # the set env variables into the spec file.
119 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV], 119 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
120 [ 120 [
121 # Store path to cygwin link.exe to help excluding it when searching for 121 # Store path to cygwin link.exe to help excluding it when searching for
122 # VS linker. This must be done before changing the PATH when looking for VS. 122 # VS linker. This must be done before changing the PATH when looking for VS.
123 AC_PATH_PROG(CYGWIN_LINK, link) 123 AC_PATH_PROG(CYGWIN_LINK, link)
124 if test "x$CYGWIN_LINK" != x; then 124 if test "x$CYGWIN_LINK" != x; then
125 AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool]) 125 AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
126 "$CYGWIN_LINK" --version > /dev/null 126 "$CYGWIN_LINK" --version > /dev/null
185 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) 185 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
186 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) 186 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
187 AC_MSG_ERROR([Cannot continue]) 187 AC_MSG_ERROR([Cannot continue])
188 fi 188 fi
189 189
190 # Now set all paths and other env variables. This will allow the rest of 190 # Now set all paths and other env variables. This will allow the rest of
191 # the configure script to find and run the compiler in the proper way. 191 # the configure script to find and run the compiler in the proper way.
192 AC_MSG_NOTICE([Setting extracted environment variables]) 192 AC_MSG_NOTICE([Setting extracted environment variables])
193 . $OUTPUT_ROOT/localdevenv.sh 193 . $OUTPUT_ROOT/localdevenv.sh
194 else 194 else
195 # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. 195 # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
196 AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) 196 AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
197 fi 197 fi
198 198
199 # At this point, we should have corrent variables in the environment, or we can't continue. 199 # At this point, we should have corrent variables in the environment, or we can't continue.
200 AC_MSG_CHECKING([for Visual Studio variables]) 200 AC_MSG_CHECKING([for Visual Studio variables])
201 201
202 if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then 202 if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then
203 if test "x$INCLUDE" = x || test "x$LIB" = x; then 203 if test "x$INCLUDE" = x || test "x$LIB" = x; then
204 AC_MSG_RESULT([present but broken]) 204 AC_MSG_RESULT([present but broken])
205 AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.]) 205 AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
206 else 206 else
226 fi 226 fi
227 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) 227 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
228 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) 228 AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
229 AC_MSG_ERROR([Cannot continue]) 229 AC_MSG_ERROR([Cannot continue])
230 fi 230 fi
231 231 ])
232 AC_MSG_CHECKING([for msvcr100.dll]) 232
233 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
234 [
235 POSSIBLE_MSVCR_DLL="$1"
236 METHOD="$2"
237 if test -e "$POSSIBLE_MSVCR_DLL"; then
238 AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
239
240 # Need to check if the found msvcr is correct architecture
241 AC_MSG_CHECKING([found msvcr100.dll architecture])
242 MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
243 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
244 CORRECT_MSVCR_ARCH=386
245 else
246 CORRECT_MSVCR_ARCH=x86-64
247 fi
248 if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
249 AC_MSG_RESULT([ok])
250 MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
251 AC_MSG_CHECKING([for msvcr100.dll])
252 AC_MSG_RESULT([$MSVCR_DLL])
253 else
254 AC_MSG_RESULT([incorrect, ignoring])
255 AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
256 fi
257 fi
258 ])
259
260 AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
261 [
233 AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll], 262 AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
234 [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])]) 263 [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
264
235 if test "x$with_msvcr_dll" != x; then 265 if test "x$with_msvcr_dll" != x; then
236 MSVCR_DLL="$with_msvcr_dll" 266 # If given explicitely by user, do not probe. If not present, fail directly.
237 else 267 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
268 if test "x$MSVCR_DLL" = x; then
269 AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
270 fi
271 fi
272
273 if test "x$MSVCR_DLL" = x; then
274 # Probe: Using well-known location from Visual Studio 10.0
238 if test "x$VCINSTALLDIR" != x; then 275 if test "x$VCINSTALLDIR" != x; then
276 CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
277 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
239 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 278 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
240 MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1` 279 POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
241 else 280 else
242 MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1` 281 POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
243 if test "x$MSVCR_DLL" = x; then 282 fi
244 MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1` 283 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
284 fi
285 fi
286
287 if test "x$MSVCR_DLL" = x; then
288 # Probe: Check in the Boot JDK directory.
289 POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
290 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
291 fi
292
293 if test "x$MSVCR_DLL" = x; then
294 # Probe: Look in the Windows system32 directory
295 CYGWIN_SYSTEMROOT="$SYSTEMROOT"
296 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
297 POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
298 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
299 fi
300
301 if test "x$MSVCR_DLL" = x; then
302 # Probe: If Visual Studio Express is installed, there is usually one with the debugger
303 if test "x$VS100COMNTOOLS" != x; then
304 CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
305 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
306 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
307 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
308 else
309 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
310 fi
311 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
312 fi
313 fi
314
315 if test "x$MSVCR_DLL" = x; then
316 # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
317 # (This was the original behaviour; kept since it might turn up something)
318 if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
319 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
320 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
321 else
322 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
323 if test "x$POSSIBLE_MSVCR_DLL" = x; then
324 # We're grasping at straws now...
325 POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
245 fi 326 fi
246 fi 327 fi
247 if test "x$MSVCR_DLL" != x; then 328
248 AC_MSG_NOTICE([msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR]) 329 TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
249 else 330 fi
250 AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR]) 331 fi
251 fi 332
252 fi 333 if test "x$MSVCR_DLL" = x; then
253 # Try some fallback alternatives 334 AC_MSG_CHECKING([for msvcr100.dll])
254 if test "x$MSVCR_DLL" = x; then
255 # If visual studio express is installed, there is usually one with the debugger
256 if test "x$VS100COMNTOOLS" != x; then
257 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
258 MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
259 AC_MSG_NOTICE([msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS..])
260 fi
261 fi
262 fi
263 if test "x$MSVCR_DLL" = x; then
264 if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
265 # Fallback for 32bit builds, look in the windows directory.
266 if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
267 AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
268 MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
269 fi
270 fi
271 fi
272 fi
273 if test "x$MSVCR_DLL" = x; then
274 AC_MSG_RESULT([no]) 335 AC_MSG_RESULT([no])
275 AC_MSG_ERROR([Could not find msvcr100.dll !]) 336 AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
276 fi 337 fi
277 AC_MSG_RESULT([$MSVCR_DLL]) 338
278 BASIC_FIXUP_PATH(MSVCR_DLL) 339 BASIC_FIXUP_PATH(MSVCR_DLL)
279 ]) 340 ])
280
281
282 # Setup the DXSDK paths
283 AC_DEFUN([TOOLCHAIN_SETUP_DXSDK],
284 [
285 AC_ARG_WITH(dxsdk, [AS_HELP_STRING([--with-dxsdk],
286 [the DirectX SDK (Windows only) @<:@probed@:>@])])
287 AC_ARG_WITH(dxsdk-lib, [AS_HELP_STRING([--with-dxsdk-lib],
288 [the DirectX SDK lib directory (Windows only) @<:@probed@:>@])])
289 AC_ARG_WITH(dxsdk-include, [AS_HELP_STRING([--with-dxsdk-include],
290 [the DirectX SDK include directory (Windows only) @<:@probed@:>@])])
291
292 AC_MSG_CHECKING([for DirectX SDK])
293
294 if test "x$with_dxsdk" != x; then
295 dxsdk_path="$with_dxsdk"
296 elif test "x$DXSDK_DIR" != x; then
297 dxsdk_path="$DXSDK_DIR"
298 elif test -d "C:/DXSDK"; then
299 dxsdk_path="C:/DXSDK"
300 else
301 AC_MSG_ERROR([Could not find the DirectX SDK])
302 fi
303 AC_MSG_RESULT([$dxsdk_path])
304 BASIC_FIXUP_PATH(dxsdk_path)
305
306 AC_MSG_CHECKING([for DirectX SDK lib dir])
307 if test "x$with_dxsdk_lib" != x; then
308 DXSDK_LIB_PATH="$with_dxsdk_lib"
309 elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
310 DXSDK_LIB_PATH="$dxsdk_path/Lib/x64"
311 else
312 DXSDK_LIB_PATH="$dxsdk_path/Lib"
313 fi
314 # dsound.lib is linked to in jsoundds
315 if test ! -f "$DXSDK_LIB_PATH/dsound.lib"; then
316 AC_MSG_ERROR([Invalid DirectX SDK lib dir])
317 fi
318 AC_MSG_RESULT([$DXSDK_LIB_PATH])
319 BASIC_FIXUP_PATH(DXSDK_LIB_PATH)
320
321 AC_MSG_CHECKING([for DirectX SDK include dir])
322 if test "x$with_dxsdk_include" != x; then
323 DXSDK_INCLUDE_PATH="$with_dxsdk_include"
324 else
325 DXSDK_INCLUDE_PATH="$dxsdk_path/Include"
326 fi
327 # dsound.h is included in jsoundds
328 if test ! -f "$DXSDK_INCLUDE_PATH/dsound.h"; then
329 AC_MSG_ERROR([Invalid DirectX SDK lib dir])
330 fi
331 AC_MSG_RESULT([$DXSDK_INCLUDE_PATH])
332 BASIC_FIXUP_PATH(DXSDK_INCLUDE_PATH)
333
334 AC_SUBST(DXSDK_LIB_PATH)
335 AC_SUBST(DXSDK_INCLUDE_PATH)
336 LDFLAGS_JDK="$LDFLAGS_JDK -libpath:$DXSDK_LIB_PATH"
337 ])

mercurial