VirtualBox

source: vbox/trunk/configure@ 16560

Last change on this file since 16560 was 16494, checked in by vboxsync, 15 years ago

configure: todo

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 52.6 KB
RevLine 
[3163]1#!/bin/sh
[1]2# The purpose of this script is to check for all external tools, headers, and
3# libraries VBox OSE depends on.
4
5#
[8175]6# Copyright (C) 2006-2007 Sun Microsystems, Inc.
[1]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 as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17LC_ALL=C
18export LC_ALL
19
[4733]20# append some extra paths
21PATH="$PATH:/opt/gnome/bin"
[4757]22# Solaris (order of paths important for tr, echo, grep, sed to work)
23PATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
[5536]24ORGPATH=$PATH
[4733]25
[14711]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
46
[1]47#
[1025]48# Defaults
[1]49#
50OSE=1
[5041]51ODIR="`pwd`/"
[16257]52ODIR_OVERRIDE=0
53OUT_PATH=""
54OUT_PATH_OVERRIDE=0
[5041]55SETUP_WINE=
[3675]56TARGET_MACHINE=""
57TARGET_CPU=""
[1025]58WITH_XPCOM=1
[11735]59WITH_PYTHON=1
[1025]60WITH_LIBIDL=1
[16141]61WITH_GSOAP=0
[8056]62WITH_QT4=1
[5239]63WITH_SDL=1
[1038]64WITH_SDL_TTF=1
[5239]65WITH_X11=1
[8018]66WITH_ALSA=1
[6101]67WITH_PULSE=1
[14989]68WITH_DBUS=1
[6157]69WITH_KMODS=1
[11884]70WITH_HARDENING=1
[1]71CC="gcc"
[3675]72CC32=""
73CC64=""
[1]74CXX="g++"
[3675]75CXX32=""
76CXX64=""
[1]77BCC="bcc"
78YASM="yasm"
79IASL="iasl"
80AS86="as86"
81XSLTPROC="xsltproc"
82GENISOIMAGE="genisoimage"
83MKISOFS="mkisofs"
[6098]84BUILD_LIBXML2=
[7298]85BUILD_LIBXSLT=
[1]86LIBCRYPTO="-lcrypto"
87LIBPTHREAD="-lpthread"
[15247]88LIBCAP="-lcap"
[16139]89GSOAP=""
[4913]90LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
91INCX11="/usr/local/include"
[1]92LIBXCURSOR="-lXcursor"
93INCZ=""
94LIBZ="-lz"
95INCPNG=""
96LIBPNG="-lpng"
[14711]97PKGCONFIG="`which_wrapper pkg-config`"
[11735]98PYTHONDIR="/usr /usr/local"
[10348]99QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr"
[9671]100QT4DIR_PKGCONFIG=1
[7470]101QT4UIC3DIR="/usr/bin"
[4724]102KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
103DEVDIR="`cd \`dirname $0\`; pwd`/tools"
[3163]104if [ -d "/lib/modules/`uname -r`/build" ]; then
[1]105 LINUX="/lib/modules/`uname -r`/build"
106else
107 LINUX="/usr/src/linux"
108fi
109KCHMVIEWER="kchmviewer"
110LOG="configure.log"
111CNF="AutoConfig.kmk"
112ENV="env.sh"
113BUILD_TYPE="release"
[203]114# the restricting tool is ar (mri mode).
115INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
[1]116
[3163]117if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
[65]118 echo "Error: VBox base path contains invalid characters!"
[63]119 exit 1
120fi
121
[8068]122# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
123if [ "`uname`" = "Darwin" ]; then
124 ECHO_N="/bin/echo -n"
[9133]125else
[8068]126 ECHO_N="echo -n"
127fi
128
129
[3163]130cleanup()
[1]131{
[16202]132 rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
[1]133}
134
[3163]135fail()
[1]136{
137 if [ -z "$nofatal" -o "x$1" != "x" ]; then
138 cleanup
139 rm -f $ENV
140 exit 1
141 fi
142}
143
[8461]144log()
145{
146 echo "$1"
147 echo "$1" >> $LOG
148}
149
[3163]150log_success()
[1]151{
[8068]152 if [ -n "$1" ]; then $ECHO_N "$1, "; fi
[1]153 echo "OK."
[3328]154 echo "$1" >> $LOG
155 echo >> $LOG
156 echo >> $LOG
[1]157}
158
[3163]159log_failure()
[1]160{
[3328]161 echo
162 echo " ** $1!"
163 echo "** $1!" >> $LOG
164 echo >> $LOG
[1]165}
166
[3163]167cnf_append()
[1]168{
[1409]169 printf "%-30s := %s\n" "$1" "$2" >> $CNF
[1]170}
171
[3163]172strip_l()
[3032]173{
[10291]174 echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
[3032]175}
176
[3163]177strip_L()
[3032]178{
[10291]179 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
[3032]180}
181
[3163]182strip_I()
183{
[10291]184 echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
[3163]185}
186
[4886]187prefix_I()
188{
[4889]189 echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
[4886]190}
191
[3163]192check_avail()
[1]193{
194 if [ -z "$1" ]; then
195 log_failure "$2 is empty"
196 fail $3
197 return 1
198 elif which_wrapper $1 > /dev/null; then
199 return 0
200 else
201 log_failure "$1 (variable $2) not found"
202 fail $3
203 return 1
204 fi
205}
206
[11735]207
[1]208# Prepare a test
[3163]209test_header()
[1]210{
211 echo "***** Checking $1 *****" >> $LOG
[8068]212 $ECHO_N "Checking for $1: "
[1]213}
214
[11735]215
[1]216# Compile a test
[3163]217test_compile()
[1]218{
219 echo "compiling the following source file:" >> $LOG
[16202]220 cat $ODIR.tmp_src.cc >> $LOG
[1]221 echo "using the following command line:" >> $LOG
[16202]222 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
223 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
[3163]224 if [ $? -ne 0 ]; then
[1]225 if [ -z "$4" ]; then
[3328]226 echo
227 echo " $2 not found at $1 or $3 headers not found"
228 echo " Check the file $LOG for detailed error information."
[1]229 fail
230 else
231 echo "not found."
[3328]232 echo >> $LOG
233 echo >> $LOG
[1]234 fi
235 return 1
236 fi
237 return 0
238}
239
[11735]240
[1]241# Execute a compiled test binary
[3163]242test_execute()
[1]243{
244 echo "executing the binary" >> $LOG
[16202]245 $ODIR.tmp_out > $ODIR.test_execute.log
[1]246 rc=$?
[16202]247 cat $ODIR.test_execute.log | tee -a $LOG
[3163]248 if [ $rc -ne 0 ]; then
[1]249 fail $1
250 return 1
251 fi
[3328]252 echo >> $LOG
253 echo >> $LOG
[1]254 return 0
255}
256
[11735]257
[10291]258# Execute a compiled test binary
259test_execute_path()
260{
261 echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
[16202]262 LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
[10291]263 rc=$?
[16202]264 cat $ODIR.test_execute.log | tee -a $LOG
[10291]265 if [ $rc -ne 0 ]; then
266 fail
267 return 1
268 fi
269 echo >> $LOG
270 echo >> $LOG
271 return 0
272}
273
[11735]274
[1]275#
276# Check for OS, MACHINE, CPU
277#
[3163]278check_environment()
[1]279{
280 test_header environment
[5533]281 OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
282 case "$OS" in
283 linux)
284 ;;
285 darwin)
286 ;;
287 freebsd)
288 ;;
289 sunos)
290 OS='solaris'
291 ;;
292 *)
293 log_failure "Cannot determine OS"
294 exit 1
295 ;;
296 esac
[3675]297 BUILD_CPU=`uname -m`
[5533]298 [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
[3675]299 case "$BUILD_CPU" in
[4509]300 i[3456789]86|x86|i86pc)
[3675]301 BUILD_MACHINE='x86'
[2571]302 LIB='lib'
[1]303 ;;
304 x86_64|amd64)
[3675]305 BUILD_MACHINE='amd64'
306 BUILD_CPU='k8'
[5534]307 if [ "$OS" != "solaris" ]; then
308 # on AMD64 systems, 64bit libs are usually located in /usr/lib64
309 # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
310 LIB='lib64'
311 else
[9133]312 # Solaris doesn't seem to subscribe to fhs, libs are usually in
313 # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
[5534]314 # alternative binaries can be found in 'amd64' subdirs of the 'bin'
315 # ones. So, in order to find the right stuff (esp. sdl-config) we'll
316 # have to make sure the */bin/amd64 dirs are searched before the */bin
317 # ones. (The sed has some sideeffects, but they shouldn't harm us...)
318 echo "64-bit Solaris detected, hacking the PATH" >> $LOG
319 echo "old PATH: $PATH" >> $LOG
320 PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
321 -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
322 export PATH
323 echo "new PATH: $PATH" >> $LOG
324 LIB='lib/64'
325 fi
[1]326 ;;
327 *)
328 log_failure "Cannot determine system"
329 exit 1
330 ;;
331 esac
[3675]332 [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
333 [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
334 DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
335 log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
[2374]336
[6212]337 echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
338 echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
339 echo "export BUILD_TARGET=\"$OS\"" >> $ENV
340 echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
341 echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
342 echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
[1]343}
344
345#
346# Check for gcc with version >= 3.2.
347# We depend on a working gcc, if we fail terminate in every case.
348#
[3163]349check_gcc()
[1]350{
351 test_header gcc
352 if check_avail "$CC" CC really; then
[8461]353 cc_ver=`$CC -dumpversion` 2>/dev/null
354 if [ $? -ne 0 ]; then
355 log_failure "cannot execute '$CC -dumpversion'"
356 fail really
357 fi
[1]358 if check_avail "$CXX" CXX really; then
[8461]359 cxx_ver=`$CXX -dumpversion` 2>/dev/null
360 if [ $? -ne 0 ]; then
361 log_failure "cannot execute '$CXX -dumpversion'"
362 fail really
363 fi
[1]364 cc_maj=`echo $cc_ver|cut -d. -f1`
365 cc_min=`echo $cc_ver|cut -d. -f2`
366 if [ "x$cc_ver" != "x$cxx_ver" ]; then
367 log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
368 fail really
[8461]369 elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "OS" = "darwin" ]; then
370 log_success "found version $cc_ver"
[9196]371 # gcc-4.0 is allowed for Darwin only
[8461]372 elif [ $cc_maj -lt 3 \
373 -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
[9196]374 -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
[8461]375 -o \( $cc_maj -eq 4 -a $cc_min -gt 3 \) \
376 -o $cc_maj -gt 4 ]; then
377 log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<4"
[1]378 fail really
379 else
380 log_success "found version $cc_ver"
381 fi
[3675]382 if [ "$BUILD_MACHINE" = "amd64" ]; then
383 [ -z "$CC32" ] && CC32="$CC -m32"
384 [ -z "$CXX32" ] && CXX32="$CXX -m32"
385 else
386 [ -z "$CC32" ] && CC32="$CC"
387 [ -z "$CXX32" ] && CXX32="$CXX"
388 fi
389 if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
[5366]390 [ -z "$CC64" ] && CC64="$CC -m64"
391 [ -z "$CXX64" ] && CXX64="$CXX -m64"
[3675]392 fi
[1]393 if [ "$CC" != "gcc" ]; then
[3675]394 cnf_append "TOOL_GCC3_CC" "$CC"
395 cnf_append "TOOL_GCC3_AS" "$CC"
396 cnf_append "TOOL_GCC3_LD" "$CC"
397 cnf_append "TOOL_GXX3_CC" "$CC"
398 cnf_append "TOOL_GXX3_AS" "$CC"
[1]399 fi
400 if [ "$CXX" != "g++" ]; then
[3675]401 cnf_append "TOOL_GCC3_CXX" "$CXX"
402 cnf_append "TOOL_GXX3_CXX" "$CXX"
403 cnf_append "TOOL_GXX3_LD" "$CXX"
[1]404 fi
[3675]405 if [ "$CC32" != "gcc -m32" ]; then
406 cnf_append "TOOL_GCC32_CC" "$CC32"
407 cnf_append "TOOL_GCC32_AS" "$CC32"
408 cnf_append "TOOL_GCC32_LD" "$CC32"
409 cnf_append "TOOL_GXX32_CC" "$CC32"
410 cnf_append "TOOL_GXX32_AS" "$CC32"
411 fi
412 if [ "$CXX32" != "g++ -m32" ]; then
413 cnf_append "TOOL_GCC32_CXX" "$CXX32"
414 cnf_append "TOOL_GXX32_CXX" "$CXX32"
415 cnf_append "TOOL_GXX32_LD" "$CXX32"
416 fi
[5533]417 # this isn't not necessary, there is not such tool.
[3675]418 if [ -n "$CC64" ]; then
419 cnf_append "TOOL_GCC64_CC" "$CC64"
420 cnf_append "TOOL_GCC64_AS" "$CC64"
421 cnf_append "TOOL_GCC64_LD" "$CC64"
422 cnf_append "TOOL_GXX64_CC" "$CC64"
423 cnf_append "TOOL_GXX64_AS" "$CC64"
424 fi
425 if [ -n "$CXX64" ]; then
426 cnf_append "TOOL_GCC64_CXX" "$CXX64"
427 cnf_append "TOOL_GXX64_CXX" "$CXX64"
428 cnf_append "TOOL_GXX64_LD" "$CXX64"
429 fi
[5533]430 # Solaris sports a 32-bit gcc/g++.
431 if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
432 [ "$CC" = "gcc" ] && CC="gcc -m64"
433 [ "$CXX" = "g++" ] && CXX="g++ -m64"
[9133]434 fi
[1]435 fi
436 fi
437}
438
[11735]439
[1]440#
441# Check for the bcc compiler, needed for compiling the BIOS
442#
[3163]443check_bcc()
[1]444{
445 test_header bcc
446 if check_avail "$BCC" BCC; then
447 bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
[3163]448 if [ $? -ne 0 ]; then
[1]449 log_failure "not found"
450 fail
451 else
452 echo "compiling the following source file:" >> $LOG
[16202]453 cat > $ODIR.tmp_src.c << EOF
[1]454int foo(a)
455 int a;
456{
457 return 0;
458}
[3163]459EOF
[16202]460 cat $ODIR.tmp_src.c >> $LOG
[4757]461 bcc_path=`which_wrapper $BCC`
462 bcc_dir="`dirname $bcc_path`/"
[1]463 echo "using the following command line:" >> $LOG
[16202]464 echo "$BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
465 $BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
[3163]466 if [ $? -ne 0 ]; then
[1]467 log_failure "not found"
468 fail
469 else
470 log_success "found version $bcc_ver"
471 cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
472 fi
[4757]473 unset bcc_path
474 unset bcc_dir
[1]475 fi
476 fi
477}
478
[11735]479
[1]480#
481# Check for the as86 assembler, needed for compiling the BIOS
482#
[3163]483check_as86()
[1]484{
485 test_header as86
486 if check_avail "$AS86" AS86; then
487 as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
[3163]488 if [ $? -ne 0 ]; then
[1]489 log_failure "not found"
490 fail
491 else
492 log_success "found version $as86_ver"
[802]493 cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
[1]494 fi
495 fi
496}
497
[11735]498
[1]499#
500# Check for yasm, needed to compile assembler files
501#
[3163]502check_yasm()
[1]503{
504 test_header yasm
505 if check_avail "$YASM" YASM; then
506 yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
[3163]507 if [ $? -ne 0 ]; then
[1]508 log_failure "not found"
509 fail
510 else
511 yasm_maj=`echo $yasm_ver|cut -d. -f1`
512 yasm_min=`echo $yasm_ver|cut -d. -f2`
513 yasm_rev=`echo $yasm_ver|cut -d. -f3`
[4726]514 yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
[3163]515 if [ $yasm_ver_mul -lt 501 ]; then
[1]516 log_failure "found version $yasm_ver, expected at least 0.5.1"
517 fail
518 else
519 log_success "found version $yasm_ver"
520 fi
521 fi
522 fi
523}
524
[11735]525
[1]526#
527# Check for the iasl ACPI compiler, needed to compile vbox.dsl
528#
[3163]529check_iasl()
[1]530{
531 test_header iasl
532 if check_avail "$IASL" IASL; then
533 iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
[3163]534 if [ $? -ne 0 ]; then
[1]535 log_failure "not found"
536 fail
537 else
538 log_success "found version $iasl_ver"
[802]539 cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
[1]540 fi
541 fi
542}
543
[11735]544
[1]545#
546# Check for xsltproc, needed by Main
547#
[3163]548check_xsltproc()
[1]549{
550 test_header xslt
551 if check_avail "$XSLTPROC" XSLTPROC; then
552 xsltproc_ver=`$XSLTPROC --version`
[3163]553 if [ $? -ne 0 ]; then
[1]554 log_failure "not found"
555 fail
556 else
557 log_success "found"
[802]558 cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
[1]559 fi
560 fi
561}
562
[11735]563
[1]564#
565# Check for mkisofs, needed to build the CDROM image containing the additions
566#
[3163]567check_mkisofs()
[1]568{
569 test_header mkisofs
[802]570 if which_wrapper $GENISOIMAGE > /dev/null; then
[1]571 mkisofs_ver=`$GENISOIMAGE --version`
[3163]572 if [ $? -ne 0 ]; then
[1]573 log_failure "not found"
574 fail
575 else
576 log_success "found $mkisofs_ver"
[802]577 cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
[1]578 fi
579 elif check_avail "$MKISOFS" MKISOFS; then
580 mkisofs_ver=`$MKISOFS --version`
[3163]581 if [ $? -ne 0 ]; then
[1]582 log_failure "not found"
583 fail
584 else
585 log_success "found $mkisofs_ver"
[802]586 cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
[1]587 fi
588 fi
589}
590
[11735]591
[1]592#
[6125]593# Check for libxml2, needed by VBoxSettings
[7393]594# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
[1]595#
[6060]596check_libxml2()
597{
[6098]598 if [ -z "$BUILD_LIBXML2" ]; then
599 test_header libxml2
600 if which_wrapper pkg-config > /dev/null; then
601 libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
602 if [ $? -ne 0 ]; then
603 log_failure "not found"
604 fail
605 else
606 FLGXML2=`pkg-config libxml-2.0 --cflags`
607 INCXML2=`strip_I "$FLGXML2"`
608 LIBXML2=`pkg-config libxml-2.0 --libs`
[16202]609 cat > $ODIR.tmp_src.cc << EOF
[6097]610#include <cstdio>
611#include <libxml/xmlversion.h>
612extern "C" int main(void)
613{
614 printf("found version %s", LIBXML_DOTTED_VERSION);
[6500]615#if LIBXML_VERSION >= 20626
[6097]616 printf(", OK.\n");
617 return 0;
618#else
[6500]619 printf(", expected version 2.6.26 or higher\n");
[6097]620 return 1;
621#endif
622}
623EOF
[6098]624 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
625 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
626 if test_execute; then
627 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
628 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
629 fi
[6097]630 fi
631 fi
[6098]632 elif which_wrapper xml2-config; then
633 libxml2_ver=`xml2-config --version`
634 if [ $? -ne 0 ]; then
635 log_failure "not found"
636 fail
637 else
638 log_success "found version $libxml2_ver"
639 FLGXML2=`xml2-config --cflags`
640 INCXML2=`strip_I "$FLGXML2"`
641 LIBXML2=`xml2-config --libs`
[16202]642 cat > $ODIR.tmp_src.cc << EOF
[6097]643#include <cstdio>
644#include <libxml/xmlversion.h>
645extern "C" int main(void)
646{
647 printf("found version %s", LIBXML_DOTTED_VERSION);
[6500]648#if LIBXML_VERSION >= 20626
[6097]649 printf(", OK.\n");
650 return 0;
651#else
[6500]652 printf(", expected version 2.6.26 or higher\n");
[6097]653 return 1;
654#endif
655}
656EOF
[6098]657 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
658 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
659 if test_execute; then
660 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
661 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
662 fi
[6097]663 fi
664 fi
[6098]665 else
666 log_failure "neither pkg-config nor xml2-config found"
667 fail
[6060]668 fi
669 fi
670}
671
[11735]672
[6060]673#
[7393]674# Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.17.
675# This library is available on Ubuntu Edgy which fulfils the minimal libxml2
676# requirement (2.6.26).
[7298]677#
678check_libxslt()
679{
680 if [ -z "$BUILD_LIBXSLT" ]; then
681 test_header libxslt
682 if which_wrapper pkg-config > /dev/null; then
683 libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
684 if [ $? -ne 0 ]; then
685 log_failure "not found"
686 fail
687 else
688 FLGXSLT=`pkg-config libxslt --cflags`
689 INCXSLT=`strip_I "$FLGXSLT"`
690 LIBXSLT=`pkg-config libxslt --libs`
[16202]691 cat > $ODIR.tmp_src.cc << EOF
[7298]692#include <cstdio>
693#include <libxslt/xsltconfig.h>
694extern "C" int main(void)
695{
696 printf("found version %s", LIBXSLT_DOTTED_VERSION);
[7395]697#if LIBXSLT_VERSION >= 10117
[7298]698 printf(", OK.\n");
699 return 0;
700#else
[7395]701 printf(", expected version 1.1.17 or higher\n");
[7298]702 return 1;
703#endif
704}
705EOF
706 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
707 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
708 if test_execute; then
709 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
710 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
711 fi
712 fi
713 fi
714 elif which_wrapper xslt-config; then
715 libxslt_ver=`xslt-config --version`
716 if [ $? -ne 0 ]; then
717 log_failure "not found"
718 fail
719 else
720 log_success "found version $libxslt_ver"
721 FLGXSLT=`xslt-config --cflags`
722 INCXSLT=`strip_I "$FLGXSLT"`
723 LIBXSLT=`xslt-config --libs`
[16202]724 cat > $ODIR.tmp_src.cc << EOF
[7298]725#include <cstdio>
726#include <libxslt/xsltconfig.h>
727extern "C" int main(void)
728{
729 printf("found version %s", LIBXSLT_DOTTED_VERSION);
[7395]730#if LIBXSLT_VERSION >= 10117
[7298]731 printf(", OK.\n");
732 return 0;
733#else
[7395]734 printf(", expected version 1.1.17 or higher\n");
[7298]735 return 1;
736#endif
737}
738EOF
739 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
740 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
741 if test_execute; then
742 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
743 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
744 fi
745 fi
746 fi
747 else
748 log_failure "neither pkg-config nor xslt-config found"
749 fail
750 fi
751 fi
752}
753
[11735]754
[7298]755#
[1]756# Check for libIDL, needed by xpcom
757#
758check_libidl()
759{
760 test_header libIDL
[24]761
[802]762 if which_wrapper libIDL-config-2 > /dev/null; then
[1]763 libidl_ver=`libIDL-config-2 --version`
[3163]764 if [ $? -ne 0 ]; then
[1]765 log_failure "not found"
766 fail
767 else
768 log_success "found version $libidl_ver"
[921]769 cnf_append "VBOX_LIBIDL_CONFIG" \
[2571]770 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
[1]771 fi
772 elif check_avail "libIDL-config" libIDL-config; then
773 libidl_ver=`libIDL-config --version`
[3163]774 if [ $? -ne 0 ]; then
[1]775 log_failure "not found"
776 fail
777 else
778 log_success "found version $libidl_ver"
[2926]779 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
[1]780 fi
781 fi
782}
783
[11735]784
[1]785#
786# Check for openssl, needed for RDP
787#
[3163]788check_ssl()
[1]789{
790 test_header ssl
[16202]791 cat > $ODIR.tmp_src.cc << EOF
[1]792#include <cstdio>
793#include <openssl/opensslv.h>
794extern "C" int main(void)
795{
796 printf("found version %s", OPENSSL_VERSION_TEXT);
797#if OPENSSL_VERSION_NUMBER >= 0x0090700
798 printf(", OK.\n");
799 return 0;
800#else
801 printf(", expected version 0.9.7 or higher\n");
802 return 1;
803#endif
804}
[3163]805EOF
[1]806 if test_compile $LIBCRYPTO libcrypto openssl; then
807 if test_execute nofatal; then
808 cnf_append "SDK_VBOX_OPENSSL_INCS" ""
[3163]809 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
[1]810 fi
811 fi
812}
813
[11735]814
[1]815#
816# Check for pthread, needed by VBoxSVC, frontends, ...
817#
[3163]818check_pthread()
[1]819{
820 test_header pthread
[16202]821 cat > $ODIR.tmp_src.cc << EOF
[1]822#include <cstdio>
823#include <pthread.h>
824extern "C" int main(void)
825{
826 pthread_mutex_t mutex;
827 if (pthread_mutex_init(&mutex, NULL)) {
828 printf("pthread_mutex_init() failed\n");
829 return 1;
830 }
831 if (pthread_mutex_lock(&mutex)) {
832 printf("pthread_mutex_lock() failed\n");
833 return 1;
834 }
835 if (pthread_mutex_unlock(&mutex)) {
836 printf("pthread_mutex_unlock() failed\n");
837 return 1;
838 }
839 printf("found, OK.\n");
840}
[3163]841EOF
[1]842 if test_compile $LIBPTHREAD pthread pthread; then
843 if test_execute; then
[3163]844 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
[1]845 fi
846 fi
847}
848
[11735]849
[1]850#
851# Check for zlib, needed by VBoxSVC, Runtime, ...
852#
[3163]853check_z()
[1]854{
855 test_header zlib
[16202]856 cat > $ODIR.tmp_src.cc << EOF
[1]857#include <cstdio>
858#include <zlib.h>
859extern "C" int main(void)
860{
861 printf("found version %s", ZLIB_VERSION);
862#if ZLIB_VERNUM >= 0x1210
863 printf(", OK.\n");
864 return 0;
865#else
866 printf(", expected version 1.2.1 or higher\n");
867 return 1;
868#endif
869}
[3163]870EOF
[4886]871 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
[4719]872 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
[1]873 if test_execute; then
[3163]874 cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
[1]875 cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
876 fi
877 fi
878}
879
[11735]880
[1]881#
882# Check for libpng, needed by kchmviewer
883#
[3163]884check_png()
[1]885{
886 test_header libpng
[16202]887 cat > $ODIR.tmp_src.cc << EOF
[1]888#include <cstdio>
889#include <png.h>
890extern "C" int main(void)
891{
892 printf("found version %s", PNG_LIBPNG_VER_STRING);
893#if PNG_LIBPNG_VER >= 10205
894 printf(", OK.\n");
895 return 0;
896#else
897 printf(", expected version 1.2.5 or higher\n");
898 return 1;
899#endif
900}
[3163]901EOF
[4886]902 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
[4719]903# if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then
904 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
[3163]905# if test_execute nofatal; then
906 if test_execute; then
907 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
[1]908 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
909 fi
910 fi
911}
912
[11735]913
[1]914#
915# Check for pam, needed by VRDPAuth
916# Version 79 was introduced in 9/2005, do we support older versions?
[757]917# Debian/sarge uses 76
[832]918# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
[1]919#
[3163]920check_pam()
[1]921{
922 test_header pam
[16202]923 cat > $ODIR.tmp_src.cc << EOF
[1]924#include <cstdio>
925#include <security/pam_appl.h>
926extern "C" int main(void)
927{
928 printf("found version %d", __LIBPAM_VERSION);
[757]929 if (__LIBPAM_VERSION >= 76)
[1]930 {
931 printf(", OK.\n");
932 return 0;
933 }
934 else
935 {
[757]936 printf(", expected version 76 or higher\n");
[1]937 return 1;
938 }
939}
[3163]940EOF
[832]941 if test_compile "-lpam" pam pam nofatal; then
942 if test_execute nofatal; then
943 return 0;
944 fi
945 fi
946 test_header linux_pam
[16202]947 cat > $ODIR.tmp_src.cc << EOF
[832]948#include <cstdio>
949#include <security/pam_appl.h>
950extern "C" int main(void)
951{
952 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
953 if (__LINUX_PAM__ >= 1)
954 {
955 printf(", OK.\n");
956 return 0;
957 }
958 else
959 {
960 printf(", expected version 1.0 or higher\n");
961 return 1;
962 }
963}
[3163]964EOF
[1]965 if test_compile "-lpam" pam pam; then
966 test_execute
967 fi
968}
969
[3163]970
[1]971#
972# Check for the SDL library, needed by VBoxSDL and VirtualBox
973# We depend at least on version 1.2.7
974#
[3163]975check_sdl()
[1]976{
977 test_header SDL
[8037]978 if [ "$OS" = "darwin" ]; then
[8041]979 if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
[15739]980 PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
[8041]981 elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
[8037]982 PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
983 fi
984 if [ -n "$PATH_SDK_LIBSDL" ]; then
985 foundsdl=1
986 INCSDL="$PATH_SDK_LIBSDL/Headers"
987 FLDSDL="-framework SDL"
[8041]988 else
989 log_failure "SDL framework not found"
990 fail
[8037]991 fi
992 else
993 if which_wrapper sdl-config > /dev/null; then
994 FLGSDL=`sdl-config --cflags`
995 INCSDL=`strip_I "$FLGSDL"`
996 LIBSDL=`sdl-config --libs`
997 LIBSDLMAIN="-lSDLmain"
998 FLDSDL=
999 foundsdl=1
1000 fi
1001 fi
1002 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1003 if [ -n "$foundsdl" ]; then
[16202]1004 cat > $ODIR.tmp_src.cc << EOF
[1]1005#include <cstdio>
[7699]1006#include <SDL.h>
1007#include <SDL_main.h>
[8044]1008#undef main
[7704]1009extern "C" int main(int argc, char** argv)
[1]1010{
1011 printf("found version %d.%d.%d",
1012 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1013#if SDL_VERSION_ATLEAST(1,2,7)
1014 printf(", OK.\n");
1015 return 0;
1016#else
1017 printf(", expected version 1.2.7 or higher\n");
1018 return 1;
1019#endif
1020}
[3163]1021EOF
[4886]1022 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
[8037]1023 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
[3163]1024 if test_execute; then
1025 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1026 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1027 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
[8037]1028 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1029 [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
[3163]1030 fi
[1]1031 fi
[3163]1032 else
1033 log_failure "not found"
[5435]1034 fail
[1]1035 fi
1036}
1037
[11735]1038
[1]1039#
1040# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1041#
[3163]1042check_sdl_ttf()
[1]1043{
1044 test_header SDL_ttf
[16202]1045 cat > $ODIR.tmp_src.cc << EOF
[1]1046#include <cstdio>
[7699]1047#include <SDL_ttf.h>
[757]1048#ifndef SDL_TTF_MAJOR_VERSION
1049#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1050#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1051#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1052#endif
[1]1053extern "C" int main(void)
1054{
1055 printf("found version %d.%d.%d",
1056 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1057#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1058 printf(", OK.\n");
1059 return 0;
1060#else
1061 printf(", expected version 2.0.6 or higher\n");
1062 return 1;
1063#endif
1064}
[3163]1065EOF
[8344]1066 if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
[9035]1067 if ! test_execute nofatal; then
1068 cnf_append "VBOX_WITH_SECURELABEL" ""
1069 fi
1070 else
1071 cnf_append "VBOX_WITH_SECURELABEL" ""
[1]1072 fi
1073}
1074
[11735]1075
[1]1076#
[791]1077# Check for libasound, needed by the ALSA audio backend
1078#
[3163]1079check_alsa()
[791]1080{
1081 test_header ALSA
[16202]1082 cat > $ODIR.tmp_src.cc << EOF
[6101]1083#include <cstdio>
[791]1084#include <alsa/asoundlib.h>
1085extern "C" int main(void)
1086{
1087 printf("found version %d.%d.%d",
1088 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
[1025]1089#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
[791]1090 printf(", OK.\n");
1091 return 0;
1092#else
[1025]1093 printf(", expected version 1.0.6 or higher\n");
[791]1094 return 1;
1095#endif
1096}
[3163]1097EOF
[791]1098 if test_compile "-lasound" asound asound; then
1099 test_execute
1100 fi
1101}
1102
[11735]1103
[791]1104#
[6101]1105# Check for PulseAudio
1106#
1107check_pulse()
1108{
1109 test_header "PulseAudio"
[16202]1110 cat > $ODIR.tmp_src.cc << EOF
[6101]1111#include <cstdio>
1112#include <pulse/version.h>
1113extern "C" int main(void)
1114{
1115 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1116#if PA_API_VERSION >= 9
1117 printf(", OK.\n");
1118 return 0;
1119#else
1120 printf(", expected version 0.9.0 (API version 9) or higher\n");
1121 return 1;
1122#endif
1123}
1124EOF
1125 if test_compile "-lpulse" pulse pulse; then
1126 test_execute
1127 fi
1128}
1129
[11735]1130
[6101]1131#
[1]1132# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1133#
[3163]1134check_xcursor()
[1]1135{
1136 test_header Xcursor
[16202]1137 cat > $ODIR.tmp_src.cc << EOF
[1]1138#include <cstdio>
1139#include <X11/Xlib.h>
1140#include <X11/Xcursor/Xcursor.h>
1141extern "C" int main(void)
1142{
1143 XcursorImage *cursor = XcursorImageCreate (10, 10);
1144 XcursorImageDestroy(cursor);
1145 return 0;
1146}
[3163]1147EOF
[4913]1148 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1149 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
[1]1150 log_success "found"
[5359]1151 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
[1]1152 fi
1153}
1154
[11735]1155
[1]1156#
1157# Check for the X libraries (Xext, X11)
1158#
[3163]1159check_x()
[1]1160{
1161 test_header "X libraries"
[16202]1162 cat > $ODIR.tmp_src.cc << EOF
[1]1163#include <cstdio>
1164#include <X11/Xlib.h>
1165extern "C" int main(void)
1166{
1167 Display *dpy;
1168 int scrn_num;
1169 Screen *scrn;
1170 Window win;
1171
1172 dpy = XOpenDisplay(NULL);
1173 scrn_num = DefaultScreen(dpy);
1174 scrn = ScreenOfDisplay(dpy, scrn_num);
1175 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1176 0, 16, InputOutput, CopyFromParent, 0, NULL);
1177 XDestroyWindow(dpy, win);
1178}
[3163]1179EOF
[4913]1180 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1181 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
[1]1182 log_success "found"
1183 fi
1184}
1185
[11735]1186
[1]1187#
[16174]1188# Check for the Qt4 library, needed by the VirtualBox frontend
[7222]1189#
1190# Currently not fatal.
1191#
1192check_qt4()
1193{
[11735]1194 foundqt4=
[7222]1195 test_header Qt4
[8051]1196 if [ "$OS" = "darwin" ]; then
1197 if [ -f "/System/Library/Frameworks/QtCore.framework/QtCore" ]; then
1198 PATH_SDK_QT4="/System/Library/Framework/QtCore.framework"
1199 elif [ -f "/Library/Frameworks/QtCore.framework/QtCore" ]; then
1200 PATH_SDK_QT4="/Library/Frameworks/QtCore.framework"
1201 fi
1202 if [ -n "$PATH_SDK_QT4" ]; then
1203 foundqt4=1
1204 INCQT4="$PATH_SDK_QT4/Headers"
1205 LIBQT4=
[10217]1206 FLGQT4="-framework QtCore"
[7222]1207 else
[16166]1208 log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
[8051]1209 fail
1210 fi
1211 else
[9671]1212 if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1213 # default is to use pkg-config
1214 if which_wrapper pkg-config > /dev/null; then
[10385]1215 # this braindead path is necessary for mdv2008.1
[10599]1216 qt4_ver=`\
[11234]1217 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
[10599]1218 pkg-config QtCore --modversion 2>> $LOG`
[9671]1219 if [ $? -ne 0 ]; then
1220 log_failure "not found"
[10302]1221 fail
[9671]1222 else
[10599]1223 FLGQT4=`\
1224 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1225 pkg-config QtCore --cflags`
[9671]1226 INCQT4=`strip_I "$FLGQT4"`
[10599]1227 LIBQT4=`\
1228 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1229 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1230 pkg-config QtCore --libs`
[9671]1231 foundqt4=1
1232 fi
[8051]1233 else
[9671]1234 log_failure "pkg-config not found"
[10385]1235 fail
[8051]1236 fi
1237 else
[9671]1238 # do it the old way (e.g. user has specified QT4DIR)
[16202]1239 cat > $ODIR.tmp_src.cc << EOF
[11202]1240#include <cstdio>
1241#include <QtGlobal>
1242extern "C" int main(void)
1243{
1244 printf("found version %s", QT_VERSION_STR);
1245#if QT_VERSION >= 0x040300
1246 printf(", OK.\n");
1247 return 0;
[12864]1248#else
[11202]1249 printf(", expected version 4.3.0 or higher\n");
1250 return 1;
1251#endif
1252}
1253EOF
[9671]1254 for q in $QT4DIR; do
1255 INCQT4="$q/include $q/include/QtCore"
1256 FLGQT4="-DQT_SHARED"
1257 I_INCQT4=`prefix_I "$INCQT4"`
[10291]1258 LIBQT4="-L$q/lib -lVBoxQtCore"
[10217]1259 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
[10291]1260 foundqt4=2
1261 break;
1262 fi
1263 LIBQT4="-L$q/lib -lQtCore"
1264 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
[9671]1265 foundqt4=1
1266 break;
1267 fi
1268 done
[8051]1269 fi
1270 fi
1271 if [ -n "$foundqt4" ]; then
[16202]1272 cat > $ODIR.tmp_src.cc << EOF
[7222]1273#include <cstdio>
[8052]1274#include <QtGlobal>
[7222]1275extern "C" int main(void)
1276{
1277 printf("found version %s", QT_VERSION_STR);
[10348]1278#if QT_VERSION >= 0x040300
[7222]1279 printf(", OK.\n");
1280 return 0;
[12864]1281#else
[10348]1282 printf(", expected version 4.3.0 or higher\n");
[7222]1283 return 1;
1284#endif
1285}
1286EOF
[8051]1287 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
[10217]1288 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
[10291]1289 if test_execute_path "`strip_L "$LIBQT4"`"; then
[10217]1290 if [ "$OS" != "darwin" ]; then
1291 # strip .../QtCore as we add components ourself
[10348]1292 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1293 # store only the first path, remove all other pathes
1294 # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1295 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
[10217]1296 cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
[10581]1297 cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
[10629]1298 cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
[10581]1299 # this is not quite right since the qt libpath does not have to be first...
1300 cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
[10348]1301 if [ "$foundqt4" = "2" ]; then
1302 cnf_append "VBOX_WITH_QT4_SUN" "1"
1303 fi
[7470]1304 test_header "Qt4 devtools"
1305 for q in $QT4DIR; do
1306 if which_wrapper "$q/bin/moc" > /dev/null; then
1307 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1308 if [ $? -ne 0 ]; then
1309 log_failure "not found"
1310 fail
1311 else
1312 log_success "found version $moc_ver"
1313 cnf_append "VBOX_PATH_QT4" "$q"
[10581]1314 cnf_append "PATH_SDK_QT4" "$q"
1315 cnf_append "PATH_TOOL_QT4" "$q"
[12190]1316 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
[10175]1317 return
[7470]1318 fi
1319 fi
1320 done
[7222]1321 fi
1322 fi
[8051]1323 else
1324 log_failure "not found"
1325 fail
[7222]1326 fi
[11202]1327 else
1328 log_failure "not found"
1329 fail
[7222]1330 fi
1331}
1332
1333
1334#
[5366]1335# Check whether static libstdc++ is installed
1336#
1337check_staticlibstdcxx()
1338{
1339 test_header "static stc++ library"
1340 libstdcxx=`$CXX -print-file-name=libstdc++.a`
[16202]1341 cat > $ODIR.tmp_src.cc << EOF
[5366]1342#include <string>
1343
1344extern "C" int main(void)
1345{
1346 std::string s = "test";
1347 return 0;
1348}
1349EOF
1350 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1351 log_success "found"
1352 fi
1353}
1354
[11735]1355
[5366]1356#
[1]1357# Check for Linux sources
1358#
[3163]1359check_linux()
[1]1360{
1361 test_header "Linux kernel sources"
[16202]1362 cat > $ODIR.tmp_src.c << EOF
[1]1363#include <linux/version.h>
1364int printf(const char *format, ...);
1365int main(void)
1366{
[24]1367 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
[1]1368 (LINUX_VERSION_CODE % 65536) / 256,
1369 LINUX_VERSION_CODE % 256);
1370#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1371 printf(", OK.\n");
1372 return 0;
1373#else
1374 printf(", expected version 2.4.0 or higher\n");
1375 return 1;
1376#endif
1377}
[3163]1378EOF
[1]1379 echo "compiling the following source file:" >> $LOG
[16202]1380 cat $ODIR.tmp_src.c >> $LOG
[1]1381 echo "using the following command line:" >> $LOG
[16202]1382 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1383 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
[3163]1384 if [ $? -ne 0 ]; then
[3328]1385 echo
1386 echo " Linux kernel headers not found at $LINUX"
1387 echo " Check the file $LOG for detailed error information."
[1]1388 fail
1389 else
1390 if test_execute; then
[2926]1391 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
[1]1392 fi
1393 fi
1394}
1395
[11735]1396
[1]1397#
1398# Check for kchmviewer, needed to display the online help
[11735]1399# (unused as we ship kchmviewer)
[1]1400#
[3163]1401check_kchmviewer()
[1]1402{
1403 test_header kchmviewer
1404 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1405 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
[3163]1406 if [ $? -ne 0 ]; then
[1]1407 log_failure "not found"
1408 fail
1409 else
1410 log_success "found version $kchmviewer_ver"
1411 fi
1412 fi
1413}
1414
[11735]1415
[1]1416#
1417# Check for the kBuild tools, we don't support GNU make
1418#
[3163]1419check_kbuild()
[1]1420{
1421 test_header kBuild
[6199]1422 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1423 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
[1]1424 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1425 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1426 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
[2923]1427 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
[1]1428 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
[4757]1429 if [ "$OS" = "solaris" ]; then
1430 # Because of sh being non-default shell in Solaris we need to export PATH again when
1431 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
[5536]1432 echo "PATH=\"$ORGPATH\"" >> $ENV
[4757]1433 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1434 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1435 else
1436 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1437 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1438 fi
[1]1439 echo "export PATH" >> $ENV
1440 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
[6199]1441 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1442 elif check_avail "kmk" KBUILDDIR really; then
1443 # check for installed kBuild
1444 KBUILD_SED="`which_wrapper kmk_sed`"
1445 else
1446 fail
[1]1447 fi
[6199]1448 log_success "found"
[1]1449}
1450
[923]1451
[1]1452#
[923]1453# Check for compiler.h
[9133]1454# Some Linux distributions include "compiler.h" in their libc linux
1455# headers package, some don't. Most don't need it, building might (!)
[923]1456# not succeed on openSUSE without it.
1457#
1458# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1459#
[3163]1460check_compiler_h()
[923]1461{
1462 test_header compiler.h
1463 if ! test -f "/usr/include/linux/compiler.h"; then
[994]1464 cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
[923]1465 log_success "compiler.h not found"
1466 else
1467 log_success "compiler.h found"
1468 fi
1469}
1470
[15247]1471#
1472# Check for libcap.
1473# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1474# sockets for doing ICMP requests.
1475#
1476check_libcap()
1477{
1478 test_header "libcap library"
[16202]1479 cat > $ODIR.tmp_src.cc << EOF
[15247]1480#include <cstdio>
1481#include <sys/capability.h>
[923]1482
[15247]1483extern "C" int main(void)
1484{
[15608]1485 char buf[1024];
[15247]1486 cap_t caps = cap_get_proc();
[15608]1487 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
[15247]1488 return 0;
1489}
1490EOF
1491 if test_compile $LIBCAP libcap libcap; then
1492 if test_execute; then
1493 log_success "found"
1494 fi
1495 fi
1496}
1497
[923]1498#
[4446]1499# Check if we are able to build 32-bit applications (needed for the guest additions)
1500#
1501check_32bit()
1502{
1503 test_header "32-bit support"
[16202]1504 cat > $ODIR.tmp_src.c << EOF
[4446]1505#include <stdint.h>
1506int main(void)
1507{
1508 return 0;
1509}
1510EOF
1511 echo "compiling the following source file:" >> $LOG
[16202]1512 cat $ODIR.tmp_src.c >> $LOG
[4446]1513 echo "using the following command line:" >> $LOG
[16202]1514 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1515 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
[4446]1516 if [ $? -ne 0 ]; then
1517 echo
1518 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1519 echo " Check the file $LOG for detailed error information."
1520 fail
1521 fi
1522 log_success ""
1523}
1524
[11735]1525
[5041]1526#
[11735]1527# Check for Python
1528#
1529check_python()
1530{
1531 test_header "python support"
[16202]1532 cat > $ODIR.tmp_src.cc << EOF
[11735]1533#include <cstdio>
1534#include <Python.h>
1535extern "C" int main(void)
1536{
1537 Py_Initialize();
1538 printf("found version %s", PY_VERSION);
1539#if PY_VERSION_HEX >= 0x02030000
1540 printf(", OK.\n");
1541 return 0;
1542#else
1543 printf(", expected version 2.3 or higher\n");
1544 return 1;
1545#endif
1546}
1547EOF
1548 found=
1549 for p in $PYTHONDIR; do
[14238]1550 for d in python2.6 python2.5 python2.4 python2.3; do
[12054]1551 for b in lib64 lib/64 lib; do
[11735]1552 echo "compiling the following source file:" >> $LOG
[16202]1553 cat $ODIR.tmp_src.cc >> $LOG
[11735]1554 echo "using the following command line:" >> $LOG
[16202]1555 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1556 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
[11735]1557 if [ $? -eq 0 ]; then
1558 found=1
1559 break
1560 fi
1561 done
1562 if [ -n "$found" ]; then break; fi
1563 done
1564 if [ -n "$found" ]; then break; fi
1565 done
1566 if [ -n "$found" ]; then
1567 if test_execute; then
1568 cnf_append "VBOX_WITH_PYTHON" "1"
1569 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1570 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1571 else
1572 log_failure "not found"
1573 fail
1574 fi
1575 else
1576 log_failure "not found"
1577 fail
1578 fi
1579}
1580
1581
1582#
[5041]1583# Setup wine
1584#
1585setup_wine()
1586{
[5069]1587 test_header "Wine support"
[5044]1588 if ! which_wrapper wine > /dev/null; then
[5069]1589 echo " wine binary not found"
[5044]1590 fail
1591 fi
1592 if ! which_wrapper wineprefixcreate > /dev/null; then
1593 echo " wineprefixcreate not found"
1594 fail
1595 fi
[5041]1596 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
[5044]1597 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
[5041]1598 rm -rf $WINEPREFIX
1599 mkdir -p $WINEPREFIX
1600 touch $WINEPREFIX/.no_prelaunch_window_flag
[5044]1601 if ! wineprefixcreate -q > /dev/null 2>&1; then
[5041]1602 echo " wineprefixcreate failed"
1603 fail
1604 fi
1605 tmp=.tmp.wine.reg
1606 rm -f $tmp
1607 echo 'REGEDIT4' > $tmp
1608 echo '' >> $tmp
1609 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1610 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
1611 echo '' >> $tmp
1612 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1613 echo '"itss"="native"' >> $tmp
1614 echo '' >> $tmp
1615 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1616 echo '"itss"="native"' >> $tmp
1617 echo '' >> $tmp
[5044]1618 if ! wine regedit $tmp > /dev/null 2>&1; then
[5041]1619 rm -f $tmp
1620 echo " failed to load registry changes (path)."
1621 fail
1622 fi
1623 rm -f $tmp
[5069]1624 log_success "found"
[5041]1625}
[4446]1626
[16139]1627#
1628#
1629#
1630check_gsoap()
1631{
1632 test_header "GSOAP compiler"
1633 if [ -z "$GSOAP" ]; then
1634 GSOAP="/usr/bin"
1635 fi
1636 if which_wrapper "$GSOAP/soapcpp2" > /dev/null; then
1637 if which_wrapper "$GSOAP/wsdl2h" > /dev/null; then
1638 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1639 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1640 log_success "found"
1641 else
1642 log_failure "wsdl2h not found -- disabling webservice"
[16144]1643 cnf_append "VBOX_WITH_WEBSERVICES" ""
[16139]1644 fi
1645 else
1646 log_failure "soapcpp2 not found -- disabling webservice"
[16144]1647 cnf_append "VBOX_WITH_WEBSERVICES" ""
[16139]1648 fi
1649}
[5041]1650
[16139]1651
[4446]1652#
[8464]1653# Determines the Darwin version.
[8070]1654# @todo This should really check the Xcode/SDK version.
1655#
1656check_darwinversion()
1657{
1658 test_header "Darwin version"
1659 darwin_ver=`uname -r`
1660 case "$darwin_ver" in
1661 9\.*)
1662 darwin_ver="10.5"
[9133]1663 #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
[8070]1664 ;;
1665 8\.*)
[9133]1666 darwin_ver="10.4"
[8070]1667 ;;
1668 *)
1669 echo " failed to determin darwin version. (uname -r: $darwin_ver)"
1670 fail
1671 darwin_ver="unknown"
1672 ;;
1673 esac
1674 log_success "found version $darwin_ver"
1675}
1676
1677
1678#
[9133]1679# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1680# is around to prevent confusion when the build fails in src/recompiler.
[8072]1681# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1682#
1683check_i386elfgcc()
1684{
1685 test_header "i386-elf-gcc"
1686 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1687 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1688 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1689 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1690 if test -z "$i386_elf_gcc"; then
1691 echo " failed to find i386-elf-gcc"
1692 fail
1693 fi
1694 log_success "found $i386_elf_gcc"
1695}
1696
1697
1698#
[1]1699# Show help
1700#
[3163]1701show_help()
[1]1702{
1703 cat << EOF
1704Usage: ./configure [OPTIONS]...
1705
1706Configuration:
[4785]1707 -h, --help display this help and exit
1708 --nofatal don't abort on errors
1709 --disable-xpcom disable XPCOM and related stuff
[11735]1710 --disable-python disable python bindings
[4785]1711 --disable-sdl-ttf disable SDL_ttf detection
[8018]1712 --disable-alsa disable the ALSA sound backend
1713 --disable-pulse disable the PulseAudio backend
[14989]1714 --disable-dbus don't use DBus and hal for hardware detection
[6157]1715 --disable-kmods don't build Linux kernel modules (host and guest)
[11884]1716 --disable-hardening don't be strict about /dev/vboxdrv access
[16141]1717 --enable-webservice enable the webservice stuff
[7306]1718 --build-libxml2 build libxml2 from sources
[9733]1719 --build-libxslt build libxslt from sources
[5041]1720 --setup-wine setup a Wine directory and register the hhc hack
[1]1721
1722Paths:
[4785]1723 --with-gcc=PATH location of the gcc compiler [$CC]
1724 --with-g++=PATH location of the g++ compiler [$CXX]
1725 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1726 --with-iasl=PATH location of the iasl compiler [$IASL]
1727 --with-linux=DIR Linux kernel source directory [$LINUX]
1728 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
[16166]1729 --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
[16139]1730 --with-gsoap-dir=PATH directory for SOAP compiler (soapcpp2 and wsdl2h)
[16257]1731 --out-path=PATH the folder to which configuration and build output
1732 should go
[1]1733
1734Build type:
[4785]1735 -d, --build-debug build with debugging symbols and assertions
[6928]1736 --build-profile build with profiling support
[4785]1737 --build-headless build headless (without any X11 frontend)
[1]1738EOF
1739 exit 0
1740}
1741
1742
1743#
1744# The body.
1745#
1746
1747# scan command line options
[4785]1748for option in $*; do
[1]1749 case "$option" in
1750 --help|-help|-h)
1751 show_help
1752 ;;
1753 --nofatal)
1754 nofatal=1
1755 ;;
[11373]1756 --env-only)
1757 ENV_ONLY=1
1758 ;;
[1]1759 --with-gcc=*)
1760 CC=`echo $option | cut -d'=' -f2`
1761 ;;
1762 --with-g++=*)
1763 CXX=`echo $option | cut -d'=' -f2`
1764 ;;
1765 --with-kbuild=*)
1766 KBUILDDIR=`echo $option | cut -d'=' -f2`
[63]1767 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1768 echo "Error: KBUILDDIR contains invalid characters!"
1769 exit 1
1770 fi
[1]1771 ;;
[16166]1772 --with-qt-dir=*|--with-qt4-dir=*)
[7470]1773 QT4DIR=`echo $option | cut -d'=' -f2`
[9671]1774 QT4DIR_PKGCONFIG=0
[7470]1775 ;;
[16139]1776 --with-gsoap-dir=*)
1777 GSOAP=`echo $option | cut -d'=' -f2`
1778 ;;
[1]1779 --with-iasl=*)
1780 IASL=`echo $option | cut -d'=' -f2`
1781 ;;
1782 --with-linux=*)
1783 LINUX=`echo $option | cut -d'=' -f2`
1784 ;;
1785 --with-mkisofs=*)
1786 MKISOFS=`echo $option | cut -d'=' -f2`
1787 ;;
1788 --disable-xpcom)
[1025]1789 WITH_XPCOM=0
[1]1790 ;;
[11735]1791 --disable-python)
1792 WITH_PYTHON=0
1793 ;;
[1038]1794 --disable-sdl-ttf)
1795 WITH_SDL_TTF=0
1796 ;;
[1]1797 --disable-qt)
[8056]1798 WITH_QT4=0
[1]1799 ;;
[8073]1800 --disable-qt4)
1801 WITH_QT4=0
1802 ;;
[8018]1803 --disable-alsa)
1804 WITH_ALSA=0
1805 ;;
[6101]1806 --disable-pulse)
1807 WITH_PULSE=0
1808 ;;
[14989]1809 --disable-dbus)
1810 WITH_DBUS=0
[14711]1811 ;;
[6157]1812 --disable-kmods)
1813 WITH_KMODS=0
1814 ;;
[11884]1815 --disable-hardening)
1816 WITH_HARDENING=0
1817 ;;
1818 --enable-hardening)
1819 WITH_HARDENING=2
1820 ;;
[16141]1821 --enable-webservice)
1822 WITH_GSOAP=1
[16139]1823 ;;
[1]1824 --build-debug|-d)
1825 BUILD_TYPE=debug
1826 ;;
[6928]1827 --build-profile)
1828 BUILD_TYPE=profile
1829 ;;
[6098]1830 --build-libxml2)
1831 BUILD_LIBXML2=1
1832 ;;
[7298]1833 --build-libxslt)
1834 BUILD_LIBXSLT=1
1835 ;;
[3905]1836 --build-headless)
1837 HEADLESS=1
[5239]1838 WITH_SDL=0
1839 WITH_SDL_TTF=0
1840 WITH_X11=0
[8056]1841 WITH_QT4=0
[3905]1842 ;;
[1]1843 --ose)
1844 OSE=2
1845 ;;
1846 --odir=*)
[4719]1847 ODIR="`echo $option | cut -d'=' -f2`/"
[16257]1848 ODIR_OVERRIDE=1
[1]1849 ;;
[16257]1850 --out-path=*)
1851 out_path="`echo $option | cut -d'=' -f2`/"
1852 if [ -d $out_path ]; then
1853 saved_path="`pwd`"
1854 cd $out_path
1855 OUT_PATH="`pwd`/"
1856 cd $saved_path
1857 OUT_PATH_OVERRIDE=1
1858 if [ $ODIR_OVERRIDE -eq 0 ]; then
1859 # This variable has not *yet* been overridden. That can still happen.
1860 ODIR=$OUT_PATH
1861 fi
1862 else
1863 echo "Error: invalid folder \"$out_path\" in option \"$option\""
1864 exit 1
1865 fi
1866 ;;
[5041]1867 --setup-wine)
1868 SETUP_WINE=1
1869 ;;
[1]1870 *)
1871 echo
1872 echo "Unrecognized option \"$option\""
1873 echo
1874 show_help
1875 ;;
1876 esac
1877done
1878
[4719]1879LOG="$ODIR$LOG"
1880ENV="$ODIR$ENV"
1881CNF="$ODIR$CNF"
[1]1882
1883# initialize output files
1884cat > $LOG << EOF
1885# Log file generated by
1886#
1887# '$0 $*'
1888#
1889
1890EOF
1891cat > $CNF << EOF
1892# -*- Makefile -*-
1893#
1894# automatically generated by
1895#
1896# '$0 $*'
1897#
1898# It will be completely overwritten if configure is executed again.
1899#
1900
1901EOF
1902cat > $ENV << EOF
1903#!/bin/bash
1904#
1905# automatically generated by
1906#
1907# '$0 $*'
1908#
1909# It will be completely overwritten if configure is executed again.
1910# Make sure you source this file once before you start to build VBox.
1911#
1912
1913EOF
1914
1915# test if we are OSE
[4724]1916if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
[1]1917 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
1918 echo >> $LOG
1919 OSE=0
1920fi
1921
[3263]1922if [ "$BUILD_TYPE" = "debug" ]; then
1923 echo "Creating DEBUG build!" >> $LOG
[6928]1924elif [ "$BUILD_TYPE" = "profile" ]; then
1925 echo "Creating PROFILE build!" >> $LOG
[3263]1926fi
1927
[1]1928# first determine our environment
1929check_environment
1930check_kbuild
1931
[11373]1932[ -n "$ENV_ONLY" ] && exit 0
1933
[4733]1934# append the tools directory to the default search path
1935echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
1936export PATH
1937
[16257]1938# if we will be writing to a different out directory then set this up now
1939if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
1940 echo "export AUTOCFG=$OUT_PATH""AutoConfig.kmk" >> $ENV
1941 echo "export LOCALCFG=$OUT_PATH""LocalConfig.kmk" >> $ENV
1942 echo "export PATH_OUT_BASE=$OUT_PATH" >> $ENV
1943fi
1944
[1]1945# some things are not available in for OSE
[3163]1946if [ $OSE -ge 1 ]; then
[1]1947 cnf_append "VBOX_OSE" "1"
1948 cnf_append "VBOX_WITH_TESTSUITE" ""
1949 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
1950
[24]1951 if [ "$OS" = "linux" ]; then
[1]1952 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
[24]1953 else
[1]1954 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
1955 fi
1956 echo >> $CNF
1957fi
1958
[3905]1959# headless
1960if [ -n "$HEADLESS" ]; then
1961 cnf_append "VBOX_HEADLESS" "1"
1962fi
1963
[8056]1964if [ "$OS" = "darwin" ]; then
[8073]1965 # On Darwin we want to build against Qt4 only. WITH_QT4 is enabled by
1966 # default so disable Qt3. --disable-qt disables both Qt3 and Qt4 GUI now,
1967 # --disable-qt4 disables only the Qt4 GUI (which is not appropriate for
1968 # Darwin as we disable the Qt3 here anyway.
[8464]1969 # (Qt3 builds for Intel Macs are usually not threaded or for X11. And they
1970 # don't contain our patches, which means the result isn't really usable.)
[8056]1971 BUILD_LIBXSLT=1
1972 BUILD_LIBXML2=1
1973fi
1974
[1542]1975# emit disable directives corresponding to any --disable-xxx options.
[16174]1976[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
1977[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
1978[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
[11884]1979[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
1980[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
[1542]1981
[1]1982# the tools
1983check_gcc
[3163]1984[ "$OS" != "darwin" ] && check_as86
1985[ "$OS" != "darwin" ] && check_bcc
1986[ "$OS" != "darwin" ] && check_iasl
[1]1987# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
1988# [ "$OS" != "darwin" ] && check_yasm
[3163]1989[ "$OS" != "darwin" ] && check_xsltproc
[7270]1990[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
[1]1991
1992# the libraries
[3163]1993[ "$OS" != "darwin" ] && check_pthread
[6060]1994[ $WITH_XPCOM -eq 1 ] && check_libxml2
[7393]1995[ $WITH_XPCOM -eq 1 ] && check_libxslt
[3163]1996[ $WITH_LIBIDL -eq 1 ] && check_libidl
[7290]1997# build openssl on Darwin in every case
1998[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
[3163]1999[ "$OS" != "darwin" ] && check_z
[16026]2000[ "$OS" != "darwin" -a "$OS" != "freebsd" ] && check_png
[3163]2001[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
[5239]2002[ $WITH_SDL -eq 1 ] && check_sdl
[3163]2003[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
[11735]2004[ $WITH_X11 -eq 1 ] && check_x
[14926]2005# TODO check for Xmu (X11/Xmu/StdCmap.h)
2006# TODO check for mesa-common-dev (GL/glx.h)
2007# TODO check for libglu1-mesa-dev (GL/glu.h)
[16494]2008# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h)
[11735]2009[ $WITH_X11 -eq 1 ] && check_xcursor
2010[ $WITH_QT4 -eq 1 ] && check_qt4
[11880]2011[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
[1]2012
2013# Linux-specific
[3163]2014if [ "$OS" = "linux" ]; then
[5366]2015 check_staticlibstdcxx
[6157]2016 if [ $WITH_KMODS -eq 1 ]; then
2017 check_linux
2018 else
2019 cnf_append "VBOX_LINUX_SRC" ""
2020 cnf_append "VBOX_WITH_VBOXDRV" ""
[8551]2021 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
[6157]2022 fi
[8018]2023 if [ $WITH_ALSA -eq 1 ]; then
2024 check_alsa
2025 else
2026 cnf_append "VBOX_WITH_ALSA" ""
2027 fi
[6101]2028 if [ $WITH_PULSE -eq 1 ]; then
2029 check_pulse
2030 else
2031 cnf_append "VBOX_WITH_PULSE" ""
2032 fi
[15057]2033 if [ $WITH_DBUS -eq 0 ]; then
[14989]2034 cnf_append "VBOX_WITH_DBUS" ""
[14711]2035 fi
[15247]2036 check_libcap
[3163]2037 check_compiler_h
[4446]2038 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
[3163]2039fi
[1]2040
[5041]2041[ -n "$SETUP_WINE" ] && setup_wine
2042
[16305]2043if [ $OSE -ge 1 ]; then
2044 if [ $WITH_GSOAP -eq 1 ]; then
2045 check_gsoap
2046 else
2047 cnf_append "VBOX_WITH_WEBSERVICES" ""
2048 fi
[16144]2049fi
[16139]2050
[8070]2051# Darwin-specific
2052if [ "$OS" = "darwin" ]; then
2053 check_darwinversion
[8072]2054 check_i386elfgcc
[8070]2055fi
2056
[1]2057# success!
2058echo
2059echo "Successfully generated '$CNF' and '$ENV'."
2060echo "Source '$ENV' once before you start to build VBox:"
[1513]2061echo ""
[1]2062echo " source $ENV"
2063echo " kmk"
[1513]2064echo ""
[1539]2065if [ "$OS" = "linux" ]; then
[16257]2066 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2067 vbox_out_path=$OUT_PATH
2068 else
2069 vbox_out_path=./out/
2070 fi
[1539]2071 echo "To compile the kernel module, do:"
2072 echo ""
[16257]2073 echo " cd $vbox_out_path$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src/vboxdrv"
[1539]2074 echo " make"
2075 echo ""
2076fi
[11908]2077if [ $WITH_HARDENING -gt 0 ]; then
2078 echo ""
2079 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2080 echo " Hardening is enabled which means that the VBox binaries will not run from"
2081 echo " the binary directory. The binaries have to be installed suid root and some"
2082 echo " more prerequisites have to be fulfilled which is normally done by installing"
2083 echo " the final package. For development, the hardening feature can be disabled"
2084 echo " by specifying the --disable-hardening parameter. Please never disable that"
2085 echo " feature for the final distribution!"
2086 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2087 echo ""
2088else
2089 echo ""
2090 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2091 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2092 echo " disabled hardening!"
2093 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2094 echo ""
2095fi
[1]2096echo "Enjoy!"
2097cleanup
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use