VirtualBox

source: vbox/trunk/configure@ 84068

Last change on this file since 84068 was 83224, checked in by vboxsync, 5 years ago

bugref:9637. optional dlopen'ing libXrandr instead of linking. part-2

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