VirtualBox

source: vbox/trunk/configure@ 30998

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

configure: allow to disable Java bindings

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

© 2023 Oracle
ContactPrivacy policyTerms of Use