VirtualBox

source: vbox/trunk/configure@ 22739

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

configure: allow/show option only which are relevant for the current architecture

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