VirtualBox

source: vbox/trunk/configure@ 22496

Last change on this file since 22496 was 22282, checked in by vboxsync, 15 years ago

configure-OSX: Handle special case for amd64 and the missing kBuild bins.

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

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