VirtualBox

source: vbox/trunk/configure@ 72196

Last change on this file since 72196 was 71337, checked in by vboxsync, 6 years ago

configure: Add SPARC for the CPU detection

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

© 2023 Oracle
ContactPrivacy policyTerms of Use