VirtualBox

source: vbox/trunk/configure@ 87614

Last change on this file since 87614 was 87614, checked in by vboxsync, 4 years ago

/configure: Improvements mainly for macOS. Can now deal with just the command line tools (VirtualBox never needed the full Xcode), looking in the appropriate place when no Xcode directory is specified. Added Big Sur.

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

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