VirtualBox

source: vbox/trunk/configure@ 43674

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

configure: fix compilation test for Linux 3.7 headers

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