VirtualBox

source: vbox/trunk/configure@ 67579

Last change on this file since 67579 was 67315, checked in by vboxsync, 7 years ago

configure: removed check_i386elfgcc() which is unused for a long time

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

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