VirtualBox

source: vbox/trunk/configure@ 43363

Last change on this file since 43363 was 43363, checked in by vboxsync, 12 years ago

Haiku Additions.

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