VirtualBox

source: vbox/trunk/configure@ 109281

Last change on this file since 109281 was 109228, checked in by vboxsync, 11 days ago

Config.kmk,configure: Attempt at getting the svn revision from a git commit log in case the source code is from a git repository, bugref:10900

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

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