VirtualBox

source: vbox/trunk/configure@ 45805

最後變更 在這個檔案從45805是 45772,由 vboxsync 提交於 12 年 前

VPX: allow to build against libvpx provided by the build system

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
檔案大小: 72.0 KB
 
1#!/bin/sh
2# The purpose of this script is to check for all external tools, headers, and
3# libraries VBox OSE depends on.
4
5#
6# Copyright (C) 2006-2013 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.alldomusa.eu.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17LC_ALL=C
18export LC_ALL
19
20# append some extra paths
21PATH="$PATH:/opt/gnome/bin"
22# Solaris (order of paths important for tr, echo, grep, sed to work)
23PATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
24ORGPATH=$PATH
25
26# Wrapper for ancient /usr/bin/which on darwin that always returns 0
27which_wrapper()
28{
29 if [ -z "$have_ancient_which" ]; then
30 if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
31 have_ancient_which="yes"
32 else
33 have_ancient_which="no"
34 fi
35 fi
36 if [ "$have_ancient_which" = "yes" ]; then
37 retval=`which $* 2>/dev/null`
38 echo "$retval"
39 test -n "$retval" -a -x "$retval"
40 unset retval
41 else
42 which $* 2> /dev/null
43 fi
44}
45
46OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr '[:upper:]' '[:lower:]'`
47case "$OS" in
48 linux)
49 ;;
50 darwin)
51 ;;
52 freebsd)
53 ;;
54 sunos)
55 OS='solaris'
56 ;;
57 haiku)
58 ;;
59 *)
60 echo "Cannot determine OS!"
61 exit 1
62 ;;
63esac
64
65#
66# Defaults
67#
68OSE=1
69ODIR="`pwd`/"
70ODIR_OVERRIDE=0
71OUT_PATH=""
72OUT_PATH_OVERRIDE=0
73SETUP_WINE=
74TARGET_MACHINE=""
75TARGET_CPU=""
76WITH_XPCOM=1
77WITH_PYTHON=1
78WITH_JAVA=1
79WITH_VMMRAW=1
80WITH_LIBIDL=1
81WITH_GSOAP=0
82WITH_QT4=1
83WITH_SDL=1
84WITH_SDL_TTF=1
85WITH_X11=1
86WITH_ALSA=1
87WITH_PULSE=1
88WITH_DBUS=1
89WITH_DEVMAPPER=1
90WITH_KMODS=1
91WITH_OPENGL=1
92WITH_HARDENING=1
93WITH_UDPTUNNEL=1
94WITH_VDE=0
95WITH_VNC=0
96WITH_EXTPACK=1
97WITH_DOCS=1
98BUILD_LIBXML2=
99BUILD_LIBCURL=
100BUILD_LIBSSL=
101BUILD_LIBVPX=
102PASSIVE_MESA=0
103CC="gcc"
104CC32=""
105CC64=""
106CXX="g++"
107CXX32=""
108CXX64=""
109YASM="yasm"
110IASL="iasl"
111XSLTPROC="xsltproc"
112GENISOIMAGE="genisoimage"
113MKISOFS="mkisofs"
114INCCRYPTO=""
115LIBCRYPTO="-lssl -lcrypto"
116LIBPTHREAD="-lpthread"
117LIBCAP="-lcap"
118GSOAP=""
119GSOAP_IMPORT=""
120INCX11="/usr/local/include"
121LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
122LIBXCURSOR="-lXcursor"
123LIBXMU="-lXmu"
124LIBXINERAMA="-lXinerama"
125LIBXRANDR="-lXrandr"
126MAKESELF="makeself"
127MESA="-lGL"
128INCZ=""
129LIBZ="-lz"
130INCVNCSERVER=""
131LIBVNCSERVER="-lvncserver"
132INCDEVMAPPER=""
133LIBDEVMAPPER="-ldevmapper"
134CXX_FLAGS=""
135if [ "$OS" = "freebsd" ]; then
136 INCCURL="-I/usr/local/include"
137 LIBCURL="-L/usr/local/lib -lcurl"
138 INCPULSE="-I/usr/local/include"
139 LIBPULSE="-L/usr/local/lib"
140 INCPNG="-I/usr/local/include"
141 LIBPNG="-L/usr/local/lib -lpng"
142else
143 INCCURL=""
144 LIBCURL="-lcurl"
145 INCPNG=""
146 LIBPNG="-lpng"
147fi
148PKGCONFIG="`which_wrapper pkg-config`"
149PYTHONDIR="/usr /usr/local"
150QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
151QT4DIR_PKGCONFIG=1
152QT4UIC3DIR="/usr/bin"
153KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
154DEVDIR="`cd \`dirname $0\`; pwd`/tools"
155if [ -d "/lib/modules/`uname -r`/build" ]; then
156 LINUX="/lib/modules/`uname -r`/build"
157else
158 LINUX="/usr/src/linux"
159fi
160KCHMVIEWER="kchmviewer"
161LOG="configure.log"
162CNF="AutoConfig.kmk"
163ENV="env.sh"
164BUILD_TYPE="release"
165# the restricting tool is ar (mri mode).
166INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
167
168if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
169 echo "Error: VBox base path contains invalid characters!"
170 exit 1
171fi
172
173# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
174if [ "$OS" = "darwin" ]; then
175 ECHO_N="/bin/echo -n"
176else
177 ECHO_N="echo -n"
178fi
179
180
181cleanup()
182{
183 rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
184}
185
186fail()
187{
188 if [ -z "$nofatal" -o "x$1" != "x" ]; then
189 cleanup
190 rm -f $ENV
191 echo "Check $LOG for details"
192 exit 1
193 fi
194}
195
196log()
197{
198 echo "$1"
199 echo "$1" >> $LOG
200}
201
202log_success()
203{
204 if [ -n "$1" ]; then $ECHO_N "$1, "; fi
205 echo "OK."
206 echo "$1" >> $LOG
207 echo >> $LOG
208 echo >> $LOG
209}
210
211log_failure()
212{
213 echo
214 echo " ** $1!"
215 echo "** $1!" >> $LOG
216 echo >> $LOG
217}
218
219cnf_append()
220{
221 printf "%-30s := %s\n" "$1" "$2" >> $CNF
222}
223
224strip_l()
225{
226 echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
227}
228
229strip_L()
230{
231 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
232}
233
234strip_I()
235{
236 echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
237}
238
239prefix_I()
240{
241 echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
242}
243
244check_avail()
245{
246 if [ -z "$1" ]; then
247 log_failure "$2 is empty"
248 fail $3
249 return 1
250 elif which_wrapper $1 > /dev/null; then
251 return 0
252 else
253 log_failure "$1 (variable $2) not found"
254 fail $3
255 return 1
256 fi
257}
258
259
260# Prepare a test
261test_header()
262{
263 echo "***** Checking $1 *****" >> $LOG
264 $ECHO_N "Checking for $1: "
265}
266
267
268# Compile a test
269# $1 compile flags/libs
270# $2 library name
271# $3 package name
272# $4 if this argument is 'nofatal', don't abort
273test_compile()
274{
275 echo "compiling the following source file:" >> $LOG
276 cat $ODIR.tmp_src.cc >> $LOG
277 echo "using the following command line:" >> $LOG
278 echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
279 $CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
280 if [ $? -ne 0 ]; then
281 if [ -z "$4" ]; then
282 echo
283 echo " $2 not found at $1 or $3 headers not found"
284 echo " Check the file $LOG for detailed error information."
285 fail
286 else
287 echo >> $LOG
288 echo >> $LOG
289 fi
290 return 1
291 fi
292 return 0
293}
294
295
296# Execute a compiled test binary
297test_execute()
298{
299 echo "executing the binary" >> $LOG
300 $ODIR.tmp_out > $ODIR.test_execute.log
301 rc=$?
302 cat $ODIR.test_execute.log | tee -a $LOG
303 if [ $rc -ne 0 ]; then
304 fail $1
305 return 1
306 fi
307 echo >> $LOG
308 echo >> $LOG
309 return 0
310}
311
312
313# Execute a compiled test binary
314test_execute_path()
315{
316 echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
317 LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
318 rc=$?
319 cat $ODIR.test_execute.log | tee -a $LOG
320 if [ $rc -ne 0 ]; then
321 fail
322 return 1
323 fi
324 echo >> $LOG
325 echo >> $LOG
326 return 0
327}
328
329
330#
331# Check for OS, MACHINE, CPU
332#
333check_environment()
334{
335 test_header environment
336 BUILD_CPU=`uname -m`
337 [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
338 case "$BUILD_CPU" in
339 i[3456789]86|x86|i86pc|BePC)
340 BUILD_MACHINE='x86'
341 LIB='lib'
342 ;;
343 x86_64|amd64)
344 BUILD_MACHINE='amd64'
345 BUILD_CPU='k8'
346 if [ "$OS" != "solaris" ]; then
347 # on AMD64 systems, 64bit libs are usually located in /usr/lib64
348 # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
349 LIB='lib64'
350 else
351 # Solaris doesn't seem to subscribe to fhs, libs are usually in
352 # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
353 # alternative binaries can be found in 'amd64' subdirs of the 'bin'
354 # ones. So, in order to find the right stuff (esp. sdl-config) we'll
355 # have to make sure the */bin/amd64 dirs are searched before the */bin
356 # ones. (The sed has some sideeffects, but they shouldn't harm us...)
357 echo "64-bit Solaris detected, hacking the PATH" >> $LOG
358 echo "old PATH: $PATH" >> $LOG
359 PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
360 -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
361 export PATH
362 echo "new PATH: $PATH" >> $LOG
363 LIB='lib/64'
364 fi
365 ;;
366 *)
367 log_failure "Cannot determine system"
368 exit 1
369 ;;
370 esac
371 [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
372 [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
373 DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
374 log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
375
376 echo "BUILD_PLATFORM=\"$OS\"" >> $ENV
377 echo "export BUILD_PLATFORM" >> $ENV
378 echo "BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
379 echo "export BUILD_PLATFORM_ARCH" >> $ENV
380 echo "BUILD_TARGET=\"$OS\"" >> $ENV
381 echo "export BUILD_TARGET" >> $ENV
382 echo "BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
383 echo "export BUILD_TARGET_ARCH" >> $ENV
384 echo "BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
385 echo "export BUILD_TARGET_CPU" >> $ENV
386 echo "BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
387 echo "export BUILD_TYPE" >> $ENV
388}
389
390#
391# Check for gcc with version >= 3.2.
392# We depend on a working gcc, if we fail terminate in every case.
393#
394check_gcc()
395{
396 test_header gcc
397 if check_avail "$CC" CC really; then
398 cc_ver=`$CC -dumpversion` 2>/dev/null
399 if [ $? -ne 0 ]; then
400 log_failure "cannot execute '$CC -dumpversion'"
401 fail really
402 fi
403 if check_avail "$CXX" CXX really; then
404 cxx_ver=`$CXX -dumpversion` 2>/dev/null
405 if [ $? -ne 0 ]; then
406 log_failure "cannot execute '$CXX -dumpversion'"
407 fail really
408 fi
409 cc_maj=`echo $cc_ver|cut -d. -f1`
410 cc_min=`echo $cc_ver|cut -d. -f2`
411 if [ "x$cc_ver" != "x$cxx_ver" ]; then
412 log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
413 fail really
414 elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
415 log_success "found version $cc_ver"
416 # gcc-4.0 is allowed for Darwin only
417 elif [ $cc_maj -lt 3 \
418 -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
419 -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
420 -o \( $cc_maj -eq 4 -a $cc_min -gt 8 \) \
421 -o $cc_maj -gt 4 ]; then
422 log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<8"
423 fail really
424 else
425 log_success "found version $cc_ver"
426 fi
427 if [ "$BUILD_MACHINE" = "amd64" ]; then
428 [ -z "$CC32" ] && CC32="$CC -m32"
429 [ -z "$CXX32" ] && CXX32="$CXX -m32"
430 else
431 [ -z "$CC32" ] && CC32="$CC"
432 [ -z "$CXX32" ] && CXX32="$CXX"
433 fi
434 if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
435 [ -z "$CC64" ] && CC64="$CC -m64"
436 [ -z "$CXX64" ] && CXX64="$CXX -m64"
437 fi
438 if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
439 CC32="undefined"
440 CXX32="undefined"
441 fi
442 if [ "$CC" != "gcc" ]; then
443 cnf_append "TOOL_GCC3_CC" "$CC"
444 cnf_append "TOOL_GCC3_AS" "$CC"
445 cnf_append "TOOL_GCC3_LD" "$CC"
446 cnf_append "TOOL_GXX3_CC" "$CC"
447 cnf_append "TOOL_GXX3_AS" "$CC"
448 fi
449 if [ "$CXX" != "g++" ]; then
450 cnf_append "TOOL_GCC3_CXX" "$CXX"
451 cnf_append "TOOL_GXX3_CXX" "$CXX"
452 cnf_append "TOOL_GXX3_LD" "$CXX"
453 fi
454 if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
455 cnf_append "TOOL_GCC32_CC" "$CC32"
456 cnf_append "TOOL_GCC32_AS" "$CC32"
457 cnf_append "TOOL_GCC32_LD" "$CC32"
458 cnf_append "TOOL_GXX32_CC" "$CC32"
459 cnf_append "TOOL_GXX32_AS" "$CC32"
460 fi
461 if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
462 cnf_append "TOOL_GCC32_CXX" "$CXX32"
463 cnf_append "TOOL_GXX32_CXX" "$CXX32"
464 cnf_append "TOOL_GXX32_LD" "$CXX32"
465 fi
466 # this isn't not necessary, there is not such tool.
467 if [ -n "$CC64" ]; then
468 cnf_append "TOOL_GCC64_CC" "$CC64"
469 cnf_append "TOOL_GCC64_AS" "$CC64"
470 cnf_append "TOOL_GCC64_LD" "$CC64"
471 cnf_append "TOOL_GXX64_CC" "$CC64"
472 cnf_append "TOOL_GXX64_AS" "$CC64"
473 fi
474 if [ -n "$CXX64" ]; then
475 cnf_append "TOOL_GCC64_CXX" "$CXX64"
476 cnf_append "TOOL_GXX64_CXX" "$CXX64"
477 cnf_append "TOOL_GXX64_LD" "$CXX64"
478 fi
479 # Solaris sports a 32-bit gcc/g++.
480 if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
481 [ "$CC" = "gcc" ] && CC="gcc -m64"
482 [ "$CXX" = "g++" ] && CXX="g++ -m64"
483 fi
484 fi
485 fi
486}
487
488
489#
490# Check for the OpenWatcom compiler, needed for compiling the BIOS
491#
492# If the system has Open Watcom installed, WATCOM will be set in the
493# environment. If the user has her/his own Open Watcom install it will be
494# pointed to by on the command line, which will set the WATCOM variable.
495# The only exception is detecting OpenWatcom in tools/common/openwatcom.
496#
497check_open_watcom()
498{
499 test_header "Open Watcom"
500
501 if [ -z "$WATCOM" ]; then
502 WATCOM=`/bin/ls -rd1 $PWD/tools/common/openwatcom/* 2> /dev/null | head -1`
503 if [ -z "$WATCOM" ]; then
504 log_failure "Open Watcom was not found"
505 cnf_append "VBOX_WITH_OPEN_WATCOM" ""
506 return 0;
507 fi
508 fi
509
510 case "$OS" in
511 "darwin") wc_bin="binosx";; # ??
512 "dos") wc_bin="binw";;
513 "freebsd") wc_bin="binfbsd";; # ??
514 "linux") wc_bin="binl";;
515 "solaris") wc_bin="binsol";; # ??
516 "os2") wc_bin="binp";;
517 "win") wc_bin="binnt";;
518 *) wc_bin="binl";;
519 esac
520
521 # Check that the tools we use are there.
522 for prog in wasm wcc wlink;
523 do
524 if [ ! -f "$WATCOM/$wc_bin/$prog" ]; then
525 log_failure "$WATCOM/$wc_bin/$prog does not exist or is not a regular file."
526 fail
527 fi
528 done
529
530 # Use WASM to get the version.
531 wasm_ver=`$WATCOM/$wc_bin/wasm -? 2>&1 | sed -e '1!d' -e 's/Open Watcom Assembler Version *//'`
532 if [ -z "$wasm_ver" ]; then
533 log_failure "$WATCOM/$wc_bin/wasm -? did not produce the expected response"
534 fail
535 fi
536 log_success "found version $wasm_ver"
537 cnf_append "PATH_TOOL_OPENWATCOM" "$WATCOM"
538 cnf_append "VBOX_WITH_OPEN_WATCOM" "1"
539
540 unset wasm_ver
541 unset wc_wasm
542 unset wc_bin
543}
544
545
546#
547# Check for yasm, needed to compile assembler files
548#
549check_yasm()
550{
551 test_header yasm
552 if check_avail "$YASM" YASM; then
553 yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
554 if [ $? -ne 0 ]; then
555 log_failure "yasm not found"
556 fail
557 else
558 yasm_maj=`echo $yasm_ver|cut -d. -f1`
559 yasm_min=`echo $yasm_ver|cut -d. -f2`
560 yasm_rev=`echo $yasm_ver|cut -d. -f3`
561 yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
562 if [ $yasm_ver_mul -lt 501 ]; then
563 log_failure "found version $yasm_ver, expected at least 0.5.1"
564 fail
565 else
566 log_success "found version $yasm_ver"
567 fi
568 fi
569 fi
570}
571
572
573#
574# Check for the iasl ACPI compiler, needed to compile vbox.dsl
575#
576check_iasl()
577{
578 test_header iasl
579 if check_avail "$IASL" IASL; then
580 iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
581 if [ $? -ne 0 ]; then
582 log_failure "iasl not found"
583 fail
584 else
585 log_success "found version $iasl_ver"
586 cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
587 fi
588 fi
589}
590
591
592#
593# Check for xsltproc, needed by Main
594#
595check_xsltproc()
596{
597 if [ -n "$BUILD_LIBXSLT" ]; then
598 return 0;
599 fi
600 test_header xslt
601 if check_avail "$XSLTPROC" XSLTPROC; then
602 xsltproc_ver=`$XSLTPROC --version`
603 if [ $? -ne 0 ]; then
604 log_failure "xsltproc not found"
605 fail
606 else
607 log_success "found"
608 cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
609 fi
610 fi
611}
612
613
614#
615# Check for mkisofs, needed to build the CDROM image containing the additions
616#
617check_mkisofs()
618{
619 test_header mkisofs
620 if which_wrapper $GENISOIMAGE > /dev/null; then
621 mkisofs_ver=`$GENISOIMAGE --version`
622 if [ $? -ne 0 ]; then
623 log_failure "mkisofs not found"
624 fail
625 else
626 log_success "found $mkisofs_ver"
627 cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
628 fi
629 elif check_avail "$MKISOFS" MKISOFS; then
630 mkisofs_ver=`$MKISOFS --version`
631 if [ $? -ne 0 ]; then
632 log_failure "mkisofs not working"
633 fail
634 else
635 log_success "found $mkisofs_ver"
636 cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
637 fi
638 fi
639}
640
641
642#
643# Check for libxml2, needed by VBoxSettings and Runtime.
644# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
645#
646check_libxml2()
647{
648 if [ -z "$BUILD_LIBXML2" ]; then
649 test_header libxml2
650 if which_wrapper pkg-config > /dev/null; then
651 libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
652 if [ $? -ne 0 ]; then
653 log_failure "libxml2 not found"
654 fail
655 else
656 FLGXML2=`pkg-config libxml-2.0 --cflags`
657 INCXML2=`strip_I "$FLGXML2"`
658 LIBXML2=`pkg-config libxml-2.0 --libs`
659 cat > $ODIR.tmp_src.cc << EOF
660#include <cstdio>
661#include <libxml/xmlversion.h>
662extern "C" int main(void)
663{
664 printf("found version %s", LIBXML_DOTTED_VERSION);
665#if LIBXML_VERSION >= 20626
666 printf(", OK.\n");
667 return 0;
668#else
669 printf(", expected version 2.6.26 or higher\n");
670 return 1;
671#endif
672}
673EOF
674 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
675 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
676 if test_execute; then
677 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
678 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
679 fi
680 fi
681 fi
682 elif which_wrapper xml2-config; then
683 libxml2_ver=`xml2-config --version`
684 if [ $? -ne 0 ]; then
685 log_failure "xml2-config not found"
686 fail
687 else
688 log_success "found version $libxml2_ver"
689 FLGXML2=`xml2-config --cflags`
690 INCXML2=`strip_I "$FLGXML2"`
691 LIBXML2=`xml2-config --libs`
692 cat > $ODIR.tmp_src.cc << EOF
693#include <cstdio>
694#include <libxml/xmlversion.h>
695extern "C" int main(void)
696{
697 printf("found version %s", LIBXML_DOTTED_VERSION);
698#if LIBXML_VERSION >= 20626
699 printf(", OK.\n");
700 return 0;
701#else
702 printf(", expected version 2.6.26 or higher\n");
703 return 1;
704#endif
705}
706EOF
707 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
708 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
709 if test_execute; then
710 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
711 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
712 fi
713 fi
714 fi
715 else
716 log_failure "neither pkg-config nor xml2-config found"
717 fail
718 fi
719 fi
720}
721
722
723#
724# Check for libIDL, needed by xpcom
725#
726check_libidl()
727{
728 test_header libIDL
729
730 if which_wrapper libIDL-config-2 > /dev/null; then
731 libidl_ver=`libIDL-config-2 --version`
732 if [ $? -ne 0 ]; then
733 log_failure "libIDL-config-2 not working"
734 fail
735 else
736 log_success "found version $libidl_ver"
737 cnf_append "VBOX_LIBIDL_CONFIG" \
738 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
739 fi
740 elif check_avail "libIDL-config" libIDL-config; then
741 libidl_ver=`libIDL-config --version`
742 if [ $? -ne 0 ]; then
743 log_failure "libIDL-config not working"
744 fail
745 else
746 log_success "found version $libidl_ver"
747 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
748 fi
749 fi
750}
751
752
753#
754# Check for libdevmapper, needed by the VBoxVolInfo
755#
756check_libdevmapper()
757{
758 test_header libdevmapper
759 cat > $ODIR.tmp_src.cc << EOF
760#include <cstdio>
761extern "C" {
762#define private
763#include <libdevmapper.h>
764int main()
765{
766 char version[80];
767
768 if (!dm_get_library_version(version, sizeof(version)))
769 {
770 printf("dm_get_library_version() failed.\n");
771 return 1;
772 }
773
774 const char* v=version;
775 unsigned int major = 0, minor = 0, micro = 0;
776
777 for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
778 if (*v == '.') v++;
779 for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
780 if (*v == '.') v++;
781 for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
782
783 printf("found version %s", version);
784 if (major*10000 + minor*100 + micro >= 10200)
785 {
786 printf(", OK.\n");
787 return 0;
788 }
789 else
790 {
791 printf(", expected version 1.02 or higher\n");
792 return 1;
793 }
794}
795}
796EOF
797 if test_compile "$LIBDEVMAPPER $INCDEVMAPPER" libdevmapper libdevmapper; then
798 if test_execute; then
799 cnf_append "VBOX_WITH_DEVMAPPER" "1"
800 fi
801 fi
802}
803
804
805#
806# Check for openssl, needed for RDP and S3
807#
808check_ssl()
809{
810 if [ -z "$BUILD_LIBSSL" ]; then
811 test_header ssl
812 cat > $ODIR.tmp_src.cc << EOF
813#include <cstdio>
814#include <openssl/opensslv.h>
815#include <openssl/ssl.h>
816extern "C" int main(void)
817{
818 printf("found version %s", OPENSSL_VERSION_TEXT);
819 SSL_library_init();
820#if OPENSSL_VERSION_NUMBER >= 0x00908000
821 printf(", OK.\n");
822 return 0;
823#else
824 printf(", expected version 0.9.8 or higher\n");
825 return 1;
826#endif
827}
828EOF
829 if test_compile "$INCCRYPTO $LIBCRYPTO" libcrypto openssl; then
830 if test_execute nofatal; then
831 cnf_append "SDK_VBOX_OPENSSL_INCS" "`strip_I "$INCCRYPTO"`"
832 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
833 cnf_append "SDK_VBOX_BLD_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
834 fi
835 fi
836 fi
837}
838
839
840#
841# Check for pthread, needed by VBoxSVC, frontends, ...
842#
843check_pthread()
844{
845 test_header pthread
846 cat > $ODIR.tmp_src.cc << EOF
847#include <cstdio>
848#include <pthread.h>
849extern "C" int main(void)
850{
851 pthread_mutex_t mutex;
852 if (pthread_mutex_init(&mutex, NULL)) {
853 printf("pthread_mutex_init() failed\n");
854 return 1;
855 }
856 if (pthread_mutex_lock(&mutex)) {
857 printf("pthread_mutex_lock() failed\n");
858 return 1;
859 }
860 if (pthread_mutex_unlock(&mutex)) {
861 printf("pthread_mutex_unlock() failed\n");
862 return 1;
863 }
864 printf("found, OK.\n");
865}
866EOF
867 if test_compile $LIBPTHREAD pthread pthread; then
868 if test_execute; then
869 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
870 fi
871 fi
872}
873
874
875#
876# Check for zlib, needed by VBoxSVC, Runtime, ...
877#
878check_z()
879{
880 test_header zlib
881 cat > $ODIR.tmp_src.cc << EOF
882#include <cstdio>
883#include <zlib.h>
884extern "C" int main(void)
885{
886 printf("found version %s", ZLIB_VERSION);
887#if ZLIB_VERNUM >= 0x1210
888 printf(", OK.\n");
889 return 0;
890#else
891 printf(", expected version 1.2.1 or higher\n");
892 return 1;
893#endif
894}
895EOF
896 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
897 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
898 if test_execute; then
899 echo "if1of (\$(KBUILD_TARGET),darwin freebsd haiku linux solaris)" >> $CNF
900 cnf_append " SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
901 cnf_append " SDK_VBOX_ZLIB_INCS" "$INCZ"
902 echo "endif" >> $CNF
903 fi
904 fi
905}
906
907
908#
909# Check for libpng, needed by kchmviewer
910#
911check_png()
912{
913 test_header libpng
914 cat > $ODIR.tmp_src.cc << EOF
915#include <cstdio>
916#include <png.h>
917extern "C" int main(void)
918{
919 printf("found version %s", PNG_LIBPNG_VER_STRING);
920#if PNG_LIBPNG_VER >= 10205
921 printf(", OK.\n");
922 return 0;
923#else
924 printf(", expected version 1.2.5 or higher\n");
925 return 1;
926#endif
927}
928EOF
929 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
930 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
931 if test_execute; then
932 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
933 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
934 fi
935 fi
936}
937
938#
939# Check for libvncserver, needed for VNC in OSE
940#
941check_vncserver()
942{
943 test_header libvncserver
944 cat > $ODIR.tmp_src.cc <<EOF
945#include <cstdio>
946#include <rfb/rfbconfig.h>
947
948extern "C" int main()
949{
950 const char* v=LIBVNCSERVER_VERSION;
951 unsigned int major = 0, minor = 0, micro = 0;
952
953 for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
954 if (*v == '.') v++;
955 for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
956 if (*v == '.') v++;
957 for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
958
959 printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
960 if (major*10000 + minor*100 + micro >= 900)
961 {
962 printf(", OK.\n");
963 return 0;
964 }
965 else
966 {
967 printf(", expected version 0.9 or higher\n");
968 return 1;
969 }
970}
971EOF
972 if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
973 if test_execute; then
974 cnf_append "VBOX_WITH_EXTPACK_VNC" "1"
975 fi
976 fi
977}
978
979#
980# Check for libcurl, needed by S3
981#
982check_curl()
983{
984 if [ -z "$BUILD_LIBCURL" ]; then
985 test_header libcurl
986 cat > $ODIR.tmp_src.cc << EOF
987#include <cstdio>
988#include <curl/curl.h>
989extern "C" int main(void)
990{
991 printf("found version %s", LIBCURL_VERSION);
992#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71901
993 printf(", OK.\n");
994 return 0;
995#else
996 printf(", expected version 7.19.1 or higher\n");
997 return 1;
998#endif
999}
1000EOF
1001 [ -n "$INCCURL" ] && I_INCCURL=`prefix_I "$INCCURL"`
1002 if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl; then
1003 if test_execute; then
1004 cnf_append "SDK_VBOX_LIBCURL_LIBS" "`strip_l "$LIBCURL"`"
1005 cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
1006 fi
1007 fi
1008 fi
1009}
1010
1011
1012#
1013# Check for pam, needed by VRDPAuth
1014# Version 79 was introduced in 9/2005, do we support older versions?
1015# Debian/sarge uses 76
1016# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
1017#
1018check_pam()
1019{
1020 test_header pam
1021 cat > $ODIR.tmp_src.cc << EOF
1022#include <cstdio>
1023#include <security/pam_appl.h>
1024extern "C" int main(void)
1025{
1026 printf("found version %d", __LIBPAM_VERSION);
1027 if (__LIBPAM_VERSION >= 76)
1028 {
1029 printf(", OK.\n");
1030 return 0;
1031 }
1032 else
1033 {
1034 printf(", expected version 76 or higher\n");
1035 return 1;
1036 }
1037}
1038EOF
1039 if test_compile "-lpam" pam pam nofatal; then
1040 if test_execute nofatal; then
1041 return 0;
1042 fi
1043 fi
1044 echo "pam0.x not found"
1045 test_header linux_pam
1046 cat > $ODIR.tmp_src.cc << EOF
1047#include <cstdio>
1048#include <security/pam_appl.h>
1049extern "C" int main(void)
1050{
1051 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
1052 if (__LINUX_PAM__ >= 1)
1053 {
1054 printf(", OK.\n");
1055 return 0;
1056 }
1057 else
1058 {
1059 printf(", expected version 1.0 or higher\n");
1060 return 1;
1061 }
1062}
1063EOF
1064 if test_compile "-lpam" pam pam; then
1065 test_execute
1066 fi
1067}
1068
1069
1070#
1071# Check for the SDL library, needed by VBoxSDL and VirtualBox
1072# We depend at least on version 1.2.7
1073#
1074check_sdl()
1075{
1076 test_header SDL
1077 if [ "$OS" = "darwin" ]; then
1078 if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
1079 PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
1080 elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
1081 PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
1082 fi
1083 if [ -n "$PATH_SDK_LIBSDL" ]; then
1084 foundsdl=1
1085 INCSDL="$PATH_SDK_LIBSDL/Headers"
1086 FLDSDL="-framework SDL"
1087 else
1088 log_failure "SDL framework not found"
1089 fail
1090 fi
1091 else
1092 if which_wrapper sdl-config > /dev/null; then
1093 FLGSDL=`sdl-config --cflags`
1094 INCSDL=`strip_I "$FLGSDL"`
1095 LIBSDL=`sdl-config --libs`
1096 LIBSDLMAIN="-lSDLmain"
1097 FLDSDL=
1098 foundsdl=1
1099 fi
1100 fi
1101 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1102 if [ -n "$foundsdl" ]; then
1103 cat > $ODIR.tmp_src.cc << EOF
1104#include <cstdio>
1105#include <SDL.h>
1106#include <SDL_main.h>
1107#undef main
1108extern "C" int main(int argc, char** argv)
1109{
1110 printf("found version %d.%d.%d",
1111 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1112#if SDL_VERSION_ATLEAST(1,2,7)
1113 printf(", OK.\n");
1114 return 0;
1115#else
1116 printf(", expected version 1.2.7 or higher\n");
1117 return 1;
1118#endif
1119}
1120EOF
1121 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
1122 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
1123 if test_execute; then
1124 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1125 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1126 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
1127 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1128 [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
1129 fi
1130 fi
1131 else
1132 log_failure "SDL not found"
1133 fail
1134 fi
1135}
1136
1137
1138#
1139# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1140#
1141check_sdl_ttf()
1142{
1143 test_header SDL_ttf
1144 cat > $ODIR.tmp_src.cc << EOF
1145#include <cstdio>
1146#include <SDL_ttf.h>
1147#ifndef SDL_TTF_MAJOR_VERSION
1148#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1149#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1150#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1151#endif
1152extern "C" int main(void)
1153{
1154 printf("found version %d.%d.%d",
1155 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1156#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1157 printf(", OK.\n");
1158 return 0;
1159#else
1160 printf(", expected version 2.0.6 or higher\n");
1161 return 1;
1162#endif
1163}
1164EOF
1165 if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
1166 if ! test_execute nofatal; then
1167 cnf_append "VBOX_WITH_SECURELABEL" ""
1168 fi
1169 else
1170 echo "not found -- disabling VBoxSDL secure label."
1171 cnf_append "VBOX_WITH_SECURELABEL" ""
1172 fi
1173}
1174
1175
1176#
1177# Check for libasound, needed by the ALSA audio backend
1178#
1179check_alsa()
1180{
1181 test_header ALSA
1182 cat > $ODIR.tmp_src.cc << EOF
1183#include <cstdio>
1184#include <alsa/asoundlib.h>
1185extern "C" int main(void)
1186{
1187 printf("found version %d.%d.%d",
1188 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
1189#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
1190 printf(", OK.\n");
1191 return 0;
1192#else
1193 printf(", expected version 1.0.6 or higher\n");
1194 return 1;
1195#endif
1196}
1197EOF
1198 if test_compile "-lasound" asound asound; then
1199 test_execute
1200 fi
1201}
1202
1203
1204#
1205# Check for PulseAudio
1206#
1207check_pulse()
1208{
1209 test_header "PulseAudio"
1210 cat > $ODIR.tmp_src.cc << EOF
1211#include <cstdio>
1212#include <pulse/version.h>
1213extern "C" int main(void)
1214{
1215 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1216#if PA_API_VERSION >= 9
1217 printf(", OK.\n");
1218 return 0;
1219#else
1220 printf(", expected version 0.9.0 (API version 9) or higher\n");
1221 return 1;
1222#endif
1223}
1224EOF
1225 if test_compile "$INCPULSE $LIBPULSE -lpulse" pulse pulse; then
1226 test_execute
1227 fi
1228}
1229
1230
1231#
1232# Check for the X libraries (Xext, X11)
1233#
1234check_x()
1235{
1236 test_header "X libraries"
1237 cat > $ODIR.tmp_src.cc << EOF
1238#include <cstdio>
1239#include <X11/Xlib.h>
1240extern "C" int main(void)
1241{
1242 Display *dpy;
1243 int scrn_num;
1244 Screen *scrn;
1245 Window win;
1246
1247 dpy = XOpenDisplay(NULL);
1248 scrn_num = DefaultScreen(dpy);
1249 scrn = ScreenOfDisplay(dpy, scrn_num);
1250 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1251 0, 16, InputOutput, CopyFromParent, 0, NULL);
1252 XDestroyWindow(dpy, win);
1253 XCloseDisplay(dpy);
1254}
1255EOF
1256 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1257 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1258 log_success "found"
1259 fi
1260}
1261
1262
1263#
1264# Check for the Xcursor library, needed by VBoxSDL.
1265#
1266check_xcursor()
1267{
1268 test_header Xcursor
1269 cat > $ODIR.tmp_src.cc << EOF
1270#include <cstdio>
1271#include <X11/Xlib.h>
1272#include <X11/Xcursor/Xcursor.h>
1273extern "C" int main(void)
1274{
1275 XcursorImage *cursor = XcursorImageCreate (10, 10);
1276 XcursorImageDestroy(cursor);
1277 return 0;
1278}
1279EOF
1280 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1281 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1282 log_success "found"
1283 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1284 fi
1285}
1286
1287
1288#
1289# Check for the Xinerama library, needed by the Qt GUI
1290#
1291check_xinerama()
1292{
1293 test_header Xinerama
1294 cat > $ODIR.tmp_src.cc << EOF
1295#include <X11/Xlib.h>
1296#include <X11/extensions/Xinerama.h>
1297extern "C" int main(void)
1298{
1299 Display *dpy;
1300 Bool flag;
1301 dpy = XOpenDisplay(NULL);
1302 if (dpy)
1303 {
1304 flag = XineramaIsActive(dpy);
1305 XCloseDisplay(dpy);
1306 }
1307}
1308EOF
1309 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1310 if test_compile "$LIBX11 $LIBXINERAMA $I_INCX11" Xinerama Xinerama; then
1311 log_success "found"
1312 fi
1313}
1314
1315
1316#
1317# Check for the Xinerama library, needed by the Qt GUI
1318#
1319check_xrandr()
1320{
1321 test_header Xrandr
1322 cat > $ODIR.tmp_src.cc << EOF
1323#include <X11/Xlib.h>
1324#include <X11/extensions/Xrandr.h>
1325extern "C" int main(void)
1326{
1327 Display *dpy;
1328 Bool flag;
1329 int major, minor;
1330 dpy = XOpenDisplay(NULL);
1331 if (dpy)
1332 {
1333 flag = XRRQueryVersion(dpy, &major, &minor);
1334 XCloseDisplay(dpy);
1335 }
1336}
1337EOF
1338 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1339 if test_compile "$LIBX11 $LIBXRANDR $I_INCX11" Xrandr Xrandr; then
1340 log_success "found"
1341 fi
1342}
1343
1344
1345#
1346# Check for OpenGL
1347#
1348check_opengl()
1349{
1350 # On darwin this is a on/off decision only
1351 if [ "$OS" = "darwin" ]; then
1352 test_header "OpenGL support"
1353 echo "enabled"
1354 cnf_append "VBOX_WITH_CROGL" "1"
1355 else
1356 check_xmu
1357 check_mesa
1358 fi
1359}
1360
1361
1362#
1363# Check for the Xmu library, needed by OpenGL
1364#
1365check_xmu()
1366{
1367 test_header Xmu
1368 cat > $ODIR.tmp_src.cc << EOF
1369#include <cstdio>
1370#include <X11/Xatom.h>
1371#include <X11/Xlib.h>
1372#include <X11/Xutil.h>
1373#include <X11/Xmu/StdCmap.h>
1374extern "C" int main(void)
1375{
1376 Display *dpy;
1377 int scrn_num;
1378 Screen *scrn;
1379
1380 dpy = XOpenDisplay(NULL);
1381 if (dpy)
1382 {
1383 scrn_num = DefaultScreen(dpy);
1384 scrn = ScreenOfDisplay(dpy, scrn_num);
1385 Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
1386 24, XA_RGB_DEFAULT_MAP, False, True);
1387 printf("Status = %x\n", status);
1388 XCloseDisplay(dpy);
1389 }
1390 return 0;
1391}
1392EOF
1393 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1394 if test_compile "$LIBX11 $LIBXMU $I_INCX11" Xmu Xmu; then
1395 log_success "found"
1396 cnf_append "VBOX_XMU_LIBS" "`strip_l "$LIBXMU"`"
1397 fi
1398}
1399
1400#
1401# Check for Mesa, needed by OpenGL
1402#
1403check_mesa()
1404{
1405 test_header "Mesa / GLU"
1406 cat > $ODIR.tmp_src.cc << EOF
1407#include <cstdio>
1408#include <X11/Xlib.h>
1409#include <GL/glx.h>
1410#include <GL/glu.h>
1411extern "C" int main(void)
1412{
1413 Display *dpy;
1414 int major, minor;
1415
1416 dpy = XOpenDisplay(NULL);
1417 if (dpy)
1418 {
1419 Bool glx_version = glXQueryVersion(dpy, &major, &minor);
1420 XCloseDisplay(dpy);
1421 if (glx_version)
1422 {
1423 printf("found version %u.%u, OK.\n", major, minor);
1424 return 0;
1425 }
1426 }
1427 printf("found (inactive), OK.\n");
1428 return 0;
1429}
1430EOF
1431 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1432 if test_compile "$LIBX11 $MESA $I_INCX11" Mesa Mesa; then
1433 [ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
1434 test_execute
1435 fi
1436}
1437
1438
1439#
1440# Check for the Qt4 library, needed by the VirtualBox frontend
1441#
1442# Currently not fatal.
1443#
1444check_qt4()
1445{
1446 foundqt4=
1447 test_header Qt4
1448 if [ "$OS" = "darwin" ]; then
1449 # First check if there is the internal version of Qt. If yes nothing else
1450 # has to be done.
1451 QT_INTERNAL=`/bin/ls -rd1 $PWD/tools/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
1452 for t in $QT_INTERNAL; do
1453 if [ -f "$t/Frameworks/QtCoreVBox.framework/QtCoreVBox" ]; then
1454 cnf_append "VBOX_WITH_QT4_SUN" "1"
1455 log_success "use internal version"
1456 return
1457 fi
1458 done
1459 # Now try the user provided directory and some of the standard directories.
1460 QT_TRIES="$QT4DIR /System/Library /Library"
1461 for t in $QT_TRIES; do
1462 if [ -f "$t/Frameworks/QtCore.framework/QtCore" ]; then
1463 PATH_SDK_QT4="$t"
1464 break
1465 fi
1466 done
1467 # Add the necessary params for building the test application
1468 if [ -n "$PATH_SDK_QT4" ]; then
1469 foundqt4=1
1470 INCQT4=-I$PATH_SDK_QT4/Frameworks/QtCore.framework/Headers
1471 LIBQT4=-F$PATH_SDK_QT4/Frameworks
1472 FLGQT4="-framework QtCore"
1473 else
1474 log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
1475 fail
1476 fi
1477 else
1478 if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1479 # default is to use pkg-config
1480 if which_wrapper pkg-config > /dev/null; then
1481 # this braindead path is necessary for mdv2008.1
1482 qt4_ver=`\
1483 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1484 pkg-config QtCore --modversion 2>> $LOG`
1485 if [ $? -ne 0 ]; then
1486 log_failure "QtCore not found"
1487 fail
1488 else
1489 FLGQT4=`\
1490 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1491 pkg-config QtCore --cflags`
1492 INCQT4=`strip_I "$FLGQT4"`
1493 LIBQT4=`\
1494 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1495 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1496 pkg-config QtCore --libs`
1497 foundqt4=1
1498 fi
1499 else
1500 log_failure "pkg-config not found"
1501 fail
1502 fi
1503 else
1504 # do it the old way (e.g. user has specified QT4DIR)
1505 cat > $ODIR.tmp_src.cc << EOF
1506#include <cstdio>
1507#include <QtGlobal>
1508extern "C" int main(void)
1509{
1510 printf("found version %s", QT_VERSION_STR);
1511#if QT_VERSION >= 0x040602
1512 printf(", OK.\n");
1513 return 0;
1514#else
1515 printf(", expected version 4.6.2 or higher\n");
1516 return 1;
1517#endif
1518}
1519EOF
1520 for q in $QT4DIR; do
1521 INCQT4="$q/include $q/include/QtCore"
1522 FLGQT4="-DQT_SHARED"
1523 I_INCQT4=`prefix_I "$INCQT4"`
1524 LIBQT4="-L$q/lib -lQtCoreVBox"
1525 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1526 foundqt4=2
1527 break;
1528 fi
1529 LIBQT4="-L$q/lib -lQtCore"
1530 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1531 foundqt4=1
1532 break;
1533 fi
1534 done
1535 fi
1536 fi
1537 if [ -n "$foundqt4" ]; then
1538 cat > $ODIR.tmp_src.cc << EOF
1539#include <cstdio>
1540#include <QtGlobal>
1541extern "C" int main(void)
1542{
1543 printf("found version %s", QT_VERSION_STR);
1544#if QT_VERSION >= 0x040602
1545 printf(", OK.\n");
1546 return 0;
1547#else
1548 printf(", expected version 4.6.2 or higher\n");
1549 return 1;
1550#endif
1551}
1552EOF
1553 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1554 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1555 if test_execute_path "`strip_L "$LIBQT4"`"; then
1556 if [ "$OS" = "darwin" ]; then
1557 # Successful build & run the test application so add the necessary
1558 # params to AutoConfig.kmk
1559 cnf_append "PATH_SDK_QT4_INC" "$PATH_SDK_QT4/Frameworks"
1560 cnf_append "PATH_SDK_QT4_LIB" "$PATH_SDK_QT4/Frameworks"
1561 cnf_append "PATH_SDK_QT4" "$PATH_SDK_QT4/Frameworks"
1562 # Check for the moc tool in the Qt directory found & some standard
1563 # directories.
1564 for q in $PATH_SDK_QT4 /usr /Developer/Tools/Qt; do
1565 if which_wrapper "$q/bin/moc" > /dev/null; then
1566 cnf_append "PATH_TOOL_QT4" "$q"
1567 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1568 fi
1569 done
1570 else
1571 # strip .../QtCore as we add components ourself
1572 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1573 # store only the first path, remove all other pathes
1574 # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1575 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1576 cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1577 cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1578 cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1579 # this is not quite right since the qt libpath does not have to be first...
1580 cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1581 if [ "$foundqt4" = "2" ]; then
1582 cnf_append "VBOX_WITH_QT4_SUN" "1"
1583 fi
1584 test_header "Qt4 devtools"
1585 for q in $QT4DIR; do
1586 # first try it with a suffix, some platforms use that
1587 if which_wrapper "$q/bin/moc-qt4" > /dev/null; then
1588 moc_ver=`$q/bin/moc-qt4 -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1589 if [ $? -ne 0 ]; then
1590 log_failure "moc-qt4 not working"
1591 fail
1592 else
1593 log_success "found version $moc_ver"
1594 cnf_append "VBOX_PATH_QT4" "$q"
1595 cnf_append "PATH_SDK_QT4" "$q"
1596 cnf_append "PATH_TOOL_QT4" "$q"
1597 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1598 cnf_append "TOOL_QT4_BIN_SUFF" "-qt4"
1599 return
1600 fi
1601 elif which_wrapper "$q/bin/moc" > /dev/null; then
1602 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1603 if [ $? -ne 0 ]; then
1604 log_failure "moc not working"
1605 fail
1606 else
1607 log_success "found version $moc_ver"
1608 cnf_append "VBOX_PATH_QT4" "$q"
1609 cnf_append "PATH_SDK_QT4" "$q"
1610 cnf_append "PATH_TOOL_QT4" "$q"
1611 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1612 return
1613 fi
1614 fi
1615 done
1616 fi
1617 fi
1618 else
1619 log_failure "qt4 not working"
1620 fail
1621 fi
1622 else
1623 log_failure "qt4 not found"
1624 fail
1625 fi
1626}
1627
1628#
1629# Check for libvpx
1630#
1631check_vpx()
1632{
1633 if [ -z "$BUILD_LIBVPX" ]; then
1634 test_header libvpx
1635 if which_wrapper pkg-config > /dev/null; then
1636 libvpx_ver=`pkg-config vpx --modversion 2>> $LOG`
1637 if [ $? -ne 0 ]; then
1638 log_failure "libvpx not found"
1639 fail
1640 else
1641 FLGVPX=`pkg-config vpx --cflags`
1642 INCVPX=`strip_I "$FLGVPX"`
1643 LIBVPX=`pkg-config vpx --libs`
1644 cat > $ODIR.tmp_src.cc << EOF
1645#include <cstdio>
1646#include <vpx/vpx_codec.h>
1647extern "C" int main(void)
1648{
1649 int version = vpx_codec_version();
1650 int verMajor = VPX_VERSION_MAJOR(version);
1651 int verMinor = VPX_VERSION_MINOR(version);
1652 int verPatch = VPX_VERSION_PATCH(version);
1653 printf("found version %d.%d.%d", verMajor, verMinor, verPatch);
1654 if (verMajor == 1 && verMinor >= 0)
1655 {
1656 printf(", OK.\n");
1657 return 0;
1658 }
1659 else
1660 {
1661 printf(", expected version 1.0.0 or higher\n");
1662 return 1;
1663 }
1664}
1665EOF
1666 [ -n "$INCVPX" ] && I_INCVPX=`prefix_I "$INCVPX"`
1667 if test_compile "$LIBVPX $LIBPTHREAD $I_INCVPX" vpx vpx; then
1668 if test_execute; then
1669 cnf_append "SDK_VBOX_VPX_INCS" "$INCVPX"
1670 cnf_append "SDK_VBOX_VPX_LIBS" "`strip_l "$LIBVPX"`"
1671 fi
1672 fi
1673 fi
1674 fi
1675 fi
1676}
1677
1678
1679
1680#
1681# Check whether static libstdc++ is installed. This library is required
1682# for the Linux guest additions.
1683#
1684check_staticlibstdcxx()
1685{
1686 test_header "static stc++ library"
1687 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1688 cat > $ODIR.tmp_src.cc << EOF
1689#include <string>
1690
1691extern "C" int main(void)
1692{
1693 std::string s = "test";
1694 return 0;
1695}
1696EOF
1697 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1698 log_success "found"
1699 fi
1700}
1701
1702
1703#
1704# Check for Linux sources
1705#
1706check_linux()
1707{
1708 test_header "Linux kernel sources"
1709 cat > $ODIR.tmp_src.c << EOF
1710#include <linux/version.h>
1711int printf(const char *format, ...);
1712int main(void)
1713{
1714 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1715 (LINUX_VERSION_CODE % 65536) / 256,
1716 LINUX_VERSION_CODE % 256);
1717#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1718 printf(", OK.\n");
1719 return 0;
1720#else
1721 printf(", expected version 2.4.0 or higher\n");
1722 return 1;
1723#endif
1724}
1725EOF
1726 echo "compiling the following source file:" >> $LOG
1727 cat $ODIR.tmp_src.c >> $LOG
1728 echo "using the following command line:" >> $LOG
1729 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include " \
1730 "-I$LINUX/include/generated/uapi" >> $LOG
1731 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include \
1732 -I$LINUX/include/generated/uapi >> $LOG 2>&1
1733 if [ $? -ne 0 ]; then
1734 echo
1735 echo " Linux kernel headers not found at $LINUX"
1736 echo " Check the file $LOG for detailed error information."
1737 fail
1738 else
1739 if test_execute; then
1740 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1741 fi
1742 fi
1743}
1744
1745
1746#
1747# Check for kchmviewer, needed to display the online help
1748# (unused as we ship kchmviewer)
1749#
1750check_kchmviewer()
1751{
1752 test_header kchmviewer
1753 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1754 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1755 if [ $? -ne 0 ]; then
1756 log_failure "kchmviewer not working"
1757 fail
1758 else
1759 log_success "found version $kchmviewer_ver"
1760 fi
1761 fi
1762}
1763
1764
1765#
1766# Check for the kBuild tools, we don't support GNU make
1767#
1768check_kbuild()
1769{
1770 test_header kBuild
1771 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1772 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1773 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1774 echo "export PATH_KBUILD" >> $ENV
1775 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1776 echo "export PATH_DEVTOOLS" >> $ENV
1777 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1778 echo "export PATH_KBUILD_BIN" >> $ENV
1779 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1780 if [ "$OS" = "solaris" ]; then
1781 # Because of sh being non-default shell in Solaris we need to export PATH again when
1782 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1783 echo "PATH=\"$ORGPATH\"" >> $ENV
1784 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1785 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1786 else
1787 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1788 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1789 fi
1790 echo "export PATH" >> $ENV
1791 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1792 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1793 elif [ "$OS.$BUILD_MACHINE" = "darwin.amd64" ]; then
1794 # Currently there are no amd64 kBuild bins. So use the x86 variant in any case.
1795 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.x86"
1796 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1797 echo "export PATH_KBUILD" >> $ENV
1798 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1799 echo "export PATH_DEVTOOLS" >> $ENV
1800 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.x86\"" >> $ENV
1801 echo "PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1802 echo "export PATH_KBUILD_BIN" >> $ENV
1803 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1804 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1805 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1806 echo "export PATH" >> $ENV
1807 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1808 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1809 elif check_avail "kmk" KBUILDDIR really; then
1810 # check for installed kBuild
1811 KBUILD_SED="`which_wrapper kmk_sed`"
1812 else
1813 fail
1814 fi
1815 log_success "found"
1816}
1817
1818
1819#
1820# Check for compiler.h
1821# Some Linux distributions include "compiler.h" in their libc linux
1822# headers package, some don't. Most don't need it, building might (!)
1823# not succeed on openSUSE without it.
1824#
1825# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1826#
1827check_compiler_h()
1828{
1829 test_header compiler.h
1830 if ! test -f "/usr/include/linux/compiler.h"; then
1831 log_success "compiler.h not found"
1832 else
1833 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1834 log_success "compiler.h found"
1835 fi
1836}
1837
1838#
1839# Check for libcap.
1840# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1841# sockets for doing ICMP requests.
1842#
1843check_libcap()
1844{
1845 test_header "libcap library"
1846 cat > $ODIR.tmp_src.cc << EOF
1847#include <cstdio>
1848#include <sys/types.h>
1849#include <linux/types.h>
1850#include <sys/capability.h>
1851
1852extern "C" int main(void)
1853{
1854 char buf[1024];
1855 cap_t caps = cap_get_proc();
1856 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1857 return 0;
1858}
1859EOF
1860 if test_compile $LIBCAP libcap libcap; then
1861 if test_execute; then
1862 log_success "found"
1863 fi
1864 fi
1865}
1866
1867#
1868# Check if we are able to build 32-bit applications (needed for the guest additions)
1869#
1870check_32bit()
1871{
1872 test_header "32-bit support"
1873 cat > $ODIR.tmp_src.c << EOF
1874#include <stdint.h>
1875int main(void)
1876{
1877 return 0;
1878}
1879EOF
1880 echo "compiling the following source file:" >> $LOG
1881 cat $ODIR.tmp_src.c >> $LOG
1882 echo "using the following command line:" >> $LOG
1883 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1884 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1885 if [ $? -ne 0 ]; then
1886 echo
1887 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1888 echo " Check the file $LOG for detailed error information."
1889 fail
1890 else
1891 echo "executing the binary" >> $LOG
1892 $ODIR.tmp_out 2> $ODIR.test_execute.log
1893 rc=$?
1894 cat $ODIR.test_execute.log >> $LOG
1895 if [ $rc -ne 0 ]; then
1896 echo
1897 echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
1898 echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
1899 fail
1900 return 1
1901 fi
1902 fi
1903 log_success ""
1904}
1905
1906
1907#
1908# Check for Python
1909#
1910check_python()
1911{
1912 test_header "Python support"
1913
1914 # On darwin this is a on/off decision only
1915 if [ "$OS" = "darwin" ]; then
1916 echo "enabled"
1917 cnf_append "VBOX_WITH_PYTHON" "1"
1918 return
1919 fi
1920
1921 cat > $ODIR.tmp_src.cc << EOF
1922#include <cstdio>
1923#include <Python.h>
1924extern "C" int main(void)
1925{
1926 Py_Initialize();
1927 printf("found version %s", PY_VERSION);
1928#if PY_VERSION_HEX >= 0x02030000
1929 printf(", OK.\n");
1930 return 0;
1931#else
1932 printf(", expected version 2.3 or higher\n");
1933 return 1;
1934#endif
1935}
1936EOF
1937 found=
1938# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1939 if [ "$OS" != "solaris" ]; then
1940 SUPPYTHONLIBS="python2.7 python2.6 python2.5 python2.4 python2.3"
1941 else
1942 SUPPYTHONLIBS="python2.4"
1943 fi
1944 for p in $PYTHONDIR; do
1945 for d in $SUPPYTHONLIBS; do
1946 for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
1947 echo "compiling the following source file:" >> $LOG
1948 cat $ODIR.tmp_src.cc >> $LOG
1949 echo "using the following command line:" >> $LOG
1950 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1951 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1952 if [ $? -eq 0 ]; then
1953 found=1
1954 break
1955 fi
1956 done
1957 if [ -n "$found" ]; then break; fi
1958 done
1959 if [ -n "$found" ]; then break; fi
1960 done
1961 if [ -n "$found" ]; then
1962 if test_execute; then
1963 cnf_append "VBOX_WITH_PYTHON" "1"
1964 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1965 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1966 else
1967 log_failure "Python not working"
1968 fail
1969 fi
1970 else
1971 log_failure "Python not found"
1972 fail
1973 fi
1974}
1975
1976
1977#
1978# Check for Java
1979#
1980check_java()
1981{
1982 test_header "Java support"
1983 log_success
1984}
1985
1986
1987#
1988# Setup wine
1989#
1990setup_wine()
1991{
1992 test_header "Wine support"
1993 if ! which_wrapper wine > /dev/null; then
1994 echo " wine binary not found"
1995 fail
1996 fi
1997 if ! which_wrapper wine > /dev/null; then
1998 echo " wine not found"
1999 fail
2000 fi
2001 wine_version="`wine --version`"
2002 case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
2003 "0")
2004 if ! which_wrapper wineprefixcreate > /dev/null; then
2005 echo " wineprefixcreate not found"
2006 fail
2007 fi
2008 ;;
2009 *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
2010 esac
2011 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
2012 echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
2013 echo "export WINEPREFIX" >> $ENV
2014 rm -rf $WINEPREFIX
2015 mkdir -p $WINEPREFIX
2016 touch $WINEPREFIX/.no_prelaunch_window_flag
2017 if ! wineprefixcreate -q > /dev/null 2>&1; then
2018 echo " wineprefixcreate failed"
2019 fail
2020 fi
2021 tmp=.tmp.wine.reg
2022 rm -f $tmp
2023 echo 'REGEDIT4' > $tmp
2024 echo '' >> $tmp
2025 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
2026 echo "\"PATH\"=\"c:\\\\\\\\windows\\\\\\\\system32;c:\\\\\\\\windows;z:$DEVDIR/win.x86/vcc/v8/bin/Microsoft.VC80.CRT;z:$DEVDIR/win.x86/HTML_Help_Workshop/v1.3\"" >> $tmp
2027 echo '' >> $tmp
2028 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
2029 echo '"itss"="native"' >> $tmp
2030 echo '' >> $tmp
2031 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
2032 echo '"itss"="native"' >> $tmp
2033 echo '' >> $tmp
2034 if ! wine regedit $tmp > /dev/null 2>&1; then
2035 rm -f $tmp
2036 echo " failed to load registry changes (path)."
2037 fail
2038 fi
2039 rm -f $tmp
2040 log_success "found"
2041}
2042
2043
2044#
2045# Check for gSOAP.
2046#
2047check_gsoap()
2048{
2049 test_header "GSOAP compiler"
2050 if [ -z "$GSOAP" -a -z "$GSOAP_IMPORT" ]; then
2051 if which_wrapper pkg-config > /dev/null; then
2052 GSOAP_CXX_LIBS=`pkg-config gsoapssl++ --libs 2>> $LOG`
2053 if [ $? -eq 0 ]; then
2054 GSOAP=`pkg-config gsoapssl++ --variable=exec_prefix`
2055 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2056 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2057 GSOAP_IMPORT="$GSOAP/include/gsoap"
2058 fi
2059 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2060 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2061 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2062 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2063 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2064 else
2065 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2066 fi
2067 cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
2068 gsoap_version=`pkg-config gsoapssl++ --modversion`
2069 log_success "found version $gsoap_version"
2070 return
2071 fi
2072 fi
2073 fi
2074 if [ -z "$GSOAP" ]; then
2075 GSOAP="/usr"
2076 fi
2077 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
2078 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
2079 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
2080 # TODO: Check for libgsoap++.a/so
2081
2082 if [ -z "$GSOAP_IMPORT" ]; then
2083 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2084 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2085 GSOAP_IMPORT="$GSOAP/include/gsoap"
2086 fi
2087 fi
2088 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
2089 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2090 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2091 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2092 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2093 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2094 else
2095 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2096 fi
2097 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoapssl++"
2098 log_success "found"
2099 else
2100 log_failure "stlvector.h not found -- disabling webservice"
2101 cnf_append "VBOX_WITH_WEBSERVICES" ""
2102 fi
2103 else
2104 log_failure "stdsoap2.h not found -- disabling webservice"
2105 cnf_append "VBOX_WITH_WEBSERVICES" ""
2106 fi
2107 else
2108 log_failure "wsdl2h not found -- disabling webservice"
2109 cnf_append "VBOX_WITH_WEBSERVICES" ""
2110 fi
2111 else
2112 log_failure "soapcpp2 not found -- disabling webservice"
2113 cnf_append "VBOX_WITH_WEBSERVICES" ""
2114 fi
2115}
2116
2117
2118#
2119# Determines the Darwin version.
2120# @todo This should really check the Xcode/SDK version.
2121#
2122check_darwinversion()
2123{
2124 test_header "Darwin version"
2125 darwin_ver=`uname -r`
2126 case "$darwin_ver" in
2127 11\.*)
2128 darwin_ver="10.7" # Lion
2129 sdk=/Developer/SDKs/MacOSX10.6.sdk
2130 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2131 ;;
2132 10\.*)
2133 darwin_ver="10.6" # Snow Leopard
2134 if [ "$BUILD_MACHINE" = "x86" ]; then
2135 sdk=/Developer/SDKs/MacOSX10.5.sdk
2136 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2137 cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
2138 else
2139 sdk=/Developer/SDKs/MacOSX10.6.sdk
2140 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2141 fi
2142# test "$CC" = "gcc" && CC="gcc-4.0"
2143# test "$CXX" = "g++" && CXX="g++-4.0"
2144 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2145 ;;
2146 9\.*)
2147 darwin_ver="10.5" # Leopard
2148 sdk=/Developer/SDKs/MacOSX10.5.sdk
2149 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2150# test "$CC" = "gcc" && CC="gcc-4.0"
2151# test "$CXX" = "g++" && CXX="g++-4.0"
2152 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2153 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2154 ;;
2155 8\.*)
2156 darwin_ver="10.4" # Tiger
2157 sdk=/Developer/SDKs/MacOSX10.4u.sdk
2158 CXX_FLAGS="-mmacosx-version-min=10.4 -isysroot $sdk -Wl,-syslibroot,$sdk"
2159# test "$CC" = "gcc" && CC="gcc-4.0"
2160# test "$CXX" = "g++" && CXX="g++-4.0"
2161 cnf_append "VBOX_WITH_COCOA_QT" ""
2162 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2163 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2164 ;;
2165 *)
2166 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
2167 fail
2168 darwin_ver="unknown"
2169 ;;
2170 esac
2171 log_success "found version $darwin_ver (SDK: $sdk)"
2172}
2173
2174
2175check_makeself()
2176{
2177 test_header "makeself"
2178 if check_avail "$MAKESELF" makeself; then
2179 makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2180 if [ $? -ne 0 ]; then
2181 log_failure "makeself not working"
2182 fail
2183 else
2184 log_success "found version $makeself_ver"
2185 cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2186 fi
2187 fi
2188}
2189
2190
2191#
2192# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
2193# is around to prevent confusion when the build fails in src/recompiler.
2194# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
2195#
2196check_i386elfgcc()
2197{
2198 test_header "i386-elf-gcc"
2199 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
2200 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
2201 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
2202 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
2203 if test -z "$i386_elf_gcc"; then
2204 echo " failed to find i386-elf-gcc"
2205 fail
2206 fi
2207 log_success "found $i386_elf_gcc"
2208}
2209
2210
2211#
2212# Show help
2213#
2214show_help()
2215{
2216cat << EOF
2217Usage: ./configure [OPTIONS]...
2218
2219Configuration:
2220 -h, --help display this help and exit
2221 --nofatal don't abort on errors
2222EOF
2223[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
2224[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
2225[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
2226[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
2227[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
2228[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
2229[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
2230[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
2231[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
2232[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
2233[ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
2234[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
2235[ $OSE -eq 0 ] && echo " --disable-extpack don't build the extpack"
2236[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
2237[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
2238cat << EOF
2239 --disable-udptunnel disable UDP tunnel networking
2240 --disable-devmapper disable device mapper library access
2241 --disable-hardening don't be strict about /dev/vboxdrv access
2242 --build-libxml2 build libxml2 from sources
2243EOF
2244[ $OSE -eq 0 ] && cat << EOF
2245 --build-libssl build openssl from sources
2246 --build-libcurl build libcurl from sources
2247 --build-libvpx build libvpx from sources
2248EOF
2249[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
2250cat << EOF
2251
2252Paths:
2253 --with-gcc=PATH location of the gcc compiler [$CC]
2254 --with-g++=PATH location of the g++ compiler [$CXX]
2255 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
2256 --with-iasl=PATH location of the iasl compiler [$IASL]
2257 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
2258 --with-makeself=PATH location of makeself [$MAKESELF]
2259EOF
2260[ "$OS" = "linux" ] && echo " --with-linux=DIR Linux kernel source directory [$LINUX]"
2261[ $WITH_QT4 -eq 1 ] && echo " --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]"
2262[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
2263[ $WITH_GSOAP -eq 1 ] && echo " (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
2264[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
2265cat << EOF
2266 --with-openssl-dir=DIR directory for OpenSSL headers/libraries
2267 --with-ow-dir=DIR directory where Open Watcom can be found [$WATCOM]
2268 --out-path=PATH the folder to which configuration and build output
2269 should go
2270
2271Build type:
2272 -d, --build-debug build with debugging symbols and assertions
2273 --build-profile build with profiling support
2274 --build-headless build headless (without any GUI frontend)
2275EOF
2276 exit 0
2277}
2278
2279
2280#
2281# The body.
2282#
2283
2284# test if we are OSE
2285if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
2286 OSE=0
2287 # Set this as a reminder to print a log message once we know the path of the
2288 # log file
2289 NOT_OSE=1
2290fi
2291
2292# Change OS specific defaults; must be before all other stuff
2293if [ "$OS" = "darwin" ]; then
2294 WITH_SDL=0
2295 WITH_SDL_TTF=0
2296 WITH_X11=0
2297 WITH_ALSA=0
2298 WITH_PULSE=0
2299 WITH_DBUS=0
2300 WITH_KMODS=0
2301 BUILD_LIBXML2=1
2302 BUILD_LIBVPX=1
2303 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2304elif [ "$OS" = "haiku" ]; then
2305 #WITH_SDL=0
2306 WITH_SDL_TTF=0
2307 WITH_X11=0
2308 WITH_ALSA=0
2309 WITH_PULSE=0
2310 WITH_DBUS=0
2311 WITH_KMODS=0
2312 WITH_LIBIDL=0
2313 WITH_XPCOM=0
2314 BUILD_LIBXSLT=1
2315 BUILD_LIBXML2=1
2316 # it is part of libroot, which is linked by default,
2317 # but the script wants something
2318 LIBPTHREAD="-lroot"
2319 #[ $OSE -eq 1] || BUILD_LIBCURL=1
2320 [ $OSE -eq 1] || BUILD_LIBSSL=1
2321fi
2322
2323# scan command line options
2324for option in $*; do
2325 case "$option" in
2326 --help|-help|-h)
2327 show_help
2328 ;;
2329 --nofatal)
2330 nofatal=1
2331 ;;
2332 --env-only)
2333 ENV_ONLY=1
2334 ;;
2335 --with-gcc=*)
2336 CC=`echo $option | cut -d'=' -f2`
2337 ;;
2338 --with-g++=*)
2339 CXX=`echo $option | cut -d'=' -f2`
2340 ;;
2341 --with-kbuild=*)
2342 KBUILDDIR=`echo $option | cut -d'=' -f2`
2343 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2344 echo "Error: KBUILDDIR contains invalid characters!"
2345 exit 1
2346 fi
2347 ;;
2348 --with-qt-dir=*|--with-qt4-dir=*)
2349 QT4DIR=`echo $option | cut -d'=' -f2`
2350 QT4DIR_PKGCONFIG=0
2351 ;;
2352 --with-openssl-dir=*)
2353 OPENSSLDIR=`echo $option | cut -d'=' -f2`
2354 INCCRYPTO="-I${OPENSSLDIR}/include"
2355 LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
2356 ;;
2357 --with-ow-dir=*)
2358 WATCOM=`echo $option | cut -d'=' -f2`
2359 ;;
2360 --with-gsoap-dir=*)
2361 GSOAP=`echo $option | cut -d'=' -f2`
2362 ;;
2363 --with-gsoap-import=*)
2364 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2365 ;;
2366 --with-iasl=*)
2367 IASL=`echo $option | cut -d'=' -f2`
2368 ;;
2369 --with-linux=*)
2370 LINUX=`echo $option | cut -d'=' -f2`
2371 ;;
2372 --with-mkisofs=*)
2373 MKISOFS=`echo $option | cut -d'=' -f2`
2374 ;;
2375 --with-makeself=*)
2376 MAKESELF=`echo $option | cut -d'=' -f2`
2377 ;;
2378 --target-arch=*)
2379 TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2380 ;;
2381 --disable-xpcom)
2382 [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
2383 ;;
2384 --disable-python)
2385 [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
2386 ;;
2387 --disable-java)
2388 [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2389 ;;
2390 --disable-vmmraw)
2391 [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2392 ;;
2393 --disable-sdl-ttf)
2394 [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
2395 ;;
2396 --disable-qt)
2397 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2398 ;;
2399 --disable-qt4)
2400 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2401 ;;
2402 --passive-mesa)
2403 PASSIVE_MESA=1
2404 ;;
2405 --disable-alsa)
2406 [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
2407 ;;
2408 --disable-pulse)
2409 [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
2410 ;;
2411 --enable-pulse)
2412 WITH_PULSE=2
2413 ;;
2414 --disable-dbus)
2415 [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
2416 ;;
2417 --disable-kmods)
2418 [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
2419 ;;
2420 --disable-opengl)
2421 [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
2422 ;;
2423 --enable-webservice)
2424 [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
2425 ;;
2426 --enable-vnc)
2427 WITH_VNC=1
2428 ;;
2429 --disable-hardening)
2430 WITH_HARDENING=0
2431 ;;
2432 --disable-extpack)
2433 WITH_EXTPACK=0
2434 ;;
2435 --disable-docs)
2436 WITH_DOCS=0
2437 ;;
2438 --enable-hardening)
2439 WITH_HARDENING=2
2440 ;;
2441 --disable-udptunnel)
2442 WITH_UDPTUNNEL=0
2443 ;;
2444 --enable-vde)
2445 WITH_VDE=1
2446 ;;
2447 --disable-devmapper)
2448 WITH_DEVMAPPER=0
2449 ;;
2450 --build-debug|-d)
2451 BUILD_TYPE=debug
2452 ;;
2453 --build-profile)
2454 BUILD_TYPE=profile
2455 ;;
2456 --build-libxml2)
2457 BUILD_LIBXML2=1
2458 ;;
2459 --build-libssl)
2460 BUILD_LIBSSL=1
2461 ;;
2462 --build-libcurl)
2463 BUILD_LIBCURL=1
2464 ;;
2465 --build-libvpx)
2466 BUILD_LIBVPX=1
2467 ;;
2468 --build-headless)
2469 HEADLESS=1
2470 WITH_SDL=0
2471 WITH_SDL_TTF=0
2472 WITH_X11=0
2473 WITH_OPENGL=0
2474 WITH_QT4=0
2475 ;;
2476 --ose)
2477 OSE=2
2478 ;;
2479 --odir=*)
2480 ODIR="`echo $option | cut -d'=' -f2`/"
2481 ODIR_OVERRIDE=1
2482 ;;
2483 --out-path=*)
2484 out_path="`echo $option | cut -d'=' -f2`/"
2485 if [ -d $out_path ]; then
2486 saved_path="`pwd`"
2487 cd $out_path
2488 OUT_PATH="`pwd`"
2489 cd $saved_path
2490 OUT_PATH_OVERRIDE=1
2491 if [ $ODIR_OVERRIDE -eq 0 ]; then
2492 # This variable has not *yet* been overridden. That can still happen.
2493 ODIR=$OUT_PATH/
2494 fi
2495 else
2496 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2497 exit 1
2498 fi
2499 ;;
2500 --setup-wine)
2501 [ "$OS" != "darwin" ] && SETUP_WINE=1
2502 ;;
2503 *)
2504 echo
2505 echo "Unrecognized option \"$option\""
2506 echo
2507 show_help
2508 ;;
2509 esac
2510done
2511
2512LOG="$ODIR$LOG"
2513ENV="$ODIR$ENV"
2514CNF="$ODIR$CNF"
2515
2516# initialize output files
2517cat > $LOG << EOF
2518# Log file generated by
2519#
2520# '$0 $*'
2521#
2522
2523EOF
2524cat > $CNF << EOF
2525# -*- Makefile -*-
2526#
2527# automatically generated by
2528#
2529# '$0 $*'
2530#
2531# It will be completely overwritten if configure is executed again.
2532#
2533
2534EOF
2535cat > $ENV << EOF
2536#!/bin/bash
2537#
2538# automatically generated by
2539#
2540# '$0 $*'
2541#
2542# It will be completely overwritten if configure is executed again.
2543# Make sure you source this file once before you start to build VBox.
2544#
2545
2546EOF
2547
2548# Print log warning about OSE if necessary
2549if [ -n "$NOT_OSE" ]; then
2550 echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
2551 echo >> $LOG
2552fi
2553
2554
2555if [ "$BUILD_TYPE" = "debug" ]; then
2556 echo "Creating DEBUG build!" >> $LOG
2557elif [ "$BUILD_TYPE" = "profile" ]; then
2558 echo "Creating PROFILE build!" >> $LOG
2559fi
2560
2561# first determine our environment
2562check_environment
2563check_kbuild
2564
2565[ -n "$ENV_ONLY" ] && exit 0
2566
2567# append the tools directory to the default search path
2568echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2569export PATH
2570
2571# if we will be writing to a different out directory then set this up now
2572if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2573 echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2574 echo "export AUTOCFG" >> $ENV
2575 echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2576 echo "export LOCALCFG" >> $ENV
2577 echo "PATH_OUT_BASE=$OUT_PATH" >> $ENV
2578 echo "export PATH_OUT_BASE" >> $ENV
2579fi
2580
2581# some things are not available in for OSE
2582if [ $OSE -ge 1 ]; then
2583 cnf_append "VBOX_OSE" "1"
2584 cnf_append "VBOX_WITH_TESTSUITE" ""
2585 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2586
2587 if [ "$OS" = "linux" ]; then
2588 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2589 else
2590 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2591 fi
2592 echo >> $CNF
2593fi
2594
2595# extpack
2596if [ $OSE -eq 0 ]; then
2597 if [ $WITH_EXTPACK -eq 1 ]; then
2598 BUILD_LIBSSL=1
2599 else
2600 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2601 fi
2602fi
2603
2604# headless
2605if [ -n "$HEADLESS" ]; then
2606 cnf_append "VBOX_HEADLESS" "1"
2607fi
2608
2609# emit disable directives corresponding to any --disable-xxx options.
2610if [ $WITH_OPENGL -eq 0 ]; then
2611 cnf_append "VBOX_WITH_CROGL" ""
2612 cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
2613 cnf_append "VBOX_GUI_USE_QGL" ""
2614fi
2615[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2616[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2617[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2618[ $WITH_PYTHON -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2619[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JXPCOM" ""
2620[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JWS" ""
2621[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2622[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2623[ $WITH_VMMRAW -eq 0 ] && cnf_append "VBOX_WITH_RAW_MODE" ""
2624
2625# Darwin-specific
2626if [ "$OS" = "darwin" ]; then
2627 check_darwinversion
2628fi
2629# the tools
2630check_gcc
2631check_open_watcom
2632[ "$OS" != "darwin" ] && check_iasl
2633# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2634# [ "$OS" != "darwin" ] && check_yasm
2635[ "$OS" != "darwin" ] && check_xsltproc
2636[ "$OS" != "darwin" ] && check_mkisofs
2637
2638# the libraries
2639[ "$OS" != "darwin" ] && check_pthread
2640check_libxml2
2641[ $WITH_LIBIDL -eq 1 ] && check_libidl
2642check_ssl
2643check_curl
2644check_vpx
2645[ "$OS" != "darwin" ] && check_z
2646[ "$OS" != "darwin" ] && check_png
2647[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2648[ $WITH_SDL -eq 1 ] && check_sdl
2649[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2650[ $WITH_X11 -eq 1 ] && check_x
2651# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2652# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2653[ $WITH_X11 -eq 1 ] && check_xcursor
2654[ $WITH_X11 -eq 1 ] && check_xinerama
2655[ $WITH_X11 -eq 1 ] && check_xrandr
2656[ $WITH_OPENGL -eq 1 ] && check_opengl
2657[ $WITH_QT4 -eq 1 ] && check_qt4
2658[ $WITH_PYTHON -eq 1 ] && check_python
2659[ $WITH_JAVA -eq 1 ] && check_java
2660
2661# PulseAudio
2662if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2663 if [ $WITH_PULSE -eq 1 ]; then
2664 check_pulse
2665 elif [ $WITH_PULSE -eq 0 ]; then
2666 cnf_append "VBOX_WITH_PULSE" ""
2667 fi
2668fi
2669
2670# Linux-specific
2671if [ "$OS" = "linux" ]; then
2672 # don't check for the static libstdc++ in the PUEL version as we build the
2673 # additions at a dedicated box
2674 [ $OSE -ge 1 ] && check_staticlibstdcxx
2675 if [ $WITH_KMODS -eq 1 ]; then
2676 check_linux
2677 else
2678 cnf_append "VBOX_LINUX_SRC" ""
2679 cnf_append "VBOX_WITH_VBOXDRV" ""
2680 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2681 fi
2682 if [ $WITH_ALSA -eq 1 ]; then
2683 check_alsa
2684 else
2685 cnf_append "VBOX_WITH_ALSA" ""
2686 fi
2687 if [ $WITH_DBUS -eq 0 ]; then
2688 cnf_append "VBOX_WITH_DBUS" ""
2689 fi
2690 if [ $WITH_DEVMAPPER -eq 1 ]; then
2691 check_libdevmapper
2692 else
2693 cnf_append "VBOX_WITH_DEVMAPPER" ""
2694 fi
2695 check_libcap
2696 check_compiler_h
2697 [ "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
2698 # tools/common/makeself*
2699 [ $OSE -ge 1 ] && check_makeself
2700fi
2701
2702[ -n "$SETUP_WINE" ] && setup_wine
2703
2704if [ $WITH_GSOAP -eq 1 ]; then
2705 check_gsoap
2706else
2707 if [ $OSE -ge 1 ]; then
2708 cnf_append "VBOX_WITH_WEBSERVICES" ""
2709 fi
2710fi
2711
2712# UDPTUNNEL
2713if [ $WITH_UDPTUNNEL -eq 0 ]; then
2714 cnf_append "VBOX_WITH_UDPTUNNEL" ""
2715fi
2716
2717# VDE
2718if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2719 if [ $WITH_VDE -eq 1 ]; then
2720 cnf_append "VBOX_WITH_VDE" "1"
2721 fi
2722fi
2723
2724# DOCS
2725if [ $WITH_DOCS -eq 0 ]; then
2726 cnf_append "VBOX_WITH_DOCS" ""
2727 cnf_append "VBOX_WITH_DOCS_PACKING" ""
2728fi
2729
2730# VNC server support
2731if [ $OSE -ge 1 ]; then
2732 if [ $WITH_VNC = 1 ]; then
2733 check_vncserver
2734 else
2735 cnf_append "VBOX_WITH_EXTPACK_VNC" ""
2736 fi
2737fi
2738
2739# success!
2740echo
2741echo "Successfully generated '$CNF' and '$ENV'."
2742echo "Source '$ENV' once before you start to build VBox:"
2743echo ""
2744echo " source $ENV"
2745echo " kmk"
2746echo ""
2747if [ "$OS" = "linux" ]; then
2748 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2749 vbox_out_path=$OUT_PATH
2750 else
2751 vbox_out_path=./out
2752 fi
2753 echo "To compile the kernel modules, do:"
2754 echo ""
2755 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2756 echo " make"
2757 echo ""
2758fi
2759if [ $WITH_HARDENING -gt 0 ]; then
2760 echo ""
2761 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2762 echo " Hardening is enabled which means that the VBox binaries will not run from"
2763 echo " the binary directory. The binaries have to be installed suid root and some"
2764 echo " more prerequisites have to be fulfilled which is normally done by installing"
2765 echo " the final package. For development, the hardening feature can be disabled"
2766 echo " by specifying the --disable-hardening parameter. Please never disable that"
2767 echo " feature for the final distribution!"
2768 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2769 echo ""
2770else
2771 echo ""
2772 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2773 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2774 echo " disabled hardening!"
2775 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2776 echo ""
2777fi
2778echo "Enjoy!"
2779cleanup
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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