VirtualBox

source: vbox/trunk/configure.vbs@ 33643

Last change on this file since 33643 was 31874, checked in by vboxsync, 14 years ago

OSE fixes

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Id
File size: 76.9 KB
Line 
1' $Id: configure.vbs 31874 2010-08-23 19:02:39Z vboxsync $
2'' @file
3' The purpose of this script is to check for all external tools, headers, and
4' libraries VBox OSE depends on.
5'
6' The script generates the build configuration file 'AutoConfig.kmk' and the
7' environment setup script 'env.bat'. A log of what has been done is
8' written to 'configure.log'.
9'
10
11'
12' Copyright (C) 2006-2007 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_strPathDDK, g_strSubOutput
39g_strPathkBuild = ""
40g_strPathDev = ""
41g_strPathVCC = ""
42g_strPathPSDK = ""
43g_strPathDDK = ""
44
45dim g_blnDisableCOM, g_strDisableCOM
46g_blnDisableCOM = False
47g_strDisableCOM = ""
48
49' The internal mode is primarily for skipping some large libraries.
50dim g_blnInternalMode
51g_blnInternalMode = False
52
53' Whether to try the internal stuff first or last.
54dim g_blnInternalFirst
55g_blnInternalFirst = True
56
57' Whether to try the new tools: Visual Studio 10.0, Windows 7 SDK and WDK.
58dim g_blnNewTools
59g_blnNewTools = False 'True
60
61
62
63''
64' Converts to unix slashes
65function UnixSlashes(str)
66 UnixSlashes = replace(str, "\", "/")
67end function
68
69
70''
71' Converts to dos slashes
72function DosSlashes(str)
73 DosSlashes = replace(str, "/", "\")
74end function
75
76
77''
78' Read a file (typically the tmp file) into a string.
79function FileToString(strFilename)
80 const ForReading = 1, TristateFalse = 0
81 dim objLogFile, str
82
83 set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForReading, False, TristateFalse)
84 str = objFile.ReadAll()
85 objFile.Close()
86
87 FileToString = str
88end function
89
90
91''
92' Deletes a file
93sub FileDelete(strFilename)
94 if g_objFileSys.FileExists(DosSlashes(strFilename)) then
95 g_objFileSys.DeleteFile(DosSlashes(strFilename))
96 end if
97end sub
98
99
100''
101' Appends a line to an ascii file.
102sub FileAppendLine(strFilename, str)
103 const ForAppending = 8, TristateFalse = 0
104 dim objFile
105
106 set objFile = g_objFileSys.OpenTextFile(DosSlashes(strFilename), ForAppending, True, TristateFalse)
107 objFile.WriteLine(str)
108 objFile.Close()
109end sub
110
111
112''
113' Checks if the file exists.
114function FileExists(strFilename)
115 FileExists = g_objFileSys.FileExists(DosSlashes(strFilename))
116end function
117
118
119''
120' Checks if the directory exists.
121function DirExists(strDirectory)
122 DirExists = g_objFileSys.FolderExists(DosSlashes(strDirectory))
123end function
124
125
126''
127' Checks if this is a WOW64 process.
128function IsWow64()
129 if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
130 IsWow64 = 1
131 else
132 IsWow64 = 0
133 end if
134end function
135
136
137''
138' Returns a reverse sorted array (strings).
139function ArraySortStrings(arrStrings)
140 for i = LBound(arrStrings) to UBound(arrStrings)
141 str1 = arrStrings(i)
142 for j = i + 1 to UBound(arrStrings)
143 str2 = arrStrings(j)
144 if StrComp(str2, str1) < 0 then
145 arrStrings(j) = str1
146 str1 = str2
147 end if
148 next
149 arrStrings(i) = str1
150 next
151 ArraySortStrings = arrStrings
152end function
153
154
155''
156' Prints a string array.
157sub ArrayPrintStrings(arrStrings, strPrefix)
158 for i = LBound(arrStrings) to UBound(arrStrings)
159 Print strPrefix & "arrStrings(" & i & ") = '" & arrStrings(i) & "'"
160 next
161end sub
162
163
164''
165' Returns a reverse sorted array (strings).
166function ArrayRSortStrings(arrStrings)
167 ' Sort it.
168 arrStrings = ArraySortStrings(arrStrings)
169
170 ' Reverse the array.
171 cnt = UBound(arrStrings) - LBound(arrStrings) + 1
172 if cnt > 0 then
173 j = UBound(arrStrings)
174 iHalf = Fix(LBound(arrStrings) + cnt / 2)
175 for i = LBound(arrStrings) to iHalf - 1
176 strTmp = arrStrings(i)
177 arrStrings(i) = arrStrings(j)
178 arrStrings(j) = strTmp
179 j = j - 1
180 next
181 end if
182 ArrayRSortStrings = arrStrings
183end function
184
185
186''
187' Returns the input array with the string appended.
188' Note! There must be some better way of doing this...
189function ArrayAppend(arr, str)
190 dim i, cnt
191 cnt = UBound(arr) - LBound(arr) + 1
192 redim arrRet(cnt)
193 for i = LBound(arr) to UBound(arr)
194 arrRet(i) = arr(i)
195 next
196 arrRet(UBound(arr) + 1) = str
197 ArrayAppend = arrRet
198end function
199
200
201
202''
203' Translates a register root name to a value
204function RegTransRoot(strRoot)
205 const HKEY_LOCAL_MACHINE = &H80000002
206 const HKEY_CURRENT_USER = &H80000001
207 select case strRoot
208 case "HKLM"
209 RegTransRoot = HKEY_LOCAL_MACHINE
210 case "HKCU"
211 RegTransRoot = HKEY_CURRENT_USER
212 case else
213 MsgFatal "RegTransRoot: Unknown root: '" & strRoot & "'"
214 RegTransRoot = 0
215 end select
216end function
217
218
219'' The registry globals
220dim g_objReg, g_objRegCtx
221dim g_blnRegistry
222g_blnRegistry = false
223
224
225''
226' Init the register provider globals.
227function RegInit()
228 RegInit = false
229 On Error Resume Next
230 if g_blnRegistry = false then
231 set g_objRegCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
232 ' Comment out the following for lines if the cause trouble on your windows version.
233 if IsWow64() then
234 g_objRegCtx.Add "__ProviderArchitecture", 64
235 g_objRegCtx.Add "__RequiredArchitecture", true
236 end if
237 set objLocator = CreateObject("Wbemscripting.SWbemLocator")
238 set objServices = objLocator.ConnectServer("", "root\default", "", "", , , , g_objRegCtx)
239 set g_objReg = objServices.Get("StdRegProv")
240 g_blnRegistry = true
241 end if
242 RegInit = true
243end function
244
245
246''
247' Gets a value from the registry. Returns "" if string wasn't found / valid.
248function RegGetString(strName)
249 RegGetString = ""
250 if RegInit() then
251 dim strRoot, strKey, strValue
252 dim iRoot
253
254 ' split up into root, key and value parts.
255 strRoot = left(strName, instr(strName, "\") - 1)
256 strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\"))
257 strValue = mid(strName, instrrev(strName, "\") + 1)
258
259 ' Must use ExecMethod to call the GetStringValue method because of the context.
260 Set InParms = g_objReg.Methods_("GetStringValue").Inparameters
261 InParms.hDefKey = RegTransRoot(strRoot)
262 InParms.sSubKeyName = strKey
263 InParms.sValueName = strValue
264 On Error Resume Next
265 set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx)
266 if OutParms.ReturnValue = 0 then
267 RegGetString = OutParms.sValue
268 end if
269 else
270 ' fallback mode
271 On Error Resume Next
272 RegGetString = g_objShell.RegRead(strName)
273 end if
274end function
275
276
277''
278' Returns an array of subkey strings.
279function RegEnumSubKeys(strRoot, strKeyPath)
280 dim iRoot
281 iRoot = RegTransRoot(strRoot)
282 RegEnumSubKeys = Array()
283
284 if RegInit() then
285 ' Must use ExecMethod to call the EnumKey method because of the context.
286 Set InParms = g_objReg.Methods_("EnumKey").Inparameters
287 InParms.hDefKey = RegTransRoot(strRoot)
288 InParms.sSubKeyName = strKeyPath
289 On Error Resume Next
290 set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx)
291 if OutParms.ReturnValue = 0 then
292 RegEnumSubKeys = OutParms.sNames
293 end if
294 else
295 ' fallback mode
296 dim objReg, rc, arrSubKeys
297 set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
298 On Error Resume Next
299 rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
300 if rc = 0 then
301 RegEnumSubKeys = arrSubKeys
302 end if
303 end if
304end function
305
306
307''
308' Returns an array of full path subkey strings.
309function RegEnumSubKeysFull(strRoot, strKeyPath)
310 dim arrTmp
311 arrTmp = RegEnumSubKeys(strRoot, strKeyPath)
312 for i = LBound(arrTmp) to UBound(arrTmp)
313 arrTmp(i) = strKeyPath & "\" & arrTmp(i)
314 next
315 RegEnumSubKeysFull = arrTmp
316end function
317
318
319''
320' Returns an rsorted array of subkey strings.
321function RegEnumSubKeysRSort(strRoot, strKeyPath)
322 RegEnumSubKeysRSort = ArrayRSortStrings(RegEnumSubKeys(strRoot, strKeyPath))
323end function
324
325
326''
327' Returns an rsorted array of subkey strings.
328function RegEnumSubKeysFullRSort(strRoot, strKeyPath)
329 RegEnumSubKeysFullRSort = ArrayRSortStrings(RegEnumSubKeysFull(strRoot, strKeyPath))
330end function
331
332
333''
334' Gets the commandline used to invoke the script.
335function GetCommandline()
336 dim str, i
337
338 '' @todo find an api for querying it instead of reconstructing it like this...
339 GetCommandline = "cscript configure.vbs"
340 for i = 1 to WScript.Arguments.Count
341 str = WScript.Arguments.Item(i - 1)
342 if str = "" then
343 str = """"""
344 elseif (InStr(1, str, " ")) then
345 str = """" & str & """"
346 end if
347 GetCommandline = GetCommandline & " " & str
348 next
349end function
350
351
352''
353' Gets an environment variable.
354function EnvGet(strName)
355 EnvGet = g_objShell.Environment("PROCESS")(strName)
356end function
357
358
359''
360' Sets an environment variable.
361sub EnvSet(strName, strValue)
362 g_objShell.Environment("PROCESS")(strName) = strValue
363 LogPrint "EnvSet: " & strName & "=" & strValue
364end sub
365
366
367''
368' Appends a string to an environment variable
369sub EnvAppend(strName, strValue)
370 dim str
371 str = g_objShell.Environment("PROCESS")(strName)
372 g_objShell.Environment("PROCESS")(strName) = str & strValue
373 LogPrint "EnvAppend: " & strName & "=" & str & strValue
374end sub
375
376
377''
378' Prepends a string to an environment variable
379sub EnvPrepend(strName, strValue)
380 dim str
381 str = g_objShell.Environment("PROCESS")(strName)
382 g_objShell.Environment("PROCESS")(strName) = strValue & str
383 LogPrint "EnvPrepend: " & strName & "=" & strValue & str
384end sub
385
386
387''
388' Get the path of the parent directory. Returns root if root was specified.
389' Expects abs path.
390function PathParent(str)
391 PathParent = g_objFileSys.GetParentFolderName(DosSlashes(str))
392end function
393
394
395''
396' Strips the filename from at path.
397function PathStripFilename(str)
398 PathStripFilename = g_objFileSys.GetParentFolderName(DosSlashes(str))
399end function
400
401
402''
403' Get the abs path, use the short version if necessary.
404function PathAbs(str)
405 strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
406 strParent = g_objFileSys.GetParentFolderName(strAbs)
407 if strParent = "" then
408 PathAbs = strAbs
409 else
410 strParent = PathAbs(strParent) ' Recurse to resolve parent paths.
411 PathAbs = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
412
413 dim obj
414 set obj = Nothing
415 if FileExists(PathAbs) then
416 set obj = g_objFileSys.GetFile(PathAbs)
417 elseif DirExists(PathAbs) then
418 set obj = g_objFileSys.GetFolder(PathAbs)
419 end if
420
421 if not (obj is nothing) then
422 for each objSub in obj.ParentFolder.SubFolders
423 if obj.Name = objSub.Name or obj.ShortName = objSub.ShortName then
424 if InStr(1, objSub.Name, " ") > 0 _
425 Or InStr(1, objSub.Name, "&") > 0 _
426 Or InStr(1, objSub.Name, "$") > 0 _
427 then
428 PathAbs = g_objFileSys.BuildPath(strParent, objSub.ShortName)
429 if InStr(1, PathAbs, " ") > 0 _
430 Or InStr(1, PathAbs, "&") > 0 _
431 Or InStr(1, PathAbs, "$") > 0 _
432 then
433 MsgFatal "PathAbs(" & str & ") attempted to return filename with problematic " _
434 & "characters in it (" & PathAbs & "). The tool/sdk referenced will probably " _
435 & "need to be copied or reinstalled to a location without 'spaces', '$', ';' " _
436 & "or '&' in the path name. (Unless it's a problem with this script of course...)"
437 end if
438 else
439 PathAbs = g_objFileSys.BuildPath(strParent, objSub.Name)
440 end if
441 exit for
442 end if
443 next
444 end if
445 end if
446end function
447
448
449''
450' Get the abs path, use the long version.
451function PathAbsLong(str)
452 strAbs = g_objFileSys.GetAbsolutePathName(DosSlashes(str))
453 strParent = g_objFileSys.GetParentFolderName(strAbs)
454 if strParent = "" then
455 PathAbsLong = strAbs
456 else
457 strParent = PathAbsLong(strParent) ' Recurse to resolve parent paths.
458 PathAbsLong = g_objFileSys.BuildPath(strParent, g_objFileSys.GetFileName(strAbs))
459
460 dim obj
461 set obj = Nothing
462 if FileExists(PathAbsLong) then
463 set obj = g_objFileSys.GetFile(PathAbsLong)
464 elseif DirExists(PathAbsLong) then
465 set obj = g_objFileSys.GetFolder(PathAbsLong)
466 end if
467
468 if not (obj is nothing) then
469 for each objSub in obj.ParentFolder.SubFolders
470 if obj.Name = objSub.Name or obj.ShortName = objSub.ShortName then
471 PathAbsLong = g_objFileSys.BuildPath(strParent, objSub.Name)
472 exit for
473 end if
474 next
475 end if
476 end if
477end function
478
479
480''
481' Executes a command in the shell catching output in g_strShellOutput
482function Shell(strCommand, blnBoth)
483 dim strShell, strCmdline, objExec, str
484
485 strShell = g_objShell.ExpandEnvironmentStrings("%ComSpec%")
486 if blnBoth = true then
487 strCmdline = strShell & " /c " & strCommand & " 2>&1"
488 else
489 strCmdline = strShell & " /c " & strCommand & " 2>nul"
490 end if
491
492 LogPrint "# Shell: " & strCmdline
493 Set objExec = g_objShell.Exec(strCmdLine)
494 g_strShellOutput = objExec.StdOut.ReadAll()
495 objExec.StdErr.ReadAll()
496 do while objExec.Status = 0
497 Wscript.Sleep 20
498 g_strShellOutput = g_strShellOutput & objExec.StdOut.ReadAll()
499 objExec.StdErr.ReadAll()
500 loop
501
502 LogPrint "# Status: " & objExec.ExitCode
503 LogPrint "# Start of Output"
504 LogPrint g_strShellOutput
505 LogPrint "# End of Output"
506
507 Shell = objExec.ExitCode
508end function
509
510
511''
512' Try find the specified file in the path.
513function Which(strFile)
514 dim strPath, iStart, iEnd, str
515
516 ' the path
517 strPath = EnvGet("Path")
518 iStart = 1
519 do while iStart <= Len(strPath)
520 iEnd = InStr(iStart, strPath, ";")
521 if iEnd <= 0 then iEnd = Len(strPath) + 1
522 if iEnd > iStart then
523 str = Mid(strPath, iStart, iEnd - iStart) & "/" & strFile
524 if FileExists(str) then
525 Which = str
526 exit function
527 end if
528 end if
529 iStart = iEnd + 1
530 loop
531
532 ' registry or somewhere?
533
534 Which = ""
535end function
536
537
538''
539' Append text to the log file and echo it to stdout
540sub Print(str)
541 LogPrint str
542 Wscript.Echo str
543end sub
544
545
546''
547' Prints a test header
548sub PrintHdr(strTest)
549 LogPrint "***** Checking for " & strTest & " *****"
550 Wscript.Echo "Checking for " & StrTest & "..."
551end sub
552
553
554''
555' Prints a success message
556sub PrintResultMsg(strTest, strResult)
557 LogPrint "** " & strTest & ": " & strResult
558 Wscript.Echo " Found "& strTest & ": " & strResult
559end sub
560
561
562''
563' Prints a successfully detected path
564sub PrintResult(strTest, strPath)
565 strLongPath = PathAbsLong(strPath)
566 if PathAbs(strPath) <> strLongPath then
567 LogPrint "** " & strTest & ": " & strPath & " (" & UnixSlashes(strLongPath) & ")"
568 Wscript.Echo " Found " & strTest & ": " & strPath & " (" & UnixSlashes(strLongPath) & ")"
569 else
570 LogPrint "** " & strTest & ": " & strPath
571 Wscript.Echo " Found " & strTest & ": " & strPath
572 end if
573end sub
574
575
576''
577' Warning message.
578sub MsgWarning(strMsg)
579 Print "warning: " & strMsg
580end sub
581
582
583''
584' Fatal error.
585sub MsgFatal(strMsg)
586 Print "fatal error: " & strMsg
587 Wscript.Quit
588end sub
589
590
591''
592' Error message, fatal unless flag to ignore errors is given.
593sub MsgError(strMsg)
594 Print "error: " & strMsg
595 if g_blnInternalMode = False then
596 Wscript.Quit
597 end if
598end sub
599
600
601''
602' Write a log header with some basic info.
603sub LogInit
604 FileDelete g_strLogFile
605 LogPrint "# Log file generated by " & Wscript.ScriptFullName
606 for i = 1 to WScript.Arguments.Count
607 LogPrint "# Arg #" & i & ": " & WScript.Arguments.Item(i - 1)
608 next
609 if Wscript.Arguments.Count = 0 then
610 LogPrint "# No arguments given"
611 end if
612 LogPrint "# Reconstructed command line: " & GetCommandline()
613
614 ' some Wscript stuff
615 LogPrint "# Wscript properties:"
616 LogPrint "# ScriptName: " & Wscript.ScriptName
617 LogPrint "# Version: " & Wscript.Version
618 LogPrint "# Build: " & Wscript.BuildVersion
619 LogPrint "# Name: " & Wscript.Name
620 LogPrint "# Full Name: " & Wscript.FullName
621 LogPrint "# Path: " & Wscript.Path
622 LogPrint "#"
623
624
625 ' the environment
626 LogPrint "# Environment:"
627 dim objEnv
628 for each strVar in g_objShell.Environment("PROCESS")
629 LogPrint "# " & strVar
630 next
631 LogPrint "#"
632end sub
633
634
635''
636' Append text to the log file.
637sub LogPrint(str)
638 FileAppendLine g_strLogFile, str
639 'Wscript.Echo "dbg: " & str
640end sub
641
642
643''
644' Checks if the file exists and logs failures.
645function LogFileExists(strPath, strFilename)
646 LogFileExists = FileExists(strPath & "/" & strFilename)
647 if LogFileExists = False then
648 LogPrint "Testing '" & strPath & "': " & strFilename & " not found"
649 end if
650
651end function
652
653
654''
655' Finds the first file matching the pattern.
656' If no file is found, log the failure.
657function LogFindFile(strPath, strPattern)
658 dim str
659
660 '
661 ' Yes, there are some facy database kinda interface to the filesystem
662 ' however, breaking down the path and constructing a usable query is
663 ' too much hassle. So, we'll do it the unix way...
664 '
665 if Shell("dir /B """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
666 And InStr(1, g_strShellOutput, Chr(13)) > 1 _
667 then
668 ' return the first word.
669 LogFindFile = Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
670 else
671 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
672 LogFindFile = ""
673 end if
674end function
675
676
677''
678' Finds the first directory matching the pattern.
679' If no directory is found, log the failure,
680' else return the complete path to the found directory.
681function LogFindDir(strPath, strPattern)
682 dim str
683
684 '
685 ' Yes, there are some facy database kinda interface to the filesystem
686 ' however, breaking down the path and constructing a usable query is
687 ' too much hassle. So, we'll do it the unix way...
688 '
689
690 ' List the alphabetically last names as first entries (with /O-N).
691 if Shell("dir /B /AD /O-N """ & DosSlashes(strPath) & "\" & DosSlashes(strPattern) & """", True) = 0 _
692 And InStr(1, g_strShellOutput, Chr(13)) > 1 _
693 then
694 ' return the first word.
695 LogFindDir = strPath & "/" & Left(g_strShellOutput, InStr(1, g_strShellOutput, Chr(13)) - 1)
696 else
697 LogPrint "Testing '" & strPath & "': " & strPattern & " not found"
698 LogFindDir = ""
699 end if
700end function
701
702
703''
704' Initializes the config file.
705sub CfgInit
706 FileDelete g_strCfgFile
707 CfgPrint "# -*- Makefile -*-"
708 CfgPrint "#"
709 CfgPrint "# Build configuration generated by " & GetCommandline()
710 CfgPrint "#"
711 if g_blnInternalMode = False then
712 CfgPrint "VBOX_OSE := 1"
713 end if
714end sub
715
716
717''
718' Prints a string to the config file.
719sub CfgPrint(str)
720 FileAppendLine g_strCfgFile, str
721end sub
722
723
724''
725' Initializes the environment batch script.
726sub EnvInit
727 FileDelete g_strEnvFile
728 EnvPrint "@echo off"
729 EnvPrint "rem"
730 EnvPrint "rem Environment setup script generated by " & GetCommandline()
731 EnvPrint "rem"
732end sub
733
734
735''
736' Prints a string to the environment batch script.
737sub EnvPrint(str)
738 FileAppendLine g_strEnvFile, str
739end sub
740
741
742''
743' No COM
744sub DisableCOM(strReason)
745 if g_blnDisableCOM = False then
746 LogPrint "Disabled COM components: " & strReason
747 g_blnDisableCOM = True
748 g_strDisableCOM = strReason
749 CfgPrint "VBOX_WITH_MAIN="
750 CfgPrint "VBOX_WITH_QTGUI="
751 CfgPrint "VBOX_WITH_VBOXSDL="
752 CfgPrint "VBOX_WITH_DEBUGGER_GUI="
753 CfgPrint "VBOX_WITHOUT_COM=1"
754 end if
755end sub
756
757
758''
759' Checks the the path doesn't contain characters the tools cannot deal with.
760sub CheckSourcePath
761 dim sPwd
762
763 sPwd = PathAbs(g_strPath)
764 if InStr(1, sPwd, " ") > 0 then
765 MsgError "Source path contains spaces! Please move it. (" & sPwd & ")"
766 end if
767 if InStr(1, sPwd, "$") > 0 then
768 MsgError "Source path contains the '$' char! Please move it. (" & sPwd & ")"
769 end if
770 if InStr(1, sPwd, "%") > 0 then
771 MsgError "Source path contains the '%' char! Please move it. (" & sPwd & ")"
772 end if
773 if InStr(1, sPwd, Chr(10)) > 0 _
774 Or InStr(1, sPwd, Chr(13)) > 0 _
775 Or InStr(1, sPwd, Chr(9)) > 0 _
776 then
777 MsgError "Source path contains control characters! Please move it. (" & sPwd & ")"
778 end if
779 Print "Source path: OK"
780end sub
781
782
783''
784' Checks for kBuild - very simple :)
785sub CheckForkBuild(strOptkBuild)
786 PrintHdr "kBuild"
787
788 '
789 ' Check if there is a 'kmk' in the path somewhere without
790 ' any PATH_KBUILD* stuff around.
791 '
792 blnNeedEnvVars = True
793 g_strPathkBuild = strOptkBuild
794 g_strPathkBuildBin = ""
795 if (g_strPathkBuild = "") _
796 And (EnvGet("PATH_KBUILD") = "") _
797 And (EnvGet("PATH_KBUILD_BIN") = "") _
798 And (Shell("kmk.exe --version", True) = 0) _
799 And (InStr(1,g_strShellOutput, "kBuild Make 0.1") > 0) _
800 And (InStr(1,g_strShellOutput, "PATH_KBUILD") > 0) _
801 And (InStr(1,g_strShellOutput, "PATH_KBUILD_BIN") > 0) then
802 '' @todo Need to parse out the PATH_KBUILD and PATH_KBUILD_BIN values to complete the other tests.
803 'blnNeedEnvVars = False
804 MsgWarning "You've installed kBuild it seems. configure.vbs hasn't been updated to " _
805 & "deal with that yet and will use the one it ships with. Sorry."
806 end if
807
808 '
809 ' Check for the PATH_KBUILD env.var. and fall back on root/kBuild otherwise.
810 '
811 if g_strPathkBuild = "" then
812 g_strPathkBuild = EnvGet("PATH_KBUILD")
813 if (g_strPathkBuild <> "") and (FileExists(g_strPathkBuild & "/footer.kmk") = False) then
814 MsgWarning "Ignoring incorrect kBuild path (PATH_KBUILD=" & g_strPathkBuild & ")"
815 g_strPathkBuild = ""
816 end if
817
818 if g_strPathkBuild = "" then
819 g_strPathkBuild = g_strPath & "/kBuild"
820 end if
821 end if
822
823 g_strPathkBuild = UnixSlashes(PathAbs(g_strPathkBuild))
824
825 '
826 ' Determin the location of the kBuild binaries.
827 '
828 if g_strPathkBuildBin = "" then
829 dim str2
830 if EnvGet("PROCESSOR_ARCHITECTURE") = "x86" then
831 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
832 else ' boldly assumes there is only x86 and amd64.
833 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.amd64"
834 if FileExists(g_strPathkBuild & "/kmk.exe") = False then
835 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
836 end if
837 end if
838 if FileExists(g_strPathkBuild & "/kmk.exe") = False then
839 g_strPathkBuildBin = g_strPathkBuild & "/bin/win.x86"
840 end if
841 end if
842
843 '
844 ' Perform basic validations of the kBuild installation.
845 '
846 if (FileExists(g_strPathkBuild & "/footer.kmk") = False) _
847 Or (FileExists(g_strPathkBuild & "/header.kmk") = False) _
848 Or (FileExists(g_strPathkBuild & "/rules.kmk") = False) then
849 MsgFatal "Can't find valid kBuild at '" & g_strPathkBuild & "'. Either there is an " _
850 & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
851 exit sub
852 end if
853 if (FileExists(g_strPathkBuildBin & "/kmk.exe") = False) _
854 Or (FileExists(g_strPathkBuildBin & "/kmk_ash.exe") = False) then
855 MsgFatal "Can't find valid kBuild binaries at '" & g_strPathkBuildBin & "'. Either there is an " _
856 & "incorrect PATH_KBUILD in the environment or the checkout didn't succeed."
857 exit sub
858 end if
859
860 if (Shell(DosSlashes(g_strPathkBuildBin & "/kmk.exe") & " --version", True) <> 0) Then
861 MsgFatal "Can't execute '" & g_strPathkBuildBin & "/kmk.exe --version'. check configure.log for the out."
862 exit sub
863 end if
864
865 '
866 ' Check for env.vars that kBuild uses.
867 '
868 str = EnvGet("BUILD_TYPE")
869 if (str <> "") _
870 And (InStr(1, "|release|debug|profile|kprofile", str) <= 0) then
871 EnvPrint "set BUILD_TYPE=release"
872 EnvSet "BUILD_TYPE", "release"
873 MsgWarning "Found unknown BUILD_TYPE value '" & str &"' in your environment. Setting it to 'release'."
874 end if
875
876 str = EnvGet("BUILD_TARGET")
877 if (str <> "") _
878 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
879 EnvPrint "set BUILD_TARGET=win"
880 EnvSet "BUILD_TARGET", "win"
881 MsgWarning "Found unknown BUILD_TARGET value '" & str &"' in your environment. Setting it to 'win32'."
882 end if
883
884 str = EnvGet("BUILD_TARGET_ARCH")
885 if (str <> "") _
886 And (InStr(1, "x86|amd64", str) <= 0) then
887 EnvPrint "set BUILD_TARGET_ARCH=x86"
888 EnvSet "BUILD_TARGET_ARCH", "x86"
889 MsgWarning "Found unknown BUILD_TARGET_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
890 end if
891
892 str = EnvGet("BUILD_TARGET_CPU")
893 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
894 if (str <> "") _
895 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
896 EnvPrint "set BUILD_TARGET_CPU=i386"
897 EnvSet "BUILD_TARGET_CPU", "i386"
898 MsgWarning "Found unknown BUILD_TARGET_CPU value '" & str &"' in your environment. Setting it to 'i386'."
899 end if
900
901 str = EnvGet("BUILD_PLATFORM")
902 if (str <> "") _
903 And (InStr(1, "win|win32|win64", str) <= 0) then '' @todo later only 'win' will be valid. remember to fix this check!
904 EnvPrint "set BUILD_PLATFORM=win"
905 EnvSet "BUILD_PLATFORM", "win"
906 MsgWarning "Found unknown BUILD_PLATFORM value '" & str &"' in your environment. Setting it to 'win32'."
907 end if
908
909 str = EnvGet("BUILD_PLATFORM_ARCH")
910 if (str <> "") _
911 And (InStr(1, "x86|amd64", str) <= 0) then
912 EnvPrint "set BUILD_PLATFORM_ARCH=x86"
913 EnvSet "BUILD_PLATFORM_ARCH", "x86"
914 MsgWarning "Found unknown BUILD_PLATFORM_ARCH value '" & str &"' in your environment. Setting it to 'x86'."
915 end if
916
917 str = EnvGet("BUILD_PLATFORM_CPU")
918 ' perhaps a bit pedantic this since this isn't clearly define nor used much...
919 if (str <> "") _
920 And (InStr(1, "i386|i486|i686|i786|i868|k5|k6|k7|k8", str) <= 0) then
921 EnvPrint "set BUILD_PLATFORM_CPU=i386"
922 EnvSet "BUILD_PLATFORM_CPU", "i386"
923 MsgWarning "Found unknown BUILD_PLATFORM_CPU value '" & str &"' in your environment. Setting it to 'i386'."
924 end if
925
926 '
927 ' If PATH_DEV is set, check that it's pointing to something useful.
928 '
929 str = EnvGet("PATH_DEV")
930 g_strPathDev = str
931 if (str <> "") _
932 And False then '' @todo add some proper tests here.
933 strNew = UnixSlashes(g_strPath & "/tools")
934 EnvPrint "set PATH_DEV=" & strNew
935 EnvSet "PATH_DEV", strNew
936 MsgWarning "Found PATH_DEV='" & str &"' in your environment. Setting it to '" & strNew & "'."
937 g_strPathDev = strNew
938 end if
939 if g_strPathDev = "" then g_strPathDev = UnixSlashes(g_strPath & "/tools")
940
941 '
942 ' Write PATH_KBUILD to the environment script if necessary.
943 '
944 if blnNeedEnvVars = True then
945 EnvPrint "set PATH_KBUILD=" & g_strPathkBuild
946 EnvSet "PATH_KBUILD", g_strPathkBuild
947 EnvPrint "set PATH=" & g_strPathkBuildBin & ";%PATH%"
948 EnvPrepend "PATH", g_strPathkBuildBin & ";"
949 end if
950
951 PrintResult "kBuild", g_strPathkBuild
952 PrintResult "kBuild binaries", g_strPathkBuildBin
953end sub
954
955
956''
957' Checks for Visual C++ version 7.1, 8 or 10.
958sub CheckForVisualCPP(strOptVC, strOptVCCommon, blnOptVCExpressEdition)
959 dim strPathVC, strPathVCCommon, str, str2, blnNeedMsPDB
960 PrintHdr "Visual C++"
961
962 '
963 ' Try find it...
964 '
965 strPathVC = ""
966 strPathVCCommon = ""
967 if (strPathVC = "") And (strOptVC <> "") then
968 if CheckForVisualCPPSub(strOptVC, strOptVCCommon, blnOptVCExpressEdition) then
969 strPathVC = strOptVC
970 strPathVCCommon = strOptVCCommon
971 end if
972 end if
973
974 if (strPathVC = "") And (g_blnInternalFirst = True) Then
975 if g_blnNewTools Then
976 strPathVC = g_strPathDev & "/win.x86/vcc/v10"
977 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
978 strPathVC = ""
979 end if
980 end if
981 if strPathVC = "" then
982 strPathVC = g_strPathDev & "/win.x86/vcc/v8"
983 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
984 strPathVC = g_strPathDev & "/win.x86/vcc/v7"
985 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
986 strPathVC = ""
987 end if
988 end if
989 end if
990 end if
991
992 if (strPathVC = "") _
993 And (Shell("cl.exe", True) = 0) then
994 str = Which("cl.exe")
995 if FileExists(PathStripFilename(strClExe) & "/build.exe") then
996 ' don't know how to deal with this cl.
997 Warning "Ignoring DDK cl.exe (" & str & ")."
998 else
999 strPathVC = PathParent(PathStripFilename(str))
1000 strPathVCCommon = PathParent(strPathVC) & "/Common7"
1001 end if
1002 end if
1003
1004 if (strPathVC = "") And g_blnNewTools then
1005 str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1006 if str <> "" Then
1007 str2 = str & "Common7"
1008 str = str & "VC"
1009 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1010 strPathVC = str
1011 strPathVCCommon = str2
1012 end if
1013 end if
1014 end if
1015
1016 if (strPathVC = "") And g_blnNewTools then
1017 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS\ProductDir")
1018 if str <> "" Then
1019 str2 = str & "Common7"
1020 str = str & "VC"
1021 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1022 strPathVC = str
1023 strPathVCCommon = str2
1024 end if
1025 end if
1026 end if
1027
1028 if strPathVC = "" then
1029 str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
1030 str2 = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
1031 if str <> "" And str2 <> "" Then
1032 str = str & "VC"
1033 str2 = PathParent(str2)
1034 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1035 strPathVC = str
1036 strPathVCCommon = str2
1037 end if
1038 end if
1039 end if
1040
1041 if strPathVC = "" then
1042 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
1043 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
1044 if str <> "" And str2 <> "" Then
1045 str = str & "VC"
1046 str2 = PathParent(str2)
1047 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1048 strPathVC = str
1049 strPathVCCommon = str2
1050 end if
1051 end if
1052 end if
1053
1054 if strPathVC = "" then
1055 '' @todo check what this really looks like on 7.1
1056 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\ProductDir")
1057 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\Setup\VS\EnvironmentDirectory")
1058 if str <> "" And str2 <> "" Then
1059 str = str & "VC7"
1060 str2 = PathParent(str2)
1061 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1062 strPathVC = str
1063 strPathVCCommon = str2
1064 end if
1065 end if
1066 end if
1067
1068 if strPathVC = "" then
1069 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\ProductDir")
1070 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VS\EnvironmentDirectory")
1071 if str <> "" And str2 <> "" Then
1072 str = str & "VC7"
1073 str2 = PathParent(str2)
1074 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1075 strPathVC = str
1076 strPathVCCommon = str2
1077 end if
1078 end if
1079 end if
1080
1081 if strPathVC = "" then
1082 str = RegGetString("HKLM\SOFTWARE\Microsoft\Wow6432Node\VisualStudio\SxS\VC7\8.0")
1083 if str <> "" then
1084 str2 = PathParent(str) & "/Common7"
1085 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1086 strPathVC = str
1087 strPathVCCommon = str2
1088 end if
1089 end if
1090 end if
1091
1092 if strPathVC = "" then
1093 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7\8.0")
1094 if str <> "" then
1095 str2 = PathParent(str) & "/Common7"
1096 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1097 strPathVC = str
1098 strPathVCCommon = str2
1099 end if
1100 end if
1101 end if
1102
1103 ' finally check for the express edition.
1104 if strPathVC = "" then
1105 str = RegGetString("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Visual C++ 2005 Express Edition - ENU\InstallLocation")
1106 if str <> "" then
1107 str2 = str & "Common7"
1108 str = str & "VC/"
1109 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
1110 strPathVC = str
1111 strPathVCCommon = str2
1112 end if
1113 end if
1114 end if
1115
1116 if (strPathVC = "") And (g_blnInternalFirst = False) Then
1117 strPathVC = g_strPathDev & "/win.x86/vcc/v8"
1118 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
1119 strPathVC = g_strPathDev & "/win.x86/vcc/v7"
1120 if CheckForVisualCPPSub(strPathVC, "", blnOptVCExpressEdition) = False then
1121 strPathVC = ""
1122 end if
1123 end if
1124 end if
1125
1126 if strPathVC = "" then
1127 MsgError "Cannot find cl.exe (Visual C++) anywhere on your system. Check the build requirements."
1128 exit sub
1129 end if
1130
1131 '
1132 ' Clean up the path and determin the VC directory.
1133 '
1134 strPathVC = UnixSlashes(PathAbs(strPathVC))
1135 g_strPathVCC = strPathVC
1136
1137 '
1138 ' Check the version.
1139 ' We'll have to make sure mspdbXX.dll is somewhere in the PATH.
1140 '
1141 if (strPathVCCommon <> "") Then
1142 EnvAppend "PATH", ";" & strPathVCCommon & "/IDE"
1143 end if
1144 if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
1145 MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed."
1146 exit sub
1147 end if
1148
1149 if (InStr(1, g_strShellOutput, "Version 13.10") <= 0) _
1150 And (InStr(1, g_strShellOutput, "Version 14.") <= 0) _
1151 And (InStr(1, g_strShellOutput, "Version 16.") <= 0) then
1152 MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 7.1, 8.0 or 10.0. Check the build requirements."
1153 exit sub
1154 end if
1155
1156 '
1157 ' Ok, emit build config variables.
1158 '
1159 if InStr(1, g_strShellOutput, "Version 16.") > 0 then
1160 CfgPrint "VBOX_USE_VCC100 := 1"
1161 CfgPrint "PATH_TOOL_VCC100 := " & g_strPathVCC
1162 CfgPrint "PATH_TOOL_VCC100X86 = $(PATH_TOOL_VCC100)"
1163 CfgPrint "PATH_TOOL_VCC100AMD64 = $(PATH_TOOL_VCC100)"
1164 if LogFileExists(strPathVC, "atlmfc/include/atlbase.h") then
1165 PrintResult "Visual C++ v10 with ATL", g_strPathVCC
1166 elseif LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
1167 And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib") then
1168 CfgPrint "TOOL_VCC100X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
1169 CfgPrint "TOOL_VCC100AMD64_MT = $(TOOL_VCC100X86_MT)"
1170 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1171 CfgPrint "PATH_TOOL_VCC100_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
1172 CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.amd64 = " & g_strPathDDK & "/lib/ATL/amd64"
1173 CfgPrint "PATH_TOOL_VCC100_ATLMFC_LIB.x86 = " & g_strPathDDK & "/lib/ATL/i386"
1174 CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
1175 CfgPrint "PATH_TOOL_VCC100AMD64_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/amd64"
1176 CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_INC = " & g_strPathDDK & "/inc/atl71"
1177 CfgPrint "PATH_TOOL_VCC100X86_ATLMFC_LIB = " & g_strPathDDK & "/lib/ATL/i386"
1178 PrintResult "Visual C++ v10 with DDK ATL", g_strPathVCC
1179 else
1180 CfgPrint "TOOL_VCC100X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
1181 CfgPrint "TOOL_VCC100AMD64_MT = $(TOOL_VCC100X86_MT)"
1182 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1183 DisableCOM "No ATL"
1184 PrintResult "Visual C++ v10 (or later) without ATL", g_strPathVCC
1185 end if
1186 elseif InStr(1, g_strShellOutput, "Version 14.") > 0 then
1187 CfgPrint "VBOX_USE_VCC80 := 1"
1188 CfgPrint "PATH_TOOL_VCC80 := " & g_strPathVCC
1189 CfgPrint "PATH_TOOL_VCC80X86 = $(PATH_TOOL_VCC80)"
1190 CfgPrint "PATH_TOOL_VCC80AMD64 = $(PATH_TOOL_VCC80)"
1191 if blnOptVCExpressEdition _
1192 And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
1193 then
1194 CfgPrint "TOOL_VCC80X86_MT = $(PATH_SDK_WINPSDK)/Bin/mt.exe"
1195 CfgPrint "TOOL_VCC80AMD64_MT = $(TOOL_VCC80X86_MT)"
1196 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1197 DisableCOM "No ATL"
1198 PrintResult "Visual C++ v8 (or later) without ATL", g_strPathVCC
1199 else
1200 PrintResult "Visual C++ v8 (or later)", g_strPathVCC
1201 end if
1202 else
1203 CfgPrint "PATH_TOOL_VCC70 := " & g_strPathVCC
1204 if blnOptVCExpressEdition _
1205 And LogFileExists(strPathVC, "atlmfc/include/atlbase.h") = False _
1206 then
1207 CfgPrint "VBOX_WITHOUT_COMPILER_REDIST=1"
1208 DisableCOM "No ATL"
1209 PrintResult "Visual C++ v7.1 without ATL", g_strPathVCC
1210 else
1211 PrintResult "Visual C++ v7.1", g_strPathVCC
1212 end if
1213 end if
1214
1215 ' and the env.bat path fix.
1216 if strPathVCCommon <> "" then
1217 EnvPrint "set PATH=%PATH%;" & strPathVCCommon & "/IDE;"
1218 end if
1219end sub
1220
1221''
1222' Checks if the specified path points to a usable PSDK.
1223function CheckForVisualCPPSub(strPathVC, strPathVCCommon, blnOptVCExpressEdition)
1224 strPathVC = UnixSlashes(PathAbs(strPathVC))
1225 CheckForVisualCPPSub = False
1226 LogPrint "trying: strPathVC=" & strPathVC & " strPathVCCommon=" & strPathVCCommon & " blnOptVCExpressEdition=" & blnOptVCExpressEdition
1227 if LogFileExists(strPathVC, "bin/cl.exe") _
1228 And LogFileExists(strPathVC, "bin/link.exe") _
1229 And LogFileExists(strPathVC, "include/string.h") _
1230 And LogFileExists(strPathVC, "lib/libcmt.lib") _
1231 And LogFileExists(strPathVC, "lib/msvcrt.lib") _
1232 then
1233 if blnOptVCExpressEdition _
1234 Or ( LogFileExists(strPathVC, "atlmfc/include/atlbase.h") _
1235 And LogFileExists(strPathVC, "atlmfc/lib/atls.lib")) _
1236 Or ( LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h") _
1237 And LogFileExists(g_strPathDDK, "lib/ATL/i386/atls.lib")) _
1238 Then
1239 '' @todo figure out a way we can verify the version/build!
1240 CheckForVisualCPPSub = True
1241 end if
1242 end if
1243end function
1244
1245
1246''
1247' Checks for a platform SDK that works with the compiler
1248sub CheckForPlatformSDK(strOptSDK)
1249 dim strPathPSDK, str
1250 PrintHdr "Windows Platform SDK (recent)"
1251
1252 strPathPSDK = ""
1253
1254 ' Check the supplied argument first.
1255 str = strOptSDK
1256 if str <> "" then
1257 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1258 end if
1259
1260 ' The tools location (first).
1261 if strPathPSDK = "" And g_blnInternalFirst then
1262 str = g_strPathDev & "/win.x86/sdk/200604"
1263 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1264 end if
1265
1266 if strPathPSDK = "" And g_blnInternalFirst then
1267 str = g_strPathDev & "/win.x86/sdk/200504"
1268 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1269 end if
1270
1271 if strPathPSDK = "" And g_blnInternalFirst then
1272 str = g_strPathDev & "/win.x86/sdk/200209"
1273 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1274 end if
1275
1276 ' Look for it in the environment
1277 str = EnvGet("MSSdk")
1278 if strPathPSDK = "" And str <> "" then
1279 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1280 end if
1281
1282 str = EnvGet("Mstools")
1283 if strPathPSDK = "" And str <> "" then
1284 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1285 end if
1286
1287 ' Check if there is one installed with the compiler.
1288 if strPathPSDK = "" And str <> "" then
1289 str = g_strPathVCC & "/PlatformSDK"
1290 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1291 end if
1292
1293 ' Check the registry next (ASSUMES sorting). (first pair is vista, second is pre-vista)
1294 arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1295 for each strSubKey in arrSubKeys
1296 str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
1297 if strPathPSDK = "" And str <> "" then
1298 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1299 end if
1300 Next
1301 arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
1302 for each strSubKey in arrSubKeys
1303 str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
1304 if strPathPSDK = "" And str <> "" then
1305 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1306 end if
1307 Next
1308
1309 arrSubKeys = RegEnumSubKeysRSort("HKLM", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
1310 for each strSubKey in arrSubKeys
1311 str = RegGetString("HKLM\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
1312 if strPathPSDK = "" And str <> "" then
1313 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1314 end if
1315 Next
1316 arrSubKeys = RegEnumSubKeysRSort("HKCU", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
1317 for each strSubKey in arrSubKeys
1318 str = RegGetString("HKCU\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\" & strSubKey & "\Install Dir")
1319 if strPathPSDK = "" And str <> "" then
1320 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1321 end if
1322 Next
1323
1324 ' The tools location (post).
1325 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1326 str = g_strPathDev & "/win.x86/sdk/200604"
1327 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1328 end if
1329
1330 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1331 str = g_strPathDev & "/win.x86/sdk/200504"
1332 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1333 end if
1334
1335 if (strPathPSDK = "") And (g_blnInternalFirst = False) then
1336 str = g_strPathDev & "/win.x86/sdk/200209"
1337 if CheckForPlatformSDKSub(str) then strPathPSDK = str
1338 end if
1339
1340 ' Give up.
1341 if strPathPSDK = "" then
1342 MsgError "Cannot find a suitable Platform SDK. Check configure.log and the build requirements."
1343 exit sub
1344 end if
1345
1346 '
1347 ' Emit the config.
1348 '
1349 strPathPSDK = UnixSlashes(PathAbs(strPathPSDK))
1350 CfgPrint "PATH_SDK_WINPSDK := " & strPathPSDK
1351 CfgPrint "PATH_SDK_WINPSDKINCS = $(PATH_SDK_WINPSDK)"
1352 CfgPrint "PATH_SDK_WIN32SDK = $(PATH_SDK_WINPSDK)"
1353 CfgPrint "PATH_SDK_WIN64SDK = $(PATH_SDK_WINPSDK)"
1354
1355 PrintResult "Windows Platform SDK", strPathPSDK
1356 g_strPathPSDK = strPathPSDK
1357end sub
1358
1359''
1360' Checks if the specified path points to a usable PSDK.
1361function CheckForPlatformSDKSub(strPathPSDK)
1362 CheckForPlatformSDKSub = False
1363 LogPrint "trying: strPathPSDK=" & strPathPSDK
1364 if LogFileExists(strPathPSDK, "include/Windows.h") _
1365 And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _
1366 And LogFileExists(strPathPSDK, "lib/User32.Lib") _
1367 then
1368 CheckForPlatformSDKSub = True
1369 end if
1370end function
1371
1372
1373''
1374' Checks for a Windows 2003 DDK or Windows 7 Driver Kit.
1375sub CheckForWin2k3DDK(strOptDDK)
1376 dim strPathDDK, str, strSubKeys
1377 PrintHdr "Windows 2003 DDK, build 3790 or later"
1378
1379 '
1380 ' Find the DDK.
1381 '
1382 strPathDDK = ""
1383 ' The specified path.
1384 if strPathDDK = "" And strOptDDK <> "" then
1385 if CheckForWin2k3DDKSub(strOptDDK, True) then strPathDDK = strOptDDK
1386 end if
1387
1388 ' The tools location (first).
1389 if strPathDDK = "" And g_blnInternalFirst then
1390 str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
1391 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1392 end if
1393
1394 if strPathDDK = "" And g_blnInternalFirst then
1395 str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
1396 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1397 end if
1398
1399 ' Check the environment
1400 str = EnvGet("DDK_INC_PATH")
1401 if strPathDDK = "" And str <> "" then
1402 str = PathParent(PathParent(str))
1403 if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
1404 end if
1405
1406 str = EnvGet("BASEDIR")
1407 if strPathDDK = "" And str <> "" then
1408 if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
1409 end if
1410
1411 ' Some array constants to ease the work.
1412 arrSoftwareKeys = array("SOFTWARE", "SOFTWARE\Wow6432Node")
1413 arrRoots = array("HKLM", "HKCU")
1414
1415 ' Windows 7 WDK.
1416 arrLocations = array()
1417 for each strSoftwareKey in arrSoftwareKeys
1418 for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits")
1419 for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey)
1420 str = RegGetString("HKLM\" & strSubKey2 & "\setup-install-location")
1421 if str <> "" then
1422 arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
1423 end if
1424 next
1425 next
1426 next
1427 arrLocations = ArrayRSortStrings(arrLocations)
1428
1429 ' Vista WDK.
1430 for each strRoot in arrRoots
1431 for each strSubKey in RegEnumSubKeysFullRSort(strRoot, "SOFTWARE\Microsoft\WINDDK")
1432 str = RegGetString(strRoot & "\" & strSubKey & "\Setup\BUILD")
1433 if str <> "" then arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
1434 Next
1435 next
1436
1437 ' Pre-Vista WDK?
1438 for each strRoot in arrRoots
1439 for each strSubKey in RegEnumSubKeysFullRSort(strRoot, "SOFTWARE\Microsoft\WINDDK")
1440 str = RegGetString(strRoot & "\" & strSubKey & "\SFNDirectory")
1441 if str <> "" then arrLocations = ArrayAppend(arrLocations, PathAbsLong(str))
1442 Next
1443 next
1444
1445 ' Check the locations we've gathered.
1446 for each str in arrLocations
1447 if strPathDDK = "" then
1448 if CheckForWin2k3DDKSub(str, True) then strPathDDK = str
1449 end if
1450 next
1451
1452 ' The tools location (post).
1453 if (strPathDDK = "") And (g_blnInternalFirst = False) then
1454 str = g_strPathDev & "/win.x86/ddkwin2k3/200503"
1455 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1456 end if
1457
1458 if (strPathDDK = "") And (g_blnInternalFirst = False) then
1459 str = g_strPathDev & "/win.x86/ddkwin2k3/2004"
1460 if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
1461 end if
1462
1463 ' Give up.
1464 if strPathDDK = "" then
1465 MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."
1466 exit sub
1467 end if
1468
1469 '
1470 ' Emit the config.
1471 '
1472 strPathDDK = UnixSlashes(PathAbs(strPathDDK))
1473 if LogFileExists(strPathDDK, "inc/api/ntdef.h") then
1474 CfgPrint "VBOX_USE_WINDDK := 1"
1475 CfgPrint "PATH_SDK_WINDDK := " & strPathDDK
1476 else
1477 CfgPrint "PATH_SDK_W2K3DDK := " & strPathDDK
1478 CfgPrint "PATH_SDK_W2K3DDKX86 = $(PATH_SDK_W2K3DDK)"
1479 CfgPrint "PATH_SDK_W2K3DDKAMD64 = $(PATH_SDK_W2K3DDK)"
1480 end if
1481
1482 PrintResult "Windows 2003 DDK", strPathDDK
1483 g_strPathDDK = strPathDDK
1484end sub
1485
1486'' Quick check if the DDK is in the specified directory or not.
1487function CheckForWin2k3DDKSub(strPathDDK, blnCheckBuild)
1488 CheckForWin2k3DDKSub = False
1489 LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
1490 if g_blnNewTools _
1491 And LogFileExists(strPathDDK, "inc/api/ntdef.h") _
1492 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
1493 then
1494 '' @todo figure out a way we can verify the version/build!
1495 CheckForWin2k3DDKSub = True
1496 end if
1497
1498 if LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
1499 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
1500 then
1501 '' @todo figure out a way we can verify the version/build!
1502 CheckForWin2k3DDKSub = True
1503 end if
1504end function
1505
1506
1507''
1508' Finds midl.exe
1509sub CheckForMidl()
1510 dim strMidl
1511 PrintHdr "Midl.exe"
1512
1513 ' Skip if no COM/ATL.
1514 if g_blnDisableCOM then
1515 PrintResultMsg "Midl", "Skipped (" & g_strDisableCOM & ")"
1516 exit sub
1517 end if
1518
1519 if LogFileExists(g_strPathPSDK, "bin/Midl.exe") then
1520 strMidl = g_strPathPSDK & "/bin/Midl.exe"
1521 elseif LogFileExists(g_strPathVCC, "Common7/Tools/Bin/Midl.exe") then
1522 strMidl = g_strPathVCC & "/Common7/Tools/Bin/Midl.exe"
1523 elseif LogFileExists(g_strPathDDK, "bin/x86/Midl.exe") then
1524 strMidl = g_strPathDDK & "/bin/x86/Midl.exe"
1525 elseif LogFileExists(g_strPathDDK, "bin/Midl.exe") then
1526 strMidl = g_strPathDDK & "/bin/Midl.exe"
1527 elseif LogFileExists(g_strPathDev, "win.x86/bin/Midl.exe") then
1528 strMidl = g_strPathDev & "/win.x86/bin/Midl.exe"
1529 else
1530 MsgWarning "Midl.exe not found!"
1531 exit sub
1532 end if
1533
1534 CfgPrint "VBOX_MAIN_IDL = " & strMidl
1535 PrintResult "Midl.exe", strMidl
1536end sub
1537
1538
1539''
1540' Checks for a recent DirectX SDK.
1541sub CheckForDirectXSDK(strOptDXSDK)
1542 dim strPathDXSDK, str, arrSubKeys, arrSubKeys2, strKey, strKey2
1543 PrintHdr "Direct X SDK"
1544
1545 '
1546 ' Find the DX SDK.
1547 '
1548 strPathDXSDK = ""
1549 ' The specified path.
1550 if (strPathDXSDK = "") And (strOptDXSDK <> "") then
1551 if CheckForDirectXSDKSub(strOptDXSDK) then strPathDXSDK = strOptDXSDK
1552 end if
1553
1554 ' The tools location (first).
1555 if (strPathDXSDK = "") And (g_blnInternalFirst = True) then
1556 str = g_strPathDev & "/win.x86/dxsdk/200610"
1557 if CheckForDirectXSDKSub(str) then strPathDXSDK = str
1558 end if
1559
1560 ' Check the installer registry (sucks a bit).
1561 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData")
1562 for Each strSubKey In arrSubKeys
1563 strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\" & strSubKey & "\Products"
1564 arrSubKeys2 = RegEnumSubKeys("HKLM", strKey)
1565 for Each strSubKey2 In arrSubKeys2
1566 strKey2 = "HKLM\" & strKey & "\" & strSubKey2 & "\InstallProperties"
1567 str = RegGetString(strKey2 & "\DisplayName")
1568 if InStr(1, str, "Microsoft DirectX SDK") > 0 then
1569 str = RegGetString(strKey2 & "\InstallLocation")
1570 if (str <> "") And (strPathDXSDK = "") then
1571 if CheckForDirectXSDKSub(str) then
1572 strPathDXSDK = str
1573 Exit For
1574 end if
1575 end if
1576 end if
1577 Next
1578 Next
1579
1580 ' The tools location (post).
1581 if (strPathDXSDK = "") And (g_blnInternalFirst = False) then
1582 str = g_strPathDev & "/win.x86/dxsdk/200610"
1583 if CheckForDirectXSDKSub(str) then strPathDXSDK = str
1584 end if
1585
1586 ' Give up.
1587 if strPathDXSDK = "" then
1588 MsgError "Cannot find a suitable Direct X SDK. Check configure.log and the build requirements."
1589 exit sub
1590 end if
1591
1592 '
1593 ' Emit the config.
1594 '
1595 strPathDXSDK = UnixSlashes(PathAbs(strPathDXSDK))
1596 CfgPrint "PATH_SDK_DXSDK := " & strPathDXSDK
1597 CfgPrint "PATH_SDK_DXSDKX86 = $(PATH_SDK_DXSDK)"
1598 CfgPrint "PATH_SDK_DXSDKAMD64 = $(PATH_SDK_DXSDK)"
1599
1600 PrintResult "Direct X SDK", strPathDXSDK
1601end sub
1602
1603'' Quick check if the DXSDK is in the specified directory or not.
1604function CheckForDirectXSDKSub(strPathDXSDK)
1605 CheckForDirectXSDKSub = False
1606 LogPrint "trying: strPathDXSDK=" & strPathDXSDK
1607 if LogFileExists(strPathDXSDK, "Lib/x86/dxguid.lib") _
1608 then
1609 '' @todo figure out a way we can verify the version/build!
1610 CheckForDirectXSDKSub = True
1611 end if
1612end function
1613
1614
1615''
1616' Checks for a MingW32 suitable for building the recompiler.
1617'
1618' strOptW32API is currently ignored.
1619'
1620sub CheckForMingW(strOptMingw, strOptW32API)
1621 dim strPathMingW, strPathW32API, str
1622 PrintHdr "MinGW GCC v3.3.x + Binutils + Runtime + W32API"
1623
1624 '
1625 ' Find the MinGW and W32API tools.
1626 '
1627 strPathMingW = ""
1628 strPathW32API = ""
1629
1630 ' The specified path.
1631 if (strPathMingW = "") And (strOptMingW <> "") then
1632 if CheckForMingWSub(strOptMingW, strOptW32API) then
1633 strPathMingW = strOptMingW
1634 strPathW32API = strOptW32API
1635 end if
1636 end if
1637
1638 ' The tools location (first).
1639 if (strPathMingW = "") And (g_blnInternalFirst = True) then
1640 str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
1641 str2 = g_strPathDev & "/win.x86/w32api/v2.5"
1642 if CheckForMingWSub(str, str2) then
1643 strPathMingW = str
1644 strPathW32API = str2
1645 end if
1646 end if
1647
1648 ' See if there is any gcc around.
1649 if strPathMingW = "" then
1650 str = Which("mingw32-gcc.exe")
1651 if (str <> "") then
1652 str = PathParent(PathStripFilename(str))
1653 if CheckForMingWSub(str, str) then strPathMingW = str
1654 end if
1655 end if
1656
1657 if strPathMingW = "" then
1658 str = Which("gcc.exe")
1659 if (str <> "") then
1660 str = PathParent(PathStripFilename(str))
1661 if CheckForMingWSub(str, str) then strPathMingW = str
1662 end if
1663 end if
1664
1665 ' The tools location (post).
1666 if (strPathMingW = "") And (g_blnInternalFirst = False) then
1667 str = g_strPathDev & "/win.x86/mingw32/v3.3.3"
1668 str2 = g_strPathDev & "/win.x86/w32api/v2.5"
1669 if CheckForMingWSub(str, str2) then
1670 strPathMingW = str
1671 strPathW32API = str2
1672 end if
1673 end if
1674
1675 ' Success?
1676 if strPathMingW = "" then
1677 if strOptMingw = "" then
1678 MsgError "Can't locate a suitable MinGW installation. Try specify the path with " _
1679 & "the --with-MinGW=<path> argument. If still no luck, consult the configure.log and the build requirements."
1680 else
1681 MsgError "Can't locate a suitable MinGW installation. Please consult the configure.log and the build requirements."
1682 end if
1683 exit sub
1684 end if
1685
1686 '
1687 ' Emit the config.
1688 '
1689 strPathMingW = UnixSlashes(PathAbs(strPathMingW))
1690 CfgPrint "PATH_TOOL_MINGW32 := " & strPathMingW
1691 PrintResult "MinGW (GCC v" & g_strSubOutput & ")", strPathMingW
1692 if (strPathMingW = strPathW32API) Or strPathW32API = "" then
1693 CfgPrint "PATH_SDK_W32API = $(PATH_TOOL_MINGW32)"
1694 else
1695 CfgPrint "PATH_SDK_W32API = " & strPathW32API
1696 PrintResult "W32API", strPathW32API
1697 end if
1698end sub
1699
1700''
1701' Checks if the specified path points to an usable MinGW or not.
1702function CheckForMingWSub(strPathMingW, strPathW32API)
1703 g_strSubOutput = ""
1704 if strPathW32API = "" then strPathW32API = strPathMingW
1705 LogPrint "trying: strPathMingW=" &strPathMingW & " strPathW32API=" & strPathW32API
1706
1707 if LogFileExists(strPathMingW, "bin/mingw32-gcc.exe") _
1708 And LogFileExists(strPathMingW, "bin/ld.exe") _
1709 And LogFileExists(strPathMingW, "bin/objdump.exe") _
1710 And LogFileExists(strPathMingW, "bin/dllwrap.exe") _
1711 And LogFileExists(strPathMingW, "bin/as.exe") _
1712 And LogFileExists(strPathMingW, "include/string.h") _
1713 And LogFileExists(strPathMingW, "include/_mingw.h") _
1714 And LogFileExists(strPathMingW, "lib/dllcrt1.o") _
1715 And LogFileExists(strPathMingW, "lib/dllcrt2.o") _
1716 And LogFileExists(strPathMingW, "lib/libmsvcrt.a") _
1717 _
1718 And LogFileExists(strPathW32API, "lib/libkernel32.a") _
1719 And LogFileExists(strPathW32API, "include/windows.h") _
1720 then
1721 if Shell(DosSlashes(strPathMingW & "/bin/gcc.exe") & " --version", True) = 0 then
1722 dim offVer, iMajor, iMinor, iPatch, strVer
1723
1724 ' extract the version.
1725 strVer = ""
1726 offVer = InStr(1, g_strShellOutput, "(GCC) ")
1727 if offVer > 0 then
1728 strVer = LTrim(Mid(g_strShellOutput, offVer + Len("(GCC) ")))
1729 strVer = RTrim(Left(strVer, InStr(1, strVer, " ")))
1730 if (Mid(strVer, 2, 1) = ".") _
1731 And (Mid(strVer, 4, 1) = ".") then
1732 iMajor = Int(Left(strVer, 1)) ' Is Int() the right thing here? I want atoi()!!!
1733 iMinor = Int(Mid(strVer, 3, 1))
1734 iPatch = Int(Mid(strVer, 5))
1735 else
1736 LogPrint "Malformed version: '" & strVer & "'"
1737 strVer = ""
1738 end if
1739 end if
1740 if strVer <> "" then
1741 if (iMajor = 3) And (iMinor = 3) then
1742 CheckForMingWSub = True
1743 g_strSubOutput = strVer
1744 else
1745 LogPrint "MinGW version '" & iMajor & "." & iMinor & "." & iPatch & "' is not supported (or configure.vbs failed to parse it correctly)."
1746 end if
1747 else
1748 LogPrint "Couldn't locate the GCC version in the output!"
1749 end if
1750
1751 else
1752 LogPrint "Failed to run gcc.exe!"
1753 end if
1754 end if
1755end function
1756
1757
1758''
1759' Checks for any libSDL binaries.
1760sub CheckForlibSDL(strOptlibSDL)
1761 dim strPathlibSDL, str
1762 PrintHdr "libSDL"
1763
1764 '
1765 ' Try find some SDL library.
1766 '
1767
1768 ' First, the specific location.
1769 strPathlibSDL = ""
1770 if (strPathlibSDL = "") And (strOptlibSDL <> "") then
1771 if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL
1772 end if
1773
1774 ' The tools location (first).
1775 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1776 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1777 if CheckForlibSDLSub(str) then strPathlibSDL = str
1778 end if
1779
1780 if (strPathlibSDL = "") And (g_blnInternalFirst = True) Then
1781 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1782 if CheckForlibSDLSub(str) then strPathlibSDL = str
1783 end if
1784
1785 ' Poke about in the path.
1786 str = Which("SDLmain.lib")
1787 if (strPathlibSDL = "") And (str <> "") Then
1788 str = PathParent(PathStripFilename(str))
1789 if CheckForlibSDLSub(str) then strPathlibSDL = str
1790 end if
1791
1792 str = Which("SDL.dll")
1793 if (strPathlibSDL = "") And (str <> "") Then
1794 str = PathParent(PathStripFilename(str))
1795 if CheckForlibSDLSub(str) then strPathlibSDL = str
1796 end if
1797
1798 ' The tools location (post).
1799 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1800 str = g_strPathDev & "/win.x86/libsdl/v1.2.11"
1801 if CheckForlibSDLSub(str) then strPathlibSDL = str
1802 end if
1803
1804 if (strPathlibSDL = "") And (g_blnInternalFirst = False) Then
1805 str = g_strPathDev & "/win.x86/libsdl/v1.2.7-InnoTek"
1806 if CheckForlibSDLSub(str) then strPathlibSDL = str
1807 end if
1808
1809 ' Success?
1810 if strPathlibSDL = "" then
1811 if strOptlibSDL = "" then
1812 MsgError "Can't locate libSDL. Try specify the path with the --with-libSDL=<path> argument. " _
1813 & "If still no luck, consult the configure.log and the build requirements."
1814 else
1815 MsgError "Can't locate libSDL. Please consult the configure.log and the build requirements."
1816 end if
1817 exit sub
1818 end if
1819
1820 strPathLibSDL = UnixSlashes(PathAbs(strPathLibSDL))
1821 CfgPrint "PATH_SDK_LIBSDL := " & strPathlibSDL
1822
1823 PrintResult "libSDL", strPathlibSDL
1824end sub
1825
1826''
1827' Checks if the specified path points to an usable libSDL or not.
1828function CheckForlibSDLSub(strPathlibSDL)
1829 CheckForlibSDLSub = False
1830 LogPrint "trying: strPathlibSDL=" & strPathlibSDL
1831 if LogFileExists(strPathlibSDL, "lib/SDL.lib") _
1832 And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _
1833 And LogFileExists(strPathlibSDL, "lib/SDL.dll") _
1834 And LogFileExists(strPathlibSDL, "include/SDL.h") _
1835 And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _
1836 And LogFileExists(strPathlibSDL, "include/SDL_version.h") _
1837 then
1838 CheckForlibSDLSub = True
1839 end if
1840end function
1841
1842
1843''
1844' Checks for libxml2.
1845sub CheckForXml2(strOptXml2)
1846 dim strPathXml2, str
1847 PrintHdr "libxml2"
1848
1849 ' Skip if no COM/ATL.
1850 if g_blnDisableCOM then
1851 PrintResultMsg "libxml2", "Skipped (" & g_strDisableCOM & ")"
1852 exit sub
1853 end if
1854
1855 '
1856 ' Try find some xml2 dll/lib.
1857 '
1858 strPathXml2 = ""
1859 if (strPathXml2 = "") And (strOptXml2 <> "") then
1860 if CheckForXml2Sub(strOptXml2) then strPathXml2 = strOptXml2
1861 end if
1862
1863 if strPathXml2 = "" Then
1864 str = Which("libxml2.lib")
1865 if str <> "" Then
1866 str = PathParent(PathStripFilename(str))
1867 if CheckForXml2Sub(str) then strPathXml2 = str
1868 end if
1869 end if
1870
1871 ' Ignore failure if we're in 'internal' mode.
1872 if (strPathXml2 = "") and g_blnInternalMode then
1873 PrintResultMsg "libxml2", "ignored (internal mode)"
1874 exit sub
1875 end if
1876
1877 ' Success?
1878 if strPathXml2 = "" then
1879 if strOptXml2 = "" then
1880 MsgError "Can't locate libxml2. Try specify the path with the --with-libxml2=<path> argument. " _
1881 & "If still no luck, consult the configure.log and the build requirements."
1882 else
1883 MsgError "Can't locate libxml2. Please consult the configure.log and the build requirements."
1884 end if
1885 exit sub
1886 end if
1887
1888 strPathXml2 = UnixSlashes(PathAbs(strPathXml2))
1889 CfgPrint "SDK_VBOX_LIBXML2_INCS := " & strPathXml2 & "/include"
1890 CfgPrint "SDK_VBOX_LIBXML2_LIBS := " & strPathXml2 & "/lib/libxml2.lib"
1891
1892 PrintResult "libxml2", strPathXml2
1893end sub
1894
1895''
1896' Checks if the specified path points to an usable libxml2 or not.
1897function CheckForXml2Sub(strPathXml2)
1898 dim str
1899
1900 CheckForXml2Sub = False
1901 LogPrint "trying: strPathXml2=" & strPathXml2
1902 if LogFileExists(strPathXml2, "include/libxml/xmlexports.h") _
1903 And LogFileExists(strPathXml2, "include/libxml/xmlreader.h") _
1904 then
1905 str = LogFindFile(strPathXml2, "bin/libxml2.dll")
1906 if str <> "" then
1907 if LogFindFile(strPathXml2, "lib/libxml2.lib") <> "" then
1908 CheckForXml2Sub = True
1909 end if
1910 end if
1911 end if
1912end function
1913
1914
1915''
1916' Checks for libxslt.
1917sub CheckForXslt(strOptXslt)
1918 dim strPathXslt, str
1919 PrintHdr "libxslt"
1920
1921 ' Skip if no COM/ATL.
1922 if g_blnDisableCOM then
1923 PrintResultMsg "libxslt", "Skipped (" & g_strDisableCOM & ")"
1924 exit sub
1925 end if
1926
1927 '
1928 ' Try find some libxslt dll/lib.
1929 '
1930 strPathXslt = ""
1931 if (strPathXslt = "") And (strOptXslt <> "") then
1932 if CheckForXsltSub(strOptXslt) then strPathXslt = strOptXslt
1933 end if
1934
1935 if strPathXslt = "" Then
1936 str = Which("libxslt.lib")
1937 if str <> "" Then
1938 str = PathParent(PathStripFilename(str))
1939 if CheckForXsltSub(str) then strPathXslt = str
1940 end if
1941 end if
1942
1943 if strPathXslt = "" Then
1944 str = Which("libxslt.dll")
1945 if str <> "" Then
1946 str = PathParent(PathStripFilename(str))
1947 if CheckForXsltSub(str) then strPathXslt = str
1948 end if
1949 end if
1950
1951 ' Ignore failure if we're in 'internal' mode.
1952 if (strPathXslt = "") and g_blnInternalMode then
1953 PrintResultMsg "libxslt", "ignored (internal mode)"
1954 exit sub
1955 end if
1956
1957 ' Success?
1958 if strPathXslt = "" then
1959 if strOptXslt = "" then
1960 MsgError "Can't locate libxslt. Try specify the path with the --with-libxslt=<path> argument. " _
1961 & "If still no luck, consult the configure.log and the build requirements."
1962 else
1963 MsgError "Can't locate libxslt. Please consult the configure.log and the build requirements."
1964 end if
1965 exit sub
1966 end if
1967
1968 strPathXslt = UnixSlashes(PathAbs(strPathXslt))
1969 CfgPrint "SDK_VBOX_LIBXSLT_INCS := " & strPathXslt & "/include"
1970 CfgPrint "SDK_VBOX_LIBXSLT_LIBS := " & strPathXslt & "/lib/libxslt.lib"
1971
1972 PrintResult "libxslt", strPathXslt
1973end sub
1974
1975
1976''
1977' Checks if the specified path points to an usable libxslt or not.
1978function CheckForXsltSub(strPathXslt)
1979 dim str
1980
1981 CheckForXsltSub = False
1982 LogPrint "trying: strPathXslt=" & strPathXslt
1983
1984 if LogFileExists(strPathXslt, "include/libxslt/namespaces.h") _
1985 And LogFileExists(strPathXslt, "include/libxslt/xsltutils.h") _
1986 then
1987 str = LogFindFile(strPathXslt, "lib/libxslt.dll")
1988 if str <> "" then
1989 if LogFileExists(strPathXslt, "lib/libxslt.lib") _
1990 then
1991 CheckForXsltSub = True
1992 end if
1993 end if
1994 end if
1995end function
1996
1997
1998''
1999' Checks for openssl
2000sub CheckForSsl(strOptSsl)
2001 dim strPathSsl, str
2002 PrintHdr "openssl"
2003
2004 '
2005 ' Try find some openssl dll/lib.
2006 '
2007 strPathSsl = ""
2008 if (strPathSsl = "") And (strOptSsl <> "") then
2009 if CheckForSslSub(strOptSsl) then strPathSsl = strOptSsl
2010 end if
2011
2012 if strPathSsl = "" Then
2013 str = Which("ssleay32.lib")
2014 if str <> "" Then
2015 str = PathParent(PathStripFilename(str))
2016 if CheckForSslSub(str) then strPathSsl = str
2017 end if
2018 end if
2019
2020 ' Ignore failure if we're in 'internal' mode.
2021 if (strPathSsl = "") and g_blnInternalMode then
2022 PrintResultMsg "openssl", "ignored (internal mode)"
2023 exit sub
2024 end if
2025
2026 ' Success?
2027 if strPathSsl = "" then
2028 if strOptSsl = "" then
2029 MsgError "Can't locate openssl. Try specify the path with the --with-openssl=<path> argument. " _
2030 & "If still no luck, consult the configure.log and the build requirements."
2031 else
2032 MsgError "Can't locate openssl. Please consult the configure.log and the build requirements."
2033 end if
2034 exit sub
2035 end if
2036
2037 strPathSsl = UnixSlashes(PathAbs(strPathSsl))
2038 CfgPrint "SDK_VBOX_OPENSSL_INCS := " & strPathSsl & "/include"
2039 CfgPrint "SDK_VBOX_OPENSSL_LIBS := " & strPathSsl & "/lib/ssleay32.lib" & " " & strPathSsl & "/lib/libeay32.lib"
2040
2041 PrintResult "openssl", strPathSsl
2042end sub
2043
2044''
2045' Checks if the specified path points to an usable openssl or not.
2046function CheckForSslSub(strPathSsl)
2047
2048 CheckForSslSub = False
2049 LogPrint "trying: strPathSsl=" & strPathSsl
2050 if LogFileExists(strPathSsl, "include/openssl/md5.h") _
2051 And LogFindFile(strPathSsl, "bin/ssleay32.dll") <> "" _
2052 And LogFindFile(strPathSsl, "lib/ssleay32.lib") <> "" _
2053 And LogFindFile(strPathSsl, "bin/libeay32.dll") <> "" _
2054 And LogFindFile(strPathSsl, "lib/libeay32.lib") <> "" _
2055 then
2056 CheckForSslSub = True
2057 end if
2058end function
2059
2060
2061''
2062' Checks for libcurl
2063sub CheckForCurl(strOptCurl)
2064 dim strPathCurl, str
2065 PrintHdr "libcurl"
2066
2067 '
2068 ' Try find some cURL dll/lib.
2069 '
2070 strPathCurl = ""
2071 if (strPathCurl = "") And (strOptCurl <> "") then
2072 if CheckForCurlSub(strOptCurl) then strPathCurl = strOptCurl
2073 end if
2074
2075 if strPathCurl = "" Then
2076 str = Which("libcurl.lib")
2077 if str <> "" Then
2078 str = PathParent(PathStripFilename(str))
2079 if CheckForCurlSub(str) then strPathCurl = str
2080 end if
2081 end if
2082
2083 ' Ignore failure if we're in 'internal' mode.
2084 if (strPathCurl = "") and g_blnInternalMode then
2085 PrintResultMsg "curl", "ignored (internal mode)"
2086 exit sub
2087 end if
2088
2089 ' Success?
2090 if strPathCurl = "" then
2091 if strOptCurl = "" then
2092 MsgError "Can't locate libcurl. Try specify the path with the --with-libcurl=<path> argument. " _
2093 & "If still no luck, consult the configure.log and the build requirements."
2094 else
2095 MsgError "Can't locate libcurl. Please consult the configure.log and the build requirements."
2096 end if
2097 exit sub
2098 end if
2099
2100 strPathCurl = UnixSlashes(PathAbs(strPathCurl))
2101 CfgPrint "SDK_VBOX_LIBCURL_INCS := " & strPathCurl & "/include"
2102 CfgPrint "SDK_VBOX_LIBCURL_LIBS := " & strPathCurl & "/libcurl.lib"
2103
2104 PrintResult "libcurl", strPathCurl
2105end sub
2106
2107''
2108' Checks if the specified path points to an usable libcurl or not.
2109function CheckForCurlSub(strPathCurl)
2110
2111 CheckForCurlSub = False
2112 LogPrint "trying: strPathCurl=" & strPathCurl
2113 if LogFileExists(strPathCurl, "include/curl/curl.h") _
2114 And LogFindFile(strPathCurl, "libcurl.dll") <> "" _
2115 And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
2116 then
2117 CheckForCurlSub = True
2118 end if
2119end function
2120
2121
2122
2123''
2124''
2125' Checks for any Qt4 binaries.
2126sub CheckForQt4(strOptQt4)
2127 dim strPathQt4
2128
2129 PrintHdr "Qt4"
2130
2131 '
2132 ' Try to find the Qt4 installation (user specified path with --with-qt4)
2133 '
2134 strPathQt4 = ""
2135
2136 LogPrint "Checking for user specified path of Qt4 ... "
2137 if (strPathQt4 = "") And (strOptQt4 <> "") then
2138 strOptQt4 = UnixSlashes(strOptQt4)
2139 if CheckForQt4Sub(strOptQt4) then strPathQt4 = strOptQt4
2140 end if
2141
2142 if strPathQt4 = "" then
2143 CfgPrint "VBOX_WITH_QT4GUI="
2144 PrintResultMsg "Qt4", "not found"
2145 else
2146 CfgPrint "PATH_SDK_QT4 := " & strPathQt4
2147 CfgPrint "PATH_TOOL_QT4 = $(PATH_SDK_QT4)"
2148 CfgPrint "VBOX_PATH_QT4 = $(PATH_SDK_QT4)"
2149 PrintResult "Qt4 ", strPathQt4
2150 end if
2151end sub
2152
2153
2154'
2155'
2156function CheckForQt4Sub(strPathQt4)
2157
2158 CheckForQt4Sub = False
2159 LogPrint "trying: strPathQt4=" & strPathQt4
2160
2161 if LogFileExists(strPathQt4, "bin/moc.exe") _
2162 And LogFileExists(strPathQt4, "bin/uic.exe") _
2163 And LogFileExists(strPathQt4, "include/Qt/qwidget.h") _
2164 And LogFileExists(strPathQt4, "include/QtGui/QApplication") _
2165 And LogFileExists(strPathQt4, "include/QtNetwork/QHostAddress") _
2166 And ( LogFileExists(strPathQt4, "lib/QtCore4.lib") _
2167 Or LogFileExists(strPathQt4, "lib/VBoxQtCore4.lib") _
2168 Or LogFileExists(strPathQt4, "lib/QtCoreVBox4.lib")) _
2169 And ( LogFileExists(strPathQt4, "lib/QtNetwork4.lib") _
2170 Or LogFileExists(strPathQt4, "lib/VBoxQtNetwork4.lib") _
2171 Or LogFileExists(strPathQt4, "lib/QtNetworkVBox4.lib")) _
2172 then
2173 CheckForQt4Sub = True
2174 end if
2175
2176end function
2177
2178
2179'
2180'
2181function CheckForPython(strPathPython)
2182
2183 PrintHdr "Python"
2184
2185 CheckForPython = False
2186 LogPrint "trying: strPathPython=" & strPathPython
2187
2188 if LogFileExists(strPathPython, "python.exe") then
2189 CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe"
2190 CheckForPython = True
2191 end if
2192
2193 PrintResult "Python ", strPathPython
2194end function
2195
2196
2197'
2198'
2199function CheckForMkisofs(strFnameMkisofs)
2200
2201 PrintHdr "mkisofs"
2202
2203 CheckForMkisofs = False
2204 LogPrint "trying: strFnameMkisofs=" & strFnameMkisofs
2205
2206 if FileExists(strFnameMkisofs) = false then
2207 LogPrint "Testing '" & strFnameMkisofs & " not found"
2208 else
2209 CfgPrint "VBOX_MKISOFS := " & strFnameMkisofs
2210 CheckForMkisofs = True
2211 end if
2212
2213 PrintResult "mkisofs ", strFnameMkisofs
2214end function
2215
2216
2217''
2218' Show usage.
2219sub usage
2220 Print "Usage: cscript configure.vbs [options]"
2221 Print ""
2222 Print "Configuration:"
2223 Print " -h, --help"
2224 Print " --internal"
2225 Print " --internal-last"
2226 Print ""
2227 Print "Components:"
2228 Print " --disable-COM"
2229 Print ""
2230 Print "Locations:"
2231 Print " --with-DDK=PATH "
2232 Print " --with-DXSDK=PATH "
2233 Print " --with-kBuild=PATH "
2234 Print " --with-libSDL=PATH "
2235 Print " --with-MinGW=PATH "
2236 Print " --with-Qt4=PATH "
2237 Print " --with-SDK=PATH "
2238 Print " --with-VC=PATH "
2239 Print " --with-VC-Common=PATH "
2240 Print " --with-VC-Express-Edition"
2241 Print " --with-W32API=PATH "
2242 Print " --with-libxml2=PATH "
2243 Print " --with-libxslt=PATH "
2244 Print " --with-openssl=PATH "
2245 Print " --with-libcurl=PATH "
2246 Print " --with-python=PATH "
2247end sub
2248
2249
2250''
2251' The main() like function.
2252'
2253Sub Main
2254 '
2255 ' Write the log header and check that we're not using wscript.
2256 '
2257 LogInit
2258 If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then
2259 Wscript.Echo "This script must be run under CScript."
2260 Wscript.Quit(1)
2261 End If
2262
2263 '
2264 ' Parse arguments.
2265 '
2266 strOptDDK = ""
2267 strOptDXDDK = ""
2268 strOptkBuild = ""
2269 strOptlibSDL = ""
2270 strOptMingW = ""
2271 strOptQt4 = ""
2272 strOptSDK = ""
2273 strOptVC = ""
2274 strOptVCCommon = ""
2275 blnOptVCExpressEdition = False
2276 strOptW32API = ""
2277 strOptXml2 = ""
2278 strOptXslt = ""
2279 strOptSsl = ""
2280 strOptCurl = ""
2281 strOptPython = ""
2282 strOptMkisofs = ""
2283 blnOptDisableCOM = False
2284 for i = 1 to Wscript.Arguments.Count
2285 dim str, strArg, strPath
2286
2287 ' Separate argument and path value
2288 str = Wscript.Arguments.item(i - 1)
2289 if InStr(1, str, "=") > 0 then
2290 strArg = Mid(str, 1, InStr(1, str, "=") - 1)
2291 strPath = Mid(str, InStr(1, str, "=") + 1)
2292 if strPath = "" then MsgFatal "Syntax error! Argument #" & i & " is missing the path."
2293 else
2294 strArg = str
2295 strPath = ""
2296 end if
2297
2298 ' Process the argument
2299 select case LCase(strArg)
2300 case "--with-ddk"
2301 strOptDDK = strPath
2302 case "--with-dxsdk"
2303 strOptDXSDK = strPath
2304 case "--with-kbuild"
2305 strOptkBuild = strPath
2306 case "--with-libsdl"
2307 strOptlibSDL = strPath
2308 case "--with-mingw"
2309 strOptMingW = strPath
2310 case "--with-qt4"
2311 strOptQt4 = strPath
2312 case "--with-sdk"
2313 strOptSDK = strPath
2314 case "--with-vc"
2315 strOptVC = strPath
2316 case "--with-vc-common"
2317 strOptVCCommon = strPath
2318 case "--with-vc-express-edition"
2319 blnOptVCExpressEdition = True
2320 case "--with-w32api"
2321 strOptW32API = strPath
2322 case "--with-libxml2"
2323 strOptXml2 = strPath
2324 case "--with-libxslt"
2325 strOptXslt = strPath
2326 case "--with-openssl"
2327 strOptSsl = strPath
2328 case "--with-libcurl"
2329 strOptCurl = strPath
2330 case "--with-python"
2331 strOptPython = strPath
2332 case "--with-mkisofs"
2333 strOptMkisofs = strPath
2334 case "--disable-com"
2335 blnOptDisableCOM = True
2336 case "--enable-com"
2337 blnOptDisableCOM = False
2338 case "--internal"
2339 g_blnInternalMode = True
2340 case "--internal-last"
2341 g_blnInternalFirst = False
2342 case "-h", "--help", "-?"
2343 usage
2344 Wscript.Quit(0)
2345 case else
2346 Wscript.echo "syntax error: Unknown option '" & str &"'."
2347 usage
2348 Wscript.Quit(1)
2349 end select
2350 next
2351
2352 '
2353 ' Initialize output files.
2354 '
2355 CfgInit
2356 EnvInit
2357
2358 '
2359 ' Check that the Shell function is sane.
2360 '
2361 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = "This works"
2362 if Shell("set TESTING_ENVIRONMENT_INHERITANC", False) <> 0 then ' The 'E' is missing on purpose (4nt).
2363 MsgFatal "shell execution test failed!"
2364 end if
2365 if g_strShellOutput <> "TESTING_ENVIRONMENT_INHERITANCE=This works" & CHR(13) & CHR(10) then
2366 MsgFatal "shell inheritance or shell execution isn't working right."
2367 end if
2368 g_objShell.Environment("PROCESS")("TESTING_ENVIRONMENT_INHERITANCE") = ""
2369 Print "Shell inheritance test: OK"
2370
2371 '
2372 ' Do the checks.
2373 '
2374 if blnOptDisableCOM = True then
2375 DisableCOM "--disable-com"
2376 end if
2377 CheckSourcePath
2378 CheckForkBuild strOptkBuild
2379 CheckForWin2k3DDK strOptDDK
2380 CheckForVisualCPP strOptVC, strOptVCCommon, blnOptVCExpressEdition
2381 CheckForPlatformSDK strOptSDK
2382 CheckForMidl
2383 CheckForDirectXSDK strOptDXSDK
2384 CheckForMingW strOptMingw, strOptW32API
2385 CheckForlibSDL strOptlibSDL
2386 ' Don't check for these libraries by default as they are part of OSE
2387 ' Using external libs can add a dependency to iconv
2388 if (strOptXml2 <> "") then
2389 CheckForXml2 strOptXml2
2390 end if
2391 if (strOptXslt <> "") then
2392 CheckForXslt strOptXslt
2393 end if
2394 CheckForSsl strOptSsl
2395 CheckForCurl strOptCurl
2396 CheckForQt4 strOptQt4
2397 if (strOptPython <> "") then
2398 CheckForPython strOptPython
2399 end if
2400 if (strOptMkisofs <> "") then
2401 CheckForMkisofs strOptMkisofs
2402 end if
2403 if g_blnInternalMode then
2404 EnvPrint "call " & g_strPathDev & "/env.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9"
2405 end if
2406
2407 Print ""
2408 Print "Execute env.bat once before you start to build VBox:"
2409 Print ""
2410 Print " env.bat"
2411 Print " kmk"
2412 Print ""
2413
2414End Sub
2415
2416
2417Main
2418
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