VirtualBox

source: vbox/trunk/configure

最後變更 在這個檔案是 108322,由 vboxsync 提交於 3 週 前

libs/xpcom18a4: Replace xpidl with xpidl-new which enables us to drop the dreaded libIDL dependency (library is dead for well over a decade), bugref:10321

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

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