VirtualBox

source: vbox/trunk/configure@ 66900

Last change on this file since 66900 was 66821, checked in by vboxsync, 8 years ago

configure/debian: by default stay with Qt requirement 5.3.2 but when building the Debian packages depend on Qt 5.6 or later

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