VirtualBox

source: vbox/trunk/configure@ 85416

Last change on this file since 85416 was 85391, checked in by vboxsync, 4 years ago

configure: Use system-provided liblzf if available, otherwise fall back to building/using in-tree one.

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