VirtualBox

source: vbox/trunk/configure@ 92251

Last change on this file since 92251 was 91557, checked in by vboxsync, 3 years ago

Config.kmk,configure: Add check for libtpms dependency required for the virtual TPM, bugref:10075 [fix]

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