VirtualBox

source: vbox/trunk/configure@ 57932

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

configure: fall-back for the Linux kernel directory

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