VirtualBox

source: vbox/trunk/configure@ 26333

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

enable pulse for rhel5

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