VirtualBox

source: vbox/trunk/configure@ 86694

Last change on this file since 86694 was 86228, checked in by vboxsync, 4 years ago

configure: reflect the big changes in 3D since 5.2/6.0

  • 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 else
1440 check_xmu
1441 check_mesa
1442 fi
1443}
1444
1445
1446#
1447# Check for the Xmu library, needed by OpenGL
1448#
1449check_xmu()
1450{
1451 test_header Xmu
1452 cat > $ODIR.tmp_src.cc << EOF
1453#include <cstdio>
1454#include <X11/Xatom.h>
1455#include <X11/Xlib.h>
1456#include <X11/Xutil.h>
1457#include <X11/Xmu/StdCmap.h>
1458extern "C" int main(void)
1459{
1460 Display *dpy;
1461 int scrn_num;
1462 Screen *scrn;
1463
1464 dpy = XOpenDisplay(NULL);
1465 if (dpy)
1466 {
1467 scrn_num = DefaultScreen(dpy);
1468 scrn = ScreenOfDisplay(dpy, scrn_num);
1469 Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
1470 24, XA_RGB_DEFAULT_MAP, False, True);
1471 printf("Status = %x\n", status);
1472 XCloseDisplay(dpy);
1473 }
1474 return 0;
1475}
1476EOF
1477 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1478 if test_compile "$LIBX11 $LIBXMU $I_INCX11" Xmu Xmu; then
1479 log_success "found"
1480 cnf_append "VBOX_XMU_LIBS" "`strip_l "$LIBXMU"`"
1481 fi
1482}
1483
1484#
1485# Check for Mesa, needed by OpenGL
1486#
1487check_mesa()
1488{
1489 test_header "Mesa / GLU"
1490 cat > $ODIR.tmp_src.cc << EOF
1491#include <cstdio>
1492#include <X11/Xlib.h>
1493#include <GL/glx.h>
1494#include <GL/glu.h>
1495extern "C" int main(void)
1496{
1497 Display *dpy;
1498 int major, minor;
1499
1500 dpy = XOpenDisplay(NULL);
1501 if (dpy)
1502 {
1503 Bool glx_version = glXQueryVersion(dpy, &major, &minor);
1504 XCloseDisplay(dpy);
1505 if (glx_version)
1506 {
1507 printf("found version %u.%u, OK.\n", major, minor);
1508 return 0;
1509 }
1510 }
1511 printf("found (inactive), OK.\n");
1512 return 0;
1513}
1514EOF
1515 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1516 if test_compile "$LIBX11 $MESA $I_INCX11" Mesa Mesa; then
1517 [ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
1518 test_execute
1519 fi
1520}
1521
1522
1523#
1524# Check for the Qt5 library, needed by the VirtualBox frontend
1525#
1526# Currently not fatal.
1527#
1528check_qt5()
1529{
1530 foundqt5=
1531 test_header Qt5
1532 cat > $ODIR.tmp_src.cc << EOF
1533#include <QtGlobal>
1534extern "C" int main(void)
1535{
1536EOF
1537 echo "#if QT_VERSION >= $(($QT5MAJ*65536+$QT5MIN*256))" >> $ODIR.tmp_src.cc
1538 cat >> $ODIR.tmp_src.cc << EOF
1539 return 0;
1540#else
1541 return 1;
1542#endif
1543}
1544EOF
1545 if [ "$OS" = "darwin" ]; then
1546 # First check if there is the internal version of Qt. If yes nothing else
1547 # has to be done.
1548 QT_INTERNAL=`/bin/ls -rd1 $PWD/tools/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
1549 for t in $QT_INTERNAL; do
1550 if [ -f "$t/Frameworks/QtCoreVBox.framework/QtCoreVBox" ]; then
1551 cnf_append "VBOX_WITH_ORACLE_QT" "1"
1552 log_success "use internal version"
1553 return
1554 fi
1555 done
1556 # Now try the user provided directory and some of the standard directories.
1557 QT_TRIES="$QT5DIR /System/Library /Library"
1558 for t in $QT_TRIES; do
1559 if [ -f "$t/Frameworks/QtCore.framework/QtCore" -o -f "$t/clang_64/lib/QtCore.framework/QtCore" ]; then
1560 PATH_SDK_QT5="$t"
1561 foundqt5=1
1562 break
1563 fi
1564 done
1565 # Add the necessary params for building the test application
1566 if [ -n "$PATH_SDK_QT5" ]; then
1567 if [ -f "$t/clang_64/lib/QtCore.framework/QtCore" ]; then
1568 INCQT5=-I$PATH_SDK_QT5/clang_64/lib/QtCore.framework/Headers
1569 LIBQT5=-F$PATH_SDK_QT5/clang_64/lib
1570 SDKQT5=$PATH_SDK_QT5/clang_64
1571 else
1572 INCQT5=-I$PATH_SDK_QT5/Frameworks/QtCore.framework/Headers
1573 LIBQT5=-F$PATH_SDK_QT5/Frameworks
1574 SDKQT5=$PATH_SDK_QT5
1575 fi
1576 FLGQT5="-framework QtCore -std=c++11 -Wl,-rpath,`L_to_PATH "$LIBQT5"`"
1577 else
1578 log_failure "Qt5 framework not found (can be disabled using --disable-qt)"
1579 fail
1580 fi
1581 else # !darwin
1582 if [ $QT5DIR_PKGCONFIG -eq 1 ]; then
1583 # Default is to use pkg-config:
1584 if which_wrapper pkg-config > /dev/null; then
1585 qt5_ver=`pkg-config Qt5Core --modversion 2>> $LOG`
1586 if [ $? -eq 0 ]; then
1587 echo "(Qt5 from pkg-config)" >> $LOG
1588 FLGQT5=`pkg-config Qt5Core --cflags`
1589 # gcc 4.8 is able to compile with C++11 (see also VBOX_GCC_std in Config.kmk)
1590 [ $cc_maj -eq 4 -a $cc_min -eq 8 ] && FLGQT5="$FLGQT5 -std=c++11"
1591 INCQT5=`strip_I "$FLGQT5"`
1592 LIBDIR5=`pkg-config Qt5Core --variable=libdir`
1593 LIBQT5=`pkg-config Qt5Core --libs`
1594 LIBQT5="-L$LIBDIR5 $LIBQT5"
1595 TOOLQT5=`pkg-config Qt5Core --variable=prefix`
1596 TOOLQT5BIN=`pkg-config Qt5Core --variable=host_bins`
1597 if test_compile "$LIBQT5 $LIBPTHREAD $FLGQT5" qt5 qt5 nofatal; then
1598 test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal && foundqt5=3 # pkg-config
1599 fi
1600 fi
1601 else
1602 log_failure "pkg-config not found"
1603 fail
1604 fi
1605 fi
1606 if [ -z "$foundqt5" ]; then
1607 # Do it the old way (e.g. user has specified QT5DIR):
1608 for q in $QT5DIR "$PWD/tools/linux.$TARGET_MACHINE"/qt/v5.*; do
1609 echo "(Qt5 from '$q')" >> $LOG
1610 INCQT5="$q/include $q/include/QtCore"
1611 FLGQT5="-DQT_SHARED"
1612 I_INCQT5=`prefix_I "$INCQT5"`
1613 LIBQT5="-L$q/lib -lQt5CoreVBox"
1614 TOOLQT5="$q"
1615 if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal &&
1616 test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal; then
1617 foundqt5=2 # internal
1618 break;
1619 fi
1620 LIBQT5="-L$q/lib -lQt5Core"
1621 if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal &&
1622 test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal; then
1623 foundqt5=1 # no pkg-config, Qt directory
1624 break;
1625 fi
1626 done
1627 fi
1628 fi
1629 if [ -n "$foundqt5" ]; then
1630 # We decided which version of Qt to use, now enforce the version requirement:
1631 cat > $ODIR.tmp_src.cc << EOF
1632#include <cstdio>
1633#include <QtGlobal>
1634extern "C" int main(void)
1635{
1636 printf("found version %s", QT_VERSION_STR);
1637EOF
1638 echo "#if QT_VERSION >= $(($QT5MAJ*65536+$QT5MIN*256))" >> $ODIR.tmp_src.cc
1639 cat >> $ODIR.tmp_src.cc << EOF
1640 printf(", OK.\n");
1641 return 0;
1642#else
1643EOF
1644echo " printf(\", expected version $QT5MAJ.$QT5MIN or higher\\\\n\");" >> $ODIR.tmp_src.cc
1645 cat >> $ODIR.tmp_src.cc << EOF
1646 return 1;
1647#endif
1648}
1649EOF
1650 [ -n "$INCQT5" ] && I_INCQT5=`prefix_I "$INCQT5"`
1651 if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal; then
1652 if test_execute_path "`L_to_PATH "$LIBQT5"`"; then
1653 if [ "$OS" = "darwin" ]; then
1654 # Successful build & run the test application so add the necessary
1655 # params to AutoConfig.kmk:
1656 cnf_append "PATH_SDK_QT5_INC" "`L_to_PATH "$LIBQT5"`"
1657 cnf_append "PATH_SDK_QT5_LIB" "`L_to_PATH "$LIBQT5"`"
1658 cnf_append "PATH_SDK_QT5" "$SDKQT5"
1659 # Check for the moc tool in the Qt directory found & some standard
1660 # directories.
1661 for q in $PATH_SDK_QT5 $PATH_SDK_QT5/clang_64 /usr /Developer/Tools/Qt; do
1662 if which_wrapper "$q/bin/moc" > /dev/null; then
1663 cnf_append "PATH_TOOL_QT5_BIN" "$q/bin"
1664 fi
1665 done
1666 else
1667 # Strip .../QtCore as we add components ourself:
1668 INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1669 # store only the first path, remove all other paths
1670 # most likely pkg-config gave us -I/usr/include/qt5 -I/usr/include/qt5/QtCore
1671 INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1672 cnf_append "VBOX_PATH_QT_LIB" "`strip_L "$LIBQT5"`"
1673 cnf_append "PATH_SDK_QT5_INC" "$INCQT5"
1674 # This is not quite right since the qt libpath does not have to be first...
1675 cnf_append "PATH_SDK_QT5_LIB" '$'"(firstword `strip_L "$LIBQT5"`)"
1676 if [ "$foundqt5" = "2" ]; then
1677 cnf_append "VBOX_WITH_ORACLE_QT" "1"
1678 fi
1679 if [ "$foundqt5" != "3" ]; then
1680 TOOLQT5BIN="$TOOLQT5/bin"
1681 fi
1682 test_header "Qt5 devtools"
1683 # Try it with a suffix, some platforms use that
1684 if which_wrapper "$TOOLQT5BIN/moc-qt5" > /dev/null; then
1685 QT5BINSUFF="-qt5"
1686 else
1687 QT5BINSUFF=""
1688 fi
1689 moc_ver=`$TOOLQT5BIN/moc$QT5BINSUFF -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1690 if [ $? -ne 0 ]; then
1691 log_failure "moc$QT5BINSUFF not working"
1692 fail
1693 else
1694 log_success "found version $moc_ver"
1695 cnf_append "VBOX_PATH_QT" "$TOOLQT5"
1696 cnf_append "PATH_SDK_QT5" "$TOOLQT5"
1697 cnf_append "PATH_TOOL_QT5_BIN" "$TOOLQT5BIN"
1698 [ -n "$QT5BINSUFF" ] && cnf_append "TOOL_QT5_BIN_SUFF" "$QT5BINSUFF"
1699 fi
1700 fi
1701 fi
1702 else
1703 log_failure "qt5 not working"
1704 fail
1705 fi
1706 else
1707 log_failure "qt5 not found"
1708 fail
1709 fi
1710}
1711
1712
1713#
1714# Check for libopus
1715#
1716check_libopus()
1717{
1718 if [ -z "$BUILD_LIBOPUS" ]; then
1719 test_header libopus
1720 if which_wrapper pkg-config > /dev/null; then
1721 libopus_ver=`pkg-config opus --modversion 2>> $LOG`
1722 if [ $? -eq 0 ]; then
1723 FLGOPUS=`pkg-config opus --cflags`
1724 INCOPUS=`strip_I "$FLGOPUS"`
1725 LIBOPUS=`pkg-config opus --libs`
1726 fi
1727 cat > $ODIR.tmp_src.cc << EOF
1728#include <cstdio>
1729#include <opus/opus.h>
1730extern "C" int main(void)
1731{
1732 OpusEncoder *test;
1733 printf("found, OK.\n");
1734}
1735EOF
1736 [ -n "$INCOPUS" ] && I_INCOPUS=`prefix_I "$INCOPUS"`
1737 if test_compile "$LIBOPUS $I_INCOPUS" opus opus; then
1738 if test_execute; then
1739 cnf_append "SDK_VBOX_OPUS_INCS" "$INCOPUS"
1740 cnf_append "SDK_VBOX_OPUS_LIBS" "`strip_l "$LIBOPUS"`"
1741 fi
1742 fi
1743 fi
1744 fi
1745}
1746
1747
1748#
1749# Check for libvpx
1750#
1751check_vpx()
1752{
1753 if [ -z "$BUILD_LIBVPX" ]; then
1754 test_header libvpx
1755 if which_wrapper pkg-config > /dev/null; then
1756 libvpx_ver=`pkg-config vpx --modversion 2>> $LOG`
1757 if [ $? -eq 0 ]; then
1758 FLGVPX=`pkg-config vpx --cflags`
1759 INCVPX=`strip_I "$FLGVPX"`
1760 LIBVPX=`pkg-config vpx --libs`
1761 fi
1762 cat > $ODIR.tmp_src.cc << EOF
1763#include <cstdio>
1764#include <vpx/vpx_codec.h>
1765extern "C" int main(void)
1766{
1767 int version = vpx_codec_version();
1768 int verMajor = VPX_VERSION_MAJOR(version);
1769 int verMinor = VPX_VERSION_MINOR(version);
1770 int verPatch = VPX_VERSION_PATCH(version);
1771 printf("found version %d.%d.%d", verMajor, verMinor, verPatch);
1772 if ( verMajor == 1 && verMinor >= 0
1773 || verMajor == 0 && verMinor == 9 && verPatch >= 5)
1774 {
1775 printf(", OK.\n");
1776 return 0;
1777 }
1778 else
1779 {
1780 printf(", expected version 0.9.5 or higher\n");
1781 return 1;
1782 }
1783}
1784EOF
1785 [ -n "$INCVPX" ] && I_INCVPX=`prefix_I "$INCVPX"`
1786 if test_compile "$LIBVPX $I_INCVPX" vpx vpx; then
1787 if test_execute; then
1788 cnf_append "SDK_VBOX_VPX_INCS" "$INCVPX"
1789 cnf_append "SDK_VBOX_VPX_LIBS" "`strip_l "$LIBVPX"`"
1790 fi
1791 fi
1792 fi
1793 fi
1794}
1795
1796
1797#
1798# Check whether static libstdc++ is installed. This library is required
1799# for the Linux guest additions.
1800#
1801check_staticlibstdcxx()
1802{
1803 test_header "static stc++ library"
1804 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1805 cat > $ODIR.tmp_src.cc << EOF
1806#include <string>
1807
1808extern "C" int main(void)
1809{
1810 std::string s = "test";
1811 return 0;
1812}
1813EOF
1814 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1815 log_success "found"
1816 fi
1817}
1818
1819
1820#
1821# Check for Linux sources
1822#
1823check_linux()
1824{
1825 test_header "Linux kernel sources"
1826 cat > $ODIR.tmp_src.c << EOF
1827#include <linux/version.h>
1828int printf(const char *format, ...);
1829int main(void)
1830{
1831 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1832 (LINUX_VERSION_CODE % 65536) / 256,
1833 LINUX_VERSION_CODE % 256);
1834#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1835 printf(", OK.\n");
1836 return 0;
1837#else
1838 printf(", expected version 2.4.0 or higher\n");
1839 return 1;
1840#endif
1841}
1842EOF
1843 echo "compiling the following source file:" >> $LOG
1844 cat $ODIR.tmp_src.c >> $LOG
1845 echo "using the following command line:" >> $LOG
1846 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include " \
1847 "-I$LINUX/include/generated/uapi" >> $LOG
1848 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include \
1849 -I$LINUX/include/generated/uapi >> $LOG 2>&1
1850 if [ $? -ne 0 ]; then
1851 echo
1852 echo " Linux kernel headers not found at $LINUX"
1853 echo " Check the file $LOG for detailed error information."
1854 fail
1855 else
1856 if test_execute; then
1857 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1858 fi
1859 fi
1860}
1861
1862#
1863# Check for kchmviewer, needed to display the online help
1864# (unused as we ship kchmviewer)
1865#
1866check_kchmviewer()
1867{
1868 test_header kchmviewer
1869 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1870 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1871 if [ $? -ne 0 ]; then
1872 log_failure "kchmviewer not working"
1873 fail
1874 else
1875 log_success "found version $kchmviewer_ver"
1876 fi
1877 fi
1878}
1879
1880
1881#
1882# Check for the kBuild tools, we don't support GNU make
1883#
1884check_kbuild()
1885{
1886 test_header kBuild
1887 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1888 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1889
1890 echo "KBUILD_PATH=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1891 echo "KBUILD_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1892 echo 'path_kbuild_bin="$KBUILD_PATH/bin/$BUILD_TARGET.$BUILD_PLATFORM_ARCH"' >> $ENV
1893 echo 'path_tools_bin="$KBUILD_DEVTOOLS/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/bin"' >> $ENV
1894
1895 if [ "$OS" = "solaris" ]; then
1896 # Because of sh being non-default shell in Solaris we need to export PATH again when
1897 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1898 echo "PATH=\"$ORGPATH\"" >> $ENV
1899 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1900 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_tools_bin\" || PATH=\"\$path_tools_bin:\$PATH\"" >> $ENV
1901 else
1902 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1903 echo "echo \"\$PATH\" | grep -q \"\$path_tools_bin\" || PATH=\"\$path_tools_bin:\$PATH\"" >> $ENV
1904 fi
1905 echo "export KBUILD_PATH KBUILD_DEVTOOLS PATH" >> $ENV
1906 echo "unset path_kbuild_bin path_tools_bin" >> $ENV
1907 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1908
1909 echo '' >> $ENV
1910 echo "# Legacy - do not use:" >> $ENV
1911 echo 'PATH_KBUILD=${KBUILD_PATH}' >> $ENV
1912 echo 'PATH_DEVTOOLS=${KBUILD_DEVTOOLS}' >> $ENV
1913 echo 'export PATH_KBUILD PATH_DEVTOOLS' >> $ENV
1914 echo '' >> $ENV
1915 elif check_avail "kmk" KBUILDDIR really; then
1916 # check for installed kBuild
1917 KBUILD_SED="`which_wrapper kmk_sed`"
1918 else
1919 fail
1920 fi
1921 log_success "found"
1922}
1923
1924
1925#
1926# Check for compiler.h
1927# Some Linux distributions include "compiler.h" in their libc linux
1928# headers package, some don't. Most don't need it, building might (!)
1929# not succeed on openSUSE without it.
1930#
1931# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1932#
1933check_compiler_h()
1934{
1935 test_header compiler.h
1936 if test ! -f "/usr/include/linux/compiler.h"; then
1937 log_success "compiler.h not found"
1938 else
1939 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1940 log_success "compiler.h found"
1941 fi
1942}
1943
1944#
1945# Check for libcap.
1946# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1947# sockets for doing ICMP requests.
1948#
1949check_libcap()
1950{
1951 test_header "libcap library"
1952 cat > $ODIR.tmp_src.cc << EOF
1953#include <cstdio>
1954#include <sys/types.h>
1955#include <linux/types.h>
1956#include <sys/capability.h>
1957
1958extern "C" int main(void)
1959{
1960 char buf[1024];
1961 cap_t caps = cap_get_proc();
1962 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1963 return 0;
1964}
1965EOF
1966 if test_compile $LIBCAP libcap libcap; then
1967 if test_execute; then
1968 log_success "found"
1969 fi
1970 fi
1971}
1972
1973#
1974# Check if we are able to build 32-bit applications (needed for the guest additions)
1975#
1976check_32bit()
1977{
1978 test_header "32-bit support"
1979 cat > $ODIR.tmp_src.c << EOF
1980#include <stdint.h>
1981int main(void)
1982{
1983 return 0;
1984}
1985EOF
1986 echo "compiling the following source file:" >> $LOG
1987 cat $ODIR.tmp_src.c >> $LOG
1988 echo "using the following command line:" >> $LOG
1989 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1990 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1991 if [ $? -ne 0 ]; then
1992 echo
1993 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1994 echo " Check the file $LOG for detailed error information."
1995 fail
1996 else
1997 echo "executing the binary" >> $LOG
1998 $ODIR.tmp_out 2> $ODIR.test_execute.log
1999 rc=$?
2000 cat $ODIR.test_execute.log >> $LOG
2001 if [ $rc -ne 0 ]; then
2002 echo
2003 echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
2004 echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
2005 fail
2006 return 1
2007 fi
2008 fi
2009 log_success ""
2010}
2011
2012
2013#
2014# Check for Python
2015#
2016check_python()
2017{
2018 test_header "Python support"
2019
2020 # On darwin this is a on/off decision only
2021 if [ "$OS" = "darwin" ]; then
2022 echo "enabled"
2023 cnf_append "VBOX_WITH_PYTHON" "1"
2024 return
2025 fi
2026
2027 cat > $ODIR.tmp_src.cc << EOF
2028#include <cstdio>
2029#include <Python.h>
2030extern "C" int main(void)
2031{
2032 Py_Initialize();
2033 printf("found version %s", PY_VERSION);
2034#if PY_VERSION_HEX >= 0x02060000
2035 printf(", OK.\n");
2036 return 0;
2037#else
2038 printf(", expected version 2.6 or higher\n");
2039 return 1;
2040#endif
2041}
2042EOF
2043 found=
2044 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"
2045 for p in $PYTHONDIR; do
2046 for d in $SUPPYTHONLIBS; do
2047 for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
2048 echo "compiling the following source file:" >> $LOG
2049 cat $ODIR.tmp_src.cc >> $LOG
2050 echo "using the following command line:" >> $LOG
2051 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
2052 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
2053 if [ $? -eq 0 ]; then
2054 found=1
2055 break
2056 fi
2057 done
2058 if [ -n "$found" ]; then break; fi
2059 done
2060 if [ -n "$found" ]; then break; fi
2061 done
2062 if [ -n "$found" ]; then
2063 if test_execute; then
2064 cnf_append "VBOX_WITH_PYTHON" "1"
2065 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
2066 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
2067 else
2068 log_failure "Python not working"
2069 fail
2070 fi
2071 else
2072 log_failure "Python not found"
2073 fail
2074 fi
2075}
2076
2077
2078#
2079# Check for Java
2080#
2081check_java()
2082{
2083 test_header "Java support"
2084 log_success
2085}
2086
2087
2088#
2089# Setup wine
2090#
2091setup_wine()
2092{
2093 test_header "Wine support"
2094 if ! which_wrapper wine > /dev/null; then
2095 echo " wine binary not found"
2096 fail
2097 fi
2098 if ! which_wrapper wine > /dev/null; then
2099 echo " wine not found"
2100 fail
2101 fi
2102 wine_version="`wine --version`"
2103 case "`expr "$wine_version" : 'wine-\([0-9.]*\)' '>' 1.1.43`" in
2104 "0")
2105 if ! which_wrapper wineprefixcreate > /dev/null; then
2106 echo " wineprefixcreate not found"
2107 fail
2108 fi
2109 ;;
2110 *) eval "wineprefixcreate() { true ; }" ;; # now created automatically
2111 esac
2112 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
2113 echo "WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
2114 echo "export WINEPREFIX" >> $ENV
2115 rm -rf $WINEPREFIX
2116 mkdir -p $WINEPREFIX
2117 touch $WINEPREFIX/.no_prelaunch_window_flag
2118 if ! wineprefixcreate -q > /dev/null 2>&1; then
2119 echo " wineprefixcreate failed"
2120 fail
2121 fi
2122 tmp=.tmp.wine.reg
2123 rm -f $tmp
2124 echo 'REGEDIT4' > $tmp
2125 echo '' >> $tmp
2126 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
2127 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
2128 echo '' >> $tmp
2129 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
2130 echo '"itss"="native"' >> $tmp
2131 echo '' >> $tmp
2132 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
2133 echo '"itss"="native"' >> $tmp
2134 echo '' >> $tmp
2135 if ! wine regedit $tmp > /dev/null 2>&1; then
2136 rm -f $tmp
2137 echo " failed to load registry changes (path)."
2138 fail
2139 fi
2140 rm -f $tmp
2141 log_success "found"
2142}
2143
2144
2145#
2146# Check for gSOAP.
2147#
2148check_gsoap()
2149{
2150 test_header "GSOAP compiler"
2151 if [ -z "$GSOAP" -a -z "$GSOAP_IMPORT" ]; then
2152 if which_wrapper pkg-config > /dev/null; then
2153 GSOAP_CXX_LIBS=`pkg-config gsoapssl++ --libs 2>> $LOG`
2154 if [ $? -eq 0 ]; then
2155 GSOAP=`pkg-config gsoapssl++ --variable=exec_prefix`
2156 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2157 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2158 GSOAP_IMPORT="$GSOAP/include/gsoap"
2159 fi
2160 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2161 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2162 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2163 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2164 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2165 else
2166 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2167 fi
2168 cnf_append "VBOX_GSOAP_CXX_LIBS" "`strip_l "$GSOAP_CXX_LIBS"`"
2169 gsoap_version=`pkg-config gsoapssl++ --modversion`
2170 log_success "found version $gsoap_version"
2171 return
2172 fi
2173 fi
2174 fi
2175 if [ -z "$GSOAP" ]; then
2176 GSOAP="/usr"
2177 fi
2178 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
2179 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
2180 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
2181 # TODO: Check for libgsoap++.a/so
2182
2183 if [ -z "$GSOAP_IMPORT" ]; then
2184 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
2185 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
2186 GSOAP_IMPORT="$GSOAP/include/gsoap"
2187 fi
2188 fi
2189 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
2190 cnf_append "VBOX_GSOAP_INSTALLED" "1"
2191 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
2192 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
2193 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
2194 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
2195 else
2196 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
2197 fi
2198 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoapssl++"
2199 log_success "found"
2200 else
2201 log_failure "stlvector.h not found -- disabling webservice"
2202 cnf_append "VBOX_WITH_WEBSERVICES" ""
2203 fi
2204 else
2205 log_failure "stdsoap2.h not found -- disabling webservice"
2206 cnf_append "VBOX_WITH_WEBSERVICES" ""
2207 fi
2208 else
2209 log_failure "wsdl2h not found -- disabling webservice"
2210 cnf_append "VBOX_WITH_WEBSERVICES" ""
2211 fi
2212 else
2213 log_failure "soapcpp2 not found -- disabling webservice"
2214 cnf_append "VBOX_WITH_WEBSERVICES" ""
2215 fi
2216}
2217
2218
2219#
2220# Check Xcode path
2221#
2222check_xcode_sdk_path()
2223{
2224 # Check if WITH_XCODE_DIR is set.
2225 if [ -z "$WITH_XCODE_DIR" ]; then
2226 echo "Please specify --with-xcode-dir option."
2227 return 0
2228 fi
2229
2230 # Check if specified path exists and is a directory containing Xcode.
2231 if [ -d "$1" -a -f "$1/Contents/Developer/usr/bin/xcodebuild" ]; then
2232 return 1
2233 else
2234 echo "Xcode path [$1] not found."
2235 return 0
2236 fi
2237}
2238
2239#
2240# Determines the Darwin version.
2241# @todo This should really check the Xcode/SDK version.
2242#
2243check_darwinversion()
2244{
2245 test_header "Darwin version"
2246 darwin_ver=`uname -r`
2247 case "$darwin_ver" in
2248 19\.*)
2249 darwin_ver="10.15" # Catalina
2250 ;;
2251 18\.*)
2252 darwin_ver="10.14" # Mojave
2253 ;;
2254 17\.*)
2255 darwin_ver="10.13" # High Sierra
2256 ;;
2257 16\.*)
2258 darwin_ver="10.12" # Sierra
2259 ;;
2260 15\.*)
2261 darwin_ver="10.11" # El Capitan
2262 ;;
2263 14\.*)
2264 darwin_ver="10.10" # Yosemite
2265 ;;
2266 13\.*)
2267 darwin_ver="10.9" # Mavericks
2268 ;;
2269 *)
2270 echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
2271 fail
2272 darwin_ver="unknown"
2273 ;;
2274 esac
2275
2276 check_xcode_sdk_path "$WITH_XCODE_DIR"
2277 [ $? -eq 1 ] || fail
2278
2279 # Pick the oldest SDK offered by Xcode, to get maximum compatibility
2280 devel_subdir="$WITH_XCODE_DIR/Contents/Developer"
2281 sdk_subdir="$devel_subdir/Platforms/MacOSX.platform/Developer/SDKs"
2282 sdk_tries="$sdk_subdir"/MacOSX10.?.sdk" $sdk_subdir"/MacOSX10.??.sdk" $sdk_subdir"/MacOSX.sdk
2283 for t in $sdk_tries; do
2284 if [ -f "$t/SDKSettings.plist" ]; then
2285 sdk="$t"
2286 sdk_ver=`defaults read "$t/SDKSettings.plist" Version`
2287 break
2288 fi
2289 done
2290 if [ -z "$sdk" ]; then
2291 echo " failed to determine SDK directory. ($sdk_subdir/MacOSX*.sdk/SDKSettings.plist should exist)"
2292 fail
2293 fi
2294
2295 cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
2296 cnf_append "PATH_TOOL_VBoxXcode62" "$devel_subdir"
2297 cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$devel_subdir"
2298 cnf_append "VBOX_PATH_MACOSX_SDK" "$sdk"
2299 if [ -n "$sdk_ver" ]; then
2300 cnf_append "VBOX_DEF_MACOSX_VERSION_MIN" "$sdk_ver"
2301 cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
2302 fi
2303
2304 log_success "found version $darwin_ver (SDK: $sdk)"
2305}
2306
2307
2308check_makeself()
2309{
2310 test_header "makeself"
2311 if check_avail "$MAKESELF" makeself; then
2312 makeself_ver=`$MAKESELF --version|grep version|sed 's+^Makeself.*version \([0-9\.]*\).*+\1+'`
2313 if [ $? -ne 0 ]; then
2314 log_failure "makeself not working"
2315 fail
2316 else
2317 log_success "found version $makeself_ver"
2318 cnf_append "VBOX_MAKESELF" "`which_wrapper $MAKESELF`"
2319 fi
2320 fi
2321}
2322
2323
2324#
2325# Show help
2326#
2327show_help()
2328{
2329cat << EOF
2330Usage: ./configure [OPTIONS]...
2331
2332Configuration:
2333 -h, --help display this help and exit
2334 --nofatal don't abort on errors
2335EOF
2336[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
2337[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
2338[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
2339[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
2340[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
2341[ $WITH_QT5 -eq 1 ] && echo " --disable-qt disable Qt detection"
2342[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
2343[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
2344[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
2345[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
2346[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
2347[ $WITH_QT5 -eq 0 ] && echo " --enable-qt5 enable Qt5 detection"
2348[ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
2349[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
2350[ $OSE -eq 0 ] && echo " --disable-extpack don't build the extpack"
2351[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
2352[ $WITH_LIBVPX -eq 1 ] && echo " --disable-libvpx don't use libvpx for video capturing"
2353[ $WITH_LIBOPUS -eq 1 ] && echo " --disable-libopus don't use libopus for audio capturing"
2354[ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
2355cat << EOF
2356 --disable-udptunnel disable UDP tunnel networking
2357 --disable-devmapper disable device mapper library access
2358 --disable-hardening don't be strict about /dev/vboxdrv access
2359 --build-libxml2 build libxml2 from sources
2360 --build-libssl build openssl from sources
2361EOF
2362[ $OSE -eq 0 ] && cat << EOF
2363 --build-libcurl build libcurl from sources
2364 --build-libvpx build libvpx from sources
2365EOF
2366[ "$OS" != "darwin" ] && echo " --setup-wine setup a Wine directory and register the hhc hack"
2367cat << EOF
2368 --only-additions only build the Guest Additions
2369
2370Paths:
2371 --with-gcc=PATH location of the gcc compiler [$CC]
2372 --with-g++=PATH location of the g++ compiler [$CXX]
2373 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
2374 --with-iasl=PATH location of the iasl compiler [$IASL]
2375 --with-makeself=PATH location of makeself [$MAKESELF]
2376EOF
2377[ "$OS" = "darwin" ] && echo " --with-xcode-dir=DIR custom path to Xcode root directory; it is assumed that Xcode"
2378[ "$OS" = "darwin" ] && echo " contains OS X 10.6 SDK (required for Mountain Lion and newer hosts"
2379[ "$OS" = "darwin" ] && echo " only, ignored for the rest)"
2380[ "$OS" = "linux" ] && echo " --with-linux=DIR Linux kernel source directory [$LINUX]"
2381[ $WITH_QT5 -eq 1 ] && echo " --with-qt-dir=DIR directory for Qt headers/libraries [pkgconfig]"
2382[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
2383[ $WITH_GSOAP -eq 1 ] && echo " (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
2384[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
2385cat << EOF
2386 --with-openssl-dir=DIR directory for OpenSSL headers/libraries
2387 --with-ow-dir=DIR directory where Open Watcom can be found [$WATCOM]
2388 --out-path=PATH the folder to which configuration and build output
2389 should go
2390
2391Build type:
2392 -d, --build-debug build with debugging symbols and assertions
2393 --build-profile build with profiling support
2394 --build-headless build headless (without any GUI frontend)
2395EOF
2396 exit 0
2397}
2398
2399
2400#
2401# The body.
2402#
2403
2404# test if we are OSE
2405if [ $OSE -eq 1 -a -r "`cd \`dirname $0\`; pwd`/src/VBox/RDP/server/server.cpp" ]; then
2406 OSE=0
2407 # Set this as a reminder to print a log message once we know the path of the
2408 # log file
2409 NOT_OSE=1
2410fi
2411
2412# Change OS specific defaults; must be before all other stuff
2413if [ "$OS" = "darwin" ]; then
2414 WITH_SDL=0
2415 WITH_SDL_TTF=0
2416 WITH_X11=0
2417 WITH_ALSA=0
2418 WITH_PULSE=0
2419 WITH_DBUS=0
2420 WITH_KMODS=0
2421 BUILD_LIBXML2=1
2422 BUILD_LIBSSL=1
2423 BUILD_LIBVPX=1
2424 [ $OSE -eq 1 ] || BUILD_LIBCURL=1
2425 [ $OSE -eq 1 ] && WITH_LIBVPX=0
2426 [ $OSE -eq 1 ] && WITH_LIBOPUS=0
2427 WITH_XCODE_DIR=""
2428elif [ "$OS" = "haiku" ]; then
2429 #WITH_SDL=0
2430 WITH_SDL_TTF=0
2431 WITH_X11=0
2432 WITH_ALSA=0
2433 WITH_PULSE=0
2434 WITH_DBUS=0
2435 WITH_KMODS=0
2436 WITH_LIBIDL=0
2437 WITH_XPCOM=0
2438 BUILD_LIBXSLT=1
2439 BUILD_LIBXML2=1
2440 WITH_LIBVPX=0
2441 WITH_LIBOPUS=0
2442 # it is part of libroot, which is linked by default,
2443 # but the script wants something
2444 LIBPTHREAD="-lroot"
2445 #[ $OSE -eq 1 ] || BUILD_LIBCURL=1
2446 [ $OSE -eq 1 ] || BUILD_LIBSSL=1
2447elif [ "$OS" = "solaris" ]; then
2448 [ $OSE -eq 1 ] && WITH_LIBVPX=0
2449 [ $OSE -eq 1 ] && WITH_LIBOPUS=0
2450fi
2451
2452# scan command line options
2453for option in "$@"; do
2454 case "$option" in
2455 --help|-help|-h)
2456 show_help
2457 ;;
2458 --nofatal)
2459 nofatal=1
2460 ;;
2461 --env-only)
2462 ENV_ONLY=1
2463 ;;
2464 --with-gcc=*)
2465 CC=`echo $option | cut -d'=' -f2`
2466 ;;
2467 --with-g++=*)
2468 CXX=`echo $option | cut -d'=' -f2`
2469 ;;
2470 --with-kbuild=*)
2471 KBUILDDIR=`echo $option | cut -d'=' -f2`
2472 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
2473 echo "Error: KBUILDDIR contains invalid characters!"
2474 exit 1
2475 fi
2476 ;;
2477 --with-qt-dir=*)
2478 [ $WITH_QT5 -eq 1 ] && QT5DIR=`echo $option | cut -d'=' -f2`
2479 [ $WITH_QT5 -eq 1 ] && QT5DIR_PKGCONFIG=0
2480 ;;
2481 --with-qt5-minor=*)
2482 QT5MIN=`echo $option | cut -d'=' -f2`
2483 ;;
2484 --with-qt5-major=*)
2485 QT5MAJ=`echo $option | cut -d'=' -f2`
2486 ;;
2487 --with-openssl-dir=*)
2488 OPENSSLDIR=`echo $option | cut -d'=' -f2`
2489 INCCRYPTO="-I${OPENSSLDIR}/include"
2490 LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a"
2491 # On Darwin (at least for macports) static OpenSSL also needs zlib.
2492 [ "$OS" = "darwin" ] && LIBCRYPTO="$LIBCRYPTO ${OPENSSLDIR}/lib/libz.a"
2493 ;;
2494 --with-ow-dir=*)
2495 WATCOM=`echo $option | cut -d'=' -f2`
2496 ;;
2497 --with-gsoap-dir=*)
2498 GSOAP=`echo $option | cut -d'=' -f2`
2499 ;;
2500 --with-gsoap-import=*)
2501 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
2502 ;;
2503 --with-iasl=*)
2504 IASL=`echo $option | cut -d'=' -f2`
2505 ;;
2506 --with-xcode-dir=*)
2507 WITH_XCODE_DIR=`echo $option | cut -d'=' -f2`
2508 echo $option
2509 ;;
2510 --with-linux=*)
2511 LINUX=`echo $option | cut -d'=' -f2`
2512 ;;
2513 --with-makeself=*)
2514 MAKESELF=`echo $option | cut -d'=' -f2`
2515 ;;
2516 --target-arch=*)
2517 TARGET_MACHINE=`echo $option | cut -d'=' -f2`
2518 ;;
2519 --disable-xpcom)
2520 [ $WITH_XPCOM -eq 1 ] && WITH_XPCOM=0
2521 ;;
2522 --disable-python)
2523 [ $WITH_PYTHON -eq 1 ] && WITH_PYTHON=0
2524 ;;
2525 --disable-java)
2526 [ $WITH_JAVA -eq 1 ] && WITH_JAVA=0
2527 ;;
2528 --disable-vmmraw)
2529 [ $WITH_VMMRAW -eq 1 ] && WITH_VMMRAW=0
2530 ;;
2531 --disable-sdl-ttf)
2532 [ $WITH_SDL_TTF -eq 1 ] && WITH_SDL_TTF=0
2533 ;;
2534 --disable-qt)
2535 [ $WITH_QT5 -eq 1 ] && WITH_QT5=0
2536 ;;
2537 --enable-qt5)
2538 [ $WITH_QT5 -eq 0 ] && WITH_QT5=1
2539 ;;
2540 --passive-mesa)
2541 PASSIVE_MESA=1
2542 ;;
2543 --disable-alsa)
2544 [ $WITH_ALSA -eq 1 ] && WITH_ALSA=0
2545 ;;
2546 --disable-pulse)
2547 [ $WITH_PULSE -eq 1 ] && WITH_PULSE=0
2548 ;;
2549 --enable-pulse)
2550 WITH_PULSE=2
2551 ;;
2552 --disable-dbus)
2553 [ $WITH_DBUS -eq 1 ] && WITH_DBUS=0
2554 ;;
2555 --disable-kmods)
2556 [ $WITH_KMODS -eq 1 ] && WITH_KMODS=0
2557 ;;
2558 --disable-opengl)
2559 [ $WITH_OPENGL -eq 1 ] && WITH_OPENGL=0
2560 ;;
2561 --enable-webservice)
2562 [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
2563 ;;
2564 --enable-vnc)
2565 WITH_VNC=1
2566 ;;
2567 --disable-hardening)
2568 WITH_HARDENING=0
2569 ;;
2570 --disable-extpack)
2571 WITH_EXTPACK=0
2572 ;;
2573 --disable-docs)
2574 WITH_DOCS=0
2575 ;;
2576 --enable-hardening)
2577 WITH_HARDENING=2
2578 ;;
2579 --build-libopus)
2580 BUILD_LIBOPUS=1
2581 ;;
2582 --disable-udptunnel)
2583 WITH_UDPTUNNEL=0
2584 ;;
2585 --enable-vde)
2586 WITH_VDE=1
2587 ;;
2588 --disable-devmapper)
2589 WITH_DEVMAPPER=0
2590 ;;
2591 --disable-libvpx)
2592 WITH_LIBVPX=0
2593 ;;
2594 --disable-libopus)
2595 WITH_LIBOPUS=0
2596 ;;
2597 --disable-sdl)
2598 WITH_SDL=0
2599 ;;
2600 --build-debug|-d)
2601 BUILD_TYPE=debug
2602 ;;
2603 --build-profile)
2604 BUILD_TYPE=profile
2605 ;;
2606 --build-libxml2)
2607 BUILD_LIBXML2=1
2608 ;;
2609 --build-libssl)
2610 BUILD_LIBSSL=1
2611 ;;
2612 --build-libcurl)
2613 BUILD_LIBCURL=1
2614 ;;
2615 --build-libvpx)
2616 BUILD_LIBVPX=1
2617 ;;
2618 --build-headless)
2619 HEADLESS=1
2620 WITH_SDL=0
2621 WITH_SDL_TTF=0
2622 WITH_X11=0
2623 WITH_OPENGL=0
2624 WITH_QT5=0
2625 ;;
2626 --ose)
2627 OSE=2
2628 ;;
2629 --odir=*)
2630 ODIR="`echo $option | cut -d'=' -f2`/"
2631 ODIR_OVERRIDE=1
2632 ;;
2633 --out-path=*)
2634 out_path="`echo $option | cut -d'=' -f2`/"
2635 if [ -d $out_path ]; then
2636 saved_path="`pwd`"
2637 cd $out_path
2638 OUT_PATH="`pwd`"
2639 cd $saved_path
2640 OUT_PATH_OVERRIDE=1
2641 if [ $ODIR_OVERRIDE -eq 0 ]; then
2642 # This variable has not *yet* been overridden. That can still happen.
2643 ODIR=$OUT_PATH/
2644 fi
2645 else
2646 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2647 exit 1
2648 fi
2649 ;;
2650 --setup-wine)
2651 [ "$OS" != "darwin" ] && SETUP_WINE=1
2652 ;;
2653 --only-additions)
2654 ONLY_ADDITIONS=1
2655 ;;
2656 *)
2657 echo
2658 echo "Unrecognized option \"$option\""
2659 echo
2660 show_help
2661 ;;
2662 esac
2663done
2664
2665LOG="$ODIR$LOG"
2666ENV="$ODIR$ENV"
2667CNF="$ODIR$CNF"
2668
2669# initialize output files
2670cat > $LOG << EOF
2671# Log file generated by
2672#
2673# '$0 $*'
2674#
2675
2676EOF
2677cat > $CNF << EOF
2678# -*- Makefile -*-
2679#
2680# automatically generated by
2681#
2682# '$0 $*'
2683#
2684# It will be completely overwritten if configure is executed again.
2685#
2686
2687EOF
2688cat > $ENV << EOF
2689#!/bin/bash
2690#
2691# automatically generated by
2692#
2693# '$0 $*'
2694#
2695# It will be completely overwritten if configure is executed again.
2696# Make sure you source this file once before you start to build VBox.
2697#
2698
2699EOF
2700
2701# Print log warning about OSE if necessary
2702if [ -n "$NOT_OSE" ]; then
2703 echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
2704 echo >> $LOG
2705fi
2706
2707
2708if [ "$BUILD_TYPE" = "debug" ]; then
2709 echo "Creating DEBUG build!" >> $LOG
2710elif [ "$BUILD_TYPE" = "profile" ]; then
2711 echo "Creating PROFILE build!" >> $LOG
2712fi
2713
2714# first determine our environment
2715check_environment
2716check_kbuild
2717
2718[ -n "$ENV_ONLY" ] && exit 0
2719
2720# append the tools directory to the default search path
2721echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2722export PATH
2723
2724# if we will be writing to a different out directory then set this up now
2725if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2726 echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2727 echo "export AUTOCFG" >> $ENV
2728 echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2729 echo "export LOCALCFG" >> $ENV
2730 echo "PATH_OUT_BASE=$OUT_PATH" >> $ENV
2731 echo "export PATH_OUT_BASE" >> $ENV
2732fi
2733
2734# don't bother people with -Werror
2735cnf_append "VBOX_GCC_WERR" "\$(NO_SUCH_VARIABLE)"
2736
2737# some things are not available in for OSE
2738if [ $OSE -ge 1 ]; then
2739 cnf_append "VBOX_OSE" "1"
2740 cnf_append "VBOX_WITH_VALIDATIONKIT" ""
2741 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2742
2743 if [ "$OS" = "linux" ]; then
2744 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2745 else
2746 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2747 fi
2748 echo >> $CNF
2749fi
2750
2751# extpack
2752if [ $ONLY_ADDITIONS -eq 1 ]; then
2753 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2754elif [ $OSE -eq 0 ]; then
2755 if [ $WITH_EXTPACK -eq 1 ]; then
2756 BUILD_LIBSSL=1
2757 else
2758 cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
2759 fi
2760fi
2761
2762# headless
2763if [ -n "$HEADLESS" ]; then
2764 cnf_append "VBOX_HEADLESS" "1"
2765fi
2766
2767# emit disable directives corresponding to any --disable-xxx options.
2768if [ $WITH_OPENGL -eq 0 ]; then
2769 cnf_append "VBOX_WITH_VMSVGA3D" ""
2770 cnf_append "VBOX_WITH_3D_ACCELERATION" ""
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