VirtualBox

source: vbox/trunk/configure@ 91555

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

Config.kmk,configure: Add check for libtpms dependency required for the virtual TPM, bugref:10075

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

© 2023 Oracle
ContactPrivacy policyTerms of Use