VirtualBox

source: vbox/trunk/configure@ 21217

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

configure: allow to disable python which is enabled by default for all hosts

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

© 2023 Oracle
ContactPrivacy policyTerms of Use