VirtualBox

source: vbox/trunk/configure@ 15633

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

configure: cap detection less verbose

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