VirtualBox

source: vbox/trunk/configure@ 108242

最後變更 在這個檔案從108242是 108242,由 vboxsync 提交於 4 週 前

configure,Config.kmk: Drop the iasl dependency, bugref:10733 [second attempt]

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette