VirtualBox

source: vbox/trunk/configure@ 57826

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

configure: give Qt from tools priority if present.

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