VirtualBox

source: vbox/trunk/configure@ 18044

Last change on this file since 18044 was 18044, checked in by vboxsync, 16 years ago

configure: leftover

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 55.5 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
1418#
1419check_staticlibstdcxx()
1420{
1421 test_header "static stc++ library"
1422 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1423 cat > $ODIR.tmp_src.cc << EOF
1424#include <string>
1425
1426extern "C" int main(void)
1427{
1428 std::string s = "test";
1429 return 0;
1430}
1431EOF
1432 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1433 log_success "found"
1434 fi
1435}
1436
1437
1438#
1439# Check for Linux sources
1440#
1441check_linux()
1442{
1443 test_header "Linux kernel sources"
1444 cat > $ODIR.tmp_src.c << EOF
1445#include <linux/version.h>
1446int printf(const char *format, ...);
1447int main(void)
1448{
1449 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1450 (LINUX_VERSION_CODE % 65536) / 256,
1451 LINUX_VERSION_CODE % 256);
1452#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1453 printf(", OK.\n");
1454 return 0;
1455#else
1456 printf(", expected version 2.4.0 or higher\n");
1457 return 1;
1458#endif
1459}
1460EOF
1461 echo "compiling the following source file:" >> $LOG
1462 cat $ODIR.tmp_src.c >> $LOG
1463 echo "using the following command line:" >> $LOG
1464 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1465 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1466 if [ $? -ne 0 ]; then
1467 echo
1468 echo " Linux kernel headers not found at $LINUX"
1469 echo " Check the file $LOG for detailed error information."
1470 fail
1471 else
1472 if test_execute; then
1473 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1474 fi
1475 fi
1476}
1477
1478
1479#
1480# Check for kchmviewer, needed to display the online help
1481# (unused as we ship kchmviewer)
1482#
1483check_kchmviewer()
1484{
1485 test_header kchmviewer
1486 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1487 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1488 if [ $? -ne 0 ]; then
1489 log_failure "not found"
1490 fail
1491 else
1492 log_success "found version $kchmviewer_ver"
1493 fi
1494 fi
1495}
1496
1497
1498#
1499# Check for the kBuild tools, we don't support GNU make
1500#
1501check_kbuild()
1502{
1503 test_header kBuild
1504 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1505 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1506 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1507 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1508 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1509 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1510 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1511 if [ "$OS" = "solaris" ]; then
1512 # Because of sh being non-default shell in Solaris we need to export PATH again when
1513 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1514 echo "PATH=\"$ORGPATH\"" >> $ENV
1515 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1516 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1517 else
1518 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1519 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1520 fi
1521 echo "export PATH" >> $ENV
1522 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1523 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1524 elif check_avail "kmk" KBUILDDIR really; then
1525 # check for installed kBuild
1526 KBUILD_SED="`which_wrapper kmk_sed`"
1527 else
1528 fail
1529 fi
1530 log_success "found"
1531}
1532
1533
1534#
1535# Check for compiler.h
1536# Some Linux distributions include "compiler.h" in their libc linux
1537# headers package, some don't. Most don't need it, building might (!)
1538# not succeed on openSUSE without it.
1539#
1540# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1541#
1542check_compiler_h()
1543{
1544 test_header compiler.h
1545 if ! test -f "/usr/include/linux/compiler.h"; then
1546 cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
1547 log_success "compiler.h not found"
1548 else
1549 log_success "compiler.h found"
1550 fi
1551}
1552
1553#
1554# Check for libcap.
1555# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1556# sockets for doing ICMP requests.
1557#
1558check_libcap()
1559{
1560 test_header "libcap library"
1561 cat > $ODIR.tmp_src.cc << EOF
1562#include <cstdio>
1563#include <sys/capability.h>
1564
1565extern "C" int main(void)
1566{
1567 char buf[1024];
1568 cap_t caps = cap_get_proc();
1569 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1570 return 0;
1571}
1572EOF
1573 if test_compile $LIBCAP libcap libcap; then
1574 if test_execute; then
1575 log_success "found"
1576 fi
1577 fi
1578}
1579
1580#
1581# Check if we are able to build 32-bit applications (needed for the guest additions)
1582#
1583check_32bit()
1584{
1585 test_header "32-bit support"
1586 cat > $ODIR.tmp_src.c << EOF
1587#include <stdint.h>
1588int main(void)
1589{
1590 return 0;
1591}
1592EOF
1593 echo "compiling the following source file:" >> $LOG
1594 cat $ODIR.tmp_src.c >> $LOG
1595 echo "using the following command line:" >> $LOG
1596 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1597 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1598 if [ $? -ne 0 ]; then
1599 echo
1600 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1601 echo " Check the file $LOG for detailed error information."
1602 fail
1603 fi
1604 log_success ""
1605}
1606
1607
1608#
1609# Check for Python
1610#
1611check_python()
1612{
1613 test_header "python support"
1614 cat > $ODIR.tmp_src.cc << EOF
1615#include <cstdio>
1616#include <Python.h>
1617extern "C" int main(void)
1618{
1619 Py_Initialize();
1620 printf("found version %s", PY_VERSION);
1621#if PY_VERSION_HEX >= 0x02030000
1622 printf(", OK.\n");
1623 return 0;
1624#else
1625 printf(", expected version 2.3 or higher\n");
1626 return 1;
1627#endif
1628}
1629EOF
1630 found=
1631 for p in $PYTHONDIR; do
1632 for d in python2.6 python2.5 python2.4 python2.3; do
1633 for b in lib64 lib/64 lib; do
1634 echo "compiling the following source file:" >> $LOG
1635 cat $ODIR.tmp_src.cc >> $LOG
1636 echo "using the following command line:" >> $LOG
1637 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1638 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1639 if [ $? -eq 0 ]; then
1640 found=1
1641 break
1642 fi
1643 done
1644 if [ -n "$found" ]; then break; fi
1645 done
1646 if [ -n "$found" ]; then break; fi
1647 done
1648 if [ -n "$found" ]; then
1649 if test_execute; then
1650 cnf_append "VBOX_WITH_PYTHON" "1"
1651 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1652 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1653 else
1654 log_failure "not found"
1655 fail
1656 fi
1657 else
1658 log_failure "not found"
1659 fail
1660 fi
1661}
1662
1663
1664#
1665# Setup wine
1666#
1667setup_wine()
1668{
1669 test_header "Wine support"
1670 if ! which_wrapper wine > /dev/null; then
1671 echo " wine binary not found"
1672 fail
1673 fi
1674 if ! which_wrapper wineprefixcreate > /dev/null; then
1675 echo " wineprefixcreate not found"
1676 fail
1677 fi
1678 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1679 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1680 rm -rf $WINEPREFIX
1681 mkdir -p $WINEPREFIX
1682 touch $WINEPREFIX/.no_prelaunch_window_flag
1683 if ! wineprefixcreate -q > /dev/null 2>&1; then
1684 echo " wineprefixcreate failed"
1685 fail
1686 fi
1687 tmp=.tmp.wine.reg
1688 rm -f $tmp
1689 echo 'REGEDIT4' > $tmp
1690 echo '' >> $tmp
1691 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1692 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
1693 echo '' >> $tmp
1694 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1695 echo '"itss"="native"' >> $tmp
1696 echo '' >> $tmp
1697 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1698 echo '"itss"="native"' >> $tmp
1699 echo '' >> $tmp
1700 if ! wine regedit $tmp > /dev/null 2>&1; then
1701 rm -f $tmp
1702 echo " failed to load registry changes (path)."
1703 fail
1704 fi
1705 rm -f $tmp
1706 log_success "found"
1707}
1708
1709#
1710# Check for gSOAP.
1711#
1712check_gsoap()
1713{
1714 test_header "GSOAP compiler"
1715 if [ -z "$GSOAP" ]; then
1716 GSOAP="/usr"
1717 fi
1718 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1719 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1720 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1721 # TODO: Check for libgsoap++.a/so
1722
1723 if [ -z "$GSOAP_IMPORT" ]; then
1724 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1725 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1726 GSOAP_IMPORT="$GSOAP/include/gsoap"
1727 fi
1728 fi
1729 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1730 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1731 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1732 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1733 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1734 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoap++"
1735 log_success "found"
1736 else
1737 log_failure "stlvector.h not found -- disabling webservice"
1738 cnf_append "VBOX_WITH_WEBSERVICES" ""
1739 fi
1740 else
1741 log_failure "stdsoap2.h not found -- disabling webservice"
1742 cnf_append "VBOX_WITH_WEBSERVICES" ""
1743 fi
1744 else
1745 log_failure "wsdl2h not found -- disabling webservice"
1746 cnf_append "VBOX_WITH_WEBSERVICES" ""
1747 fi
1748 else
1749 log_failure "soapcpp2 not found -- disabling webservice"
1750 cnf_append "VBOX_WITH_WEBSERVICES" ""
1751 fi
1752}
1753
1754
1755#
1756# Determines the Darwin version.
1757# @todo This should really check the Xcode/SDK version.
1758#
1759check_darwinversion()
1760{
1761 test_header "Darwin version"
1762 darwin_ver=`uname -r`
1763 case "$darwin_ver" in
1764 9\.*)
1765 darwin_ver="10.5"
1766 #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
1767 ;;
1768 8\.*)
1769 darwin_ver="10.4"
1770 ;;
1771 *)
1772 echo " failed to determin darwin version. (uname -r: $darwin_ver)"
1773 fail
1774 darwin_ver="unknown"
1775 ;;
1776 esac
1777 log_success "found version $darwin_ver"
1778}
1779
1780
1781#
1782# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1783# is around to prevent confusion when the build fails in src/recompiler.
1784# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1785#
1786check_i386elfgcc()
1787{
1788 test_header "i386-elf-gcc"
1789 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1790 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1791 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1792 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1793 if test -z "$i386_elf_gcc"; then
1794 echo " failed to find i386-elf-gcc"
1795 fail
1796 fi
1797 log_success "found $i386_elf_gcc"
1798}
1799
1800
1801#
1802# Show help
1803#
1804show_help()
1805{
1806 cat << EOF
1807Usage: ./configure [OPTIONS]...
1808
1809Configuration:
1810 -h, --help display this help and exit
1811 --nofatal don't abort on errors
1812 --disable-xpcom disable XPCOM and related stuff
1813 --disable-python disable python bindings
1814 --disable-sdl-ttf disable SDL_ttf detection
1815 --disable-alsa disable the ALSA sound backend
1816 --disable-pulse disable the PulseAudio backend
1817 --disable-dbus don't use DBus and hal for hardware detection
1818 --disable-kmods don't build Linux kernel modules (host and guest)
1819 --disable-hardening don't be strict about /dev/vboxdrv access
1820 --disable-opengl disable OpenGL support
1821 --enable-webservice enable the webservice stuff
1822 --build-libxml2 build libxml2 from sources
1823 --build-libxslt build libxslt from sources
1824 --setup-wine setup a Wine directory and register the hhc hack
1825
1826Paths:
1827 --with-gcc=PATH location of the gcc compiler [$CC]
1828 --with-g++=PATH location of the g++ compiler [$CXX]
1829 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1830 --with-iasl=PATH location of the iasl compiler [$IASL]
1831 --with-linux=DIR Linux kernel source directory [$LINUX]
1832 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1833 --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
1834 --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries
1835 (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)
1836 --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)
1837 --out-path=PATH the folder to which configuration and build output
1838 should go
1839
1840Build type:
1841 -d, --build-debug build with debugging symbols and assertions
1842 --build-profile build with profiling support
1843 --build-headless build headless (without any X11 frontend)
1844EOF
1845 exit 0
1846}
1847
1848
1849#
1850# The body.
1851#
1852
1853# scan command line options
1854for option in $*; do
1855 case "$option" in
1856 --help|-help|-h)
1857 show_help
1858 ;;
1859 --nofatal)
1860 nofatal=1
1861 ;;
1862 --env-only)
1863 ENV_ONLY=1
1864 ;;
1865 --with-gcc=*)
1866 CC=`echo $option | cut -d'=' -f2`
1867 ;;
1868 --with-g++=*)
1869 CXX=`echo $option | cut -d'=' -f2`
1870 ;;
1871 --with-kbuild=*)
1872 KBUILDDIR=`echo $option | cut -d'=' -f2`
1873 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1874 echo "Error: KBUILDDIR contains invalid characters!"
1875 exit 1
1876 fi
1877 ;;
1878 --with-qt-dir=*|--with-qt4-dir=*)
1879 QT4DIR=`echo $option | cut -d'=' -f2`
1880 QT4DIR_PKGCONFIG=0
1881 ;;
1882 --with-gsoap-dir=*)
1883 GSOAP=`echo $option | cut -d'=' -f2`
1884 ;;
1885 --with-gsoap-import=*)
1886 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
1887 ;;
1888 --with-iasl=*)
1889 IASL=`echo $option | cut -d'=' -f2`
1890 ;;
1891 --with-linux=*)
1892 LINUX=`echo $option | cut -d'=' -f2`
1893 ;;
1894 --with-mkisofs=*)
1895 MKISOFS=`echo $option | cut -d'=' -f2`
1896 ;;
1897 --disable-xpcom)
1898 WITH_XPCOM=0
1899 ;;
1900 --disable-python)
1901 WITH_PYTHON=0
1902 ;;
1903 --disable-sdl-ttf)
1904 WITH_SDL_TTF=0
1905 ;;
1906 --disable-qt)
1907 WITH_QT4=0
1908 ;;
1909 --disable-qt4)
1910 WITH_QT4=0
1911 ;;
1912 --disable-alsa)
1913 WITH_ALSA=0
1914 ;;
1915 --disable-pulse)
1916 WITH_PULSE=0
1917 ;;
1918 --disable-dbus)
1919 WITH_DBUS=0
1920 ;;
1921 --disable-kmods)
1922 WITH_KMODS=0
1923 ;;
1924 --disable-opengl)
1925 WITH_OPENGL=0
1926 ;;
1927 --disable-hardening)
1928 WITH_HARDENING=0
1929 ;;
1930 --enable-hardening)
1931 WITH_HARDENING=2
1932 ;;
1933 --enable-webservice)
1934 WITH_GSOAP=1
1935 ;;
1936 --build-debug|-d)
1937 BUILD_TYPE=debug
1938 ;;
1939 --build-profile)
1940 BUILD_TYPE=profile
1941 ;;
1942 --build-libxml2)
1943 BUILD_LIBXML2=1
1944 ;;
1945 --build-libxslt)
1946 BUILD_LIBXSLT=1
1947 ;;
1948 --build-headless)
1949 HEADLESS=1
1950 WITH_SDL=0
1951 WITH_SDL_TTF=0
1952 WITH_X11=0
1953 WITH_OPENGL=0
1954 WITH_QT4=0
1955 ;;
1956 --ose)
1957 OSE=2
1958 ;;
1959 --odir=*)
1960 ODIR="`echo $option | cut -d'=' -f2`/"
1961 ODIR_OVERRIDE=1
1962 ;;
1963 --out-path=*)
1964 out_path="`echo $option | cut -d'=' -f2`/"
1965 if [ -d $out_path ]; then
1966 saved_path="`pwd`"
1967 cd $out_path
1968 OUT_PATH="`pwd`"
1969 cd $saved_path
1970 OUT_PATH_OVERRIDE=1
1971 if [ $ODIR_OVERRIDE -eq 0 ]; then
1972 # This variable has not *yet* been overridden. That can still happen.
1973 ODIR=$OUT_PATH/
1974 fi
1975 else
1976 echo "Error: invalid folder \"$out_path\" in option \"$option\""
1977 exit 1
1978 fi
1979 ;;
1980 --setup-wine)
1981 SETUP_WINE=1
1982 ;;
1983 *)
1984 echo
1985 echo "Unrecognized option \"$option\""
1986 echo
1987 show_help
1988 ;;
1989 esac
1990done
1991
1992LOG="$ODIR$LOG"
1993ENV="$ODIR$ENV"
1994CNF="$ODIR$CNF"
1995
1996# initialize output files
1997cat > $LOG << EOF
1998# Log file generated by
1999#
2000# '$0 $*'
2001#
2002
2003EOF
2004cat > $CNF << EOF
2005# -*- Makefile -*-
2006#
2007# automatically generated by
2008#
2009# '$0 $*'
2010#
2011# It will be completely overwritten if configure is executed again.
2012#
2013
2014EOF
2015cat > $ENV << EOF
2016#!/bin/bash
2017#
2018# automatically generated by
2019#
2020# '$0 $*'
2021#
2022# It will be completely overwritten if configure is executed again.
2023# Make sure you source this file once before you start to build VBox.
2024#
2025
2026EOF
2027
2028# test if we are OSE
2029if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
2030 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
2031 echo >> $LOG
2032 OSE=0
2033fi
2034
2035if [ "$BUILD_TYPE" = "debug" ]; then
2036 echo "Creating DEBUG build!" >> $LOG
2037elif [ "$BUILD_TYPE" = "profile" ]; then
2038 echo "Creating PROFILE build!" >> $LOG
2039fi
2040
2041# first determine our environment
2042check_environment
2043check_kbuild
2044
2045[ -n "$ENV_ONLY" ] && exit 0
2046
2047# append the tools directory to the default search path
2048echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2049export PATH
2050
2051# if we will be writing to a different out directory then set this up now
2052if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2053 echo "export AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2054 echo "export LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2055 echo "export PATH_OUT_BASE=$OUT_PATH" >> $ENV
2056fi
2057
2058# some things are not available in for OSE
2059if [ $OSE -ge 1 ]; then
2060 cnf_append "VBOX_OSE" "1"
2061 cnf_append "VBOX_WITH_TESTSUITE" ""
2062 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2063
2064 if [ "$OS" = "linux" ]; then
2065 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2066 else
2067 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2068 fi
2069 echo >> $CNF
2070fi
2071
2072# headless
2073if [ -n "$HEADLESS" ]; then
2074 cnf_append "VBOX_HEADLESS" "1"
2075fi
2076
2077if [ $WITH_OPENGL -eq 0 ]; then
2078 cnf_append "VBOX_WITH_CROGL" ""
2079fi
2080
2081if [ "$OS" = "darwin" ]; then
2082 # On Darwin we want to build against Qt4 only. WITH_QT4 is enabled by
2083 # default so disable Qt3. --disable-qt disables both Qt3 and Qt4 GUI now,
2084 # --disable-qt4 disables only the Qt4 GUI (which is not appropriate for
2085 # Darwin as we disable the Qt3 here anyway.
2086 # (Qt3 builds for Intel Macs are usually not threaded or for X11. And they
2087 # don't contain our patches, which means the result isn't really usable.)
2088 BUILD_LIBXSLT=1
2089 BUILD_LIBXML2=1
2090fi
2091
2092# emit disable directives corresponding to any --disable-xxx options.
2093[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2094[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2095[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2096[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2097[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2098
2099# the tools
2100check_gcc
2101[ "$OS" != "darwin" ] && check_as86
2102[ "$OS" != "darwin" ] && check_bcc
2103[ "$OS" != "darwin" ] && check_iasl
2104# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2105# [ "$OS" != "darwin" ] && check_yasm
2106[ "$OS" != "darwin" ] && check_xsltproc
2107[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
2108
2109# the libraries
2110[ "$OS" != "darwin" ] && check_pthread
2111[ $WITH_XPCOM -eq 1 ] && check_libxml2
2112[ $WITH_XPCOM -eq 1 ] && check_libxslt
2113[ $WITH_LIBIDL -eq 1 ] && check_libidl
2114# build openssl on Darwin in every case
2115[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
2116[ "$OS" != "darwin" ] && check_z
2117[ "$OS" != "darwin" -a "$OS" != "freebsd" ] && check_png
2118[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2119[ $WITH_SDL -eq 1 ] && check_sdl
2120[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2121[ $WITH_X11 -eq 1 ] && check_x
2122# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2123# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2124[ $WITH_X11 -eq 1 ] && check_xcursor
2125[ $WITH_OPENGL -eq 1 ] && check_xmu
2126[ $WITH_OPENGL -eq 1 ] && check_mesa
2127[ $WITH_QT4 -eq 1 ] && check_qt4
2128[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
2129
2130# Linux-specific
2131if [ "$OS" = "linux" ]; then
2132 check_staticlibstdcxx
2133 if [ $WITH_KMODS -eq 1 ]; then
2134 check_linux
2135 else
2136 cnf_append "VBOX_LINUX_SRC" ""
2137 cnf_append "VBOX_WITH_VBOXDRV" ""
2138 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2139 fi
2140 if [ $WITH_ALSA -eq 1 ]; then
2141 check_alsa
2142 else
2143 cnf_append "VBOX_WITH_ALSA" ""
2144 fi
2145 if [ $WITH_PULSE -eq 1 ]; then
2146 check_pulse
2147 else
2148 cnf_append "VBOX_WITH_PULSE" ""
2149 fi
2150 if [ $WITH_DBUS -eq 0 ]; then
2151 cnf_append "VBOX_WITH_DBUS" ""
2152 fi
2153 check_libcap
2154 check_compiler_h
2155 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
2156fi
2157
2158[ -n "$SETUP_WINE" ] && setup_wine
2159
2160if [ $OSE -ge 1 ]; then
2161 if [ $WITH_GSOAP -eq 1 ]; then
2162 check_gsoap
2163 else
2164 cnf_append "VBOX_WITH_WEBSERVICES" ""
2165 fi
2166fi
2167
2168# Darwin-specific
2169if [ "$OS" = "darwin" ]; then
2170 check_darwinversion
2171 check_i386elfgcc
2172fi
2173
2174# success!
2175echo
2176echo "Successfully generated '$CNF' and '$ENV'."
2177echo "Source '$ENV' once before you start to build VBox:"
2178echo ""
2179echo " source $ENV"
2180echo " kmk"
2181echo ""
2182if [ "$OS" = "linux" ]; then
2183 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2184 vbox_out_path=$OUT_PATH
2185 else
2186 vbox_out_path=./out
2187 fi
2188 echo "To compile the kernel module, do:"
2189 echo ""
2190 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src/vboxdrv"
2191 echo " make"
2192 echo ""
2193fi
2194if [ $WITH_HARDENING -gt 0 ]; then
2195 echo ""
2196 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2197 echo " Hardening is enabled which means that the VBox binaries will not run from"
2198 echo " the binary directory. The binaries have to be installed suid root and some"
2199 echo " more prerequisites have to be fulfilled which is normally done by installing"
2200 echo " the final package. For development, the hardening feature can be disabled"
2201 echo " by specifying the --disable-hardening parameter. Please never disable that"
2202 echo " feature for the final distribution!"
2203 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2204 echo ""
2205else
2206 echo ""
2207 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2208 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2209 echo " disabled hardening!"
2210 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2211 echo ""
2212fi
2213echo "Enjoy!"
2214cleanup
Note: See TracBrowser for help on using the repository browser.

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