VirtualBox

source: vbox/trunk/configure@ 15209

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

Main: load libdbus-1 dynamically on Linux hosts

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