VirtualBox

source: vbox/trunk/configure@ 44876

Last change on this file since 44876 was 44580, checked in by vboxsync, 12 years ago

VBoxBFE: RIP.

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

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