VirtualBox

source: vbox/trunk/configure@ 18242

Last change on this file since 18242 was 18126, checked in by vboxsync, 15 years ago

another gsoap 2.7.12 detection fix

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

© 2023 Oracle
ContactPrivacy policyTerms of Use