VirtualBox

source: vbox/trunk/configure@ 36938

Last change on this file since 36938 was 36697, checked in by vboxsync, 14 years ago

configure: added --enable-vnc (thanks Branko Majic)

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