VirtualBox

source: vbox/trunk/configure@ 73351

Last change on this file since 73351 was 73343, checked in by vboxsync, 6 years ago

configure: remove the upper version limit in the gcc test and plan to
blacklist if necessary in future.
Thank you Gianfranco Costamagna.

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