VirtualBox

source: vbox/trunk/configure@ 17913

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

configure: check for OpenGL stuff

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette