VirtualBox

source: vbox/trunk/configure.vbs@ 6314

Last change on this file since 6314 was 6081, checked in by vboxsync, 17 years ago

Added --internal-last option for simplifying testing of the script.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Id
File size: 65.1 KB
Line 
1' $Id: configure.vbs 6081 2007-12-15 04:50:59Z vboxsync $
2'' @file
3' The purpose of this script is to check for all external tools, headers, and
4' libraries VBox OSE depends on.
5'
6' The script generates the build configuration file 'AutoConfig.kmk' and the
7' environment setup script 'env.bat'. A log of what has been done is
8' written to 'configure.log'.
9'
10
11'
12' Copyright (C) 2006-2007 innotek GmbH
13'
14' This file is part of VirtualBox Open Source Edition (OSE), as
15' available from http://www.virtualbox.org. This file is free software;
16' you can redistribute it and/or modify it under the terms of the GNU
17' General Public License (GPL) as published by the Free Software
18' Foundation, in version 2 as it comes in the "COPYING" file of the
19' VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20' hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21'
22
23
24'*****************************************************************************
25'* Global Variables *
26'*****************************************************************************
27dim g_strPath, g_strEnvFile, g_strLogFile, g_strCfgFile, g_strShellOutput
28g_strPath = Left(Wscript.ScriptFullName, Len(Wscript.ScriptFullName) - Len("\configure.vbs"))
29g_strEnvFile = g_strPath & "\env.bat"
30g_strCfgFile = g_strPath & "\AutoConfig.kmk"
31g_strLogFile = g_strPath & "\configure.log"
32'g_strTmpFile = g_strPath & "\configure.tmp"
33
34dim g_objShell, g_objFileSys
35Set g_objShell = WScript.CreateObject("WScript.Shell")
36Set g_objFileSys = WScript.CreateObject("Scripting.FileSystemObject")
37
38dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev, g_strPathVCC, g_strPathPSDK, g_strPathDDK, g_strSubOutput
39g_strPathkBuild = ""
40g_strPathDev = ""
41g_strPathVCC = ""
42g_strPathPSDK = ""
43g_strPathDDK = ""
44
45dim g_blnDisableCOM, g_strDisableCOM
46g_blnDisableCOM = False
47g_strDisableCOM = ""
48
49' The internal mode is primarily for skipping the xerces and xalan monsters.
50dim g_blnInternalMode
51g_blnInternalMode = False
52
53' Whether to try the internal stuff first or last.
54dim g_blnInternalFirst
55g_blnInternalFirst = True
56
57
58
59''
60' Converts to unix slashes
61function UnixSlashes(str)
62 UnixSlashes = replace(str, "\", "/")
63end function
64
65
66''
67' Converts to dos slashes
68function DosSlashes(str)
69 DosSlashes = replace(str, "/", "\")
70end function
71
72
73''
74' Read a file (typically the tmp file) into a string.
75function FileToString(strFilename)
76 const ForReading = 1, TristateFalse = 0
77 dim objLogFile, str
78
79 set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForReading, False, TristateFalse)
80 str = objFile.ReadAll()
81 objFile.Close()
82
83 FileToString = str
84end function
85
86
87''
88' Deletes a file
89sub FileDelete(strFilename)
90 if g_objFileSys.FileExists(DosSlashes(strFilename)) then
91 g_objFileSys.DeleteFile(DosSlashes(strFilename))
92 end if
93end sub
94
95
96''
97' Appends a line to an ascii file.
98sub FileAppendLine(strFilename, str)
99 const ForAppending = 8, TristateFalse = 0
100 dim objFile
101
102 set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForAppending, True, TristateFalse)
103 objFile.WriteLine(str)
104 objFile.Close()
105end sub
106
107
108''
109' Checks if the file exists.
110function FileExists(strFilename)
111 FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
112end function
113
114
115''
116' Checks if the directory exists.
117function DirExists(strDirectory)
118 DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
119end function
120
121
122''
123' Checks if this is a WOW64 process.
124function IsWow64()
125 if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
126 IsWow64 = 1
127 else
128 IsWow64 = 0
129 end if
130end function
131
132
133''
134' Translates a register root name to a value
135function RegTransRoot(strRoot)
136 const HKEY_LOCAL_MACHINE = &H80000002
137 const HKEY_CURRENT_USER = &H80000001
138 select case strRoot
139 case "HKLM"
140 RegTransRoot = HKEY_LOCAL_MACHINE
141 case "HKCU"
142 RegTransRoot = HKEY_CURRENT_USER
143 case else
144 MsgFatal "RegEnumSubKeys: Unknown root: " & strRoot
145 RegTransRoot = 0
146 end select
147end function
148
149
150'' The registry globals
151dim g_objReg, g_objRegCtx
152dim g_blnRegistry
153g_blnRegistry = false
154
155
156''
157' Init the register provider globals.
158function RegInit()
159 RegInit = false
160 On Error Resume Next
161 if g_blnRegistry = false then
162 set g_objRegCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
163 ' Comment out the following for lines if the cause trouble on your windows version.
164 if IsWow64() then
165 g_objRegCtx.Add "__ProviderArchitecture", 64
166 g_objRegCtx.Add "__RequiredArchitecture", true
167 end if
168 set objLocator = CreateObject("Wbemscripting.SWbemLocator")
169 set objServices = objLocator.ConnectServer("", "root\default", "", "", , , , g_objRegCtx)
170 set g_objReg = objServices.Get("StdRegProv")
171 g_blnRegistry = true
172 end if
173 RegInit = true
174end function
175
176
177''
178' Gets a value from the registry. Returns "" if string wasn't found / valid.
179function RegGetString(strName)
180 RegGetString = ""
181 if RegInit() then
182 dim strRoot, strKey, strValue
183 dim iRoot
184
185 ' split up into root, key and value parts.
186 strRoot = left(strName, instr(strName, "\") - 1)
187 strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\"))
188 strValue = mid(strName, instrrev(strName, "\") + 1)
189
190 ' Must use ExecMethod to call the GetStringValue method because of the context.
191 Set InParms = g_objReg.Methods_("GetStringValue").Inparameters
192 InParms.hDefKey = RegTransRoot(strRoot)
193 InParms.sSubKeyName = strKey
194 InParms.sValueName = strValue
195 On Error Resume Next
196 set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx)
197 if OutParms.ReturnValue = 0 then
198 RegGetString = OutParms.sValue
199 end if
200 else
201 ' fallback mode
202 On Error Resume Next
203 RegGetString = g_objShell.RegRead(strName)
204 end if
205end function
206
207
208''
209' Returns an array of subkey strings.
210function RegEnumSubKeys(strRoot, strKeyPath)
211 dim iRoot
212 iRoot = RegTransRoot(strRoot)
213 RegEnumSubKeys = Array()
214
215 if RegInit() then
216 ' Must use ExecMethod to call the EnumKey method because of the context.
217 Set InParms = g_objReg.Methods_("EnumKey").Inparameters
218 InParms.hDefKey = RegTransRoot(strRoot)
219 InParms.sSubKeyName = strKeyPath
220 On Error Resume Next
221 set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx)
222 if OutParms.ReturnValue = 0 then
223 RegEnumSubKeys = OutParms.sNames
224 end if
225 else
226 ' fallback mode
227 dim objReg, rc, arrSubKeys
228 set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
229 On Error Resume Next
230 rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
231 if rc = 0 then
232 RegEnumSubKeys = arrSubKeys
233 end if
234 end if
235end function
236
237
238''
239' Gets the commandline used to invoke the script.
240function GetCommandline()
241 dim str, i
242
243 '' @todo find an api for querying it instead of reconstructing it like this...
244 GetCommandline = "cscript configure.vbs"
245 for i = 1 to WScript.Arguments.Count
246 str = WScript.Arguments.Item(i - 1)
247 if str = "" then
248 str = """"""
249 elseif (InStr(1, str, " ")) then
250 str = """" & str & """"
251 end if
252 GetCommandline = GetCommandline & " " & str
253 next
254end function
255
256
257''
258' Gets an environment variable.
259function EnvGet(strName)
260 EnvGet = g_objShell.Environment("PROCESS")(strName)
261end function
262
263
264''
265' Sets an environment variable.
266sub EnvSet(strName, strValue)
267 g_objShell.Environment("PROCESS")(strName) = strValue
268 LogPrint "EnvSet: " & strName & "=" & strValue
269end sub
270
271
272''
273' Appends a string to an environment variable
274sub EnvAppend(strName, strValue)
275 dim str
276 str = g_objShell.Environment("PROCESS")(strName)
277 g_objShell.Environment("PROCESS")(strName) = str & strValue
278 LogPrint "EnvAppend: " & strName & "=" & str & strValue
279end sub
280
281
282''
283' Prepends a string to an environment variable
284sub EnvPrepend(strName, strValue)
285 dim str
286 str = g_objShell.Environment("PROCESS")(strName)
287 g_objShell.Environment("PROCESS")(strName) = strValue & str
288 LogPrint "EnvPrepend: " & strName & "=" & strValue & str
289end sub
290
291
292''
293' Get the path of the parent directory. Returns root if root was specified.
294' Expects abs path.
295function PathParent(str)
296 PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
297end function
298
299
300''
301' Strips the filename from at path.
302function PathStripFilename(str)
303 PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
304end function
305
306
307''
308' Get the abs path, use the short version if necessary.
309function PathAbs(str)
310 PathAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
311 if (InStr(1, PathAbs, " ") > 0) _
312 Or (InStr(1, PathAbs, "&") > 0) _
313 Or (InStr(1, PathAbs, "$") > 0) _
314 then
315 if FileExists(PathAbs) then
316 dim objFile
317 set objFile = g_objFileSys.GetFile(PathAbs)
318 PathAbs = objFile.ShortPath
319 elseif DirExists(PathAbs) then
320 dim objFolder
321 set objFolder = g_objFileSys.GetFolder(PathAbs)
322 PathAbs = objFolder.ShortPath
323 else
324 ' ignore non-existing paths.
325 end if
326 end if
327
328
329 if (FileExists(PathAbs) Or DirExists(PathAbs)) _
330 And ( (InStr(1, PathAbs, " ") > 0) _
331 Or (InStr(1, PathAbs, "&") > 0) _
332 Or (InStr(1, PathAbs, "$") > 0)) _
333 then
334 MsgFatal "PathAbs(" & str & ") attempted to return filename with problematic " _
335 & "characters in it (" & PathAbs & "). The tool/sdk referenced will probably " _
336 & "need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
337 & "or '&' in the path name. (Unless it's a problem with this script of course...)"
338 end if
339end function
340
341
342''
343' Executes a command in the shell catching output in g_strShellOutput
344function Shell(strCommand, blnBoth)
345 dim strShell, strCmdline, objExec, str
346
347 strShell = g_objShell.ExpandEnvironmentStrings("%ComSpec%")
348 if blnBoth = true then
349 strCmdline = strShell & " /c " & strCommand & " 2>&1"
350 else
351 strCmdline = strShell & " /c " & strCommand & " 2>nul"
352 end if
353
354 LogPrint "# Shell: " & strCmdline
355 Set objExec = g_objShell.Exec(strCmdLine)
356 g_strShellOutput = objExec.StdOut.ReadAll()
357 objExec.StdErr.ReadAll()
358 do while objExec.Status = 0
359 Wscript.Sleep 20
360 g_strShellOutput = g_strShellOutput & objExec.StdOut.ReadAll()
361 objExec.StdErr.ReadAll()
362 loop
363
364 LogPrint "# Status: " & objExec.ExitCode
365 LogPrint "# Start of Output"
366 LogPrint g_strShellOutput
367 LogPrint "# End of Output"
368
369 Shell = objExec.ExitCode
370end function
371
372
373''
374' Try find the specified file in the path.
375function Which(strFile)
376 dim strPath, iStart, iEnd, str
377
378 ' the path
379 strPath = EnvGet("Path")
380 iStart = 1
381 do while iStart <= Len(strPath)
382 iEnd = InStr(iStart, strPath, ";")
383 if iEnd <= 0 then iEnd = Len(strPath) + 1
384 if iEnd > iStart then
385 str = Mid(strPath, iStart, iEnd - iStart) & "/" & strFile
386 if FileExists(str) then
387 Which = str
388 exit function
389 end if
390 end if
391 iStart = iEnd + 1
392 loop
393
394 ' registry or somewhere?
395
396 Which = ""
397end function
398
399
400''
401' Append text to the log file and echo it to stdout
402sub Print(str)
403 LogPrint str
404 Wscript.Echo str
405end sub
406
407
408''
409' Prints a test header
410sub PrintHdr(strTest)
411 LogPrint "***** Checking for " & strTest & " *****"
412 Wscript.Echo "Checking for " & StrTest & "..."
413end sub
414
415
416''
417' Prints a success message
418sub PrintResult(strTest, strResult)
419 LogPrint "** " & strTest & ": " & strResult
420 Wscript.Echo " Found "& strTest & ": " & strResult
421end sub
422
423
424''
425' Warning message.
426sub MsgWarning(strMsg)
427 Print "warning: " & strMsg
428end sub
429
430
431''
432' Fatal error.
433sub MsgFatal(strMsg)
434 Print "fatal error: " & strMsg
435 Wscript.Quit
436end sub
437
438
439''
440' Error message, fatal unless flag to ignore errors is given.
441sub MsgError(strMsg)
442 Print "error: " & strMsg
443 if g_blnInternalMode = False then
444 Wscript.Quit
445 end if
446end sub
447
448
449''
450' Write a log header with some basic info.
451sub LogInit
452 FileDelete g_strLogFile
453 LogPrint "# Log file generated by " & Wscript.ScriptFullName
454 for i = 1 to WScript.Arguments.Count
455 LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
456 next
457 if Wscript.Arguments.Count = 0 then
458 LogPrint "# No arguments given"
459 end if
460 LogPrint "# Reconstructed command line: " & GetCommandline()
461
462 ' some Wscript stuff
463 LogPrint "# Wscript properties:"
464 LogPrint "# ScriptName: " & Wscript.ScriptName
465 LogPrint "# Version: " & Wscript.Version
466 LogPrint "# Build: " & Wscript.BuildVersion
467 LogPrint "# Name: " & Wscript.Name
468 LogPrint "# Full Name: " & Wscript.FullName
469 LogPrint "# Path: " & Wscript.Path
470 LogPrint "#"
471
472
473 ' the environment
474 LogPrint "# Environment:"
475 dim objEnv
476 for each strVar in g_objShell.Environment("PROCESS")
477 LogPrint "# " & strVar
478 next
479 LogPrint "#"
480end sub
481
482
483''
484' Append text to the log file.
485sub LogPrint(str)
486 FileAppendLine g_strLogFile, str
487 'Wscript.Echo "dbg: " & str
488end sub
489
490
491''
492' Checks if the file exists and logs failures.
493function LogFileExists(strPath, strFilename)
494 LogFileExists = FileExists(strPath & "/" & strFilename)
495 if LogFileExists = False then
496 LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
497 end if
498
499end function
500
501
502''
503' Finds the first file matching the pattern.
504' If no file is found, log the failure.
505function LogFindFile(strPath, strPattern)
506 dim str
507
508 '
509 ' Yes, there are some facy database kinda interface to the filesystem
510 ' however, breaking down the path and constructing a usable query is
511 ' too much hassle. So, we'll do it the unix way...
512 '
513 if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
514 And InStr(1, g_strShellOutput, Chr(13)) > 1 _
515 then
516 ' return the first word.
517 LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
518 else
519 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
520 LogFindFile = ""
521 end if
522end function
523
524
525''
526' Initializes the config file.
527sub CfgInit
528 FileDelete g_strCfgFile
529 CfgPrint "# -*- Makefile -*-"
530 CfgPrint "#"
531 CfgPrint "# Build configuration generated by " & GetCommandline()
532 CfgPrint "#"
533 if g_blnInternalMode = False then
534 CfgPrint "VBOX_OSE := 1"
535 end if
536end sub
537
538
539''
540' Prints a string to the config file.
541sub CfgPrint(str)
542 FileAppendLine g_strCfgFile, str
543end sub
544
545
546''
547' Initializes the environment batch script.
548sub EnvInit
549 FileDelete g_strEnvFile
550 EnvPrint "@echo off"
551 EnvPrint "rem"
552 EnvPrint "rem Environment setup script generated by " & GetCommandline()
553 EnvPrint "rem"
554end sub
555
556
557''
558' Prints a string to the environment batch script.
559sub EnvPrint(str)
560 FileAppendLine g_strEnvFile, str
561end sub
562
563
564''
565' No COM
566sub DisableCOM(strReason)
567 if g_blnDisableCOM = False then
568 LogPrint "Disabled COM components: " & strReason
569 g_blnDisableCOM = True
570 g_strDisableCOM = strReason
571 CfgPrint "VBOX_WITH_MAIN="
572 CfgPrint "VBOX_WITH_QTGUI="
573 CfgPrint "VBOX_WITH_VBOXSDL="
574 CfgPrint "VBOX_WITH_DEBUGGER_GUI="
575 CfgPrint "VBOX_WITHOUT_COM=1"
576 end if
577end sub
578
579
580''
581' Checks the the path doesn't contain characters the tools cannot deal with.
582sub CheckSourcePath
583 dim sPwd
584
585 sPwd = PathAbs(g_strPath)
586 if InStr(1, sPwd, " ") > 0 then
587 MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
588 end if
589 if InStr(1, sPwd, "$") > 0 then
590 MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
591 end if
592 if InStr(1, sPwd, "%") > 0 then
593 MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
594 end if
595 if InStr(1, sPwd, Chr(10)) > 0 _
596 Or InStr(1, sPwd, Chr(13)) > 0 _
597 Or InStr(1, sPwd, Chr(9)) > 0 _
598 then
599 MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
600 end if
601 Print "Source path: OK"
602end sub
603
604
605''
606' Checks for kBuild - very simple :)
607sub CheckForkBuild(strOptkBuild)
608 PrintHdr "kBuild"
609
610 '
611 ' Check if there is a 'kmk' in the path somewhere without
612 ' any PATH_KBUILD* stuff around.
613 '
614 blnNeedEnvVars = True
615 g_strPathkBuild = strOptkBuild
616 g_strPathkBuildBin = ""
617 if (g_strPathkBuild = "") _
618 And (EnvGet("PATH_KBUILD") = "") _
619 And (EnvGet("PATH_KBUILD_BIN") = "") _
620 And (Shell("kmk.exe --version", True) = 0) _
621 And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
622 And (InStr(1,g_strShellOutput, "PATH_KBUILD") > 0) _
623 And (InStr(1,g_strShellOutput, "PATH_KBUILD_BIN") > 0) then
624 '' @todo Need to parse out the PATH_KBUILD and PATH_KBUILD_BIN values to complete the other tests.
625 'blnNeedEnvVars = False
626 MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
627 & "deal with that yet and will use the one it ships with. Sorry."
628 end if
629
630 '
631 ' Check for the PATH_KBUILD env.var. and fall back on root/kBuild otherwise.
632 '
633 if g_strPathkBuild = "" then
634 g_strPathkBuild = EnvGet("PATH_KBUILD")
635 if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
636 MsgWarning "Ignoring incorrect kBuild path (PATH_KBUILD=" & g_strPathkBuild & ")"
637 g_strPathkBuild = ""
638 end if
639
640 if g_strPathkBuild = "" then
641 g_strPathkBuild = g_strPath & "/kBuild"
642 end if
643 end if
644
645 g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
646
647 '
648 ' Determin the location of the kBuild binaries.
649 '
650 if g_strPathkBuildBin = "" then
651 dim str2
652 if EnvGet("PROCESSOR_ARCHITECTURE") = "x86" then
653 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
654 else ' boldly assumes there is only x86 and amd64.
655 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.amd64"
656 if FileExists(g_strPathkBuild & "/kmk.exe") = False then
657 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
658 end if
659 end if
660 if FileExists(g_strPathkBuild & "/kmk.exe") = False then
661 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
662 end if
663 end if
664
665 '
666 ' Perform basic validations of the kBuild installation.
667 '
668 if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
669 Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
670 Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
671 MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
672 & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
673 exit sub
674 end if
675 if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
676 Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
677 MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
678 & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
679 exit sub
680 end if
681
682 if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) Then
683 MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
684 exit sub
685 end if
686
687 '
688 ' Check for env.vars that kBuild uses.
689 '
690 str = EnvGet("BUILD_TYPE")
691 if (str <> "") _
692 And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
693 EnvPrint "set BUILD_TYPE=release"
694 EnvSet "BUILD_TYPE", "release"
695 MsgWarning "Found unknown BUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
696 end if
697
698 str = EnvGet("BUILD_TARGET")
699 if (str <> "") _
700 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
701 EnvPrint "set BUILD_TARGET=win"
702 EnvSet "BUILD_TARGET", "win"
703 MsgWarning "Found unknown BUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
704 end if
705
706 str = EnvGet("BUILD_TARGET_ARCH")
707 if (str <> "") _
708 And (InStr(1, "x86|amd64", str) <= 0) then
709 EnvPrint "set BUILD_TARGET_ARCH=x86"
710 EnvSet "BUILD_TARGET_ARCH", "x86"
711 MsgWarning "Found unknown BUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
712 end if
713
714 str = EnvGet("BUILD_TARGET_CPU")
715 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
716 if (str <> "") _
717 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
718 EnvPrint "set BUILD_TARGET_CPU=i386"
719 EnvSet "BUILD_TARGET_CPU", "i386"
720 MsgWarning "Found unknown BUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
721 end if
722
723 str = EnvGet("BUILD_PLATFORM")
724 if (str <> "") _
725 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
726 EnvPrint "set BUILD_PLATFORM=win"
727 EnvSet "BUILD_PLATFORM", "win"
728 MsgWarning "Found unknown BUILD_PLATFORM value '" & str &"' in your environment. Setting it to 'win32'."
729 end if
730
731 str = EnvGet("BUILD_PLATFORM_ARCH")
732 if (str <> "") _
733 And (InStr(1, "x86|amd64", str) <= 0) then
734 EnvPrint "set BUILD_PLATFORM_ARCH=x86"
735 EnvSet "BUILD_PLATFORM_ARCH", "x86"
736 MsgWarning "Found unknown BUILD_PLATFORM_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
737 end if
738
739 str = EnvGet("BUILD_PLATFORM_CPU")
740 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
741 if (str <> "") _
742 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
743 EnvPrint "set BUILD_PLATFORM_CPU=i386"
744 EnvSet "BUILD_PLATFORM_CPU", "i386"
745 MsgWarning "Found unknown BUILD_PLATFORM_CPU value '" & str &"' in your environment. Setting it to 'i386'."
746 end if
747
748 '
749 ' If PATH_DEV is set, check that it's pointing to something useful.
750 '
751 str = EnvGet("PATH_DEV")
752 g_strPathDev = str
753 if (str <> "") _
754 And False then '' @todo add some proper tests here.
755 strNew = UnixSlashes(g_strPath & "/tools")
756 EnvPrint "set PATH_DEV=" & strNew
757 EnvSet "PATH_DEV", strNew
758 MsgWarning "Found PATH_DEV='" & str &"' in your environment. Setting it to '" & strNew & "'."
759 g_strPathDev = strNew
760 end if
761 if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
762
763 '
764 ' Write PATH_KBUILD to the environment script if necessary.
765 '
766 if blnNeedEnvVars = True then
767 EnvPrint "set PATH_KBUILD=" & g_strPathkBuild
768 EnvSet "PATH_KBUILD", g_strPathkBuild
769 EnvPrint "set PATH=" & g_strPathkBuildBin & ";%PATH%"
770 EnvPrepend "PATH", g_strPathkBuildBin & ";"
771 end if
772
773 PrintResult "kBuild", g_strPathkBuild
774 PrintResult "kBuild binaries", g_strPathkBuildBin
775end sub
776
777
778''
779' Checks for Visual C++ version 7 or 8.
780sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
781 dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
782 PrintHdr "Visual C++"
783
784 '
785 ' Try find it...
786 '
787 strPathVC = ""
788 strPathVCCommon = ""
789 if (strPathVC = "") And (strOptVC <> "") then
790 if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
791 strPathVC = strOptVC
792 strPathVCCommon = strOptVCCommon
793 end if
794 end if
795
796 if (strPathVC = "") And (g_blnInternalFirst = True) Then
797 strPathVC = g_strPathDev & "/win.x86/vcc/v8"
798 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
799 strPathVC = g_strPathDev & "/win.x86/vcc/v7"
800 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
801 strPathVC = ""
802 end if
803 end if
804 end if
805
806 if (strPathVC = "") _
807 And (Shell("cl.exe", True) = 0) then
808 str = Which("cl.exe")
809 if FileExists(PathStripFilename(strClExe) & "/build.exe") then
810 ' don't know how to deal with this cl.
811 Warning "Ignoring DDK cl.exe (" & str & ")."
812 else
813 strPathVC = PathParent(PathStripFilename(str))
814 strPathVCCommon = PathParent(strPathVC) & "/Common7"
815 end if
816 end if
817
818 if strPathVC = "" then
819 str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
820 str2 = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
821 if str <> "" And str2 <> "" Then
822 str = str & "VC"
823 str2 = PathParent(str2)
824 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
825 strPathVC = str
826 strPathVCCommon = str2
827 end if
828 end if
829 end if
830
831 if strPathVC = "" then
832 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
833 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
834 if str <> "" And str2 <> "" Then
835 str = str & "VC"
836 str2 = PathParent(str2)
837 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
838 strPathVC = str
839 strPathVCCommon = str2
840 end if
841 end if
842 end if
843
844 if strPathVC = "" then
845 '' @todo check what this really looks like on 7.1
846 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\ProductDir")
847 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\EnvironmentDirectory")
848 if str <> "" And str2 <> "" Then
849 str = str & "VC7"
850 str2 = PathParent(str2)
851 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
852 strPathVC = str
853 strPathVCCommon = str2
854 end if
855 end if
856 end if
857
858 if strPathVC = "" then
859 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\ProductDir")
860 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\EnvironmentDirectory")
861 if str <> "" And str2 <> "" Then
862 str = str & "VC7"
863 str2 = PathParent(str2)
864 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
865 strPathVC = str
866 strPathVCCommon = str2
867 end if
868 end if
869 end if
870
871 if strPathVC = "" then
872 str = RegGetString("HKLM\SOFTWARE\Microsoft\Wow6432Node\VisualStudio\SxS\VC7\8.0")
873 if str <> "" then
874 str2 = PathParent(str) & "/Common7"
875 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
876 strPathVC = str
877 strPathVCCommon = str2
878 end if
879 end if
880 end if
881
882 if strPathVC = "" then
883 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7\8.0")
884 if str <> "" then
885 str2 = PathParent(str) & "/Common7"
886 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
887 strPathVC = str
888 strPathVCCommon = str2
889 end if
890 end if
891 end if
892
893 ' finally check for the express edition.
894 if strPathVC = "" then
895 str = RegGetString("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Visual C++ 2005 Express Edition - ENU\InstallLocation")
896 if str <> "" then
897 str2 = str & "Common7"
898 str = str & "VC/"
899 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
900 strPathVC = str
901 strPathVCCommon = str2
902 end if
903 end if
904 end if
905
906 if (strPathVC = "") And (g_blnInternalFirst = False) Then
907 strPathVC = g_strPathDev & "/win.x86/vcc/v8"
908 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
909 strPathVC = g_strPathDev & "/win.x86/vcc/v7"
910 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
911 strPathVC = ""
912 end if
913 end if
914 end if
915
916 if strPathVC = "" then
917 MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
918 exit sub
919 end if
920
921 '
922 ' Clean up the path and determin the VC directory.
923 '
924 strPathVC = UnixSlashes(PathAbs(strPathVC))
925 g_strPathVCC = strPathVC
926
927 '
928 ' Check the version.
929 ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
930 '
931 if (strPathVCCommon <> "") Then
932 EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
933 end if
934 if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
935 MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed."
936 exit sub
937 end if
938
939 if (InStr(1, g_strShellOutput, "Version 13.10") <= 0) _
940 And (InStr(1, g_strShellOutput, "Version 14.") <= 0) then
941 MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 7.1 or 8.0. Check the build requirements."
942 exit sub
943 end if
944
945 '
946 ' Ok, emit build config variables.
947 '
948 if InStr(1, g_strShellOutput, "Version 14.") > 0 then
949 CfgPrint "VBOX_USE_VCC80 := 1"
950 CfgPrint "PATH_TOOL_VCC80 := " & g_strPathVCC
951 CfgPrint "PATH_TOOL_VCC80X86 = $(PATH_TOOL_VCC80)"
952 CfgPrint "PATH_TOOL_VCC80AMD64 = $(PATH_TOOL_VCC80)"
953 if blnOptVCExpressEdition _
954 And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
955 then
956 CfgPrint "TOOL_VCC80X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
957 CfgPrint "TOOL_VCC80AMD64_MT = $(TOOL_VCC80X86_MT)"
958 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
959 DisableCOM "No ATL"
960 PrintResult "Visual C++ v8 (or later) without ATL", g_strPathVCC
961 else
962 PrintResult "Visual C++ v8 (or later)", g_strPathVCC
963 end if
964 else
965 CfgPrint "PATH_TOOL_VCC70 := " & g_strPathVCC
966 if blnOptVCExpressEdition _
967 And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
968 then
969 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
970 DisableCOM "No ATL"
971 PrintResult "Visual C++ v7.1 without ATL", g_strPathVCC
972 else
973 PrintResult "Visual C++ v7.1", g_strPathVCC
974 end if
975 end if
976
977 ' and the env.bat path fix.
978 if strPathVCCommon <> "" then
979 EnvPrint "set PATH=%PATH%;" & strPathVCCommon & "/IDE;"
980 end if
981end sub
982
983''
984' Checks if the specified path points to a usable PSDK.
985function CheckForVisualCPPSub(strPathVC, strPathVCCommon, blnOptVCExpressEdition)
986 strPathVC = UnixSlashes(PathAbs(strPathVC))
987 CheckForVisualCPPSub = False
988 LogPrint "trying: strPathVC=" & strPathVC & " strPathVCCommon=" & strPathVCCommon & " blnOptVCExpressEdition=" & blnOptVCExpressEdition
989 if LogFileExists(strPathVC, "bin/cl.exe") _
990 And LogFileExists(strPathVC, "bin/link.exe") _
991 And LogFileExists(strPathVC, "include/string.h") _
992 And LogFileExists(strPathVC, "lib/libcmt.lib") _
993 And LogFileExists(strPathVC, "lib/msvcrt.lib") _
994 then
995 if blnOptVCExpressEdition _
996 Or ( LogFileExists(strPathVC, "atlmfc/include/atlbase.h") _
997 And LogFileExists(strPathVC, "atlmfc/lib/atls.lib")) _
998 Then
999 '' @todo figure out a way we can verify the version/build!
1000 CheckForVisualCPPSub = True
1001 end if
1002 end if
1003end function
1004
1005
1006''
1007' Checks for a platform SDK that works with the compiler
1008sub CheckForPlatformSDK(strOptSDK)
1009 dim strPathPSDK, str
1010 PrintHdr "Windows Platform SDK (recent)"
1011
1012 strPathPSDK = ""
1013
1014 ' Check the supplied argument first.
1015 str = strOptSDK
1016 if str <> "" then
1017 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1018 end if
1019
1020 ' The tools location (first).
1021 if (strPathPSDK = "") And (g_blnInternalFirst = True) then
1022 str = g_strPathDev & "/win.x86/sdk/200604"
1023 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1024 end if
1025
1026 if (strPathPSDK = "") And (g_blnInternalFirst = True) then
1027 str = g_strPathDev & "/win.x86/sdk/200504"
1028 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1029 end if
1030
1031 if (strPathPSDK = "") And (g_blnInternalFirst = True) then
1032 str = g_strPathDev & "/win.x86/sdk/200209"
1033 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1034 end if
1035
1036 ' Look for it in the environment
1037 str = EnvGet("MSSdk")
1038 if (strPathPSDK = "") And (str <> "") then
1039 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1040 end if
1041
1042 str = EnvGet("Mstools")
1043 if (strPathPSDK = "") And (str <> "") then
1044 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1045 end if
1046
1047 ' Check if there is one installed with the compiler.
1048 if (strPathPSDK = "") And (str <> "") then
1049 str = g_strPathVCC & "/PlatformSDK"
1050 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1051 end if
1052
1053 ' Check the registry next. (first pair is vista, second is pre-vista)
1054 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1055 for Each strSubKey In arrSubKeys
1056 str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
1057 if (strPathPSDK = "") And (str <> "") then
1058 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1059 end if
1060 Next
1061 arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1062 for Each strSubKey In arrSubKeys
1063 str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
1064 if (strPathPSDK = "") And (str <> "") then
1065 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1066 end if
1067 Next
1068
1069 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
1070 for Each strSubKey In arrSubKeys
1071 str = RegGetString("HKLM\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
1072 if (strPathPSDK = "") And (str <> "") then
1073 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1074 end if
1075 Next
1076 arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
1077 for Each strSubKey In arrSubKeys
1078 str = RegGetString("HKCU\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
1079 if (strPathPSDK = "") And (str <> "") then
1080 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1081 end if
1082 Next
1083
1084 ' The tools location (post).
1085 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1086 str = g_strPathDev & "/win.x86/sdk/200604"
1087 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1088 end if
1089
1090 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1091 str = g_strPathDev & "/win.x86/sdk/200504"
1092 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1093 end if
1094
1095 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1096 str = g_strPathDev & "/win.x86/sdk/200209"
1097 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1098 end if
1099
1100 ' Give up.
1101 if strPathPSDK = "" then
1102 MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
1103 exit sub
1104 end if
1105
1106 '
1107 ' Emit the config.
1108 '
1109 strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
1110 CfgPrint "PATH_SDK_WINPSDK := " & strPathPSDK
1111 CfgPrint "PATH_SDK_WINPSDKINCS = $(PATH_SDK_WINPSDK)"
1112 CfgPrint "PATH_SDK_WIN32SDK = $(PATH_SDK_WINPSDK)"
1113 CfgPrint "PATH_SDK_WIN64SDK = $(PATH_SDK_WINPSDK)"
1114
1115 PrintResult "Windows Platform SDK", strPathPSDK
1116 g_strPathPSDK = strPathPSDK
1117end sub
1118
1119''
1120' Checks if the specified path points to a usable PSDK.
1121function CheckForPlatformSDKSub(strPathPSDK)
1122 CheckForPlatformSDKSub = False
1123 LogPrint "trying: strPathPSDK=" & strPathPSDK
1124 if LogFileExists(strPathPSDK, "include/Windows.h") _
1125 And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
1126 And LogFileExists(strPathPSDK, "lib/User32.Lib") _
1127 then
1128 CheckForPlatformSDKSub = True
1129 end if
1130end function
1131
1132
1133''
1134' Checks for a Windows 2003 DDK that works with the compiler intrinsics.
1135sub CheckForWin2k3DDK(strOptDDK)
1136 dim strPathDDK, str, strSubKeys
1137 PrintHdr "Windows 2003 DDK, build 3790 or later"
1138
1139 '
1140 ' Find the DDK.
1141 '
1142 strPathDDK = ""
1143 ' The specified path.
1144 if (strPathDDK = "") And (strOptDDK <> "") then
1145 if CheckForWin2k3DDKSub(strOptDDK, True) then strPathDDK = strOptDDK
1146 end if
1147
1148 ' The tools location (first).
1149 if (strPathDDK = "") And (g_blnInternalFirst = True) then
1150 str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
1151 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1152 end if
1153
1154 if (strPathDDK = "") And (g_blnInternalFirst = True) then
1155 str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
1156 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1157 end if
1158
1159 ' Check the environment
1160 str = EnvGet("DDK_INC_PATH")
1161 if (strPathDDK = "") And (str <> "") then
1162 str = PathParent(PathParent(str))
1163 if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
1164 end if
1165
1166 str = EnvGet("BASEDIR")
1167 if (strPathDDK = "") And (str <> "") then
1168 if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
1169 end if
1170
1171 ' Check the registry next. (the first pair is for vista (WDK), the second for pre-vista (DDK))
1172 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
1173 for Each strSubKey In arrSubKeys
1174 str = RegGetString("HKLM\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\Setup\BUILD")
1175 if (strPathDDK = "") And (str <> "") then
1176 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1177 end if
1178 Next
1179 arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
1180 for Each strSubKey In arrSubKeys
1181 str = RegGetString("HKCU\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\Setup\BUILD")
1182 if (strPathDDK = "") And (str <> "") then
1183 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1184 end if
1185 Next
1186
1187 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
1188 for Each strSubKey In arrSubKeys
1189 str = RegGetString("HKLM\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\SFNDirectory")
1190 if (strPathDDK = "") And (str <> "") then
1191 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1192 end if
1193 Next
1194 arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
1195 for Each strSubKey In arrSubKeys
1196 str = RegGetString("HKCU\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\SFNDirectory")
1197 if (strPathDDK = "") And (str <> "") then
1198 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1199 end if
1200 Next
1201
1202 ' The tools location (post).
1203 if (strPathDDK = "") And (g_blnInternalFirst = False) then
1204 str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
1205 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1206 end if
1207
1208 if (strPathDDK = "") And (g_blnInternalFirst = False) then
1209 str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
1210 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1211 end if
1212
1213 ' Give up.
1214 if strPathDDK = "" then
1215 MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."
1216 exit sub
1217 end if
1218
1219 '
1220 ' Emit the config.
1221 '
1222 strPathDDK = UnixSlashes(PathAbs(strPathDDK))
1223 CfgPrint "PATH_SDK_W2K3DDK := " & strPathDDK
1224 CfgPrint "PATH_SDK_W2K3DDKX86 = $(PATH_SDK_W2K3DDK)"
1225 CfgPrint "PATH_SDK_W2K3DDKAMD64 = $(PATH_SDK_W2K3DDK)"
1226
1227 PrintResult "Windows 2003 DDK", strPathDDK
1228 g_strPathDDK = strPathDDK
1229end sub
1230
1231'' Quick check if the DDK is in the specified directory or not.
1232function CheckForWin2k3DDKSub(strPathDDK, blnCheckBuild)
1233 CheckForWin2k3DDKSub = False
1234 LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
1235 '' @todo vista: if ( LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
1236 ' Or LogFileExists(strPathDDK, "inc/api/ntdef.h")) _
1237 if LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
1238 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
1239 then
1240 '' @todo figure out a way we can verify the version/build!
1241 CheckForWin2k3DDKSub = True
1242 end if
1243end function
1244
1245
1246''
1247' Finds midl.exe
1248sub CheckForMidl()
1249 dim strMidl
1250 PrintHdr "Midl.exe"
1251
1252 ' Skip if no COM/ATL.
1253 if g_blnDisableCOM then
1254 PrintResult "Xerces", "Skipped (" & g_strDisableCOM & ")"
1255 exit sub
1256 end if
1257
1258 if LogFileExists(g_strPathPSDK, "bin/Midl.exe") then
1259 strMidl = g_strPathPSDK & "/bin/Midl.exe"
1260 elseif LogFileExists(g_strPathVCC, "Common7/Tools/Bin/Midl.exe") then
1261 strMidl = g_strPathVCC & "/Common7/Tools/Bin/Midl.exe"
1262 elseif LogFileExists(g_strPathDDK, "bin/x86/Midl.exe") then
1263 strMidl = g_strPathDDK & "/bin/x86/Midl.exe"
1264 elseif LogFileExists(g_strPathDDK, "bin/Midl.exe") then
1265 strMidl = g_strPathDDK & "/bin/Midl.exe"
1266 elseif LogFileExists(g_strPathDev, "win.x86/bin/Midl.exe") then
1267 strMidl = g_strPathDev & "/win.x86/bin/Midl.exe"
1268 else
1269 MsgWarning "Midl.exe not found!"
1270 exit sub
1271 end if
1272
1273 CfgPrint "MAIN_IDL = " & strMidl
1274 PrintResult "Midl.exe", strMidl
1275end sub
1276
1277
1278''
1279' Checks for a recent DirectX SDK.
1280sub CheckForDirectXSDK(strOptDXSDK)
1281 dim strPathDXSDK, str, arrSubKeys, arrSubKeys2, strKey, strKey2
1282 PrintHdr "Direct X SDK"
1283
1284 '
1285 ' Find the DX SDK.
1286 '
1287 strPathDXSDK = ""
1288 ' The specified path.
1289 if (strPathDXSDK = "") And (strOptDXSDK <> "") then
1290 if CheckForDirectXSDKSub(strOptDXSDK) then strPathDXSDK = strOptDXSDK
1291 end if
1292
1293 ' The tools location (first).
1294 if (strPathDXSDK = "") And (g_blnInternalFirst = True) then
1295 str = g_strPathDev & "/win.x86/dxsdk/200610"
1296 if CheckForDirectXSDKSub(str) then strPathDXSDK = str
1297 end if
1298
1299 ' Check the installer registry (sucks a bit).
1300 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData")
1301 for Each strSubKey In arrSubKeys
1302 strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" & strSubKey & "\Products"
1303 arrSubKeys2 = RegEnumSubKeys("HKLM", strKey)
1304 for Each strSubKey2 In arrSubKeys2
1305 strKey2 = "HKLM\" & strKey & "\" & strSubKey2 & "\InstallProperties"
1306 str = RegGetString(strKey2 & "\DisplayName")
1307 if InStr(1, str, "Microsoft DirectX SDK") > 0 then
1308 str = RegGetString(strKey2 & "\InstallLocation")
1309 if (str <> "") And (strPathDXSDK = "") then
1310 if CheckForDirectXSDKSub(str) then
1311 strPathDXSDK = str
1312 Exit For
1313 end if
1314 end if
1315 end if
1316 Next
1317 Next
1318
1319 ' The tools location (post).
1320 if (strPathDXSDK = "") And (g_blnInternalFirst = False) then
1321 str = g_strPathDev & "/win.x86/dxsdk/200610"
1322 if CheckForDirectXSDKSub(str) then strPathDXSDK = str
1323 end if
1324
1325 ' Give up.
1326 if strPathDXSDK = "" then
1327 MsgError "Cannot find a suitable Direct X SDK. Check configure.log and the build requirements."
1328 exit sub
1329 end if
1330
1331 '
1332 ' Emit the config.
1333 '
1334 strPathDXSDK = UnixSlashes(PathAbs(strPathDXSDK))
1335 CfgPrint "PATH_SDK_DXSDK := " & strPathDXSDK
1336 CfgPrint "PATH_SDK_DXSDKX86 = $(PATH_SDK_DXSDK)"
1337 CfgPrint "PATH_SDK_DXSDKAMD64 = $(PATH_SDK_DXSDK)"
1338
1339 PrintResult "Direct X SDK", strPathDXSDK
1340end sub
1341
1342'' Quick check if the DXSDK is in the specified directory or not.
1343function CheckForDirectXSDKSub(strPathDXSDK)
1344 CheckForDirectXSDKSub = False
1345 LogPrint "trying: strPathDXSDK=" & strPathDXSDK
1346 if LogFileExists(strPathDXSDK, "Lib/x86/dxguid.lib") _
1347 then
1348 '' @todo figure out a way we can verify the version/build!
1349 CheckForDirectXSDKSub = True
1350 end if
1351end function
1352
1353
1354''
1355' Checks for a MingW32 suitable for building the recompiler.
1356'
1357' strOptW32API is currently ignored.
1358'
1359sub CheckForMingW(strOptMingw, strOptW32API)
1360 dim strPathMingW, strPathW32API, str
1361 PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API"
1362
1363 '
1364 ' Find the MinGW and W32API tools.
1365 '
1366 strPathMingW = ""
1367 strPathW32API = ""
1368
1369 ' The specified path.
1370 if (strPathMingW = "") And (strOptMingW <> "") then
1371 if CheckForMingWSub(strOptMingW, strOptW32API) then
1372 strPathMingW = strOptMingW
1373 strPathW32API = strOptW32API
1374 end if
1375 end if
1376
1377 ' The tools location (first).
1378 if (strPathMingW = "") And (g_blnInternalFirst = True) then
1379 str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
1380 str2 = g_strPathDev & "/win.x86/w32api/v2.5"
1381 if CheckForMingWSub(str, str2) then
1382 strPathMingW = str
1383 strPathW32API = str2
1384 end if
1385 end if
1386
1387 ' See if there is any gcc around.
1388 if strPathMingW = "" then
1389 str = Which("mingw32-gcc.exe")
1390 if (str <> "") then
1391 str = PathParent(PathStripFilename(str))
1392 if CheckForMingWSub(str, str) then strPathMingW = str
1393 end if
1394 end if
1395
1396 if strPathMingW = "" then
1397 str = Which("gcc.exe")
1398 if (str <> "") then
1399 str = PathParent(PathStripFilename(str))
1400 if CheckForMingWSub(str, str) then strPathMingW = str
1401 end if
1402 end if
1403
1404 ' The tools location (post).
1405 if (strPathMingW = "") And (g_blnInternalFirst = False) then
1406 str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
1407 str2 = g_strPathDev & "/win.x86/w32api/v2.5"
1408 if CheckForMingWSub(str, str2) then
1409 strPathMingW = str
1410 strPathW32API = str2
1411 end if
1412 end if
1413
1414 ' Success?
1415 if strPathMingW = "" then
1416 if strOptMingw = "" then
1417 MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
1418 & "the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements."
1419 else
1420 MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements."
1421 end if
1422 exit sub
1423 end if
1424
1425 '
1426 ' Emit the config.
1427 '
1428 strPathMingW = UnixSlashes(PathAbs(strPathMingW))
1429 CfgPrint "PATH_TOOL_MINGW32 := " & strPathMingW
1430 PrintResult "MinGW (GCC v" & g_strSubOutput & ")", strPathMingW
1431 if (strPathMingW = strPathW32API) Or strPathW32API = "" then
1432 CfgPrint "PATH_SDK_W32API = $(PATH_TOOL_MINGW32)"
1433 else
1434 CfgPrint "PATH_SDK_W32API = " & strPathW32API
1435 PrintResult "W32API", strPathW32API
1436 end if
1437end sub
1438
1439''
1440' Checks if the specified path points to an usable MinGW or not.
1441function CheckForMingWSub(strPathMingW, strPathW32API)
1442 g_strSubOutput = ""
1443 if strPathW32API = "" then strPathW32API = strPathMingW
1444 LogPrint "trying: strPathMingW=" &strPathMingW & " strPathW32API=" & strPathW32API
1445
1446 if LogFileExists(strPathMingW, "bin/mingw32-gcc.exe") _
1447 And LogFileExists(strPathMingW, "bin/ld.exe") _
1448 And LogFileExists(strPathMingW, "bin/objdump.exe") _
1449 And LogFileExists(strPathMingW, "bin/dllwrap.exe") _
1450 And LogFileExists(strPathMingW, "bin/as.exe") _
1451 And LogFileExists(strPathMingW, "include/string.h") _
1452 And LogFileExists(strPathMingW, "include/_mingw.h") _
1453 And LogFileExists(strPathMingW, "lib/dllcrt1.o") _
1454 And LogFileExists(strPathMingW, "lib/dllcrt2.o") _
1455 And LogFileExists(strPathMingW, "lib/libmsvcrt.a") _
1456 _
1457 And LogFileExists(strPathW32API, "lib/libkernel32.a") _
1458 And LogFileExists(strPathW32API, "include/windows.h") _
1459 then
1460 if Shell(DosSlashes(strPathMingW & "/bin/gcc.exe") & " --version", True) = 0 then
1461 dim offVer, iMajor, iMinor, iPatch, strVer
1462
1463 ' extract the version.
1464 strVer = ""
1465 offVer = InStr(1, g_strShellOutput, "(GCC) ")
1466 if offVer > 0 then
1467 strVer = LTrim(Mid(g_strShellOutput, offVer + Len("(GCC) ")))
1468 strVer = RTrim(Left(strVer, InStr(1, strVer, " ")))
1469 if (Mid(strVer, 2, 1) = ".") _
1470 And (Mid(strVer, 4, 1) = ".") then
1471 iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
1472 iMinor = Int(Mid(strVer, 3, 1))
1473 iPatch = Int(Mid(strVer, 5))
1474 else
1475 LogPrint "Malformed version: '" & strVer & "'"
1476 strVer = ""
1477 end if
1478 end if
1479 if strVer <> "" then
1480 if (iMajor = 3) And (iMinor = 3) then
1481 CheckForMingWSub = True
1482 g_strSubOutput = strVer
1483 else
1484 LogPrint "MinGW version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
1485 end if
1486 else
1487 LogPrint "Couldn't locate the GCC version in the output!"
1488 end if
1489
1490 else
1491 LogPrint "Failed to run gcc.exe!"
1492 end if
1493 end if
1494end function
1495
1496
1497''
1498' Checks for any libSDL binaries.
1499sub CheckForlibSDL(strOptlibSDL)
1500 dim strPathlibSDL, str
1501 PrintHdr "libSDL"
1502
1503 '
1504 ' Try find some SDL library.
1505 '
1506
1507 ' First, the specific location.
1508 strPathlibSDL = ""
1509 if (strPathlibSDL = "") And (strOptlibSDL <> "") then
1510 if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
1511 end if
1512
1513 ' The tools location (first).
1514 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1515 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1516 if CheckForlibSDLSub(str) then strPathlibSDL = str
1517 end if
1518
1519 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1520 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1521 if CheckForlibSDLSub(str) then strPathlibSDL = str
1522 end if
1523
1524 ' Poke about in the path.
1525 str = Which("SDLmain.lib")
1526 if (strPathlibSDL = "") And (str <> "") Then
1527 str = PathParent(PathStripFilename(str))
1528 if CheckForlibSDLSub(str) then strPathlibSDL = str
1529 end if
1530
1531 str = Which("SDL.dll")
1532 if (strPathlibSDL = "") And (str <> "") Then
1533 str = PathParent(PathStripFilename(str))
1534 if CheckForlibSDLSub(str) then strPathlibSDL = str
1535 end if
1536
1537 ' The tools location (post).
1538 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1539 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1540 if CheckForlibSDLSub(str) then strPathlibSDL = str
1541 end if
1542
1543 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1544 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1545 if CheckForlibSDLSub(str) then strPathlibSDL = str
1546 end if
1547
1548 ' Success?
1549 if strPathlibSDL = "" then
1550 if strOptlibSDL = "" then
1551 MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
1552 & "If still no luck, consult the configure.log and the build requirements."
1553 else
1554 MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
1555 end if
1556 exit sub
1557 end if
1558
1559 strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
1560 CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
1561
1562 PrintResult "libSDL", strPathlibSDL
1563end sub
1564
1565''
1566' Checks if the specified path points to an usable libSDL or not.
1567function CheckForlibSDLSub(strPathlibSDL)
1568 CheckForlibSDLSub = False
1569 LogPrint "trying: strPathlibSDL=" & strPathlibSDL
1570 if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
1571 And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
1572 And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
1573 And LogFileExists(strPathlibSDL, "include/SDL.h") _
1574 And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
1575 And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
1576 then
1577 CheckForlibSDLSub = True
1578 end if
1579end function
1580
1581
1582dim g_strXercesVer
1583g_strXercesVer = ""
1584
1585''
1586' Checks for xerces.
1587sub CheckForXerces(strOptXerces)
1588 dim strPathXerces, str
1589 PrintHdr "Xerces"
1590
1591 ' Skip if no COM/ATL.
1592 if g_blnDisableCOM then
1593 PrintResult "Xerces", "Skipped (" & g_strDisableCOM & ")"
1594 exit sub
1595 end if
1596
1597 '
1598 ' Try find some xerces dll/lib.
1599 '
1600 strPathXerces = ""
1601 if (strPathXerces = "") And (strOptXerces <> "") then
1602 if CheckForXercesSub(strOptXerces) then strPathXerces = strOptXerces
1603 end if
1604
1605 if strPathXerces = "" Then
1606 str = Which("xerces-c_2_9.lib")
1607 if str = "" then str = Which("xerces-c_2_8.lib")
1608 if str = "" then str = Which("xerces-c_2_7.lib")
1609 if str = "" then str = Which("xerces-c_2_6.lib")
1610 if str <> "" Then
1611 str = PathParent(PathStripFilename(str))
1612 if CheckForXercesSub(str) then strPathXerces = str
1613 end if
1614 end if
1615
1616 if strPathXerces = "" Then
1617 str = Which("xerces-c_2_9.dll")
1618 if str = "" then str = Which("xerces-c_2_8.dll")
1619 if str = "" then str = Which("xerces-c_2_7.dll")
1620 if str = "" then str = Which("xerces-c_2_6.dll")
1621 if str <> "" Then
1622 str = PathParent(PathStripFilename(str))
1623 if CheckForXercesSub(str) then strPathXerces = str
1624 end if
1625 end if
1626
1627 ' Ignore failure if we're in 'internal' mode.
1628 if (strPathXerces = "") and g_blnInternalMode then
1629 PrintResult "Xerces", "ignored (internal mode)"
1630 exit sub
1631 end if
1632
1633 ' Success?
1634 if strPathXerces = "" then
1635 if strOptXerces = "" then
1636 MsgError "Can't locate Xerces. Try specify the path with the --with-xerces=<path> argument. " _
1637 & "If still no luck, consult the configure.log and the build requirements."
1638 else
1639 MsgError "Can't locate Xerces. Please consult the configure.log and the build requirements."
1640 end if
1641 exit sub
1642 end if
1643
1644 strPathXerces = UnixSlashes(PathAbs(strPathXerces))
1645 CfgPrint "SDK_VBOX_XERCES_INCS := " & strPathXerces & "/include"
1646 CfgPrint "SDK_VBOX_XERCES_LIBS := " & strPathXerces & "/lib/xerces-c_" & Left(g_strXercesVer, 1) & ".lib"
1647 CfgPrint "DLL_SDK_VBOX_XERCES_XERCES := " & strPathXerces & "/bin/xerces-c_" & g_strXercesVer & ".dll"
1648
1649 PrintResult "Xerces", strPathXerces
1650end sub
1651
1652''
1653' Checks if the specified path points to an usable libSDL or not.
1654function CheckForXercesSub(strPathXerces)
1655 dim str
1656
1657 CheckForXercersSub = False
1658 LogPrint "trying: strPathXerces=" & strPathXerces
1659 if LogFileExists(strPathXerces, "include/xercesc/dom/DOM.hpp") _
1660 And LogFileExists(strPathXerces, "include/xercesc/validators/datatype/DatatypeValidator.hpp") _
1661 then
1662 ' The version is encoded in the dll/lib name, so try first
1663 ' to find the dll and then a matching lib.
1664 str = LogFindFile(strPathXerces, "bin/xerces-c_*.dll")
1665 if str <> "" then
1666 g_strXercesVer = Mid(str, Len("xerces-c_") + 1, Len(str) - Len("xerces-c_.dll"))
1667 ' the library omits the minor version (in the current distro).
1668 if LogFileExists(strPathXerces, "lib/xerces-c_" & Left(g_strXercesVer, 1) & ".lib") then
1669 CheckForXercesSub = True
1670 end if
1671 end if
1672 end if
1673end function
1674
1675
1676dim g_strXalanVer
1677g_strXalanVer = ""
1678
1679''
1680' Checks for Xalan.
1681sub CheckForXalan(strOptXalan)
1682 dim strPathXalan, str
1683 PrintHdr "Xalan"
1684
1685 ' Skip if no COM/ATL.
1686 if g_blnDisableCOM then
1687 PrintResult "Xalan", "Skipped (" & g_strDisableCOM & ")"
1688 exit sub
1689 end if
1690
1691 '
1692 ' Try find some Xalan dll/lib.
1693 '
1694 strPathXalan = ""
1695 if (strPathXalan = "") And (strOptXalan <> "") then
1696 if CheckForXalanSub(strOptXalan) then strPathXalan = strOptXalan
1697 end if
1698
1699 if strPathXalan = "" Then
1700 str = Which("Xalan-c_1_12.lib")
1701 if str = "" then str = Which("Xalan-c_1_11.lib")
1702 if str = "" then str = Which("Xalan-c_1_10.lib")
1703 if str = "" then str = Which("Xalan-c_1_9.lib")
1704 if str <> "" Then
1705 str = PathParent(PathStripFilename(str))
1706 if CheckForXalanSub(str) then strPathXalan = str
1707 end if
1708 end if
1709
1710 if strPathXalan = "" Then
1711 str = Which("Xalan-c_1_12.dll")
1712 if str = "" then str = Which("Xalan-c_1_11.dll")
1713 if str = "" then str = Which("Xalan-c_1_10.dll")
1714 if str = "" then str = Which("Xalan-c_1_9.dll")
1715 if str <> "" Then
1716 str = PathParent(PathStripFilename(str))
1717 if CheckForXalanSub(str) then strPathXalan = str
1718 end if
1719 end if
1720
1721 ' Ignore failure if we're in 'internal' mode.
1722 if (strPathXalan = "") and g_blnInternalMode then
1723 PrintResult "Xalan", "ignored (internal mode)"
1724 exit sub
1725 end if
1726
1727 ' Success?
1728 if strPathXalan = "" then
1729 if strOptXalan = "" then
1730 MsgError "Can't locate Xalan. Try specify the path with the --with-Xalan=<path> argument. " _
1731 & "If still no luck, consult the configure.log and the build requirements."
1732 else
1733 MsgError "Can't locate Xalan. Please consult the configure.log and the build requirements."
1734 end if
1735 exit sub
1736 end if
1737
1738 strPathXalan = UnixSlashes(PathAbs(strPathXalan))
1739 CfgPrint "SDK_VBOX_XALAN_INCS := " & strPathXalan & "/include"
1740 CfgPrint "SDK_VBOX_XALAN_LIBS := " & strPathXalan & "/lib/Xalan-C_" & Left(g_strXalanVer, 1) & ".lib"
1741 CfgPrint "DLL_SDK_VBOX_XALAN_XALAN := " & strPathXalan & "/bin/Xalan-C_" & g_strXalanVer & ".dll"
1742 CfgPrint "DLL_SDK_VBOX_XALAN_XALAN-MESSAGES := " & strPathXalan & "/bin/XalanMessages_" & g_strXalanVer & ".dll"
1743
1744 PrintResult "Xalan", strPathXalan
1745end sub
1746
1747''
1748' Checks if the specified path points to an usable Xalan or not.
1749function CheckForXalanSub(strPathXalan)
1750 dim str
1751
1752 CheckForXercersSub = False
1753 LogPrint "trying: strPathXalan=" & strPathXalan
1754
1755 if LogFileExists(strPathXalan, "include/xalanc/DOMSupport/DOMSupport.hpp") _
1756 And LogFileExists(strPathXalan, "include/xalanc/XalanDOM/XalanText.hpp") _
1757 then
1758 ' The version is encoded in the dll/lib name, so try first
1759 ' to find the dll and then a matching lib.
1760 str = LogFindFile(strPathXalan, "bin/Xalan-C_*.dll")
1761 if str <> "" then
1762 g_strXalanVer = Mid(str, Len("Xalan-C_") + 1, Len(str) - Len("Xalan-C_.dll"))
1763 ' the library omits the minor version (in the current distro).
1764 if LogFileExists(strPathXalan, "bin/XalanMessages_" & g_strXalanVer & ".dll") _
1765 And LogFileExists(strPathXalan, "lib/Xalan-C_" & Left(g_strXalanVer, 1) & ".lib") _
1766 then
1767 CheckForXalanSub = True
1768 end if
1769 end if
1770 end if
1771end function
1772
1773
1774dim g_strQtVer
1775g_strQtVer = ""
1776
1777''
1778' Checks for any Qt binaries. Failure here isn't fatal.
1779sub CheckForQt(strOptQt)
1780 dim strPathQt, str
1781
1782 PrintHdr "Qt"
1783
1784 '
1785 ' Try find the Qt installation.
1786 '
1787 strPathQt = ""
1788
1789 if (strPathQt = "") And (strOptQt <> "") then
1790 if CheckForQtSub(strOptQt) then strPathQt = strOptQt
1791 end if
1792
1793 if strPathQt = "" then
1794 str = g_strPathDev & "/win.x86/qt/v3.3.3"
1795 if CheckForQtSub(str) then strPathQt = str
1796 end if
1797
1798 '' @todo check for Qt installations and stuff later.
1799
1800 ' Found anything?
1801 if strPathQt = "" then
1802 CfgPrint "VBOX_WITH_QTGUI="
1803 PrintResult "Qt", "not found"
1804 else
1805 CfgPrint "VBOX_PATH_QT := " & strPathQt
1806 CfgPrint "QTDIR = $(VBOX_PATH_QT)"
1807 CfgPrint "LIB_QT = $(VBOX_PATH_QT)/lib/dynamic/qt-mt" & g_strQtVer & ".lib"
1808 CfgPrint "VBOX_DLL_QT = $(VBOX_PATH_QT)/bin/qt-mt" & g_strQtVer & ".dll"
1809 PrintResult "Qt (" & g_strQtVer & ")", strPathQt
1810 end if
1811end sub
1812
1813''
1814' Checks if the specified path points to an usable Qt install or not.
1815function CheckForQtSub(strPathQt)
1816
1817 CheckForQtSub = False
1818 LogPrint "trying: strPathQt=" & strPathQt
1819 if LogFileExists(strPathQt, "bin/moc.exe") _
1820 And LogFileExists(strPathQt, "bin/uic.exe") _
1821 And LogFileExists(strPathQt, "include/qvbox.h") _
1822 And LogFileExists(strPathQt, "include/qt_windows.h") _
1823 And LogFileExists(strPathQt, "include/qapplication.h") _
1824 And LogFileExists(strPathQt, "include/qtextedit.h") _
1825 And LogFileExists(strPathQt, "lib/dynamic/qtmain.lib") _
1826 then
1827 dim str
1828
1829 ' This check might need improving.
1830 str = LogFindFile(strPathQt, "lib/dynamic/qt-mt33*.lib")
1831 if str <> "" then
1832 g_strQtVer = Mid(str, Len("qt-mt") + 1, Len(str) - Len("qt-mt.lib"))
1833 if LogFileExists(strPathQt, "bin/qt-mt" & g_strQtVer & ".dll") then
1834 CheckForQtSub = True
1835 end if
1836 end if
1837 end if
1838end function
1839
1840
1841''
1842' Show usage.
1843sub usage
1844 Print "Usage: cscript configure.vbs [options]"
1845 Print ""
1846 Print "Configuration:"
1847 Print " -h, --help"
1848 Print " --internal"
1849 Print " --internal-last"
1850 Print ""
1851 Print "Components:"
1852 Print " --disable-COM"
1853 Print ""
1854 Print "Locations:"
1855 Print " --with-DDK=PATH "
1856 Print " --with-DXSDK=PATH "
1857 Print " --with-kBuild=PATH "
1858 Print " --with-libSDL=PATH "
1859 Print " --with-MinGW=PATH "
1860 Print " --with-Qt3=PATH "
1861 Print " --with-SDK=PATH "
1862 Print " --with-VC=PATH "
1863 Print " --with-VC-Common=PATH "
1864 Print " --with-VC-Express-Edition"
1865 Print " --with-W32API=PATH "
1866 Print " --with-Xalan=PATH "
1867 Print " --with-Xerces=PATH "
1868end sub
1869
1870
1871''
1872' The main() like function.
1873'
1874Sub Main
1875 '
1876 ' Write the log header and check that we're not using wscript.
1877 '
1878 LogInit
1879 If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
1880 Wscript.Echo "This script must be run under CScript."
1881 Wscript.Quit(1)
1882 End If
1883
1884 '
1885 ' Parse arguments.
1886 '
1887 strOptDDK = ""
1888 strOptDXDDK = ""
1889 strOptkBuild = ""
1890 strOptlibSDL = ""
1891 strOptMingW = ""
1892 strOptQt = ""
1893 strOptSDK = ""
1894 strOptVC = ""
1895 strOptVCCommon = ""
1896 blnOptVCExpressEdition = False
1897 strOptW32API = ""
1898 blnOptXalan = ""
1899 blnOptXerces = ""
1900 blnOptDisableCOM = False
1901 for i = 1 to Wscript.Arguments.Count
1902 dim str, strArg, strPath
1903
1904 ' Separate argument and path value
1905 str = Wscript.Arguments.item(i - 1)
1906 if InStr(1, str, "=") > 0 then
1907 strArg = Mid(str, 1, InStr(1, str, "=") - 1)
1908 strPath = Mid(str, InStr(1, str, "=") + 1)
1909 if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
1910 else
1911 strArg = str
1912 strPath = ""
1913 end if
1914
1915 ' Process the argument
1916 select case LCase(strArg)
1917 case "--with-ddk"
1918 strOptDDK = strPath
1919 case "--with-dxsdk"
1920 strOptDXSDK = strPath
1921 case "--with-kbuild"
1922 strOptkBuild = strPath
1923 case "--with-libsdl"
1924 strOptlibSDL = strPath
1925 case "--with-mingw"
1926 strOptMingW = strPath
1927 case "--with-qt"
1928 strOptQt = strPath
1929 case "--with-sdk"
1930 strOptSDK = strPath
1931 case "--with-vc"
1932 strOptVC = strPath
1933 case "--with-vc-common"
1934 strOptVCCommon = strPath
1935 case "--with-vc-express-edition"
1936 blnOptVCExpressEdition = True
1937 case "--with-w32api"
1938 strOptW32API = strPath
1939 case "--with-xalan"
1940 strOptXalan = strPath
1941 case "--with-xerces"
1942 strOptXerces = strPath
1943 case "--disable-com"
1944 blnOptDisableCOM = True
1945 case "--enable-com"
1946 blnOptDisableCOM = False
1947 case "--internal"
1948 g_blnInternalMode = True
1949 case "--internal-last"
1950 g_blnInternalFirst = False
1951 case "-h", "--help", "-?"
1952 usage
1953 Wscript.Quit(0)
1954 case else
1955 Wscript.echo "syntax error: Unknown option '" & str &"'."
1956 usage
1957 Wscript.Quit(1)
1958 end select
1959 next
1960
1961 '
1962 ' Initialize output files.
1963 '
1964 CfgInit
1965 EnvInit
1966
1967 '
1968 ' Check that the Shell function is sane.
1969 '
1970 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
1971 if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
1972 MsgFatal "shell execution test failed!"
1973 end if
1974 if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
1975 MsgFatal "shell inheritance or shell execution isn't working right."
1976 end if
1977 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
1978 Print "Shell inheritance test: OK"
1979
1980 '
1981 ' Do the checks.
1982 '
1983 if blnOptDisableCOM = True then
1984 DisableCOM "--disable-com"
1985 end if
1986 CheckSourcePath
1987 CheckForkBuild strOptkBuild
1988 CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
1989 CheckForPlatformSDK strOptSDK
1990 CheckForWin2k3DDK strOptDDK
1991 CheckForMidl
1992 CheckForDirectXSDK strOptDXSDK
1993 CheckForMingW strOptMingw, strOptW32API
1994 CheckForlibSDL strOptlibSDL
1995 CheckForXerces strOptXerces
1996 CheckForXalan strOptXalan
1997 CheckForQt strOptQt
1998 if g_blnInternalMode then
1999 EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
2000 end if
2001
2002End Sub
2003
2004
2005Main
2006
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette