VirtualBox

source: vbox/trunk/configure@ 45819

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

configure: don't depend on pkg-config for check_vpx

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

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