VirtualBox

source: vbox/trunk/configure@ 80114

Last change on this file since 80114 was 79836, checked in by vboxsync, 5 years ago

configure: use colons where needed in LD_LIBRARY_PATH.
ticketref:18722: ./configure: Spaces in LD_LIBRARY_PATH should be : (colons)
In the configure script we were passing LD_LIBRARY_PATH a space-separated
list of paths to load Qt. As there was usually only one path in the list
this did not get noticed. Fix by replacing the spaces by colons.
Thank you Lars Nordenström.

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