VirtualBox

source: vbox/trunk/configure@ 16596

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

configure: todo

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