VirtualBox

source: vbox/trunk/configure@ 45537

Last change on this file since 45537 was 45450, checked in by vboxsync, 12 years ago

configure/Config: allow gcc-4.8

  • 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 8 \) \
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 " \
1678 "-I$LINUX/include/generated/uapi" >> $LOG
1679 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include \
1680 -I$LINUX/include/generated/uapi >> $LOG 2>&1
1681 if [ $? -ne 0 ]; then
1682 echo
1683 echo " Linux kernel headers not found at $LINUX"
1684 echo " Check the file $LOG for detailed error information."
1685 fail
1686 else
1687 if test_execute; then
1688 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1689 fi
1690 fi
1691}
1692
1693
1694#
1695# Check for kchmviewer, needed to display the online help
1696# (unused as we ship kchmviewer)
1697#
1698check_kchmviewer()
1699{
1700 test_header kchmviewer
1701 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1702 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1703 if [ $? -ne 0 ]; then
1704 log_failure "kchmviewer not working"
1705 fail
1706 else
1707 log_success "found version $kchmviewer_ver"
1708 fi
1709 fi
1710}
1711
1712
1713#
1714# Check for the kBuild tools, we don't support GNU make
1715#
1716check_kbuild()
1717{
1718 test_header kBuild
1719 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1720 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1721 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1722 echo "export PATH_KBUILD" >> $ENV
1723 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1724 echo "export PATH_DEVTOOLS" >> $ENV
1725 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1726 echo "export PATH_KBUILD_BIN" >> $ENV
1727 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1728 if [ "$OS" = "solaris" ]; then
1729 # Because of sh being non-default shell in Solaris we need to export PATH again when
1730 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1731 echo "PATH=\"$ORGPATH\"" >> $ENV
1732 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1733 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1734 else
1735 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1736 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1737 fi
1738 echo "export PATH" >> $ENV
1739 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1740 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1741 elif [ "$OS.$BUILD_MACHINE" = "darwin.amd64" ]; then
1742 # Currently there are no amd64 kBuild bins. So use the x86 variant in any case.
1743 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.x86"
1744 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1745 echo "export PATH_KBUILD" >> $ENV
1746 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1747 echo "export PATH_DEVTOOLS" >> $ENV
1748 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.x86\"" >> $ENV
1749 echo "PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1750 echo "export PATH_KBUILD_BIN" >> $ENV
1751 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1752 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1753 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1754 echo "export PATH" >> $ENV
1755 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1756 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1757 elif check_avail "kmk" KBUILDDIR really; then
1758 # check for installed kBuild
1759 KBUILD_SED="`which_wrapper kmk_sed`"
1760 else
1761 fail
1762 fi
1763 log_success "found"
1764}
1765
1766
1767#
1768# Check for compiler.h
1769# Some Linux distributions include "compiler.h" in their libc linux
1770# headers package, some don't. Most don't need it, building might (!)
1771# not succeed on openSUSE without it.
1772#
1773# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1774#
1775check_compiler_h()
1776{
1777 test_header compiler.h
1778 if ! test -f "/usr/include/linux/compiler.h"; then
1779 log_success "compiler.h not found"
1780 else
1781 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1782 log_success "compiler.h found"
1783 fi
1784}
1785
1786#
1787# Check for libcap.
1788# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1789# sockets for doing ICMP requests.
1790#
1791check_libcap()
1792{
1793 test_header "libcap library"
1794 cat > $ODIR.tmp_src.cc << EOF
1795#include <cstdio>
1796#include <sys/types.h>
1797#include <linux/types.h>
1798#include <sys/capability.h>
1799
1800extern "C" int main(void)
1801{
1802 char buf[1024];
1803 cap_t caps = cap_get_proc();
1804 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1805 return 0;
1806}
1807EOF
1808 if test_compile $LIBCAP libcap libcap; then
1809 if test_execute; then
1810 log_success "found"
1811 fi
1812 fi
1813}
1814
1815#
1816# Check if we are able to build 32-bit applications (needed for the guest additions)
1817#
1818check_32bit()
1819{
1820 test_header "32-bit support"
1821 cat > $ODIR.tmp_src.c << EOF
1822#include <stdint.h>
1823int main(void)
1824{
1825 return 0;
1826}
1827EOF
1828 echo "compiling the following source file:" >> $LOG
1829 cat $ODIR.tmp_src.c >> $LOG
1830 echo "using the following command line:" >> $LOG
1831 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1832 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1833 if [ $? -ne 0 ]; then
1834 echo
1835 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1836 echo " Check the file $LOG for detailed error information."
1837 fail
1838 else
1839 echo "executing the binary" >> $LOG
1840 $ODIR.tmp_out 2> $ODIR.test_execute.log
1841 rc=$?
1842 cat $ODIR.test_execute.log >> $LOG
1843 if [ $rc -ne 0 ]; then
1844 echo
1845 echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
1846 echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
1847 fail
1848 return 1
1849 fi
1850 fi
1851 log_success ""
1852}
1853
1854
1855#
1856# Check for Python
1857#
1858check_python()
1859{
1860 test_header "Python support"
1861
1862 # On darwin this is a on/off decision only
1863 if [ "$OS" = "darwin" ]; then
1864 echo "enabled"
1865 cnf_append "VBOX_WITH_PYTHON" "1"
1866 return
1867 fi
1868
1869 cat > $ODIR.tmp_src.cc << EOF
1870#include <cstdio>
1871#include <Python.h>
1872extern "C" int main(void)
1873{
1874 Py_Initialize();
1875 printf("found version %s", PY_VERSION);
1876#if PY_VERSION_HEX >= 0x02030000
1877 printf(", OK.\n");
1878 return 0;
1879#else
1880 printf(", expected version 2.3 or higher\n");
1881 return 1;
1882#endif
1883}
1884EOF
1885 found=
1886# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1887 if [ "$OS" != "solaris" ]; then
1888 SUPPYTHONLIBS="python2.7 python2.6 python2.5 python2.4 python2.3"
1889 else
1890 SUPPYTHONLIBS="python2.4"
1891 fi
1892 for p in $PYTHONDIR; do
1893 for d in $SUPPYTHONLIBS; do
1894 for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
1895 echo "compiling the following source file:" >> $LOG
1896 cat $ODIR.tmp_src.cc >> $LOG
1897 echo "using the following command line:" >> $LOG
1898 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1899 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1900 if [ $? -eq 0 ]; then
1901 found=1
1902 break
1903 fi
1904 done
1905 if [ -n "$found" ]; then break; fi
1906 done
1907 if [ -n "$found" ]; then break; fi
1908 done
1909 if [ -n "$found" ]; then
1910 if test_execute; then
1911 cnf_append "VBOX_WITH_PYTHON" "1"
1912 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1913 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1914 else
1915 log_failure "Python not working"
1916 fail
1917 fi
1918 else
1919 log_failure "Python not found"
1920 fail
1921 fi
1922}
1923
1924
1925#
1926# Check for Java
1927#
1928check_java()
1929{
1930 test_header "Java support"
1931 log_success
1932}
1933
1934
1935#
1936# Setup wine
1937#
1938setup_wine()
1939{
1940 test_header "Wine support"
1941 if ! which_wrapper wine > /dev/null; then
1942 echo " wine binary not found"
1943 fail
1944 fi
1945 if ! which_wrapper wine > /dev/null; then
1946 echo " wine not found"
1947 fail
1948 fi
1949 wine_version="`wine --version`"
1950 case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
1951 "0")
1952 if ! which_wrapper wineprefixcreate > /dev/null; then
1953 echo " wineprefixcreate not found"
1954 fail
1955 fi
1956 ;;
1957 *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
1958 esac
1959 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1960 echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1961 echo "export WINEPREFIX" >> $ENV
1962 rm -rf $WINEPREFIX
1963 mkdir -p $WINEPREFIX
1964 touch $WINEPREFIX/.no_prelaunch_window_flag
1965 if ! wineprefixcreate -q > /dev/null 2>&1; then
1966 echo " wineprefixcreate failed"
1967 fail
1968 fi
1969 tmp=.tmp.wine.reg
1970 rm -f $tmp
1971 echo 'REGEDIT4' > $tmp
1972 echo '' >> $tmp
1973 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1974 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
1975 echo '' >> $tmp
1976 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1977 echo '"itss"="native"' >> $tmp
1978 echo '' >> $tmp
1979 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1980 echo '"itss"="native"' >> $tmp
1981 echo '' >> $tmp
1982 if ! wine regedit $tmp > /dev/null 2>&1; then
1983 rm -f $tmp
1984 echo " failed to load registry changes (path)."
1985 fail
1986 fi
1987 rm -f $tmp
1988 log_success "found"
1989}
1990
1991
1992#
1993# Check for gSOAP.
1994#
1995check_gsoap()
1996{
1997 test_header "GSOAP compiler"
1998 if [ -z "$GSOAP" -a -z "$GSOAP_IMPORT" ]; then
1999 if which_wrapper pkg-config > /dev/null; then
2000 GSOAP_CXX_LIBS=`pkg-config gsoapssl++ --libs 2>> $LOG`
2001 if [ $? -eq 0 ]; then
2002 GSOAP=`pkg-config gsoapssl++ --variable=exec_prefix`
2003 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2004 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2005 GSOAP_IMPORT="$GSOAP/include/gsoap"
2006 fi
2007 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2008 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2009 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2010 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2011 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2012 else
2013 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2014 fi
2015 cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
2016 gsoap_version=`pkg-config gsoapssl++ --modversion`
2017 log_success "found version $gsoap_version"
2018 return
2019 fi
2020 fi
2021 fi
2022 if [ -z "$GSOAP" ]; then
2023 GSOAP="/usr"
2024 fi
2025 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
2026 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
2027 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
2028 # TODO: Check for libgsoap++.a/so
2029
2030 if [ -z "$GSOAP_IMPORT" ]; then
2031 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2032 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2033 GSOAP_IMPORT="$GSOAP/include/gsoap"
2034 fi
2035 fi
2036 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
2037 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2038 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2039 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2040 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2041 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2042 else
2043 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2044 fi
2045 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoapssl++"
2046 log_success "found"
2047 else
2048 log_failure "stlvector.h not found -- disabling webservice"
2049 cnf_append "VBOX_WITH_WEBSERVICES" ""
2050 fi
2051 else
2052 log_failure "stdsoap2.h not found -- disabling webservice"
2053 cnf_append "VBOX_WITH_WEBSERVICES" ""
2054 fi
2055 else
2056 log_failure "wsdl2h not found -- disabling webservice"
2057 cnf_append "VBOX_WITH_WEBSERVICES" ""
2058 fi
2059 else
2060 log_failure "soapcpp2 not found -- disabling webservice"
2061 cnf_append "VBOX_WITH_WEBSERVICES" ""
2062 fi
2063}
2064
2065
2066#
2067# Determines the Darwin version.
2068# @todo This should really check the Xcode/SDK version.
2069#
2070check_darwinversion()
2071{
2072 test_header "Darwin version"
2073 darwin_ver=`uname -r`
2074 case "$darwin_ver" in
2075 11\.*)
2076 darwin_ver="10.7" # Lion
2077 sdk=/Developer/SDKs/MacOSX10.6.sdk
2078 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2079 ;;
2080 10\.*)
2081 darwin_ver="10.6" # Snow Leopard
2082 if [ "$BUILD_MACHINE" = "x86" ]; then
2083 sdk=/Developer/SDKs/MacOSX10.5.sdk
2084 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2085 cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
2086 else
2087 sdk=/Developer/SDKs/MacOSX10.6.sdk
2088 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2089 fi
2090# test "$CC" = "gcc" && CC="gcc-4.0"
2091# test "$CXX" = "g++" && CXX="g++-4.0"
2092 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2093 ;;
2094 9\.*)
2095 darwin_ver="10.5" # Leopard
2096 sdk=/Developer/SDKs/MacOSX10.5.sdk
2097 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2098# test "$CC" = "gcc" && CC="gcc-4.0"
2099# test "$CXX" = "g++" && CXX="g++-4.0"
2100 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2101 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2102 ;;
2103 8\.*)
2104 darwin_ver="10.4" # Tiger
2105 sdk=/Developer/SDKs/MacOSX10.4u.sdk
2106 CXX_FLAGS="-mmacosx-version-min=10.4 -isysroot $sdk -Wl,-syslibroot,$sdk"
2107# test "$CC" = "gcc" && CC="gcc-4.0"
2108# test "$CXX" = "g++" && CXX="g++-4.0"
2109 cnf_append "VBOX_WITH_COCOA_QT" ""
2110 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2111 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2112 ;;
2113 *)
2114 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
2115 fail
2116 darwin_ver="unknown"
2117 ;;
2118 esac
2119 log_success "found version $darwin_ver (SDK: $sdk)"
2120}
2121
2122
2123check_makeself()
2124{
2125 test_header "makeself"
2126 if check_avail "$MAKESELF" makeself; then
2127 makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2128 if [ $? -ne 0 ]; then
2129 log_failure "makeself not working"
2130 fail
2131 else
2132 log_success "found version $makeself_ver"
2133 cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2134 fi
2135 fi
2136}
2137
2138
2139#
2140# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
2141# is around to prevent confusion when the build fails in src/recompiler.
2142# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
2143#
2144check_i386elfgcc()
2145{
2146 test_header "i386-elf-gcc"
2147 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
2148 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
2149 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
2150 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
2151 if test -z "$i386_elf_gcc"; then
2152 echo " failed to find i386-elf-gcc"
2153 fail
2154 fi
2155 log_success "found $i386_elf_gcc"
2156}
2157
2158
2159#
2160# Show help
2161#
2162show_help()
2163{
2164cat << EOF
2165Usage: ./configure [OPTIONS]...
2166
2167Configuration:
2168 -h, --help display this help and exit
2169 --nofatal don't abort on errors
2170EOF
2171[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
2172[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
2173[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
2174[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
2175[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
2176[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
2177[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
2178[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
2179[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
2180[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
2181[ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
2182[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
2183[ $OSE -eq 0 ] && echo " --disable-extpack don't build the extpack"
2184[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
2185[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
2186cat << EOF
2187 --disable-udptunnel disable UDP tunnel networking
2188 --disable-devmapper disable device mapper library access
2189 --disable-hardening don't be strict about /dev/vboxdrv access
2190 --build-libxml2 build libxml2 from sources
2191EOF
2192[ $OSE -eq 0 ] && cat << EOF
2193 --build-libssl build openssl from sources
2194 --build-libcurl build libcurl from sources
2195EOF
2196[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
2197cat << EOF
2198
2199Paths:
2200 --with-gcc=PATH location of the gcc compiler [$CC]
2201 --with-g++=PATH location of the g++ compiler [$CXX]
2202 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
2203 --with-iasl=PATH location of the iasl compiler [$IASL]
2204 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
2205 --with-makeself=PATH location of makeself [$MAKESELF]
2206EOF
2207[ "$OS" = "linux" ] && echo " --with-linux=DIR Linux kernel source directory [$LINUX]"
2208[ $WITH_QT4 -eq 1 ] && echo " --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]"
2209[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
2210[ $WITH_GSOAP -eq 1 ] && echo " (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
2211[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
2212cat << EOF
2213 --with-openssl-dir=DIR directory for OpenSSL headers/libraries
2214 --with-ow-dir=DIR directory where Open Watcom can be found [$WATCOM]
2215 --out-path=PATH the folder to which configuration and build output
2216 should go
2217
2218Build type:
2219 -d, --build-debug build with debugging symbols and assertions
2220 --build-profile build with profiling support
2221 --build-headless build headless (without any GUI frontend)
2222EOF
2223 exit 0
2224}
2225
2226
2227#
2228# The body.
2229#
2230
2231# test if we are OSE
2232if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
2233 OSE=0
2234 # Set this as a reminder to print a log message once we know the path of the
2235 # log file
2236 NOT_OSE=1
2237fi
2238
2239# Change OS specific defaults; must be before all other stuff
2240if [ "$OS" = "darwin" ]; then
2241 WITH_SDL=0
2242 WITH_SDL_TTF=0
2243 WITH_X11=0
2244 WITH_ALSA=0
2245 WITH_PULSE=0
2246 WITH_DBUS=0
2247 WITH_KMODS=0
2248 BUILD_LIBXML2=1
2249 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2250elif [ "$OS" = "haiku" ]; then
2251 #WITH_SDL=0
2252 WITH_SDL_TTF=0
2253 WITH_X11=0
2254 WITH_ALSA=0
2255 WITH_PULSE=0
2256 WITH_DBUS=0
2257 WITH_KMODS=0
2258 WITH_LIBIDL=0
2259 WITH_XPCOM=0
2260 BUILD_LIBXSLT=1
2261 BUILD_LIBXML2=1
2262 # it is part of libroot, which is linked by default,
2263 # but the script wants something
2264 LIBPTHREAD="-lroot"
2265 #[ $OSE -eq 1] || BUILD_LIBCURL=1
2266 [ $OSE -eq 1] || BUILD_LIBSSL=1
2267fi
2268
2269# scan command line options
2270for option in $*; do
2271 case "$option" in
2272 --help|-help|-h)
2273 show_help
2274 ;;
2275 --nofatal)
2276 nofatal=1
2277 ;;
2278 --env-only)
2279 ENV_ONLY=1
2280 ;;
2281 --with-gcc=*)
2282 CC=`echo $option | cut -d'=' -f2`
2283 ;;
2284 --with-g++=*)
2285 CXX=`echo $option | cut -d'=' -f2`
2286 ;;
2287 --with-kbuild=*)
2288 KBUILDDIR=`echo $option | cut -d'=' -f2`
2289 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2290 echo "Error: KBUILDDIR contains invalid characters!"
2291 exit 1
2292 fi
2293 ;;
2294 --with-qt-dir=*|--with-qt4-dir=*)
2295 QT4DIR=`echo $option | cut -d'=' -f2`
2296 QT4DIR_PKGCONFIG=0
2297 ;;
2298 --with-openssl-dir=*)
2299 OPENSSLDIR=`echo $option | cut -d'=' -f2`
2300 INCCRYPTO="-I${OPENSSLDIR}/include"
2301 LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
2302 ;;
2303 --with-ow-dir=*)
2304 WATCOM=`echo $option | cut -d'=' -f2`
2305 ;;
2306 --with-gsoap-dir=*)
2307 GSOAP=`echo $option | cut -d'=' -f2`
2308 ;;
2309 --with-gsoap-import=*)
2310 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2311 ;;
2312 --with-iasl=*)
2313 IASL=`echo $option | cut -d'=' -f2`
2314 ;;
2315 --with-linux=*)
2316 LINUX=`echo $option | cut -d'=' -f2`
2317 ;;
2318 --with-mkisofs=*)
2319 MKISOFS=`echo $option | cut -d'=' -f2`
2320 ;;
2321 --with-makeself=*)
2322 MAKESELF=`echo $option | cut -d'=' -f2`
2323 ;;
2324 --target-arch=*)
2325 TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2326 ;;
2327 --disable-xpcom)
2328 [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
2329 ;;
2330 --disable-python)
2331 [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
2332 ;;
2333 --disable-java)
2334 [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2335 ;;
2336 --disable-vmmraw)
2337 [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2338 ;;
2339 --disable-sdl-ttf)
2340 [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
2341 ;;
2342 --disable-qt)
2343 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2344 ;;
2345 --disable-qt4)
2346 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2347 ;;
2348 --passive-mesa)
2349 PASSIVE_MESA=1
2350 ;;
2351 --disable-alsa)
2352 [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
2353 ;;
2354 --disable-pulse)
2355 [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
2356 ;;
2357 --enable-pulse)
2358 WITH_PULSE=2
2359 ;;
2360 --disable-dbus)
2361 [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
2362 ;;
2363 --disable-kmods)
2364 [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
2365 ;;
2366 --disable-opengl)
2367 [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
2368 ;;
2369 --enable-webservice)
2370 [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
2371 ;;
2372 --enable-vnc)
2373 WITH_VNC=1
2374 ;;
2375 --disable-hardening)
2376 WITH_HARDENING=0
2377 ;;
2378 --disable-extpack)
2379 WITH_EXTPACK=0
2380 ;;
2381 --disable-docs)
2382 WITH_DOCS=0
2383 ;;
2384 --enable-hardening)
2385 WITH_HARDENING=2
2386 ;;
2387 --disable-udptunnel)
2388 WITH_UDPTUNNEL=0
2389 ;;
2390 --enable-vde)
2391 WITH_VDE=1
2392 ;;
2393 --disable-devmapper)
2394 WITH_DEVMAPPER=0
2395 ;;
2396 --build-debug|-d)
2397 BUILD_TYPE=debug
2398 ;;
2399 --build-profile)
2400 BUILD_TYPE=profile
2401 ;;
2402 --build-libxml2)
2403 BUILD_LIBXML2=1
2404 ;;
2405 --build-libssl)
2406 BUILD_LIBSSL=1
2407 ;;
2408 --build-libcurl)
2409 BUILD_LIBCURL=1
2410 ;;
2411 --build-headless)
2412 HEADLESS=1
2413 WITH_SDL=0
2414 WITH_SDL_TTF=0
2415 WITH_X11=0
2416 WITH_OPENGL=0
2417 WITH_QT4=0
2418 ;;
2419 --ose)
2420 OSE=2
2421 ;;
2422 --odir=*)
2423 ODIR="`echo $option | cut -d'=' -f2`/"
2424 ODIR_OVERRIDE=1
2425 ;;
2426 --out-path=*)
2427 out_path="`echo $option | cut -d'=' -f2`/"
2428 if [ -d $out_path ]; then
2429 saved_path="`pwd`"
2430 cd $out_path
2431 OUT_PATH="`pwd`"
2432 cd $saved_path
2433 OUT_PATH_OVERRIDE=1
2434 if [ $ODIR_OVERRIDE -eq 0 ]; then
2435 # This variable has not *yet* been overridden. That can still happen.
2436 ODIR=$OUT_PATH/
2437 fi
2438 else
2439 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2440 exit 1
2441 fi
2442 ;;
2443 --setup-wine)
2444 [ "$OS" != "darwin" ] && SETUP_WINE=1
2445 ;;
2446 *)
2447 echo
2448 echo "Unrecognized option \"$option\""
2449 echo
2450 show_help
2451 ;;
2452 esac
2453done
2454
2455LOG="$ODIR$LOG"
2456ENV="$ODIR$ENV"
2457CNF="$ODIR$CNF"
2458
2459# initialize output files
2460cat > $LOG << EOF
2461# Log file generated by
2462#
2463# '$0 $*'
2464#
2465
2466EOF
2467cat > $CNF << EOF
2468# -*- Makefile -*-
2469#
2470# automatically generated by
2471#
2472# '$0 $*'
2473#
2474# It will be completely overwritten if configure is executed again.
2475#
2476
2477EOF
2478cat > $ENV << EOF
2479#!/bin/bash
2480#
2481# automatically generated by
2482#
2483# '$0 $*'
2484#
2485# It will be completely overwritten if configure is executed again.
2486# Make sure you source this file once before you start to build VBox.
2487#
2488
2489EOF
2490
2491# Print log warning about OSE if necessary
2492if [ -n "$NOT_OSE" ]; then
2493 echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
2494 echo >> $LOG
2495fi
2496
2497
2498if [ "$BUILD_TYPE" = "debug" ]; then
2499 echo "Creating DEBUG build!" >> $LOG
2500elif [ "$BUILD_TYPE" = "profile" ]; then
2501 echo "Creating PROFILE build!" >> $LOG
2502fi
2503
2504# first determine our environment
2505check_environment
2506check_kbuild
2507
2508[ -n "$ENV_ONLY" ] && exit 0
2509
2510# append the tools directory to the default search path
2511echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2512export PATH
2513
2514# if we will be writing to a different out directory then set this up now
2515if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2516 echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2517 echo "export AUTOCFG" >> $ENV
2518 echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2519 echo "export LOCALCFG" >> $ENV
2520 echo "PATH_OUT_BASE=$OUT_PATH" >> $ENV
2521 echo "export PATH_OUT_BASE" >> $ENV
2522fi
2523
2524# some things are not available in for OSE
2525if [ $OSE -ge 1 ]; then
2526 cnf_append "VBOX_OSE" "1"
2527 cnf_append "VBOX_WITH_TESTSUITE" ""
2528 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2529
2530 if [ "$OS" = "linux" ]; then
2531 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2532 else
2533 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2534 fi
2535 echo >> $CNF
2536fi
2537
2538# extpack
2539if [ $OSE -eq 0 ]; then
2540 if [ $WITH_EXTPACK -eq 1 ]; then
2541 BUILD_LIBSSL=1
2542 else
2543 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2544 fi
2545fi
2546
2547# headless
2548if [ -n "$HEADLESS" ]; then
2549 cnf_append "VBOX_HEADLESS" "1"
2550fi
2551
2552# emit disable directives corresponding to any --disable-xxx options.
2553if [ $WITH_OPENGL -eq 0 ]; then
2554 cnf_append "VBOX_WITH_CROGL" ""
2555 cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
2556 cnf_append "VBOX_GUI_USE_QGL" ""
2557fi
2558[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2559[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2560[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2561[ $WITH_PYTHON -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2562[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JXPCOM" ""
2563[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JWS" ""
2564[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2565[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2566[ $WITH_VMMRAW -eq 0 ] && cnf_append "VBOX_WITH_RAW_MODE" ""
2567
2568# Darwin-specific
2569if [ "$OS" = "darwin" ]; then
2570 check_darwinversion
2571fi
2572# the tools
2573check_gcc
2574check_open_watcom
2575[ "$OS" != "darwin" ] && check_iasl
2576# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2577# [ "$OS" != "darwin" ] && check_yasm
2578[ "$OS" != "darwin" ] && check_xsltproc
2579[ "$OS" != "darwin" ] && check_mkisofs
2580
2581# the libraries
2582[ "$OS" != "darwin" ] && check_pthread
2583check_libxml2
2584[ $WITH_LIBIDL -eq 1 ] && check_libidl
2585check_ssl
2586check_curl
2587[ "$OS" != "darwin" ] && check_z
2588[ "$OS" != "darwin" ] && check_png
2589[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2590[ $WITH_SDL -eq 1 ] && check_sdl
2591[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2592[ $WITH_X11 -eq 1 ] && check_x
2593# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2594# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2595[ $WITH_X11 -eq 1 ] && check_xcursor
2596[ $WITH_X11 -eq 1 ] && check_xinerama
2597[ $WITH_X11 -eq 1 ] && check_xrandr
2598[ $WITH_OPENGL -eq 1 ] && check_opengl
2599[ $WITH_QT4 -eq 1 ] && check_qt4
2600[ $WITH_PYTHON -eq 1 ] && check_python
2601[ $WITH_JAVA -eq 1 ] && check_java
2602
2603# PulseAudio
2604if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2605 if [ $WITH_PULSE -eq 1 ]; then
2606 check_pulse
2607 elif [ $WITH_PULSE -eq 0 ]; then
2608 cnf_append "VBOX_WITH_PULSE" ""
2609 fi
2610fi
2611
2612# Linux-specific
2613if [ "$OS" = "linux" ]; then
2614 # don't check for the static libstdc++ in the PUEL version as we build the
2615 # additions at a dedicated box
2616 [ $OSE -ge 1 ] && check_staticlibstdcxx
2617 if [ $WITH_KMODS -eq 1 ]; then
2618 check_linux
2619 else
2620 cnf_append "VBOX_LINUX_SRC" ""
2621 cnf_append "VBOX_WITH_VBOXDRV" ""
2622 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2623 fi
2624 if [ $WITH_ALSA -eq 1 ]; then
2625 check_alsa
2626 else
2627 cnf_append "VBOX_WITH_ALSA" ""
2628 fi
2629 if [ $WITH_DBUS -eq 0 ]; then
2630 cnf_append "VBOX_WITH_DBUS" ""
2631 fi
2632 if [ $WITH_DEVMAPPER -eq 1 ]; then
2633 check_libdevmapper
2634 else
2635 cnf_append "VBOX_WITH_DEVMAPPER" ""
2636 fi
2637 check_libcap
2638 check_compiler_h
2639 [ "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
2640 # tools/common/makeself*
2641 [ $OSE -ge 1 ] && check_makeself
2642fi
2643
2644[ -n "$SETUP_WINE" ] && setup_wine
2645
2646if [ $OSE -ge 1 ]; then
2647 if [ $WITH_GSOAP -eq 1 ]; then
2648 check_gsoap
2649 else
2650 cnf_append "VBOX_WITH_WEBSERVICES" ""
2651 fi
2652fi
2653
2654# UDPTUNNEL
2655if [ $WITH_UDPTUNNEL -eq 0 ]; then
2656 cnf_append "VBOX_WITH_UDPTUNNEL" ""
2657fi
2658
2659# VDE
2660if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2661 if [ $WITH_VDE -eq 1 ]; then
2662 cnf_append "VBOX_WITH_VDE" "1"
2663 fi
2664fi
2665
2666# DOCS
2667if [ $WITH_DOCS -eq 0 ]; then
2668 cnf_append "VBOX_WITH_DOCS" ""
2669 cnf_append "VBOX_WITH_DOCS_PACKING" ""
2670fi
2671
2672# VNC server support
2673if [ $OSE -ge 1 ]; then
2674 if [ $WITH_VNC = 1 ]; then
2675 check_vncserver
2676 else
2677 cnf_append "VBOX_WITH_EXTPACK_VNC" ""
2678 fi
2679fi
2680
2681# success!
2682echo
2683echo "Successfully generated '$CNF' and '$ENV'."
2684echo "Source '$ENV' once before you start to build VBox:"
2685echo ""
2686echo " source $ENV"
2687echo " kmk"
2688echo ""
2689if [ "$OS" = "linux" ]; then
2690 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2691 vbox_out_path=$OUT_PATH
2692 else
2693 vbox_out_path=./out
2694 fi
2695 echo "To compile the kernel modules, do:"
2696 echo ""
2697 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2698 echo " make"
2699 echo ""
2700fi
2701if [ $WITH_HARDENING -gt 0 ]; then
2702 echo ""
2703 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2704 echo " Hardening is enabled which means that the VBox binaries will not run from"
2705 echo " the binary directory. The binaries have to be installed suid root and some"
2706 echo " more prerequisites have to be fulfilled which is normally done by installing"
2707 echo " the final package. For development, the hardening feature can be disabled"
2708 echo " by specifying the --disable-hardening parameter. Please never disable that"
2709 echo " feature for the final distribution!"
2710 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2711 echo ""
2712else
2713 echo ""
2714 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2715 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2716 echo " disabled hardening!"
2717 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2718 echo ""
2719fi
2720echo "Enjoy!"
2721cleanup
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