VirtualBox

source: vbox/trunk/configure@ 17346

Last change on this file since 17346 was 17346, checked in by vboxsync, 16 years ago

configure: Qt4 4.4.3 adaption

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 53.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-2007 Sun Microsystems, Inc.
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 as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# 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
46
47#
48# Defaults
49#
50OSE=1
51ODIR="`pwd`/"
52ODIR_OVERRIDE=0
53OUT_PATH=""
54OUT_PATH_OVERRIDE=0
55SETUP_WINE=
56TARGET_MACHINE=""
57TARGET_CPU=""
58WITH_XPCOM=1
59WITH_PYTHON=1
60WITH_LIBIDL=1
61WITH_GSOAP=0
62WITH_QT4=1
63WITH_SDL=1
64WITH_SDL_TTF=1
65WITH_X11=1
66WITH_ALSA=1
67WITH_PULSE=1
68WITH_DBUS=1
69WITH_KMODS=1
70WITH_HARDENING=1
71CC="gcc"
72CC32=""
73CC64=""
74CXX="g++"
75CXX32=""
76CXX64=""
77BCC="bcc"
78YASM="yasm"
79IASL="iasl"
80AS86="as86"
81XSLTPROC="xsltproc"
82GENISOIMAGE="genisoimage"
83MKISOFS="mkisofs"
84BUILD_LIBXML2=
85BUILD_LIBXSLT=
86LIBCRYPTO="-lcrypto"
87LIBPTHREAD="-lpthread"
88LIBCAP="-lcap"
89GSOAP=""
90GSOAP_IMPORT=""
91LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
92INCX11="/usr/local/include"
93LIBXCURSOR="-lXcursor"
94INCZ=""
95LIBZ="-lz"
96INCPNG=""
97LIBPNG="-lpng"
98PKGCONFIG="`which_wrapper pkg-config`"
99PYTHONDIR="/usr /usr/local"
100QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr"
101QT4DIR_PKGCONFIG=1
102QT4UIC3DIR="/usr/bin"
103KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
104DEVDIR="`cd \`dirname $0\`; pwd`/tools"
105if [ -d "/lib/modules/`uname -r`/build" ]; then
106 LINUX="/lib/modules/`uname -r`/build"
107else
108 LINUX="/usr/src/linux"
109fi
110KCHMVIEWER="kchmviewer"
111LOG="configure.log"
112CNF="AutoConfig.kmk"
113ENV="env.sh"
114BUILD_TYPE="release"
115# the restricting tool is ar (mri mode).
116INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
117
118if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
119 echo "Error: VBox base path contains invalid characters!"
120 exit 1
121fi
122
123# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
124if [ "`uname`" = "Darwin" ]; then
125 ECHO_N="/bin/echo -n"
126else
127 ECHO_N="echo -n"
128fi
129
130
131cleanup()
132{
133 rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
134}
135
136fail()
137{
138 if [ -z "$nofatal" -o "x$1" != "x" ]; then
139 cleanup
140 rm -f $ENV
141 exit 1
142 fi
143}
144
145log()
146{
147 echo "$1"
148 echo "$1" >> $LOG
149}
150
151log_success()
152{
153 if [ -n "$1" ]; then $ECHO_N "$1, "; fi
154 echo "OK."
155 echo "$1" >> $LOG
156 echo >> $LOG
157 echo >> $LOG
158}
159
160log_failure()
161{
162 echo
163 echo " ** $1!"
164 echo "** $1!" >> $LOG
165 echo >> $LOG
166}
167
168cnf_append()
169{
170 printf "%-30s := %s\n" "$1" "$2" >> $CNF
171}
172
173strip_l()
174{
175 echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
176}
177
178strip_L()
179{
180 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
181}
182
183strip_I()
184{
185 echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
186}
187
188prefix_I()
189{
190 echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
191}
192
193check_avail()
194{
195 if [ -z "$1" ]; then
196 log_failure "$2 is empty"
197 fail $3
198 return 1
199 elif which_wrapper $1 > /dev/null; then
200 return 0
201 else
202 log_failure "$1 (variable $2) not found"
203 fail $3
204 return 1
205 fi
206}
207
208
209# Prepare a test
210test_header()
211{
212 echo "***** Checking $1 *****" >> $LOG
213 $ECHO_N "Checking for $1: "
214}
215
216
217# Compile a test
218test_compile()
219{
220 echo "compiling the following source file:" >> $LOG
221 cat $ODIR.tmp_src.cc >> $LOG
222 echo "using the following command line:" >> $LOG
223 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
224 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
225 if [ $? -ne 0 ]; then
226 if [ -z "$4" ]; then
227 echo
228 echo " $2 not found at $1 or $3 headers not found"
229 echo " Check the file $LOG for detailed error information."
230 fail
231 else
232 echo "not found."
233 echo >> $LOG
234 echo >> $LOG
235 fi
236 return 1
237 fi
238 return 0
239}
240
241
242# Execute a compiled test binary
243test_execute()
244{
245 echo "executing the binary" >> $LOG
246 $ODIR.tmp_out > $ODIR.test_execute.log
247 rc=$?
248 cat $ODIR.test_execute.log | tee -a $LOG
249 if [ $rc -ne 0 ]; then
250 fail $1
251 return 1
252 fi
253 echo >> $LOG
254 echo >> $LOG
255 return 0
256}
257
258
259# Execute a compiled test binary
260test_execute_path()
261{
262 echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
263 LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
264 rc=$?
265 cat $ODIR.test_execute.log | tee -a $LOG
266 if [ $rc -ne 0 ]; then
267 fail
268 return 1
269 fi
270 echo >> $LOG
271 echo >> $LOG
272 return 0
273}
274
275
276#
277# Check for OS, MACHINE, CPU
278#
279check_environment()
280{
281 test_header environment
282 OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
283 case "$OS" in
284 linux)
285 ;;
286 darwin)
287 ;;
288 freebsd)
289 ;;
290 sunos)
291 OS='solaris'
292 ;;
293 *)
294 log_failure "Cannot determine OS"
295 exit 1
296 ;;
297 esac
298 BUILD_CPU=`uname -m`
299 [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
300 case "$BUILD_CPU" in
301 i[3456789]86|x86|i86pc)
302 BUILD_MACHINE='x86'
303 LIB='lib'
304 ;;
305 x86_64|amd64)
306 BUILD_MACHINE='amd64'
307 BUILD_CPU='k8'
308 if [ "$OS" != "solaris" ]; then
309 # on AMD64 systems, 64bit libs are usually located in /usr/lib64
310 # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
311 LIB='lib64'
312 else
313 # Solaris doesn't seem to subscribe to fhs, libs are usually in
314 # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
315 # alternative binaries can be found in 'amd64' subdirs of the 'bin'
316 # ones. So, in order to find the right stuff (esp. sdl-config) we'll
317 # have to make sure the */bin/amd64 dirs are searched before the */bin
318 # ones. (The sed has some sideeffects, but they shouldn't harm us...)
319 echo "64-bit Solaris detected, hacking the PATH" >> $LOG
320 echo "old PATH: $PATH" >> $LOG
321 PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
322 -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
323 export PATH
324 echo "new PATH: $PATH" >> $LOG
325 LIB='lib/64'
326 fi
327 ;;
328 *)
329 log_failure "Cannot determine system"
330 exit 1
331 ;;
332 esac
333 [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
334 [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
335 DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
336 log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
337
338 echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
339 echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
340 echo "export BUILD_TARGET=\"$OS\"" >> $ENV
341 echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
342 echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
343 echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
344}
345
346#
347# Check for gcc with version >= 3.2.
348# We depend on a working gcc, if we fail terminate in every case.
349#
350check_gcc()
351{
352 test_header gcc
353 if check_avail "$CC" CC really; then
354 cc_ver=`$CC -dumpversion` 2>/dev/null
355 if [ $? -ne 0 ]; then
356 log_failure "cannot execute '$CC -dumpversion'"
357 fail really
358 fi
359 if check_avail "$CXX" CXX really; then
360 cxx_ver=`$CXX -dumpversion` 2>/dev/null
361 if [ $? -ne 0 ]; then
362 log_failure "cannot execute '$CXX -dumpversion'"
363 fail really
364 fi
365 cc_maj=`echo $cc_ver|cut -d. -f1`
366 cc_min=`echo $cc_ver|cut -d. -f2`
367 if [ "x$cc_ver" != "x$cxx_ver" ]; then
368 log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
369 fail really
370 elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "OS" = "darwin" ]; then
371 log_success "found version $cc_ver"
372 # gcc-4.0 is allowed for Darwin only
373 elif [ $cc_maj -lt 3 \
374 -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
375 -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
376 -o \( $cc_maj -eq 4 -a $cc_min -gt 3 \) \
377 -o $cc_maj -gt 4 ]; then
378 log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<4"
379 fail really
380 else
381 log_success "found version $cc_ver"
382 fi
383 if [ "$BUILD_MACHINE" = "amd64" ]; then
384 [ -z "$CC32" ] && CC32="$CC -m32"
385 [ -z "$CXX32" ] && CXX32="$CXX -m32"
386 else
387 [ -z "$CC32" ] && CC32="$CC"
388 [ -z "$CXX32" ] && CXX32="$CXX"
389 fi
390 if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
391 [ -z "$CC64" ] && CC64="$CC -m64"
392 [ -z "$CXX64" ] && CXX64="$CXX -m64"
393 fi
394 if [ "$CC" != "gcc" ]; then
395 cnf_append "TOOL_GCC3_CC" "$CC"
396 cnf_append "TOOL_GCC3_AS" "$CC"
397 cnf_append "TOOL_GCC3_LD" "$CC"
398 cnf_append "TOOL_GXX3_CC" "$CC"
399 cnf_append "TOOL_GXX3_AS" "$CC"
400 fi
401 if [ "$CXX" != "g++" ]; then
402 cnf_append "TOOL_GCC3_CXX" "$CXX"
403 cnf_append "TOOL_GXX3_CXX" "$CXX"
404 cnf_append "TOOL_GXX3_LD" "$CXX"
405 fi
406 if [ "$CC32" != "gcc -m32" ]; then
407 cnf_append "TOOL_GCC32_CC" "$CC32"
408 cnf_append "TOOL_GCC32_AS" "$CC32"
409 cnf_append "TOOL_GCC32_LD" "$CC32"
410 cnf_append "TOOL_GXX32_CC" "$CC32"
411 cnf_append "TOOL_GXX32_AS" "$CC32"
412 fi
413 if [ "$CXX32" != "g++ -m32" ]; then
414 cnf_append "TOOL_GCC32_CXX" "$CXX32"
415 cnf_append "TOOL_GXX32_CXX" "$CXX32"
416 cnf_append "TOOL_GXX32_LD" "$CXX32"
417 fi
418 # this isn't not necessary, there is not such tool.
419 if [ -n "$CC64" ]; then
420 cnf_append "TOOL_GCC64_CC" "$CC64"
421 cnf_append "TOOL_GCC64_AS" "$CC64"
422 cnf_append "TOOL_GCC64_LD" "$CC64"
423 cnf_append "TOOL_GXX64_CC" "$CC64"
424 cnf_append "TOOL_GXX64_AS" "$CC64"
425 fi
426 if [ -n "$CXX64" ]; then
427 cnf_append "TOOL_GCC64_CXX" "$CXX64"
428 cnf_append "TOOL_GXX64_CXX" "$CXX64"
429 cnf_append "TOOL_GXX64_LD" "$CXX64"
430 fi
431 # Solaris sports a 32-bit gcc/g++.
432 if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
433 [ "$CC" = "gcc" ] && CC="gcc -m64"
434 [ "$CXX" = "g++" ] && CXX="g++ -m64"
435 fi
436 fi
437 fi
438}
439
440
441#
442# Check for the bcc compiler, needed for compiling the BIOS
443#
444check_bcc()
445{
446 test_header bcc
447 if check_avail "$BCC" BCC; then
448 bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
449 if [ $? -ne 0 ]; then
450 log_failure "not found"
451 fail
452 else
453 echo "compiling the following source file:" >> $LOG
454 cat > $ODIR.tmp_src.c << EOF
455int foo(a)
456 int a;
457{
458 return 0;
459}
460EOF
461 cat $ODIR.tmp_src.c >> $LOG
462 bcc_path=`which_wrapper $BCC`
463 bcc_dir="`dirname $bcc_path`/"
464 echo "using the following command line:" >> $LOG
465 echo "$BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
466 $BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
467 if [ $? -ne 0 ]; then
468 log_failure "not found"
469 fail
470 else
471 log_success "found version $bcc_ver"
472 cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
473 fi
474 unset bcc_path
475 unset bcc_dir
476 fi
477 fi
478}
479
480
481#
482# Check for the as86 assembler, needed for compiling the BIOS
483#
484check_as86()
485{
486 test_header as86
487 if check_avail "$AS86" AS86; then
488 as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
489 if [ $? -ne 0 ]; then
490 log_failure "not found"
491 fail
492 else
493 log_success "found version $as86_ver"
494 cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
495 fi
496 fi
497}
498
499
500#
501# Check for yasm, needed to compile assembler files
502#
503check_yasm()
504{
505 test_header yasm
506 if check_avail "$YASM" YASM; then
507 yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
508 if [ $? -ne 0 ]; then
509 log_failure "not found"
510 fail
511 else
512 yasm_maj=`echo $yasm_ver|cut -d. -f1`
513 yasm_min=`echo $yasm_ver|cut -d. -f2`
514 yasm_rev=`echo $yasm_ver|cut -d. -f3`
515 yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
516 if [ $yasm_ver_mul -lt 501 ]; then
517 log_failure "found version $yasm_ver, expected at least 0.5.1"
518 fail
519 else
520 log_success "found version $yasm_ver"
521 fi
522 fi
523 fi
524}
525
526
527#
528# Check for the iasl ACPI compiler, needed to compile vbox.dsl
529#
530check_iasl()
531{
532 test_header iasl
533 if check_avail "$IASL" IASL; then
534 iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
535 if [ $? -ne 0 ]; then
536 log_failure "not found"
537 fail
538 else
539 log_success "found version $iasl_ver"
540 cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
541 fi
542 fi
543}
544
545
546#
547# Check for xsltproc, needed by Main
548#
549check_xsltproc()
550{
551 test_header xslt
552 if check_avail "$XSLTPROC" XSLTPROC; then
553 xsltproc_ver=`$XSLTPROC --version`
554 if [ $? -ne 0 ]; then
555 log_failure "not found"
556 fail
557 else
558 log_success "found"
559 cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
560 fi
561 fi
562}
563
564
565#
566# Check for mkisofs, needed to build the CDROM image containing the additions
567#
568check_mkisofs()
569{
570 test_header mkisofs
571 if which_wrapper $GENISOIMAGE > /dev/null; then
572 mkisofs_ver=`$GENISOIMAGE --version`
573 if [ $? -ne 0 ]; then
574 log_failure "not found"
575 fail
576 else
577 log_success "found $mkisofs_ver"
578 cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
579 fi
580 elif check_avail "$MKISOFS" MKISOFS; then
581 mkisofs_ver=`$MKISOFS --version`
582 if [ $? -ne 0 ]; then
583 log_failure "not found"
584 fail
585 else
586 log_success "found $mkisofs_ver"
587 cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
588 fi
589 fi
590}
591
592
593#
594# Check for libxml2, needed by VBoxSettings
595# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
596#
597check_libxml2()
598{
599 if [ -z "$BUILD_LIBXML2" ]; then
600 test_header libxml2
601 if which_wrapper pkg-config > /dev/null; then
602 libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
603 if [ $? -ne 0 ]; then
604 log_failure "not found"
605 fail
606 else
607 FLGXML2=`pkg-config libxml-2.0 --cflags`
608 INCXML2=`strip_I "$FLGXML2"`
609 LIBXML2=`pkg-config libxml-2.0 --libs`
610 cat > $ODIR.tmp_src.cc << EOF
611#include <cstdio>
612#include <libxml/xmlversion.h>
613extern "C" int main(void)
614{
615 printf("found version %s", LIBXML_DOTTED_VERSION);
616#if LIBXML_VERSION >= 20626
617 printf(", OK.\n");
618 return 0;
619#else
620 printf(", expected version 2.6.26 or higher\n");
621 return 1;
622#endif
623}
624EOF
625 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
626 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
627 if test_execute; then
628 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
629 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
630 fi
631 fi
632 fi
633 elif which_wrapper xml2-config; then
634 libxml2_ver=`xml2-config --version`
635 if [ $? -ne 0 ]; then
636 log_failure "not found"
637 fail
638 else
639 log_success "found version $libxml2_ver"
640 FLGXML2=`xml2-config --cflags`
641 INCXML2=`strip_I "$FLGXML2"`
642 LIBXML2=`xml2-config --libs`
643 cat > $ODIR.tmp_src.cc << EOF
644#include <cstdio>
645#include <libxml/xmlversion.h>
646extern "C" int main(void)
647{
648 printf("found version %s", LIBXML_DOTTED_VERSION);
649#if LIBXML_VERSION >= 20626
650 printf(", OK.\n");
651 return 0;
652#else
653 printf(", expected version 2.6.26 or higher\n");
654 return 1;
655#endif
656}
657EOF
658 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
659 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
660 if test_execute; then
661 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
662 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
663 fi
664 fi
665 fi
666 else
667 log_failure "neither pkg-config nor xml2-config found"
668 fail
669 fi
670 fi
671}
672
673
674#
675# Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.17.
676# This library is available on Ubuntu Edgy which fulfils the minimal libxml2
677# requirement (2.6.26).
678#
679check_libxslt()
680{
681 if [ -z "$BUILD_LIBXSLT" ]; then
682 test_header libxslt
683 if which_wrapper pkg-config > /dev/null; then
684 libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
685 if [ $? -ne 0 ]; then
686 log_failure "not found"
687 fail
688 else
689 FLGXSLT=`pkg-config libxslt --cflags`
690 INCXSLT=`strip_I "$FLGXSLT"`
691 LIBXSLT=`pkg-config libxslt --libs`
692 cat > $ODIR.tmp_src.cc << EOF
693#include <cstdio>
694#include <libxslt/xsltconfig.h>
695extern "C" int main(void)
696{
697 printf("found version %s", LIBXSLT_DOTTED_VERSION);
698#if LIBXSLT_VERSION >= 10117
699 printf(", OK.\n");
700 return 0;
701#else
702 printf(", expected version 1.1.17 or higher\n");
703 return 1;
704#endif
705}
706EOF
707 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
708 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
709 if test_execute; then
710 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
711 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
712 fi
713 fi
714 fi
715 elif which_wrapper xslt-config; then
716 libxslt_ver=`xslt-config --version`
717 if [ $? -ne 0 ]; then
718 log_failure "not found"
719 fail
720 else
721 log_success "found version $libxslt_ver"
722 FLGXSLT=`xslt-config --cflags`
723 INCXSLT=`strip_I "$FLGXSLT"`
724 LIBXSLT=`xslt-config --libs`
725 cat > $ODIR.tmp_src.cc << EOF
726#include <cstdio>
727#include <libxslt/xsltconfig.h>
728extern "C" int main(void)
729{
730 printf("found version %s", LIBXSLT_DOTTED_VERSION);
731#if LIBXSLT_VERSION >= 10117
732 printf(", OK.\n");
733 return 0;
734#else
735 printf(", expected version 1.1.17 or higher\n");
736 return 1;
737#endif
738}
739EOF
740 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
741 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
742 if test_execute; then
743 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
744 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
745 fi
746 fi
747 fi
748 else
749 log_failure "neither pkg-config nor xslt-config found"
750 fail
751 fi
752 fi
753}
754
755
756#
757# Check for libIDL, needed by xpcom
758#
759check_libidl()
760{
761 test_header libIDL
762
763 if which_wrapper libIDL-config-2 > /dev/null; then
764 libidl_ver=`libIDL-config-2 --version`
765 if [ $? -ne 0 ]; then
766 log_failure "not found"
767 fail
768 else
769 log_success "found version $libidl_ver"
770 cnf_append "VBOX_LIBIDL_CONFIG" \
771 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
772 fi
773 elif check_avail "libIDL-config" libIDL-config; then
774 libidl_ver=`libIDL-config --version`
775 if [ $? -ne 0 ]; then
776 log_failure "not found"
777 fail
778 else
779 log_success "found version $libidl_ver"
780 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
781 fi
782 fi
783}
784
785
786#
787# Check for openssl, needed for RDP
788#
789check_ssl()
790{
791 test_header ssl
792 cat > $ODIR.tmp_src.cc << EOF
793#include <cstdio>
794#include <openssl/opensslv.h>
795extern "C" int main(void)
796{
797 printf("found version %s", OPENSSL_VERSION_TEXT);
798#if OPENSSL_VERSION_NUMBER >= 0x0090700
799 printf(", OK.\n");
800 return 0;
801#else
802 printf(", expected version 0.9.7 or higher\n");
803 return 1;
804#endif
805}
806EOF
807 if test_compile $LIBCRYPTO libcrypto openssl; then
808 if test_execute nofatal; then
809 cnf_append "SDK_VBOX_OPENSSL_INCS" ""
810 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
811 fi
812 fi
813}
814
815
816#
817# Check for pthread, needed by VBoxSVC, frontends, ...
818#
819check_pthread()
820{
821 test_header pthread
822 cat > $ODIR.tmp_src.cc << EOF
823#include <cstdio>
824#include <pthread.h>
825extern "C" int main(void)
826{
827 pthread_mutex_t mutex;
828 if (pthread_mutex_init(&mutex, NULL)) {
829 printf("pthread_mutex_init() failed\n");
830 return 1;
831 }
832 if (pthread_mutex_lock(&mutex)) {
833 printf("pthread_mutex_lock() failed\n");
834 return 1;
835 }
836 if (pthread_mutex_unlock(&mutex)) {
837 printf("pthread_mutex_unlock() failed\n");
838 return 1;
839 }
840 printf("found, OK.\n");
841}
842EOF
843 if test_compile $LIBPTHREAD pthread pthread; then
844 if test_execute; then
845 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
846 fi
847 fi
848}
849
850
851#
852# Check for zlib, needed by VBoxSVC, Runtime, ...
853#
854check_z()
855{
856 test_header zlib
857 cat > $ODIR.tmp_src.cc << EOF
858#include <cstdio>
859#include <zlib.h>
860extern "C" int main(void)
861{
862 printf("found version %s", ZLIB_VERSION);
863#if ZLIB_VERNUM >= 0x1210
864 printf(", OK.\n");
865 return 0;
866#else
867 printf(", expected version 1.2.1 or higher\n");
868 return 1;
869#endif
870}
871EOF
872 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
873 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
874 if test_execute; then
875 cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
876 cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
877 fi
878 fi
879}
880
881
882#
883# Check for libpng, needed by kchmviewer
884#
885check_png()
886{
887 test_header libpng
888 cat > $ODIR.tmp_src.cc << EOF
889#include <cstdio>
890#include <png.h>
891extern "C" int main(void)
892{
893 printf("found version %s", PNG_LIBPNG_VER_STRING);
894#if PNG_LIBPNG_VER >= 10205
895 printf(", OK.\n");
896 return 0;
897#else
898 printf(", expected version 1.2.5 or higher\n");
899 return 1;
900#endif
901}
902EOF
903 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
904# if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then
905 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
906# if test_execute nofatal; then
907 if test_execute; then
908 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
909 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
910 fi
911 fi
912}
913
914
915#
916# Check for pam, needed by VRDPAuth
917# Version 79 was introduced in 9/2005, do we support older versions?
918# Debian/sarge uses 76
919# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
920#
921check_pam()
922{
923 test_header pam
924 cat > $ODIR.tmp_src.cc << EOF
925#include <cstdio>
926#include <security/pam_appl.h>
927extern "C" int main(void)
928{
929 printf("found version %d", __LIBPAM_VERSION);
930 if (__LIBPAM_VERSION >= 76)
931 {
932 printf(", OK.\n");
933 return 0;
934 }
935 else
936 {
937 printf(", expected version 76 or higher\n");
938 return 1;
939 }
940}
941EOF
942 if test_compile "-lpam" pam pam nofatal; then
943 if test_execute nofatal; then
944 return 0;
945 fi
946 fi
947 test_header linux_pam
948 cat > $ODIR.tmp_src.cc << EOF
949#include <cstdio>
950#include <security/pam_appl.h>
951extern "C" int main(void)
952{
953 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
954 if (__LINUX_PAM__ >= 1)
955 {
956 printf(", OK.\n");
957 return 0;
958 }
959 else
960 {
961 printf(", expected version 1.0 or higher\n");
962 return 1;
963 }
964}
965EOF
966 if test_compile "-lpam" pam pam; then
967 test_execute
968 fi
969}
970
971
972#
973# Check for the SDL library, needed by VBoxSDL and VirtualBox
974# We depend at least on version 1.2.7
975#
976check_sdl()
977{
978 test_header SDL
979 if [ "$OS" = "darwin" ]; then
980 if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
981 PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
982 elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
983 PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
984 fi
985 if [ -n "$PATH_SDK_LIBSDL" ]; then
986 foundsdl=1
987 INCSDL="$PATH_SDK_LIBSDL/Headers"
988 FLDSDL="-framework SDL"
989 else
990 log_failure "SDL framework not found"
991 fail
992 fi
993 else
994 if which_wrapper sdl-config > /dev/null; then
995 FLGSDL=`sdl-config --cflags`
996 INCSDL=`strip_I "$FLGSDL"`
997 LIBSDL=`sdl-config --libs`
998 LIBSDLMAIN="-lSDLmain"
999 FLDSDL=
1000 foundsdl=1
1001 fi
1002 fi
1003 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1004 if [ -n "$foundsdl" ]; then
1005 cat > $ODIR.tmp_src.cc << EOF
1006#include <cstdio>
1007#include <SDL.h>
1008#include <SDL_main.h>
1009#undef main
1010extern "C" int main(int argc, char** argv)
1011{
1012 printf("found version %d.%d.%d",
1013 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1014#if SDL_VERSION_ATLEAST(1,2,7)
1015 printf(", OK.\n");
1016 return 0;
1017#else
1018 printf(", expected version 1.2.7 or higher\n");
1019 return 1;
1020#endif
1021}
1022EOF
1023 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
1024 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
1025 if test_execute; then
1026 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1027 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1028 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
1029 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1030 [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
1031 fi
1032 fi
1033 else
1034 log_failure "not found"
1035 fail
1036 fi
1037}
1038
1039
1040#
1041# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1042#
1043check_sdl_ttf()
1044{
1045 test_header SDL_ttf
1046 cat > $ODIR.tmp_src.cc << EOF
1047#include <cstdio>
1048#include <SDL_ttf.h>
1049#ifndef SDL_TTF_MAJOR_VERSION
1050#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1051#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1052#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1053#endif
1054extern "C" int main(void)
1055{
1056 printf("found version %d.%d.%d",
1057 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1058#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1059 printf(", OK.\n");
1060 return 0;
1061#else
1062 printf(", expected version 2.0.6 or higher\n");
1063 return 1;
1064#endif
1065}
1066EOF
1067 if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
1068 if ! test_execute nofatal; then
1069 cnf_append "VBOX_WITH_SECURELABEL" ""
1070 fi
1071 else
1072 cnf_append "VBOX_WITH_SECURELABEL" ""
1073 fi
1074}
1075
1076
1077#
1078# Check for libasound, needed by the ALSA audio backend
1079#
1080check_alsa()
1081{
1082 test_header ALSA
1083 cat > $ODIR.tmp_src.cc << EOF
1084#include <cstdio>
1085#include <alsa/asoundlib.h>
1086extern "C" int main(void)
1087{
1088 printf("found version %d.%d.%d",
1089 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
1090#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
1091 printf(", OK.\n");
1092 return 0;
1093#else
1094 printf(", expected version 1.0.6 or higher\n");
1095 return 1;
1096#endif
1097}
1098EOF
1099 if test_compile "-lasound" asound asound; then
1100 test_execute
1101 fi
1102}
1103
1104
1105#
1106# Check for PulseAudio
1107#
1108check_pulse()
1109{
1110 test_header "PulseAudio"
1111 cat > $ODIR.tmp_src.cc << EOF
1112#include <cstdio>
1113#include <pulse/version.h>
1114extern "C" int main(void)
1115{
1116 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1117#if PA_API_VERSION >= 9
1118 printf(", OK.\n");
1119 return 0;
1120#else
1121 printf(", expected version 0.9.0 (API version 9) or higher\n");
1122 return 1;
1123#endif
1124}
1125EOF
1126 if test_compile "-lpulse" pulse pulse; then
1127 test_execute
1128 fi
1129}
1130
1131
1132#
1133# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1134#
1135check_xcursor()
1136{
1137 test_header Xcursor
1138 cat > $ODIR.tmp_src.cc << EOF
1139#include <cstdio>
1140#include <X11/Xlib.h>
1141#include <X11/Xcursor/Xcursor.h>
1142extern "C" int main(void)
1143{
1144 XcursorImage *cursor = XcursorImageCreate (10, 10);
1145 XcursorImageDestroy(cursor);
1146 return 0;
1147}
1148EOF
1149 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1150 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1151 log_success "found"
1152 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1153 fi
1154}
1155
1156
1157#
1158# Check for the X libraries (Xext, X11)
1159#
1160check_x()
1161{
1162 test_header "X libraries"
1163 cat > $ODIR.tmp_src.cc << EOF
1164#include <cstdio>
1165#include <X11/Xlib.h>
1166extern "C" int main(void)
1167{
1168 Display *dpy;
1169 int scrn_num;
1170 Screen *scrn;
1171 Window win;
1172
1173 dpy = XOpenDisplay(NULL);
1174 scrn_num = DefaultScreen(dpy);
1175 scrn = ScreenOfDisplay(dpy, scrn_num);
1176 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1177 0, 16, InputOutput, CopyFromParent, 0, NULL);
1178 XDestroyWindow(dpy, win);
1179}
1180EOF
1181 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1182 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1183 log_success "found"
1184 fi
1185}
1186
1187
1188#
1189# Check for the Qt4 library, needed by the VirtualBox frontend
1190#
1191# Currently not fatal.
1192#
1193check_qt4()
1194{
1195 foundqt4=
1196 test_header Qt4
1197 if [ "$OS" = "darwin" ]; then
1198 if [ -f "/System/Library/Frameworks/QtCore.framework/QtCore" ]; then
1199 PATH_SDK_QT4="/System/Library/Framework/QtCore.framework"
1200 elif [ -f "/Library/Frameworks/QtCore.framework/QtCore" ]; then
1201 PATH_SDK_QT4="/Library/Frameworks/QtCore.framework"
1202 fi
1203 if [ -n "$PATH_SDK_QT4" ]; then
1204 foundqt4=1
1205 INCQT4="$PATH_SDK_QT4/Headers"
1206 LIBQT4=
1207 FLGQT4="-framework QtCore"
1208 else
1209 log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
1210 fail
1211 fi
1212 else
1213 if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1214 # default is to use pkg-config
1215 if which_wrapper pkg-config > /dev/null; then
1216 # this braindead path is necessary for mdv2008.1
1217 qt4_ver=`\
1218 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1219 pkg-config QtCore --modversion 2>> $LOG`
1220 if [ $? -ne 0 ]; then
1221 log_failure "not found"
1222 fail
1223 else
1224 FLGQT4=`\
1225 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1226 pkg-config QtCore --cflags`
1227 INCQT4=`strip_I "$FLGQT4"`
1228 LIBQT4=`\
1229 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1230 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1231 pkg-config QtCore --libs`
1232 foundqt4=1
1233 fi
1234 else
1235 log_failure "pkg-config not found"
1236 fail
1237 fi
1238 else
1239 # do it the old way (e.g. user has specified QT4DIR)
1240 cat > $ODIR.tmp_src.cc << EOF
1241#include <cstdio>
1242#include <QtGlobal>
1243extern "C" int main(void)
1244{
1245 printf("found version %s", QT_VERSION_STR);
1246#if QT_VERSION >= 0x040300
1247 printf(", OK.\n");
1248 return 0;
1249#else
1250 printf(", expected version 4.3.0 or higher\n");
1251 return 1;
1252#endif
1253}
1254EOF
1255 for q in $QT4DIR; do
1256 INCQT4="$q/include $q/include/QtCore"
1257 FLGQT4="-DQT_SHARED"
1258 I_INCQT4=`prefix_I "$INCQT4"`
1259 LIBQT4="-L$q/lib -lQtCoreVBox"
1260 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1261 foundqt4=2
1262 break;
1263 fi
1264 LIBQT4="-L$q/lib -lQtCore"
1265 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1266 foundqt4=1
1267 break;
1268 fi
1269 done
1270 fi
1271 fi
1272 if [ -n "$foundqt4" ]; then
1273 cat > $ODIR.tmp_src.cc << EOF
1274#include <cstdio>
1275#include <QtGlobal>
1276extern "C" int main(void)
1277{
1278 printf("found version %s", QT_VERSION_STR);
1279#if QT_VERSION >= 0x040300
1280 printf(", OK.\n");
1281 return 0;
1282#else
1283 printf(", expected version 4.3.0 or higher\n");
1284 return 1;
1285#endif
1286}
1287EOF
1288 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1289 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1290 if test_execute_path "`strip_L "$LIBQT4"`"; then
1291 if [ "$OS" != "darwin" ]; then
1292 # strip .../QtCore as we add components ourself
1293 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1294 # store only the first path, remove all other pathes
1295 # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1296 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1297 cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1298 cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1299 cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1300 # this is not quite right since the qt libpath does not have to be first...
1301 cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1302 if [ "$foundqt4" = "2" ]; then
1303 cnf_append "VBOX_WITH_QT4_SUN" "1"
1304 fi
1305 test_header "Qt4 devtools"
1306 for q in $QT4DIR; do
1307 if which_wrapper "$q/bin/moc" > /dev/null; then
1308 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1309 if [ $? -ne 0 ]; then
1310 log_failure "not found"
1311 fail
1312 else
1313 log_success "found version $moc_ver"
1314 cnf_append "VBOX_PATH_QT4" "$q"
1315 cnf_append "PATH_SDK_QT4" "$q"
1316 cnf_append "PATH_TOOL_QT4" "$q"
1317 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1318 return
1319 fi
1320 fi
1321 done
1322 fi
1323 fi
1324 else
1325 log_failure "not found"
1326 fail
1327 fi
1328 else
1329 log_failure "not found"
1330 fail
1331 fi
1332}
1333
1334
1335#
1336# Check whether static libstdc++ is installed
1337#
1338check_staticlibstdcxx()
1339{
1340 test_header "static stc++ library"
1341 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1342 cat > $ODIR.tmp_src.cc << EOF
1343#include <string>
1344
1345extern "C" int main(void)
1346{
1347 std::string s = "test";
1348 return 0;
1349}
1350EOF
1351 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1352 log_success "found"
1353 fi
1354}
1355
1356
1357#
1358# Check for Linux sources
1359#
1360check_linux()
1361{
1362 test_header "Linux kernel sources"
1363 cat > $ODIR.tmp_src.c << EOF
1364#include <linux/version.h>
1365int printf(const char *format, ...);
1366int main(void)
1367{
1368 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1369 (LINUX_VERSION_CODE % 65536) / 256,
1370 LINUX_VERSION_CODE % 256);
1371#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1372 printf(", OK.\n");
1373 return 0;
1374#else
1375 printf(", expected version 2.4.0 or higher\n");
1376 return 1;
1377#endif
1378}
1379EOF
1380 echo "compiling the following source file:" >> $LOG
1381 cat $ODIR.tmp_src.c >> $LOG
1382 echo "using the following command line:" >> $LOG
1383 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1384 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1385 if [ $? -ne 0 ]; then
1386 echo
1387 echo " Linux kernel headers not found at $LINUX"
1388 echo " Check the file $LOG for detailed error information."
1389 fail
1390 else
1391 if test_execute; then
1392 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1393 fi
1394 fi
1395}
1396
1397
1398#
1399# Check for kchmviewer, needed to display the online help
1400# (unused as we ship kchmviewer)
1401#
1402check_kchmviewer()
1403{
1404 test_header kchmviewer
1405 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1406 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1407 if [ $? -ne 0 ]; then
1408 log_failure "not found"
1409 fail
1410 else
1411 log_success "found version $kchmviewer_ver"
1412 fi
1413 fi
1414}
1415
1416
1417#
1418# Check for the kBuild tools, we don't support GNU make
1419#
1420check_kbuild()
1421{
1422 test_header kBuild
1423 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1424 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1425 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1426 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1427 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1428 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1429 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1430 if [ "$OS" = "solaris" ]; then
1431 # Because of sh being non-default shell in Solaris we need to export PATH again when
1432 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1433 echo "PATH=\"$ORGPATH\"" >> $ENV
1434 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1435 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1436 else
1437 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1438 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1439 fi
1440 echo "export PATH" >> $ENV
1441 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1442 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1443 elif check_avail "kmk" KBUILDDIR really; then
1444 # check for installed kBuild
1445 KBUILD_SED="`which_wrapper kmk_sed`"
1446 else
1447 fail
1448 fi
1449 log_success "found"
1450}
1451
1452
1453#
1454# Check for compiler.h
1455# Some Linux distributions include "compiler.h" in their libc linux
1456# headers package, some don't. Most don't need it, building might (!)
1457# not succeed on openSUSE without it.
1458#
1459# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1460#
1461check_compiler_h()
1462{
1463 test_header compiler.h
1464 if ! test -f "/usr/include/linux/compiler.h"; then
1465 cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
1466 log_success "compiler.h not found"
1467 else
1468 log_success "compiler.h found"
1469 fi
1470}
1471
1472#
1473# Check for libcap.
1474# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1475# sockets for doing ICMP requests.
1476#
1477check_libcap()
1478{
1479 test_header "libcap library"
1480 cat > $ODIR.tmp_src.cc << EOF
1481#include <cstdio>
1482#include <sys/capability.h>
1483
1484extern "C" int main(void)
1485{
1486 char buf[1024];
1487 cap_t caps = cap_get_proc();
1488 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1489 return 0;
1490}
1491EOF
1492 if test_compile $LIBCAP libcap libcap; then
1493 if test_execute; then
1494 log_success "found"
1495 fi
1496 fi
1497}
1498
1499#
1500# Check if we are able to build 32-bit applications (needed for the guest additions)
1501#
1502check_32bit()
1503{
1504 test_header "32-bit support"
1505 cat > $ODIR.tmp_src.c << EOF
1506#include <stdint.h>
1507int main(void)
1508{
1509 return 0;
1510}
1511EOF
1512 echo "compiling the following source file:" >> $LOG
1513 cat $ODIR.tmp_src.c >> $LOG
1514 echo "using the following command line:" >> $LOG
1515 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1516 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1517 if [ $? -ne 0 ]; then
1518 echo
1519 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1520 echo " Check the file $LOG for detailed error information."
1521 fail
1522 fi
1523 log_success ""
1524}
1525
1526
1527#
1528# Check for Python
1529#
1530check_python()
1531{
1532 test_header "python support"
1533 cat > $ODIR.tmp_src.cc << EOF
1534#include <cstdio>
1535#include <Python.h>
1536extern "C" int main(void)
1537{
1538 Py_Initialize();
1539 printf("found version %s", PY_VERSION);
1540#if PY_VERSION_HEX >= 0x02030000
1541 printf(", OK.\n");
1542 return 0;
1543#else
1544 printf(", expected version 2.3 or higher\n");
1545 return 1;
1546#endif
1547}
1548EOF
1549 found=
1550 for p in $PYTHONDIR; do
1551 for d in python2.6 python2.5 python2.4 python2.3; do
1552 for b in lib64 lib/64 lib; do
1553 echo "compiling the following source file:" >> $LOG
1554 cat $ODIR.tmp_src.cc >> $LOG
1555 echo "using the following command line:" >> $LOG
1556 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1557 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1558 if [ $? -eq 0 ]; then
1559 found=1
1560 break
1561 fi
1562 done
1563 if [ -n "$found" ]; then break; fi
1564 done
1565 if [ -n "$found" ]; then break; fi
1566 done
1567 if [ -n "$found" ]; then
1568 if test_execute; then
1569 cnf_append "VBOX_WITH_PYTHON" "1"
1570 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1571 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1572 else
1573 log_failure "not found"
1574 fail
1575 fi
1576 else
1577 log_failure "not found"
1578 fail
1579 fi
1580}
1581
1582
1583#
1584# Setup wine
1585#
1586setup_wine()
1587{
1588 test_header "Wine support"
1589 if ! which_wrapper wine > /dev/null; then
1590 echo " wine binary not found"
1591 fail
1592 fi
1593 if ! which_wrapper wineprefixcreate > /dev/null; then
1594 echo " wineprefixcreate not found"
1595 fail
1596 fi
1597 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1598 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1599 rm -rf $WINEPREFIX
1600 mkdir -p $WINEPREFIX
1601 touch $WINEPREFIX/.no_prelaunch_window_flag
1602 if ! wineprefixcreate -q > /dev/null 2>&1; then
1603 echo " wineprefixcreate failed"
1604 fail
1605 fi
1606 tmp=.tmp.wine.reg
1607 rm -f $tmp
1608 echo 'REGEDIT4' > $tmp
1609 echo '' >> $tmp
1610 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1611 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
1612 echo '' >> $tmp
1613 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1614 echo '"itss"="native"' >> $tmp
1615 echo '' >> $tmp
1616 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1617 echo '"itss"="native"' >> $tmp
1618 echo '' >> $tmp
1619 if ! wine regedit $tmp > /dev/null 2>&1; then
1620 rm -f $tmp
1621 echo " failed to load registry changes (path)."
1622 fail
1623 fi
1624 rm -f $tmp
1625 log_success "found"
1626}
1627
1628#
1629# Check for gSOAP.
1630#
1631check_gsoap()
1632{
1633 test_header "GSOAP compiler"
1634 if [ -z "$GSOAP" ]; then
1635 GSOAP="/usr"
1636 fi
1637 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1638 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1639 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1640 # TODO: Check for libgsoap++.a/so
1641
1642 if [ -z "$GSOAP_IMPORT" ]; then
1643 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1644 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1645 GSOAP_IMPORT="$GSOAP/include/gsoap"
1646 fi
1647 fi
1648 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1649 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1650 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1651 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1652 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1653 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoap++"
1654 log_success "found"
1655 else
1656 log_failure "stlvector.h not found -- disabling webservice"
1657 cnf_append "VBOX_WITH_WEBSERVICES" ""
1658 fi
1659 else
1660 log_failure "stdsoap2.h not found -- disabling webservice"
1661 cnf_append "VBOX_WITH_WEBSERVICES" ""
1662 fi
1663 else
1664 log_failure "wsdl2h not found -- disabling webservice"
1665 cnf_append "VBOX_WITH_WEBSERVICES" ""
1666 fi
1667 else
1668 log_failure "soapcpp2 not found -- disabling webservice"
1669 cnf_append "VBOX_WITH_WEBSERVICES" ""
1670 fi
1671}
1672
1673
1674#
1675# Determines the Darwin version.
1676# @todo This should really check the Xcode/SDK version.
1677#
1678check_darwinversion()
1679{
1680 test_header "Darwin version"
1681 darwin_ver=`uname -r`
1682 case "$darwin_ver" in
1683 9\.*)
1684 darwin_ver="10.5"
1685 #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
1686 ;;
1687 8\.*)
1688 darwin_ver="10.4"
1689 ;;
1690 *)
1691 echo " failed to determin darwin version. (uname -r: $darwin_ver)"
1692 fail
1693 darwin_ver="unknown"
1694 ;;
1695 esac
1696 log_success "found version $darwin_ver"
1697}
1698
1699
1700#
1701# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1702# is around to prevent confusion when the build fails in src/recompiler.
1703# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1704#
1705check_i386elfgcc()
1706{
1707 test_header "i386-elf-gcc"
1708 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1709 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1710 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1711 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1712 if test -z "$i386_elf_gcc"; then
1713 echo " failed to find i386-elf-gcc"
1714 fail
1715 fi
1716 log_success "found $i386_elf_gcc"
1717}
1718
1719
1720#
1721# Show help
1722#
1723show_help()
1724{
1725 cat << EOF
1726Usage: ./configure [OPTIONS]...
1727
1728Configuration:
1729 -h, --help display this help and exit
1730 --nofatal don't abort on errors
1731 --disable-xpcom disable XPCOM and related stuff
1732 --disable-python disable python bindings
1733 --disable-sdl-ttf disable SDL_ttf detection
1734 --disable-alsa disable the ALSA sound backend
1735 --disable-pulse disable the PulseAudio backend
1736 --disable-dbus don't use DBus and hal for hardware detection
1737 --disable-kmods don't build Linux kernel modules (host and guest)
1738 --disable-hardening don't be strict about /dev/vboxdrv access
1739 --enable-webservice enable the webservice stuff
1740 --build-libxml2 build libxml2 from sources
1741 --build-libxslt build libxslt from sources
1742 --setup-wine setup a Wine directory and register the hhc hack
1743
1744Paths:
1745 --with-gcc=PATH location of the gcc compiler [$CC]
1746 --with-g++=PATH location of the g++ compiler [$CXX]
1747 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1748 --with-iasl=PATH location of the iasl compiler [$IASL]
1749 --with-linux=DIR Linux kernel source directory [$LINUX]
1750 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1751 --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
1752 --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries
1753 (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)
1754 --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)
1755 --out-path=PATH the folder to which configuration and build output
1756 should go
1757
1758Build type:
1759 -d, --build-debug build with debugging symbols and assertions
1760 --build-profile build with profiling support
1761 --build-headless build headless (without any X11 frontend)
1762EOF
1763 exit 0
1764}
1765
1766
1767#
1768# The body.
1769#
1770
1771# scan command line options
1772for option in $*; do
1773 case "$option" in
1774 --help|-help|-h)
1775 show_help
1776 ;;
1777 --nofatal)
1778 nofatal=1
1779 ;;
1780 --env-only)
1781 ENV_ONLY=1
1782 ;;
1783 --with-gcc=*)
1784 CC=`echo $option | cut -d'=' -f2`
1785 ;;
1786 --with-g++=*)
1787 CXX=`echo $option | cut -d'=' -f2`
1788 ;;
1789 --with-kbuild=*)
1790 KBUILDDIR=`echo $option | cut -d'=' -f2`
1791 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1792 echo "Error: KBUILDDIR contains invalid characters!"
1793 exit 1
1794 fi
1795 ;;
1796 --with-qt-dir=*|--with-qt4-dir=*)
1797 QT4DIR=`echo $option | cut -d'=' -f2`
1798 QT4DIR_PKGCONFIG=0
1799 ;;
1800 --with-gsoap-dir=*)
1801 GSOAP=`echo $option | cut -d'=' -f2`
1802 ;;
1803 --with-gsoap-import=*)
1804 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
1805 ;;
1806 --with-iasl=*)
1807 IASL=`echo $option | cut -d'=' -f2`
1808 ;;
1809 --with-linux=*)
1810 LINUX=`echo $option | cut -d'=' -f2`
1811 ;;
1812 --with-mkisofs=*)
1813 MKISOFS=`echo $option | cut -d'=' -f2`
1814 ;;
1815 --disable-xpcom)
1816 WITH_XPCOM=0
1817 ;;
1818 --disable-python)
1819 WITH_PYTHON=0
1820 ;;
1821 --disable-sdl-ttf)
1822 WITH_SDL_TTF=0
1823 ;;
1824 --disable-qt)
1825 WITH_QT4=0
1826 ;;
1827 --disable-qt4)
1828 WITH_QT4=0
1829 ;;
1830 --disable-alsa)
1831 WITH_ALSA=0
1832 ;;
1833 --disable-pulse)
1834 WITH_PULSE=0
1835 ;;
1836 --disable-dbus)
1837 WITH_DBUS=0
1838 ;;
1839 --disable-kmods)
1840 WITH_KMODS=0
1841 ;;
1842 --disable-hardening)
1843 WITH_HARDENING=0
1844 ;;
1845 --enable-hardening)
1846 WITH_HARDENING=2
1847 ;;
1848 --enable-webservice)
1849 WITH_GSOAP=1
1850 ;;
1851 --build-debug|-d)
1852 BUILD_TYPE=debug
1853 ;;
1854 --build-profile)
1855 BUILD_TYPE=profile
1856 ;;
1857 --build-libxml2)
1858 BUILD_LIBXML2=1
1859 ;;
1860 --build-libxslt)
1861 BUILD_LIBXSLT=1
1862 ;;
1863 --build-headless)
1864 HEADLESS=1
1865 WITH_SDL=0
1866 WITH_SDL_TTF=0
1867 WITH_X11=0
1868 WITH_QT4=0
1869 ;;
1870 --ose)
1871 OSE=2
1872 ;;
1873 --odir=*)
1874 ODIR="`echo $option | cut -d'=' -f2`/"
1875 ODIR_OVERRIDE=1
1876 ;;
1877 --out-path=*)
1878 out_path="`echo $option | cut -d'=' -f2`/"
1879 if [ -d $out_path ]; then
1880 saved_path="`pwd`"
1881 cd $out_path
1882 OUT_PATH="`pwd`"
1883 cd $saved_path
1884 OUT_PATH_OVERRIDE=1
1885 if [ $ODIR_OVERRIDE -eq 0 ]; then
1886 # This variable has not *yet* been overridden. That can still happen.
1887 ODIR=$OUT_PATH/
1888 fi
1889 else
1890 echo "Error: invalid folder \"$out_path\" in option \"$option\""
1891 exit 1
1892 fi
1893 ;;
1894 --setup-wine)
1895 SETUP_WINE=1
1896 ;;
1897 *)
1898 echo
1899 echo "Unrecognized option \"$option\""
1900 echo
1901 show_help
1902 ;;
1903 esac
1904done
1905
1906LOG="$ODIR$LOG"
1907ENV="$ODIR$ENV"
1908CNF="$ODIR$CNF"
1909
1910# initialize output files
1911cat > $LOG << EOF
1912# Log file generated by
1913#
1914# '$0 $*'
1915#
1916
1917EOF
1918cat > $CNF << EOF
1919# -*- Makefile -*-
1920#
1921# automatically generated by
1922#
1923# '$0 $*'
1924#
1925# It will be completely overwritten if configure is executed again.
1926#
1927
1928EOF
1929cat > $ENV << EOF
1930#!/bin/bash
1931#
1932# automatically generated by
1933#
1934# '$0 $*'
1935#
1936# It will be completely overwritten if configure is executed again.
1937# Make sure you source this file once before you start to build VBox.
1938#
1939
1940EOF
1941
1942# test if we are OSE
1943if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
1944 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
1945 echo >> $LOG
1946 OSE=0
1947fi
1948
1949if [ "$BUILD_TYPE" = "debug" ]; then
1950 echo "Creating DEBUG build!" >> $LOG
1951elif [ "$BUILD_TYPE" = "profile" ]; then
1952 echo "Creating PROFILE build!" >> $LOG
1953fi
1954
1955# first determine our environment
1956check_environment
1957check_kbuild
1958
1959[ -n "$ENV_ONLY" ] && exit 0
1960
1961# append the tools directory to the default search path
1962echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
1963export PATH
1964
1965# if we will be writing to a different out directory then set this up now
1966if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
1967 echo "export AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
1968 echo "export LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
1969 echo "export PATH_OUT_BASE=$OUT_PATH" >> $ENV
1970fi
1971
1972# some things are not available in for OSE
1973if [ $OSE -ge 1 ]; then
1974 cnf_append "VBOX_OSE" "1"
1975 cnf_append "VBOX_WITH_TESTSUITE" ""
1976 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
1977
1978 if [ "$OS" = "linux" ]; then
1979 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
1980 else
1981 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
1982 fi
1983 echo >> $CNF
1984fi
1985
1986# headless
1987if [ -n "$HEADLESS" ]; then
1988 cnf_append "VBOX_HEADLESS" "1"
1989fi
1990
1991if [ "$OS" = "darwin" ]; then
1992 # On Darwin we want to build against Qt4 only. WITH_QT4 is enabled by
1993 # default so disable Qt3. --disable-qt disables both Qt3 and Qt4 GUI now,
1994 # --disable-qt4 disables only the Qt4 GUI (which is not appropriate for
1995 # Darwin as we disable the Qt3 here anyway.
1996 # (Qt3 builds for Intel Macs are usually not threaded or for X11. And they
1997 # don't contain our patches, which means the result isn't really usable.)
1998 BUILD_LIBXSLT=1
1999 BUILD_LIBXML2=1
2000fi
2001
2002# emit disable directives corresponding to any --disable-xxx options.
2003[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2004[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2005[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2006[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2007[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2008
2009# the tools
2010check_gcc
2011[ "$OS" != "darwin" ] && check_as86
2012[ "$OS" != "darwin" ] && check_bcc
2013[ "$OS" != "darwin" ] && check_iasl
2014# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2015# [ "$OS" != "darwin" ] && check_yasm
2016[ "$OS" != "darwin" ] && check_xsltproc
2017[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
2018
2019# the libraries
2020[ "$OS" != "darwin" ] && check_pthread
2021[ $WITH_XPCOM -eq 1 ] && check_libxml2
2022[ $WITH_XPCOM -eq 1 ] && check_libxslt
2023[ $WITH_LIBIDL -eq 1 ] && check_libidl
2024# build openssl on Darwin in every case
2025[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
2026[ "$OS" != "darwin" ] && check_z
2027[ "$OS" != "darwin" -a "$OS" != "freebsd" ] && check_png
2028[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2029[ $WITH_SDL -eq 1 ] && check_sdl
2030[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2031[ $WITH_X11 -eq 1 ] && check_x
2032# TODO check for Xmu (X11/Xmu/StdCmap.h)
2033# TODO check for mesa-common-dev (GL/glx.h)
2034# TODO check for libglu1-mesa-dev (GL/glu.h)
2035# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h)
2036[ $WITH_X11 -eq 1 ] && check_xcursor
2037[ $WITH_QT4 -eq 1 ] && check_qt4
2038[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
2039
2040# Linux-specific
2041if [ "$OS" = "linux" ]; then
2042 check_staticlibstdcxx
2043 if [ $WITH_KMODS -eq 1 ]; then
2044 check_linux
2045 else
2046 cnf_append "VBOX_LINUX_SRC" ""
2047 cnf_append "VBOX_WITH_VBOXDRV" ""
2048 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2049 fi
2050 if [ $WITH_ALSA -eq 1 ]; then
2051 check_alsa
2052 else
2053 cnf_append "VBOX_WITH_ALSA" ""
2054 fi
2055 if [ $WITH_PULSE -eq 1 ]; then
2056 check_pulse
2057 else
2058 cnf_append "VBOX_WITH_PULSE" ""
2059 fi
2060 if [ $WITH_DBUS -eq 0 ]; then
2061 cnf_append "VBOX_WITH_DBUS" ""
2062 fi
2063 check_libcap
2064 check_compiler_h
2065 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
2066fi
2067
2068[ -n "$SETUP_WINE" ] && setup_wine
2069
2070if [ $OSE -ge 1 ]; then
2071 if [ $WITH_GSOAP -eq 1 ]; then
2072 check_gsoap
2073 else
2074 cnf_append "VBOX_WITH_WEBSERVICES" ""
2075 fi
2076fi
2077
2078# Darwin-specific
2079if [ "$OS" = "darwin" ]; then
2080 check_darwinversion
2081 check_i386elfgcc
2082fi
2083
2084# success!
2085echo
2086echo "Successfully generated '$CNF' and '$ENV'."
2087echo "Source '$ENV' once before you start to build VBox:"
2088echo ""
2089echo " source $ENV"
2090echo " kmk"
2091echo ""
2092if [ "$OS" = "linux" ]; then
2093 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2094 vbox_out_path=$OUT_PATH
2095 else
2096 vbox_out_path=./out
2097 fi
2098 echo "To compile the kernel module, do:"
2099 echo ""
2100 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src/vboxdrv"
2101 echo " make"
2102 echo ""
2103fi
2104if [ $WITH_HARDENING -gt 0 ]; then
2105 echo ""
2106 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2107 echo " Hardening is enabled which means that the VBox binaries will not run from"
2108 echo " the binary directory. The binaries have to be installed suid root and some"
2109 echo " more prerequisites have to be fulfilled which is normally done by installing"
2110 echo " the final package. For development, the hardening feature can be disabled"
2111 echo " by specifying the --disable-hardening parameter. Please never disable that"
2112 echo " feature for the final distribution!"
2113 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2114 echo ""
2115else
2116 echo ""
2117 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2118 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2119 echo " disabled hardening!"
2120 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2121 echo ""
2122fi
2123echo "Enjoy!"
2124cleanup
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