VirtualBox

source: vbox/trunk/configure@ 85127

Last change on this file since 85127 was 84934, checked in by vboxsync, 4 years ago

configure: Stop using the old KBUILD variables.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use