3 ' The purpose of this script is to check for all external tools, headers, and
4 ' libraries VBox OSE depends on.
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'.
12 ' Copyright (C) 2006-2012 Oracle Corporation
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.
24 '*****************************************************************************
26 '*****************************************************************************
27 dim g_strPath
, g_strEnvFile
, g_strLogFile
, g_strCfgFile
, g_strShellOutput
28 g_strPath
= Left(Wscript
.ScriptFullName
, Len(Wscript
.ScriptFullName
) - Len("\configure.vbs"))
29 g_strEnvFile
= g_strPath
& "\env.bat"
30 g_strCfgFile
= g_strPath
& "\AutoConfig.kmk"
31 g_strLogFile
= g_strPath
& "\configure.log"
32 'g_strTmpFile = g_strPath & "\configure.tmp"
34 dim g_objShell
, g_objFileSys
35 Set g_objShell
= WScript
.CreateObject("WScript.Shell")
36 Set g_objFileSys
= WScript
.CreateObject("Scripting.FileSystemObject")
38 dim g_strPathkBuild
, g_strPathkBuildBin
, g_strPathDev
, g_strPathVCC
, g_strPathPSDK
, g_strVerPSDK
, g_strPathDDK
, g_strSubOutput
46 g_strTargetArch
= "x86"
48 dim g_blnDisableCOM
, g_strDisableCOM
49 g_blnDisableCOM
= False
52 ' The internal mode is primarily for skipping some large libraries.
54 g_blnInternalMode
= False
56 ' Whether to try the internal stuff first or last.
57 dim g_blnInternalFirst
58 g_blnInternalFirst
= True
63 ' Converts to unix slashes
64 function UnixSlashes(str
)
65 UnixSlashes
= replace(str
, "\", "/")
70 ' Converts to dos slashes
71 function DosSlashes(str
)
72 DosSlashes
= replace(str
, "/", "\")
77 ' Read a file (typically the tmp file) into a string.
78 function FileToString(strFilename
)
79 const ForReading
= 1, TristateFalse
= 0
82 set objFile
= g_objFileSys
.OpenTextFile(DosSlashes(strFilename
), ForReading
, False, TristateFalse
)
83 str
= objFile
.ReadAll()
92 sub FileDelete(strFilename
)
93 if g_objFileSys
.FileExists(DosSlashes(strFilename
)) then
94 g_objFileSys
.DeleteFile(DosSlashes(strFilename
))
100 ' Appends a line to an ascii file.
101 sub FileAppendLine(strFilename
, str
)
102 const ForAppending
= 8, TristateFalse
= 0
105 set objFile
= g_objFileSys
.OpenTextFile(DosSlashes(strFilename
), ForAppending
, True, TristateFalse
)
106 objFile
.WriteLine(str
)
112 ' Checks if the file exists.
113 function FileExists(strFilename
)
114 FileExists
= g_objFileSys
.FileExists(DosSlashes(strFilename
))
119 ' Checks if the directory exists.
120 function DirExists(strDirectory
)
121 DirExists
= g_objFileSys
.FolderExists(DosSlashes(strDirectory
))
126 ' Checks if this is a WOW64 process.
128 if g_objShell
.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
137 ' Returns a reverse sorted array (strings).
138 function ArraySortStrings(arrStrings
)
139 for i
= LBound(arrStrings
) to UBound(arrStrings
)
141 for j
= i
+ 1 to UBound(arrStrings
)
143 if StrComp(str2
, str1
) < 0 then
150 ArraySortStrings
= arrStrings
155 ' Prints a string array.
156 sub ArrayPrintStrings(arrStrings
, strPrefix
)
157 for i
= LBound(arrStrings
) to UBound(arrStrings
)
158 Print strPrefix
& "arrStrings(" & i
& ") = '" & arrStrings(i
) & "'"
164 ' Returns a reverse sorted array (strings).
165 function ArrayRSortStrings(arrStrings
)
167 arrStrings
= ArraySortStrings(arrStrings
)
170 cnt
= UBound(arrStrings
) - LBound(arrStrings
) + 1
172 j
= UBound(arrStrings
)
173 iHalf
= Fix(LBound(arrStrings
) + cnt
/ 2)
174 for i
= LBound(arrStrings
) to iHalf
- 1
175 strTmp
= arrStrings(i
)
176 arrStrings(i
) = arrStrings(j
)
177 arrStrings(j
) = strTmp
181 ArrayRSortStrings
= arrStrings
186 ' Returns the input array with the string appended.
187 ' Note! There must be some better way of doing this...
188 function ArrayAppend(arr
, str
)
190 cnt
= UBound(arr
) - LBound(arr
) + 1
192 for i
= LBound(arr
) to UBound(arr
)
195 arrRet(UBound(arr
) + 1) = str
202 ' Translates a register root name to a value
203 function RegTransRoot(strRoot
)
204 const HKEY_LOCAL_MACHINE
= &H80000002
205 const HKEY_CURRENT_USER
= &H80000001
208 RegTransRoot
= HKEY_LOCAL_MACHINE
210 RegTransRoot
= HKEY_CURRENT_USER
212 MsgFatal
"RegTransRoot: Unknown root: '" & strRoot
& "'"
218 '' The registry globals
219 dim g_objReg
, g_objRegCtx
221 g_blnRegistry
= false
225 ' Init the register provider globals.
229 if g_blnRegistry
= false then
230 set g_objRegCtx
= CreateObject("WbemScripting.SWbemNamedValueSet")
231 ' Comment out the following for lines if the cause trouble on your windows version.
233 g_objRegCtx
.Add
"__ProviderArchitecture", 64
234 g_objRegCtx
.Add
"__RequiredArchitecture", true
236 set objLocator
= CreateObject("Wbemscripting.SWbemLocator")
237 set objServices
= objLocator
.ConnectServer("", "root\default", "", "", , , , g_objRegCtx
)
238 set g_objReg
= objServices
.Get("StdRegProv")
246 ' Gets a value from the registry. Returns "" if string wasn't found / valid.
247 function RegGetString(strName
)
250 dim strRoot
, strKey
, strValue
253 ' split up into root, key and value parts.
254 strRoot
= left(strName
, instr(strName
, "\") - 1)
255 strKey
= mid(strName
, instr(strName
, "\") + 1, instrrev(strName
, "\") - instr(strName
, "\"))
256 strValue
= mid(strName
, instrrev(strName
, "\") + 1)
258 ' Must use ExecMethod to call the GetStringValue method because of the context.
259 Set InParms
= g_objReg
.Methods_("GetStringValue").Inparameters
260 InParms
.hDefKey
= RegTransRoot(strRoot
)
261 InParms
.sSubKeyName
= strKey
262 InParms
.sValueName
= strValue
264 set OutParms
= g_objReg
.ExecMethod_("GetStringValue", InParms
, , g_objRegCtx
)
265 if OutParms
.ReturnValue
= 0 then
266 RegGetString
= OutParms
.sValue
271 RegGetString
= g_objShell
.RegRead(strName
)
277 ' Returns an array of subkey strings.
278 function RegEnumSubKeys(strRoot
, strKeyPath
)
280 iRoot
= RegTransRoot(strRoot
)
281 RegEnumSubKeys
= Array()
284 ' Must use ExecMethod to call the EnumKey method because of the context.
285 Set InParms
= g_objReg
.Methods_("EnumKey").Inparameters
286 InParms
.hDefKey
= RegTransRoot(strRoot
)
287 InParms
.sSubKeyName
= strKeyPath
289 set OutParms
= g_objReg
.ExecMethod_("EnumKey", InParms
, , g_objRegCtx
)
290 if OutParms
.ReturnValue
= 0 then
291 RegEnumSubKeys
= OutParms
.sNames
295 dim objReg
, rc
, arrSubKeys
296 set objReg
= GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
298 rc
= objReg
.EnumKey(iRoot
, strKeyPath
, arrSubKeys
)
300 RegEnumSubKeys
= arrSubKeys
307 ' Returns an array of full path subkey strings.
308 function RegEnumSubKeysFull(strRoot
, strKeyPath
)
310 arrTmp
= RegEnumSubKeys(strRoot
, strKeyPath
)
311 for i
= LBound(arrTmp
) to UBound(arrTmp
)
312 arrTmp(i
) = strKeyPath
& "\" & arrTmp(i
)
314 RegEnumSubKeysFull
= arrTmp
319 ' Returns an rsorted array of subkey strings.
320 function RegEnumSubKeysRSort(strRoot
, strKeyPath
)
321 RegEnumSubKeysRSort
= ArrayRSortStrings(RegEnumSubKeys(strRoot
, strKeyPath
))
326 ' Returns an rsorted array of subkey strings.
327 function RegEnumSubKeysFullRSort(strRoot
, strKeyPath
)
328 RegEnumSubKeysFullRSort
= ArrayRSortStrings(RegEnumSubKeysFull(strRoot
, strKeyPath
))
333 ' Gets the commandline used to invoke the script.
334 function GetCommandline()
337 '' @todo find an api for querying it instead of reconstructing it like this...
338 GetCommandline
= "cscript configure.vbs"
339 for i
= 1 to WScript
.Arguments
.Count
340 str
= WScript
.Arguments
.Item(i
- 1)
343 elseif (InStr(1, str
, " ")) then
344 str
= """" & str
& """"
346 GetCommandline
= GetCommandline
& " " & str
352 ' Gets an environment variable.
353 function EnvGet(strName
)
354 EnvGet
= g_objShell
.Environment("PROCESS")(strName
)
359 ' Sets an environment variable.
360 sub EnvSet(strName
, strValue
)
361 g_objShell
.Environment("PROCESS")(strName
) = strValue
362 LogPrint
"EnvSet: " & strName
& "=" & strValue
367 ' Appends a string to an environment variable
368 sub EnvAppend(strName
, strValue
)
370 str
= g_objShell
.Environment("PROCESS")(strName
)
371 g_objShell
.Environment("PROCESS")(strName
) = str
& strValue
372 LogPrint
"EnvAppend: " & strName
& "=" & str
& strValue
377 ' Prepends a string to an environment variable
378 sub EnvPrepend(strName
, strValue
)
380 str
= g_objShell
.Environment("PROCESS")(strName
)
381 g_objShell
.Environment("PROCESS")(strName
) = strValue
& str
382 LogPrint
"EnvPrepend: " & strName
& "=" & strValue
& str
386 ' Gets the first non-empty environment variable of the given two.
387 function EnvGetFirst(strName1
, strName2
)
388 EnvGetFirst
= g_objShell
.Environment("PROCESS")(strName1
)
389 if EnvGetFirst
= "" then
390 EnvGetFirst
= g_objShell
.Environment("PROCESS")(strName2
)
396 ' Get the path of the parent directory. Returns root if root was specified.
398 function PathParent(str
)
399 PathParent
= g_objFileSys
.GetParentFolderName(DosSlashes(str
))
404 ' Strips the filename from at path.
405 function PathStripFilename(str
)
406 PathStripFilename
= g_objFileSys
.GetParentFolderName(DosSlashes(str
))
411 ' Get the abs path, use the short version if necessary.
412 function PathAbs(str
)
413 strAbs
= g_objFileSys
.GetAbsolutePathName(DosSlashes(str
))
414 strParent
= g_objFileSys
.GetParentFolderName(strAbs
)
415 if strParent
= "" then
418 strParent
= PathAbs(strParent
) ' Recurse to resolve parent paths.
419 PathAbs
= g_objFileSys
.BuildPath(strParent
, g_objFileSys
.GetFileName(strAbs
))
423 if FileExists(PathAbs
) then
424 set obj
= g_objFileSys
.GetFile(PathAbs
)
425 elseif DirExists(PathAbs
) then
426 set obj
= g_objFileSys
.GetFolder(PathAbs
)
429 if not (obj is
nothing) then
430 for each objSub
in obj
.ParentFolder
.SubFolders
431 if obj
.Name
= objSub
.Name
or obj
.ShortName
= objSub
.ShortName
then
432 if InStr(1, objSub
.Name
, " ") > 0 _
433 Or InStr(1, objSub
.Name
, "&") > 0 _
434 Or InStr(1, objSub
.Name
, "$") > 0 _
436 PathAbs = g_objFileSys.BuildPath(strParent, objSub.ShortName)
437 if InStr(1, PathAbs, " ") > 0 _
438 Or InStr(1, PathAbs, "&") > 0 _
439 Or InStr(1, PathAbs, "$") > 0 _
441 MsgFatal
"PathAbs(" & str
& ") attempted to return filename with problematic " _
442 & "characters in it (" & PathAbs
& "). The tool/sdk referenced will probably " _
443 & "need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
444 & "or '&' in the path name. (Unless it's a problem with this script of course...)"
447 PathAbs
= g_objFileSys
.BuildPath(strParent
, objSub
.Name
)
458 ' Get the abs path, use the long version.
459 function PathAbsLong(str
)
460 strAbs
= g_objFileSys
.GetAbsolutePathName(DosSlashes(str
))
461 strParent
= g_objFileSys
.GetParentFolderName(strAbs
)
462 if strParent
= "" then
465 strParent
= PathAbsLong(strParent
) ' Recurse to resolve parent paths.
466 PathAbsLong
= g_objFileSys
.BuildPath(strParent
, g_objFileSys
.GetFileName(strAbs
))
470 if FileExists(PathAbsLong
) then
471 set obj
= g_objFileSys
.GetFile(PathAbsLong
)
472 elseif DirExists(PathAbsLong
) then
473 set obj
= g_objFileSys
.GetFolder(PathAbsLong
)
476 if not (obj is
nothing) then
477 for each objSub
in obj
.ParentFolder
.SubFolders
478 if obj
.Name
= objSub
.Name
or obj
.ShortName
= objSub
.ShortName
then
479 PathAbsLong
= g_objFileSys
.BuildPath(strParent
, objSub
.Name
)
489 ' Executes a command in the shell catching output in g_strShellOutput
490 function Shell(strCommand
, blnBoth
)
491 dim strShell
, strCmdline
, objExec
, str
493 strShell
= g_objShell
.ExpandEnvironmentStrings("%ComSpec%")
494 if blnBoth
= true then
495 strCmdline
= strShell
& " /c " & strCommand
& " 2>&1"
497 strCmdline
= strShell
& " /c " & strCommand
& " 2>nul"
500 LogPrint
"# Shell: " & strCmdline
501 Set objExec
= g_objShell
.Exec(strCmdLine
)
502 g_strShellOutput
= objExec
.StdOut
.ReadAll()
503 objExec
.StdErr
.ReadAll()
504 do while objExec
.Status
= 0
506 g_strShellOutput
= g_strShellOutput
& objExec
.StdOut
.ReadAll()
507 objExec
.StdErr
.ReadAll()
510 LogPrint
"# Status: " & objExec
.ExitCode
511 LogPrint
"# Start of Output"
512 LogPrint g_strShellOutput
513 LogPrint
"# End of Output"
515 Shell
= objExec
.ExitCode
520 ' Try find the specified file in the path.
521 function Which(strFile
)
522 dim strPath
, iStart
, iEnd
, str
525 strPath
= EnvGet("Path")
527 do while iStart
<= Len(strPath
)
528 iEnd
= InStr(iStart
, strPath
, ";")
529 if iEnd
<= 0 then iEnd
= Len(strPath
) + 1
530 if iEnd
> iStart
then
531 str
= Mid(strPath
, iStart
, iEnd
- iStart
) & "/" & strFile
532 if FileExists(str
) then
540 ' registry or somewhere?
547 ' Append text to the log file and echo it to stdout
555 ' Prints a test header
556 sub PrintHdr(strTest
)
557 LogPrint
"***** Checking for " & strTest
& " *****"
558 Wscript
.Echo
"Checking for " & StrTest
& "..."
563 ' Prints a success message
564 sub PrintResultMsg(strTest
, strResult
)
565 LogPrint
"** " & strTest
& ": " & strResult
566 Wscript
.Echo
" Found "& strTest
& ": " & strResult
571 ' Prints a successfully detected path
572 sub PrintResult(strTest
, strPath
)
573 strLongPath
= PathAbsLong(strPath
)
574 if PathAbs(strPath
) <> strLongPath
then
575 LogPrint
"** " & strTest
& ": " & strPath
& " (" & UnixSlashes(strLongPath
) & ")"
576 Wscript
.Echo
" Found " & strTest
& ": " & strPath
& " (" & UnixSlashes(strLongPath
) & ")"
578 LogPrint
"** " & strTest
& ": " & strPath
579 Wscript
.Echo
" Found " & strTest
& ": " & strPath
586 sub MsgWarning(strMsg
)
587 Print
"warning: " & strMsg
594 Print
"fatal error: " & strMsg
600 ' Error message, fatal unless flag to ignore errors is given.
602 Print
"error: " & strMsg
603 if g_blnInternalMode
= False then
610 ' Write a log header with some basic info.
612 FileDelete g_strLogFile
613 LogPrint
"# Log file generated by " & Wscript
.ScriptFullName
614 for i
= 1 to WScript
.Arguments
.Count
615 LogPrint
"# Arg #" & i
& ": " & WScript
.Arguments
.Item(i
- 1)
617 if Wscript
.Arguments
.Count
= 0 then
618 LogPrint
"# No arguments given"
620 LogPrint
"# Reconstructed command line: " & GetCommandline()
623 LogPrint
"# Wscript properties:"
624 LogPrint
"# ScriptName: " & Wscript
.ScriptName
625 LogPrint
"# Version: " & Wscript
.Version
626 LogPrint
"# Build: " & Wscript
.BuildVersion
627 LogPrint
"# Name: " & Wscript
.Name
628 LogPrint
"# Full Name: " & Wscript
.FullName
629 LogPrint
"# Path: " & Wscript
.Path
634 LogPrint
"# Environment:"
636 for each strVar
in g_objShell
.Environment("PROCESS")
637 LogPrint
"# " & strVar
644 ' Append text to the log file.
646 FileAppendLine g_strLogFile
, str
647 'Wscript.Echo "dbg: " & str
652 ' Checks if the file exists and logs failures.
653 function LogFileExists(strPath
, strFilename
)
654 LogFileExists
= FileExists(strPath
& "/" & strFilename
)
655 if LogFileExists
= False then
656 LogPrint
"Testing '" & strPath
& "': " & strFilename
& " not found"
663 ' Finds the first file matching the pattern.
664 ' If no file is found, log the failure.
665 function LogFindFile(strPath
, strPattern
)
669 ' Yes, there are some facy database kinda interface to the filesystem
670 ' however, breaking down the path and constructing a usable query is
671 ' too much hassle. So, we'll do it the unix way...
673 if Shell("dir /B """ & DosSlashes(strPath
) & "\" & DosSlashes(strPattern
) & """", True) = 0 _
674 And InStr(1, g_strShellOutput
, Chr(13)) > 1 _
676 ' return the first word.
677 LogFindFile
= Left(g_strShellOutput
, InStr(1, g_strShellOutput
, Chr(13)) - 1)
679 LogPrint
"Testing '" & strPath
& "': " & strPattern
& " not found"
686 ' Finds the first directory matching the pattern.
687 ' If no directory is found, log the failure,
688 ' else return the complete path to the found directory.
689 function LogFindDir(strPath
, strPattern
)
693 ' Yes, there are some facy database kinda interface to the filesystem
694 ' however, breaking down the path and constructing a usable query is
695 ' too much hassle. So, we'll do it the unix way...
698 ' List the alphabetically last names as first entries (with /O-N).
699 if Shell("dir /B /AD /O-N """ & DosSlashes(strPath
) & "\" & DosSlashes(strPattern
) & """", True) = 0 _
700 And InStr(1, g_strShellOutput
, Chr(13)) > 1 _
702 ' return the first word.
703 LogFindDir
= strPath
& "/" & Left(g_strShellOutput
, InStr(1, g_strShellOutput
, Chr(13)) - 1)
705 LogPrint
"Testing '" & strPath
& "': " & strPattern
& " not found"
712 ' Initializes the config file.
714 FileDelete g_strCfgFile
715 CfgPrint
"# -*- Makefile -*-"
717 CfgPrint
"# Build configuration generated by " & GetCommandline()
719 if g_blnInternalMode
= False then
720 CfgPrint
"VBOX_OSE := 1"
726 ' Prints a string to the config file.
728 FileAppendLine g_strCfgFile
, str
733 ' Initializes the environment batch script.
735 FileDelete g_strEnvFile
738 EnvPrint
"rem Environment setup script generated by " & GetCommandline()
744 ' Prints a string to the environment batch script.
746 FileAppendLine g_strEnvFile
, str
752 sub DisableCOM(strReason
)
753 if g_blnDisableCOM
= False then
754 LogPrint
"Disabled COM components: " & strReason
755 g_blnDisableCOM
= True
756 g_strDisableCOM
= strReason
757 CfgPrint
"VBOX_WITH_MAIN="
758 CfgPrint
"VBOX_WITH_QTGUI="
759 CfgPrint
"VBOX_WITH_VBOXSDL="
760 CfgPrint
"VBOX_WITH_DEBUGGER_GUI="
761 CfgPrint
"VBOX_WITHOUT_COM=1"
768 sub DisableUDPTunnel(strReason
)
769 if g_blnDisableUDPTunnel
= False then
770 LogPrint
"Disabled UDPTunnel network transport: " & strReason
771 g_blnDisableUDPTunnel
= True
772 g_strDisableUDPTunnel
= strReason
773 CfgPrint
"VBOX_WITH_UDPTUNNEL="
779 ' Checks the the path doesn't contain characters the tools cannot deal with.
783 sPwd
= PathAbs(g_strPath
)
784 if InStr(1, sPwd
, " ") > 0 then
785 MsgError
"Source path contains spaces! Please move it. (" & sPwd
& ")"
787 if InStr(1, sPwd
, "$") > 0 then
788 MsgError "Source path contains the
'$' char! Please move it. (" & sPwd & ")"
790 if InStr(1, sPwd
, "%") > 0 then
791 MsgError
"Source path contains the '%' char! Please move it. (" & sPwd
& ")"
793 if InStr(1, sPwd
, Chr(10)) > 0 _
794 Or InStr(1, sPwd
, Chr(13)) > 0 _
795 Or InStr(1, sPwd
, Chr(9)) > 0 _
797 MsgError
"Source path contains control characters! Please move it. (" & sPwd
& ")"
799 Print
"Source path: OK"
804 ' Checks for kBuild - very simple :)
805 sub CheckForkBuild(strOptkBuild
)
809 ' Check if there is a 'kmk' in the path somewhere without
810 ' any KBUILD_*PATH stuff around.
812 blnNeedEnvVars
= True
813 g_strPathkBuild
= strOptkBuild
814 g_strPathkBuildBin
= ""
815 if (g_strPathkBuild
= "") _
816 And (EnvGetFirst("KBUILD_PATH", "PATH_KBUILD") = "") _
817 And (EnvGetFirst("KBUILD_BIN_PATH", "PATH_KBUILD_BIN") = "") _
818 And (Shell("kmk.exe --version", True) = 0) _
819 And (InStr(1,g_strShellOutput
, "kBuild Make 0.1") > 0) _
820 And (InStr(1,g_strShellOutput
, "KBUILD_PATH") > 0) _
821 And (InStr(1,g_strShellOutput
, "KBUILD_BIN_PATH") > 0) then
822 '' @todo Need to parse out the KBUILD_PATH and KBUILD_BIN_PATH values to complete the other tests.
823 'blnNeedEnvVars = False
824 MsgWarning
"You've installed kBuild it seems. configure.vbs hasn't been updated to " _
825 & "deal with that yet and will use the one it ships with. Sorry."
829 ' Check for the KBUILD_PATH env.var. and fall back on root/kBuild otherwise.
831 if g_strPathkBuild
= "" then
832 g_strPathkBuild
= EnvGetFirst("KBUILD_PATH", "PATH_KBUILD")
833 if (g_strPathkBuild
<> "") and (FileExists(g_strPathkBuild
& "/footer.kmk") = False) then
834 MsgWarning
"Ignoring incorrect kBuild path (KBUILD_PATH=" & g_strPathkBuild
& ")"
838 if g_strPathkBuild
= "" then
839 g_strPathkBuild
= g_strPath
& "/kBuild"
843 g_strPathkBuild
= UnixSlashes(PathAbs(g_strPathkBuild
))
846 ' Check for env.vars that kBuild uses (do this early to set g_strTargetArch).
848 str
= EnvGetFirst("KBUILD_TYPE", "BUILD_TYPE")
850 And (InStr(1, "|release|debug|profile|kprofile", str
) <= 0) then
851 EnvPrint
"set KBUILD_TYPE=release"
852 EnvSet
"KBUILD_TYPE", "release"
853 MsgWarning
"Found unknown KBUILD_TYPE value '" & str
&"' in your environment. Setting it to 'release'."
856 str
= EnvGetFirst("KBUILD_TARGET", "BUILD_TARGET")
858 And (InStr(1, "win|win32|win64", str
) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
859 EnvPrint
"set KBUILD_TARGET=win"
860 EnvSet
"KBUILD_TARGET", "win"
861 MsgWarning
"Found unknown KBUILD_TARGET value '" & str
&"' in your environment. Setting it to 'win32'."
864 str
= EnvGetFirst("KBUILD_TARGET_ARCH", "BUILD_TARGET_ARCH")
866 And (InStr(1, "x86|amd64", str
) <= 0) then
867 EnvPrint
"set KBUILD_TARGET_ARCH=x86"
868 EnvSet
"KBUILD_TARGET_ARCH", "x86"
869 MsgWarning
"Found unknown KBUILD_TARGET_ARCH value '" & str
&"' in your environment. Setting it to 'x86'."
873 g_strTargetArch
= str
874 elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
875 Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
876 g_strTargetArch
= "amd64"
878 g_strTargetArch
= "x86"
881 str
= EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
882 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
884 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str
) <= 0) then
885 EnvPrint
"set BUILD_TARGET_CPU=i386"
886 EnvSet
"KBUILD_TARGET_CPU", "i386"
887 MsgWarning
"Found unknown KBUILD_TARGET_CPU value '" & str
&"' in your environment. Setting it to 'i386'."
890 str
= EnvGetFirst("KBUILD_HOST", "BUILD_PLATFORM")
892 And (InStr(1, "win|win32|win64", str
) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
893 EnvPrint
"set KBUILD_HOST=win"
894 EnvSet
"KBUILD_HOST", "win"
895 MsgWarning
"Found unknown KBUILD_HOST value '" & str
&"' in your environment. Setting it to 'win32'."
898 str
= EnvGetFirst("KBUILD_HOST_ARCH", "BUILD_PLATFORM_ARCH")
900 And (InStr(1, "x86|amd64", str
) <= 0) then
901 EnvPrint
"set KBUILD_HOST_ARCH=x86"
902 EnvSet
"KBUILD_HOST_ARCH", "x86"
903 MsgWarning
"Found unknown KBUILD_HOST_ARCH value '" & str
&"' in your environment. Setting it to 'x86'."
906 str
= EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
907 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
909 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str
) <= 0) then
910 EnvPrint
"set KBUILD_HOST_CPU=i386"
911 EnvSet
"KBUILD_HOST_CPU", "i386"
912 MsgWarning
"Found unknown KBUILD_HOST_CPU value '" & str
&"' in your environment. Setting it to 'i386'."
916 ' Determin the location of the kBuild binaries.
918 if g_strPathkBuildBin
= "" then
919 g_strPathkBuildBin
= g_strPathkBuild
& "/bin/win." & g_strTargetArch
920 if FileExists(g_strPathkBuild
& "/kmk.exe") = False then
921 g_strPathkBuildBin
= g_strPathkBuild
& "/bin/win.x86"
926 ' Perform basic validations of the kBuild installation.
928 if (FileExists(g_strPathkBuild
& "/footer.kmk") = False) _
929 Or (FileExists(g_strPathkBuild
& "/header.kmk") = False) _
930 Or (FileExists(g_strPathkBuild
& "/rules.kmk") = False) then
931 MsgFatal
"Can't find valid kBuild at '" & g_strPathkBuild
& "'. Either there is an " _
932 & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
935 if (FileExists(g_strPathkBuildBin
& "/kmk.exe") = False) _
936 Or (FileExists(g_strPathkBuildBin
& "/kmk_ash.exe") = False) then
937 MsgFatal
"Can't find valid kBuild binaries at '" & g_strPathkBuildBin
& "'. Either there is an " _
938 & "incorrect KBUILD_PATH in the environment or the checkout didn't succeed."
942 if (Shell(DosSlashes(g_strPathkBuildBin
& "/kmk.exe") & " --version", True) <> 0) Then
943 MsgFatal
"Can't execute '" & g_strPathkBuildBin
& "/kmk.exe --version'. check configure.log for the out."
948 ' If PATH_DEV is set, check that it's pointing to something useful.
950 str
= EnvGet("PATH_DEV")
953 And False then '' @todo add some proper tests here.
954 strNew
= UnixSlashes(g_strPath
& "/tools")
955 EnvPrint
"set PATH_DEV=" & strNew
956 EnvSet
"PATH_DEV", strNew
957 MsgWarning
"Found PATH_DEV='" & str
&"' in your environment. Setting it to '" & strNew
& "'."
958 g_strPathDev
= strNew
960 if g_strPathDev
= "" then g_strPathDev
= UnixSlashes(g_strPath
& "/tools")
963 ' Write KBUILD_PATH to the environment script if necessary.
965 if blnNeedEnvVars
= True then
966 EnvPrint
"set KBUILD_PATH=" & g_strPathkBuild
967 EnvSet
"KBUILD_PATH", g_strPathkBuild
968 EnvPrint
"set PATH=" & g_strPathkBuildBin
& ";%PATH%"
969 EnvPrepend
"PATH", g_strPathkBuildBin
& ";"
972 PrintResult
"kBuild", g_strPathkBuild
973 PrintResult
"kBuild binaries", g_strPathkBuildBin
978 ' Checks for Visual C++ version 10 (2010).
979 sub CheckForVisualCPP(strOptVC
, strOptVCCommon
, blnOptVCExpressEdition
)
980 dim strPathVC
, strPathVCCommon
, str
, str2
, blnNeedMsPDB
981 PrintHdr
"Visual C++"
988 if (strPathVC
= "") And (strOptVC
<> "") then
989 if CheckForVisualCPPSub(strOptVC
, strOptVCCommon
, blnOptVCExpressEdition
) then
991 strPathVCCommon
= strOptVCCommon
995 if (strPathVC
= "") And (g_blnInternalFirst
= True) Then
996 strPathVC
= g_strPathDev
& "/win.x86/vcc/v10sp1"
997 if CheckForVisualCPPSub(strPathVC
, "", blnOptVCExpressEdition
) = False then
1002 if (strPathVC
= "") _
1003 And (Shell("cl.exe", True) = 0) then
1004 str
= Which("cl.exe")
1005 if FileExists(PathStripFilename(strClExe
) & "/build.exe") then
1006 ' don't know how to deal with this cl.
1007 Warning
"Ignoring DDK cl.exe (" & str
& ")."
1009 strPathVC
= PathParent(PathStripFilename(str
))
1010 strPathVCCommon
= PathParent(strPathVC
) & "/Common7"
1014 if (strPathVC
= "") then
1015 str
= RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1017 str2
= str
& "Common7"
1019 if CheckForVisualCPPSub(str
, str2
, blnOptVCExpressEdition
) then
1021 strPathVCCommon
= str2
1026 if (strPathVC
= "") then
1027 str
= RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1029 str2
= str
& "Common7"
1031 if CheckForVisualCPPSub(str
, str2
, blnOptVCExpressEdition
) then
1033 strPathVCCommon
= str2
1038 if (strPathVC
= "") And (g_blnInternalFirst
= False) Then
1039 strPathVC
= g_strPathDev
& "/win.x86/vcc/v10sp1"
1040 if CheckForVisualCPPSub(strPathVC
, "", blnOptVCExpressEdition
) = False then
1045 if strPathVC
= "" then
1046 MsgError
"Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
1051 ' Clean up the path and determin the VC directory.
1053 strPathVC
= UnixSlashes(PathAbs(strPathVC
))
1054 g_strPathVCC
= strPathVC
1057 ' Check the version.
1058 ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
1060 if (strPathVCCommon
<> "") Then
1061 EnvAppend
"PATH", ";" & strPathVCCommon
& "/IDE"
1063 if Shell(DosSlashes(strPathVC
& "/bin/cl.exe"), True) <> 0 then
1064 MsgError
"Executing '" & strClExe
& "' (which we believe to be the Visual C++ compiler driver) failed."
1068 if (InStr(1, g_strShellOutput
, "Version 16.") <= 0) _
1069 And (InStr(1, g_strShellOutput
, "Version 17.") <= 0) then
1070 MsgError
"The Visual C++ compiler we found ('" & strPathVC
& "') isn't 10.0 or 11.0. Check the build requirements."
1075 ' Ok, emit build config variables.
1077 if InStr(1, g_strShellOutput
, "Version 16.") > 0 then
1078 CfgPrint
"PATH_TOOL_VCC100 := " & g_strPathVCC
1079 CfgPrint
"PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100)"
1080 CfgPrint "PATH_TOOL_VCC100AMD64
:= $(PATH_TOOL_VCC100)"
1081 if LogFileExists(strPathVC
, "atlmfc/include/atlbase.h") then
1082 PrintResult
"Visual C++ v10 with ATL", g_strPathVCC
1083 elseif LogFileExists(g_strPathDDK
, "inc/atl71/atlbase.h") _
1084 And LogFileExists(g_strPathDDK
, "lib/ATL/i386/atls.lib") then
1085 CfgPrint
"VBOX_WITHOUT_COMPILER_REDIST=1"
1086 CfgPrint
"PATH_TOOL_VCC100_ATLMFC_INC = " & g_strPathDDK
& "/inc/atl71"
1087 CfgPrint
"PATH_TOOL_VCC100_ATLMFC_LIB.amd64 = " & g_strPathDDK
& "/lib/ATL/amd64"
1088 CfgPrint
"PATH_TOOL_VCC100_ATLMFC_LIB.x86 = " & g_strPathDDK
& "/lib/ATL/i386"
1089 CfgPrint
"PATH_TOOL_VCC100AMD64_ATLMFC_INC = " & g_strPathDDK
& "/inc/atl71"
1090 CfgPrint
"PATH_TOOL_VCC100AMD64_ATLMFC_LIB = " & g_strPathDDK
& "/lib/ATL/amd64"
1091 CfgPrint
"PATH_TOOL_VCC100X86_ATLMFC_INC = " & g_strPathDDK
& "/inc/atl71"
1092 CfgPrint
"PATH_TOOL_VCC100X86_ATLMFC_LIB = " & g_strPathDDK
& "/lib/ATL/i386"
1093 PrintResult
"Visual C++ v10 with DDK ATL", g_strPathVCC
1095 CfgPrint
"VBOX_WITHOUT_COMPILER_REDIST=1"
1097 PrintResult
"Visual C++ v10 (or later) without ATL", g_strPathVCC
1100 elseif InStr(1, g_strShellOutput
, "Version 17.") > 0 then
1101 CfgPrint
"PATH_TOOL_VCC110 := " & g_strPathVCC
1102 CfgPrint
"PATH_TOOL_VCC110X86 := $(PATH_TOOL_VCC110)"
1103 CfgPrint "PATH_TOOL_VCC110AMD64
:= $(PATH_TOOL_VCC110)"
1104 PrintResult
"Visual C++ v11", g_strPathVCC
1105 MsgWarning
"The support for Visual C++ v11 (aka 2012) is experimental"
1108 MsgError
"The Visual C++ compiler we found ('" & strPathVC
& "') isn't 10.0 or 11.0. Check the build requirements."
1112 ' and the env.bat path fix.
1113 if strPathVCCommon
<> "" then
1114 EnvPrint
"set PATH=%PATH%;" & strPathVCCommon
& "/IDE;"
1119 ' Checks if the specified path points to a usable PSDK.
1120 function CheckForVisualCPPSub(strPathVC
, strPathVCCommon
, blnOptVCExpressEdition
)
1121 strPathVC
= UnixSlashes(PathAbs(strPathVC
))
1122 CheckForVisualCPPSub
= False
1123 LogPrint
"trying: strPathVC=" & strPathVC
& " strPathVCCommon=" & strPathVCCommon
& " blnOptVCExpressEdition=" & blnOptVCExpressEdition
1124 if LogFileExists(strPathVC
, "bin/cl.exe") _
1125 And LogFileExists(strPathVC
, "bin/link.exe") _
1126 And LogFileExists(strPathVC
, "include/string.h") _
1127 And LogFileExists(strPathVC
, "lib/libcmt.lib") _
1128 And LogFileExists(strPathVC
, "lib/msvcrt.lib") _
1130 if blnOptVCExpressEdition _
1131 Or ( LogFileExists(strPathVC
, "atlmfc/include/atlbase.h") _
1132 And LogFileExists(strPathVC
, "atlmfc/lib/atls.lib")) _
1133 Or ( LogFileExists(g_strPathDDK
, "inc/atl71/atlbase.h") _
1134 And LogFileExists(g_strPathDDK
, "lib/ATL/i386/atls.lib")) _
1136 '' @todo figure out a way we can verify the version/build!
1137 CheckForVisualCPPSub
= True
1144 ' Checks for a platform SDK that works with the compiler
1145 sub CheckForPlatformSDK(strOptSDK
)
1146 dim strPathPSDK
, str
1147 PrintHdr
"Windows Platform SDK (recent)"
1151 ' Check the supplied argument first.
1154 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1157 ' The tools location (first).
1158 if strPathPSDK
= "" And g_blnInternalFirst
then
1159 str
= g_strPathDev
& "/win.x86/sdk/v7.1"
1160 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1163 if strPathPSDK
= "" And g_blnInternalFirst
then
1164 str
= g_strPathDev
& "/win.x86/sdk/v8.0"
1165 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1168 ' Look for it in the environment
1169 str
= EnvGet("MSSdk")
1170 if strPathPSDK
= "" And str
<> "" then
1171 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1174 str
= EnvGet("Mstools")
1175 if strPathPSDK
= "" And str
<> "" then
1176 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1179 ' Check if there is one installed with the compiler.
1180 if strPathPSDK
= "" And str
<> "" then
1181 str
= g_strPathVCC
& "/PlatformSDK"
1182 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1185 ' Check the registry next (ASSUMES sorting).
1186 arrSubKeys
= RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1187 for each strSubKey
in arrSubKeys
1188 str
= RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey
& "\InstallationFolder")
1189 if strPathPSDK
= "" And str
<> "" then
1190 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1193 arrSubKeys
= RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1194 for each strSubKey
in arrSubKeys
1195 str
= RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey
& "\InstallationFolder")
1196 if strPathPSDK
= "" And str
<> "" then
1197 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1201 ' The tools location (post).
1202 if (strPathPSDK
= "") And (g_blnInternalFirst
= False) then
1203 str
= g_strPathDev
& "/win.x86/sdk/v7.1"
1204 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1207 if (strPathPSDK
= "") And (g_blnInternalFirst
= False) then
1208 str
= g_strPathDev
& "/win.x86/sdk/v8.0"
1209 if CheckForPlatformSDKSub(str
) then strPathPSDK
= str
1213 if strPathPSDK
= "" then
1214 MsgError
"Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
1221 strPathPSDK
= UnixSlashes(PathAbs(strPathPSDK
))
1222 CfgPrint
"PATH_SDK_WINPSDK" & g_strVerPSDK
& " := " & strPathPSDK
1223 CfgPrint
"VBOX_WINPSDK := WINPSDK" & g_strVerPSDK
1225 PrintResult
"Windows Platform SDK (v" & g_strVerPSDK
& ")", strPathPSDK
1226 g_strPathPSDK
= strPathPSDK
1230 ' Checks if the specified path points to a usable PSDK.
1231 function CheckForPlatformSDKSub(strPathPSDK
)
1232 CheckForPlatformSDKSub
= False
1233 LogPrint
"trying: strPathPSDK=" & strPathPSDK
1234 if LogFileExists(strPathPSDK
, "include/Windows.h") _
1235 And LogFileExists(strPathPSDK
, "lib/Kernel32.Lib") _
1236 And LogFileExists(strPathPSDK
, "lib/User32.Lib") _
1237 And LogFileExists(strPathPSDK
, "bin/rc.exe") _
1238 And Shell("""" & DosSlashes(strPathPSDK
& "/bin/rc.exe") & """" , True) <> 0 _
1240 if InStr(1, g_strShellOutput
, "Resource Compiler Version 6.2.") > 0 then
1242 CheckForPlatformSDKSub
= True
1243 elseif InStr(1, g_strShellOutput
, "Resource Compiler Version 6.1.") > 0 then
1245 CheckForPlatformSDKSub
= True
1252 ' Checks for a Windows 7 Driver Kit.
1253 sub CheckForWinDDK(strOptDDK
)
1254 dim strPathDDK
, str
, strSubKeys
1255 PrintHdr
"Windows DDK v7.1"
1261 ' The specified path.
1262 if strPathDDK
= "" And strOptDDK
<> "" then
1263 if CheckForWinDDKSub(strOptDDK
, True) then strPathDDK
= strOptDDK
1266 ' The tools location (first).
1267 if strPathDDK
= "" And g_blnInternalFirst
then
1268 str
= g_strPathDev
& "/win.x86/ddk/7600.16385.1"
1269 if CheckForWinDDKSub(str
, False) then strPathDDK
= str
1272 ' Check the environment
1273 str
= EnvGet("DDK_INC_PATH")
1274 if strPathDDK
= "" And str
<> "" then
1275 str
= PathParent(PathParent(str
))
1276 if CheckForWinDDKSub(str
, True) then strPathDDK
= str
1279 str
= EnvGet("BASEDIR")
1280 if strPathDDK
= "" And str
<> "" then
1281 if CheckForWinDDKSub(str
, True) then strPathDDK
= str
1284 ' Some array constants to ease the work.
1285 arrSoftwareKeys
= array("SOFTWARE", "SOFTWARE\Wow6432Node")
1286 arrRoots
= array("HKLM", "HKCU")
1289 arrLocations
= array()
1290 for each strSoftwareKey
in arrSoftwareKeys
1291 for each strSubKey
in RegEnumSubKeysFull("HKLM", strSoftwareKey
& "\Microsoft\KitSetup\configured-kits")
1292 for each strSubKey2
in RegEnumSubKeysFull("HKLM", strSubKey
)
1293 str
= RegGetString("HKLM\" & strSubKey2
& "\setup-install-location")
1295 arrLocations
= ArrayAppend(arrLocations
, PathAbsLong(str
))
1300 arrLocations
= ArrayRSortStrings(arrLocations
)
1302 ' Check the locations we've gathered.
1303 for each str
in arrLocations
1304 if strPathDDK
= "" then
1305 if CheckForWinDDKSub(str
, True) then strPathDDK
= str
1309 ' The tools location (post).
1310 if (strPathDDK
= "") And (g_blnInternalFirst
= False) then
1311 str
= g_strPathDev
& "/win.x86/ddk/7600.16385.1"
1312 if CheckForWinDDKSub(str
, False) then strPathDDK
= str
1316 if strPathDDK
= "" then
1317 MsgError
"Cannot find the Windows DDK v7.1. Check configure.log and the build requirements."
1324 strPathDDK
= UnixSlashes(PathAbs(strPathDDK
))
1325 CfgPrint
"PATH_SDK_WINDDK71 := " & strPathDDK
1327 PrintResult
"Windows DDK v7.1", strPathDDK
1328 g_strPathDDK
= strPathDDK
1331 '' Quick check if the DDK is in the specified directory or not.
1332 function CheckForWinDDKSub(strPathDDK
, blnCheckBuild
)
1333 CheckForWinDDKSub
= False
1334 LogPrint
"trying: strPathDDK=" & strPathDDK
& " blnCheckBuild=" & blnCheckBuild
1335 if LogFileExists(strPathDDK
, "inc/api/ntdef.h") _
1336 And LogFileExists(strPathDDK
, "lib/win7/i386/int64.lib") _
1337 And LogFileExists(strPathDDK
, "lib/wlh/i386/int64.lib") _
1338 And LogFileExists(strPathDDK
, "lib/wnet/i386/int64.lib") _
1339 And LogFileExists(strPathDDK
, "lib/wxp/i386/int64.lib") _
1340 And Not LogFileExists(strPathDDK
, "lib/win8/i386/int64.lib") _
1341 And LogFileExists(strPathDDK
, "bin/x86/rc.exe") _
1343 if Not blnCheckBuild
then
1344 CheckForWinDDKSub
= True
1345 '' @todo Find better build check.
1346 elseif Shell("""" & DosSlashes(strPathDDK
& "/bin/x86/rc.exe") & """" , True) <> 0 _
1347 And InStr(1, g_strShellOutput
, "Resource Compiler Version 6.1.") > 0 then
1348 CheckForWinDDKSub
= True
1360 ' Skip if no COM/ATL.
1361 if g_blnDisableCOM
then
1362 PrintResultMsg
"Midl", "Skipped (" & g_strDisableCOM
& ")"
1366 if LogFileExists(g_strPathPSDK
, "bin/Midl.exe") then
1367 strMidl
= g_strPathPSDK
& "/bin/Midl.exe"
1368 elseif LogFileExists(g_strPathVCC
, "Common7/Tools/Bin/Midl.exe") then
1369 strMidl
= g_strPathVCC
& "/Common7/Tools/Bin/Midl.exe"
1370 elseif LogFileExists(g_strPathDDK
, "bin/x86/Midl.exe") then
1371 strMidl
= g_strPathDDK
& "/bin/x86/Midl.exe"
1372 elseif LogFileExists(g_strPathDDK
, "bin/Midl.exe") then
1373 strMidl
= g_strPathDDK
& "/bin/Midl.exe"
1374 elseif LogFileExists(g_strPathDev
, "win.x86/bin/Midl.exe") then
1375 strMidl
= g_strPathDev
& "/win.x86/bin/Midl.exe"
1377 MsgWarning
"Midl.exe not found!"
1381 CfgPrint
"VBOX_MAIN_IDL := " & strMidl
1382 PrintResult
"Midl.exe", strMidl
1387 ' Checks for a MinGW32 suitable for building the recompiler.
1389 ' strOptW32API is currently ignored.
1391 sub CheckForMinGW32(strOptMinGW32
, strOptW32API
)
1392 dim strPathMingW32
, strPathW32API
, str
1393 PrintHdr
"MinGW32 GCC v3.3.x + Binutils + Runtime + W32API"
1396 ' Find the MinGW and W32API tools.
1401 ' The specified path.
1402 if (strPathMingW32
= "") And (strOptMinGW32
<> "") then
1403 if CheckForMinGW32Sub(strOptMinGW32
, strOptW32API
) then
1404 strPathMingW32
= strOptMinGW32
1405 strPathW32API
= strOptW32API
1409 ' The tools location (first).
1410 if (strPathMingW32
= "") And (g_blnInternalFirst
= True) then
1411 str
= g_strPathDev
& "/win.x86/mingw32/v3.3.3"
1412 str2
= g_strPathDev
& "/win.x86/w32api/v2.5"
1413 if CheckForMinGW32Sub(str
, str2
) then
1414 strPathMingW32
= str
1415 strPathW32API
= str2
1419 ' See if there is any gcc around.
1420 if strPathMingW32
= "" then
1421 str
= Which("mingw32-gcc.exe")
1423 str
= PathParent(PathStripFilename(str
))
1424 if CheckForMinGW32Sub(str
, str
) then strPathMingW32
= str
1428 if strPathMingW32
= "" then
1429 str
= Which("gcc.exe")
1431 str
= PathParent(PathStripFilename(str
))
1432 if CheckForMinGW32Sub(str
, str
) then strPathMingW32
= str
1436 ' The tools location (post).
1437 if (strPathMingW32
= "") And (g_blnInternalFirst
= False) then
1438 str
= g_strPathDev
& "/win.x86/mingw32/v3.3.3"
1439 str2
= g_strPathDev
& "/win.x86/w32api/v2.5"
1440 if CheckForMinGW32Sub(str
, str2
) then
1441 strPathMingW32
= str
1442 strPathW32API
= str2
1447 if strPathMingW32
= "" then
1448 if g_strTargetArch
= "amd64" then
1449 MsgWarning
"Can't locate a suitable MinGW32 installation, ignoring since we're targetting AMD64 and won't need it."
1450 elseif strOptMinGW32
= "" then
1451 MsgError
"Can't locate a suitable MinGW32 installation. Try specify the path with " _
1452 & "the --with-MinGW32=<path> argument. If still no luck, consult the configure.log and the build requirements."
1454 MsgError
"Can't locate a suitable MinGW32 installation. Please consult the configure.log and the build requirements."
1462 strPathMingW32
= UnixSlashes(PathAbs(strPathMingW32
))
1463 CfgPrint
"PATH_TOOL_MINGW32 := " & strPathMingW32
1464 PrintResult
"MinGW32 (GCC v" & g_strSubOutput
& ")", strPathMingW32
1465 if (strPathMingW32
= strPathW32API
) Or strPathW32API
= "" then
1466 CfgPrint
"PATH_SDK_W32API := $(PATH_TOOL_MINGW32)"
1468 CfgPrint "PATH_SDK_W32API
:= " & strPathW32API
1469 PrintResult "W32API
", strPathW32API
1474 ' Checks if the specified path points to an usable MinGW or not.
1475 function CheckForMinGW32Sub(strPathMingW32, strPathW32API)
1477 if strPathW32API = "" then strPathW32API = strPathMingW32
1478 LogPrint "trying
: strPathMingW32
=" &strPathMingW32 & " strPathW32API
=" & strPathW32API
1480 if LogFileExists(strPathMingW32, "bin
/mingw32
-gcc
.exe
") _
1481 And LogFileExists(strPathMingW32, "bin
/ld
.exe
") _
1482 And LogFileExists(strPathMingW32, "bin
/objdump
.exe
") _
1483 And LogFileExists(strPathMingW32, "bin
/dllwrap
.exe
") _
1484 And LogFileExists(strPathMingW32, "bin
/as.exe
") _
1485 And LogFileExists(strPathMingW32, "include
/string.h
") _
1486 And LogFileExists(strPathMingW32, "include
/_mingw
.h
") _
1487 And LogFileExists(strPathMingW32, "lib/dllcrt1
.o
") _
1488 And LogFileExists(strPathMingW32, "lib/dllcrt2
.o
") _
1489 And LogFileExists(strPathMingW32, "lib/libmsvcrt
.a
") _
1491 And LogFileExists(strPathW32API, "lib/libkernel32
.a
") _
1492 And LogFileExists(strPathW32API, "include
/windows
.h
") _
1494 if Shell(DosSlashes(strPathMingW32 & "/bin
/gcc
.exe
") & " --version
", True) = 0 then
1495 dim offVer, iMajor, iMinor, iPatch, strVer
1497 ' extract the version.
1499 offVer = InStr(1, g_strShellOutput, "(GCC
) ")
1501 strVer = LTrim(Mid(g_strShellOutput, offVer + Len("(GCC
) ")))
1502 strVer = RTrim(Left(strVer, InStr(1, strVer, " ")))
1503 if (Mid(strVer, 2, 1) = ".") _
1504 And (Mid(strVer, 4, 1) = ".") then
1505 iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
1506 iMinor = Int(Mid(strVer, 3, 1))
1507 iPatch = Int(Mid(strVer, 5))
1509 LogPrint "Malformed version
: '" & strVer & "'"
1513 if strVer
<> "" then
1514 if (iMajor
= 3) And (iMinor
= 3) then
1515 CheckForMinGW32Sub
= True
1516 g_strSubOutput
= strVer
1518 LogPrint
"MinGW32 version '" & iMajor
& "." & iMinor
& "." & iPatch
& "' is not supported (or configure.vbs failed to parse it correctly)."
1521 LogPrint
"Couldn't locate the GCC version in the output!"
1525 LogPrint
"Failed to run gcc.exe!"
1532 ' Checks for a MinGW-w64 suitable for building the recompiler.
1534 sub CheckForMinGWw64(strOptMinGWw64
)
1535 dim strPathMingWw64
, str
1536 PrintHdr
"MinGW-w64 GCC (unprefixed)"
1539 ' Find the MinGW-w64 tools.
1541 strPathMingWw64
= ""
1543 ' The specified path.
1544 if (strPathMingWw64
= "") And (strOptMinGWw64
<> "") then
1545 if CheckForMinGWw64Sub(strOptMinGWw64
) then
1546 strPathMingWw64
= strOptMinGWw64
1550 ' The tools location (first).
1551 if (strPathMinGWw64
= "") And (g_blnInternalFirst
= True) then
1552 str
= g_strPathDev
& "/win.amd64/mingw-w64/r1"
1553 if CheckForMinGWw64Sub(str
) then
1554 strPathMinGWw64
= str
1558 ' See if there is any gcc around.
1559 if strPathMinGWw64
= "" then
1560 str
= Which("x86_64-w64-mingw32-gcc.exe")
1562 str
= PathParent(PathStripFilename(str
))
1563 if CheckForMinGWw64Sub(str
) then strPathMinGWw64
= str
1567 if strPathMinGWw64
= "" then
1568 str
= Which("gcc.exe")
1570 str
= PathParent(PathStripFilename(str
))
1571 if CheckForMinGWw64Sub(str
) then strPathMinGWw64
= str
1575 ' The tools location (post).
1576 if (strPathMinGWw64
= "") And (g_blnInternalFirst
= False) then
1577 str
= g_strPathDev
& "/win.amd64/mingw-w64/r1"
1578 if CheckForMinGWw64Sub(str
) then
1579 strPathMinGWw64
= str
1584 if strPathMinGWw64
= "" then
1585 if g_strTargetArch
= "x86" then
1586 MsgWarning
"Can't locate a suitable MinGW-w64 installation, ignoring since we're targetting x86 and won't need it."
1587 elseif strOptMinGWw64
= "" then
1588 MsgError
"Can't locate a suitable MinGW-w64 installation. Try specify the path with " _
1589 & "the --with-MinGW-w64=<path> argument. If still no luck, consult the configure.log and the build requirements."
1591 MsgError
"Can't locate a suitable MinGW-w64 installation. Please consult the configure.log and the build requirements."
1599 strPathMinGWw64
= UnixSlashes(PathAbs(strPathMinGWw64
))
1600 CfgPrint
"PATH_TOOL_MINGWW64 := " & strPathMinGWw64
1601 PrintResult
"MinGW-w64 (GCC v" & g_strSubOutput
& ")", strPathMinGWw64
1605 ' Checks if the specified path points to an usable MinGW-w64 or not.
1606 function CheckForMinGWw64Sub(strPathMinGWw64
)
1608 LogPrint
"trying: strPathMinGWw64=" &strPathMinGWw64
1610 if LogFileExists(strPathMinGWw64
, "bin/gcc.exe") _
1611 And LogFileExists(strPathMinGWw64
, "bin/ld.exe") _
1612 And LogFileExists(strPathMinGWw64
, "bin/objdump.exe") _
1613 And LogFileExists(strPathMinGWw64
, "bin/dllwrap.exe") _
1614 And LogFileExists(strPathMinGWw64
, "bin/dlltool.exe") _
1615 And LogFileExists(strPathMinGWw64
, "bin/as.exe") _
1616 And LogFileExists(strPathMinGWw64
, "include/bfd.h") _
1617 And LogFileExists(strPathMinGWw64
, "lib64/libgcc_s.a") _
1618 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/lib/dllcrt1.o") _
1619 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/lib/dllcrt2.o") _
1620 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/lib/libmsvcrt.a") _
1621 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/lib/libmsvcr100.a") _
1622 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/include/_mingw.h") _
1623 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/include/stdint.h") _
1624 And LogFileExists(strPathMinGWw64
, "x86_64-w64-mingw32/include/windows.h") _
1626 if Shell(DosSlashes(strPathMinGWw64
& "/bin/gcc.exe") & " -dumpversion", True) = 0 then
1627 dim offVer
, iMajor
, iMinor
, iPatch
, strVer
1629 ' extract the version.
1630 strVer
= Trim(Replace(Replace(g_strShellOutput
, vbCr
, ""), vbLf
, ""))
1631 if (Mid(strVer
, 2, 1) = ".") _
1632 And (Mid(strVer
, 4, 1) = ".") then
1633 iMajor
= Int(Left(strVer
, 1)) ' Is Int() the right thing here? I want atoi()!!!
1634 iMinor
= Int(Mid(strVer
, 3, 1))
1635 iPatch
= Int(Mid(strVer
, 5))
1637 LogPrint
"Malformed version: '" & strVer
& "'"
1640 if strVer
<> "" then
1641 if (iMajor
= 4) And (iMinor
>= 4) then
1642 CheckForMinGWw64Sub
= True
1643 g_strSubOutput
= strVer
1645 LogPrint
"MinGW-w64 version '" & iMajor
& "." & iMinor
& "." & iPatch
& "' is not supported (or configure.vbs failed to parse it correctly)."
1648 LogPrint
"Couldn't locate the GCC version in the output!"
1652 LogPrint
"Failed to run gcc.exe!"
1659 ' Checks for any libSDL binaries.
1660 sub CheckForlibSDL(strOptlibSDL
)
1661 dim strPathlibSDL
, str
1665 ' Try find some SDL library.
1668 ' First, the specific location.
1670 if (strPathlibSDL
= "") And (strOptlibSDL
<> "") then
1671 if CheckForlibSDLSub(strOptlibSDL
) then strPathlibSDL
= strOptlibSDL
1674 ' The tools location (first).
1675 if (strPathlibSDL
= "") And (g_blnInternalFirst
= True) Then
1676 str
= g_strPathDev
& "/win.x86/libsdl/v1.2.11"
1677 if CheckForlibSDLSub(str
) then strPathlibSDL
= str
1680 if (strPathlibSDL
= "") And (g_blnInternalFirst
= True) Then
1681 str
= g_strPathDev
& "/win.x86/libsdl/v1.2.7-InnoTek"
1682 if CheckForlibSDLSub(str
) then strPathlibSDL
= str
1685 ' Poke about in the path.
1686 str
= Which("SDLmain.lib")
1687 if (strPathlibSDL
= "") And (str
<> "") Then
1688 str
= PathParent(PathStripFilename(str
))
1689 if CheckForlibSDLSub(str
) then strPathlibSDL
= str
1692 str
= Which("SDL.dll")
1693 if (strPathlibSDL
= "") And (str
<> "") Then
1694 str
= PathParent(PathStripFilename(str
))
1695 if CheckForlibSDLSub(str
) then strPathlibSDL
= str
1698 ' The tools location (post).
1699 if (strPathlibSDL
= "") And (g_blnInternalFirst
= False) Then
1700 str
= g_strPathDev
& "/win.x86/libsdl/v1.2.11"
1701 if CheckForlibSDLSub(str
) then strPathlibSDL
= str
1704 if (strPathlibSDL
= "") And (g_blnInternalFirst
= False) Then
1705 str
= g_strPathDev
& "/win.x86/libsdl/v1.2.7-InnoTek"
1706 if CheckForlibSDLSub(str
) then strPathlibSDL
= str
1710 if strPathlibSDL
= "" then
1711 if strOptlibSDL
= "" then
1712 MsgError
"Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
1713 & "If still no luck, consult the configure.log and the build requirements."
1715 MsgError
"Can't locate libSDL. Please consult the configure.log and the build requirements."
1720 strPathLibSDL
= UnixSlashes(PathAbs(strPathLibSDL
))
1721 CfgPrint
"PATH_SDK_LIBSDL := " & strPathlibSDL
1723 PrintResult
"libSDL", strPathlibSDL
1727 ' Checks if the specified path points to an usable libSDL or not.
1728 function CheckForlibSDLSub(strPathlibSDL
)
1729 CheckForlibSDLSub
= False
1730 LogPrint
"trying: strPathlibSDL=" & strPathlibSDL
1731 if LogFileExists(strPathlibSDL
, "lib/SDL.lib") _
1732 And LogFileExists(strPathlibSDL
, "lib/SDLmain.lib") _
1733 And LogFileExists(strPathlibSDL
, "lib/SDL.dll") _
1734 And LogFileExists(strPathlibSDL
, "include/SDL.h") _
1735 And LogFileExists(strPathlibSDL
, "include/SDL_syswm.h") _
1736 And LogFileExists(strPathlibSDL
, "include/SDL_version.h") _
1738 CheckForlibSDLSub
= True
1744 ' Checks for libxml2.
1745 sub CheckForXml2(strOptXml2
)
1746 dim strPathXml2
, str
1749 ' Skip if no COM/ATL.
1750 if g_blnDisableCOM
then
1751 PrintResultMsg
"libxml2", "Skipped (" & g_strDisableCOM
& ")"
1756 ' Try find some xml2 dll/lib.
1759 if (strPathXml2
= "") And (strOptXml2
<> "") then
1760 if CheckForXml2Sub(strOptXml2
) then strPathXml2
= strOptXml2
1763 if strPathXml2
= "" Then
1764 str
= Which("libxml2.lib")
1766 str
= PathParent(PathStripFilename(str
))
1767 if CheckForXml2Sub(str
) then strPathXml2
= str
1771 ' Ignore failure if we're in 'internal' mode.
1772 if (strPathXml2
= "") and g_blnInternalMode
then
1773 PrintResultMsg
"libxml2", "ignored (internal mode)"
1778 if strPathXml2
= "" then
1779 if strOptXml2
= "" then
1780 MsgError
"Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
1781 & "If still no luck, consult the configure.log and the build requirements."
1783 MsgError
"Can't locate libxml2. Please consult the configure.log and the build requirements."
1788 strPathXml2
= UnixSlashes(PathAbs(strPathXml2
))
1789 CfgPrint
"SDK_VBOX_LIBXML2_INCS := " & strPathXml2
& "/include"
1790 CfgPrint
"SDK_VBOX_LIBXML2_LIBS := " & strPathXml2
& "/lib/libxml2.lib"
1792 PrintResult
"libxml2", strPathXml2
1796 ' Checks if the specified path points to an usable libxml2 or not.
1797 function CheckForXml2Sub(strPathXml2
)
1800 CheckForXml2Sub
= False
1801 LogPrint
"trying: strPathXml2=" & strPathXml2
1802 if LogFileExists(strPathXml2
, "include/libxml/xmlexports.h") _
1803 And LogFileExists(strPathXml2
, "include/libxml/xmlreader.h") _
1805 str
= LogFindFile(strPathXml2
, "bin/libxml2.dll")
1807 if LogFindFile(strPathXml2
, "lib/libxml2.lib") <> "" then
1808 CheckForXml2Sub
= True
1816 ' Checks for libxslt.
1817 sub CheckForXslt(strOptXslt
)
1818 dim strPathXslt
, str
1821 ' Skip if no COM/ATL.
1822 if g_blnDisableCOM
then
1823 PrintResultMsg
"libxslt", "Skipped (" & g_strDisableCOM
& ")"
1828 ' Try find some libxslt dll/lib.
1831 if (strPathXslt
= "") And (strOptXslt
<> "") then
1832 if CheckForXsltSub(strOptXslt
) then strPathXslt
= strOptXslt
1835 if strPathXslt
= "" Then
1836 str
= Which("libxslt.lib")
1838 str
= PathParent(PathStripFilename(str
))
1839 if CheckForXsltSub(str
) then strPathXslt
= str
1843 if strPathXslt
= "" Then
1844 str
= Which("libxslt.dll")
1846 str
= PathParent(PathStripFilename(str
))
1847 if CheckForXsltSub(str
) then strPathXslt
= str
1851 ' Ignore failure if we're in 'internal' mode.
1852 if (strPathXslt
= "") and g_blnInternalMode
then
1853 PrintResultMsg
"libxslt", "ignored (internal mode)"
1858 if strPathXslt
= "" then
1859 if strOptXslt
= "" then
1860 MsgError
"Can't locate libxslt. Try specify the path with the --with-libxslt=<path> argument. " _
1861 & "If still no luck, consult the configure.log and the build requirements."
1863 MsgError
"Can't locate libxslt. Please consult the configure.log and the build requirements."
1868 strPathXslt
= UnixSlashes(PathAbs(strPathXslt
))
1869 CfgPrint
"SDK_VBOX_LIBXSLT_INCS := " & strPathXslt
& "/include"
1870 CfgPrint
"SDK_VBOX_LIBXSLT_LIBS := " & strPathXslt
& "/lib/libxslt.lib"
1872 PrintResult
"libxslt", strPathXslt
1877 ' Checks if the specified path points to an usable libxslt or not.
1878 function CheckForXsltSub(strPathXslt
)
1881 CheckForXsltSub
= False
1882 LogPrint
"trying: strPathXslt=" & strPathXslt
1884 if LogFileExists(strPathXslt
, "include/libxslt/namespaces.h") _
1885 And LogFileExists(strPathXslt
, "include/libxslt/xsltutils.h") _
1887 str
= LogFindFile(strPathXslt
, "lib/libxslt.dll")
1889 if LogFileExists(strPathXslt
, "lib/libxslt.lib") _
1891 CheckForXsltSub
= True
1899 ' Checks for openssl
1900 sub CheckForSsl(strOptSsl
)
1905 ' Try find some openssl dll/lib.
1908 if (strPathSsl
= "") And (strOptSsl
<> "") then
1909 if CheckForSslSub(strOptSsl
) then strPathSsl
= strOptSsl
1912 if strPathSsl
= "" Then
1913 str
= Which("ssleay32.lib")
1915 str
= PathParent(PathStripFilename(str
))
1916 if CheckForSslSub(str
) then strPathSsl
= str
1920 ' Ignore failure if we're in 'internal' mode.
1921 if (strPathSsl
= "") and g_blnInternalMode
then
1922 PrintResultMsg
"openssl", "ignored (internal mode)"
1927 if strPathSsl
= "" then
1928 if strOptSsl
= "" then
1929 MsgError
"Can't locate openssl. Try specify the path with the --with-openssl=<path> argument. " _
1930 & "If still no luck, consult the configure.log and the build requirements."
1932 MsgError
"Can't locate openssl. Please consult the configure.log and the build requirements."
1937 strPathSsl
= UnixSlashes(PathAbs(strPathSsl
))
1938 CfgPrint
"SDK_VBOX_OPENSSL_INCS := " & strPathSsl
& "/include"
1939 CfgPrint
"SDK_VBOX_OPENSSL_LIBS := " & strPathSsl
& "/lib/ssleay32.lib" & " " & strPathSsl
& "/lib/libeay32.lib"
1940 CfgPrint
"SDK_VBOX_BLD_OPENSSL_LIBS := " & strPathSsl
& "/lib/ssleay32.lib" & " " & strPathSsl
& "/lib/libeay32.lib"
1942 PrintResult
"openssl", strPathSsl
1946 ' Checks if the specified path points to an usable openssl or not.
1947 function CheckForSslSub(strPathSsl
)
1949 CheckForSslSub
= False
1950 LogPrint
"trying: strPathSsl=" & strPathSsl
1951 if LogFileExists(strPathSsl
, "include/openssl/md5.h") _
1952 And LogFindFile(strPathSsl
, "bin/ssleay32.dll") <> "" _
1953 And LogFindFile(strPathSsl
, "lib/ssleay32.lib") <> "" _
1954 And LogFindFile(strPathSsl
, "bin/libeay32.dll") <> "" _
1955 And LogFindFile(strPathSsl
, "lib/libeay32.lib") <> "" _
1957 CheckForSslSub
= True
1963 ' Checks for libcurl
1964 sub CheckForCurl(strOptCurl
)
1965 dim strPathCurl
, str
1969 ' Try find some cURL dll/lib.
1972 if (strPathCurl
= "") And (strOptCurl
<> "") then
1973 if CheckForCurlSub(strOptCurl
) then strPathCurl
= strOptCurl
1976 if strPathCurl
= "" Then
1977 str
= Which("libcurl.lib")
1979 str
= PathParent(PathStripFilename(str
))
1980 if CheckForCurlSub(str
) then strPathCurl
= str
1984 ' Ignore failure if we're in 'internal' mode.
1985 if (strPathCurl
= "") and g_blnInternalMode
then
1986 PrintResultMsg
"curl", "ignored (internal mode)"
1991 if strPathCurl
= "" then
1992 if strOptCurl
= "" then
1993 MsgError
"Can't locate libcurl. Try specify the path with the --with-libcurl=<path> argument. " _
1994 & "If still no luck, consult the configure.log and the build requirements."
1996 MsgError
"Can't locate libcurl. Please consult the configure.log and the build requirements."
2001 strPathCurl
= UnixSlashes(PathAbs(strPathCurl
))
2002 CfgPrint
"SDK_VBOX_LIBCURL_INCS := " & strPathCurl
& "/include"
2003 CfgPrint
"SDK_VBOX_LIBCURL_LIBS := " & strPathCurl
& "/libcurl.lib"
2005 PrintResult
"libcurl", strPathCurl
2009 ' Checks if the specified path points to an usable libcurl or not.
2010 function CheckForCurlSub(strPathCurl
)
2012 CheckForCurlSub
= False
2013 LogPrint
"trying: strPathCurl=" & strPathCurl
2014 if LogFileExists(strPathCurl
, "include/curl/curl.h") _
2015 And LogFindFile(strPathCurl
, "libcurl.dll") <> "" _
2016 And LogFindFile(strPathCurl
, "libcurl.lib") <> "" _
2018 CheckForCurlSub
= True
2025 ' Checks for any Qt4 binaries.
2026 sub CheckForQt4(strOptQt4
)
2032 ' Try to find the Qt4 installation (user specified path with --with-qt4)
2036 LogPrint
"Checking for user specified path of Qt4 ... "
2037 if (strPathQt4
= "") And (strOptQt4
<> "") then
2038 strOptQt4
= UnixSlashes(strOptQt4
)
2039 if CheckForQt4Sub(strOptQt4
) then strPathQt4
= strOptQt4
2042 ' Check the dev tools
2043 if (strPathQt4
= "") Then
2044 strPathQt4
= g_strPathDev
& "/win." & g_strTargetArch
& "/qt/v4.7.3-vcc100"
2045 if CheckForQt4Sub(strPathQt4
) = False then strPathQt4
= ""
2048 ' Display the result.
2049 if strPathQt4
= "" then
2050 CfgPrint
"VBOX_WITH_QT4GUI="
2051 PrintResultMsg
"Qt4", "not found"
2053 CfgPrint
"PATH_SDK_QT4 := " & strPathQt4
2054 CfgPrint
"PATH_TOOL_QT4 := $(PATH_SDK_QT4)"
2055 CfgPrint "VBOX_PATH_QT4
:= $(PATH_SDK_QT4)"
2056 PrintResult
"Qt4 ", strPathQt4
2062 ' Checks if the specified path points to an usable Qt library.
2063 function CheckForQt4Sub(strPathQt4
)
2065 CheckForQt4Sub
= False
2066 LogPrint
"trying: strPathQt4=" & strPathQt4
2068 if LogFileExists(strPathQt4
, "bin/moc.exe") _
2069 And LogFileExists(strPathQt4
, "bin/uic.exe") _
2070 And LogFileExists(strPathQt4
, "include/Qt/qwidget.h") _
2071 And LogFileExists(strPathQt4
, "include/QtGui/QApplication") _
2072 And LogFileExists(strPathQt4
, "include/QtNetwork/QHostAddress") _
2073 And ( LogFileExists(strPathQt4
, "lib/QtCore4.lib") _
2074 Or LogFileExists(strPathQt4
, "lib/VBoxQtCore4.lib") _
2075 Or LogFileExists(strPathQt4
, "lib/QtCoreVBox4.lib")) _
2076 And ( LogFileExists(strPathQt4
, "lib/QtNetwork4.lib") _
2077 Or LogFileExists(strPathQt4
, "lib/VBoxQtNetwork4.lib") _
2078 Or LogFileExists(strPathQt4
, "lib/QtNetworkVBox4.lib")) _
2080 CheckForQt4Sub
= True
2088 function CheckForPython(strPathPython
)
2092 CheckForPython
= False
2093 LogPrint
"trying: strPathPython=" & strPathPython
2095 if LogFileExists(strPathPython
, "python.exe") then
2096 CfgPrint
"VBOX_BLD_PYTHON := " & strPathPython
& "\python.exe"
2097 CheckForPython
= True
2100 PrintResult
"Python ", strPathPython
2106 function CheckForMkisofs(strFnameMkisofs
)
2110 CheckForMkisofs
= False
2111 LogPrint
"trying: strFnameMkisofs=" & strFnameMkisofs
2113 if FileExists(strFnameMkisofs
) = false then
2114 LogPrint
"Testing '" & strFnameMkisofs
& " not found"
2116 CfgPrint
"VBOX_MKISOFS := " & strFnameMkisofs
2117 CheckForMkisofs
= True
2120 PrintResult
"mkisofs ", strFnameMkisofs
2127 Print
"Usage: cscript configure.vbs [options]"
2129 Print
"Configuration:"
2132 Print
" --internal-last"
2135 Print
" --disable-COM"
2136 Print
" --disable-UDPTunnel"
2139 Print
" --with-DDK=PATH "
2140 Print
" --with-DXSDK=PATH "
2141 Print
" --with-kBuild=PATH "
2142 Print
" --with-libSDL=PATH "
2143 Print
" --with-MinGW32=PATH "
2144 Print
" --with-MinGW-w64=PATH "
2145 Print
" --with-Qt4=PATH "
2146 Print
" --with-SDK=PATH "
2147 Print
" --with-VC=PATH "
2148 Print
" --with-VC-Common=PATH "
2149 Print
" --with-VC-Express-Edition"
2150 Print
" --with-W32API=PATH "
2151 Print
" --with-libxml2=PATH "
2152 Print
" --with-libxslt=PATH "
2153 Print
" --with-openssl=PATH "
2154 Print
" --with-libcurl=PATH "
2155 Print
" --with-python=PATH "
2160 ' The main() like function.
2164 ' Write the log header and check that we're not using wscript.
2167 If UCase(Right(Wscript
.FullName
, 11)) = "WSCRIPT.EXE" Then
2168 Wscript
.Echo
"This script must be run under CScript."
2185 blnOptVCExpressEdition
= False
2193 blnOptDisableCOM
= False
2194 blnOptDisableUDPTunnel
= False
2195 for i
= 1 to Wscript
.Arguments
.Count
2196 dim str
, strArg
, strPath
2198 ' Separate argument and path value
2199 str
= Wscript
.Arguments
.item(i
- 1)
2200 if InStr(1, str
, "=") > 0 then
2201 strArg
= Mid(str
, 1, InStr(1, str
, "=") - 1)
2202 strPath
= Mid(str
, InStr(1, str
, "=") + 1)
2203 if strPath
= "" then MsgFatal
"Syntax error! Argument #" & i
& " is missing the path."
2209 ' Process the argument
2210 select case LCase(strArg
)
2214 MsgWarning
"Ignornig --with-dxsdk (the DirectX SDK is no longer required)."
2215 case "--with-kbuild"
2216 strOptkBuild
= strPath
2217 case "--with-libsdl"
2218 strOptlibSDL
= strPath
2219 case "--with-mingw32"
2220 strOptMinGW32
= strPath
2221 case "--with-mingw-w64"
2222 strOptMinGWw64
= strPath
2229 case "--with-vc-common"
2230 strOptVCCommon
= strPath
2231 case "--with-vc-express-edition"
2232 blnOptVCExpressEdition
= True
2233 case "--with-w32api"
2234 strOptW32API
= strPath
2235 case "--with-libxml2"
2236 strOptXml2
= strPath
2237 case "--with-libxslt"
2238 strOptXslt
= strPath
2239 case "--with-openssl"
2241 case "--with-libcurl"
2242 strOptCurl
= strPath
2243 case "--with-python"
2244 strOptPython
= strPath
2245 case "--with-mkisofs"
2246 strOptMkisofs
= strPath
2247 case "--disable-com"
2248 blnOptDisableCOM
= True
2250 blnOptDisableCOM
= False
2251 case "--disable-udptunnel"
2252 blnOptDisableUDPTunnel
= True
2254 g_blnInternalMode
= True
2255 case "--internal-last"
2256 g_blnInternalFirst
= False
2257 case "-h", "--help", "-?"
2261 Wscript
.echo
"syntax error: Unknown option '" & str
&"'."
2268 ' Initialize output files.
2274 ' Check that the Shell function is sane.
2276 g_objShell
.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
2277 if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
2278 MsgFatal
"shell execution test failed!"
2280 if g_strShellOutput
<> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
2281 Print
"Shell test Test -> '" & g_strShellOutput
& "'"
2282 MsgFatal
"shell inheritance or shell execution isn't working right. Make sure you use cmd.exe."
2284 g_objShell
.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
2285 Print
"Shell inheritance test: OK"
2290 if blnOptDisableCOM
= True then
2291 DisableCOM
"--disable-com"
2293 if blnOptDisableUDPTunnel
= True then
2294 DisableUDPTunnel
"--disable-udptunnel"
2297 CheckForkBuild strOptkBuild
2298 CheckForWinDDK strOptDDK
2299 CfgPrint
"VBOX_WITH_WDDM_W8 := " '' @todo look for WinDDKv8; Check with Misha if we _really_ need the v8 DDK...
2300 CheckForVisualCPP strOptVC
, strOptVCCommon
, blnOptVCExpressEdition
2301 CheckForPlatformSDK strOptSDK
2303 CheckForMinGW32 strOptMinGW32
, strOptW32API
2304 CheckForMinGWw64 strOptMinGWw64
2305 CfgPrint
"VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
2306 EnvPrint
"set PATH=%PATH%;" & g_strPath
& "/tools/win." & g_strTargetArch
& "/bin;" '' @todo look for yasm
2307 CheckForlibSDL strOptlibSDL
2308 ' Don't check for these libraries by default as they are part of OSE
2309 ' Using external libs can add a dependency to iconv
2310 if (strOptXml2
<> "") then
2311 CheckForXml2 strOptXml2
2313 if (strOptXslt
<> "") then
2314 CheckForXslt strOptXslt
2316 CheckForSsl strOptSsl
2317 CheckForCurl strOptCurl
2318 CheckForQt4 strOptQt4
2319 if (strOptPython
<> "") then
2320 CheckForPython strOptPython
2322 if (strOptMkisofs
<> "") then
2323 CheckForMkisofs strOptMkisofs
2325 if g_blnInternalMode
then
2326 EnvPrint
"call " & g_strPathDev
& "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
2330 Print
"Execute env.bat once before you start to build VBox:"