VirtualBox

source: vbox/trunk/configure@ 57698

Last change on this file since 57698 was 56243, checked in by vboxsync, 10 years ago

configure: typo

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