VirtualBox

source: vbox/trunk/configure@ 21959

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

configure: don't force to build libcurl for OSE

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