VirtualBox

source: vbox/trunk/configure@ 40754

Last change on this file since 40754 was 40495, checked in by vboxsync, 12 years ago

configure: build fix

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 68.4 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-2012 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_EXTPACK=1
94WITH_DOCS=1
95BUILD_LIBXML2=
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 7 \) \
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<8"
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 libIDL, needed by xpcom
720#
721check_libidl()
722{
723 test_header libIDL
724
725 if which_wrapper libIDL-config-2 > /dev/null; then
726 libidl_ver=`libIDL-config-2 --version`
727 if [ $? -ne 0 ]; then
728 log_failure "libIDL-config-2 not working"
729 fail
730 else
731 log_success "found version $libidl_ver"
732 cnf_append "VBOX_LIBIDL_CONFIG" \
733 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
734 fi
735 elif check_avail "libIDL-config" libIDL-config; then
736 libidl_ver=`libIDL-config --version`
737 if [ $? -ne 0 ]; then
738 log_failure "libIDL-config not working"
739 fail
740 else
741 log_success "found version $libidl_ver"
742 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
743 fi
744 fi
745}
746
747
748#
749# Check for openssl, needed for RDP and S3
750#
751check_ssl()
752{
753 if [ -z "$BUILD_LIBSSL" ]; then
754 test_header ssl
755 cat > $ODIR.tmp_src.cc << EOF
756#include <cstdio>
757#include <openssl/opensslv.h>
758#include <openssl/ssl.h>
759extern "C" int main(void)
760{
761 printf("found version %s", OPENSSL_VERSION_TEXT);
762 SSL_library_init();
763#if OPENSSL_VERSION_NUMBER >= 0x00908000
764 printf(", OK.\n");
765 return 0;
766#else
767 printf(", expected version 0.9.8 or higher\n");
768 return 1;
769#endif
770}
771EOF
772 if test_compile "$INCCRYPTO $LIBCRYPTO" libcrypto openssl; then
773 if test_execute nofatal; then
774 cnf_append "SDK_VBOX_OPENSSL_INCS" "`strip_I "$INCCRYPTO"`"
775 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
776 cnf_append "SDK_VBOX_BLD_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
777 fi
778 fi
779 fi
780}
781
782
783#
784# Check for pthread, needed by VBoxSVC, frontends, ...
785#
786check_pthread()
787{
788 test_header pthread
789 cat > $ODIR.tmp_src.cc << EOF
790#include <cstdio>
791#include <pthread.h>
792extern "C" int main(void)
793{
794 pthread_mutex_t mutex;
795 if (pthread_mutex_init(&mutex, NULL)) {
796 printf("pthread_mutex_init() failed\n");
797 return 1;
798 }
799 if (pthread_mutex_lock(&mutex)) {
800 printf("pthread_mutex_lock() failed\n");
801 return 1;
802 }
803 if (pthread_mutex_unlock(&mutex)) {
804 printf("pthread_mutex_unlock() failed\n");
805 return 1;
806 }
807 printf("found, OK.\n");
808}
809EOF
810 if test_compile $LIBPTHREAD pthread pthread; then
811 if test_execute; then
812 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
813 fi
814 fi
815}
816
817
818#
819# Check for zlib, needed by VBoxSVC, Runtime, ...
820#
821check_z()
822{
823 test_header zlib
824 cat > $ODIR.tmp_src.cc << EOF
825#include <cstdio>
826#include <zlib.h>
827extern "C" int main(void)
828{
829 printf("found version %s", ZLIB_VERSION);
830#if ZLIB_VERNUM >= 0x1210
831 printf(", OK.\n");
832 return 0;
833#else
834 printf(", expected version 1.2.1 or higher\n");
835 return 1;
836#endif
837}
838EOF
839 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
840 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
841 if test_execute; then
842 echo "if1of (\$(KBUILD_TARGET),darwin freebsd linux solaris)" >> $CNF
843 cnf_append " SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
844 cnf_append " SDK_VBOX_ZLIB_INCS" "$INCZ"
845 echo "endif" >> $CNF
846 fi
847 fi
848}
849
850
851#
852# Check for libpng, needed by kchmviewer
853#
854check_png()
855{
856 test_header libpng
857 cat > $ODIR.tmp_src.cc << EOF
858#include <cstdio>
859#include <png.h>
860extern "C" int main(void)
861{
862 printf("found version %s", PNG_LIBPNG_VER_STRING);
863#if PNG_LIBPNG_VER >= 10205
864 printf(", OK.\n");
865 return 0;
866#else
867 printf(", expected version 1.2.5 or higher\n");
868 return 1;
869#endif
870}
871EOF
872 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
873 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
874 if test_execute; then
875 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
876 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
877 fi
878 fi
879}
880
881#
882# Check for libvncserver, needed for VNC in OSE
883#
884check_vncserver()
885{
886 test_header libvncserver
887 cat > $ODIR.tmp_src.cc <<EOF
888#include <cstdio>
889#include <rfb/rfbconfig.h>
890
891extern "C" int main()
892{
893 const char* v=LIBVNCSERVER_VERSION;
894 unsigned int major = 0, minor = 0, micro = 0;
895
896 for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
897 if (*v == '.') v++;
898 for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
899 if (*v == '.') v++;
900 for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
901
902 printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
903 if (major*10000 + minor*100 + micro >= 900)
904 {
905 printf(", OK.\n");
906 return 0;
907 }
908 else
909 {
910 printf(", expected version 0.9 or higher\n");
911 return 1;
912 }
913}
914EOF
915 if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
916 if test_execute; then
917 cnf_append "VBOX_WITH_EXTPACK_VNC" "1"
918 fi
919 fi
920}
921
922#
923# Check for libcurl, needed by S3
924#
925check_curl()
926{
927 if [ -z "$BUILD_LIBCURL" ]; then
928 test_header libcurl
929 cat > $ODIR.tmp_src.cc << EOF
930#include <cstdio>
931#include <curl/curl.h>
932extern "C" int main(void)
933{
934 printf("found version %s", LIBCURL_VERSION);
935#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71601
936 printf(", OK.\n");
937 return 0;
938#else
939 printf(", expected version 7.16.1 or higher\n");
940 return 1;
941#endif
942}
943EOF
944 [ -n "$INCCURL" ] && I_INCCURL=`prefix_I "$INCCURL"`
945 if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl; then
946 if test_execute; then
947 cnf_append "SDK_VBOX_LIBCURL_LIBS" "`strip_l "$LIBCURL"`"
948 cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
949 fi
950 fi
951 fi
952}
953
954
955#
956# Check for pam, needed by VRDPAuth
957# Version 79 was introduced in 9/2005, do we support older versions?
958# Debian/sarge uses 76
959# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
960#
961check_pam()
962{
963 test_header pam
964 cat > $ODIR.tmp_src.cc << EOF
965#include <cstdio>
966#include <security/pam_appl.h>
967extern "C" int main(void)
968{
969 printf("found version %d", __LIBPAM_VERSION);
970 if (__LIBPAM_VERSION >= 76)
971 {
972 printf(", OK.\n");
973 return 0;
974 }
975 else
976 {
977 printf(", expected version 76 or higher\n");
978 return 1;
979 }
980}
981EOF
982 if test_compile "-lpam" pam pam nofatal; then
983 if test_execute nofatal; then
984 return 0;
985 fi
986 fi
987 echo "pam0.x not found"
988 test_header linux_pam
989 cat > $ODIR.tmp_src.cc << EOF
990#include <cstdio>
991#include <security/pam_appl.h>
992extern "C" int main(void)
993{
994 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
995 if (__LINUX_PAM__ >= 1)
996 {
997 printf(", OK.\n");
998 return 0;
999 }
1000 else
1001 {
1002 printf(", expected version 1.0 or higher\n");
1003 return 1;
1004 }
1005}
1006EOF
1007 if test_compile "-lpam" pam pam; then
1008 test_execute
1009 fi
1010}
1011
1012
1013#
1014# Check for the SDL library, needed by VBoxSDL and VirtualBox
1015# We depend at least on version 1.2.7
1016#
1017check_sdl()
1018{
1019 test_header SDL
1020 if [ "$OS" = "darwin" ]; then
1021 if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
1022 PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
1023 elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
1024 PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
1025 fi
1026 if [ -n "$PATH_SDK_LIBSDL" ]; then
1027 foundsdl=1
1028 INCSDL="$PATH_SDK_LIBSDL/Headers"
1029 FLDSDL="-framework SDL"
1030 else
1031 log_failure "SDL framework not found"
1032 fail
1033 fi
1034 else
1035 if which_wrapper sdl-config > /dev/null; then
1036 FLGSDL=`sdl-config --cflags`
1037 INCSDL=`strip_I "$FLGSDL"`
1038 LIBSDL=`sdl-config --libs`
1039 LIBSDLMAIN="-lSDLmain"
1040 FLDSDL=
1041 foundsdl=1
1042 fi
1043 fi
1044 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1045 if [ -n "$foundsdl" ]; then
1046 cat > $ODIR.tmp_src.cc << EOF
1047#include <cstdio>
1048#include <SDL.h>
1049#include <SDL_main.h>
1050#undef main
1051extern "C" int main(int argc, char** argv)
1052{
1053 printf("found version %d.%d.%d",
1054 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1055#if SDL_VERSION_ATLEAST(1,2,7)
1056 printf(", OK.\n");
1057 return 0;
1058#else
1059 printf(", expected version 1.2.7 or higher\n");
1060 return 1;
1061#endif
1062}
1063EOF
1064 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
1065 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
1066 if test_execute; then
1067 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1068 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1069 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
1070 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1071 [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
1072 fi
1073 fi
1074 else
1075 log_failure "SDL not found"
1076 fail
1077 fi
1078}
1079
1080
1081#
1082# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1083#
1084check_sdl_ttf()
1085{
1086 test_header SDL_ttf
1087 cat > $ODIR.tmp_src.cc << EOF
1088#include <cstdio>
1089#include <SDL_ttf.h>
1090#ifndef SDL_TTF_MAJOR_VERSION
1091#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1092#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1093#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1094#endif
1095extern "C" int main(void)
1096{
1097 printf("found version %d.%d.%d",
1098 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1099#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1100 printf(", OK.\n");
1101 return 0;
1102#else
1103 printf(", expected version 2.0.6 or higher\n");
1104 return 1;
1105#endif
1106}
1107EOF
1108 if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
1109 if ! test_execute nofatal; then
1110 cnf_append "VBOX_WITH_SECURELABEL" ""
1111 fi
1112 else
1113 echo "not found -- disabling VBoxSDL secure label."
1114 cnf_append "VBOX_WITH_SECURELABEL" ""
1115 fi
1116}
1117
1118
1119#
1120# Check for libasound, needed by the ALSA audio backend
1121#
1122check_alsa()
1123{
1124 test_header ALSA
1125 cat > $ODIR.tmp_src.cc << EOF
1126#include <cstdio>
1127#include <alsa/asoundlib.h>
1128extern "C" int main(void)
1129{
1130 printf("found version %d.%d.%d",
1131 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
1132#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
1133 printf(", OK.\n");
1134 return 0;
1135#else
1136 printf(", expected version 1.0.6 or higher\n");
1137 return 1;
1138#endif
1139}
1140EOF
1141 if test_compile "-lasound" asound asound; then
1142 test_execute
1143 fi
1144}
1145
1146
1147#
1148# Check for PulseAudio
1149#
1150check_pulse()
1151{
1152 test_header "PulseAudio"
1153 cat > $ODIR.tmp_src.cc << EOF
1154#include <cstdio>
1155#include <pulse/version.h>
1156extern "C" int main(void)
1157{
1158 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1159#if PA_API_VERSION >= 9
1160 printf(", OK.\n");
1161 return 0;
1162#else
1163 printf(", expected version 0.9.0 (API version 9) or higher\n");
1164 return 1;
1165#endif
1166}
1167EOF
1168 if test_compile "$INCPULSE $LIBPULSE -lpulse" pulse pulse; then
1169 test_execute
1170 fi
1171}
1172
1173
1174#
1175# Check for the X libraries (Xext, X11)
1176#
1177check_x()
1178{
1179 test_header "X libraries"
1180 cat > $ODIR.tmp_src.cc << EOF
1181#include <cstdio>
1182#include <X11/Xlib.h>
1183extern "C" int main(void)
1184{
1185 Display *dpy;
1186 int scrn_num;
1187 Screen *scrn;
1188 Window win;
1189
1190 dpy = XOpenDisplay(NULL);
1191 scrn_num = DefaultScreen(dpy);
1192 scrn = ScreenOfDisplay(dpy, scrn_num);
1193 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1194 0, 16, InputOutput, CopyFromParent, 0, NULL);
1195 XDestroyWindow(dpy, win);
1196 XCloseDisplay(dpy);
1197}
1198EOF
1199 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1200 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1201 log_success "found"
1202 fi
1203}
1204
1205
1206#
1207# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1208#
1209check_xcursor()
1210{
1211 test_header Xcursor
1212 cat > $ODIR.tmp_src.cc << EOF
1213#include <cstdio>
1214#include <X11/Xlib.h>
1215#include <X11/Xcursor/Xcursor.h>
1216extern "C" int main(void)
1217{
1218 XcursorImage *cursor = XcursorImageCreate (10, 10);
1219 XcursorImageDestroy(cursor);
1220 return 0;
1221}
1222EOF
1223 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1224 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1225 log_success "found"
1226 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1227 fi
1228}
1229
1230
1231#
1232# Check for the Xinerama library, needed by the Qt GUI
1233#
1234check_xinerama()
1235{
1236 test_header Xinerama
1237 cat > $ODIR.tmp_src.cc << EOF
1238#include <X11/Xlib.h>
1239#include <X11/extensions/Xinerama.h>
1240extern "C" int main(void)
1241{
1242 Display *dpy;
1243 Bool flag;
1244 dpy = XOpenDisplay(NULL);
1245 if (dpy)
1246 {
1247 flag = XineramaIsActive(dpy);
1248 XCloseDisplay(dpy);
1249 }
1250}
1251EOF
1252 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1253 if test_compile "$LIBX11 $LIBXINERAMA $I_INCX11" Xinerama Xinerama; then
1254 log_success "found"
1255 fi
1256}
1257
1258
1259#
1260# Check for the Xinerama library, needed by the Qt GUI
1261#
1262check_xrandr()
1263{
1264 test_header Xrandr
1265 cat > $ODIR.tmp_src.cc << EOF
1266#include <X11/Xlib.h>
1267#include <X11/extensions/Xrandr.h>
1268extern "C" int main(void)
1269{
1270 Display *dpy;
1271 Bool flag;
1272 int major, minor;
1273 dpy = XOpenDisplay(NULL);
1274 if (dpy)
1275 {
1276 flag = XRRQueryVersion(dpy, &major, &minor);
1277 XCloseDisplay(dpy);
1278 }
1279}
1280EOF
1281 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1282 if test_compile "$LIBX11 $LIBXRANDR $I_INCX11" Xrandr Xrandr; then
1283 log_success "found"
1284 fi
1285}
1286
1287
1288#
1289# Check for OpenGL
1290#
1291check_opengl()
1292{
1293 # On darwin this is a on/off decision only
1294 if [ "$OS" = "darwin" ]; then
1295 test_header "OpenGL support"
1296 echo "enabled"
1297 cnf_append "VBOX_WITH_CROGL" "1"
1298 else
1299 check_xmu
1300 check_mesa
1301 fi
1302}
1303
1304
1305#
1306# Check for the Xmu library, needed by OpenGL
1307#
1308check_xmu()
1309{
1310 test_header Xmu
1311 cat > $ODIR.tmp_src.cc << EOF
1312#include <cstdio>
1313#include <X11/Xatom.h>
1314#include <X11/Xlib.h>
1315#include <X11/Xutil.h>
1316#include <X11/Xmu/StdCmap.h>
1317extern "C" int main(void)
1318{
1319 Display *dpy;
1320 int scrn_num;
1321 Screen *scrn;
1322
1323 dpy = XOpenDisplay(NULL);
1324 if (dpy)
1325 {
1326 scrn_num = DefaultScreen(dpy);
1327 scrn = ScreenOfDisplay(dpy, scrn_num);
1328 Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
1329 24, XA_RGB_DEFAULT_MAP, False, True);
1330 printf("Status = %x\n", status);
1331 XCloseDisplay(dpy);
1332 }
1333 return 0;
1334}
1335EOF
1336 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1337 if test_compile "$LIBX11 $LIBXMU $I_INCX11" Xmu Xmu; then
1338 log_success "found"
1339 cnf_append "VBOX_XMU_LIBS" "`strip_l "$LIBXMU"`"
1340 fi
1341}
1342
1343#
1344# Check for Mesa, needed by OpenGL
1345#
1346check_mesa()
1347{
1348 test_header "Mesa / GLU"
1349 cat > $ODIR.tmp_src.cc << EOF
1350#include <cstdio>
1351#include <X11/Xlib.h>
1352#include <GL/glx.h>
1353#include <GL/glu.h>
1354extern "C" int main(void)
1355{
1356 Display *dpy;
1357 int major, minor;
1358
1359 dpy = XOpenDisplay(NULL);
1360 if (dpy)
1361 {
1362 Bool glx_version = glXQueryVersion(dpy, &major, &minor);
1363 XCloseDisplay(dpy);
1364 if (glx_version)
1365 {
1366 printf("found version %u.%u, OK.\n", major, minor);
1367 return 0;
1368 }
1369 }
1370 printf("found (inactive), OK.\n");
1371 return 0;
1372}
1373EOF
1374 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1375 if test_compile "$LIBX11 $MESA $I_INCX11" Mesa Mesa; then
1376 [ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
1377 test_execute
1378 fi
1379}
1380
1381
1382#
1383# Check for the Qt4 library, needed by the VirtualBox frontend
1384#
1385# Currently not fatal.
1386#
1387check_qt4()
1388{
1389 foundqt4=
1390 test_header Qt4
1391 if [ "$OS" = "darwin" ]; then
1392 # First check if there is the internal version of Qt. If yes nothing else
1393 # has to be done.
1394 QT_INTERNAL=`/bin/ls -rd1 $PWD/tools/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
1395 for t in $QT_INTERNAL; do
1396 if [ -f "$t/Frameworks/QtCoreVBox.framework/QtCoreVBox" ]; then
1397 cnf_append "VBOX_WITH_QT4_SUN" "1"
1398 log_success "use internal version"
1399 return
1400 fi
1401 done
1402 # Now try the user provided directory and some of the standard directories.
1403 QT_TRIES="$QT4DIR /System/Library /Library"
1404 for t in $QT_TRIES; do
1405 if [ -f "$t/Frameworks/QtCore.framework/QtCore" ]; then
1406 PATH_SDK_QT4="$t"
1407 break
1408 fi
1409 done
1410 # Add the necessary params for building the test application
1411 if [ -n "$PATH_SDK_QT4" ]; then
1412 foundqt4=1
1413 INCQT4=-I$PATH_SDK_QT4/Frameworks/QtCore.framework/Headers
1414 LIBQT4=-F$PATH_SDK_QT4/Frameworks
1415 FLGQT4="-framework QtCore"
1416 else
1417 log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
1418 fail
1419 fi
1420 else
1421 if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1422 # default is to use pkg-config
1423 if which_wrapper pkg-config > /dev/null; then
1424 # this braindead path is necessary for mdv2008.1
1425 qt4_ver=`\
1426 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1427 pkg-config QtCore --modversion 2>> $LOG`
1428 if [ $? -ne 0 ]; then
1429 log_failure "QtCore not found"
1430 fail
1431 else
1432 FLGQT4=`\
1433 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1434 pkg-config QtCore --cflags`
1435 INCQT4=`strip_I "$FLGQT4"`
1436 LIBQT4=`\
1437 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1438 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1439 pkg-config QtCore --libs`
1440 foundqt4=1
1441 fi
1442 else
1443 log_failure "pkg-config not found"
1444 fail
1445 fi
1446 else
1447 # do it the old way (e.g. user has specified QT4DIR)
1448 cat > $ODIR.tmp_src.cc << EOF
1449#include <cstdio>
1450#include <QtGlobal>
1451extern "C" int main(void)
1452{
1453 printf("found version %s", QT_VERSION_STR);
1454#if QT_VERSION >= 0x040400
1455 printf(", OK.\n");
1456 return 0;
1457#else
1458 printf(", expected version 4.4.0 or higher\n");
1459 return 1;
1460#endif
1461}
1462EOF
1463 for q in $QT4DIR; do
1464 INCQT4="$q/include $q/include/QtCore"
1465 FLGQT4="-DQT_SHARED"
1466 I_INCQT4=`prefix_I "$INCQT4"`
1467 LIBQT4="-L$q/lib -lQtCoreVBox"
1468 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1469 foundqt4=2
1470 break;
1471 fi
1472 LIBQT4="-L$q/lib -lQtCore"
1473 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1474 foundqt4=1
1475 break;
1476 fi
1477 done
1478 fi
1479 fi
1480 if [ -n "$foundqt4" ]; then
1481 cat > $ODIR.tmp_src.cc << EOF
1482#include <cstdio>
1483#include <QtGlobal>
1484extern "C" int main(void)
1485{
1486 printf("found version %s", QT_VERSION_STR);
1487#if QT_VERSION >= 0x040400
1488 printf(", OK.\n");
1489 return 0;
1490#else
1491 printf(", expected version 4.4.0 or higher\n");
1492 return 1;
1493#endif
1494}
1495EOF
1496 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1497 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1498 if test_execute_path "`strip_L "$LIBQT4"`"; then
1499 if [ "$OS" = "darwin" ]; then
1500 # Successful build & run the test application so add the necessary
1501 # params to AutoConfig.kmk
1502 cnf_append "PATH_SDK_QT4_INC" "$PATH_SDK_QT4/Frameworks"
1503 cnf_append "PATH_SDK_QT4_LIB" "$PATH_SDK_QT4/Frameworks"
1504 cnf_append "PATH_SDK_QT4" "$PATH_SDK_QT4/Frameworks"
1505 # Check for the moc tool in the Qt directory found & some standard
1506 # directories.
1507 for q in $PATH_SDK_QT4 /usr /Developer/Tools/Qt; do
1508 if which_wrapper "$q/bin/moc" > /dev/null; then
1509 cnf_append "PATH_TOOL_QT4" "$q"
1510 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1511 fi
1512 done
1513 else
1514 # strip .../QtCore as we add components ourself
1515 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1516 # store only the first path, remove all other pathes
1517 # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1518 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1519 cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1520 cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1521 cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1522 # this is not quite right since the qt libpath does not have to be first...
1523 cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1524 if [ "$foundqt4" = "2" ]; then
1525 cnf_append "VBOX_WITH_QT4_SUN" "1"
1526 fi
1527 test_header "Qt4 devtools"
1528 for q in $QT4DIR; do
1529 # first try it with a suffix, some platforms use that
1530 if which_wrapper "$q/bin/moc-qt4" > /dev/null; then
1531 moc_ver=`$q/bin/moc-qt4 -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1532 if [ $? -ne 0 ]; then
1533 log_failure "moc-qt4 not working"
1534 fail
1535 else
1536 log_success "found version $moc_ver"
1537 cnf_append "VBOX_PATH_QT4" "$q"
1538 cnf_append "PATH_SDK_QT4" "$q"
1539 cnf_append "PATH_TOOL_QT4" "$q"
1540 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1541 cnf_append "TOOL_QT4_BIN_SUFF" "-qt4"
1542 return
1543 fi
1544 elif which_wrapper "$q/bin/moc" > /dev/null; then
1545 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1546 if [ $? -ne 0 ]; then
1547 log_failure "moc not working"
1548 fail
1549 else
1550 log_success "found version $moc_ver"
1551 cnf_append "VBOX_PATH_QT4" "$q"
1552 cnf_append "PATH_SDK_QT4" "$q"
1553 cnf_append "PATH_TOOL_QT4" "$q"
1554 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1555 return
1556 fi
1557 fi
1558 done
1559 fi
1560 fi
1561 else
1562 log_failure "qt4 not working"
1563 fail
1564 fi
1565 else
1566 log_failure "qt4 not found"
1567 fail
1568 fi
1569}
1570
1571
1572#
1573# Check whether static libstdc++ is installed. This library is required
1574# for the Linux guest additions.
1575#
1576check_staticlibstdcxx()
1577{
1578 test_header "static stc++ library"
1579 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1580 cat > $ODIR.tmp_src.cc << EOF
1581#include <string>
1582
1583extern "C" int main(void)
1584{
1585 std::string s = "test";
1586 return 0;
1587}
1588EOF
1589 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1590 log_success "found"
1591 fi
1592}
1593
1594
1595#
1596# Check for Linux sources
1597#
1598check_linux()
1599{
1600 test_header "Linux kernel sources"
1601 cat > $ODIR.tmp_src.c << EOF
1602#include <linux/version.h>
1603int printf(const char *format, ...);
1604int main(void)
1605{
1606 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1607 (LINUX_VERSION_CODE % 65536) / 256,
1608 LINUX_VERSION_CODE % 256);
1609#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1610 printf(", OK.\n");
1611 return 0;
1612#else
1613 printf(", expected version 2.4.0 or higher\n");
1614 return 1;
1615#endif
1616}
1617EOF
1618 echo "compiling the following source file:" >> $LOG
1619 cat $ODIR.tmp_src.c >> $LOG
1620 echo "using the following command line:" >> $LOG
1621 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1622 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1623 if [ $? -ne 0 ]; then
1624 echo
1625 echo " Linux kernel headers not found at $LINUX"
1626 echo " Check the file $LOG for detailed error information."
1627 fail
1628 else
1629 if test_execute; then
1630 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1631 fi
1632 fi
1633}
1634
1635
1636#
1637# Check for kchmviewer, needed to display the online help
1638# (unused as we ship kchmviewer)
1639#
1640check_kchmviewer()
1641{
1642 test_header kchmviewer
1643 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1644 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1645 if [ $? -ne 0 ]; then
1646 log_failure "kchmviewer not working"
1647 fail
1648 else
1649 log_success "found version $kchmviewer_ver"
1650 fi
1651 fi
1652}
1653
1654
1655#
1656# Check for the kBuild tools, we don't support GNU make
1657#
1658check_kbuild()
1659{
1660 test_header kBuild
1661 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1662 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1663 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1664 echo "export PATH_KBUILD" >> $ENV
1665 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1666 echo "export PATH_DEVTOOLS" >> $ENV
1667 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1668 echo "export PATH_KBUILD_BIN" >> $ENV
1669 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1670 if [ "$OS" = "solaris" ]; then
1671 # Because of sh being non-default shell in Solaris we need to export PATH again when
1672 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1673 echo "PATH=\"$ORGPATH\"" >> $ENV
1674 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1675 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1676 else
1677 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1678 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1679 fi
1680 echo "export PATH" >> $ENV
1681 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1682 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1683 elif [ "$OS.$BUILD_MACHINE" = "darwin.amd64" ]; then
1684 # Currently there are no amd64 kBuild bins. So use the x86 variant in any case.
1685 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.x86"
1686 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1687 echo "export PATH_KBUILD" >> $ENV
1688 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1689 echo "export PATH_DEVTOOLS" >> $ENV
1690 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.x86\"" >> $ENV
1691 echo "PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1692 echo "export PATH_KBUILD_BIN" >> $ENV
1693 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1694 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1695 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1696 echo "export PATH" >> $ENV
1697 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1698 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1699 elif check_avail "kmk" KBUILDDIR really; then
1700 # check for installed kBuild
1701 KBUILD_SED="`which_wrapper kmk_sed`"
1702 else
1703 fail
1704 fi
1705 log_success "found"
1706}
1707
1708
1709#
1710# Check for compiler.h
1711# Some Linux distributions include "compiler.h" in their libc linux
1712# headers package, some don't. Most don't need it, building might (!)
1713# not succeed on openSUSE without it.
1714#
1715# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1716#
1717check_compiler_h()
1718{
1719 test_header compiler.h
1720 if ! test -f "/usr/include/linux/compiler.h"; then
1721 log_success "compiler.h not found"
1722 else
1723 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1724 log_success "compiler.h found"
1725 fi
1726}
1727
1728#
1729# Check for libcap.
1730# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1731# sockets for doing ICMP requests.
1732#
1733check_libcap()
1734{
1735 test_header "libcap library"
1736 cat > $ODIR.tmp_src.cc << EOF
1737#include <cstdio>
1738#include <sys/types.h>
1739#include <linux/types.h>
1740#include <sys/capability.h>
1741
1742extern "C" int main(void)
1743{
1744 char buf[1024];
1745 cap_t caps = cap_get_proc();
1746 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1747 return 0;
1748}
1749EOF
1750 if test_compile $LIBCAP libcap libcap; then
1751 if test_execute; then
1752 log_success "found"
1753 fi
1754 fi
1755}
1756
1757#
1758# Check if we are able to build 32-bit applications (needed for the guest additions)
1759#
1760check_32bit()
1761{
1762 test_header "32-bit support"
1763 cat > $ODIR.tmp_src.c << EOF
1764#include <stdint.h>
1765int main(void)
1766{
1767 return 0;
1768}
1769EOF
1770 echo "compiling the following source file:" >> $LOG
1771 cat $ODIR.tmp_src.c >> $LOG
1772 echo "using the following command line:" >> $LOG
1773 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1774 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1775 if [ $? -ne 0 ]; then
1776 echo
1777 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1778 echo " Check the file $LOG for detailed error information."
1779 fail
1780 else
1781 echo "executing the binary" >> $LOG
1782 $ODIR.tmp_out 2> $ODIR.test_execute.log
1783 rc=$?
1784 cat $ODIR.test_execute.log >> $LOG
1785 if [ $rc -ne 0 ]; then
1786 echo
1787 echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
1788 echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
1789 fail
1790 return 1
1791 fi
1792 fi
1793 log_success ""
1794}
1795
1796
1797#
1798# Check for Python
1799#
1800check_python()
1801{
1802 test_header "Python support"
1803
1804 # On darwin this is a on/off decision only
1805 if [ "$OS" = "darwin" ]; then
1806 echo "enabled"
1807 cnf_append "VBOX_WITH_PYTHON" "1"
1808 return
1809 fi
1810
1811 cat > $ODIR.tmp_src.cc << EOF
1812#include <cstdio>
1813#include <Python.h>
1814extern "C" int main(void)
1815{
1816 Py_Initialize();
1817 printf("found version %s", PY_VERSION);
1818#if PY_VERSION_HEX >= 0x02030000
1819 printf(", OK.\n");
1820 return 0;
1821#else
1822 printf(", expected version 2.3 or higher\n");
1823 return 1;
1824#endif
1825}
1826EOF
1827 found=
1828# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1829 if [ "$OS" != "solaris" ]; then
1830 SUPPYTHONLIBS="python2.7 python2.6 python2.5 python2.4 python2.3"
1831 else
1832 SUPPYTHONLIBS="python2.4"
1833 fi
1834 for p in $PYTHONDIR; do
1835 for d in $SUPPYTHONLIBS; do
1836 for b in lib64 lib/64 lib; do
1837 echo "compiling the following source file:" >> $LOG
1838 cat $ODIR.tmp_src.cc >> $LOG
1839 echo "using the following command line:" >> $LOG
1840 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1841 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1842 if [ $? -eq 0 ]; then
1843 found=1
1844 break
1845 fi
1846 done
1847 if [ -n "$found" ]; then break; fi
1848 done
1849 if [ -n "$found" ]; then break; fi
1850 done
1851 if [ -n "$found" ]; then
1852 if test_execute; then
1853 cnf_append "VBOX_WITH_PYTHON" "1"
1854 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1855 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1856 else
1857 log_failure "Python not working"
1858 fail
1859 fi
1860 else
1861 log_failure "Python not found"
1862 fail
1863 fi
1864}
1865
1866
1867#
1868# Check for Java
1869#
1870check_java()
1871{
1872 test_header "Java support"
1873 log_success
1874}
1875
1876
1877#
1878# Setup wine
1879#
1880setup_wine()
1881{
1882 test_header "Wine support"
1883 if ! which_wrapper wine > /dev/null; then
1884 echo " wine binary not found"
1885 fail
1886 fi
1887 if ! which_wrapper wine > /dev/null; then
1888 echo " wine not found"
1889 fail
1890 fi
1891 wine_version="`wine --version`"
1892 case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
1893 "0")
1894 if ! which_wrapper wineprefixcreate > /dev/null; then
1895 echo " wineprefixcreate not found"
1896 fail
1897 fi
1898 ;;
1899 *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
1900 esac
1901 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1902 echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1903 echo "export WINEPREFIX" >> $ENV
1904 rm -rf $WINEPREFIX
1905 mkdir -p $WINEPREFIX
1906 touch $WINEPREFIX/.no_prelaunch_window_flag
1907 if ! wineprefixcreate -q > /dev/null 2>&1; then
1908 echo " wineprefixcreate failed"
1909 fail
1910 fi
1911 tmp=.tmp.wine.reg
1912 rm -f $tmp
1913 echo 'REGEDIT4' > $tmp
1914 echo '' >> $tmp
1915 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1916 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
1917 echo '' >> $tmp
1918 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1919 echo '"itss"="native"' >> $tmp
1920 echo '' >> $tmp
1921 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1922 echo '"itss"="native"' >> $tmp
1923 echo '' >> $tmp
1924 if ! wine regedit $tmp > /dev/null 2>&1; then
1925 rm -f $tmp
1926 echo " failed to load registry changes (path)."
1927 fail
1928 fi
1929 rm -f $tmp
1930 log_success "found"
1931}
1932
1933
1934#
1935# Check for gSOAP.
1936#
1937check_gsoap()
1938{
1939 test_header "GSOAP compiler"
1940 if [ -z "$GSOAP" -a -z "$GSOAP_IMPORT" ]; then
1941 if which_wrapper pkg-config > /dev/null; then
1942 GSOAP_CXX_LIBS=`pkg-config gsoapssl++ --libs 2>> $LOG`
1943 if [ $? -eq 0 ]; then
1944 GSOAP=`pkg-config gsoapssl++ --variable=exec_prefix`
1945 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1946 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1947 GSOAP_IMPORT="$GSOAP/include/gsoap"
1948 fi
1949 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1950 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1951 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1952 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
1953 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
1954 else
1955 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1956 fi
1957 cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
1958 gsoap_version=`pkg-config gsoapssl++ --modversion`
1959 log_success "found version $gsoap_version"
1960 return
1961 fi
1962 fi
1963 fi
1964 if [ -z "$GSOAP" ]; then
1965 GSOAP="/usr"
1966 fi
1967 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1968 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1969 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1970 # TODO: Check for libgsoap++.a/so
1971
1972 if [ -z "$GSOAP_IMPORT" ]; then
1973 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1974 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1975 GSOAP_IMPORT="$GSOAP/include/gsoap"
1976 fi
1977 fi
1978 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1979 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1980 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1981 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1982 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
1983 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
1984 else
1985 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1986 fi
1987 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoapssl++"
1988 log_success "found"
1989 else
1990 log_failure "stlvector.h not found -- disabling webservice"
1991 cnf_append "VBOX_WITH_WEBSERVICES" ""
1992 fi
1993 else
1994 log_failure "stdsoap2.h not found -- disabling webservice"
1995 cnf_append "VBOX_WITH_WEBSERVICES" ""
1996 fi
1997 else
1998 log_failure "wsdl2h not found -- disabling webservice"
1999 cnf_append "VBOX_WITH_WEBSERVICES" ""
2000 fi
2001 else
2002 log_failure "soapcpp2 not found -- disabling webservice"
2003 cnf_append "VBOX_WITH_WEBSERVICES" ""
2004 fi
2005}
2006
2007
2008#
2009# Determines the Darwin version.
2010# @todo This should really check the Xcode/SDK version.
2011#
2012check_darwinversion()
2013{
2014 test_header "Darwin version"
2015 darwin_ver=`uname -r`
2016 case "$darwin_ver" in
2017 11\.*)
2018 darwin_ver="10.7" # Lion
2019 sdk=/Developer/SDKs/MacOSX10.6.sdk
2020 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2021 ;;
2022 10\.*)
2023 darwin_ver="10.6" # Snow Leopard
2024 if [ "$BUILD_MACHINE" = "x86" ]; then
2025 sdk=/Developer/SDKs/MacOSX10.5.sdk
2026 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2027 cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
2028 else
2029 sdk=/Developer/SDKs/MacOSX10.6.sdk
2030 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2031 fi
2032# test "$CC" = "gcc" && CC="gcc-4.0"
2033# test "$CXX" = "g++" && CXX="g++-4.0"
2034 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2035 ;;
2036 9\.*)
2037 darwin_ver="10.5" # Leopard
2038 sdk=/Developer/SDKs/MacOSX10.5.sdk
2039 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2040# test "$CC" = "gcc" && CC="gcc-4.0"
2041# test "$CXX" = "g++" && CXX="g++-4.0"
2042 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2043 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2044 ;;
2045 8\.*)
2046 darwin_ver="10.4" # Tiger
2047 sdk=/Developer/SDKs/MacOSX10.4u.sdk
2048 CXX_FLAGS="-mmacosx-version-min=10.4 -isysroot $sdk -Wl,-syslibroot,$sdk"
2049# test "$CC" = "gcc" && CC="gcc-4.0"
2050# test "$CXX" = "g++" && CXX="g++-4.0"
2051 cnf_append "VBOX_WITH_COCOA_QT" ""
2052 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2053 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2054 ;;
2055 *)
2056 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
2057 fail
2058 darwin_ver="unknown"
2059 ;;
2060 esac
2061 log_success "found version $darwin_ver (SDK: $sdk)"
2062}
2063
2064
2065check_makeself()
2066{
2067 test_header "makeself"
2068 if check_avail "$MAKESELF" makeself; then
2069 makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2070 if [ $? -ne 0 ]; then
2071 log_failure "makeself not working"
2072 fail
2073 else
2074 log_success "found version $makeself_ver"
2075 cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2076 fi
2077 fi
2078}
2079
2080
2081#
2082# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
2083# is around to prevent confusion when the build fails in src/recompiler.
2084# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
2085#
2086check_i386elfgcc()
2087{
2088 test_header "i386-elf-gcc"
2089 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
2090 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
2091 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
2092 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
2093 if test -z "$i386_elf_gcc"; then
2094 echo " failed to find i386-elf-gcc"
2095 fail
2096 fi
2097 log_success "found $i386_elf_gcc"
2098}
2099
2100
2101#
2102# Show help
2103#
2104show_help()
2105{
2106cat << EOF
2107Usage: ./configure [OPTIONS]...
2108
2109Configuration:
2110 -h, --help display this help and exit
2111 --nofatal don't abort on errors
2112EOF
2113[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
2114[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
2115[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
2116[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
2117[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
2118[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
2119[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
2120[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
2121[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
2122[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
2123[ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
2124[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
2125[ $OSE -eq 0 ] && echo " --disable-extpack don't build the extpack"
2126[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
2127[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
2128cat << EOF
2129 --disable-udptunnel disable UDP tunnel networking
2130 --disable-hardening don't be strict about /dev/vboxdrv access
2131 --build-libxml2 build libxml2 from sources
2132EOF
2133[ $OSE -eq 0 ] && cat << EOF
2134 --build-libssl build openssl from sources
2135 --build-libcurl build libcurl from sources
2136EOF
2137[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
2138cat << EOF
2139
2140Paths:
2141 --with-gcc=PATH location of the gcc compiler [$CC]
2142 --with-g++=PATH location of the g++ compiler [$CXX]
2143 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
2144 --with-iasl=PATH location of the iasl compiler [$IASL]
2145 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
2146 --with-makeself=PATH location of makeself [$MAKESELF]
2147EOF
2148[ "$OS" = "linux" ] && echo " --with-linux=DIR Linux kernel source directory [$LINUX]"
2149[ $WITH_QT4 -eq 1 ] && echo " --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]"
2150[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
2151[ $WITH_GSOAP -eq 1 ] && echo " (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
2152[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
2153cat << EOF
2154 --with-openssl-dir=DIR directory for OpenSSL headers/libraries
2155 --out-path=PATH the folder to which configuration and build output
2156 should go
2157
2158Build type:
2159 -d, --build-debug build with debugging symbols and assertions
2160 --build-profile build with profiling support
2161 --build-headless build headless (without any GUI frontend)
2162EOF
2163 exit 0
2164}
2165
2166
2167#
2168# The body.
2169#
2170
2171# test if we are OSE
2172if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
2173 OSE=0
2174 # Set this as a reminder to print a log message once we know the path of the
2175 # log file
2176 NOT_OSE=1
2177fi
2178
2179# Change OS specific defaults; must be before all other stuff
2180if [ "$OS" = "darwin" ]; then
2181 WITH_SDL=0
2182 WITH_SDL_TTF=0
2183 WITH_X11=0
2184 WITH_ALSA=0
2185 WITH_PULSE=0
2186 WITH_DBUS=0
2187 WITH_KMODS=0
2188 BUILD_LIBXML2=1
2189 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2190fi
2191
2192# scan command line options
2193for option in $*; do
2194 case "$option" in
2195 --help|-help|-h)
2196 show_help
2197 ;;
2198 --nofatal)
2199 nofatal=1
2200 ;;
2201 --env-only)
2202 ENV_ONLY=1
2203 ;;
2204 --with-gcc=*)
2205 CC=`echo $option | cut -d'=' -f2`
2206 ;;
2207 --with-g++=*)
2208 CXX=`echo $option | cut -d'=' -f2`
2209 ;;
2210 --with-kbuild=*)
2211 KBUILDDIR=`echo $option | cut -d'=' -f2`
2212 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2213 echo "Error: KBUILDDIR contains invalid characters!"
2214 exit 1
2215 fi
2216 ;;
2217 --with-qt-dir=*|--with-qt4-dir=*)
2218 QT4DIR=`echo $option | cut -d'=' -f2`
2219 QT4DIR_PKGCONFIG=0
2220 ;;
2221 --with-openssl-dir=*)
2222 OPENSSLDIR=`echo $option | cut -d'=' -f2`
2223 INCCRYPTO="-I${OPENSSLDIR}/include"
2224 LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
2225 ;;
2226 --with-gsoap-dir=*)
2227 GSOAP=`echo $option | cut -d'=' -f2`
2228 ;;
2229 --with-gsoap-import=*)
2230 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2231 ;;
2232 --with-iasl=*)
2233 IASL=`echo $option | cut -d'=' -f2`
2234 ;;
2235 --with-linux=*)
2236 LINUX=`echo $option | cut -d'=' -f2`
2237 ;;
2238 --with-mkisofs=*)
2239 MKISOFS=`echo $option | cut -d'=' -f2`
2240 ;;
2241 --with-makeself=*)
2242 MAKESELF=`echo $option | cut -d'=' -f2`
2243 ;;
2244 --target-arch=*)
2245 TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2246 ;;
2247 --disable-xpcom)
2248 [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
2249 ;;
2250 --disable-python)
2251 [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
2252 ;;
2253 --disable-java)
2254 [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2255 ;;
2256 --disable-vmmraw)
2257 [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2258 ;;
2259 --disable-sdl-ttf)
2260 [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
2261 ;;
2262 --disable-qt)
2263 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2264 ;;
2265 --disable-qt4)
2266 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2267 ;;
2268 --passive-mesa)
2269 PASSIVE_MESA=1
2270 ;;
2271 --disable-alsa)
2272 [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
2273 ;;
2274 --disable-pulse)
2275 [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
2276 ;;
2277 --enable-pulse)
2278 WITH_PULSE=2
2279 ;;
2280 --disable-dbus)
2281 [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
2282 ;;
2283 --disable-kmods)
2284 [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
2285 ;;
2286 --disable-opengl)
2287 [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
2288 ;;
2289 --enable-webservice)
2290 [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
2291 ;;
2292 --enable-vnc)
2293 WITH_VNC=1
2294 ;;
2295 --disable-hardening)
2296 WITH_HARDENING=0
2297 ;;
2298 --disable-extpack)
2299 WITH_EXTPACK=0
2300 ;;
2301 --disable-docs)
2302 WITH_DOCS=0
2303 ;;
2304 --enable-hardening)
2305 WITH_HARDENING=2
2306 ;;
2307 --disable-udptunnel)
2308 WITH_UDPTUNNEL=0
2309 ;;
2310 --enable-vde)
2311 WITH_VDE=1
2312 ;;
2313 --build-debug|-d)
2314 BUILD_TYPE=debug
2315 ;;
2316 --build-profile)
2317 BUILD_TYPE=profile
2318 ;;
2319 --build-libxml2)
2320 BUILD_LIBXML2=1
2321 ;;
2322 --build-libssl)
2323 BUILD_LIBSSL=1
2324 ;;
2325 --build-libcurl)
2326 BUILD_LIBCURL=1
2327 ;;
2328 --build-headless)
2329 HEADLESS=1
2330 WITH_SDL=0
2331 WITH_SDL_TTF=0
2332 WITH_X11=0
2333 WITH_OPENGL=0
2334 WITH_QT4=0
2335 ;;
2336 --ose)
2337 OSE=2
2338 ;;
2339 --odir=*)
2340 ODIR="`echo $option | cut -d'=' -f2`/"
2341 ODIR_OVERRIDE=1
2342 ;;
2343 --out-path=*)
2344 out_path="`echo $option | cut -d'=' -f2`/"
2345 if [ -d $out_path ]; then
2346 saved_path="`pwd`"
2347 cd $out_path
2348 OUT_PATH="`pwd`"
2349 cd $saved_path
2350 OUT_PATH_OVERRIDE=1
2351 if [ $ODIR_OVERRIDE -eq 0 ]; then
2352 # This variable has not *yet* been overridden. That can still happen.
2353 ODIR=$OUT_PATH/
2354 fi
2355 else
2356 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2357 exit 1
2358 fi
2359 ;;
2360 --setup-wine)
2361 [ "$OS" != "darwin" ] && SETUP_WINE=1
2362 ;;
2363 *)
2364 echo
2365 echo "Unrecognized option \"$option\""
2366 echo
2367 show_help
2368 ;;
2369 esac
2370done
2371
2372LOG="$ODIR$LOG"
2373ENV="$ODIR$ENV"
2374CNF="$ODIR$CNF"
2375
2376# initialize output files
2377cat > $LOG << EOF
2378# Log file generated by
2379#
2380# '$0 $*'
2381#
2382
2383EOF
2384cat > $CNF << EOF
2385# -*- Makefile -*-
2386#
2387# automatically generated by
2388#
2389# '$0 $*'
2390#
2391# It will be completely overwritten if configure is executed again.
2392#
2393
2394EOF
2395cat > $ENV << EOF
2396#!/bin/bash
2397#
2398# automatically generated by
2399#
2400# '$0 $*'
2401#
2402# It will be completely overwritten if configure is executed again.
2403# Make sure you source this file once before you start to build VBox.
2404#
2405
2406EOF
2407
2408# Print log warning about OSE if necessary
2409if [ -n "$NOT_OSE" ]; then
2410 echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
2411 echo >> $LOG
2412fi
2413
2414
2415if [ "$BUILD_TYPE" = "debug" ]; then
2416 echo "Creating DEBUG build!" >> $LOG
2417elif [ "$BUILD_TYPE" = "profile" ]; then
2418 echo "Creating PROFILE build!" >> $LOG
2419fi
2420
2421# first determine our environment
2422check_environment
2423check_kbuild
2424
2425[ -n "$ENV_ONLY" ] && exit 0
2426
2427# append the tools directory to the default search path
2428echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2429export PATH
2430
2431# if we will be writing to a different out directory then set this up now
2432if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2433 echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2434 echo "export AUTOCFG" >> $ENV
2435 echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2436 echo "export LOCALCFG" >> $ENV
2437 echo "PATH_OUT_BASE=$OUT_PATH" >> $ENV
2438 echo "export PATH_OUT_BASE" >> $ENV
2439fi
2440
2441# some things are not available in for OSE
2442if [ $OSE -ge 1 ]; then
2443 cnf_append "VBOX_OSE" "1"
2444 cnf_append "VBOX_WITH_TESTSUITE" ""
2445 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2446
2447 if [ "$OS" = "linux" ]; then
2448 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2449 else
2450 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2451 fi
2452 echo >> $CNF
2453fi
2454
2455# extpack
2456if [ $OSE -eq 0 ]; then
2457 if [ $WITH_EXTPACK -eq 1 ]; then
2458 BUILD_LIBSSL=1
2459 else
2460 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2461 fi
2462fi
2463
2464# headless
2465if [ -n "$HEADLESS" ]; then
2466 cnf_append "VBOX_HEADLESS" "1"
2467fi
2468
2469# emit disable directives corresponding to any --disable-xxx options.
2470if [ $WITH_OPENGL -eq 0 ]; then
2471 cnf_append "VBOX_WITH_CROGL" ""
2472 cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
2473 cnf_append "VBOX_GUI_USE_QGL" ""
2474fi
2475[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2476[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2477[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2478[ $WITH_PYTHON -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2479[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JXPCOM" ""
2480[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2481[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2482[ $WITH_VMMRAW -eq 0 ] && cnf_append "VBOX_WITH_RAW_MODE" ""
2483
2484# Darwin-specific
2485if [ "$OS" = "darwin" ]; then
2486 check_darwinversion
2487fi
2488# the tools
2489check_gcc
2490[ "$OS" != "darwin" ] && check_as86
2491[ "$OS" != "darwin" ] && check_bcc
2492[ "$OS" != "darwin" ] && check_iasl
2493# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2494# [ "$OS" != "darwin" ] && check_yasm
2495[ "$OS" != "darwin" ] && check_xsltproc
2496[ "$OS" != "darwin" ] && check_mkisofs
2497
2498# the libraries
2499[ "$OS" != "darwin" ] && check_pthread
2500check_libxml2
2501[ $WITH_LIBIDL -eq 1 ] && check_libidl
2502check_ssl
2503check_curl
2504[ "$OS" != "darwin" ] && check_z
2505[ "$OS" != "darwin" ] && check_png
2506[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2507[ $WITH_SDL -eq 1 ] && check_sdl
2508[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2509[ $WITH_X11 -eq 1 ] && check_x
2510# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2511# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2512[ $WITH_X11 -eq 1 ] && check_xcursor
2513[ $WITH_X11 -eq 1 ] && check_xinerama
2514[ $WITH_X11 -eq 1 ] && check_xrandr
2515[ $WITH_OPENGL -eq 1 ] && check_opengl
2516[ $WITH_QT4 -eq 1 ] && check_qt4
2517[ $WITH_PYTHON -eq 1 ] && check_python
2518[ $WITH_JAVA -eq 1 ] && check_java
2519
2520# PulseAudio
2521if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2522 if [ $WITH_PULSE -eq 1 ]; then
2523 check_pulse
2524 elif [ $WITH_PULSE -eq 0 ]; then
2525 cnf_append "VBOX_WITH_PULSE" ""
2526 fi
2527fi
2528
2529# Linux-specific
2530if [ "$OS" = "linux" ]; then
2531 # don't check for the static libstdc++ in the PUEL version as we build the
2532 # additions at a dedicated box
2533 [ $OSE -ge 1 ] && check_staticlibstdcxx
2534 if [ $WITH_KMODS -eq 1 ]; then
2535 check_linux
2536 else
2537 cnf_append "VBOX_LINUX_SRC" ""
2538 cnf_append "VBOX_WITH_VBOXDRV" ""
2539 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2540 fi
2541 if [ $WITH_ALSA -eq 1 ]; then
2542 check_alsa
2543 else
2544 cnf_append "VBOX_WITH_ALSA" ""
2545 fi
2546 if [ $WITH_DBUS -eq 0 ]; then
2547 cnf_append "VBOX_WITH_DBUS" ""
2548 fi
2549 check_libcap
2550 check_compiler_h
2551 [ "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
2552 # tools/common/makeself*
2553 [ $OSE -ge 1 ] && check_makeself
2554fi
2555
2556[ -n "$SETUP_WINE" ] && setup_wine
2557
2558if [ $OSE -ge 1 ]; then
2559 if [ $WITH_GSOAP -eq 1 ]; then
2560 check_gsoap
2561 else
2562 cnf_append "VBOX_WITH_WEBSERVICES" ""
2563 fi
2564fi
2565
2566# UDPTUNNEL
2567if [ $WITH_UDPTUNNEL -eq 0 ]; then
2568 cnf_append "VBOX_WITH_UDPTUNNEL" ""
2569fi
2570
2571# VDE
2572if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2573 if [ $WITH_VDE -eq 1 ]; then
2574 cnf_append "VBOX_WITH_VDE" "1"
2575 fi
2576fi
2577
2578# DOCS
2579if [ $WITH_DOCS -eq 0 ]; then
2580 cnf_append "VBOX_WITH_DOCS" ""
2581 cnf_append "VBOX_WITH_DOCS_PACKING" ""
2582fi
2583
2584# VNC server support
2585if [ $OSE -ge 1 ]; then
2586 if [ $WITH_VNC = 1 ]; then
2587 check_vncserver
2588 else
2589 cnf_append "VBOX_WITH_EXTPACK_VNC" ""
2590 fi
2591fi
2592
2593# success!
2594echo
2595echo "Successfully generated '$CNF' and '$ENV'."
2596echo "Source '$ENV' once before you start to build VBox:"
2597echo ""
2598echo " source $ENV"
2599echo " kmk"
2600echo ""
2601if [ "$OS" = "linux" ]; then
2602 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2603 vbox_out_path=$OUT_PATH
2604 else
2605 vbox_out_path=./out
2606 fi
2607 echo "To compile the kernel modules, do:"
2608 echo ""
2609 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2610 echo " make"
2611 echo ""
2612fi
2613if [ $WITH_HARDENING -gt 0 ]; then
2614 echo ""
2615 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2616 echo " Hardening is enabled which means that the VBox binaries will not run from"
2617 echo " the binary directory. The binaries have to be installed suid root and some"
2618 echo " more prerequisites have to be fulfilled which is normally done by installing"
2619 echo " the final package. For development, the hardening feature can be disabled"
2620 echo " by specifying the --disable-hardening parameter. Please never disable that"
2621 echo " feature for the final distribution!"
2622 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2623 echo ""
2624else
2625 echo ""
2626 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2627 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2628 echo " disabled hardening!"
2629 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2630 echo ""
2631fi
2632echo "Enjoy!"
2633cleanup
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use