VirtualBox

source: vbox/trunk/configure@ 25002

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

configure: fix OpenSSL check

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