VirtualBox

source: vbox/trunk/configure@ 70775

Last change on this file since 70775 was 70497, checked in by vboxsync, 7 years ago

configure: do not do kernel module test builds with --disable-kmods.
bugref:9088: Linux hosts: configure --disable-kmods requires kernel headers
As part of changes to make our kernel module test builds work with kernels
4.9 and later, kernel module test builds were moved from the main build
to test cases. The Make variables used to enable and disable them were also
changed, but configure --disable-kmods was not changed to reflect this.
This change fixes that and removes script from configure to disable test
builds with kernels 4.9 and later.
Thank you Ulrich Gemkow and Sérgio Basto.

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