VirtualBox

source: vbox/trunk/configure@ 84909

Last change on this file since 84909 was 84900, checked in by vboxsync, 5 years ago

configure: For Darwin: Modernize OS version, Xcode, SDK and Qt detection. Fix different linker options (-L is -F on Darwin).

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette