VirtualBox

source: vbox/trunk/configure@ 28938

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

configure: really disable OpenGL with --disable-opengl

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

© 2023 Oracle
ContactPrivacy policyTerms of Use