VirtualBox

source: vbox/trunk/configure@ 40476

Last change on this file since 40476 was 40476, checked in by vboxsync, 12 years ago

fix webservices for newer versions of GSOAP

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

© 2023 Oracle
ContactPrivacy policyTerms of Use