VirtualBox

source: vbox/trunk/configure@ 39547

Last change on this file since 39547 was 39547, checked in by vboxsync, 13 years ago

configure: uek-headers fix

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