VirtualBox

source: vbox/trunk/configure@ 55347

Last change on this file since 55347 was 55347, checked in by vboxsync, 9 years ago

configure: introduced --only-additions

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

© 2023 Oracle
ContactPrivacy policyTerms of Use