VirtualBox

source: vbox/trunk/configure

Last change on this file was 101243, checked in by vboxsync, 7 months ago

configure: bugref:10450: Tweaking Qt6 support for configure script for macOS.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use