VirtualBox

source: vbox/trunk/configure@ 57894

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

configure: potentially try several candidate Qt4 libraries until we find the right version, and try the one in our build tools last.

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