VirtualBox

source: vbox/trunk/configure@ 35740

Last change on this file since 35740 was 34466, checked in by vboxsync, 14 years ago

Made RTManifest a build program, this drags in IPRT and libcrypto into the build program run.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use