VirtualBox

source: vbox/trunk/configure.vbs@ 42302

Last change on this file since 42302 was 42296, checked in by vboxsync, 12 years ago

configure.vbs: Take yasm from tools/win.*/bin.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Id
File size: 71.8 KB
Line 
1' $Id: configure.vbs 42296 2012-07-21 00:24:46Z 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-2012 Oracle Corporation
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_strVerPSDK, g_strPathDDK, g_strSubOutput
39g_strPathkBuild = ""
40g_strPathDev = ""
41g_strPathVCC = ""
42g_strPathPSDK = ""
43g_strPathDDK = ""
44
45dim g_strTargetArch
46g_strTargetArch = "x86"
47
48dim g_blnDisableCOM, g_strDisableCOM
49g_blnDisableCOM = False
50g_strDisableCOM = ""
51
52' The internal mode is primarily for skipping some large libraries.
53dim g_blnInternalMode
54g_blnInternalMode = False
55
56' Whether to try the internal stuff first or last.
57dim g_blnInternalFirst
58g_blnInternalFirst = True
59
60
61
62''
63' Converts to unix slashes
64function UnixSlashes(str)
65 UnixSlashes = replace(str, "\", "/")
66end function
67
68
69''
70' Converts to dos slashes
71function DosSlashes(str)
72 DosSlashes = replace(str, "/", "\")
73end function
74
75
76''
77' Read a file (typically the tmp file) into a string.
78function FileToString(strFilename)
79 const ForReading = 1, TristateFalse = 0
80 dim objLogFile, str
81
82 set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForReading, False, TristateFalse)
83 str = objFile.ReadAll()
84 objFile.Close()
85
86 FileToString = str
87end function
88
89
90''
91' Deletes a file
92sub FileDelete(strFilename)
93 if g_objFileSys.FileExists(DosSlashes(strFilename)) then
94 g_objFileSys.DeleteFile(DosSlashes(strFilename))
95 end if
96end sub
97
98
99''
100' Appends a line to an ascii file.
101sub FileAppendLine(strFilename, str)
102 const ForAppending = 8, TristateFalse = 0
103 dim objFile
104
105 set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForAppending, True, TristateFalse)
106 objFile.WriteLine(str)
107 objFile.Close()
108end sub
109
110
111''
112' Checks if the file exists.
113function FileExists(strFilename)
114 FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
115end function
116
117
118''
119' Checks if the directory exists.
120function DirExists(strDirectory)
121 DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
122end function
123
124
125''
126' Checks if this is a WOW64 process.
127function IsWow64()
128 if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
129 IsWow64 = 1
130 else
131 IsWow64 = 0
132 end if
133end function
134
135
136''
137' Returns a reverse sorted array (strings).
138function ArraySortStrings(arrStrings)
139 for i = LBound(arrStrings) to UBound(arrStrings)
140 str1 = arrStrings(i)
141 for j = i + 1 to UBound(arrStrings)
142 str2 = arrStrings(j)
143 if StrComp(str2, str1) < 0 then
144 arrStrings(j) = str1
145 str1 = str2
146 end if
147 next
148 arrStrings(i) = str1
149 next
150 ArraySortStrings = arrStrings
151end function
152
153
154''
155' Prints a string array.
156sub ArrayPrintStrings(arrStrings, strPrefix)
157 for i = LBound(arrStrings) to UBound(arrStrings)
158 Print strPrefix & "arrStrings(" & i & ") = '" & arrStrings(i) & "'"
159 next
160end sub
161
162
163''
164' Returns a reverse sorted array (strings).
165function ArrayRSortStrings(arrStrings)
166 ' Sort it.
167 arrStrings = ArraySortStrings(arrStrings)
168
169 ' Reverse the array.
170 cnt = UBound(arrStrings) - LBound(arrStrings) + 1
171 if cnt > 0 then
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
178 j = j - 1
179 next
180 end if
181 ArrayRSortStrings = arrStrings
182end function
183
184
185''
186' Returns the input array with the string appended.
187' Note! There must be some better way of doing this...
188function ArrayAppend(arr, str)
189 dim i, cnt
190 cnt = UBound(arr) - LBound(arr) + 1
191 redim arrRet(cnt)
192 for i = LBound(arr) to UBound(arr)
193 arrRet(i) = arr(i)
194 next
195 arrRet(UBound(arr) + 1) = str
196 ArrayAppend = arrRet
197end function
198
199
200
201''
202' Translates a register root name to a value
203function RegTransRoot(strRoot)
204 const HKEY_LOCAL_MACHINE = &H80000002
205 const HKEY_CURRENT_USER = &H80000001
206 select case strRoot
207 case "HKLM"
208 RegTransRoot = HKEY_LOCAL_MACHINE
209 case "HKCU"
210 RegTransRoot = HKEY_CURRENT_USER
211 case else
212 MsgFatal "RegTransRoot: Unknown root: '" & strRoot & "'"
213 RegTransRoot = 0
214 end select
215end function
216
217
218'' The registry globals
219dim g_objReg, g_objRegCtx
220dim g_blnRegistry
221g_blnRegistry = false
222
223
224''
225' Init the register provider globals.
226function RegInit()
227 RegInit = false
228 On Error Resume Next
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.
232 if IsWow64() then
233 g_objRegCtx.Add "__ProviderArchitecture", 64
234 g_objRegCtx.Add "__RequiredArchitecture", true
235 end if
236 set objLocator = CreateObject("Wbemscripting.SWbemLocator")
237 set objServices = objLocator.ConnectServer("", "root\default", "", "", , , , g_objRegCtx)
238 set g_objReg = objServices.Get("StdRegProv")
239 g_blnRegistry = true
240 end if
241 RegInit = true
242end function
243
244
245''
246' Gets a value from the registry. Returns "" if string wasn't found / valid.
247function RegGetString(strName)
248 RegGetString = ""
249 if RegInit() then
250 dim strRoot, strKey, strValue
251 dim iRoot
252
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)
257
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
263 On Error Resume Next
264 set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx)
265 if OutParms.ReturnValue = 0 then
266 RegGetString = OutParms.sValue
267 end if
268 else
269 ' fallback mode
270 On Error Resume Next
271 RegGetString = g_objShell.RegRead(strName)
272 end if
273end function
274
275
276''
277' Returns an array of subkey strings.
278function RegEnumSubKeys(strRoot, strKeyPath)
279 dim iRoot
280 iRoot = RegTransRoot(strRoot)
281 RegEnumSubKeys = Array()
282
283 if RegInit() then
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
288 On Error Resume Next
289 set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx)
290 if OutParms.ReturnValue = 0 then
291 RegEnumSubKeys = OutParms.sNames
292 end if
293 else
294 ' fallback mode
295 dim objReg, rc, arrSubKeys
296 set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
297 On Error Resume Next
298 rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
299 if rc = 0 then
300 RegEnumSubKeys = arrSubKeys
301 end if
302 end if
303end function
304
305
306''
307' Returns an array of full path subkey strings.
308function RegEnumSubKeysFull(strRoot, strKeyPath)
309 dim arrTmp
310 arrTmp = RegEnumSubKeys(strRoot, strKeyPath)
311 for i = LBound(arrTmp) to UBound(arrTmp)
312 arrTmp(i) = strKeyPath & "\" & arrTmp(i)
313 next
314 RegEnumSubKeysFull = arrTmp
315end function
316
317
318''
319' Returns an rsorted array of subkey strings.
320function RegEnumSubKeysRSort(strRoot, strKeyPath)
321 RegEnumSubKeysRSort = ArrayRSortStrings(RegEnumSubKeys(strRoot, strKeyPath))
322end function
323
324
325''
326' Returns an rsorted array of subkey strings.
327function RegEnumSubKeysFullRSort(strRoot, strKeyPath)
328 RegEnumSubKeysFullRSort = ArrayRSortStrings(RegEnumSubKeysFull(strRoot, strKeyPath))
329end function
330
331
332''
333' Gets the commandline used to invoke the script.
334function GetCommandline()
335 dim str, i
336
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)
341 if str = "" then
342 str = """"""
343 elseif (InStr(1, str, " ")) then
344 str = """" & str & """"
345 end if
346 GetCommandline = GetCommandline & " " & str
347 next
348end function
349
350
351''
352' Gets an environment variable.
353function EnvGet(strName)
354 EnvGet = g_objShell.Environment("PROCESS")(strName)
355end function
356
357
358''
359' Sets an environment variable.
360sub EnvSet(strName, strValue)
361 g_objShell.Environment("PROCESS")(strName) = strValue
362 LogPrint "EnvSet: " & strName & "=" & strValue
363end sub
364
365
366''
367' Appends a string to an environment variable
368sub EnvAppend(strName, strValue)
369 dim str
370 str = g_objShell.Environment("PROCESS")(strName)
371 g_objShell.Environment("PROCESS")(strName) = str & strValue
372 LogPrint "EnvAppend: " & strName & "=" & str & strValue
373end sub
374
375
376''
377' Prepends a string to an environment variable
378sub EnvPrepend(strName, strValue)
379 dim str
380 str = g_objShell.Environment("PROCESS")(strName)
381 g_objShell.Environment("PROCESS")(strName) = strValue & str
382 LogPrint "EnvPrepend: " & strName & "=" & strValue & str
383end sub
384
385''
386' Gets the first non-empty environment variable of the given two.
387function EnvGetFirst(strName1, strName2)
388 EnvGetFirst = g_objShell.Environment("PROCESS")(strName1)
389 if EnvGetFirst = "" then
390 EnvGetFirst = g_objShell.Environment("PROCESS")(strName2)
391 end if
392end function
393
394
395''
396' Get the path of the parent directory. Returns root if root was specified.
397' Expects abs path.
398function PathParent(str)
399 PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
400end function
401
402
403''
404' Strips the filename from at path.
405function PathStripFilename(str)
406 PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
407end function
408
409
410''
411' Get the abs path, use the short version if necessary.
412function PathAbs(str)
413 strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
414 strParent = g_objFileSys.GetParentFolderName(strAbs)
415 if strParent = "" then
416 PathAbs = strAbs
417 else
418 strParent = PathAbs(strParent) ' Recurse to resolve parent paths.
419 PathAbs = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
420
421 dim obj
422 set obj = Nothing
423 if FileExists(PathAbs) then
424 set obj = g_objFileSys.GetFile(PathAbs)
425 elseif DirExists(PathAbs) then
426 set obj = g_objFileSys.GetFolder(PathAbs)
427 end if
428
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 _
435 then
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 _
440 then
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...)"
445 end if
446 else
447 PathAbs = g_objFileSys.BuildPath(strParent, objSub.Name)
448 end if
449 exit for
450 end if
451 next
452 end if
453 end if
454end function
455
456
457''
458' Get the abs path, use the long version.
459function PathAbsLong(str)
460 strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
461 strParent = g_objFileSys.GetParentFolderName(strAbs)
462 if strParent = "" then
463 PathAbsLong = strAbs
464 else
465 strParent = PathAbsLong(strParent) ' Recurse to resolve parent paths.
466 PathAbsLong = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
467
468 dim obj
469 set obj = Nothing
470 if FileExists(PathAbsLong) then
471 set obj = g_objFileSys.GetFile(PathAbsLong)
472 elseif DirExists(PathAbsLong) then
473 set obj = g_objFileSys.GetFolder(PathAbsLong)
474 end if
475
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)
480 exit for
481 end if
482 next
483 end if
484 end if
485end function
486
487
488''
489' Executes a command in the shell catching output in g_strShellOutput
490function Shell(strCommand, blnBoth)
491 dim strShell, strCmdline, objExec, str
492
493 strShell = g_objShell.ExpandEnvironmentStrings("%ComSpec%")
494 if blnBoth = true then
495 strCmdline = strShell & " /c " & strCommand & " 2>&1"
496 else
497 strCmdline = strShell & " /c " & strCommand & " 2>nul"
498 end if
499
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
505 Wscript.Sleep 20
506 g_strShellOutput = g_strShellOutput & objExec.StdOut.ReadAll()
507 objExec.StdErr.ReadAll()
508 loop
509
510 LogPrint "# Status: " & objExec.ExitCode
511 LogPrint "# Start of Output"
512 LogPrint g_strShellOutput
513 LogPrint "# End of Output"
514
515 Shell = objExec.ExitCode
516end function
517
518
519''
520' Try find the specified file in the path.
521function Which(strFile)
522 dim strPath, iStart, iEnd, str
523
524 ' the path
525 strPath = EnvGet("Path")
526 iStart = 1
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
533 Which = str
534 exit function
535 end if
536 end if
537 iStart = iEnd + 1
538 loop
539
540 ' registry or somewhere?
541
542 Which = ""
543end function
544
545
546''
547' Append text to the log file and echo it to stdout
548sub Print(str)
549 LogPrint str
550 Wscript.Echo str
551end sub
552
553
554''
555' Prints a test header
556sub PrintHdr(strTest)
557 LogPrint "***** Checking for " & strTest & " *****"
558 Wscript.Echo "Checking for " & StrTest & "..."
559end sub
560
561
562''
563' Prints a success message
564sub PrintResultMsg(strTest, strResult)
565 LogPrint "** " & strTest & ": " & strResult
566 Wscript.Echo " Found "& strTest & ": " & strResult
567end sub
568
569
570''
571' Prints a successfully detected path
572sub 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) & ")"
577 else
578 LogPrint "** " & strTest & ": " & strPath
579 Wscript.Echo " Found " & strTest & ": " & strPath
580 end if
581end sub
582
583
584''
585' Warning message.
586sub MsgWarning(strMsg)
587 Print "warning: " & strMsg
588end sub
589
590
591''
592' Fatal error.
593sub MsgFatal(strMsg)
594 Print "fatal error: " & strMsg
595 Wscript.Quit
596end sub
597
598
599''
600' Error message, fatal unless flag to ignore errors is given.
601sub MsgError(strMsg)
602 Print "error: " & strMsg
603 if g_blnInternalMode = False then
604 Wscript.Quit
605 end if
606end sub
607
608
609''
610' Write a log header with some basic info.
611sub LogInit
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)
616 next
617 if Wscript.Arguments.Count = 0 then
618 LogPrint "# No arguments given"
619 end if
620 LogPrint "# Reconstructed command line: " & GetCommandline()
621
622 ' some Wscript stuff
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
630 LogPrint "#"
631
632
633 ' the environment
634 LogPrint "# Environment:"
635 dim objEnv
636 for each strVar in g_objShell.Environment("PROCESS")
637 LogPrint "# " & strVar
638 next
639 LogPrint "#"
640end sub
641
642
643''
644' Append text to the log file.
645sub LogPrint(str)
646 FileAppendLine g_strLogFile, str
647 'Wscript.Echo "dbg: " & str
648end sub
649
650
651''
652' Checks if the file exists and logs failures.
653function LogFileExists(strPath, strFilename)
654 LogFileExists = FileExists(strPath & "/" & strFilename)
655 if LogFileExists = False then
656 LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
657 end if
658
659end function
660
661
662''
663' Finds the first file matching the pattern.
664' If no file is found, log the failure.
665function LogFindFile(strPath, strPattern)
666 dim str
667
668 '
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...
672 '
673 if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
674 And InStr(1, g_strShellOutput, Chr(13)) > 1 _
675 then
676 ' return the first word.
677 LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
678 else
679 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
680 LogFindFile = ""
681 end if
682end function
683
684
685''
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.
689function LogFindDir(strPath, strPattern)
690 dim str
691
692 '
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...
696 '
697
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 _
701 then
702 ' return the first word.
703 LogFindDir = strPath & "/" & Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
704 else
705 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
706 LogFindDir = ""
707 end if
708end function
709
710
711''
712' Initializes the config file.
713sub CfgInit
714 FileDelete g_strCfgFile
715 CfgPrint "# -*- Makefile -*-"
716 CfgPrint "#"
717 CfgPrint "# Build configuration generated by " & GetCommandline()
718 CfgPrint "#"
719 if g_blnInternalMode = False then
720 CfgPrint "VBOX_OSE := 1"
721 end if
722end sub
723
724
725''
726' Prints a string to the config file.
727sub CfgPrint(str)
728 FileAppendLine g_strCfgFile, str
729end sub
730
731
732''
733' Initializes the environment batch script.
734sub EnvInit
735 FileDelete g_strEnvFile
736 EnvPrint "@echo off"
737 EnvPrint "rem"
738 EnvPrint "rem Environment setup script generated by " & GetCommandline()
739 EnvPrint "rem"
740end sub
741
742
743''
744' Prints a string to the environment batch script.
745sub EnvPrint(str)
746 FileAppendLine g_strEnvFile, str
747end sub
748
749
750''
751' No COM
752sub 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"
762 end if
763end sub
764
765
766''
767' No UDPTunnel
768sub 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="
774 end if
775end sub
776
777
778''
779' Checks the the path doesn't contain characters the tools cannot deal with.
780sub CheckSourcePath
781 dim sPwd
782
783 sPwd = PathAbs(g_strPath)
784 if InStr(1, sPwd, " ") > 0 then
785 MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
786 end if
787 if InStr(1, sPwd, "$") > 0 then
788 MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
789 end if
790 if InStr(1, sPwd, "%") > 0 then
791 MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
792 end if
793 if InStr(1, sPwd, Chr(10)) > 0 _
794 Or InStr(1, sPwd, Chr(13)) > 0 _
795 Or InStr(1, sPwd, Chr(9)) > 0 _
796 then
797 MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
798 end if
799 Print "Source path: OK"
800end sub
801
802
803''
804' Checks for kBuild - very simple :)
805sub CheckForkBuild(strOptkBuild)
806 PrintHdr "kBuild"
807
808 '
809 ' Check if there is a 'kmk' in the path somewhere without
810 ' any KBUILD_*PATH stuff around.
811 '
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."
826 end if
827
828 '
829 ' Check for the KBUILD_PATH env.var. and fall back on root/kBuild otherwise.
830 '
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 & ")"
835 g_strPathkBuild = ""
836 end if
837
838 if g_strPathkBuild = "" then
839 g_strPathkBuild = g_strPath & "/kBuild"
840 end if
841 end if
842
843 g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
844
845 '
846 ' Check for env.vars that kBuild uses (do this early to set g_strTargetArch).
847 '
848 str = EnvGetFirst("KBUILD_TYPE", "BUILD_TYPE")
849 if (str <> "") _
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'."
854 end if
855
856 str = EnvGetFirst("KBUILD_TARGET", "BUILD_TARGET")
857 if (str <> "") _
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'."
862 end if
863
864 str = EnvGetFirst("KBUILD_TARGET_ARCH", "BUILD_TARGET_ARCH")
865 if (str <> "") _
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'."
870 str = "x86"
871 end if
872 if str <> "" then
873 g_strTargetArch = str
874 elseif (EnvGet("PROCESSOR_ARCHITEW6432") = "AMD64" ) _
875 Or (EnvGet("PROCESSOR_ARCHITECTURE") = "AMD64" ) then
876 g_strTargetArch = "amd64"
877 else
878 g_strTargetArch = "x86"
879 end if
880
881 str = EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
882 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
883 if (str <> "") _
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'."
888 end if
889
890 str = EnvGetFirst("KBUILD_HOST", "BUILD_PLATFORM")
891 if (str <> "") _
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'."
896 end if
897
898 str = EnvGetFirst("KBUILD_HOST_ARCH", "BUILD_PLATFORM_ARCH")
899 if (str <> "") _
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'."
904 end if
905
906 str = EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
907 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
908 if (str <> "") _
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'."
913 end if
914
915 '
916 ' Determin the location of the kBuild binaries.
917 '
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"
922 end if
923 end if
924
925 '
926 ' Perform basic validations of the kBuild installation.
927 '
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."
933 exit sub
934 end if
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."
939 exit sub
940 end if
941
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."
944 exit sub
945 end if
946
947 '
948 ' If PATH_DEV is set, check that it's pointing to something useful.
949 '
950 str = EnvGet("PATH_DEV")
951 g_strPathDev = str
952 if (str <> "") _
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
959 end if
960 if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
961
962 '
963 ' Write KBUILD_PATH to the environment script if necessary.
964 '
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 & ";"
970 end if
971
972 PrintResult "kBuild", g_strPathkBuild
973 PrintResult "kBuild binaries", g_strPathkBuildBin
974end sub
975
976
977''
978' Checks for Visual C++ version 10 (2010).
979sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
980 dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
981 PrintHdr "Visual C++"
982
983 '
984 ' Try find it...
985 '
986 strPathVC = ""
987 strPathVCCommon = ""
988 if (strPathVC = "") And (strOptVC <> "") then
989 if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
990 strPathVC = strOptVC
991 strPathVCCommon = strOptVCCommon
992 end if
993 end if
994
995 if (strPathVC = "") And (g_blnInternalFirst = True) Then
996 strPathVC = g_strPathDev & "/win.x86/vcc/v10sp1"
997 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
998 strPathVC = ""
999 end if
1000 end if
1001
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 & ")."
1008 else
1009 strPathVC = PathParent(PathStripFilename(str))
1010 strPathVCCommon = PathParent(strPathVC) & "/Common7"
1011 end if
1012 end if
1013
1014 if (strPathVC = "") then
1015 str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1016 if str <> "" Then
1017 str2 = str & "Common7"
1018 str = str & "VC"
1019 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1020 strPathVC = str
1021 strPathVCCommon = str2
1022 end if
1023 end if
1024 end if
1025
1026 if (strPathVC = "") then
1027 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1028 if str <> "" Then
1029 str2 = str & "Common7"
1030 str = str & "VC"
1031 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1032 strPathVC = str
1033 strPathVCCommon = str2
1034 end if
1035 end if
1036 end if
1037
1038 if (strPathVC = "") And (g_blnInternalFirst = False) Then
1039 strPathVC = g_strPathDev & "/win.x86/vcc/v10sp1"
1040 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
1041 strPathVC = ""
1042 end if
1043 end if
1044
1045 if strPathVC = "" then
1046 MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
1047 exit sub
1048 end if
1049
1050 '
1051 ' Clean up the path and determin the VC directory.
1052 '
1053 strPathVC = UnixSlashes(PathAbs(strPathVC))
1054 g_strPathVCC = strPathVC
1055
1056 '
1057 ' Check the version.
1058 ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
1059 '
1060 if (strPathVCCommon <> "") Then
1061 EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
1062 end if
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."
1065 exit sub
1066 end if
1067
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."
1071 exit sub
1072 end if
1073
1074 '
1075 ' Ok, emit build config variables.
1076 '
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
1094 else
1095 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1096 DisableCOM "No ATL"
1097 PrintResult "Visual C++ v10 (or later) without ATL", g_strPathVCC
1098 end if
1099
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"
1106
1107 else
1108 MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 10.0 or 11.0. Check the build requirements."
1109 exit sub
1110 end if
1111
1112 ' and the env.bat path fix.
1113 if strPathVCCommon <> "" then
1114 EnvPrint "set PATH=%PATH%;" & strPathVCCommon & "/IDE;"
1115 end if
1116end sub
1117
1118''
1119' Checks if the specified path points to a usable PSDK.
1120function 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") _
1129 then
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")) _
1135 Then
1136 '' @todo figure out a way we can verify the version/build!
1137 CheckForVisualCPPSub = True
1138 end if
1139 end if
1140end function
1141
1142
1143''
1144' Checks for a platform SDK that works with the compiler
1145sub CheckForPlatformSDK(strOptSDK)
1146 dim strPathPSDK, str
1147 PrintHdr "Windows Platform SDK (recent)"
1148
1149 strPathPSDK = ""
1150
1151 ' Check the supplied argument first.
1152 str = strOptSDK
1153 if str <> "" then
1154 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1155 end if
1156
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
1161 end if
1162
1163 if strPathPSDK = "" And g_blnInternalFirst then
1164 str = g_strPathDev & "/win.x86/sdk/v8.0"
1165 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1166 end if
1167
1168 ' Look for it in the environment
1169 str = EnvGet("MSSdk")
1170 if strPathPSDK = "" And str <> "" then
1171 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1172 end if
1173
1174 str = EnvGet("Mstools")
1175 if strPathPSDK = "" And str <> "" then
1176 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1177 end if
1178
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
1183 end if
1184
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
1191 end if
1192 Next
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
1198 end if
1199 Next
1200
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
1205 end if
1206
1207 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1208 str = g_strPathDev & "/win.x86/sdk/v8.0"
1209 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1210 end if
1211
1212 ' Give up.
1213 if strPathPSDK = "" then
1214 MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
1215 exit sub
1216 end if
1217
1218 '
1219 ' Emit the config.
1220 '
1221 strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
1222 CfgPrint "PATH_SDK_WINPSDK" & g_strVerPSDK & " := " & strPathPSDK
1223 CfgPrint "VBOX_WINPSDK := WINPSDK" & g_strVerPSDK
1224
1225 PrintResult "Windows Platform SDK (v" & g_strVerPSDK & ")", strPathPSDK
1226 g_strPathPSDK = strPathPSDK
1227end sub
1228
1229''
1230' Checks if the specified path points to a usable PSDK.
1231function 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 _
1239 then
1240 if InStr(1, g_strShellOutput, "Resource Compiler Version 6.2.") > 0 then
1241 g_strVerPSDK = "80"
1242 CheckForPlatformSDKSub = True
1243 elseif InStr(1, g_strShellOutput, "Resource Compiler Version 6.1.") > 0 then
1244 g_strVerPSDK = "71"
1245 CheckForPlatformSDKSub = True
1246 end if
1247 end if
1248end function
1249
1250
1251''
1252' Checks for a Windows 7 Driver Kit.
1253sub CheckForWinDDK(strOptDDK)
1254 dim strPathDDK, str, strSubKeys
1255 PrintHdr "Windows DDK v7.1"
1256
1257 '
1258 ' Find the DDK.
1259 '
1260 strPathDDK = ""
1261 ' The specified path.
1262 if strPathDDK = "" And strOptDDK <> "" then
1263 if CheckForWinDDKSub(strOptDDK, True) then strPathDDK = strOptDDK
1264 end if
1265
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
1270 end if
1271
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
1277 end if
1278
1279 str = EnvGet("BASEDIR")
1280 if strPathDDK = "" And str <> "" then
1281 if CheckForWinDDKSub(str, True) then strPathDDK = str
1282 end if
1283
1284 ' Some array constants to ease the work.
1285 arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
1286 arrRoots = array("HKLM", "HKCU")
1287
1288 ' Windows 7 WDK.
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")
1294 if str <> "" then
1295 arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
1296 end if
1297 next
1298 next
1299 next
1300 arrLocations = ArrayRSortStrings(arrLocations)
1301
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
1306 end if
1307 next
1308
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
1313 end if
1314
1315 ' Give up.
1316 if strPathDDK = "" then
1317 MsgError "Cannot find the Windows DDK v7.1. Check configure.log and the build requirements."
1318 exit sub
1319 end if
1320
1321 '
1322 ' Emit the config.
1323 '
1324 strPathDDK = UnixSlashes(PathAbs(strPathDDK))
1325 CfgPrint "PATH_SDK_WINDDK71 := " & strPathDDK
1326
1327 PrintResult "Windows DDK v7.1", strPathDDK
1328 g_strPathDDK = strPathDDK
1329end sub
1330
1331'' Quick check if the DDK is in the specified directory or not.
1332function 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") _
1342 then
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
1349 end if
1350 end if
1351end function
1352
1353
1354''
1355' Finds midl.exe
1356sub CheckForMidl()
1357 dim strMidl
1358 PrintHdr "Midl.exe"
1359
1360 ' Skip if no COM/ATL.
1361 if g_blnDisableCOM then
1362 PrintResultMsg "Midl", "Skipped (" & g_strDisableCOM & ")"
1363 exit sub
1364 end if
1365
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"
1376 else
1377 MsgWarning "Midl.exe not found!"
1378 exit sub
1379 end if
1380
1381 CfgPrint "VBOX_MAIN_IDL := " & strMidl
1382 PrintResult "Midl.exe", strMidl
1383end sub
1384
1385
1386''
1387' Checks for a recent DirectX SDK.
1388sub CheckForDirectXSDK(strOptDXSDK)
1389 dim strPathDXSDK, str, arrSubKeys, arrSubKeys2, strKey, strKey2
1390 PrintHdr "Direct X SDK"
1391
1392 '
1393 ' Find the DX SDK.
1394 '
1395 strPathDXSDK = ""
1396 ' The specified path.
1397 if (strPathDXSDK = "") And (strOptDXSDK <> "") then
1398 if CheckForDirectXSDKSub(strOptDXSDK) then strPathDXSDK = strOptDXSDK
1399 end if
1400
1401 ' The tools location (first).
1402 if (strPathDXSDK = "") And (g_blnInternalFirst = True) then
1403 str = g_strPathDev & "/win.x86/dxsdk/200610"
1404 if CheckForDirectXSDKSub(str) then strPathDXSDK = str
1405 end if
1406
1407 ' Check the installer registry (sucks a bit).
1408 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData")
1409 for Each strSubKey In arrSubKeys
1410 strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" & strSubKey & "\Products"
1411 arrSubKeys2 = RegEnumSubKeys("HKLM", strKey)
1412 for Each strSubKey2 In arrSubKeys2
1413 strKey2 = "HKLM\" & strKey & "\" & strSubKey2 & "\InstallProperties"
1414 str = RegGetString(strKey2 & "\DisplayName")
1415 if InStr(1, str, "Microsoft DirectX SDK") > 0 then
1416 str = RegGetString(strKey2 & "\InstallLocation")
1417 if (str <> "") And (strPathDXSDK = "") then
1418 if CheckForDirectXSDKSub(str) then
1419 strPathDXSDK = str
1420 Exit For
1421 end if
1422 end if
1423 end if
1424 Next
1425 Next
1426
1427 ' The tools location (post).
1428 if (strPathDXSDK = "") And (g_blnInternalFirst = False) then
1429 str = g_strPathDev & "/win.x86/dxsdk/200610"
1430 if CheckForDirectXSDKSub(str) then strPathDXSDK = str
1431 end if
1432
1433 ' Give up.
1434 if strPathDXSDK = "" then
1435 MsgError "Cannot find a suitable Direct X SDK. Check configure.log and the build requirements."
1436 exit sub
1437 end if
1438
1439 '
1440 ' Emit the config.
1441 '
1442 strPathDXSDK = UnixSlashes(PathAbs(strPathDXSDK))
1443 CfgPrint "PATH_SDK_DXSDK := " & strPathDXSDK
1444 CfgPrint "PATH_SDK_DXSDKX86 := $(PATH_SDK_DXSDK)"
1445 CfgPrint "PATH_SDK_DXSDKAMD64 := $(PATH_SDK_DXSDK)"
1446
1447 PrintResult "Direct X SDK", strPathDXSDK
1448end sub
1449
1450'' Quick check if the DXSDK is in the specified directory or not.
1451function CheckForDirectXSDKSub(strPathDXSDK)
1452 CheckForDirectXSDKSub = False
1453 LogPrint "trying: strPathDXSDK=" & strPathDXSDK
1454 if LogFileExists(strPathDXSDK, "Lib/x86/dxguid.lib") _
1455 then
1456 '' @todo figure out a way we can verify the version/build!
1457 CheckForDirectXSDKSub = True
1458 end if
1459end function
1460
1461
1462''
1463' Checks for a MingW32 suitable for building the recompiler.
1464'
1465' strOptW32API is currently ignored.
1466'
1467sub CheckForMingW(strOptMingw, strOptW32API)
1468 dim strPathMingW, strPathW32API, str
1469 PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API"
1470
1471 '
1472 ' Find the MinGW and W32API tools.
1473 '
1474 strPathMingW = ""
1475 strPathW32API = ""
1476
1477 ' The specified path.
1478 if (strPathMingW = "") And (strOptMingW <> "") then
1479 if CheckForMingWSub(strOptMingW, strOptW32API) then
1480 strPathMingW = strOptMingW
1481 strPathW32API = strOptW32API
1482 end if
1483 end if
1484
1485 ' The tools location (first).
1486 if (strPathMingW = "") And (g_blnInternalFirst = True) then
1487 str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
1488 str2 = g_strPathDev & "/win.x86/w32api/v2.5"
1489 if CheckForMingWSub(str, str2) then
1490 strPathMingW = str
1491 strPathW32API = str2
1492 end if
1493 end if
1494
1495 ' See if there is any gcc around.
1496 if strPathMingW = "" then
1497 str = Which("mingw32-gcc.exe")
1498 if (str <> "") then
1499 str = PathParent(PathStripFilename(str))
1500 if CheckForMingWSub(str, str) then strPathMingW = str
1501 end if
1502 end if
1503
1504 if strPathMingW = "" then
1505 str = Which("gcc.exe")
1506 if (str <> "") then
1507 str = PathParent(PathStripFilename(str))
1508 if CheckForMingWSub(str, str) then strPathMingW = str
1509 end if
1510 end if
1511
1512 ' The tools location (post).
1513 if (strPathMingW = "") And (g_blnInternalFirst = False) then
1514 str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
1515 str2 = g_strPathDev & "/win.x86/w32api/v2.5"
1516 if CheckForMingWSub(str, str2) then
1517 strPathMingW = str
1518 strPathW32API = str2
1519 end if
1520 end if
1521
1522 ' Success?
1523 if strPathMingW = "" then
1524 if strOptMingw = "" then
1525 MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
1526 & "the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements."
1527 else
1528 MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements."
1529 end if
1530 exit sub
1531 end if
1532
1533 '
1534 ' Emit the config.
1535 '
1536 strPathMingW = UnixSlashes(PathAbs(strPathMingW))
1537 CfgPrint "PATH_TOOL_MINGW32 := " & strPathMingW
1538 PrintResult "MinGW (GCC v" & g_strSubOutput & ")", strPathMingW
1539 if (strPathMingW = strPathW32API) Or strPathW32API = "" then
1540 CfgPrint "PATH_SDK_W32API := $(PATH_TOOL_MINGW32)"
1541 else
1542 CfgPrint "PATH_SDK_W32API := " & strPathW32API
1543 PrintResult "W32API", strPathW32API
1544 end if
1545end sub
1546
1547''
1548' Checks if the specified path points to an usable MinGW or not.
1549function CheckForMingWSub(strPathMingW, strPathW32API)
1550 g_strSubOutput = ""
1551 if strPathW32API = "" then strPathW32API = strPathMingW
1552 LogPrint "trying: strPathMingW=" &strPathMingW & " strPathW32API=" & strPathW32API
1553
1554 if LogFileExists(strPathMingW, "bin/mingw32-gcc.exe") _
1555 And LogFileExists(strPathMingW, "bin/ld.exe") _
1556 And LogFileExists(strPathMingW, "bin/objdump.exe") _
1557 And LogFileExists(strPathMingW, "bin/dllwrap.exe") _
1558 And LogFileExists(strPathMingW, "bin/as.exe") _
1559 And LogFileExists(strPathMingW, "include/string.h") _
1560 And LogFileExists(strPathMingW, "include/_mingw.h") _
1561 And LogFileExists(strPathMingW, "lib/dllcrt1.o") _
1562 And LogFileExists(strPathMingW, "lib/dllcrt2.o") _
1563 And LogFileExists(strPathMingW, "lib/libmsvcrt.a") _
1564 _
1565 And LogFileExists(strPathW32API, "lib/libkernel32.a") _
1566 And LogFileExists(strPathW32API, "include/windows.h") _
1567 then
1568 if Shell(DosSlashes(strPathMingW & "/bin/gcc.exe") & " --version", True) = 0 then
1569 dim offVer, iMajor, iMinor, iPatch, strVer
1570
1571 ' extract the version.
1572 strVer = ""
1573 offVer = InStr(1, g_strShellOutput, "(GCC) ")
1574 if offVer > 0 then
1575 strVer = LTrim(Mid(g_strShellOutput, offVer + Len("(GCC) ")))
1576 strVer = RTrim(Left(strVer, InStr(1, strVer, " ")))
1577 if (Mid(strVer, 2, 1) = ".") _
1578 And (Mid(strVer, 4, 1) = ".") then
1579 iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
1580 iMinor = Int(Mid(strVer, 3, 1))
1581 iPatch = Int(Mid(strVer, 5))
1582 else
1583 LogPrint "Malformed version: '" & strVer & "'"
1584 strVer = ""
1585 end if
1586 end if
1587 if strVer <> "" then
1588 if (iMajor = 3) And (iMinor = 3) then
1589 CheckForMingWSub = True
1590 g_strSubOutput = strVer
1591 else
1592 LogPrint "MinGW version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
1593 end if
1594 else
1595 LogPrint "Couldn't locate the GCC version in the output!"
1596 end if
1597
1598 else
1599 LogPrint "Failed to run gcc.exe!"
1600 end if
1601 end if
1602end function
1603
1604
1605''
1606' Checks for any libSDL binaries.
1607sub CheckForlibSDL(strOptlibSDL)
1608 dim strPathlibSDL, str
1609 PrintHdr "libSDL"
1610
1611 '
1612 ' Try find some SDL library.
1613 '
1614
1615 ' First, the specific location.
1616 strPathlibSDL = ""
1617 if (strPathlibSDL = "") And (strOptlibSDL <> "") then
1618 if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
1619 end if
1620
1621 ' The tools location (first).
1622 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1623 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1624 if CheckForlibSDLSub(str) then strPathlibSDL = str
1625 end if
1626
1627 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1628 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1629 if CheckForlibSDLSub(str) then strPathlibSDL = str
1630 end if
1631
1632 ' Poke about in the path.
1633 str = Which("SDLmain.lib")
1634 if (strPathlibSDL = "") And (str <> "") Then
1635 str = PathParent(PathStripFilename(str))
1636 if CheckForlibSDLSub(str) then strPathlibSDL = str
1637 end if
1638
1639 str = Which("SDL.dll")
1640 if (strPathlibSDL = "") And (str <> "") Then
1641 str = PathParent(PathStripFilename(str))
1642 if CheckForlibSDLSub(str) then strPathlibSDL = str
1643 end if
1644
1645 ' The tools location (post).
1646 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1647 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1648 if CheckForlibSDLSub(str) then strPathlibSDL = str
1649 end if
1650
1651 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1652 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1653 if CheckForlibSDLSub(str) then strPathlibSDL = str
1654 end if
1655
1656 ' Success?
1657 if strPathlibSDL = "" then
1658 if strOptlibSDL = "" then
1659 MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
1660 & "If still no luck, consult the configure.log and the build requirements."
1661 else
1662 MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
1663 end if
1664 exit sub
1665 end if
1666
1667 strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
1668 CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
1669
1670 PrintResult "libSDL", strPathlibSDL
1671end sub
1672
1673''
1674' Checks if the specified path points to an usable libSDL or not.
1675function CheckForlibSDLSub(strPathlibSDL)
1676 CheckForlibSDLSub = False
1677 LogPrint "trying: strPathlibSDL=" & strPathlibSDL
1678 if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
1679 And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
1680 And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
1681 And LogFileExists(strPathlibSDL, "include/SDL.h") _
1682 And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
1683 And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
1684 then
1685 CheckForlibSDLSub = True
1686 end if
1687end function
1688
1689
1690''
1691' Checks for libxml2.
1692sub CheckForXml2(strOptXml2)
1693 dim strPathXml2, str
1694 PrintHdr "libxml2"
1695
1696 ' Skip if no COM/ATL.
1697 if g_blnDisableCOM then
1698 PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
1699 exit sub
1700 end if
1701
1702 '
1703 ' Try find some xml2 dll/lib.
1704 '
1705 strPathXml2 = ""
1706 if (strPathXml2 = "") And (strOptXml2 <> "") then
1707 if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
1708 end if
1709
1710 if strPathXml2 = "" Then
1711 str = Which("libxml2.lib")
1712 if str <> "" Then
1713 str = PathParent(PathStripFilename(str))
1714 if CheckForXml2Sub(str) then strPathXml2 = str
1715 end if
1716 end if
1717
1718 ' Ignore failure if we're in 'internal' mode.
1719 if (strPathXml2 = "") and g_blnInternalMode then
1720 PrintResultMsg "libxml2", "ignored (internal mode)"
1721 exit sub
1722 end if
1723
1724 ' Success?
1725 if strPathXml2 = "" then
1726 if strOptXml2 = "" then
1727 MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
1728 & "If still no luck, consult the configure.log and the build requirements."
1729 else
1730 MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
1731 end if
1732 exit sub
1733 end if
1734
1735 strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
1736 CfgPrint "SDK_VBOX_LIBXML2_INCS := " & strPathXml2 & "/include"
1737 CfgPrint "SDK_VBOX_LIBXML2_LIBS := " & strPathXml2 & "/lib/libxml2.lib"
1738
1739 PrintResult "libxml2", strPathXml2
1740end sub
1741
1742''
1743' Checks if the specified path points to an usable libxml2 or not.
1744function CheckForXml2Sub(strPathXml2)
1745 dim str
1746
1747 CheckForXml2Sub = False
1748 LogPrint "trying: strPathXml2=" & strPathXml2
1749 if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
1750 And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
1751 then
1752 str = LogFindFile(strPathXml2, "bin/libxml2.dll")
1753 if str <> "" then
1754 if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
1755 CheckForXml2Sub = True
1756 end if
1757 end if
1758 end if
1759end function
1760
1761
1762''
1763' Checks for libxslt.
1764sub CheckForXslt(strOptXslt)
1765 dim strPathXslt, str
1766 PrintHdr "libxslt"
1767
1768 ' Skip if no COM/ATL.
1769 if g_blnDisableCOM then
1770 PrintResultMsg "libxslt", "Skipped (" & g_strDisableCOM & ")"
1771 exit sub
1772 end if
1773
1774 '
1775 ' Try find some libxslt dll/lib.
1776 '
1777 strPathXslt = ""
1778 if (strPathXslt = "") And (strOptXslt <> "") then
1779 if CheckForXsltSub(strOptXslt) then strPathXslt = strOptXslt
1780 end if
1781
1782 if strPathXslt = "" Then
1783 str = Which("libxslt.lib")
1784 if str <> "" Then
1785 str = PathParent(PathStripFilename(str))
1786 if CheckForXsltSub(str) then strPathXslt = str
1787 end if
1788 end if
1789
1790 if strPathXslt = "" Then
1791 str = Which("libxslt.dll")
1792 if str <> "" Then
1793 str = PathParent(PathStripFilename(str))
1794 if CheckForXsltSub(str) then strPathXslt = str
1795 end if
1796 end if
1797
1798 ' Ignore failure if we're in 'internal' mode.
1799 if (strPathXslt = "") and g_blnInternalMode then
1800 PrintResultMsg "libxslt", "ignored (internal mode)"
1801 exit sub
1802 end if
1803
1804 ' Success?
1805 if strPathXslt = "" then
1806 if strOptXslt = "" then
1807 MsgError "Can't locate libxslt. Try specify the path with the --with-libxslt=<path> argument. " _
1808 & "If still no luck, consult the configure.log and the build requirements."
1809 else
1810 MsgError "Can't locate libxslt. Please consult the configure.log and the build requirements."
1811 end if
1812 exit sub
1813 end if
1814
1815 strPathXslt = UnixSlashes(PathAbs(strPathXslt))
1816 CfgPrint "SDK_VBOX_LIBXSLT_INCS := " & strPathXslt & "/include"
1817 CfgPrint "SDK_VBOX_LIBXSLT_LIBS := " & strPathXslt & "/lib/libxslt.lib"
1818
1819 PrintResult "libxslt", strPathXslt
1820end sub
1821
1822
1823''
1824' Checks if the specified path points to an usable libxslt or not.
1825function CheckForXsltSub(strPathXslt)
1826 dim str
1827
1828 CheckForXsltSub = False
1829 LogPrint "trying: strPathXslt=" & strPathXslt
1830
1831 if LogFileExists(strPathXslt, "include/libxslt/namespaces.h") _
1832 And LogFileExists(strPathXslt, "include/libxslt/xsltutils.h") _
1833 then
1834 str = LogFindFile(strPathXslt, "lib/libxslt.dll")
1835 if str <> "" then
1836 if LogFileExists(strPathXslt, "lib/libxslt.lib") _
1837 then
1838 CheckForXsltSub = True
1839 end if
1840 end if
1841 end if
1842end function
1843
1844
1845''
1846' Checks for openssl
1847sub CheckForSsl(strOptSsl)
1848 dim strPathSsl, str
1849 PrintHdr "openssl"
1850
1851 '
1852 ' Try find some openssl dll/lib.
1853 '
1854 strPathSsl = ""
1855 if (strPathSsl = "") And (strOptSsl <> "") then
1856 if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
1857 end if
1858
1859 if strPathSsl = "" Then
1860 str = Which("ssleay32.lib")
1861 if str <> "" Then
1862 str = PathParent(PathStripFilename(str))
1863 if CheckForSslSub(str) then strPathSsl = str
1864 end if
1865 end if
1866
1867 ' Ignore failure if we're in 'internal' mode.
1868 if (strPathSsl = "") and g_blnInternalMode then
1869 PrintResultMsg "openssl", "ignored (internal mode)"
1870 exit sub
1871 end if
1872
1873 ' Success?
1874 if strPathSsl = "" then
1875 if strOptSsl = "" then
1876 MsgError "Can't locate openssl. Try specify the path with the --with-openssl=<path> argument. " _
1877 & "If still no luck, consult the configure.log and the build requirements."
1878 else
1879 MsgError "Can't locate openssl. Please consult the configure.log and the build requirements."
1880 end if
1881 exit sub
1882 end if
1883
1884 strPathSsl = UnixSlashes(PathAbs(strPathSsl))
1885 CfgPrint "SDK_VBOX_OPENSSL_INCS := " & strPathSsl & "/include"
1886 CfgPrint "SDK_VBOX_OPENSSL_LIBS := " & strPathSsl & "/lib/ssleay32.lib" & " " & strPathSsl & "/lib/libeay32.lib"
1887 CfgPrint "SDK_VBOX_BLD_OPENSSL_LIBS := " & strPathSsl & "/lib/ssleay32.lib" & " " & strPathSsl & "/lib/libeay32.lib"
1888
1889 PrintResult "openssl", strPathSsl
1890end sub
1891
1892''
1893' Checks if the specified path points to an usable openssl or not.
1894function CheckForSslSub(strPathSsl)
1895
1896 CheckForSslSub = False
1897 LogPrint "trying: strPathSsl=" & strPathSsl
1898 if LogFileExists(strPathSsl, "include/openssl/md5.h") _
1899 And LogFindFile(strPathSsl, "bin/ssleay32.dll") <> "" _
1900 And LogFindFile(strPathSsl, "lib/ssleay32.lib") <> "" _
1901 And LogFindFile(strPathSsl, "bin/libeay32.dll") <> "" _
1902 And LogFindFile(strPathSsl, "lib/libeay32.lib") <> "" _
1903 then
1904 CheckForSslSub = True
1905 end if
1906end function
1907
1908
1909''
1910' Checks for libcurl
1911sub CheckForCurl(strOptCurl)
1912 dim strPathCurl, str
1913 PrintHdr "libcurl"
1914
1915 '
1916 ' Try find some cURL dll/lib.
1917 '
1918 strPathCurl = ""
1919 if (strPathCurl = "") And (strOptCurl <> "") then
1920 if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
1921 end if
1922
1923 if strPathCurl = "" Then
1924 str = Which("libcurl.lib")
1925 if str <> "" Then
1926 str = PathParent(PathStripFilename(str))
1927 if CheckForCurlSub(str) then strPathCurl = str
1928 end if
1929 end if
1930
1931 ' Ignore failure if we're in 'internal' mode.
1932 if (strPathCurl = "") and g_blnInternalMode then
1933 PrintResultMsg "curl", "ignored (internal mode)"
1934 exit sub
1935 end if
1936
1937 ' Success?
1938 if strPathCurl = "" then
1939 if strOptCurl = "" then
1940 MsgError "Can't locate libcurl. Try specify the path with the --with-libcurl=<path> argument. " _
1941 & "If still no luck, consult the configure.log and the build requirements."
1942 else
1943 MsgError "Can't locate libcurl. Please consult the configure.log and the build requirements."
1944 end if
1945 exit sub
1946 end if
1947
1948 strPathCurl = UnixSlashes(PathAbs(strPathCurl))
1949 CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
1950 CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
1951
1952 PrintResult "libcurl", strPathCurl
1953end sub
1954
1955''
1956' Checks if the specified path points to an usable libcurl or not.
1957function CheckForCurlSub(strPathCurl)
1958
1959 CheckForCurlSub = False
1960 LogPrint "trying: strPathCurl=" & strPathCurl
1961 if LogFileExists(strPathCurl, "include/curl/curl.h") _
1962 And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
1963 And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
1964 then
1965 CheckForCurlSub = True
1966 end if
1967end function
1968
1969
1970
1971''
1972' Checks for any Qt4 binaries.
1973sub CheckForQt4(strOptQt4)
1974 dim strPathQt4
1975
1976 PrintHdr "Qt4"
1977
1978 '
1979 ' Try to find the Qt4 installation (user specified path with --with-qt4)
1980 '
1981 strPathQt4 = ""
1982
1983 LogPrint "Checking for user specified path of Qt4 ... "
1984 if (strPathQt4 = "") And (strOptQt4 <> "") then
1985 strOptQt4 = UnixSlashes(strOptQt4)
1986 if CheckForQt4Sub(strOptQt4) then strPathQt4 = strOptQt4
1987 end if
1988
1989 ' Check the dev tools
1990 if (strPathQt4 = "") Then
1991 strPathQt4 = g_strPathDev & "/win." & g_strTargetArch & "/qt/v4.7.3-vcc100"
1992 if CheckForQt4Sub(strPathQt4) = False then strPathQt4 = ""
1993 end if
1994
1995 ' Display the result.
1996 if strPathQt4 = "" then
1997 CfgPrint "VBOX_WITH_QT4GUI="
1998 PrintResultMsg "Qt4", "not found"
1999 else
2000 CfgPrint "PATH_SDK_QT4 := " & strPathQt4
2001 CfgPrint "PATH_TOOL_QT4 := $(PATH_SDK_QT4)"
2002 CfgPrint "VBOX_PATH_QT4 := $(PATH_SDK_QT4)"
2003 PrintResult "Qt4 ", strPathQt4
2004 end if
2005end sub
2006
2007
2008''
2009' Checks if the specified path points to an usable Qt library.
2010function CheckForQt4Sub(strPathQt4)
2011
2012 CheckForQt4Sub = False
2013 LogPrint "trying: strPathQt4=" & strPathQt4
2014
2015 if LogFileExists(strPathQt4, "bin/moc.exe") _
2016 And LogFileExists(strPathQt4, "bin/uic.exe") _
2017 And LogFileExists(strPathQt4, "include/Qt/qwidget.h") _
2018 And LogFileExists(strPathQt4, "include/QtGui/QApplication") _
2019 And LogFileExists(strPathQt4, "include/QtNetwork/QHostAddress") _
2020 And ( LogFileExists(strPathQt4, "lib/QtCore4.lib") _
2021 Or LogFileExists(strPathQt4, "lib/VBoxQtCore4.lib") _
2022 Or LogFileExists(strPathQt4, "lib/QtCoreVBox4.lib")) _
2023 And ( LogFileExists(strPathQt4, "lib/QtNetwork4.lib") _
2024 Or LogFileExists(strPathQt4, "lib/VBoxQtNetwork4.lib") _
2025 Or LogFileExists(strPathQt4, "lib/QtNetworkVBox4.lib")) _
2026 then
2027 CheckForQt4Sub = True
2028 end if
2029
2030end function
2031
2032
2033'
2034'
2035function CheckForPython(strPathPython)
2036
2037 PrintHdr "Python"
2038
2039 CheckForPython = False
2040 LogPrint "trying: strPathPython=" & strPathPython
2041
2042 if LogFileExists(strPathPython, "python.exe") then
2043 CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe"
2044 CheckForPython = True
2045 end if
2046
2047 PrintResult "Python ", strPathPython
2048end function
2049
2050
2051'
2052'
2053function CheckForMkisofs(strFnameMkisofs)
2054
2055 PrintHdr "mkisofs"
2056
2057 CheckForMkisofs = False
2058 LogPrint "trying: strFnameMkisofs=" & strFnameMkisofs
2059
2060 if FileExists(strFnameMkisofs) = false then
2061 LogPrint "Testing '" & strFnameMkisofs & " not found"
2062 else
2063 CfgPrint "VBOX_MKISOFS := " & strFnameMkisofs
2064 CheckForMkisofs = True
2065 end if
2066
2067 PrintResult "mkisofs ", strFnameMkisofs
2068end function
2069
2070
2071''
2072' Show usage.
2073sub usage
2074 Print "Usage: cscript configure.vbs [options]"
2075 Print ""
2076 Print "Configuration:"
2077 Print " -h, --help"
2078 Print " --internal"
2079 Print " --internal-last"
2080 Print ""
2081 Print "Components:"
2082 Print " --disable-COM"
2083 Print " --disable-UDPTunnel"
2084 Print ""
2085 Print "Locations:"
2086 Print " --with-DDK=PATH "
2087 Print " --with-DXSDK=PATH "
2088 Print " --with-kBuild=PATH "
2089 Print " --with-libSDL=PATH "
2090 Print " --with-MinGW=PATH "
2091 Print " --with-Qt4=PATH "
2092 Print " --with-SDK=PATH "
2093 Print " --with-VC=PATH "
2094 Print " --with-VC-Common=PATH "
2095 Print " --with-VC-Express-Edition"
2096 Print " --with-W32API=PATH "
2097 Print " --with-libxml2=PATH "
2098 Print " --with-libxslt=PATH "
2099 Print " --with-openssl=PATH "
2100 Print " --with-libcurl=PATH "
2101 Print " --with-python=PATH "
2102end sub
2103
2104
2105''
2106' The main() like function.
2107'
2108Sub Main
2109 '
2110 ' Write the log header and check that we're not using wscript.
2111 '
2112 LogInit
2113 If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
2114 Wscript.Echo "This script must be run under CScript."
2115 Wscript.Quit(1)
2116 End If
2117
2118 '
2119 ' Parse arguments.
2120 '
2121 strOptDDK = ""
2122 strOptDXDDK = ""
2123 strOptkBuild = ""
2124 strOptlibSDL = ""
2125 strOptMingW = ""
2126 strOptQt4 = ""
2127 strOptSDK = ""
2128 strOptVC = ""
2129 strOptVCCommon = ""
2130 blnOptVCExpressEdition = False
2131 strOptW32API = ""
2132 strOptXml2 = ""
2133 strOptXslt = ""
2134 strOptSsl = ""
2135 strOptCurl = ""
2136 strOptPython = ""
2137 strOptMkisofs = ""
2138 blnOptDisableCOM = False
2139 blnOptDisableUDPTunnel = False
2140 for i = 1 to Wscript.Arguments.Count
2141 dim str, strArg, strPath
2142
2143 ' Separate argument and path value
2144 str = Wscript.Arguments.item(i - 1)
2145 if InStr(1, str, "=") > 0 then
2146 strArg = Mid(str, 1, InStr(1, str, "=") - 1)
2147 strPath = Mid(str, InStr(1, str, "=") + 1)
2148 if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
2149 else
2150 strArg = str
2151 strPath = ""
2152 end if
2153
2154 ' Process the argument
2155 select case LCase(strArg)
2156 case "--with-ddk"
2157 strOptDDK = strPath
2158 case "--with-dxsdk"
2159 strOptDXSDK = strPath
2160 case "--with-kbuild"
2161 strOptkBuild = strPath
2162 case "--with-libsdl"
2163 strOptlibSDL = strPath
2164 case "--with-mingw"
2165 strOptMingW = strPath
2166 case "--with-qt4"
2167 strOptQt4 = strPath
2168 case "--with-sdk"
2169 strOptSDK = strPath
2170 case "--with-vc"
2171 strOptVC = strPath
2172 case "--with-vc-common"
2173 strOptVCCommon = strPath
2174 case "--with-vc-express-edition"
2175 blnOptVCExpressEdition = True
2176 case "--with-w32api"
2177 strOptW32API = strPath
2178 case "--with-libxml2"
2179 strOptXml2 = strPath
2180 case "--with-libxslt"
2181 strOptXslt = strPath
2182 case "--with-openssl"
2183 strOptSsl = strPath
2184 case "--with-libcurl"
2185 strOptCurl = strPath
2186 case "--with-python"
2187 strOptPython = strPath
2188 case "--with-mkisofs"
2189 strOptMkisofs = strPath
2190 case "--disable-com"
2191 blnOptDisableCOM = True
2192 case "--enable-com"
2193 blnOptDisableCOM = False
2194 case "--disable-udptunnel"
2195 blnOptDisableUDPTunnel = True
2196 case "--internal"
2197 g_blnInternalMode = True
2198 case "--internal-last"
2199 g_blnInternalFirst = False
2200 case "-h", "--help", "-?"
2201 usage
2202 Wscript.Quit(0)
2203 case else
2204 Wscript.echo "syntax error: Unknown option '" & str &"'."
2205 usage
2206 Wscript.Quit(1)
2207 end select
2208 next
2209
2210 '
2211 ' Initialize output files.
2212 '
2213 CfgInit
2214 EnvInit
2215
2216 '
2217 ' Check that the Shell function is sane.
2218 '
2219 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
2220 if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
2221 MsgFatal "shell execution test failed!"
2222 end if
2223 if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
2224 Print "Shell test Test -> '" & g_strShellOutput & "'"
2225 MsgFatal "shell inheritance or shell execution isn't working right. Make sure you use cmd.exe."
2226 end if
2227 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
2228 Print "Shell inheritance test: OK"
2229
2230 '
2231 ' Do the checks.
2232 '
2233 if blnOptDisableCOM = True then
2234 DisableCOM "--disable-com"
2235 end if
2236 if blnOptDisableUDPTunnel = True then
2237 DisableUDPTunnel "--disable-udptunnel"
2238 end if
2239 CheckSourcePath
2240 CheckForkBuild strOptkBuild
2241 CheckForWinDDK strOptDDK
2242 CfgPrint "VBOX_WITH_WDDM_W8 := " '' @todo look for WinDDKv8; Check with Misha if we _really_ need the v8 DDK...
2243 CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
2244 CheckForPlatformSDK strOptSDK
2245 CheckForMidl
2246 CheckForDirectXSDK strOptDXSDK
2247 CheckForMingW strOptMingw, strOptW32API
2248 CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
2249 EnvPrint "set PATH=%PATH%;" & g_strPath& "/tools/win." & g_strTargetArch & "/bin;" '' @todo look for yasm
2250 CheckForlibSDL strOptlibSDL
2251 ' Don't check for these libraries by default as they are part of OSE
2252 ' Using external libs can add a dependency to iconv
2253 if (strOptXml2 <> "") then
2254 CheckForXml2 strOptXml2
2255 end if
2256 if (strOptXslt <> "") then
2257 CheckForXslt strOptXslt
2258 end if
2259 CheckForSsl strOptSsl
2260 CheckForCurl strOptCurl
2261 CheckForQt4 strOptQt4
2262 if (strOptPython <> "") then
2263 CheckForPython strOptPython
2264 end if
2265 if (strOptMkisofs <> "") then
2266 CheckForMkisofs strOptMkisofs
2267 end if
2268 if g_blnInternalMode then
2269 EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
2270 end if
2271
2272 Print ""
2273 Print "Execute env.bat once before you start to build VBox:"
2274 Print ""
2275 Print " env.bat"
2276 Print " kmk"
2277 Print ""
2278
2279End Sub
2280
2281
2282Main
2283
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