VirtualBox

source: vbox/trunk/configure@ 73250

Last change on this file since 73250 was 73138, checked in by vboxsync, 6 years ago

configure: allow Python 3.6. Thank you Gianfranco Costamagna.

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