VirtualBox

source: vbox/trunk/configure@ 90778

Last change on this file since 90778 was 90537, checked in by vboxsync, 3 years ago

libs/xpcom: Added support for running with Python 3.10 (untested).

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 78.7 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#
[90537]6# Copyright (C) 2006-2021 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"
[60754]22# Solaris (order of paths important for tr, grep, sed to work)
23PATH="/usr/xpg4/bin:$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
[44526]46OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr '[:upper:]' '[:lower:]'`
[20209]47case "$OS" in
48 linux)
49 ;;
50 darwin)
51 ;;
52 freebsd)
53 ;;
[62416]54 netbsd)
55 ;;
[20209]56 sunos)
57 OS='solaris'
58 ;;
[43363]59 haiku)
60 ;;
[20209]61 *)
62 echo "Cannot determine OS!"
63 exit 1
64 ;;
65esac
[14711]66
[1]67#
[1025]68# Defaults
[1]69#
70OSE=1
[5041]71ODIR="`pwd`/"
[16257]72ODIR_OVERRIDE=0
[90118]73OUT_BASE_PATH=""
74OUT_BASE_PATH_OVERRIDE=0
[5041]75SETUP_WINE=
[55347]76ONLY_ADDITIONS=0
[3675]77TARGET_MACHINE=""
78TARGET_CPU=""
[1025]79WITH_XPCOM=1
[11735]80WITH_PYTHON=1
[30998]81WITH_JAVA=1
[26695]82WITH_VMMRAW=1
[1025]83WITH_LIBIDL=1
[60537]84WITH_QT5=1
[5239]85WITH_SDL=1
[1038]86WITH_SDL_TTF=1
[5239]87WITH_X11=1
[8018]88WITH_ALSA=1
[6101]89WITH_PULSE=1
[14989]90WITH_DBUS=1
[43735]91WITH_DEVMAPPER=1
[6157]92WITH_KMODS=1
[17912]93WITH_OPENGL=1
[11884]94WITH_HARDENING=1
[37199]95WITH_UDPTUNNEL=1
[28564]96WITH_VDE=0
[36697]97WITH_VNC=0
[40217]98WITH_EXTPACK=1
[31852]99WITH_DOCS=1
[45822]100WITH_LIBVPX=1
[73369]101WITH_LIBOPUS=1
[20209]102BUILD_LIBXML2=
103BUILD_LIBCURL=
[22259]104BUILD_LIBSSL=
[45772]105BUILD_LIBVPX=
[26776]106PASSIVE_MESA=0
[1]107CC="gcc"
[3675]108CC32=""
109CC64=""
[1]110CXX="g++"
[3675]111CXX32=""
112CXX64=""
[1]113YASM="yasm"
114IASL="iasl"
115XSLTPROC="xsltproc"
[23547]116INCCRYPTO=""
[37263]117LIBCRYPTO="-lssl -lcrypto"
[1]118LIBPTHREAD="-lpthread"
[15247]119LIBCAP="-lcap"
[16139]120GSOAP=""
[16994]121GSOAP_IMPORT=""
[20209]122INCX11="/usr/local/include"
[4913]123LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
[1]124LIBXCURSOR="-lXcursor"
[17912]125LIBXMU="-lXmu"
[27449]126LIBXINERAMA="-lXinerama"
[27604]127LIBXRANDR="-lXrandr"
[31639]128MAKESELF="makeself"
[17912]129MESA="-lGL"
[1]130INCZ=""
131LIBZ="-lz"
[85391]132INCLZF="/usr/include/liblzf"
133LIBLZF="-llzf"
[36697]134INCVNCSERVER=""
135LIBVNCSERVER="-lvncserver"
[43715]136INCDEVMAPPER=""
137LIBDEVMAPPER="-ldevmapper"
[23545]138CXX_FLAGS=""
[20209]139if [ "$OS" = "freebsd" ]; then
140 INCCURL="-I/usr/local/include"
141 LIBCURL="-L/usr/local/lib -lcurl"
[25819]142 INCPULSE="-I/usr/local/include"
143 LIBPULSE="-L/usr/local/lib"
[32017]144 INCPNG="-I/usr/local/include"
145 LIBPNG="-L/usr/local/lib -lpng"
[20209]146else
147 INCCURL=""
148 LIBCURL="-lcurl"
[32017]149 INCPNG=""
150 LIBPNG="-lpng"
[20209]151fi
[45819]152INCVPX=""
153LIBVPX="-lvpx"
[14711]154PKGCONFIG="`which_wrapper pkg-config`"
[11735]155PYTHONDIR="/usr /usr/local"
[59681]156QT5DIR="/usr/lib/qt5 /usr/share/qt5 /usr/lib64/qt5 /usr /usr/local"
157QT5DIR_PKGCONFIG=1
[66821]158QT5MAJ=5
[88425]159QT5MIN=9
[4724]160KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
161DEVDIR="`cd \`dirname $0\`; pwd`/tools"
[3163]162if [ -d "/lib/modules/`uname -r`/build" ]; then
[57932]163 LINUX="/lib/modules/`uname -r`/build"
[57866]164elif [ "`echo /lib/modules/*`" != "/lib/modules/*" ]; then
[57795]165 # Get the most recent kernel headers if none match the current kernel.
166 for i in /lib/modules/*; do
[57932]167 if [ -r "$i/build" ]; then
168 LINUX="$i/build"
169 fi
[57795]170 done
[57932]171fi
172if [ -z "$LINUX" ]; then
[1]173 LINUX="/usr/src/linux"
174fi
175KCHMVIEWER="kchmviewer"
176LOG="configure.log"
177CNF="AutoConfig.kmk"
178ENV="env.sh"
179BUILD_TYPE="release"
[203]180# the restricting tool is ar (mri mode).
181INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
[1]182
[3163]183if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
[65]184 echo "Error: VBox base path contains invalid characters!"
[63]185 exit 1
186fi
187
[68031]188# Posix /bin/sh isn't supporting echo -n. Use printf instead.
189ECHO_N="printf"
[8068]190
191
[3163]192cleanup()
[1]193{
[18044]194 rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
[87614]195 [ "$OS" = "darwin" ] && rm -rf $ODIR.tmp_out.dSYM
[87615]196 true
[1]197}
198
[3163]199fail()
[1]200{
201 if [ -z "$nofatal" -o "x$1" != "x" ]; then
202 cleanup
203 rm -f $ENV
[33515]204 echo "Check $LOG for details"
[1]205 exit 1
206 fi
207}
208
[8461]209log()
210{
211 echo "$1"
212 echo "$1" >> $LOG
213}
214
[3163]215log_success()
[1]216{
[8068]217 if [ -n "$1" ]; then $ECHO_N "$1, "; fi
[1]218 echo "OK."
[3328]219 echo "$1" >> $LOG
220 echo >> $LOG
221 echo >> $LOG
[1]222}
223
[3163]224log_failure()
[1]225{
[3328]226 echo
227 echo " ** $1!"
228 echo "** $1!" >> $LOG
229 echo >> $LOG
[1]230}
231
[3163]232cnf_append()
[1]233{
[1409]234 printf "%-30s := %s\n" "$1" "$2" >> $CNF
[1]235}
236
[3163]237strip_l()
[3032]238{
[10291]239 echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
[3032]240}
241
[3163]242strip_L()
[3032]243{
[84900]244 if [ "$OS" = "darwin" ]; then
245 echo "$1"|$KBUILD_SED 's|-F\([^ ]\+\)|\1|g; s|^-[^F][^ ]*||g; s| -[^F][^ ]*||g; s|^ ||; s| *$||g'
246 else
247 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
248 fi
[3032]249}
250
[79836]251L_to_PATH()
252{
[84900]253echo $1 >> $LOG
254 if [ "$OS" = "darwin" ]; then
255 echo "$1"|$KBUILD_SED 's|-F\([^ ]\+\)|\1|g; s|^-[^F][^ ]*||g; s| -[^F][^ ]*||g; s|^ ||; s| *$||g; s| |:|g'
256 else
257 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g; s| |:|g'
258 fi
[79836]259}
260
[3163]261strip_I()
262{
[10291]263 echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
[3163]264}
265
[4886]266prefix_I()
267{
[4889]268 echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
[4886]269}
270
[3163]271check_avail()
[1]272{
273 if [ -z "$1" ]; then
274 log_failure "$2 is empty"
275 fail $3
276 return 1
277 elif which_wrapper $1 > /dev/null; then
278 return 0
279 else
280 log_failure "$1 (variable $2) not found"
281 fail $3
282 return 1
283 fi
284}
285
[11735]286
[1]287# Prepare a test
[3163]288test_header()
[1]289{
290 echo "***** Checking $1 *****" >> $LOG
[8068]291 $ECHO_N "Checking for $1: "
[1]292}
293
[11735]294
[1]295# Compile a test
[17912]296# $1 compile flags/libs
297# $2 library name
298# $3 package name
299# $4 if this argument is 'nofatal', don't abort
[3163]300test_compile()
[1]301{
302 echo "compiling the following source file:" >> $LOG
[16202]303 cat $ODIR.tmp_src.cc >> $LOG
[1]304 echo "using the following command line:" >> $LOG
[84900]305 echo "$CXX $CXX_FLAGS -fPIC -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1" >> $LOG
[59681]306 $CXX $CXX_FLAGS -fPIC -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
[3163]307 if [ $? -ne 0 ]; then
[1]308 if [ -z "$4" ]; then
[3328]309 echo
310 echo " $2 not found at $1 or $3 headers not found"
311 echo " Check the file $LOG for detailed error information."
[1]312 fail
313 else
[3328]314 echo >> $LOG
315 echo >> $LOG
[1]316 fi
317 return 1
318 fi
319 return 0
320}
321
[11735]322
[1]323# Execute a compiled test binary
[3163]324test_execute()
[1]325{
326 echo "executing the binary" >> $LOG
[81723]327 $ODIR.tmp_out > $ODIR.test_execute.log 2>&1
[1]328 rc=$?
[16202]329 cat $ODIR.test_execute.log | tee -a $LOG
[3163]330 if [ $rc -ne 0 ]; then
[1]331 fail $1
332 return 1
333 fi
[3328]334 echo >> $LOG
335 echo >> $LOG
[1]336 return 0
337}
338
[11735]339
[10291]340# Execute a compiled test binary
341test_execute_path()
342{
[57889]343 ## LD_LIBRARY_PATH to set.
344 local_path="${1}"
345 ## Set this to non-empty to make this test non-fatal.
346 local_nofail="${2}"
[84667]347 echo "executing the binary (LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH)" >> $LOG
348 LD_LIBRARY_PATH="${local_path}:$LD_LIBRARY_PATH" $ODIR.tmp_out > $ODIR.test_execute.log 2>&1
[10291]349 rc=$?
[16202]350 cat $ODIR.test_execute.log | tee -a $LOG
[10291]351 if [ $rc -ne 0 ]; then
[57889]352 test -z "${local_nofail}" && fail
353 echo >> $LOG
354 echo >> $LOG
[10291]355 return 1
356 fi
357 echo >> $LOG
358 echo >> $LOG
359 return 0
360}
361
[11735]362
[1]363#
364# Check for OS, MACHINE, CPU
365#
[3163]366check_environment()
[1]367{
368 test_header environment
[3675]369 BUILD_CPU=`uname -m`
[5533]370 [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
[3675]371 case "$BUILD_CPU" in
[43363]372 i[3456789]86|x86|i86pc|BePC)
[3675]373 BUILD_MACHINE='x86'
[2571]374 LIB='lib'
[1]375 ;;
376 x86_64|amd64)
[3675]377 BUILD_MACHINE='amd64'
[84934]378 BUILD_CPU='blend'
[5534]379 if [ "$OS" != "solaris" ]; then
380 # on AMD64 systems, 64bit libs are usually located in /usr/lib64
381 # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
382 LIB='lib64'
383 else
[9133]384 # Solaris doesn't seem to subscribe to fhs, libs are usually in
385 # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
[5534]386 # alternative binaries can be found in 'amd64' subdirs of the 'bin'
387 # ones. So, in order to find the right stuff (esp. sdl-config) we'll
388 # have to make sure the */bin/amd64 dirs are searched before the */bin
389 # ones. (The sed has some sideeffects, but they shouldn't harm us...)
390 echo "64-bit Solaris detected, hacking the PATH" >> $LOG
391 echo "old PATH: $PATH" >> $LOG
392 PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
393 -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
394 export PATH
395 echo "new PATH: $PATH" >> $LOG
396 LIB='lib/64'
397 fi
[1]398 ;;
[71337]399 sparc64|sparcv9)
400 BUILD_MACHINE='sparc64'
401 BUILD_CPU='blend'
402 ;;
403 sparc32|sparc|sparcv8|sparcv7|sparcv8e)
404 BUILD_MACHINE='sparc32'
405 BUILD_CPU='blend'
406 ;;
[1]407 *)
408 log_failure "Cannot determine system"
409 exit 1
410 ;;
411 esac
[3675]412 [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
413 [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
414 DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
415 log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
[2374]416
[84934]417 echo "KBUILD_HOST=\"$OS\"" >> $ENV
418 echo "KBUILD_HOST_ARCH=\"$BUILD_MACHINE\"" >> $ENV
419 echo "KBUILD_TARGET=\"$OS\"" >> $ENV
420 echo "KBUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
421 echo "KBUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
422 echo "KBUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
423 echo 'export KBUILD_HOST KBUILD_HOST_ARCH KBUILD_TARGET KBUILD_TARGET_ARCH KBUILD_TARGET_CPU KBUILD_TYPE' >> $ENV
424
425 # obsolete legacy stuff:
426 echo '' >> $ENV
427 echo "# Legacy - do not use:" >> $ENV
428 echo 'BUILD_PLATFORM="$KBUILD_HOST"' >> $ENV
429 echo 'BUILD_PLATFORM_ARCH="$KBUILD_HOST_ARCH"' >> $ENV
430 echo 'BUILD_TARGET="$KBUILD_TARGET"' >> $ENV
431 echo 'BUILD_TARGET_ARCH="$KBUILD_TARGET_ARCH"' >> $ENV
432 echo 'BUILD_TARGET_CPU="$KBUILD_TARGET_CPU"' >> $ENV
433 echo 'BUILD_TYPE="$KBUILD_TYPE"' >> $ENV
434 echo 'export BUILD_PLATFORM BUILD_PLATFORM_ARCH BUILD_TARGET BUILD_TARGET_ARCH BUILD_TARGET_CPU BUILD_TYPE' >> $ENV
435 echo '' >> $ENV
[1]436}
437
438#
439# Check for gcc with version >= 3.2.
440# We depend on a working gcc, if we fail terminate in every case.
441#
[3163]442check_gcc()
[1]443{
444 test_header gcc
445 if check_avail "$CC" CC really; then
[68274]446 cc_ver=`$CC -dumpfullversion 2>/dev/null`
[8461]447 if [ $? -ne 0 ]; then
[68274]448 cc_ver=`$CC -dumpversion 2>/dev/null`
[66931]449 fi
450 if [ $? -ne 0 ]; then
[8461]451 log_failure "cannot execute '$CC -dumpversion'"
452 fail really
453 fi
[1]454 if check_avail "$CXX" CXX really; then
[68274]455 cxx_ver=`$CXX -dumpfullversion 2>/dev/null`
[8461]456 if [ $? -ne 0 ]; then
[68274]457 cxx_ver=`$CXX -dumpversion 2>/dev/null`
[66931]458 fi
459 if [ $? -ne 0 ]; then
[8461]460 log_failure "cannot execute '$CXX -dumpversion'"
461 fail really
462 fi
[1]463 cc_maj=`echo $cc_ver|cut -d. -f1`
464 cc_min=`echo $cc_ver|cut -d. -f2`
465 if [ "x$cc_ver" != "x$cxx_ver" ]; then
466 log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
467 fail really
[20209]468 elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
[8461]469 log_success "found version $cc_ver"
[9196]470 # gcc-4.0 is allowed for Darwin only
[77135]471 elif [ $cc_maj -eq 4 -a $cc_min -eq 2 -a "$OS" = "freebsd" ]; then
472 log_success "found version $cc_ver"
473 # gcc-4.2 is allowed for FreeBSD only
[62303]474 elif [ $cc_maj -lt 4 \
475 -o \( $cc_maj -eq 4 -a $cc_min -lt 4 -a "$OS" != "darwin" \) \
[73343]476 -o \( $cc_maj -eq 4 -a $cc_min -lt 2 -a "$OS" = "darwin" \) ]; then
477 log_failure "gcc version $cc_maj.$cc_min found, expected gcc 4.x or later"
[1]478 fail really
479 else
480 log_success "found version $cc_ver"
481 fi
[3675]482 if [ "$BUILD_MACHINE" = "amd64" ]; then
483 [ -z "$CC32" ] && CC32="$CC -m32"
484 [ -z "$CXX32" ] && CXX32="$CXX -m32"
485 else
486 [ -z "$CC32" ] && CC32="$CC"
487 [ -z "$CXX32" ] && CXX32="$CXX"
488 fi
489 if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
[5366]490 [ -z "$CC64" ] && CC64="$CC -m64"
491 [ -z "$CXX64" ] && CXX64="$CXX -m64"
[3675]492 fi
[26695]493 if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
494 CC32="undefined"
495 CXX32="undefined"
496 fi
[1]497 if [ "$CC" != "gcc" ]; then
[3675]498 cnf_append "TOOL_GCC3_CC" "$CC"
499 cnf_append "TOOL_GCC3_AS" "$CC"
500 cnf_append "TOOL_GCC3_LD" "$CC"
501 cnf_append "TOOL_GXX3_CC" "$CC"
502 cnf_append "TOOL_GXX3_AS" "$CC"
[1]503 fi
504 if [ "$CXX" != "g++" ]; then
[3675]505 cnf_append "TOOL_GCC3_CXX" "$CXX"
506 cnf_append "TOOL_GXX3_CXX" "$CXX"
507 cnf_append "TOOL_GXX3_LD" "$CXX"
[1]508 fi
[26695]509 if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
[3675]510 cnf_append "TOOL_GCC32_CC" "$CC32"
511 cnf_append "TOOL_GCC32_AS" "$CC32"
512 cnf_append "TOOL_GCC32_LD" "$CC32"
513 cnf_append "TOOL_GXX32_CC" "$CC32"
514 cnf_append "TOOL_GXX32_AS" "$CC32"
515 fi
[26695]516 if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
[3675]517 cnf_append "TOOL_GCC32_CXX" "$CXX32"
518 cnf_append "TOOL_GXX32_CXX" "$CXX32"
519 cnf_append "TOOL_GXX32_LD" "$CXX32"
520 fi
[5533]521 # this isn't not necessary, there is not such tool.
[3675]522 if [ -n "$CC64" ]; then
523 cnf_append "TOOL_GCC64_CC" "$CC64"
524 cnf_append "TOOL_GCC64_AS" "$CC64"
525 cnf_append "TOOL_GCC64_LD" "$CC64"
526 cnf_append "TOOL_GXX64_CC" "$CC64"
527 cnf_append "TOOL_GXX64_AS" "$CC64"
528 fi
529 if [ -n "$CXX64" ]; then
530 cnf_append "TOOL_GCC64_CXX" "$CXX64"
531 cnf_append "TOOL_GXX64_CXX" "$CXX64"
532 cnf_append "TOOL_GXX64_LD" "$CXX64"
533 fi
[67153]534 if [ "$CC" != "gcc" ]; then
535 if [ -n "$CC64" ]; then
536 cnf_append "TOOL_Bs3Gcc64Elf64_CC" "$CC64"
537 else
538 cnf_append "TOOL_Bs3Gcc64Elf64_CC" "$CC"
539 fi
540 if [ -n "$CXX64" ]; then
541 cnf_append "TOOL_Bs3Gcc64Elf64_CXX" "$CXX64"
542 else
543 cnf_append "TOOL_Bs3Gcc64Elf64_CXX" "$CXX"
544 fi
545 fi
[5533]546 # Solaris sports a 32-bit gcc/g++.
547 if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
548 [ "$CC" = "gcc" ] && CC="gcc -m64"
549 [ "$CXX" = "g++" ] && CXX="g++ -m64"
[9133]550 fi
[1]551 fi
552 fi
553}
554
[11735]555
[1]556#
[41518]557# Check for the OpenWatcom compiler, needed for compiling the BIOS
558#
559# If the system has Open Watcom installed, WATCOM will be set in the
560# environment. If the user has her/his own Open Watcom install it will be
561# pointed to by on the command line, which will set the WATCOM variable.
562# The only exception is detecting OpenWatcom in tools/common/openwatcom.
563#
564check_open_watcom()
565{
566 test_header "Open Watcom"
567
568 if [ -z "$WATCOM" ]; then
[90355]569 WATCOM=`/bin/ls -rd1 $DEVDIR/common/openwatcom/* 2> /dev/null | head -1`
[41518]570 if [ -z "$WATCOM" ]; then
[67684]571 if [ $OSE -eq 0 -a $OS = "linux" ]; then
572 log_failure "Open Watcom was not found"
573 exit 1
574 fi
575 log_failure "Open Watcom was not found, using alternative BIOS sources"
[41518]576 cnf_append "VBOX_WITH_OPEN_WATCOM" ""
577 return 0;
578 fi
579 fi
580
581 case "$OS" in
582 "darwin") wc_bin="binosx";; # ??
583 "dos") wc_bin="binw";;
584 "freebsd") wc_bin="binfbsd";; # ??
585 "linux") wc_bin="binl";;
[62416]586 "netbsd") wc_bin="binnbsd";; # ??
[41518]587 "solaris") wc_bin="binsol";; # ??
588 "os2") wc_bin="binp";;
589 "win") wc_bin="binnt";;
590 *) wc_bin="binl";;
591 esac
592
593 # Check that the tools we use are there.
594 for prog in wasm wcc wlink;
595 do
596 if [ ! -f "$WATCOM/$wc_bin/$prog" ]; then
597 log_failure "$WATCOM/$wc_bin/$prog does not exist or is not a regular file."
598 fail
599 fi
600 done
601
602 # Use WASM to get the version.
603 wasm_ver=`$WATCOM/$wc_bin/wasm -? 2>&1 | sed -e '1!d' -e 's/Open Watcom Assembler Version *//'`
604 if [ -z "$wasm_ver" ]; then
605 log_failure "$WATCOM/$wc_bin/wasm -? did not produce the expected response"
606 fail
607 fi
608 log_success "found version $wasm_ver"
609 cnf_append "PATH_TOOL_OPENWATCOM" "$WATCOM"
610 cnf_append "VBOX_WITH_OPEN_WATCOM" "1"
611
612 unset wasm_ver
613 unset wc_wasm
614 unset wc_bin
615}
616
617
618#
[1]619# Check for yasm, needed to compile assembler files
620#
[3163]621check_yasm()
[1]622{
623 test_header yasm
624 if check_avail "$YASM" YASM; then
625 yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
[3163]626 if [ $? -ne 0 ]; then
[33515]627 log_failure "yasm not found"
[1]628 fail
629 else
630 yasm_maj=`echo $yasm_ver|cut -d. -f1`
631 yasm_min=`echo $yasm_ver|cut -d. -f2`
632 yasm_rev=`echo $yasm_ver|cut -d. -f3`
[4726]633 yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
[87584]634 if [ $yasm_ver_mul -lt 10300 ]; then
635 log_failure "found version $yasm_ver, expected at least 1.3.0"
[1]636 fail
637 else
[87614]638 [ "$YASM" != "yasm" ] && cnf_append "PATH_TOOL_YASM" "`dirname $YASM`"
[1]639 log_success "found version $yasm_ver"
640 fi
641 fi
642 fi
643}
644
[11735]645
[1]646#
647# Check for the iasl ACPI compiler, needed to compile vbox.dsl
648#
[3163]649check_iasl()
[1]650{
651 test_header iasl
652 if check_avail "$IASL" IASL; then
[48114]653 iasl_ver=`$IASL|grep "ASL.*version"|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
[3163]654 if [ $? -ne 0 ]; then
[33515]655 log_failure "iasl not found"
[1]656 fail
657 else
658 log_success "found version $iasl_ver"
[802]659 cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
[1]660 fi
661 fi
662}
663
[11735]664
[1]665#
666# Check for xsltproc, needed by Main
667#
[3163]668check_xsltproc()
[1]669{
[43363]670 if [ -n "$BUILD_LIBXSLT" ]; then
671 return 0;
672 fi
[1]673 test_header xslt
674 if check_avail "$XSLTPROC" XSLTPROC; then
675 xsltproc_ver=`$XSLTPROC --version`
[3163]676 if [ $? -ne 0 ]; then
[33515]677 log_failure "xsltproc not found"
[1]678 fail
679 else
680 log_success "found"
[802]681 cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
[1]682 fi
683 fi
684}
685
[11735]686
[1]687#
[74653]688# Check for libxml2, needed by the Runtime.
[7393]689# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
[1]690#
[6060]691check_libxml2()
692{
[6098]693 if [ -z "$BUILD_LIBXML2" ]; then
694 test_header libxml2
695 if which_wrapper pkg-config > /dev/null; then
696 libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
697 if [ $? -ne 0 ]; then
[33515]698 log_failure "libxml2 not found"
[6098]699 fail
700 else
701 FLGXML2=`pkg-config libxml-2.0 --cflags`
702 INCXML2=`strip_I "$FLGXML2"`
703 LIBXML2=`pkg-config libxml-2.0 --libs`
[16202]704 cat > $ODIR.tmp_src.cc << EOF
[6097]705#include <cstdio>
706#include <libxml/xmlversion.h>
707extern "C" int main(void)
708{
709 printf("found version %s", LIBXML_DOTTED_VERSION);
[6500]710#if LIBXML_VERSION >= 20626
[6097]711 printf(", OK.\n");
712 return 0;
713#else
[6500]714 printf(", expected version 2.6.26 or higher\n");
[6097]715 return 1;
716#endif
717}
718EOF
[6098]719 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
720 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
721 if test_execute; then
[74653]722 cnf_append "SDK_VBOX_LIBXML2_DEFS" "_REENTRANT" ## @todo get defines from --cflags
[6098]723 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
724 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
725 fi
[6097]726 fi
727 fi
[6098]728 elif which_wrapper xml2-config; then
729 libxml2_ver=`xml2-config --version`
730 if [ $? -ne 0 ]; then
[33515]731 log_failure "xml2-config not found"
[6098]732 fail
733 else
734 log_success "found version $libxml2_ver"
735 FLGXML2=`xml2-config --cflags`
736 INCXML2=`strip_I "$FLGXML2"`
737 LIBXML2=`xml2-config --libs`
[16202]738 cat > $ODIR.tmp_src.cc << EOF
[6097]739#include <cstdio>
740#include <libxml/xmlversion.h>
741extern "C" int main(void)
742{
743 printf("found version %s", LIBXML_DOTTED_VERSION);
[6500]744#if LIBXML_VERSION >= 20626
[6097]745 printf(", OK.\n");
746 return 0;
747#else
[6500]748 printf(", expected version 2.6.26 or higher\n");
[6097]749 return 1;
750#endif
751}
752EOF
[6098]753 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
754 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
755 if test_execute; then
[74653]756 cnf_append "SDK_VBOX_LIBXML2_DEFS" "_REENTRANT" ## @todo get defines from --cflags
[6098]757 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
758 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
759 fi
[6097]760 fi
761 fi
[6098]762 else
763 log_failure "neither pkg-config nor xml2-config found"
764 fail
[6060]765 fi
766 fi
767}
768
[11735]769
[6060]770#
[1]771# Check for libIDL, needed by xpcom
772#
773check_libidl()
774{
775 test_header libIDL
[24]776
[802]777 if which_wrapper libIDL-config-2 > /dev/null; then
[1]778 libidl_ver=`libIDL-config-2 --version`
[3163]779 if [ $? -ne 0 ]; then
[33515]780 log_failure "libIDL-config-2 not working"
[1]781 fail
782 else
783 log_success "found version $libidl_ver"
[921]784 cnf_append "VBOX_LIBIDL_CONFIG" \
[2571]785 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
[1]786 fi
787 elif check_avail "libIDL-config" libIDL-config; then
788 libidl_ver=`libIDL-config --version`
[3163]789 if [ $? -ne 0 ]; then
[33515]790 log_failure "libIDL-config not working"
[1]791 fail
792 else
793 log_success "found version $libidl_ver"
[2926]794 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
[1]795 fi
796 fi
797}
798
[11735]799
[1]800#
[43715]801# Check for libdevmapper, needed by the VBoxVolInfo
802#
803check_libdevmapper()
804{
805 test_header libdevmapper
806 cat > $ODIR.tmp_src.cc << EOF
807#include <cstdio>
808extern "C" {
809#define private
810#include <libdevmapper.h>
811int main()
812{
813 char version[80];
814
815 if (!dm_get_library_version(version, sizeof(version)))
816 {
817 printf("dm_get_library_version() failed.\n");
818 return 1;
819 }
820
821 const char* v=version;
822 unsigned int major = 0, minor = 0, micro = 0;
823
824 for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
825 if (*v == '.') v++;
826 for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
827 if (*v == '.') v++;
828 for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
829
830 printf("found version %s", version);
831 if (major*10000 + minor*100 + micro >= 10200)
832 {
833 printf(", OK.\n");
834 return 0;
835 }
836 else
837 {
838 printf(", expected version 1.02 or higher\n");
839 return 1;
840 }
841}
842}
843EOF
844 if test_compile "$LIBDEVMAPPER $INCDEVMAPPER" libdevmapper libdevmapper; then
845 if test_execute; then
846 cnf_append "VBOX_WITH_DEVMAPPER" "1"
847 fi
848 fi
849}
850
851
852#
[20030]853# Check for openssl, needed for RDP and S3
[1]854#
[3163]855check_ssl()
[1]856{
[22259]857 if [ -z "$BUILD_LIBSSL" ]; then
858 test_header ssl
859 cat > $ODIR.tmp_src.cc << EOF
[1]860#include <cstdio>
861#include <openssl/opensslv.h>
[37260]862#include <openssl/ssl.h>
[1]863extern "C" int main(void)
864{
865 printf("found version %s", OPENSSL_VERSION_TEXT);
[37260]866 SSL_library_init();
[74325]867#if OPENSSL_VERSION_NUMBER >= 0x10001000
[1]868 printf(", OK.\n");
869 return 0;
870#else
[74325]871 printf(", expected version 1.0.1 or higher\n");
[1]872 return 1;
873#endif
874}
[3163]875EOF
[23547]876 if test_compile "$INCCRYPTO $LIBCRYPTO" libcrypto openssl; then
[22259]877 if test_execute nofatal; then
[23547]878 cnf_append "SDK_VBOX_OPENSSL_INCS" "`strip_I "$INCCRYPTO"`"
[22259]879 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
[34466]880 cnf_append "SDK_VBOX_BLD_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
[22259]881 fi
[1]882 fi
883 fi
884}
885
[11735]886
[1]887#
888# Check for pthread, needed by VBoxSVC, frontends, ...
889#
[3163]890check_pthread()
[1]891{
892 test_header pthread
[16202]893 cat > $ODIR.tmp_src.cc << EOF
[1]894#include <cstdio>
895#include <pthread.h>
896extern "C" int main(void)
897{
898 pthread_mutex_t mutex;
899 if (pthread_mutex_init(&mutex, NULL)) {
900 printf("pthread_mutex_init() failed\n");
901 return 1;
902 }
903 if (pthread_mutex_lock(&mutex)) {
904 printf("pthread_mutex_lock() failed\n");
905 return 1;
906 }
907 if (pthread_mutex_unlock(&mutex)) {
908 printf("pthread_mutex_unlock() failed\n");
909 return 1;
910 }
911 printf("found, OK.\n");
912}
[3163]913EOF
[1]914 if test_compile $LIBPTHREAD pthread pthread; then
915 if test_execute; then
[3163]916 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
[1]917 fi
918 fi
919}
920
[11735]921
[1]922#
923# Check for zlib, needed by VBoxSVC, Runtime, ...
924#
[3163]925check_z()
[1]926{
927 test_header zlib
[16202]928 cat > $ODIR.tmp_src.cc << EOF
[1]929#include <cstdio>
930#include <zlib.h>
931extern "C" int main(void)
932{
933 printf("found version %s", ZLIB_VERSION);
934#if ZLIB_VERNUM >= 0x1210
935 printf(", OK.\n");
936 return 0;
937#else
938 printf(", expected version 1.2.1 or higher\n");
939 return 1;
940#endif
941}
[3163]942EOF
[4886]943 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
[4719]944 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
[1]945 if test_execute; then
[48312]946 echo "if1of (\$(KBUILD_TARGET),darwin freebsd haiku linux)" >> $CNF
[21887]947 cnf_append " SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
948 cnf_append " SDK_VBOX_ZLIB_INCS" "$INCZ"
949 echo "endif" >> $CNF
[1]950 fi
951 fi
952}
953
[11735]954
[1]955#
[85391]956# Check for liblzf, needed by VBoxSVC, Runtime, ...
957#
958check_lzf()
959{
960 test_header liblzf
961 cat > $ODIR.tmp_src.cc << EOF
962#include <cstdio>
963#include <lzf.h>
964extern "C" int main(void)
965{
966 printf("found LZF API version %u.%u", LZF_VERSION >> 8, LZF_VERSION & 0xff);
967#if LZF_VERSION >= 0x0105
968 printf(", OK.\n");
969 return 0;
970#else
971 printf(", expected version 1.5 or higher\n");
972 return 1;
973#endif
974}
975EOF
976 [ -n "$INCLZF" ] && I_INCLZF=`prefix_I "$INCLZF"`
977 if test_compile "$LIBLZF $I_INCLZF" liblzf liblzf nofatal; then
978 if test_execute; then
979 echo "if1of (\$(KBUILD_TARGET),darwin freebsd haiku linux)" >> $CNF
980 cnf_append " SDK_VBOX_LZF_LIBS" "`strip_l "$LIBLZF"`"
981 cnf_append " SDK_VBOX_LZF_INCS" "$INCLZF"
982 echo "endif" >> $CNF
983 fi
984 else
985 echo "not found -- builing liblzf from in-tree code."
986 fi
987}
988
989
990#
[1]991# Check for libpng, needed by kchmviewer
992#
[3163]993check_png()
[1]994{
995 test_header libpng
[16202]996 cat > $ODIR.tmp_src.cc << EOF
[1]997#include <cstdio>
998#include <png.h>
999extern "C" int main(void)
1000{
1001 printf("found version %s", PNG_LIBPNG_VER_STRING);
1002#if PNG_LIBPNG_VER >= 10205
1003 printf(", OK.\n");
1004 return 0;
1005#else
1006 printf(", expected version 1.2.5 or higher\n");
1007 return 1;
1008#endif
1009}
[3163]1010EOF
[4886]1011 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
[4719]1012 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
[3163]1013 if test_execute; then
1014 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
[1]1015 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
1016 fi
1017 fi
1018}
1019
[19356]1020#
[36697]1021# Check for libvncserver, needed for VNC in OSE
1022#
1023check_vncserver()
1024{
1025 test_header libvncserver
1026 cat > $ODIR.tmp_src.cc <<EOF
1027#include <cstdio>
1028#include <rfb/rfbconfig.h>
1029
1030extern "C" int main()
1031{
1032 const char* v=LIBVNCSERVER_VERSION;
1033 unsigned int major = 0, minor = 0, micro = 0;
1034
1035 for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
1036 if (*v == '.') v++;
1037 for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
1038 if (*v == '.') v++;
1039 for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
1040
1041 printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
[40390]1042 if (major*10000 + minor*100 + micro >= 900)
[36697]1043 {
1044 printf(", OK.\n");
1045 return 0;
1046 }
1047 else
1048 {
[40390]1049 printf(", expected version 0.9 or higher\n");
[36697]1050 return 1;
1051 }
1052}
1053EOF
1054 if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
1055 if test_execute; then
[40383]1056 cnf_append "VBOX_WITH_EXTPACK_VNC" "1"
[36697]1057 fi
1058 fi
1059}
1060
1061#
[19356]1062# Check for libcurl, needed by S3
1063#
1064check_curl()
1065{
[19849]1066 if [ -z "$BUILD_LIBCURL" ]; then
1067 test_header libcurl
1068 cat > $ODIR.tmp_src.cc << EOF
[19356]1069#include <cstdio>
1070#include <curl/curl.h>
1071extern "C" int main(void)
1072{
1073 printf("found version %s", LIBCURL_VERSION);
[43741]1074#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71901
[19356]1075 printf(", OK.\n");
1076 return 0;
1077#else
[43741]1078 printf(", expected version 7.19.1 or higher\n");
[19356]1079 return 1;
1080#endif
1081}
1082EOF
[19849]1083 [ -n "$INCCURL" ] && I_INCCURL=`prefix_I "$INCCURL"`
1084 if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl; then
1085 if test_execute; then
1086 cnf_append "SDK_VBOX_LIBCURL_LIBS" "`strip_l "$LIBCURL"`"
1087 cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
1088 fi
[19356]1089 fi
1090 fi
1091}
[11735]1092
[19356]1093
[1]1094#
1095# Check for pam, needed by VRDPAuth
1096# Version 79 was introduced in 9/2005, do we support older versions?
[757]1097# Debian/sarge uses 76
[832]1098# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
[1]1099#
[3163]1100check_pam()
[1]1101{
1102 test_header pam
[16202]1103 cat > $ODIR.tmp_src.cc << EOF
[1]1104#include <cstdio>
1105#include <security/pam_appl.h>
1106extern "C" int main(void)
1107{
1108 printf("found version %d", __LIBPAM_VERSION);
[757]1109 if (__LIBPAM_VERSION >= 76)
[1]1110 {
1111 printf(", OK.\n");
1112 return 0;
1113 }
1114 else
1115 {
[757]1116 printf(", expected version 76 or higher\n");
[1]1117 return 1;
1118 }
1119}
[3163]1120EOF
[832]1121 if test_compile "-lpam" pam pam nofatal; then
1122 if test_execute nofatal; then
1123 return 0;
1124 fi
1125 fi
[33515]1126 echo "pam0.x not found"
[832]1127 test_header linux_pam
[16202]1128 cat > $ODIR.tmp_src.cc << EOF
[832]1129#include <cstdio>
1130#include <security/pam_appl.h>
1131extern "C" int main(void)
1132{
1133 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
1134 if (__LINUX_PAM__ >= 1)
1135 {
1136 printf(", OK.\n");
1137 return 0;
1138 }
1139 else
1140 {
1141 printf(", expected version 1.0 or higher\n");
1142 return 1;
1143 }
1144}
[3163]1145EOF
[1]1146 if test_compile "-lpam" pam pam; then
1147 test_execute
1148 fi
1149}
1150
[3163]1151
[1]1152#
1153# Check for the SDL library, needed by VBoxSDL and VirtualBox
1154# We depend at least on version 1.2.7
1155#
[3163]1156check_sdl()
[1]1157{
1158 test_header SDL
[8037]1159 if [ "$OS" = "darwin" ]; then
[8041]1160 if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
[15739]1161 PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
[8041]1162 elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
[8037]1163 PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
1164 fi
1165 if [ -n "$PATH_SDK_LIBSDL" ]; then
1166 foundsdl=1
1167 INCSDL="$PATH_SDK_LIBSDL/Headers"
1168 FLDSDL="-framework SDL"
[8041]1169 else
1170 log_failure "SDL framework not found"
1171 fail
[8037]1172 fi
1173 else
1174 if which_wrapper sdl-config > /dev/null; then
1175 FLGSDL=`sdl-config --cflags`
1176 INCSDL=`strip_I "$FLGSDL"`
1177 LIBSDL=`sdl-config --libs`
1178 LIBSDLMAIN="-lSDLmain"
1179 FLDSDL=
1180 foundsdl=1
1181 fi
1182 fi
1183 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1184 if [ -n "$foundsdl" ]; then
[16202]1185 cat > $ODIR.tmp_src.cc << EOF
[1]1186#include <cstdio>
[7699]1187#include <SDL.h>
1188#include <SDL_main.h>
[8044]1189#undef main
[7704]1190extern "C" int main(int argc, char** argv)
[1]1191{
1192 printf("found version %d.%d.%d",
1193 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1194#if SDL_VERSION_ATLEAST(1,2,7)
1195 printf(", OK.\n");
1196 return 0;
1197#else
1198 printf(", expected version 1.2.7 or higher\n");
1199 return 1;
1200#endif
1201}
[3163]1202EOF
[4886]1203 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
[8037]1204 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
[3163]1205 if test_execute; then
1206 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1207 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1208 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
[8037]1209 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1210 [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
[3163]1211 fi
[1]1212 fi
[3163]1213 else
[57789]1214 log_failure "SDL not found (can be disabled using --disable-sdl)"
[5435]1215 fail
[1]1216 fi
1217}
1218
[11735]1219
[1]1220#
1221# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1222#
[3163]1223check_sdl_ttf()
[1]1224{
1225 test_header SDL_ttf
[16202]1226 cat > $ODIR.tmp_src.cc << EOF
[1]1227#include <cstdio>
[7699]1228#include <SDL_ttf.h>
[757]1229#ifndef SDL_TTF_MAJOR_VERSION
1230#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1231#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1232#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1233#endif
[1]1234extern "C" int main(void)
1235{
1236 printf("found version %d.%d.%d",
1237 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1238#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1239 printf(", OK.\n");
1240 return 0;
1241#else
1242 printf(", expected version 2.0.6 or higher\n");
1243 return 1;
1244#endif
1245}
[3163]1246EOF
[8344]1247 if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
[58367]1248 test_execute nofatal || \
[9035]1249 cnf_append "VBOX_WITH_SECURELABEL" ""
1250 else
[23028]1251 echo "not found -- disabling VBoxSDL secure label."
[9035]1252 cnf_append "VBOX_WITH_SECURELABEL" ""
[1]1253 fi
1254}
1255
[11735]1256
[1]1257#
[791]1258# Check for libasound, needed by the ALSA audio backend
1259#
[3163]1260check_alsa()
[791]1261{
1262 test_header ALSA
[16202]1263 cat > $ODIR.tmp_src.cc << EOF
[6101]1264#include <cstdio>
[791]1265#include <alsa/asoundlib.h>
1266extern "C" int main(void)
1267{
1268 printf("found version %d.%d.%d",
1269 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
[59997]1270#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10014
[791]1271 printf(", OK.\n");
1272 return 0;
1273#else
[59997]1274 printf(", expected version 1.0.14 or higher\n");
[791]1275 return 1;
1276#endif
1277}
[3163]1278EOF
[791]1279 if test_compile "-lasound" asound asound; then
1280 test_execute
1281 fi
1282}
1283
[11735]1284
[791]1285#
[6101]1286# Check for PulseAudio
1287#
1288check_pulse()
1289{
1290 test_header "PulseAudio"
[16202]1291 cat > $ODIR.tmp_src.cc << EOF
[6101]1292#include <cstdio>
1293#include <pulse/version.h>
1294extern "C" int main(void)
1295{
1296 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1297#if PA_API_VERSION >= 9
1298 printf(", OK.\n");
1299 return 0;
1300#else
1301 printf(", expected version 0.9.0 (API version 9) or higher\n");
1302 return 1;
1303#endif
1304}
1305EOF
[78022]1306 if test_compile "$INCPULSE $LIBPULSE -lpulse" pulse pulse nofatal; then
1307 if test_execute nofatal; then
1308 cnf_append "VBOX_WITH_AUDIO_PULSE" "1"
1309 else
1310 cnf_append "VBOX_WITH_AUDIO_PULSE" ""
[78023]1311 fi
[78022]1312 else
1313 cnf_append "VBOX_WITH_AUDIO_PULSE" ""
[6101]1314 fi
1315}
1316
[11735]1317
[6101]1318#
[17912]1319# Check for the X libraries (Xext, X11)
1320#
1321check_x()
1322{
1323 test_header "X libraries"
1324 cat > $ODIR.tmp_src.cc << EOF
1325#include <cstdio>
1326#include <X11/Xlib.h>
1327extern "C" int main(void)
1328{
1329 Display *dpy;
1330 int scrn_num;
1331 Screen *scrn;
1332 Window win;
1333
1334 dpy = XOpenDisplay(NULL);
1335 scrn_num = DefaultScreen(dpy);
1336 scrn = ScreenOfDisplay(dpy, scrn_num);
1337 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1338 0, 16, InputOutput, CopyFromParent, 0, NULL);
1339 XDestroyWindow(dpy, win);
[27449]1340 XCloseDisplay(dpy);
[17912]1341}
1342EOF
1343 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1344 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1345 log_success "found"
1346 fi
1347}
1348
1349
1350#
[44580]1351# Check for the Xcursor library, needed by VBoxSDL.
[1]1352#
[3163]1353check_xcursor()
[1]1354{
1355 test_header Xcursor
[16202]1356 cat > $ODIR.tmp_src.cc << EOF
[1]1357#include <cstdio>
1358#include <X11/Xlib.h>
1359#include <X11/Xcursor/Xcursor.h>
1360extern "C" int main(void)
1361{
1362 XcursorImage *cursor = XcursorImageCreate (10, 10);
1363 XcursorImageDestroy(cursor);
1364 return 0;
1365}
[3163]1366EOF
[4913]1367 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1368 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
[1]1369 log_success "found"
[5359]1370 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
[1]1371 fi
1372}
1373
[27449]1374
[22752]1375#
[27449]1376# Check for the Xinerama library, needed by the Qt GUI
1377#
1378check_xinerama()
1379{
1380 test_header Xinerama
1381 cat > $ODIR.tmp_src.cc << EOF
1382#include <X11/Xlib.h>
1383#include <X11/extensions/Xinerama.h>
1384extern "C" int main(void)
1385{
1386 Display *dpy;
1387 Bool flag;
1388 dpy = XOpenDisplay(NULL);
1389 if (dpy)
1390 {
1391 flag = XineramaIsActive(dpy);
1392 XCloseDisplay(dpy);
1393 }
1394}
1395EOF
1396 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1397 if test_compile "$LIBX11 $LIBXINERAMA $I_INCX11" Xinerama Xinerama; then
1398 log_success "found"
1399 fi
1400}
1401
1402
1403#
[83219]1404# Check for the XRandR library, needed by the Qt GUI
[27604]1405#
1406check_xrandr()
1407{
1408 test_header Xrandr
1409 cat > $ODIR.tmp_src.cc << EOF
1410#include <X11/Xlib.h>
1411#include <X11/extensions/Xrandr.h>
1412extern "C" int main(void)
1413{
1414 Display *dpy;
1415 Bool flag;
1416 int major, minor;
1417 dpy = XOpenDisplay(NULL);
1418 if (dpy)
1419 {
1420 flag = XRRQueryVersion(dpy, &major, &minor);
1421 XCloseDisplay(dpy);
1422 }
1423}
1424EOF
1425 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1426 if test_compile "$LIBX11 $LIBXRANDR $I_INCX11" Xrandr Xrandr; then
1427 log_success "found"
1428 fi
1429}
1430
1431
1432#
[22752]1433# Check for OpenGL
1434#
1435check_opengl()
1436{
1437 # On darwin this is a on/off decision only
1438 if [ "$OS" = "darwin" ]; then
1439 test_header "OpenGL support"
1440 echo "enabled"
1441 else
1442 check_xmu
1443 check_mesa
1444 fi
1445}
[11735]1446
[22752]1447
[1]1448#
[17912]1449# Check for the Xmu library, needed by OpenGL
[1]1450#
[17912]1451check_xmu()
[1]1452{
[17912]1453 test_header Xmu
[16202]1454 cat > $ODIR.tmp_src.cc << EOF
[1]1455#include <cstdio>
[17912]1456#include <X11/Xatom.h>
[1]1457#include <X11/Xlib.h>
[17912]1458#include <X11/Xutil.h>
1459#include <X11/Xmu/StdCmap.h>
[1]1460extern "C" int main(void)
1461{
1462 Display *dpy;
1463 int scrn_num;
1464 Screen *scrn;
1465
[17912]1466 dpy = XOpenDisplay(NULL);
[17918]1467 if (dpy)
1468 {
1469 scrn_num = DefaultScreen(dpy);
1470 scrn = ScreenOfDisplay(dpy, scrn_num);
1471 Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
1472 24, XA_RGB_DEFAULT_MAP, False, True);
1473 printf("Status = %x\n", status);
[27449]1474 XCloseDisplay(dpy);
[17918]1475 }
[17912]1476 return 0;
[1]1477}
[3163]1478EOF
[4913]1479 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
[17912]1480 if test_compile "$LIBX11 $LIBXMU $I_INCX11" Xmu Xmu; then
[1]1481 log_success "found"
[17912]1482 cnf_append "VBOX_XMU_LIBS" "`strip_l "$LIBXMU"`"
[1]1483 fi
1484}
1485
1486#
[17912]1487# Check for Mesa, needed by OpenGL
1488#
1489check_mesa()
1490{
1491 test_header "Mesa / GLU"
1492 cat > $ODIR.tmp_src.cc << EOF
1493#include <cstdio>
1494#include <X11/Xlib.h>
1495#include <GL/glx.h>
1496#include <GL/glu.h>
1497extern "C" int main(void)
1498{
1499 Display *dpy;
1500 int major, minor;
1501
1502 dpy = XOpenDisplay(NULL);
[17918]1503 if (dpy)
[17912]1504 {
[31036]1505 Bool glx_version = glXQueryVersion(dpy, &major, &minor);
1506 XCloseDisplay(dpy);
1507 if (glx_version)
[17918]1508 {
1509 printf("found version %u.%u, OK.\n", major, minor);
1510 return 0;
1511 }
[17912]1512 }
[17918]1513 printf("found (inactive), OK.\n");
[17912]1514 return 0;
1515}
1516EOF
1517 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1518 if test_compile "$LIBX11 $MESA $I_INCX11" Mesa Mesa; then
[26776]1519 [ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
[17912]1520 test_execute
1521 fi
1522}
1523
1524
1525#
[59681]1526# Check for the Qt5 library, needed by the VirtualBox frontend
1527#
1528# Currently not fatal.
1529#
1530check_qt5()
1531{
1532 foundqt5=
1533 test_header Qt5
1534 cat > $ODIR.tmp_src.cc << EOF
1535#include <QtGlobal>
1536extern "C" int main(void)
1537{
[66821]1538EOF
1539 echo "#if QT_VERSION >= $(($QT5MAJ*65536+$QT5MIN*256))" >> $ODIR.tmp_src.cc
1540 cat >> $ODIR.tmp_src.cc << EOF
[59681]1541 return 0;
1542#else
1543 return 1;
1544#endif
1545}
1546EOF
1547 if [ "$OS" = "darwin" ]; then
1548 # First check if there is the internal version of Qt. If yes nothing else
1549 # has to be done.
[90355]1550 QT_INTERNAL=`/bin/ls -rd1 $DEVDIR/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
[59681]1551 for t in $QT_INTERNAL; do
1552 if [ -f "$t/Frameworks/QtCoreVBox.framework/QtCoreVBox" ]; then
1553 cnf_append "VBOX_WITH_ORACLE_QT" "1"
1554 log_success "use internal version"
1555 return
1556 fi
1557 done
1558 # Now try the user provided directory and some of the standard directories.
1559 QT_TRIES="$QT5DIR /System/Library /Library"
1560 for t in $QT_TRIES; do
[84900]1561 if [ -f "$t/Frameworks/QtCore.framework/QtCore" -o -f "$t/clang_64/lib/QtCore.framework/QtCore" ]; then
[59681]1562 PATH_SDK_QT5="$t"
[84900]1563 foundqt5=1
[59681]1564 break
1565 fi
1566 done
1567 # Add the necessary params for building the test application
1568 if [ -n "$PATH_SDK_QT5" ]; then
[84900]1569 if [ -f "$t/clang_64/lib/QtCore.framework/QtCore" ]; then
1570 INCQT5=-I$PATH_SDK_QT5/clang_64/lib/QtCore.framework/Headers
1571 LIBQT5=-F$PATH_SDK_QT5/clang_64/lib
1572 SDKQT5=$PATH_SDK_QT5/clang_64
1573 else
1574 INCQT5=-I$PATH_SDK_QT5/Frameworks/QtCore.framework/Headers
1575 LIBQT5=-F$PATH_SDK_QT5/Frameworks
1576 SDKQT5=$PATH_SDK_QT5
1577 fi
1578 FLGQT5="-framework QtCore -std=c++11 -Wl,-rpath,`L_to_PATH "$LIBQT5"`"
[59681]1579 else
1580 log_failure "Qt5 framework not found (can be disabled using --disable-qt)"
1581 fail
1582 fi
1583 else # !darwin
1584 if [ $QT5DIR_PKGCONFIG -eq 1 ]; then
1585 # Default is to use pkg-config:
1586 if which_wrapper pkg-config > /dev/null; then
1587 qt5_ver=`pkg-config Qt5Core --modversion 2>> $LOG`
1588 if [ $? -eq 0 ]; then
[60563]1589 echo "(Qt5 from pkg-config)" >> $LOG
[90377]1590 FLGQT5=`pkg-config Qt5Core --cflags`
[65356]1591 # gcc 4.8 is able to compile with C++11 (see also VBOX_GCC_std in Config.kmk)
[90172]1592 [ $(($cc_maj * 100 + $cc_min)) -ge 408 ] && FLGQT5="$FLGQT5 -std=c++11"
[59681]1593 INCQT5=`strip_I "$FLGQT5"`
1594 LIBDIR5=`pkg-config Qt5Core --variable=libdir`
[90355]1595 LIBQT5=`pkg-config Qt5Core Qt5Gui --libs`
[59681]1596 LIBQT5="-L$LIBDIR5 $LIBQT5"
1597 TOOLQT5=`pkg-config Qt5Core --variable=prefix`
1598 TOOLQT5BIN=`pkg-config Qt5Core --variable=host_bins`
[60363]1599 if test_compile "$LIBQT5 $LIBPTHREAD $FLGQT5" qt5 qt5 nofatal; then
[79836]1600 test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal && foundqt5=3 # pkg-config
[59681]1601 fi
1602 fi
1603 else
1604 log_failure "pkg-config not found"
1605 fail
1606 fi
1607 fi
1608 if [ -z "$foundqt5" ]; then
1609 # Do it the old way (e.g. user has specified QT5DIR):
[90355]1610 for q in $QT5DIR "$DEVDIR/linux.$TARGET_MACHINE"/qt/v5.*; do
[60563]1611 echo "(Qt5 from '$q')" >> $LOG
[59681]1612 INCQT5="$q/include $q/include/QtCore"
[88296]1613 FLGQT5="-DQT_SHARED -std=c++11"
[59681]1614 I_INCQT5=`prefix_I "$INCQT5"`
[90355]1615 LIBQT5="-L$q/lib -lQt5CoreVBox -lQt5GuiVBox"
[59681]1616 TOOLQT5="$q"
1617 if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal &&
[79836]1618 test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal; then
[59681]1619 foundqt5=2 # internal
1620 break;
1621 fi
[90360]1622 LIBQT5="-L$q/lib -lQt5Core -lQt5Gui"
[59681]1623 if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal &&
[79836]1624 test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal; then
[59681]1625 foundqt5=1 # no pkg-config, Qt directory
1626 break;
1627 fi
1628 done
1629 fi
1630 fi
1631 if [ -n "$foundqt5" ]; then
1632 # We decided which version of Qt to use, now enforce the version requirement:
1633 cat > $ODIR.tmp_src.cc << EOF
1634#include <cstdio>
1635#include <QtGlobal>
1636extern "C" int main(void)
1637{
1638 printf("found version %s", QT_VERSION_STR);
[66821]1639EOF
1640 echo "#if QT_VERSION >= $(($QT5MAJ*65536+$QT5MIN*256))" >> $ODIR.tmp_src.cc
1641 cat >> $ODIR.tmp_src.cc << EOF
[59681]1642 printf(", OK.\n");
1643 return 0;
1644#else
[66821]1645EOF
1646echo " printf(\", expected version $QT5MAJ.$QT5MIN or higher\\\\n\");" >> $ODIR.tmp_src.cc
1647 cat >> $ODIR.tmp_src.cc << EOF
[59681]1648 return 1;
1649#endif
1650}
1651EOF
1652 [ -n "$INCQT5" ] && I_INCQT5=`prefix_I "$INCQT5"`
1653 if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal; then
[79836]1654 if test_execute_path "`L_to_PATH "$LIBQT5"`"; then
[59681]1655 if [ "$OS" = "darwin" ]; then
1656 # Successful build & run the test application so add the necessary
1657 # params to AutoConfig.kmk:
[84900]1658 cnf_append "PATH_SDK_QT5_INC" "`L_to_PATH "$LIBQT5"`"
1659 cnf_append "PATH_SDK_QT5_LIB" "`L_to_PATH "$LIBQT5"`"
1660 cnf_append "PATH_SDK_QT5" "$SDKQT5"
[59681]1661 # Check for the moc tool in the Qt directory found & some standard
1662 # directories.
[84900]1663 for q in $PATH_SDK_QT5 $PATH_SDK_QT5/clang_64 /usr /Developer/Tools/Qt; do
[59681]1664 if which_wrapper "$q/bin/moc" > /dev/null; then
1665 cnf_append "PATH_TOOL_QT5_BIN" "$q/bin"
1666 fi
1667 done
1668 else
1669 # Strip .../QtCore as we add components ourself:
1670 INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1671 # store only the first path, remove all other paths
1672 # most likely pkg-config gave us -I/usr/include/qt5 -I/usr/include/qt5/QtCore
1673 INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1674 cnf_append "VBOX_PATH_QT_LIB" "`strip_L "$LIBQT5"`"
1675 cnf_append "PATH_SDK_QT5_INC" "$INCQT5"
1676 # This is not quite right since the qt libpath does not have to be first...
1677 cnf_append "PATH_SDK_QT5_LIB" '$'"(firstword `strip_L "$LIBQT5"`)"
1678 if [ "$foundqt5" = "2" ]; then
1679 cnf_append "VBOX_WITH_ORACLE_QT" "1"
1680 fi
1681 if [ "$foundqt5" != "3" ]; then
1682 TOOLQT5BIN="$TOOLQT5/bin"
1683 fi
1684 test_header "Qt5 devtools"
1685 # Try it with a suffix, some platforms use that
1686 if which_wrapper "$TOOLQT5BIN/moc-qt5" > /dev/null; then
1687 QT5BINSUFF="-qt5"
1688 else
1689 QT5BINSUFF=""
1690 fi
1691 moc_ver=`$TOOLQT5BIN/moc$QT5BINSUFF -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1692 if [ $? -ne 0 ]; then
1693 log_failure "moc$QT5BINSUFF not working"
1694 fail
1695 else
1696 log_success "found version $moc_ver"
1697 cnf_append "VBOX_PATH_QT" "$TOOLQT5"
1698 cnf_append "PATH_SDK_QT5" "$TOOLQT5"
1699 cnf_append "PATH_TOOL_QT5_BIN" "$TOOLQT5BIN"
1700 [ -n "$QT5BINSUFF" ] && cnf_append "TOOL_QT5_BIN_SUFF" "$QT5BINSUFF"
1701 fi
1702 fi
1703 fi
1704 else
1705 log_failure "qt5 not working"
1706 fail
1707 fi
1708 else
1709 log_failure "qt5 not found"
1710 fail
1711 fi
1712}
1713
1714
1715#
[73123]1716# Check for libopus
1717#
1718check_libopus()
1719{
1720 if [ -z "$BUILD_LIBOPUS" ]; then
1721 test_header libopus
1722 if which_wrapper pkg-config > /dev/null; then
1723 libopus_ver=`pkg-config opus --modversion 2>> $LOG`
1724 if [ $? -eq 0 ]; then
1725 FLGOPUS=`pkg-config opus --cflags`
1726 INCOPUS=`strip_I "$FLGOPUS"`
1727 LIBOPUS=`pkg-config opus --libs`
1728 fi
1729 cat > $ODIR.tmp_src.cc << EOF
1730#include <cstdio>
1731#include <opus/opus.h>
1732extern "C" int main(void)
1733{
1734 OpusEncoder *test;
1735 printf("found, OK.\n");
1736}
1737EOF
1738 [ -n "$INCOPUS" ] && I_INCOPUS=`prefix_I "$INCOPUS"`
1739 if test_compile "$LIBOPUS $I_INCOPUS" opus opus; then
1740 if test_execute; then
1741 cnf_append "SDK_VBOX_OPUS_INCS" "$INCOPUS"
1742 cnf_append "SDK_VBOX_OPUS_LIBS" "`strip_l "$LIBOPUS"`"
1743 fi
1744 fi
1745 fi
1746 fi
1747}
1748
1749
1750#
[45772]1751# Check for libvpx
1752#
1753check_vpx()
1754{
1755 if [ -z "$BUILD_LIBVPX" ]; then
1756 test_header libvpx
1757 if which_wrapper pkg-config > /dev/null; then
1758 libvpx_ver=`pkg-config vpx --modversion 2>> $LOG`
[45819]1759 if [ $? -eq 0 ]; then
[45772]1760 FLGVPX=`pkg-config vpx --cflags`
1761 INCVPX=`strip_I "$FLGVPX"`
1762 LIBVPX=`pkg-config vpx --libs`
[45819]1763 fi
1764 cat > $ODIR.tmp_src.cc << EOF
[45772]1765#include <cstdio>
1766#include <vpx/vpx_codec.h>
1767extern "C" int main(void)
1768{
1769 int version = vpx_codec_version();
1770 int verMajor = VPX_VERSION_MAJOR(version);
1771 int verMinor = VPX_VERSION_MINOR(version);
1772 int verPatch = VPX_VERSION_PATCH(version);
1773 printf("found version %d.%d.%d", verMajor, verMinor, verPatch);
[45932]1774 if ( verMajor == 1 && verMinor >= 0
1775 || verMajor == 0 && verMinor == 9 && verPatch >= 5)
[45772]1776 {
1777 printf(", OK.\n");
1778 return 0;
1779 }
1780 else
1781 {
[45932]1782 printf(", expected version 0.9.5 or higher\n");
[45772]1783 return 1;
1784 }
1785}
1786EOF
[45819]1787 [ -n "$INCVPX" ] && I_INCVPX=`prefix_I "$INCVPX"`
1788 if test_compile "$LIBVPX $I_INCVPX" vpx vpx; then
1789 if test_execute; then
1790 cnf_append "SDK_VBOX_VPX_INCS" "$INCVPX"
1791 cnf_append "SDK_VBOX_VPX_LIBS" "`strip_l "$LIBVPX"`"
[45772]1792 fi
1793 fi
1794 fi
1795 fi
1796}
[7222]1797
[45772]1798
[7222]1799#
[18084]1800# Check whether static libstdc++ is installed. This library is required
1801# for the Linux guest additions.
[5366]1802#
1803check_staticlibstdcxx()
1804{
1805 test_header "static stc++ library"
1806 libstdcxx=`$CXX -print-file-name=libstdc++.a`
[16202]1807 cat > $ODIR.tmp_src.cc << EOF
[5366]1808#include <string>
1809
1810extern "C" int main(void)
1811{
1812 std::string s = "test";
1813 return 0;
1814}
1815EOF
1816 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1817 log_success "found"
1818 fi
1819}
1820
[11735]1821
[5366]1822#
[1]1823# Check for Linux sources
1824#
[3163]1825check_linux()
[1]1826{
1827 test_header "Linux kernel sources"
[16202]1828 cat > $ODIR.tmp_src.c << EOF
[1]1829#include <linux/version.h>
1830int printf(const char *format, ...);
1831int main(void)
1832{
[24]1833 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
[1]1834 (LINUX_VERSION_CODE % 65536) / 256,
1835 LINUX_VERSION_CODE % 256);
1836#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1837 printf(", OK.\n");
1838 return 0;
1839#else
1840 printf(", expected version 2.4.0 or higher\n");
1841 return 1;
1842#endif
1843}
[3163]1844EOF
[1]1845 echo "compiling the following source file:" >> $LOG
[16202]1846 cat $ODIR.tmp_src.c >> $LOG
[1]1847 echo "using the following command line:" >> $LOG
[45204]1848 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include " \
1849 "-I$LINUX/include/generated/uapi" >> $LOG
[43674]1850 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include \
1851 -I$LINUX/include/generated/uapi >> $LOG 2>&1
[3163]1852 if [ $? -ne 0 ]; then
[3328]1853 echo
1854 echo " Linux kernel headers not found at $LINUX"
1855 echo " Check the file $LOG for detailed error information."
[1]1856 fail
1857 else
1858 if test_execute; then
[70497]1859 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
[1]1860 fi
1861 fi
1862}
1863
1864#
1865# Check for kchmviewer, needed to display the online help
[11735]1866# (unused as we ship kchmviewer)
[1]1867#
[3163]1868check_kchmviewer()
[1]1869{
1870 test_header kchmviewer
1871 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1872 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
[3163]1873 if [ $? -ne 0 ]; then
[33515]1874 log_failure "kchmviewer not working"
[1]1875 fail
1876 else
1877 log_success "found version $kchmviewer_ver"
1878 fi
1879 fi
1880}
1881
[11735]1882
[1]1883#
1884# Check for the kBuild tools, we don't support GNU make
1885#
[3163]1886check_kbuild()
[1]1887{
1888 test_header kBuild
[6199]1889 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1890 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
[84934]1891
1892 echo "KBUILD_PATH=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1893 echo "KBUILD_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1894 echo 'path_kbuild_bin="$KBUILD_PATH/bin/$BUILD_TARGET.$BUILD_PLATFORM_ARCH"' >> $ENV
1895 echo 'path_tools_bin="$KBUILD_DEVTOOLS/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/bin"' >> $ENV
1896
[4757]1897 if [ "$OS" = "solaris" ]; then
1898 # Because of sh being non-default shell in Solaris we need to export PATH again when
1899 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
[5536]1900 echo "PATH=\"$ORGPATH\"" >> $ENV
[4757]1901 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
[84934]1902 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_tools_bin\" || PATH=\"\$path_tools_bin:\$PATH\"" >> $ENV
[4757]1903 else
1904 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
[84934]1905 echo "echo \"\$PATH\" | grep -q \"\$path_tools_bin\" || PATH=\"\$path_tools_bin:\$PATH\"" >> $ENV
[4757]1906 fi
[84934]1907 echo "export KBUILD_PATH KBUILD_DEVTOOLS PATH" >> $ENV
1908 echo "unset path_kbuild_bin path_tools_bin" >> $ENV
[6199]1909 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
[84934]1910
1911 echo '' >> $ENV
1912 echo "# Legacy - do not use:" >> $ENV
1913 echo 'PATH_KBUILD=${KBUILD_PATH}' >> $ENV
1914 echo 'PATH_DEVTOOLS=${KBUILD_DEVTOOLS}' >> $ENV
1915 echo 'export PATH_KBUILD PATH_DEVTOOLS' >> $ENV
1916 echo '' >> $ENV
[6199]1917 elif check_avail "kmk" KBUILDDIR really; then
1918 # check for installed kBuild
1919 KBUILD_SED="`which_wrapper kmk_sed`"
1920 else
1921 fail
[1]1922 fi
[6199]1923 log_success "found"
[1]1924}
1925
[923]1926
[1]1927#
[923]1928# Check for compiler.h
[9133]1929# Some Linux distributions include "compiler.h" in their libc linux
1930# headers package, some don't. Most don't need it, building might (!)
[923]1931# not succeed on openSUSE without it.
1932#
1933# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1934#
[3163]1935check_compiler_h()
[923]1936{
1937 test_header compiler.h
[58367]1938 if test ! -f "/usr/include/linux/compiler.h"; then
[923]1939 log_success "compiler.h not found"
1940 else
[18866]1941 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
[923]1942 log_success "compiler.h found"
1943 fi
1944}
1945
[15247]1946#
1947# Check for libcap.
1948# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1949# sockets for doing ICMP requests.
1950#
1951check_libcap()
1952{
1953 test_header "libcap library"
[16202]1954 cat > $ODIR.tmp_src.cc << EOF
[15247]1955#include <cstdio>
[19094]1956#include <sys/types.h>
[39547]1957#include <linux/types.h>
[15247]1958#include <sys/capability.h>
[923]1959
[15247]1960extern "C" int main(void)
1961{
[15608]1962 char buf[1024];
[15247]1963 cap_t caps = cap_get_proc();
[15608]1964 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
[15247]1965 return 0;
1966}
1967EOF
1968 if test_compile $LIBCAP libcap libcap; then
1969 if test_execute; then
1970 log_success "found"
1971 fi
1972 fi
1973}
1974
[923]1975#
[4446]1976# Check if we are able to build 32-bit applications (needed for the guest additions)
1977#
1978check_32bit()
1979{
1980 test_header "32-bit support"
[16202]1981 cat > $ODIR.tmp_src.c << EOF
[4446]1982#include <stdint.h>
1983int main(void)
1984{
1985 return 0;
1986}
1987EOF
1988 echo "compiling the following source file:" >> $LOG
[16202]1989 cat $ODIR.tmp_src.c >> $LOG
[4446]1990 echo "using the following command line:" >> $LOG
[16202]1991 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1992 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
[4446]1993 if [ $? -ne 0 ]; then
1994 echo
1995 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1996 echo " Check the file $LOG for detailed error information."
1997 fail
[32176]1998 else
1999 echo "executing the binary" >> $LOG
2000 $ODIR.tmp_out 2> $ODIR.test_execute.log
2001 rc=$?
2002 cat $ODIR.test_execute.log >> $LOG
2003 if [ $rc -ne 0 ]; then
2004 echo
2005 echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
2006 echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
2007 fail
2008 return 1
2009 fi
[4446]2010 fi
2011 log_success ""
2012}
2013
[11735]2014
[5041]2015#
[11735]2016# Check for Python
2017#
2018check_python()
2019{
[30998]2020 test_header "Python support"
[22752]2021
2022 # On darwin this is a on/off decision only
2023 if [ "$OS" = "darwin" ]; then
2024 echo "enabled"
2025 cnf_append "VBOX_WITH_PYTHON" "1"
2026 return
2027 fi
2028
[16202]2029 cat > $ODIR.tmp_src.cc << EOF
[11735]2030#include <cstdio>
2031#include <Python.h>
2032extern "C" int main(void)
2033{
2034 Py_Initialize();
2035 printf("found version %s", PY_VERSION);
[61131]2036#if PY_VERSION_HEX >= 0x02060000
[11735]2037 printf(", OK.\n");
2038 return 0;
2039#else
[61131]2040 printf(", expected version 2.6 or higher\n");
[11735]2041 return 1;
2042#endif
2043}
2044EOF
2045 found=
[90537]2046 SUPPYTHONLIBS="python2.7 python2.6 python3.1 python3.2 python3.3 python3.4 python3.4m python3.5 python3.5m python3.6 python3.6m python3.7 python3.7m python3.8 python3.8m python3.9 python3.9m python3.10 python3.10m"
[11735]2047 for p in $PYTHONDIR; do
[18904]2048 for d in $SUPPYTHONLIBS; do
[45204]2049 for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
[11735]2050 echo "compiling the following source file:" >> $LOG
[16202]2051 cat $ODIR.tmp_src.cc >> $LOG
[11735]2052 echo "using the following command line:" >> $LOG
[16202]2053 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
2054 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
[11735]2055 if [ $? -eq 0 ]; then
2056 found=1
2057 break
2058 fi
2059 done
2060 if [ -n "$found" ]; then break; fi
2061 done
2062 if [ -n "$found" ]; then break; fi
2063 done
2064 if [ -n "$found" ]; then
2065 if test_execute; then
2066 cnf_append "VBOX_WITH_PYTHON" "1"
2067 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
2068 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
2069 else
[33515]2070 log_failure "Python not working"
[11735]2071 fail
2072 fi
2073 else
[33515]2074 log_failure "Python not found"
[11735]2075 fail
2076 fi
2077}
2078
2079
2080#
[30998]2081# Check for Java
2082#
2083check_java()
2084{
2085 test_header "Java support"
2086 log_success
2087}
2088
2089
2090#
[5041]2091# Setup wine
2092#
2093setup_wine()
2094{
[5069]2095 test_header "Wine support"
[5044]2096 if ! which_wrapper wine > /dev/null; then
[5069]2097 echo " wine binary not found"
[5044]2098 fail
2099 fi
[37089]2100 if ! which_wrapper wine > /dev/null; then
2101 echo " wine not found"
[5044]2102 fail
2103 fi
[37089]2104 wine_version="`wine --version`"
2105 case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
2106 "0")
2107 if ! which_wrapper wineprefixcreate > /dev/null; then
2108 echo " wineprefixcreate not found"
2109 fail
2110 fi
2111 ;;
2112 *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
2113 esac
[5041]2114 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
[26687]2115 echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
2116 echo "export WINEPREFIX" >> $ENV
[5041]2117 rm -rf $WINEPREFIX
2118 mkdir -p $WINEPREFIX
2119 touch $WINEPREFIX/.no_prelaunch_window_flag
[5044]2120 if ! wineprefixcreate -q > /dev/null 2>&1; then
[5041]2121 echo " wineprefixcreate failed"
2122 fail
2123 fi
2124 tmp=.tmp.wine.reg
2125 rm -f $tmp
2126 echo 'REGEDIT4' > $tmp
2127 echo '' >> $tmp
2128 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
2129 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
2130 echo '' >> $tmp
2131 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
2132 echo '"itss"="native"' >> $tmp
2133 echo '' >> $tmp
2134 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
2135 echo '"itss"="native"' >> $tmp
2136 echo '' >> $tmp
[5044]2137 if ! wine regedit $tmp > /dev/null 2>&1; then
[5041]2138 rm -f $tmp
2139 echo " failed to load registry changes (path)."
2140 fail
2141 fi
2142 rm -f $tmp
[5069]2143 log_success "found"
[5041]2144}
[4446]2145
[31639]2146
[16139]2147#
[16994]2148# Check for gSOAP.
[16139]2149#
2150check_gsoap()
2151{
2152 test_header "GSOAP compiler"
[40494]2153 if [ -z "$GSOAP" -a -z "$GSOAP_IMPORT" ]; then
2154 if which_wrapper pkg-config > /dev/null; then
2155 GSOAP_CXX_LIBS=`pkg-config gsoapssl++ --libs 2>> $LOG`
2156 if [ $? -eq 0 ]; then
2157 GSOAP=`pkg-config gsoapssl++ --variable=exec_prefix`
2158 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2159 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2160 GSOAP_IMPORT="$GSOAP/include/gsoap"
2161 fi
2162 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2163 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2164 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2165 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2166 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2167 else
2168 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2169 fi
[40495]2170 cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
[40494]2171 gsoap_version=`pkg-config gsoapssl++ --modversion`
2172 log_success "found version $gsoap_version"
2173 return
2174 fi
2175 fi
[90402]2176 if [ -d "$DEVDIR/common/gsoap" ]; then
2177 GSOAP_DIR=`ls -d1 "$DEVDIR"/common/gsoap/v* 2>/dev/null | tail -1`
2178 if [ -n "$GSOAP_DIR" -a -d "$GSOAP_DIR" ]; then
2179 gsoap_version=`echo "$GSOAP_DIR" | sed -ne 's/^.*\/v\([1-9][0-9.]*\).*$/\1/p'`
2180 log_success "found gSOAP tool version $gsoap_version"
2181 # No need to configure anything, the build system knows what to do.
2182 return
2183 fi
2184 fi
[40494]2185 fi
[16139]2186 if [ -z "$GSOAP" ]; then
[16994]2187 GSOAP="/usr"
[16139]2188 fi
[16994]2189 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
2190 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
2191 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
2192 # TODO: Check for libgsoap++.a/so
2193
2194 if [ -z "$GSOAP_IMPORT" ]; then
2195 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2196 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2197 GSOAP_IMPORT="$GSOAP/include/gsoap"
2198 fi
2199 fi
2200 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
2201 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2202 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2203 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
[18126]2204 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2205 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2206 else
2207 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2208 fi
[40477]2209 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoapssl++"
[16994]2210 log_success "found"
2211 else
2212 log_failure "stlvector.h not found -- disabling webservice"
2213 cnf_append "VBOX_WITH_WEBSERVICES" ""
2214 fi
2215 else
2216 log_failure "stdsoap2.h not found -- disabling webservice"
2217 cnf_append "VBOX_WITH_WEBSERVICES" ""
2218 fi
[16139]2219 else
2220 log_failure "wsdl2h not found -- disabling webservice"
[16144]2221 cnf_append "VBOX_WITH_WEBSERVICES" ""
[16139]2222 fi
2223 else
2224 log_failure "soapcpp2 not found -- disabling webservice"
[16144]2225 cnf_append "VBOX_WITH_WEBSERVICES" ""
[16139]2226 fi
2227}
[5041]2228
[16139]2229
[4446]2230#
[8464]2231# Determines the Darwin version.
[8070]2232#
2233check_darwinversion()
2234{
2235 test_header "Darwin version"
2236 darwin_ver=`uname -r`
2237 case "$darwin_ver" in
[87614]2238 20\.*)
2239 darwin_ver="11.0" # Big Sur
2240 ;;
[84900]2241 19\.*)
2242 darwin_ver="10.15" # Catalina
2243 ;;
2244 18\.*)
2245 darwin_ver="10.14" # Mojave
2246 ;;
[68477]2247 17\.*)
2248 darwin_ver="10.13" # High Sierra
2249 ;;
[67198]2250 16\.*)
[67280]2251 darwin_ver="10.12" # Sierra
[67198]2252 ;;
[59405]2253 15\.*)
2254 darwin_ver="10.11" # El Capitan
2255 ;;
[51645]2256 14\.*)
2257 darwin_ver="10.10" # Yosemite
2258 ;;
2259 13\.*)
2260 darwin_ver="10.9" # Mavericks
2261 ;;
[8070]2262 *)
[22259]2263 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
[8070]2264 fail
2265 darwin_ver="unknown"
2266 ;;
2267 esac
[84900]2268
[87614]2269 log_success "found version $darwin_ver"
2270}
2271
2272#
2273# Check Xcode path
2274#
2275check_xcode_path()
2276{
2277 # Check if WITH_XCODE_DIR is set.
2278 if [ -z "$WITH_XCODE_DIR" ]; then
2279 if [ -d "/Library/Developer/CommandLineTools" -a -f "/Library/Developer/CommandLineTools/usr/bin/clang" ]; then
2280 return 1
2281 else
2282 echo "Please specify --with-xcode-dir option."
2283 return 0
2284 fi
2285 fi
2286
2287 # Check if specified path exists and is a directory containing Xcode.
2288 if [ -d "$1" -a -f "$1/Contents/Developer/usr/bin/xcodebuild" ]; then
2289 return 1
2290 else
2291 echo "Xcode path [$1] not found."
2292 return 0
2293 fi
2294}
2295
2296check_xcode()
2297{
2298 test_header "Xcode and SDK"
2299 check_xcode_path "$WITH_XCODE_DIR"
[84900]2300 [ $? -eq 1 ] || fail
2301
2302 # Pick the oldest SDK offered by Xcode, to get maximum compatibility
[87614]2303 if [ -z "$WITH_XCODE_DIR" ]; then
2304 devel_subdir="/Library/Developer/CommandLineTools"
2305 sdk_subdir="$devel_subdir/SDKs"
2306 else
2307 devel_subdir="$WITH_XCODE_DIR/Contents/Developer"
2308 sdk_subdir="$devel_subdir/Platforms/MacOSX.platform/Developer/SDKs"
2309 fi
[84900]2310 sdk_tries="$sdk_subdir"/MacOSX10.?.sdk" $sdk_subdir"/MacOSX10.??.sdk" $sdk_subdir"/MacOSX.sdk
2311 for t in $sdk_tries; do
2312 if [ -f "$t/SDKSettings.plist" ]; then
2313 sdk="$t"
2314 sdk_ver=`defaults read "$t/SDKSettings.plist" Version`
2315 break
2316 fi
2317 done
2318 if [ -z "$sdk" ]; then
2319 echo " failed to determine SDK directory. ($sdk_subdir/MacOSX*.sdk/SDKSettings.plist should exist)"
2320 fail
2321 fi
[87614]2322 xcode_ver=`$devel_subdir/usr/bin/clang --version | sed -n 's/^.*version \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*$/\1/p'`
2323 if [ $? -ne 0 -o -z "$xcode_ver" ]; then
2324 echo " failed to determine Xcode version."
2325 fail
2326 fi
[84900]2327
[87614]2328 if [ -z "$WITH_XCODE_DIR" ]; then
2329 cnf_append "VBOX_WITH_EVEN_NEWER_XCODE" "1"
2330 else
2331 cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
2332 cnf_append "PATH_TOOL_VBoxXcode62" "$devel_subdir"
2333 cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$devel_subdir"
2334 fi
[84900]2335 cnf_append "VBOX_PATH_MACOSX_SDK" "$sdk"
2336 if [ -n "$sdk_ver" ]; then
2337 cnf_append "VBOX_DEF_MACOSX_VERSION_MIN" "$sdk_ver"
2338 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2339 fi
2340
[87614]2341 log_success "found version $xcode_ver (SDK: $sdk)"
[8070]2342}
2343
2344
[31639]2345check_makeself()
2346{
2347 test_header "makeself"
2348 if check_avail "$MAKESELF" makeself; then
2349 makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2350 if [ $? -ne 0 ]; then
[33515]2351 log_failure "makeself not working"
[31639]2352 fail
2353 else
2354 log_success "found version $makeself_ver"
2355 cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2356 fi
2357 fi
2358}
2359
2360
[8070]2361#
[1]2362# Show help
2363#
[3163]2364show_help()
[1]2365{
[22739]2366cat << EOF
[1]2367Usage: ./configure [OPTIONS]...
2368
2369Configuration:
[4785]2370 -h, --help display this help and exit
2371 --nofatal don't abort on errors
[22739]2372EOF
[22743]2373[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
2374[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
[30998]2375[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
[26695]2376[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
[22743]2377[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
[59681]2378[ $WITH_QT5 -eq 1 ] && echo " --disable-qt disable Qt detection"
[22743]2379[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
2380[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
2381[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
2382[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
[28938]2383[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
[59681]2384[ $WITH_QT5 -eq 0 ] && echo " --enable-qt5 enable Qt5 detection"
[36697]2385[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
[40217]2386[ $OSE -eq 0 ] && echo " --disable-extpack don't build the extpack"
[31852]2387[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
[45822]2388[ $WITH_LIBVPX -eq 1 ] && echo " --disable-libvpx don't use libvpx for video capturing"
[73369]2389[ $WITH_LIBOPUS -eq 1 ] && echo " --disable-libopus don't use libopus for audio capturing"
[28419]2390[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
[22739]2391cat << EOF
[37199]2392 --disable-udptunnel disable UDP tunnel networking
[43715]2393 --disable-devmapper disable device mapper library access
[11884]2394 --disable-hardening don't be strict about /dev/vboxdrv access
[7306]2395 --build-libxml2 build libxml2 from sources
[84900]2396 --build-libssl build openssl from sources
[22752]2397EOF
[28746]2398[ $OSE -eq 0 ] && cat << EOF
2399 --build-libcurl build libcurl from sources
[45772]2400 --build-libvpx build libvpx from sources
[28746]2401EOF
[22752]2402[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
2403cat << EOF
[55347]2404 --only-additions only build the Guest Additions
[1]2405
2406Paths:
[4785]2407 --with-gcc=PATH location of the gcc compiler [$CC]
2408 --with-g++=PATH location of the g++ compiler [$CXX]
2409 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
2410 --with-iasl=PATH location of the iasl compiler [$IASL]
[87614]2411 --with-yasm=PATH location of the iasl compiler [$YASM]
[37199]2412 --with-makeself=PATH location of makeself [$MAKESELF]
[22739]2413EOF
[51645]2414[ "$OS" = "darwin" ] && echo " --with-xcode-dir=DIR custom path to Xcode root directory; it is assumed that Xcode"
2415[ "$OS" = "darwin" ] && echo " contains OS X 10.6 SDK (required for Mountain Lion and newer hosts"
2416[ "$OS" = "darwin" ] && echo " only, ignored for the rest)"
[22743]2417[ "$OS" = "linux" ] && echo " --with-linux=DIR Linux kernel source directory [$LINUX]"
[59681]2418[ $WITH_QT5 -eq 1 ] && echo " --with-qt-dir=DIR directory for Qt headers/libraries [pkgconfig]"
[22739]2419cat << EOF
[90354]2420 --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries
2421 (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)
2422 --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)
[23555]2423 --with-openssl-dir=DIR directory for OpenSSL headers/libraries
[41518]2424 --with-ow-dir=DIR directory where Open Watcom can be found [$WATCOM]
[90118]2425 --out-base-dir=DIR directory where configuration and build output
2426 should go, in subdirectory out
[1]2427
2428Build type:
[4785]2429 -d, --build-debug build with debugging symbols and assertions
[6928]2430 --build-profile build with profiling support
[22739]2431 --build-headless build headless (without any GUI frontend)
[1]2432EOF
2433 exit 0
2434}
2435
2436
2437#
2438# The body.
2439#
2440
[22739]2441# test if we are OSE
[31889]2442if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
[22739]2443 OSE=0
[25411]2444 # Set this as a reminder to print a log message once we know the path of the
2445 # log file
2446 NOT_OSE=1
[22739]2447fi
2448
2449# Change OS specific defaults; must be before all other stuff
2450if [ "$OS" = "darwin" ]; then
2451 WITH_SDL=0
2452 WITH_SDL_TTF=0
2453 WITH_X11=0
2454 WITH_ALSA=0
2455 WITH_PULSE=0
2456 WITH_DBUS=0
2457 WITH_KMODS=0
2458 BUILD_LIBXML2=1
[84900]2459 BUILD_LIBSSL=1
[45772]2460 BUILD_LIBVPX=1
[22739]2461 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
[45822]2462 [ $OSE -eq 1 ] && WITH_LIBVPX=0
[73369]2463 [ $OSE -eq 1 ] && WITH_LIBOPUS=0
[51645]2464 WITH_XCODE_DIR=""
[43363]2465elif [ "$OS" = "haiku" ]; then
2466 #WITH_SDL=0
2467 WITH_SDL_TTF=0
2468 WITH_X11=0
2469 WITH_ALSA=0
2470 WITH_PULSE=0
2471 WITH_DBUS=0
2472 WITH_KMODS=0
2473 WITH_LIBIDL=0
2474 WITH_XPCOM=0
2475 BUILD_LIBXSLT=1
2476 BUILD_LIBXML2=1
[45822]2477 WITH_LIBVPX=0
[73369]2478 WITH_LIBOPUS=0
[43363]2479 # it is part of libroot, which is linked by default,
2480 # but the script wants something
2481 LIBPTHREAD="-lroot"
[45822]2482 #[ $OSE -eq 1 ] || BUILD_LIBCURL=1
[72668]2483 [ $OSE -eq 1 ] || BUILD_LIBSSL=1
[45822]2484elif [ "$OS" = "solaris" ]; then
2485 [ $OSE -eq 1 ] && WITH_LIBVPX=0
[73369]2486 [ $OSE -eq 1 ] && WITH_LIBOPUS=0
[22739]2487fi
2488
[1]2489# scan command line options
[51645]2490for option in "$@"; do
[1]2491 case "$option" in
2492 --help|-help|-h)
2493 show_help
2494 ;;
2495 --nofatal)
2496 nofatal=1
2497 ;;
[11373]2498 --env-only)
2499 ENV_ONLY=1
2500 ;;
[1]2501 --with-gcc=*)
2502 CC=`echo $option | cut -d'=' -f2`
2503 ;;
2504 --with-g++=*)
2505 CXX=`echo $option | cut -d'=' -f2`
2506 ;;
2507 --with-kbuild=*)
2508 KBUILDDIR=`echo $option | cut -d'=' -f2`
[63]2509 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2510 echo "Error: KBUILDDIR contains invalid characters!"
2511 exit 1
2512 fi
[1]2513 ;;
[59681]2514 --with-qt-dir=*)
2515 [ $WITH_QT5 -eq 1 ] && QT5DIR=`echo $option | cut -d'=' -f2`
2516 [ $WITH_QT5 -eq 1 ] && QT5DIR_PKGCONFIG=0
[7470]2517 ;;
[66821]2518 --with-qt5-minor=*)
2519 QT5MIN=`echo $option | cut -d'=' -f2`
2520 ;;
2521 --with-qt5-major=*)
2522 QT5MAJ=`echo $option | cut -d'=' -f2`
2523 ;;
[23547]2524 --with-openssl-dir=*)
2525 OPENSSLDIR=`echo $option | cut -d'=' -f2`
2526 INCCRYPTO="-I${OPENSSLDIR}/include"
[90415]2527 LIBCRYPTO="${OPENSSLDIR}/lib/libssl.a ${OPENSSLDIR}/lib/libcrypto.a"
[84900]2528 # On Darwin (at least for macports) static OpenSSL also needs zlib.
2529 [ "$OS" = "darwin" ] && LIBCRYPTO="$LIBCRYPTO ${OPENSSLDIR}/lib/libz.a"
[90415]2530 # On Linux static OpenSSL typically needs a few additional libraries.
2531 [ "$OS" = "linux" ] && LIBCRYPTO="-ldl $LIBPTHREAD -lm"
[23547]2532 ;;
[41518]2533 --with-ow-dir=*)
2534 WATCOM=`echo $option | cut -d'=' -f2`
2535 ;;
[16139]2536 --with-gsoap-dir=*)
2537 GSOAP=`echo $option | cut -d'=' -f2`
2538 ;;
[16994]2539 --with-gsoap-import=*)
2540 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2541 ;;
[1]2542 --with-iasl=*)
2543 IASL=`echo $option | cut -d'=' -f2`
2544 ;;
[87614]2545 --with-yasm=*)
2546 YASM=`echo $option | cut -d'=' -f2`
2547 ;;
[51645]2548 --with-xcode-dir=*)
2549 WITH_XCODE_DIR=`echo $option | cut -d'=' -f2`
2550 ;;
[1]2551 --with-linux=*)
2552 LINUX=`echo $option | cut -d'=' -f2`
2553 ;;
[37199]2554 --with-makeself=*)
2555 MAKESELF=`echo $option | cut -d'=' -f2`
2556 ;;
[22739]2557 --target-arch=*)
2558 TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2559 ;;
[1]2560 --disable-xpcom)
[22739]2561 [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
[1]2562 ;;
[11735]2563 --disable-python)
[22739]2564 [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
[11735]2565 ;;
[30998]2566 --disable-java)
2567 [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2568 ;;
[26695]2569 --disable-vmmraw)
2570 [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2571 ;;
[1038]2572 --disable-sdl-ttf)
[22739]2573 [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
[1038]2574 ;;
[1]2575 --disable-qt)
[59681]2576 [ $WITH_QT5 -eq 1 ] && WITH_QT5=0
[1]2577 ;;
[59681]2578 --enable-qt5)
2579 [ $WITH_QT5 -eq 0 ] && WITH_QT5=1
[8073]2580 ;;
[26776]2581 --passive-mesa)
2582 PASSIVE_MESA=1
2583 ;;
[8018]2584 --disable-alsa)
[22739]2585 [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
[8018]2586 ;;
[6101]2587 --disable-pulse)
[22739]2588 [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
[6101]2589 ;;
[25938]2590 --enable-pulse)
2591 WITH_PULSE=2
2592 ;;
[14989]2593 --disable-dbus)
[22739]2594 [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
[14711]2595 ;;
[6157]2596 --disable-kmods)
[22739]2597 [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
[6157]2598 ;;
[17912]2599 --disable-opengl)
[22739]2600 [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
[17912]2601 ;;
[22739]2602 --enable-webservice)
2603 ;;
[36697]2604 --enable-vnc)
2605 WITH_VNC=1
2606 ;;
[11884]2607 --disable-hardening)
2608 WITH_HARDENING=0
2609 ;;
[40217]2610 --disable-extpack)
[40218]2611 WITH_EXTPACK=0
[40217]2612 ;;
[31852]2613 --disable-docs)
2614 WITH_DOCS=0
2615 ;;
[11884]2616 --enable-hardening)
2617 WITH_HARDENING=2
2618 ;;
[73123]2619 --build-libopus)
2620 BUILD_LIBOPUS=1
2621 ;;
[37199]2622 --disable-udptunnel)
2623 WITH_UDPTUNNEL=0
2624 ;;
[28419]2625 --enable-vde)
2626 WITH_VDE=1
2627 ;;
[43715]2628 --disable-devmapper)
2629 WITH_DEVMAPPER=0
2630 ;;
[46279]2631 --disable-libvpx)
2632 WITH_LIBVPX=0
2633 ;;
[73369]2634 --disable-libopus)
2635 WITH_LIBOPUS=0
2636 ;;
[61108]2637 --disable-sdl)
[57789]2638 WITH_SDL=0
2639 ;;
[1]2640 --build-debug|-d)
2641 BUILD_TYPE=debug
2642 ;;
[6928]2643 --build-profile)
2644 BUILD_TYPE=profile
2645 ;;
[6098]2646 --build-libxml2)
2647 BUILD_LIBXML2=1
2648 ;;
[23574]2649 --build-libssl)
2650 BUILD_LIBSSL=1
2651 ;;
[19849]2652 --build-libcurl)
2653 BUILD_LIBCURL=1
2654 ;;
[45772]2655 --build-libvpx)
2656 BUILD_LIBVPX=1
2657 ;;
[3905]2658 --build-headless)
2659 HEADLESS=1
[5239]2660 WITH_SDL=0
2661 WITH_SDL_TTF=0
2662 WITH_X11=0
[17912]2663 WITH_OPENGL=0
[59681]2664 WITH_QT5=0
[3905]2665 ;;
[1]2666 --ose)
2667 OSE=2
2668 ;;
2669 --odir=*)
[4719]2670 ODIR="`echo $option | cut -d'=' -f2`/"
[16257]2671 ODIR_OVERRIDE=1
[1]2672 ;;
[90118]2673 --out-base-dir=*)
2674 out_base_dir="`echo $option | cut -d'=' -f2`/"
2675 if [ -d $out_base_dir ]; then
2676 saved_pwd="$PWD"
2677 cd $out_base_dir
2678 OUT_BASE_PATH="`pwd`"
2679 cd $saved_pwd
2680 OUT_BASE_PATH_OVERRIDE=1
[16257]2681 if [ $ODIR_OVERRIDE -eq 0 ]; then
2682 # This variable has not *yet* been overridden. That can still happen.
[90118]2683 ODIR=$OUT_BASE_PATH/
[16257]2684 fi
2685 else
[90118]2686 echo "Error: invalid folder \"$out_base_dir\" in option \"$option\""
[16257]2687 exit 1
2688 fi
2689 ;;
[5041]2690 --setup-wine)
[22752]2691 [ "$OS" != "darwin" ] && SETUP_WINE=1
[5041]2692 ;;
[55347]2693 --only-additions)
2694 ONLY_ADDITIONS=1
2695 ;;
[1]2696 *)
2697 echo
2698 echo "Unrecognized option \"$option\""
2699 echo
2700 show_help
2701 ;;
2702 esac
2703done
2704
[4719]2705LOG="$ODIR$LOG"
2706ENV="$ODIR$ENV"
2707CNF="$ODIR$CNF"
[1]2708
2709# initialize output files
2710cat > $LOG << EOF
2711# Log file generated by
2712#
2713# '$0 $*'
2714#
2715
2716EOF
2717cat > $CNF << EOF
2718# -*- Makefile -*-
2719#
2720# automatically generated by
2721#
2722# '$0 $*'
2723#
2724# It will be completely overwritten if configure is executed again.
2725#
2726
2727EOF
2728cat > $ENV << EOF
2729#!/bin/bash
2730#
2731# automatically generated by
2732#
2733# '$0 $*'
2734#
2735# It will be completely overwritten if configure is executed again.
2736# Make sure you source this file once before you start to build VBox.
2737#
2738
2739EOF
2740
[28662]2741# Print log warning about OSE if necessary
2742if [ -n "$NOT_OSE" ]; then
[31889]2743 echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
[28662]2744 echo >> $LOG
2745fi
2746
2747
[3263]2748if [ "$BUILD_TYPE" = "debug" ]; then
2749 echo "Creating DEBUG build!" >> $LOG
[6928]2750elif [ "$BUILD_TYPE" = "profile" ]; then
2751 echo "Creating PROFILE build!" >> $LOG
[3263]2752fi
2753
[1]2754# first determine our environment
2755check_environment
2756check_kbuild
2757
[11373]2758[ -n "$ENV_ONLY" ] && exit 0
2759
[4733]2760# append the tools directory to the default search path
2761echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2762export PATH
2763
[16257]2764# if we will be writing to a different out directory then set this up now
[90118]2765if [ $ODIR_OVERRIDE -eq 1 ]; then
2766 echo "AUTOCFG=$CFG" >> $ENV
[26687]2767 echo "export AUTOCFG" >> $ENV
[90118]2768fi
2769if [ $OUT_BASE_PATH_OVERRIDE -eq 1 ]; then
2770 echo "PATH_OUT_BASE=$OUT_BASE_PATH" >> $ENV
[26687]2771 echo "export PATH_OUT_BASE" >> $ENV
[16257]2772fi
2773
[63576]2774# don't bother people with -Werror
2775cnf_append "VBOX_GCC_WERR" "\$(NO_SUCH_VARIABLE)"
2776
[1]2777# some things are not available in for OSE
[3163]2778if [ $OSE -ge 1 ]; then
[1]2779 cnf_append "VBOX_OSE" "1"
[56243]2780 cnf_append "VBOX_WITH_VALIDATIONKIT" ""
[1]2781 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2782
[24]2783 if [ "$OS" = "linux" ]; then
[1]2784 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
[24]2785 else
[1]2786 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2787 fi
2788 echo >> $CNF
2789fi
2790
[40219]2791# extpack
[55347]2792if [ $ONLY_ADDITIONS -eq 1 ]; then
2793 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2794elif [ $OSE -eq 0 ]; then
[40219]2795 if [ $WITH_EXTPACK -eq 1 ]; then
2796 BUILD_LIBSSL=1
2797 else
2798 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2799 fi
2800fi
2801
[3905]2802# headless
2803if [ -n "$HEADLESS" ]; then
2804 cnf_append "VBOX_HEADLESS" "1"
2805fi
2806
[1542]2807# emit disable directives corresponding to any --disable-xxx options.
[28938]2808if [ $WITH_OPENGL -eq 0 ]; then
[86228]2809 cnf_append "VBOX_WITH_VMSVGA3D" ""
2810 cnf_append "VBOX_WITH_3D_ACCELERATION" ""
[28938]2811 cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
2812 cnf_append "VBOX_GUI_USE_QGL" ""
2813fi
[30998]2814[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
[67067]2815[ $WITH_QT5 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
[30998]2816[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2817[ $WITH_PYTHON -eq 0 ] && cnf_append "VBOX_WITH_PYTHON" ""
2818[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JXPCOM" ""
[42002]2819[ $WITH_JAVA -eq 0 ] && cnf_append "VBOX_WITH_JWS" ""
[11884]2820[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2821[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
[30998]2822[ $WITH_VMMRAW -eq 0 ] && cnf_append "VBOX_WITH_RAW_MODE" ""
[65360]2823if [ $WITH_LIBVPX -eq 0 ]; then
2824 cnf_append "VBOX_WITH_LIBVPX" ""
[75345]2825 cnf_append "VBOX_WITH_RECORDING" ""
[65360]2826fi
[73369]2827if [ $WITH_LIBOPUS -eq 0 ]; then
2828 cnf_append "VBOX_WITH_LIBOPUS" ""
[75345]2829 cnf_append "VBOX_WITH_AUDIO_RECORDING" ""
[73369]2830fi
[1542]2831
[23545]2832# Darwin-specific
[87614]2833[ "$OS" = "darwin" ] && check_darwinversion
[1]2834# the tools
[87614]2835[ "$OS" != "darwin" ] && check_gcc
2836[ "$OS" = "darwin" ] && check_xcode
[55347]2837if [ $ONLY_ADDITIONS -eq 0 ]; then
2838 check_open_watcom
2839 [ "$OS" != "darwin" ] && check_iasl
[87584]2840 [ $OSE -ge 1 ] && check_yasm
[55347]2841 [ "$OS" != "darwin" ] && check_xsltproc
2842fi
[1]2843
2844# the libraries
[55347]2845if [ $ONLY_ADDITIONS -eq 0 ]; then
2846 [ "$OS" != "darwin" ] && check_pthread
2847 check_libxml2
2848 [ $WITH_LIBIDL -eq 1 ] && check_libidl
[84900]2849 check_z
[85391]2850 check_lzf
[55347]2851 check_ssl
2852 check_curl
2853 [ $WITH_LIBVPX -eq 1 ] && check_vpx
[73369]2854 [ $WITH_LIBOPUS -eq 1 ] && check_libopus
[55347]2855 [ "$OS" != "darwin" ] && check_png
2856 [ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
[57789]2857 if [ $WITH_SDL -eq 1 ]; then
2858 check_sdl
2859 else
2860 cnf_append "VBOX_WITH_VBOXSDL" ""
2861 fi
[55347]2862 [ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2863 [ $WITH_X11 -eq 1 ] && check_x
2864 # TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2865 # TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2866 [ $WITH_X11 -eq 1 ] && check_xcursor
2867 [ $WITH_X11 -eq 1 ] && check_xinerama
2868 [ $WITH_X11 -eq 1 ] && check_xrandr
2869 [ $WITH_OPENGL -eq 1 ] && check_opengl
[59681]2870 [ $WITH_QT5 -eq 1 ] && check_qt5
[55347]2871 [ $WITH_PYTHON -eq 1 ] && check_python
2872 [ $WITH_JAVA -eq 1 ] && check_java
[1]2873
[55347]2874 # PulseAudio
[78022]2875 if [ $WITH_PULSE -eq 1 ]; then
2876 check_pulse
2877 elif [ $WITH_PULSE -eq 0 ]; then # Force disabling PulseAudio.
2878 cnf_append "VBOX_WITH_AUDIO_PULSE" ""
2879 elif [ $WITH_PULSE -eq 2 ]; then # --enable-pulse was passed, force PulseAudio.
2880 cnf_append "VBOX_WITH_AUDIO_PULSE" "1"
2881 fi
[25819]2882fi
2883
[1]2884# Linux-specific
[3163]2885if [ "$OS" = "linux" ]; then
[18084]2886 # don't check for the static libstdc++ in the PUEL version as we build the
2887 # additions at a dedicated box
2888 [ $OSE -ge 1 ] && check_staticlibstdcxx
[6157]2889 if [ $WITH_KMODS -eq 1 ]; then
2890 check_linux
2891 else
2892 cnf_append "VBOX_LINUX_SRC" ""
[70497]2893 cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
[6157]2894 fi
[55347]2895 if [ $ONLY_ADDITIONS -eq 0 ]; then
2896 if [ $WITH_ALSA -eq 1 ]; then
2897 check_alsa
2898 else
[63575]2899 cnf_append "VBOX_WITH_AUDIO_ALSA" ""
[55347]2900 fi
2901 if [ $WITH_DBUS -eq 0 ]; then
2902 cnf_append "VBOX_WITH_DBUS" ""
2903 fi
2904 if [ $WITH_DEVMAPPER -eq 1 ]; then
2905 check_libdevmapper
2906 else
2907 cnf_append "VBOX_WITH_DEVMAPPER" ""
2908 fi
2909 check_libcap
[8018]2910 fi
[3163]2911 check_compiler_h
[55347]2912 [ $ONLY_ADDITIONS -eq 0 -a "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
[31774]2913 # tools/common/makeself*
2914 [ $OSE -ge 1 ] && check_makeself
[3163]2915fi
[1]2916
[5041]2917[ -n "$SETUP_WINE" ] && setup_wine
2918
[90354]2919if [ $ONLY_ADDITIONS -eq 0 ]; then
[45613]2920 check_gsoap
2921else
[90354]2922 cnf_append "VBOX_WITH_WEBSERVICES" ""
[16144]2923fi
[16139]2924
[37199]2925# UDPTUNNEL
[55347]2926if [ $ONLY_ADDITIONS -eq 0 -a $WITH_UDPTUNNEL -eq 0 ]; then
[37199]2927 cnf_append "VBOX_WITH_UDPTUNNEL" ""
2928fi
2929
[28419]2930# VDE
[55347]2931if [ $ONLY_ADDITIONS -eq 0 -a "$OS" = "linux" -o "$OS" = "freebsd" ]; then
[28419]2932 if [ $WITH_VDE -eq 1 ]; then
2933 cnf_append "VBOX_WITH_VDE" "1"
2934 fi
2935fi
2936
[31852]2937# DOCS
[55347]2938if [ $ONLY_ADDITIONS -eq 1 -o $WITH_DOCS -eq 0 ]; then
[31852]2939 cnf_append "VBOX_WITH_DOCS" ""
2940 cnf_append "VBOX_WITH_DOCS_PACKING" ""
2941fi
2942
[36697]2943# VNC server support
[55347]2944if [ $ONLY_ADDITIONS -eq 0 -a $OSE -ge 1 ]; then
[36697]2945 if [ $WITH_VNC = 1 ]; then
2946 check_vncserver
2947 else
[40383]2948 cnf_append "VBOX_WITH_EXTPACK_VNC" ""
[36697]2949 fi
2950fi
2951
[55347]2952if [ $ONLY_ADDITIONS -eq 1 ]; then
2953 cnf_append "VBOX_ONLY_ADDITIONS" "1"
2954fi
2955
[1]2956# success!
2957echo
2958echo "Successfully generated '$CNF' and '$ENV'."
2959echo "Source '$ENV' once before you start to build VBox:"
[1513]2960echo ""
[1]2961echo " source $ENV"
2962echo " kmk"
[1513]2963echo ""
[1539]2964if [ "$OS" = "linux" ]; then
[90118]2965 if [ $OUT_BASE_PATH_OVERRIDE -eq 1 ]; then
2966 out_base_dir=$OUT_BASE_PATH
[16257]2967 else
[90118]2968 out_base_dir=.
[16257]2969 fi
[19129]2970 echo "To compile the kernel modules, do:"
[1539]2971 echo ""
[90118]2972 echo " cd $out_base_dir/out/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
[1539]2973 echo " make"
2974 echo ""
2975fi
[55347]2976if [ $ONLY_ADDITIONS -eq 1 ]; then
[11908]2977 echo ""
[55347]2978 echo " Tree configured to build only the Guest Additions"
2979 echo ""
2980elif [ $WITH_HARDENING -gt 0 ]; then
2981 echo ""
[11908]2982 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2983 echo " Hardening is enabled which means that the VBox binaries will not run from"
2984 echo " the binary directory. The binaries have to be installed suid root and some"
2985 echo " more prerequisites have to be fulfilled which is normally done by installing"
2986 echo " the final package. For development, the hardening feature can be disabled"
2987 echo " by specifying the --disable-hardening parameter. Please never disable that"
2988 echo " feature for the final distribution!"
2989 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2990 echo ""
2991else
2992 echo ""
2993 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2994 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2995 echo " disabled hardening!"
2996 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2997 echo ""
2998fi
[1]2999echo "Enjoy!"
3000cleanup
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use