VirtualBox

source: vbox/trunk/configure@ 22259

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

Configure-OSE: make it work for Darwin again

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 57.8 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 check_avail "kmk" KBUILDDIR really; then
1591 # check for installed kBuild
1592 KBUILD_SED="`which_wrapper kmk_sed`"
1593 else
1594 fail
1595 fi
1596 log_success "found"
1597}
1598
1599
1600#
1601# Check for compiler.h
1602# Some Linux distributions include "compiler.h" in their libc linux
1603# headers package, some don't. Most don't need it, building might (!)
1604# not succeed on openSUSE without it.
1605#
1606# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1607#
1608check_compiler_h()
1609{
1610 test_header compiler.h
1611 if ! test -f "/usr/include/linux/compiler.h"; then
1612 log_success "compiler.h not found"
1613 else
1614 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1615 log_success "compiler.h found"
1616 fi
1617}
1618
1619#
1620# Check for libcap.
1621# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1622# sockets for doing ICMP requests.
1623#
1624check_libcap()
1625{
1626 test_header "libcap library"
1627 cat > $ODIR.tmp_src.cc << EOF
1628#include <cstdio>
1629#include <sys/types.h>
1630#include <sys/capability.h>
1631
1632extern "C" int main(void)
1633{
1634 char buf[1024];
1635 cap_t caps = cap_get_proc();
1636 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1637 return 0;
1638}
1639EOF
1640 if test_compile $LIBCAP libcap libcap; then
1641 if test_execute; then
1642 log_success "found"
1643 fi
1644 fi
1645}
1646
1647#
1648# Check if we are able to build 32-bit applications (needed for the guest additions)
1649#
1650check_32bit()
1651{
1652 test_header "32-bit support"
1653 cat > $ODIR.tmp_src.c << EOF
1654#include <stdint.h>
1655int main(void)
1656{
1657 return 0;
1658}
1659EOF
1660 echo "compiling the following source file:" >> $LOG
1661 cat $ODIR.tmp_src.c >> $LOG
1662 echo "using the following command line:" >> $LOG
1663 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1664 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1665 if [ $? -ne 0 ]; then
1666 echo
1667 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1668 echo " Check the file $LOG for detailed error information."
1669 fail
1670 fi
1671 log_success ""
1672}
1673
1674
1675#
1676# Check for Python
1677#
1678check_python()
1679{
1680 test_header "python support"
1681 cat > $ODIR.tmp_src.cc << EOF
1682#include <cstdio>
1683#include <Python.h>
1684extern "C" int main(void)
1685{
1686 Py_Initialize();
1687 printf("found version %s", PY_VERSION);
1688#if PY_VERSION_HEX >= 0x02030000
1689 printf(", OK.\n");
1690 return 0;
1691#else
1692 printf(", expected version 2.3 or higher\n");
1693 return 1;
1694#endif
1695}
1696EOF
1697 found=
1698# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1699 if [ "$OS" != "solaris" ]; then
1700 SUPPYTHONLIBS="python2.6 python2.5 python2.4 python2.3"
1701 else
1702 SUPPYTHONLIBS="python2.4"
1703 fi
1704 for p in $PYTHONDIR; do
1705 for d in $SUPPYTHONLIBS; do
1706 for b in lib64 lib/64 lib; do
1707 echo "compiling the following source file:" >> $LOG
1708 cat $ODIR.tmp_src.cc >> $LOG
1709 echo "using the following command line:" >> $LOG
1710 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1711 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1712 if [ $? -eq 0 ]; then
1713 found=1
1714 break
1715 fi
1716 done
1717 if [ -n "$found" ]; then break; fi
1718 done
1719 if [ -n "$found" ]; then break; fi
1720 done
1721 if [ -n "$found" ]; then
1722 if test_execute; then
1723 cnf_append "VBOX_WITH_PYTHON" "1"
1724 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1725 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1726 else
1727 log_failure "not found"
1728 fail
1729 fi
1730 else
1731 log_failure "not found"
1732 fail
1733 fi
1734}
1735
1736
1737#
1738# Setup wine
1739#
1740setup_wine()
1741{
1742 test_header "Wine support"
1743 if ! which_wrapper wine > /dev/null; then
1744 echo " wine binary not found"
1745 fail
1746 fi
1747 if ! which_wrapper wineprefixcreate > /dev/null; then
1748 echo " wineprefixcreate not found"
1749 fail
1750 fi
1751 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1752 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1753 rm -rf $WINEPREFIX
1754 mkdir -p $WINEPREFIX
1755 touch $WINEPREFIX/.no_prelaunch_window_flag
1756 if ! wineprefixcreate -q > /dev/null 2>&1; then
1757 echo " wineprefixcreate failed"
1758 fail
1759 fi
1760 tmp=.tmp.wine.reg
1761 rm -f $tmp
1762 echo 'REGEDIT4' > $tmp
1763 echo '' >> $tmp
1764 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1765 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
1766 echo '' >> $tmp
1767 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1768 echo '"itss"="native"' >> $tmp
1769 echo '' >> $tmp
1770 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1771 echo '"itss"="native"' >> $tmp
1772 echo '' >> $tmp
1773 if ! wine regedit $tmp > /dev/null 2>&1; then
1774 rm -f $tmp
1775 echo " failed to load registry changes (path)."
1776 fail
1777 fi
1778 rm -f $tmp
1779 log_success "found"
1780}
1781
1782#
1783# Check for gSOAP.
1784#
1785check_gsoap()
1786{
1787 test_header "GSOAP compiler"
1788 if [ -z "$GSOAP" ]; then
1789 GSOAP="/usr"
1790 fi
1791 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1792 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1793 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1794 # TODO: Check for libgsoap++.a/so
1795
1796 if [ -z "$GSOAP_IMPORT" ]; then
1797 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1798 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1799 GSOAP_IMPORT="$GSOAP/include/gsoap"
1800 fi
1801 fi
1802 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1803 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1804 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1805 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1806 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
1807 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
1808 else
1809 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1810 fi
1811 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoap++"
1812 log_success "found"
1813 else
1814 log_failure "stlvector.h not found -- disabling webservice"
1815 cnf_append "VBOX_WITH_WEBSERVICES" ""
1816 fi
1817 else
1818 log_failure "stdsoap2.h not found -- disabling webservice"
1819 cnf_append "VBOX_WITH_WEBSERVICES" ""
1820 fi
1821 else
1822 log_failure "wsdl2h not found -- disabling webservice"
1823 cnf_append "VBOX_WITH_WEBSERVICES" ""
1824 fi
1825 else
1826 log_failure "soapcpp2 not found -- disabling webservice"
1827 cnf_append "VBOX_WITH_WEBSERVICES" ""
1828 fi
1829}
1830
1831
1832#
1833# Determines the Darwin version.
1834# @todo This should really check the Xcode/SDK version.
1835#
1836check_darwinversion()
1837{
1838 test_header "Darwin version"
1839 darwin_ver=`uname -r`
1840 case "$darwin_ver" in
1841 10\.*)
1842 darwin_ver="10.6"
1843 ;;
1844 9\.*)
1845 darwin_ver="10.5"
1846 #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
1847 ;;
1848 8\.*)
1849 darwin_ver="10.4"
1850 ;;
1851 *)
1852 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
1853 fail
1854 darwin_ver="unknown"
1855 ;;
1856 esac
1857 log_success "found version $darwin_ver"
1858}
1859
1860
1861#
1862# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1863# is around to prevent confusion when the build fails in src/recompiler.
1864# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1865#
1866check_i386elfgcc()
1867{
1868 test_header "i386-elf-gcc"
1869 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1870 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1871 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1872 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1873 if test -z "$i386_elf_gcc"; then
1874 echo " failed to find i386-elf-gcc"
1875 fail
1876 fi
1877 log_success "found $i386_elf_gcc"
1878}
1879
1880
1881#
1882# Show help
1883#
1884show_help()
1885{
1886 cat << EOF
1887Usage: ./configure [OPTIONS]...
1888
1889Configuration:
1890 -h, --help display this help and exit
1891 --nofatal don't abort on errors
1892 --disable-xpcom disable XPCOM and related stuff
1893 --disable-python disable python bindings
1894 --disable-sdl-ttf disable SDL_ttf detection
1895 --disable-alsa disable the ALSA sound backend
1896 --disable-pulse disable the PulseAudio backend
1897 --disable-dbus don't use DBus and hal for hardware detection
1898 --disable-kmods don't build Linux kernel modules (host and guest)
1899 --disable-hardening don't be strict about /dev/vboxdrv access
1900 --disable-opengl disable OpenGL support
1901 --enable-webservice enable the webservice stuff
1902 --build-libxml2 build libxml2 from sources
1903 --build-libxslt build libxslt from sources
1904 --build-libcurl build libcurl from sources (PUEL only)
1905 --setup-wine setup a Wine directory and register the hhc hack
1906
1907Paths:
1908 --with-gcc=PATH location of the gcc compiler [$CC]
1909 --with-g++=PATH location of the g++ compiler [$CXX]
1910 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1911 --with-iasl=PATH location of the iasl compiler [$IASL]
1912 --with-linux=DIR Linux kernel source directory [$LINUX]
1913 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1914 --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
1915 --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries
1916 (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)
1917 --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)
1918 --out-path=PATH the folder to which configuration and build output
1919 should go
1920
1921Build type:
1922 -d, --build-debug build with debugging symbols and assertions
1923 --build-profile build with profiling support
1924 --build-headless build headless (without any X11 frontend)
1925EOF
1926 exit 0
1927}
1928
1929
1930#
1931# The body.
1932#
1933
1934# scan command line options
1935for option in $*; do
1936 case "$option" in
1937 --help|-help|-h)
1938 show_help
1939 ;;
1940 --nofatal)
1941 nofatal=1
1942 ;;
1943 --env-only)
1944 ENV_ONLY=1
1945 ;;
1946 --with-gcc=*)
1947 CC=`echo $option | cut -d'=' -f2`
1948 ;;
1949 --with-g++=*)
1950 CXX=`echo $option | cut -d'=' -f2`
1951 ;;
1952 --with-kbuild=*)
1953 KBUILDDIR=`echo $option | cut -d'=' -f2`
1954 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1955 echo "Error: KBUILDDIR contains invalid characters!"
1956 exit 1
1957 fi
1958 ;;
1959 --with-qt-dir=*|--with-qt4-dir=*)
1960 QT4DIR=`echo $option | cut -d'=' -f2`
1961 QT4DIR_PKGCONFIG=0
1962 ;;
1963 --with-gsoap-dir=*)
1964 GSOAP=`echo $option | cut -d'=' -f2`
1965 ;;
1966 --with-gsoap-import=*)
1967 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
1968 ;;
1969 --with-iasl=*)
1970 IASL=`echo $option | cut -d'=' -f2`
1971 ;;
1972 --with-linux=*)
1973 LINUX=`echo $option | cut -d'=' -f2`
1974 ;;
1975 --with-mkisofs=*)
1976 MKISOFS=`echo $option | cut -d'=' -f2`
1977 ;;
1978 --disable-xpcom)
1979 WITH_XPCOM=0
1980 ;;
1981 --disable-python)
1982 WITH_PYTHON=0
1983 ;;
1984 --disable-sdl-ttf)
1985 WITH_SDL_TTF=0
1986 ;;
1987 --disable-qt)
1988 WITH_QT4=0
1989 ;;
1990 --disable-qt4)
1991 WITH_QT4=0
1992 ;;
1993 --disable-alsa)
1994 WITH_ALSA=0
1995 ;;
1996 --disable-pulse)
1997 WITH_PULSE=0
1998 ;;
1999 --disable-dbus)
2000 WITH_DBUS=0
2001 ;;
2002 --disable-kmods)
2003 WITH_KMODS=0
2004 ;;
2005 --disable-opengl)
2006 WITH_OPENGL=0
2007 ;;
2008 --disable-hardening)
2009 WITH_HARDENING=0
2010 ;;
2011 --enable-hardening)
2012 WITH_HARDENING=2
2013 ;;
2014 --enable-webservice)
2015 WITH_GSOAP=1
2016 ;;
2017 --build-debug|-d)
2018 BUILD_TYPE=debug
2019 ;;
2020 --build-profile)
2021 BUILD_TYPE=profile
2022 ;;
2023 --build-libxml2)
2024 BUILD_LIBXML2=1
2025 ;;
2026 --build-libxslt)
2027 BUILD_LIBXSLT=1
2028 ;;
2029 --build-libcurl)
2030 BUILD_LIBCURL=1
2031 ;;
2032 --build-headless)
2033 HEADLESS=1
2034 WITH_SDL=0
2035 WITH_SDL_TTF=0
2036 WITH_X11=0
2037 WITH_OPENGL=0
2038 WITH_QT4=0
2039 ;;
2040 --ose)
2041 OSE=2
2042 ;;
2043 --odir=*)
2044 ODIR="`echo $option | cut -d'=' -f2`/"
2045 ODIR_OVERRIDE=1
2046 ;;
2047 --out-path=*)
2048 out_path="`echo $option | cut -d'=' -f2`/"
2049 if [ -d $out_path ]; then
2050 saved_path="`pwd`"
2051 cd $out_path
2052 OUT_PATH="`pwd`"
2053 cd $saved_path
2054 OUT_PATH_OVERRIDE=1
2055 if [ $ODIR_OVERRIDE -eq 0 ]; then
2056 # This variable has not *yet* been overridden. That can still happen.
2057 ODIR=$OUT_PATH/
2058 fi
2059 else
2060 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2061 exit 1
2062 fi
2063 ;;
2064 --setup-wine)
2065 SETUP_WINE=1
2066 ;;
2067 *)
2068 echo
2069 echo "Unrecognized option \"$option\""
2070 echo
2071 show_help
2072 ;;
2073 esac
2074done
2075
2076LOG="$ODIR$LOG"
2077ENV="$ODIR$ENV"
2078CNF="$ODIR$CNF"
2079
2080# initialize output files
2081cat > $LOG << EOF
2082# Log file generated by
2083#
2084# '$0 $*'
2085#
2086
2087EOF
2088cat > $CNF << EOF
2089# -*- Makefile -*-
2090#
2091# automatically generated by
2092#
2093# '$0 $*'
2094#
2095# It will be completely overwritten if configure is executed again.
2096#
2097
2098EOF
2099cat > $ENV << EOF
2100#!/bin/bash
2101#
2102# automatically generated by
2103#
2104# '$0 $*'
2105#
2106# It will be completely overwritten if configure is executed again.
2107# Make sure you source this file once before you start to build VBox.
2108#
2109
2110EOF
2111
2112# test if we are OSE
2113if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
2114 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
2115 echo >> $LOG
2116 OSE=0
2117fi
2118
2119if [ "$BUILD_TYPE" = "debug" ]; then
2120 echo "Creating DEBUG build!" >> $LOG
2121elif [ "$BUILD_TYPE" = "profile" ]; then
2122 echo "Creating PROFILE build!" >> $LOG
2123fi
2124
2125# first determine our environment
2126check_environment
2127check_kbuild
2128
2129[ -n "$ENV_ONLY" ] && exit 0
2130
2131# append the tools directory to the default search path
2132echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2133export PATH
2134
2135# if we will be writing to a different out directory then set this up now
2136if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2137 echo "export AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2138 echo "export LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2139 echo "export PATH_OUT_BASE=$OUT_PATH" >> $ENV
2140fi
2141
2142# some things are not available in for OSE
2143if [ $OSE -ge 1 ]; then
2144 cnf_append "VBOX_OSE" "1"
2145 cnf_append "VBOX_WITH_TESTSUITE" ""
2146 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2147
2148 if [ "$OS" = "linux" ]; then
2149 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2150 else
2151 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2152 fi
2153 echo >> $CNF
2154fi
2155
2156# headless
2157if [ -n "$HEADLESS" ]; then
2158 cnf_append "VBOX_HEADLESS" "1"
2159fi
2160
2161if [ $WITH_OPENGL -eq 0 ]; then
2162 cnf_append "VBOX_WITH_CROGL" ""
2163fi
2164
2165if [ "$OS" = "darwin" ]; then
2166 BUILD_LIBXSLT=1
2167 BUILD_LIBXML2=1
2168 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2169 [ $OSE -eq 1 ] || BUILD_LIBSSL=1
2170fi
2171
2172# emit disable directives corresponding to any --disable-xxx options.
2173[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2174[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2175[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2176[ $WITH_PYTHON -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2177[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2178[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2179
2180# the tools
2181check_gcc
2182[ "$OS" != "darwin" ] && check_as86
2183[ "$OS" != "darwin" ] && check_bcc
2184[ "$OS" != "darwin" ] && check_iasl
2185# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2186# [ "$OS" != "darwin" ] && check_yasm
2187[ "$OS" != "darwin" ] && check_xsltproc
2188[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
2189
2190# the libraries
2191[ "$OS" != "darwin" ] && check_pthread
2192[ $WITH_XPCOM -eq 1 ] && check_libxml2
2193[ $WITH_XPCOM -eq 1 ] && check_libxslt
2194[ $WITH_LIBIDL -eq 1 ] && check_libidl
2195check_ssl
2196check_curl
2197[ "$OS" != "darwin" ] && check_z
2198[ "$OS" != "darwin" -a "$OS" != "freebsd" ] && check_png
2199[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2200[ $WITH_SDL -eq 1 ] && check_sdl
2201[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2202[ $WITH_X11 -eq 1 ] && check_x
2203# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2204# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2205[ $WITH_X11 -eq 1 ] && check_xcursor
2206[ $WITH_OPENGL -eq 1 ] && check_xmu
2207[ "$OS" != "darwin" -a $WITH_OPENGL -eq 1 ] && check_mesa
2208[ $WITH_QT4 -eq 1 ] && check_qt4
2209[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
2210
2211# Linux-specific
2212if [ "$OS" = "linux" ]; then
2213 # don't check for the static libstdc++ in the PUEL version as we build the
2214 # additions at a dedicated box
2215 [ $OSE -ge 1 ] && check_staticlibstdcxx
2216 if [ $WITH_KMODS -eq 1 ]; then
2217 check_linux
2218 else
2219 cnf_append "VBOX_LINUX_SRC" ""
2220 cnf_append "VBOX_WITH_VBOXDRV" ""
2221 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2222 fi
2223 if [ $WITH_ALSA -eq 1 ]; then
2224 check_alsa
2225 else
2226 cnf_append "VBOX_WITH_ALSA" ""
2227 fi
2228 if [ $WITH_PULSE -eq 1 ]; then
2229 check_pulse
2230 else
2231 cnf_append "VBOX_WITH_PULSE" ""
2232 fi
2233 if [ $WITH_DBUS -eq 0 ]; then
2234 cnf_append "VBOX_WITH_DBUS" ""
2235 fi
2236 check_libcap
2237 check_compiler_h
2238 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
2239fi
2240
2241[ -n "$SETUP_WINE" ] && setup_wine
2242
2243if [ $OSE -ge 1 ]; then
2244 if [ $WITH_GSOAP -eq 1 ]; then
2245 check_gsoap
2246 else
2247 cnf_append "VBOX_WITH_WEBSERVICES" ""
2248 fi
2249fi
2250
2251# Darwin-specific
2252if [ "$OS" = "darwin" ]; then
2253 check_darwinversion
2254# check_i386elfgcc
2255fi
2256
2257# success!
2258echo
2259echo "Successfully generated '$CNF' and '$ENV'."
2260echo "Source '$ENV' once before you start to build VBox:"
2261echo ""
2262echo " source $ENV"
2263echo " kmk"
2264echo ""
2265if [ "$OS" = "linux" ]; then
2266 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2267 vbox_out_path=$OUT_PATH
2268 else
2269 vbox_out_path=./out
2270 fi
2271 echo "To compile the kernel modules, do:"
2272 echo ""
2273 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2274 echo " make"
2275 echo ""
2276fi
2277if [ $WITH_HARDENING -gt 0 ]; then
2278 echo ""
2279 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2280 echo " Hardening is enabled which means that the VBox binaries will not run from"
2281 echo " the binary directory. The binaries have to be installed suid root and some"
2282 echo " more prerequisites have to be fulfilled which is normally done by installing"
2283 echo " the final package. For development, the hardening feature can be disabled"
2284 echo " by specifying the --disable-hardening parameter. Please never disable that"
2285 echo " feature for the final distribution!"
2286 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2287 echo ""
2288else
2289 echo ""
2290 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2291 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2292 echo " disabled hardening!"
2293 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2294 echo ""
2295fi
2296echo "Enjoy!"
2297cleanup
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