VirtualBox

source: vbox/trunk/configure@ 27048

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

configure: adpated OSE check

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