VirtualBox

source: vbox/trunk/configure@ 57815

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

configure: small Qt detection fixes.

  • 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 [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1493 # default is to use pkg-config
1494 if which_wrapper pkg-config > /dev/null; then
1495 # this braindead path is necessary for mdv2008.1
1496 qt4_ver=`\
1497 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1498 pkg-config QtCore --modversion 2>> $LOG`
1499 if [ $? -ne 0 ]; then
1500 log_failure "QtCore not found"
1501 fail
1502 else
1503 FLGQT4=`\
1504 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1505 pkg-config QtCore --cflags`
1506 INCQT4=`strip_I "$FLGQT4"`
1507 LIBQT4=`\
1508 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/qt4/lib/pkgconfig \
1509 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1510 pkg-config QtCore --libs`
1511 foundqt4=1
1512 fi
1513 else
1514 log_failure "pkg-config not found"
1515 fail
1516 fi
1517 else
1518 # do it the old way (e.g. user has specified QT4DIR)
1519 cat > $ODIR.tmp_src.cc << EOF
1520#include <cstdio>
1521#include <QtGlobal>
1522extern "C" int main(void)
1523{
1524 printf("found version %s", QT_VERSION_STR);
1525#if QT_VERSION >= 0x040800
1526 printf(", OK.\n");
1527 return 0;
1528#else
1529 printf(", expected version 4.8.0 or higher\n");
1530 return 1;
1531#endif
1532}
1533EOF
1534 for q in $QT4DIR "$PWD/tools/linux.$TARGET_MACHINE"/qt/v4.8.*; do
1535 INCQT4="$q/include $q/include/QtCore"
1536 FLGQT4="-DQT_SHARED"
1537 I_INCQT4=`prefix_I "$INCQT4"`
1538 LIBQT4="-L$q/lib -lQtCoreVBox"
1539 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1540 foundqt4=2
1541 break;
1542 fi
1543 LIBQT4="-L$q/lib -lQtCore"
1544 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1545 foundqt4=1
1546 break;
1547 fi
1548 done
1549 fi
1550 fi
1551 if [ -n "$foundqt4" ]; then
1552 cat > $ODIR.tmp_src.cc << EOF
1553#include <cstdio>
1554#include <QtGlobal>
1555extern "C" int main(void)
1556{
1557 printf("found version %s", QT_VERSION_STR);
1558#if QT_VERSION >= 0x040800
1559 printf(", OK.\n");
1560 return 0;
1561#else
1562 printf(", expected version 4.8.0 or higher\n");
1563 return 1;
1564#endif
1565}
1566EOF
1567 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1568 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1569 if test_execute_path "`strip_L "$LIBQT4"`"; then
1570 if [ "$OS" = "darwin" ]; then
1571 # Successful build & run the test application so add the necessary
1572 # params to AutoConfig.kmk
1573 cnf_append "PATH_SDK_QT4_INC" "$PATH_SDK_QT4/Frameworks"
1574 cnf_append "PATH_SDK_QT4_LIB" "$PATH_SDK_QT4/Frameworks"
1575 cnf_append "PATH_SDK_QT4" "$PATH_SDK_QT4/Frameworks"
1576 # Check for the moc tool in the Qt directory found & some standard
1577 # directories.
1578 for q in $PATH_SDK_QT4 /usr /Developer/Tools/Qt; do
1579 if which_wrapper "$q/bin/moc" > /dev/null; then
1580 cnf_append "PATH_TOOL_QT4" "$q"
1581 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1582 fi
1583 done
1584 else
1585 # strip .../QtCore as we add components ourself
1586 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1587 # store only the first path, remove all other pathes
1588 # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1589 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1590 cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1591 cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1592 cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1593 # this is not quite right since the qt libpath does not have to be first...
1594 cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1595 if [ "$foundqt4" = "2" ]; then
1596 cnf_append "VBOX_WITH_QT4_SUN" "1"
1597 fi
1598 test_header "Qt4 devtools"
1599 for q in $QT4DIR "$PWD/tools/linux.$TARGET_MACHINE"/qt/v4.8.*; do
1600 # first try it with a suffix, some platforms use that
1601 if which_wrapper "$q/bin/moc-qt4" > /dev/null; then
1602 moc_ver=`$q/bin/moc-qt4 -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1603 if [ $? -ne 0 ]; then
1604 log_failure "moc-qt4 not working"
1605 fail
1606 else
1607 log_success "found version $moc_ver"
1608 cnf_append "VBOX_PATH_QT4" "$q"
1609 cnf_append "PATH_SDK_QT4" "$q"
1610 cnf_append "PATH_TOOL_QT4" "$q"
1611 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1612 cnf_append "TOOL_QT4_BIN_SUFF" "-qt4"
1613 return
1614 fi
1615 elif which_wrapper "$q/bin/moc" > /dev/null; then
1616 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1617 if [ $? -ne 0 ]; then
1618 log_failure "moc not working"
1619 fail
1620 else
1621 log_success "found version $moc_ver"
1622 cnf_append "VBOX_PATH_QT4" "$q"
1623 cnf_append "PATH_SDK_QT4" "$q"
1624 cnf_append "PATH_TOOL_QT4" "$q"
1625 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1626 return
1627 fi
1628 fi
1629 done
1630 fi
1631 fi
1632 else
1633 log_failure "qt4 not working"
1634 fail
1635 fi
1636 else
1637 log_failure "qt4 not found"
1638 fail
1639 fi
1640}
1641
1642#
1643# Check for libvpx
1644#
1645check_vpx()
1646{
1647 if [ -z "$BUILD_LIBVPX" ]; then
1648 test_header libvpx
1649 if which_wrapper pkg-config > /dev/null; then
1650 libvpx_ver=`pkg-config vpx --modversion 2>> $LOG`
1651 if [ $? -eq 0 ]; then
1652 FLGVPX=`pkg-config vpx --cflags`
1653 INCVPX=`strip_I "$FLGVPX"`
1654 LIBVPX=`pkg-config vpx --libs`
1655 fi
1656 cat > $ODIR.tmp_src.cc << EOF
1657#include <cstdio>
1658#include <vpx/vpx_codec.h>
1659extern "C" int main(void)
1660{
1661 int version = vpx_codec_version();
1662 int verMajor = VPX_VERSION_MAJOR(version);
1663 int verMinor = VPX_VERSION_MINOR(version);
1664 int verPatch = VPX_VERSION_PATCH(version);
1665 printf("found version %d.%d.%d", verMajor, verMinor, verPatch);
1666 if ( verMajor == 1 && verMinor >= 0
1667 || verMajor == 0 && verMinor == 9 && verPatch >= 5)
1668 {
1669 printf(", OK.\n");
1670 return 0;
1671 }
1672 else
1673 {
1674 printf(", expected version 0.9.5 or higher\n");
1675 return 1;
1676 }
1677}
1678EOF
1679 [ -n "$INCVPX" ] && I_INCVPX=`prefix_I "$INCVPX"`
1680 if test_compile "$LIBVPX $I_INCVPX" vpx vpx; then
1681 if test_execute; then
1682 cnf_append "SDK_VBOX_VPX_INCS" "$INCVPX"
1683 cnf_append "SDK_VBOX_VPX_LIBS" "`strip_l "$LIBVPX"`"
1684 fi
1685 fi
1686 fi
1687 fi
1688}
1689
1690
1691#
1692# Check whether static libstdc++ is installed. This library is required
1693# for the Linux guest additions.
1694#
1695check_staticlibstdcxx()
1696{
1697 test_header "static stc++ library"
1698 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1699 cat > $ODIR.tmp_src.cc << EOF
1700#include <string>
1701
1702extern "C" int main(void)
1703{
1704 std::string s = "test";
1705 return 0;
1706}
1707EOF
1708 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1709 log_success "found"
1710 fi
1711}
1712
1713
1714#
1715# Check for Linux sources
1716#
1717check_linux()
1718{
1719 test_header "Linux kernel sources"
1720 cat > $ODIR.tmp_src.c << EOF
1721#include <linux/version.h>
1722int printf(const char *format, ...);
1723int main(void)
1724{
1725 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1726 (LINUX_VERSION_CODE % 65536) / 256,
1727 LINUX_VERSION_CODE % 256);
1728#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1729 printf(", OK.\n");
1730 return 0;
1731#else
1732 printf(", expected version 2.4.0 or higher\n");
1733 return 1;
1734#endif
1735}
1736EOF
1737 echo "compiling the following source file:" >> $LOG
1738 cat $ODIR.tmp_src.c >> $LOG
1739 echo "using the following command line:" >> $LOG
1740 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include " \
1741 "-I$LINUX/include/generated/uapi" >> $LOG
1742 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include \
1743 -I$LINUX/include/generated/uapi >> $LOG 2>&1
1744 if [ $? -ne 0 ]; then
1745 echo
1746 echo " Linux kernel headers not found at $LINUX"
1747 echo " Check the file $LOG for detailed error information."
1748 fail
1749 else
1750 if test_execute; then
1751 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1752 fi
1753 fi
1754}
1755
1756
1757#
1758# Check for kchmviewer, needed to display the online help
1759# (unused as we ship kchmviewer)
1760#
1761check_kchmviewer()
1762{
1763 test_header kchmviewer
1764 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1765 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1766 if [ $? -ne 0 ]; then
1767 log_failure "kchmviewer not working"
1768 fail
1769 else
1770 log_success "found version $kchmviewer_ver"
1771 fi
1772 fi
1773}
1774
1775
1776#
1777# Check for the kBuild tools, we don't support GNU make
1778#
1779check_kbuild()
1780{
1781 test_header kBuild
1782 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1783 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1784 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1785 echo "export PATH_KBUILD" >> $ENV
1786 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1787 echo "export PATH_DEVTOOLS" >> $ENV
1788 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1789 echo "export PATH_KBUILD_BIN" >> $ENV
1790 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1791 if [ "$OS" = "solaris" ]; then
1792 # Because of sh being non-default shell in Solaris we need to export PATH again when
1793 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1794 echo "PATH=\"$ORGPATH\"" >> $ENV
1795 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1796 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1797 else
1798 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1799 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1800 fi
1801 echo "export PATH" >> $ENV
1802 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1803 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1804 elif [ "$OS.$BUILD_MACHINE" = "darwin.amd64" ]; then
1805 # Currently there are no amd64 kBuild bins. So use the x86 variant in any case.
1806 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.x86"
1807 echo "PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1808 echo "export PATH_KBUILD" >> $ENV
1809 echo "PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1810 echo "export PATH_DEVTOOLS" >> $ENV
1811 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.x86\"" >> $ENV
1812 echo "PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1813 echo "export PATH_KBUILD_BIN" >> $ENV
1814 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1815 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1816 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1817 echo "export PATH" >> $ENV
1818 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1819 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1820 elif check_avail "kmk" KBUILDDIR really; then
1821 # check for installed kBuild
1822 KBUILD_SED="`which_wrapper kmk_sed`"
1823 else
1824 fail
1825 fi
1826 log_success "found"
1827}
1828
1829
1830#
1831# Check for compiler.h
1832# Some Linux distributions include "compiler.h" in their libc linux
1833# headers package, some don't. Most don't need it, building might (!)
1834# not succeed on openSUSE without it.
1835#
1836# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1837#
1838check_compiler_h()
1839{
1840 test_header compiler.h
1841 if ! test -f "/usr/include/linux/compiler.h"; then
1842 log_success "compiler.h not found"
1843 else
1844 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1845 log_success "compiler.h found"
1846 fi
1847}
1848
1849#
1850# Check for libcap.
1851# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1852# sockets for doing ICMP requests.
1853#
1854check_libcap()
1855{
1856 test_header "libcap library"
1857 cat > $ODIR.tmp_src.cc << EOF
1858#include <cstdio>
1859#include <sys/types.h>
1860#include <linux/types.h>
1861#include <sys/capability.h>
1862
1863extern "C" int main(void)
1864{
1865 char buf[1024];
1866 cap_t caps = cap_get_proc();
1867 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1868 return 0;
1869}
1870EOF
1871 if test_compile $LIBCAP libcap libcap; then
1872 if test_execute; then
1873 log_success "found"
1874 fi
1875 fi
1876}
1877
1878#
1879# Check if we are able to build 32-bit applications (needed for the guest additions)
1880#
1881check_32bit()
1882{
1883 test_header "32-bit support"
1884 cat > $ODIR.tmp_src.c << EOF
1885#include <stdint.h>
1886int main(void)
1887{
1888 return 0;
1889}
1890EOF
1891 echo "compiling the following source file:" >> $LOG
1892 cat $ODIR.tmp_src.c >> $LOG
1893 echo "using the following command line:" >> $LOG
1894 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1895 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1896 if [ $? -ne 0 ]; then
1897 echo
1898 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1899 echo " Check the file $LOG for detailed error information."
1900 fail
1901 else
1902 echo "executing the binary" >> $LOG
1903 $ODIR.tmp_out 2> $ODIR.test_execute.log
1904 rc=$?
1905 cat $ODIR.test_execute.log >> $LOG
1906 if [ $rc -ne 0 ]; then
1907 echo
1908 echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
1909 echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
1910 fail
1911 return 1
1912 fi
1913 fi
1914 log_success ""
1915}
1916
1917
1918#
1919# Check for Python
1920#
1921check_python()
1922{
1923 test_header "Python support"
1924
1925 # On darwin this is a on/off decision only
1926 if [ "$OS" = "darwin" ]; then
1927 echo "enabled"
1928 cnf_append "VBOX_WITH_PYTHON" "1"
1929 return
1930 fi
1931
1932 cat > $ODIR.tmp_src.cc << EOF
1933#include <cstdio>
1934#include <Python.h>
1935extern "C" int main(void)
1936{
1937 Py_Initialize();
1938 printf("found version %s", PY_VERSION);
1939#if PY_VERSION_HEX >= 0x02030000
1940 printf(", OK.\n");
1941 return 0;
1942#else
1943 printf(", expected version 2.3 or higher\n");
1944 return 1;
1945#endif
1946}
1947EOF
1948 found=
1949# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1950 if [ "$OS" != "solaris" ]; then
1951 SUPPYTHONLIBS="python2.7 python2.6 python2.5 python2.4 python2.3"
1952 else
1953 SUPPYTHONLIBS="python2.4"
1954 fi
1955 for p in $PYTHONDIR; do
1956 for d in $SUPPYTHONLIBS; do
1957 for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
1958 echo "compiling the following source file:" >> $LOG
1959 cat $ODIR.tmp_src.cc >> $LOG
1960 echo "using the following command line:" >> $LOG
1961 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1962 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1963 if [ $? -eq 0 ]; then
1964 found=1
1965 break
1966 fi
1967 done
1968 if [ -n "$found" ]; then break; fi
1969 done
1970 if [ -n "$found" ]; then break; fi
1971 done
1972 if [ -n "$found" ]; then
1973 if test_execute; then
1974 cnf_append "VBOX_WITH_PYTHON" "1"
1975 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1976 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1977 else
1978 log_failure "Python not working"
1979 fail
1980 fi
1981 else
1982 log_failure "Python not found"
1983 fail
1984 fi
1985}
1986
1987
1988#
1989# Check for Java
1990#
1991check_java()
1992{
1993 test_header "Java support"
1994 log_success
1995}
1996
1997
1998#
1999# Setup wine
2000#
2001setup_wine()
2002{
2003 test_header "Wine support"
2004 if ! which_wrapper wine > /dev/null; then
2005 echo " wine binary not found"
2006 fail
2007 fi
2008 if ! which_wrapper wine > /dev/null; then
2009 echo " wine not found"
2010 fail
2011 fi
2012 wine_version="`wine --version`"
2013 case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
2014 "0")
2015 if ! which_wrapper wineprefixcreate > /dev/null; then
2016 echo " wineprefixcreate not found"
2017 fail
2018 fi
2019 ;;
2020 *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
2021 esac
2022 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
2023 echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
2024 echo "export WINEPREFIX" >> $ENV
2025 rm -rf $WINEPREFIX
2026 mkdir -p $WINEPREFIX
2027 touch $WINEPREFIX/.no_prelaunch_window_flag
2028 if ! wineprefixcreate -q > /dev/null 2>&1; then
2029 echo " wineprefixcreate failed"
2030 fail
2031 fi
2032 tmp=.tmp.wine.reg
2033 rm -f $tmp
2034 echo 'REGEDIT4' > $tmp
2035 echo '' >> $tmp
2036 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
2037 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
2038 echo '' >> $tmp
2039 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
2040 echo '"itss"="native"' >> $tmp
2041 echo '' >> $tmp
2042 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
2043 echo '"itss"="native"' >> $tmp
2044 echo '' >> $tmp
2045 if ! wine regedit $tmp > /dev/null 2>&1; then
2046 rm -f $tmp
2047 echo " failed to load registry changes (path)."
2048 fail
2049 fi
2050 rm -f $tmp
2051 log_success "found"
2052}
2053
2054
2055#
2056# Check for gSOAP.
2057#
2058check_gsoap()
2059{
2060 test_header "GSOAP compiler"
2061 if [ -z "$GSOAP" -a -z "$GSOAP_IMPORT" ]; then
2062 if which_wrapper pkg-config > /dev/null; then
2063 GSOAP_CXX_LIBS=`pkg-config gsoapssl++ --libs 2>> $LOG`
2064 if [ $? -eq 0 ]; then
2065 GSOAP=`pkg-config gsoapssl++ --variable=exec_prefix`
2066 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2067 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2068 GSOAP_IMPORT="$GSOAP/include/gsoap"
2069 fi
2070 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2071 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2072 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2073 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2074 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2075 else
2076 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2077 fi
2078 cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
2079 gsoap_version=`pkg-config gsoapssl++ --modversion`
2080 log_success "found version $gsoap_version"
2081 return
2082 fi
2083 fi
2084 fi
2085 if [ -z "$GSOAP" ]; then
2086 GSOAP="/usr"
2087 fi
2088 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
2089 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
2090 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
2091 # TODO: Check for libgsoap++.a/so
2092
2093 if [ -z "$GSOAP_IMPORT" ]; then
2094 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2095 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2096 GSOAP_IMPORT="$GSOAP/include/gsoap"
2097 fi
2098 fi
2099 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
2100 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2101 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2102 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2103 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2104 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2105 else
2106 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2107 fi
2108 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoapssl++"
2109 log_success "found"
2110 else
2111 log_failure "stlvector.h not found -- disabling webservice"
2112 cnf_append "VBOX_WITH_WEBSERVICES" ""
2113 fi
2114 else
2115 log_failure "stdsoap2.h not found -- disabling webservice"
2116 cnf_append "VBOX_WITH_WEBSERVICES" ""
2117 fi
2118 else
2119 log_failure "wsdl2h not found -- disabling webservice"
2120 cnf_append "VBOX_WITH_WEBSERVICES" ""
2121 fi
2122 else
2123 log_failure "soapcpp2 not found -- disabling webservice"
2124 cnf_append "VBOX_WITH_WEBSERVICES" ""
2125 fi
2126}
2127
2128
2129#
2130# Check Xcode path
2131#
2132check_xcode_sdk_path()
2133{
2134 # Check if WITH_XCODE_DIR is set.
2135 if [ -z "$WITH_XCODE_DIR" ]; then
2136 echo "Please specify --with-xcode-dir option."
2137 return 0
2138 fi
2139
2140 # Check if specified path exists and is a directory.
2141 if [ -d "$1" ]; then
2142 return 1
2143 else
2144 echo "Xcode path [$1] not found."
2145 return 0
2146 fi
2147}
2148
2149#
2150# Determines the Darwin version.
2151# @todo This should really check the Xcode/SDK version.
2152#
2153check_darwinversion()
2154{
2155 test_header "Darwin version"
2156 darwin_ver=`uname -r`
2157 case "$darwin_ver" in
2158 14\.*)
2159 check_xcode_sdk_path "$WITH_XCODE_SDK_DIR"
2160 [ $? -eq 1 ] || fail
2161 darwin_ver="10.10" # Yosemite
2162 sdk=$WITH_XCODE_DIR/Developer/SDKs/MacOSX10.6.sdk
2163 cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
2164 cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$WITH_XCODE_DIR/Developer"
2165 ;;
2166 13\.*)
2167 check_xcode_sdk_path "$WITH_XCODE_DIR"
2168 [ $? -eq 1 ] || fail
2169 darwin_ver="10.9" # Mavericks
2170 sdk=$WITH_XCODE_DIR/Developer/SDKs/MacOSX10.6.sdk
2171 cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
2172 cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$WITH_XCODE_DIR/Developer"
2173 ;;
2174 12\.*)
2175 darwin_ver="10.8" # Mountain Lion
2176 if [ ! -z "$WITH_XCODE_DIR" ]; then
2177 sdk=$WITH_XCODE_DIR/Developer/SDKs/MacOSX10.6.sdk
2178 cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
2179 cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$WITH_XCODE_DIR/Developer"
2180 else
2181 sdk=/Developer/SDKs/MacOSX10.6.sdk
2182 fi
2183 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2184 ;;
2185 11\.*)
2186 darwin_ver="10.7" # Lion
2187 sdk=/Developer/SDKs/MacOSX10.6.sdk
2188 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2189 ;;
2190 10\.*)
2191 darwin_ver="10.6" # Snow Leopard
2192 if [ "$BUILD_MACHINE" = "x86" ]; then
2193 sdk=/Developer/SDKs/MacOSX10.5.sdk
2194 CXX_FLAGS="-mmacosx-version-min=10.5 -isysroot $sdk -Wl,-syslibroot,$sdk"
2195 cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
2196 else
2197 sdk=/Developer/SDKs/MacOSX10.6.sdk
2198 CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
2199 fi
2200# test "$CC" = "gcc" && CC="gcc-4.0"
2201# test "$CXX" = "g++" && CXX="g++-4.0"
2202 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2203 ;;
2204 9\.*)
2205 darwin_ver="10.5" # Leopard
2206 sdk=/Developer/SDKs/MacOSX10.5.sdk
2207 CXX_FLAGS="-mmacosx-version-min=10.5 -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_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2211 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2212 ;;
2213 8\.*)
2214 darwin_ver="10.4" # Tiger
2215 sdk=/Developer/SDKs/MacOSX10.4u.sdk
2216 CXX_FLAGS="-mmacosx-version-min=10.4 -isysroot $sdk -Wl,-syslibroot,$sdk"
2217# test "$CC" = "gcc" && CC="gcc-4.0"
2218# test "$CXX" = "g++" && CXX="g++-4.0"
2219 cnf_append "VBOX_WITH_COCOA_QT" ""
2220 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2221 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7" "1"
2222 ;;
2223 *)
2224 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
2225 fail
2226 darwin_ver="unknown"
2227 ;;
2228 esac
2229 log_success "found version $darwin_ver (SDK: $sdk)"
2230}
2231
2232
2233check_makeself()
2234{
2235 test_header "makeself"
2236 if check_avail "$MAKESELF" makeself; then
2237 makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2238 if [ $? -ne 0 ]; then
2239 log_failure "makeself not working"
2240 fail
2241 else
2242 log_success "found version $makeself_ver"
2243 cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2244 fi
2245 fi
2246}
2247
2248
2249#
2250# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
2251# is around to prevent confusion when the build fails in src/recompiler.
2252# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
2253#
2254check_i386elfgcc()
2255{
2256 test_header "i386-elf-gcc"
2257 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
2258 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
2259 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
2260 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
2261 if test -z "$i386_elf_gcc"; then
2262 echo " failed to find i386-elf-gcc"
2263 fail
2264 fi
2265 log_success "found $i386_elf_gcc"
2266}
2267
2268
2269#
2270# Show help
2271#
2272show_help()
2273{
2274cat << EOF
2275Usage: ./configure [OPTIONS]...
2276
2277Configuration:
2278 -h, --help display this help and exit
2279 --nofatal don't abort on errors
2280EOF
2281[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
2282[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
2283[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
2284[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
2285[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
2286[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
2287[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
2288[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
2289[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
2290[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
2291[ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
2292[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
2293[ $OSE -eq 0 ] && echo " --disable-extpack don't build the extpack"
2294[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
2295[ $WITH_LIBVPX -eq 1 ] && echo " --disable-libvpx don't use libvpx for video capturing"
2296[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
2297cat << EOF
2298 --disable-udptunnel disable UDP tunnel networking
2299 --disable-devmapper disable device mapper library access
2300 --disable-hardening don't be strict about /dev/vboxdrv access
2301 --build-libxml2 build libxml2 from sources
2302EOF
2303[ $OSE -eq 0 ] && cat << EOF
2304 --build-libssl build openssl from sources
2305 --build-libcurl build libcurl from sources
2306 --build-libvpx build libvpx from sources
2307EOF
2308[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
2309cat << EOF
2310 --only-additions only build the Guest Additions
2311
2312Paths:
2313 --with-gcc=PATH location of the gcc compiler [$CC]
2314 --with-g++=PATH location of the g++ compiler [$CXX]
2315 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
2316 --with-iasl=PATH location of the iasl compiler [$IASL]
2317 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
2318 --with-makeself=PATH location of makeself [$MAKESELF]
2319EOF
2320[ "$OS" = "darwin" ] && echo " --with-xcode-dir=DIR custom path to Xcode root directory; it is assumed that Xcode"
2321[ "$OS" = "darwin" ] && echo " contains OS X 10.6 SDK (required for Mountain Lion and newer hosts"
2322[ "$OS" = "darwin" ] && echo " only, ignored for the rest)"
2323[ "$OS" = "linux" ] && echo " --with-linux=DIR Linux kernel source directory [$LINUX]"
2324[ $WITH_QT4 -eq 1 ] && echo " --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]"
2325[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
2326[ $WITH_GSOAP -eq 1 ] && echo " (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
2327[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
2328cat << EOF
2329 --with-openssl-dir=DIR directory for OpenSSL headers/libraries
2330 --with-ow-dir=DIR directory where Open Watcom can be found [$WATCOM]
2331 --out-path=PATH the folder to which configuration and build output
2332 should go
2333
2334Build type:
2335 -d, --build-debug build with debugging symbols and assertions
2336 --build-profile build with profiling support
2337 --build-headless build headless (without any GUI frontend)
2338EOF
2339 exit 0
2340}
2341
2342
2343#
2344# The body.
2345#
2346
2347# test if we are OSE
2348if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
2349 OSE=0
2350 # Set this as a reminder to print a log message once we know the path of the
2351 # log file
2352 NOT_OSE=1
2353fi
2354
2355# Change OS specific defaults; must be before all other stuff
2356if [ "$OS" = "darwin" ]; then
2357 WITH_SDL=0
2358 WITH_SDL_TTF=0
2359 WITH_X11=0
2360 WITH_ALSA=0
2361 WITH_PULSE=0
2362 WITH_DBUS=0
2363 WITH_KMODS=0
2364 BUILD_LIBXML2=1
2365 BUILD_LIBVPX=1
2366 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2367 [ $OSE -eq 1 ] && WITH_LIBVPX=0
2368 WITH_XCODE_DIR=""
2369elif [ "$OS" = "haiku" ]; then
2370 #WITH_SDL=0
2371 WITH_SDL_TTF=0
2372 WITH_X11=0
2373 WITH_ALSA=0
2374 WITH_PULSE=0
2375 WITH_DBUS=0
2376 WITH_KMODS=0
2377 WITH_LIBIDL=0
2378 WITH_XPCOM=0
2379 BUILD_LIBXSLT=1
2380 BUILD_LIBXML2=1
2381 WITH_LIBVPX=0
2382 # it is part of libroot, which is linked by default,
2383 # but the script wants something
2384 LIBPTHREAD="-lroot"
2385 #[ $OSE -eq 1 ] || BUILD_LIBCURL=1
2386 [ $OSE -eq 1 ] || BUILD_LIBSSL=1
2387elif [ "$OS" = "solaris" ]; then
2388 [ $OSE -eq 1 ] && WITH_LIBVPX=0
2389fi
2390
2391# scan command line options
2392for option in "$@"; do
2393 case "$option" in
2394 --help|-help|-h)
2395 show_help
2396 ;;
2397 --nofatal)
2398 nofatal=1
2399 ;;
2400 --env-only)
2401 ENV_ONLY=1
2402 ;;
2403 --with-gcc=*)
2404 CC=`echo $option | cut -d'=' -f2`
2405 ;;
2406 --with-g++=*)
2407 CXX=`echo $option | cut -d'=' -f2`
2408 ;;
2409 --with-kbuild=*)
2410 KBUILDDIR=`echo $option | cut -d'=' -f2`
2411 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2412 echo "Error: KBUILDDIR contains invalid characters!"
2413 exit 1
2414 fi
2415 ;;
2416 --with-qt-dir=*|--with-qt4-dir=*)
2417 QT4DIR=`echo $option | cut -d'=' -f2`
2418 QT4DIR_PKGCONFIG=0
2419 ;;
2420 --with-openssl-dir=*)
2421 OPENSSLDIR=`echo $option | cut -d'=' -f2`
2422 INCCRYPTO="-I${OPENSSLDIR}/include"
2423 LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
2424 ;;
2425 --with-ow-dir=*)
2426 WATCOM=`echo $option | cut -d'=' -f2`
2427 ;;
2428 --with-gsoap-dir=*)
2429 GSOAP=`echo $option | cut -d'=' -f2`
2430 ;;
2431 --with-gsoap-import=*)
2432 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2433 ;;
2434 --with-iasl=*)
2435 IASL=`echo $option | cut -d'=' -f2`
2436 ;;
2437 --with-xcode-dir=*)
2438 WITH_XCODE_DIR=`echo $option | cut -d'=' -f2`
2439 echo $option
2440 ;;
2441 --with-linux=*)
2442 LINUX=`echo $option | cut -d'=' -f2`
2443 ;;
2444 --with-mkisofs=*)
2445 MKISOFS=`echo $option | cut -d'=' -f2`
2446 ;;
2447 --with-makeself=*)
2448 MAKESELF=`echo $option | cut -d'=' -f2`
2449 ;;
2450 --target-arch=*)
2451 TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2452 ;;
2453 --disable-xpcom)
2454 [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
2455 ;;
2456 --disable-python)
2457 [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
2458 ;;
2459 --disable-java)
2460 [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2461 ;;
2462 --disable-vmmraw)
2463 [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2464 ;;
2465 --disable-sdl-ttf)
2466 [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
2467 ;;
2468 --disable-qt)
2469 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2470 ;;
2471 --disable-qt4)
2472 [ $WITH_QT4 -eq 1 ] && WITH_QT4=0
2473 ;;
2474 --passive-mesa)
2475 PASSIVE_MESA=1
2476 ;;
2477 --disable-alsa)
2478 [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
2479 ;;
2480 --disable-pulse)
2481 [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
2482 ;;
2483 --enable-pulse)
2484 WITH_PULSE=2
2485 ;;
2486 --disable-dbus)
2487 [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
2488 ;;
2489 --disable-kmods)
2490 [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
2491 ;;
2492 --disable-opengl)
2493 [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
2494 ;;
2495 --enable-webservice)
2496 [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
2497 ;;
2498 --enable-vnc)
2499 WITH_VNC=1
2500 ;;
2501 --disable-hardening)
2502 WITH_HARDENING=0
2503 ;;
2504 --disable-extpack)
2505 WITH_EXTPACK=0
2506 ;;
2507 --disable-docs)
2508 WITH_DOCS=0
2509 ;;
2510 --enable-hardening)
2511 WITH_HARDENING=2
2512 ;;
2513 --disable-udptunnel)
2514 WITH_UDPTUNNEL=0
2515 ;;
2516 --enable-vde)
2517 WITH_VDE=1
2518 ;;
2519 --disable-devmapper)
2520 WITH_DEVMAPPER=0
2521 ;;
2522 --disable-libvpx)
2523 WITH_LIBVPX=0
2524 ;;
2525 --disable-vboxsdl)
2526 WITH_SDL=0
2527 ;;
2528 --build-debug|-d)
2529 BUILD_TYPE=debug
2530 ;;
2531 --build-profile)
2532 BUILD_TYPE=profile
2533 ;;
2534 --build-libxml2)
2535 BUILD_LIBXML2=1
2536 ;;
2537 --build-libssl)
2538 BUILD_LIBSSL=1
2539 ;;
2540 --build-libcurl)
2541 BUILD_LIBCURL=1
2542 ;;
2543 --build-libvpx)
2544 BUILD_LIBVPX=1
2545 ;;
2546 --build-headless)
2547 HEADLESS=1
2548 WITH_SDL=0
2549 WITH_SDL_TTF=0
2550 WITH_X11=0
2551 WITH_OPENGL=0
2552 WITH_QT4=0
2553 ;;
2554 --ose)
2555 OSE=2
2556 ;;
2557 --odir=*)
2558 ODIR="`echo $option | cut -d'=' -f2`/"
2559 ODIR_OVERRIDE=1
2560 ;;
2561 --out-path=*)
2562 out_path="`echo $option | cut -d'=' -f2`/"
2563 if [ -d $out_path ]; then
2564 saved_path="`pwd`"
2565 cd $out_path
2566 OUT_PATH="`pwd`"
2567 cd $saved_path
2568 OUT_PATH_OVERRIDE=1
2569 if [ $ODIR_OVERRIDE -eq 0 ]; then
2570 # This variable has not *yet* been overridden. That can still happen.
2571 ODIR=$OUT_PATH/
2572 fi
2573 else
2574 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2575 exit 1
2576 fi
2577 ;;
2578 --setup-wine)
2579 [ "$OS" != "darwin" ] && SETUP_WINE=1
2580 ;;
2581 --only-additions)
2582 ONLY_ADDITIONS=1
2583 ;;
2584 *)
2585 echo
2586 echo "Unrecognized option \"$option\""
2587 echo
2588 show_help
2589 ;;
2590 esac
2591done
2592
2593LOG="$ODIR$LOG"
2594ENV="$ODIR$ENV"
2595CNF="$ODIR$CNF"
2596
2597# initialize output files
2598cat > $LOG << EOF
2599# Log file generated by
2600#
2601# '$0 $*'
2602#
2603
2604EOF
2605cat > $CNF << EOF
2606# -*- Makefile -*-
2607#
2608# automatically generated by
2609#
2610# '$0 $*'
2611#
2612# It will be completely overwritten if configure is executed again.
2613#
2614
2615EOF
2616cat > $ENV << EOF
2617#!/bin/bash
2618#
2619# automatically generated by
2620#
2621# '$0 $*'
2622#
2623# It will be completely overwritten if configure is executed again.
2624# Make sure you source this file once before you start to build VBox.
2625#
2626
2627EOF
2628
2629# Print log warning about OSE if necessary
2630if [ -n "$NOT_OSE" ]; then
2631 echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
2632 echo >> $LOG
2633fi
2634
2635
2636if [ "$BUILD_TYPE" = "debug" ]; then
2637 echo "Creating DEBUG build!" >> $LOG
2638elif [ "$BUILD_TYPE" = "profile" ]; then
2639 echo "Creating PROFILE build!" >> $LOG
2640fi
2641
2642# first determine our environment
2643check_environment
2644check_kbuild
2645
2646[ -n "$ENV_ONLY" ] && exit 0
2647
2648# append the tools directory to the default search path
2649echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2650export PATH
2651
2652# if we will be writing to a different out directory then set this up now
2653if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2654 echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2655 echo "export AUTOCFG" >> $ENV
2656 echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2657 echo "export LOCALCFG" >> $ENV
2658 echo "PATH_OUT_BASE=$OUT_PATH" >> $ENV
2659 echo "export PATH_OUT_BASE" >> $ENV
2660fi
2661
2662# some things are not available in for OSE
2663if [ $OSE -ge 1 ]; then
2664 cnf_append "VBOX_OSE" "1"
2665 cnf_append "VBOX_WITH_VALIDATIONKIT" ""
2666 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2667
2668 if [ "$OS" = "linux" ]; then
2669 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2670 else
2671 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2672 fi
2673 echo >> $CNF
2674fi
2675
2676# extpack
2677if [ $ONLY_ADDITIONS -eq 1 ]; then
2678 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2679elif [ $OSE -eq 0 ]; then
2680 if [ $WITH_EXTPACK -eq 1 ]; then
2681 BUILD_LIBSSL=1
2682 else
2683 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2684 fi
2685fi
2686
2687# headless
2688if [ -n "$HEADLESS" ]; then
2689 cnf_append "VBOX_HEADLESS" "1"
2690fi
2691
2692# emit disable directives corresponding to any --disable-xxx options.
2693if [ $WITH_OPENGL -eq 0 ]; then
2694 cnf_append "VBOX_WITH_CROGL" ""
2695 cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
2696 cnf_append "VBOX_GUI_USE_QGL" ""
2697fi
2698[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2699[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2700[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2701[ $WITH_PYTHON -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2702[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JXPCOM" ""
2703[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JWS" ""
2704[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2705[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2706[ $WITH_VMMRAW -eq 0 ] && cnf_append "VBOX_WITH_RAW_MODE" ""
2707[ $WITH_LIBVPX -eq 0 ] && cnf_append "VBOX_WITH_VPX" ""
2708
2709# Darwin-specific
2710if [ "$OS" = "darwin" ]; then
2711 check_darwinversion
2712fi
2713# the tools
2714check_gcc
2715if [ $ONLY_ADDITIONS -eq 0 ]; then
2716 check_open_watcom
2717 [ "$OS" != "darwin" ] && check_iasl
2718 # don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2719 # [ "$OS" != "darwin" ] && check_yasm
2720 [ "$OS" != "darwin" ] && check_xsltproc
2721 [ "$OS" != "darwin" ] && check_mkisofs
2722fi
2723
2724# the libraries
2725if [ $ONLY_ADDITIONS -eq 0 ]; then
2726 [ "$OS" != "darwin" ] && check_pthread
2727 check_libxml2
2728 [ $WITH_LIBIDL -eq 1 ] && check_libidl
2729 check_ssl
2730 check_curl
2731 [ $WITH_LIBVPX -eq 1 ] && check_vpx
2732 [ "$OS" != "darwin" ] && check_z
2733 [ "$OS" != "darwin" ] && check_png
2734 [ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2735 if [ $WITH_SDL -eq 1 ]; then
2736 check_sdl
2737 else
2738 cnf_append "VBOX_WITH_VBOXSDL" ""
2739 fi
2740 [ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2741 [ $WITH_X11 -eq 1 ] && check_x
2742 # TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2743 # TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2744 [ $WITH_X11 -eq 1 ] && check_xcursor
2745 [ $WITH_X11 -eq 1 ] && check_xinerama
2746 [ $WITH_X11 -eq 1 ] && check_xrandr
2747 [ $WITH_OPENGL -eq 1 ] && check_opengl
2748 [ $WITH_QT4 -eq 1 ] && check_qt4
2749 [ $WITH_PYTHON -eq 1 ] && check_python
2750 [ $WITH_JAVA -eq 1 ] && check_java
2751
2752 # PulseAudio
2753 if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2754 if [ $WITH_PULSE -eq 1 ]; then
2755 check_pulse
2756 elif [ $WITH_PULSE -eq 0 ]; then
2757 cnf_append "VBOX_WITH_PULSE" ""
2758 fi
2759 fi
2760fi
2761
2762# Linux-specific
2763if [ "$OS" = "linux" ]; then
2764 # don't check for the static libstdc++ in the PUEL version as we build the
2765 # additions at a dedicated box
2766 [ $OSE -ge 1 ] && check_staticlibstdcxx
2767 if [ $WITH_KMODS -eq 1 ]; then
2768 check_linux
2769 else
2770 cnf_append "VBOX_LINUX_SRC" ""
2771 cnf_append "VBOX_WITH_VBOXDRV" ""
2772 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2773 fi
2774 if [ $ONLY_ADDITIONS -eq 0 ]; then
2775 if [ $WITH_ALSA -eq 1 ]; then
2776 check_alsa
2777 else
2778 cnf_append "VBOX_WITH_ALSA" ""
2779 fi
2780 if [ $WITH_DBUS -eq 0 ]; then
2781 cnf_append "VBOX_WITH_DBUS" ""
2782 fi
2783 if [ $WITH_DEVMAPPER -eq 1 ]; then
2784 check_libdevmapper
2785 else
2786 cnf_append "VBOX_WITH_DEVMAPPER" ""
2787 fi
2788 check_libcap
2789 fi
2790 check_compiler_h
2791 [ $ONLY_ADDITIONS -eq 0 -a "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
2792 # tools/common/makeself*
2793 [ $OSE -ge 1 ] && check_makeself
2794fi
2795
2796[ -n "$SETUP_WINE" ] && setup_wine
2797
2798if [ $ONLY_ADDITIONS -eq 0 -a $WITH_GSOAP -eq 1 ]; then
2799 check_gsoap
2800else
2801 if [ $OSE -ge 1 ]; then
2802 cnf_append "VBOX_WITH_WEBSERVICES" ""
2803 fi
2804fi
2805
2806# UDPTUNNEL
2807if [ $ONLY_ADDITIONS -eq 0 -a $WITH_UDPTUNNEL -eq 0 ]; then
2808 cnf_append "VBOX_WITH_UDPTUNNEL" ""
2809fi
2810
2811# VDE
2812if [ $ONLY_ADDITIONS -eq 0 -a "$OS" = "linux" -o "$OS" = "freebsd" ]; then
2813 if [ $WITH_VDE -eq 1 ]; then
2814 cnf_append "VBOX_WITH_VDE" "1"
2815 fi
2816fi
2817
2818# DOCS
2819if [ $ONLY_ADDITIONS -eq 1 -o $WITH_DOCS -eq 0 ]; then
2820 cnf_append "VBOX_WITH_DOCS" ""
2821 cnf_append "VBOX_WITH_DOCS_PACKING" ""
2822fi
2823
2824# VNC server support
2825if [ $ONLY_ADDITIONS -eq 0 -a $OSE -ge 1 ]; then
2826 if [ $WITH_VNC = 1 ]; then
2827 check_vncserver
2828 else
2829 cnf_append "VBOX_WITH_EXTPACK_VNC" ""
2830 fi
2831fi
2832
2833if [ $ONLY_ADDITIONS -eq 1 ]; then
2834 cnf_append "VBOX_ONLY_ADDITIONS" "1"
2835fi
2836
2837# success!
2838echo
2839echo "Successfully generated '$CNF' and '$ENV'."
2840echo "Source '$ENV' once before you start to build VBox:"
2841echo ""
2842echo " source $ENV"
2843echo " kmk"
2844echo ""
2845if [ "$OS" = "linux" ]; then
2846 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2847 vbox_out_path=$OUT_PATH
2848 else
2849 vbox_out_path=./out
2850 fi
2851 echo "To compile the kernel modules, do:"
2852 echo ""
2853 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2854 echo " make"
2855 echo ""
2856fi
2857if [ $ONLY_ADDITIONS -eq 1 ]; then
2858 echo ""
2859 echo " Tree configured to build only the Guest Additions"
2860 echo ""
2861elif [ $WITH_HARDENING -gt 0 ]; then
2862 echo ""
2863 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2864 echo " Hardening is enabled which means that the VBox binaries will not run from"
2865 echo " the binary directory. The binaries have to be installed suid root and some"
2866 echo " more prerequisites have to be fulfilled which is normally done by installing"
2867 echo " the final package. For development, the hardening feature can be disabled"
2868 echo " by specifying the --disable-hardening parameter. Please never disable that"
2869 echo " feature for the final distribution!"
2870 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2871 echo ""
2872else
2873 echo ""
2874 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2875 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2876 echo " disabled hardening!"
2877 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2878 echo ""
2879fi
2880echo "Enjoy!"
2881cleanup
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