VirtualBox

source: vbox/trunk/configure@ 75163

Last change on this file since 75163 was 74653, checked in by vboxsync, 6 years ago

IPRT: Try shut up xmlFree linker warning.

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