VirtualBox

source: vbox/trunk/configure@ 67112

Last change on this file since 67112 was 67067, checked in by vboxsync, 8 years ago

drop VBOX_WITH_QTGUI_V5 and friends

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