VirtualBox

source: vbox/trunk/configure@ 57795

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

configure: better kernel header detection in a chroot.

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