VirtualBox

source: vbox/trunk/configure@ 43656

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

bcc/as86 are no longer required to compile the tree

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