VirtualBox

source: vbox/trunk/configure@ 6102

Last change on this file since 6102 was 6101, checked in by vboxsync, 17 years ago

configure: added PulseAudio detection, added --disable-pulse to disable the PulseAudio backend

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 40.4 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-2007 innotek GmbH
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#
27# Defaults
28#
29OSE=1
30ODIR="`pwd`/"
31SETUP_WINE=
32TARGET_MACHINE=""
33TARGET_CPU=""
34WITH_XPCOM=1
35WITH_LIBIDL=1
36WITH_QT=1
37WITH_SDL=1
38WITH_SDL_TTF=1
39WITH_X11=1
40WITH_PULSE=1
41CC="gcc"
42CC32=""
43CC64=""
44CXX="g++"
45CXX32=""
46CXX64=""
47BCC="bcc"
48YASM="yasm"
49IASL="iasl"
50AS86="as86"
51XSLTPROC="xsltproc"
52GENISOIMAGE="genisoimage"
53MKISOFS="mkisofs"
54INCXALAN="/usr/local/include"
55LIBXALAN="-lxalan-c"
56LIBXALAN_DIR="/usr/local/lib"
57INCXERCES="/usr/local/include"
58LIBXERCES="-lxerces-c"
59LIBXERCES_DIR="/usr/local/lib"
60BUILD_LIBXML2=
61LIBCRYPTO="-lcrypto"
62LIBPTHREAD="-lpthread"
63LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
64INCX11="/usr/local/include"
65LIBXCURSOR="-lXcursor"
66INCZ=""
67LIBZ="-lz"
68INCPNG=""
69LIBPNG="-lpng"
70QTDIR="/usr/qt/3 /usr/lib/qt3 /usr/lib/qt-3.3 /usr/share/qt3 /usr/lib64/qt-3.3 /usr/X11R6 /usr/lib/qt"
71KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
72DEVDIR="`cd \`dirname $0\`; pwd`/tools"
73if [ -d "/lib/modules/`uname -r`/build" ]; then
74 LINUX="/lib/modules/`uname -r`/build"
75else
76 LINUX="/usr/src/linux"
77fi
78KCHMVIEWER="kchmviewer"
79LOG="configure.log"
80CNF="AutoConfig.kmk"
81ENV="env.sh"
82BUILD_TYPE="release"
83# the restricting tool is ar (mri mode).
84INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
85
86if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
87 echo "Error: VBox base path contains invalid characters!"
88 exit 1
89fi
90
91cleanup()
92{
93 rm -f .tmp_src.cc .tmp_src.c .tmp_out .test_execute.log
94}
95
96fail()
97{
98 if [ -z "$nofatal" -o "x$1" != "x" ]; then
99 cleanup
100 rm -f $ENV
101 exit 1
102 fi
103}
104
105log_success()
106{
107 if [ -n "$1" ]; then echo -n "$1, "; fi
108 echo "OK."
109 echo "$1" >> $LOG
110 echo >> $LOG
111 echo >> $LOG
112}
113
114log_failure()
115{
116 echo
117 echo " ** $1!"
118 echo "** $1!" >> $LOG
119 echo >> $LOG
120}
121
122cnf_append()
123{
124 printf "%-30s := %s\n" "$1" "$2" >> $CNF
125}
126
127strip_l()
128{
129 echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|-[^l]\([^ ]\+\)||g; s|^ ||; s| *$||g'
130}
131
132strip_L()
133{
134 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|-[^L]\([^ ]\+\)||g; s|^ ||; s| *$||g'
135}
136
137strip_I()
138{
139 echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|-[^I]\([^ ]\+\)||g; s|^ ||; s| *$||g'
140}
141
142prefix_I()
143{
144 echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
145}
146
147# Wrapper for ancient /usr/bin/which on darwin that always returns 0
148which_wrapper()
149{
150 if [ -z "$have_ancient_which" ]; then
151 if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
152 have_ancient_which="yes"
153 else
154 have_ancient_which="no"
155 fi
156 fi
157 if [ "$have_ancient_which" = "yes" ]; then
158 retval=`which $* 2>/dev/null`
159 echo "$retval"
160 test -n "$retval" -a -e "$retval"
161 unset retval
162 else
163 which $* 2> /dev/null
164 fi
165}
166
167check_avail()
168{
169 if [ -z "$1" ]; then
170 log_failure "$2 is empty"
171 fail $3
172 return 1
173 elif which_wrapper $1 > /dev/null; then
174 return 0
175 else
176 log_failure "$1 (variable $2) not found"
177 fail $3
178 return 1
179 fi
180}
181
182# Prepare a test
183test_header()
184{
185 echo "***** Checking $1 *****" >> $LOG
186 echo -n "Checking for $1: "
187}
188
189# Compile a test
190test_compile()
191{
192 echo "compiling the following source file:" >> $LOG
193 cat .tmp_src.cc >> $LOG
194 echo "using the following command line:" >> $LOG
195 echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc \"$1\"" >> $LOG
196 $CXX -O -Wall -o .tmp_out .tmp_src.cc $1 >> $LOG 2>&1
197 if [ $? -ne 0 ]; then
198 if [ -z "$4" ]; then
199 echo
200 echo " $2 not found at $1 or $3 headers not found"
201 echo " Check the file $LOG for detailed error information."
202 fail
203 else
204 echo "not found."
205 echo >> $LOG
206 echo >> $LOG
207 fi
208 return 1
209 fi
210 return 0
211}
212
213# Execute a compiled test binary
214test_execute()
215{
216 echo "executing the binary" >> $LOG
217 ./.tmp_out > .test_execute.log
218 rc=$?
219 cat .test_execute.log | tee -a $LOG
220 if [ $rc -ne 0 ]; then
221 fail $1
222 return 1
223 fi
224 echo >> $LOG
225 echo >> $LOG
226 return 0
227}
228
229#
230# Check for OS, MACHINE, CPU
231#
232check_environment()
233{
234 test_header environment
235 OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
236 case "$OS" in
237 linux)
238 ;;
239 darwin)
240 ;;
241 freebsd)
242 ;;
243 sunos)
244 OS='solaris'
245 ;;
246 *)
247 log_failure "Cannot determine OS"
248 exit 1
249 ;;
250 esac
251 BUILD_CPU=`uname -m`
252 [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
253 case "$BUILD_CPU" in
254 i[3456789]86|x86|i86pc)
255 BUILD_MACHINE='x86'
256 LIB='lib'
257 ;;
258 x86_64|amd64)
259 BUILD_MACHINE='amd64'
260 BUILD_CPU='k8'
261 if [ "$OS" != "solaris" ]; then
262 # on AMD64 systems, 64bit libs are usually located in /usr/lib64
263 # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
264 LIB='lib64'
265 else
266 # Solaris doesn't seem to subscribe to fhs, libs are usually in
267 # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
268 # alternative binaries can be found in 'amd64' subdirs of the 'bin'
269 # ones. So, in order to find the right stuff (esp. sdl-config) we'll
270 # have to make sure the */bin/amd64 dirs are searched before the */bin
271 # ones. (The sed has some sideeffects, but they shouldn't harm us...)
272 echo "64-bit Solaris detected, hacking the PATH" >> $LOG
273 echo "old PATH: $PATH" >> $LOG
274 PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
275 -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
276 export PATH
277 echo "new PATH: $PATH" >> $LOG
278 LIB='lib/64'
279 fi
280 ;;
281 *)
282 log_failure "Cannot determine system"
283 exit 1
284 ;;
285 esac
286 [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
287 [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
288 DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
289 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
290 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
291 log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
292
293 # Automatically disable XPCOM on darwin.
294 if [ "$OS" = "darwin" -a $WITH_XPCOM -eq 1 ]; then
295 WITH_XPCOM=0
296 WITH_LIBIDL=0
297 WITH_QT=0
298 WITH_SDL=0
299 WITH_SDL_TTF=0
300 WITH_X11=0
301 echo "Disabling checks for XPCOM related components."
302 fi
303}
304
305#
306# Check for gcc with version >= 3.2.
307# We depend on a working gcc, if we fail terminate in every case.
308#
309check_gcc()
310{
311 test_header gcc
312 if check_avail "$CC" CC really; then
313 cc_ver=`$CC -dumpversion`
314 if check_avail "$CXX" CXX really; then
315 cxx_ver=`$CXX -dumpversion`
316 cc_maj=`echo $cc_ver|cut -d. -f1`
317 cc_min=`echo $cc_ver|cut -d. -f2`
318 if [ "x$cc_ver" != "x$cxx_ver" ]; then
319 log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
320 fail really
321 elif [ $cc_maj -eq 4 -a $cc_min -eq 0 ]; then
322 if [ "$OS" = "darwin" ]; then
323 log_success "found version $cc_ver"
324 else
325 log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with x>0"
326 fail really
327 fi
328 elif [ $cc_maj -gt 3 ]; then
329 log_success "found version $cc_ver"
330 elif [ $cc_maj -lt 3 -o $cc_min -lt 2 ]; then
331 log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with x>0"
332 fail really
333 else
334 log_success "found version $cc_ver"
335 fi
336 if [ "$BUILD_MACHINE" = "amd64" ]; then
337 [ -z "$CC32" ] && CC32="$CC -m32"
338 [ -z "$CXX32" ] && CXX32="$CXX -m32"
339 else
340 [ -z "$CC32" ] && CC32="$CC"
341 [ -z "$CXX32" ] && CXX32="$CXX"
342 fi
343 if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
344 [ -z "$CC64" ] && CC64="$CC -m64"
345 [ -z "$CXX64" ] && CXX64="$CXX -m64"
346 fi
347 if [ "$CC" != "gcc" ]; then
348 cnf_append "TOOL_GCC3_CC" "$CC"
349 cnf_append "TOOL_GCC3_AS" "$CC"
350 cnf_append "TOOL_GCC3_LD" "$CC"
351 cnf_append "TOOL_GXX3_CC" "$CC"
352 cnf_append "TOOL_GXX3_AS" "$CC"
353 fi
354 if [ "$CXX" != "g++" ]; then
355 cnf_append "TOOL_GCC3_CXX" "$CXX"
356 cnf_append "TOOL_GXX3_CXX" "$CXX"
357 cnf_append "TOOL_GXX3_LD" "$CXX"
358 fi
359 if [ "$CC32" != "gcc -m32" ]; then
360 cnf_append "TOOL_GCC32_CC" "$CC32"
361 cnf_append "TOOL_GCC32_AS" "$CC32"
362 cnf_append "TOOL_GCC32_LD" "$CC32"
363 cnf_append "TOOL_GXX32_CC" "$CC32"
364 cnf_append "TOOL_GXX32_AS" "$CC32"
365 fi
366 if [ "$CXX32" != "g++ -m32" ]; then
367 cnf_append "TOOL_GCC32_CXX" "$CXX32"
368 cnf_append "TOOL_GXX32_CXX" "$CXX32"
369 cnf_append "TOOL_GXX32_LD" "$CXX32"
370 fi
371 # this isn't not necessary, there is not such tool.
372 if [ -n "$CC64" ]; then
373 cnf_append "TOOL_GCC64_CC" "$CC64"
374 cnf_append "TOOL_GCC64_AS" "$CC64"
375 cnf_append "TOOL_GCC64_LD" "$CC64"
376 cnf_append "TOOL_GXX64_CC" "$CC64"
377 cnf_append "TOOL_GXX64_AS" "$CC64"
378 fi
379 if [ -n "$CXX64" ]; then
380 cnf_append "TOOL_GCC64_CXX" "$CXX64"
381 cnf_append "TOOL_GXX64_CXX" "$CXX64"
382 cnf_append "TOOL_GXX64_LD" "$CXX64"
383 fi
384 # Solaris sports a 32-bit gcc/g++.
385 if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
386 [ "$CC" = "gcc" ] && CC="gcc -m64"
387 [ "$CXX" = "g++" ] && CXX="g++ -m64"
388 fi
389 fi
390 fi
391}
392
393#
394# Check for the bcc compiler, needed for compiling the BIOS
395#
396check_bcc()
397{
398 test_header bcc
399 if check_avail "$BCC" BCC; then
400 bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
401 if [ $? -ne 0 ]; then
402 log_failure "not found"
403 fail
404 else
405 echo "compiling the following source file:" >> $LOG
406 cat > .tmp_src.c << EOF
407int foo(a)
408 int a;
409{
410 return 0;
411}
412EOF
413 cat .tmp_src.c >> $LOG
414 bcc_path=`which_wrapper $BCC`
415 bcc_dir="`dirname $bcc_path`/"
416 echo "using the following command line:" >> $LOG
417 echo "$BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c" >> $LOG
418 $BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c >> $LOG 2>&1
419 if [ $? -ne 0 ]; then
420 log_failure "not found"
421 fail
422 else
423 log_success "found version $bcc_ver"
424 cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
425 fi
426 unset bcc_path
427 unset bcc_dir
428 fi
429 fi
430}
431
432#
433# Check for the as86 assembler, needed for compiling the BIOS
434#
435check_as86()
436{
437 test_header as86
438 if check_avail "$AS86" AS86; then
439 as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
440 if [ $? -ne 0 ]; then
441 log_failure "not found"
442 fail
443 else
444 log_success "found version $as86_ver"
445 cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
446 fi
447 fi
448}
449
450#
451# Check for yasm, needed to compile assembler files
452#
453check_yasm()
454{
455 test_header yasm
456 if check_avail "$YASM" YASM; then
457 yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
458 if [ $? -ne 0 ]; then
459 log_failure "not found"
460 fail
461 else
462 yasm_maj=`echo $yasm_ver|cut -d. -f1`
463 yasm_min=`echo $yasm_ver|cut -d. -f2`
464 yasm_rev=`echo $yasm_ver|cut -d. -f3`
465 yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
466 if [ $yasm_ver_mul -lt 501 ]; then
467 log_failure "found version $yasm_ver, expected at least 0.5.1"
468 fail
469 else
470 log_success "found version $yasm_ver"
471 fi
472 fi
473 fi
474}
475
476#
477# Check for the iasl ACPI compiler, needed to compile vbox.dsl
478#
479check_iasl()
480{
481 test_header iasl
482 if check_avail "$IASL" IASL; then
483 iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
484 if [ $? -ne 0 ]; then
485 log_failure "not found"
486 fail
487 else
488 log_success "found version $iasl_ver"
489 cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
490 fi
491 fi
492}
493
494#
495# Check for xsltproc, needed by Main
496#
497check_xsltproc()
498{
499 test_header xslt
500 if check_avail "$XSLTPROC" XSLTPROC; then
501 xsltproc_ver=`$XSLTPROC --version`
502 if [ $? -ne 0 ]; then
503 log_failure "not found"
504 fail
505 else
506 log_success "found"
507 cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
508 fi
509 fi
510}
511
512#
513# Check for mkisofs, needed to build the CDROM image containing the additions
514#
515check_mkisofs()
516{
517 test_header mkisofs
518 if which_wrapper $GENISOIMAGE > /dev/null; then
519 mkisofs_ver=`$GENISOIMAGE --version`
520 if [ $? -ne 0 ]; then
521 log_failure "not found"
522 fail
523 else
524 log_success "found $mkisofs_ver"
525 cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
526 fi
527 elif check_avail "$MKISOFS" MKISOFS; then
528 mkisofs_ver=`$MKISOFS --version`
529 if [ $? -ne 0 ]; then
530 log_failure "not found"
531 fail
532 else
533 log_success "found $mkisofs_ver"
534 cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
535 fi
536 fi
537}
538
539#
540# Check for xalan, needed by VBoxXML
541#
542check_xalan()
543{
544 if [ -n "$LIBXALAN" ]; then
545 test_header xalan
546 cat > .tmp_src.cc << EOF
547#include <cstdio>
548#include <xalanc/Include/XalanVersion.hpp>
549extern "C" int main(void)
550{
551 printf("found version %d.%d.%d",
552 XALAN_VERSION_MAJOR, XALAN_VERSION_MINOR, XALAN_VERSION_REVISION);
553#if _XALAN_VERSION >= 10800
554 printf(", OK.\n");
555 return 0;
556#else
557 printf(", expected version 1.8.0 or higher\n");
558 return 1;
559#endif
560}
561EOF
562 [ -n "$INCXALAN" ] && I_INCXALAN=`prefix_I "$INCXALAN"`
563 if test_compile "$LIBXALAN $LIBPTHREAD $I_INCXALAN" xalan xalanc; then
564 if test_execute; then
565 cnf_append "SDK_VBOX_XALAN_LIBS" "`strip_l "$LIBXALAN"`"
566 cnf_append "SDK_VBOX_XALAN_LIBPATH" "`strip_L "$LIBXALAN"`"
567 cnf_append "SDK_VBOX_XALAN_INCS" "$INCXALAN"
568 fi
569 fi
570 else
571 echo "Building xalan from shipped sources."
572 echo "Building xalan from shipped sources." >> $LOG
573 echo >> $LOG
574 echo >> $LOG
575 fi
576}
577
578#
579# Check for xerces, needed by VBoxXML
580#
581check_xerces()
582{
583 if [ -n "$LIBXERCES" ]; then
584 test_header xerces
585 cat > .tmp_src.cc << EOF
586#include <cstdio>
587#include <xercesc/util/XercesVersion.hpp>
588extern "C" int main(void)
589{
590 printf("found version %d.%d.%d",
591 XERCES_VERSION_MAJOR, XERCES_VERSION_MINOR, XERCES_VERSION_REVISION);
592#if _XERCES_VERSION >= 20500
593 printf(", OK.\n");
594 return 0;
595#else
596 printf(", expected version 2.5.0 or higher\n");
597 return 1;
598#endif
599}
600EOF
601 [ -n "$INCXERCES" ] && I_INCXERCES=`prefix_I "$INCXERCES"`
602 if test_compile "$LIBXERCES $LIBPTHREAD $I_INCXERCES" xerces xercesc; then
603 if test_execute; then
604 cnf_append "SDK_VBOX_XERCES_LIBS" "`strip_l "$LIBXERCES"`"
605 cnf_append "SDK_VBOX_XERCES_LIBPATH" "`strip_L "$LIBXERCES"`"
606 cnf_append "SDK_VBOX_XERCES_INCS" "$INCXERCES"
607 fi
608 fi
609 else
610 echo "Building xerces from shipped sources."
611 echo "Building xerces from shipped sources." >> $LOG
612 echo >> $LOG
613 echo >> $LOG
614 fi
615}
616
617#
618# Check for libxml2, needed by xpcom
619# For now we check for libxml2 2.6.23 as 2.6.22 is known to NOT work
620#
621check_libxml2()
622{
623 if [ -z "$BUILD_LIBXML2" ]; then
624 test_header libxml2
625 if which_wrapper pkg-config > /dev/null; then
626 libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
627 if [ $? -ne 0 ]; then
628 log_failure "not found"
629 fail
630 else
631 FLGXML2=`pkg-config libxml-2.0 --cflags`
632 INCXML2=`strip_I "$FLGXML2"`
633 LIBXML2=`pkg-config libxml-2.0 --libs`
634 cat > .tmp_src.cc << EOF
635#include <cstdio>
636#include <libxml/xmlversion.h>
637extern "C" int main(void)
638{
639 printf("found version %s", LIBXML_DOTTED_VERSION);
640#if LIBXML_VERSION >= 20623
641 printf(", OK.\n");
642 return 0;
643#else
644 printf(", expected version 2.6.23 or higher\n");
645 return 1;
646#endif
647}
648EOF
649 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
650 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
651 if test_execute; then
652 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
653 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
654 fi
655 fi
656 fi
657 elif which_wrapper xml2-config; then
658 libxml2_ver=`xml2-config --version`
659 if [ $? -ne 0 ]; then
660 log_failure "not found"
661 fail
662 else
663 log_success "found version $libxml2_ver"
664 FLGXML2=`xml2-config --cflags`
665 INCXML2=`strip_I "$FLGXML2"`
666 LIBXML2=`xml2-config --libs`
667 cat > .tmp_src.cc << EOF
668#include <cstdio>
669#include <libxml/xmlversion.h>
670extern "C" int main(void)
671{
672 printf("found version %s", LIBXML_DOTTED_VERSION);
673#if LIBXML_VERSION >= 20623
674 printf(", OK.\n");
675 return 0;
676#else
677 printf(", expected version 2.6.23 or higher\n");
678 return 1;
679#endif
680}
681EOF
682 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
683 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
684 if test_execute; then
685 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
686 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
687 fi
688 fi
689 fi
690 else
691 log_failure "neither pkg-config nor xml2-config found"
692 fail
693 fi
694 fi
695}
696
697#
698# Check for libIDL, needed by xpcom
699#
700check_libidl()
701{
702 test_header libIDL
703
704 if which_wrapper libIDL-config-2 > /dev/null; then
705 libidl_ver=`libIDL-config-2 --version`
706 if [ $? -ne 0 ]; then
707 log_failure "not found"
708 fail
709 else
710 log_success "found version $libidl_ver"
711 cnf_append "VBOX_LIBIDL_CONFIG" \
712 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
713 fi
714 elif check_avail "libIDL-config" libIDL-config; then
715 libidl_ver=`libIDL-config --version`
716 if [ $? -ne 0 ]; then
717 log_failure "not found"
718 fail
719 else
720 log_success "found version $libidl_ver"
721 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
722 fi
723 fi
724}
725
726#
727# Check for openssl, needed for RDP
728#
729check_ssl()
730{
731 test_header ssl
732 cat > .tmp_src.cc << EOF
733#include <cstdio>
734#include <openssl/opensslv.h>
735extern "C" int main(void)
736{
737 printf("found version %s", OPENSSL_VERSION_TEXT);
738#if OPENSSL_VERSION_NUMBER >= 0x0090700
739 printf(", OK.\n");
740 return 0;
741#else
742 printf(", expected version 0.9.7 or higher\n");
743 return 1;
744#endif
745}
746EOF
747 if test_compile $LIBCRYPTO libcrypto openssl; then
748 if test_execute nofatal; then
749 cnf_append "SDK_VBOX_OPENSSL_INCS" ""
750 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
751 fi
752 fi
753}
754
755#
756# Check for pthread, needed by VBoxSVC, frontends, ...
757#
758check_pthread()
759{
760 test_header pthread
761 cat > .tmp_src.cc << EOF
762#include <cstdio>
763#include <pthread.h>
764extern "C" int main(void)
765{
766 pthread_mutex_t mutex;
767 if (pthread_mutex_init(&mutex, NULL)) {
768 printf("pthread_mutex_init() failed\n");
769 return 1;
770 }
771 if (pthread_mutex_lock(&mutex)) {
772 printf("pthread_mutex_lock() failed\n");
773 return 1;
774 }
775 if (pthread_mutex_unlock(&mutex)) {
776 printf("pthread_mutex_unlock() failed\n");
777 return 1;
778 }
779 printf("found, OK.\n");
780}
781EOF
782 if test_compile $LIBPTHREAD pthread pthread; then
783 if test_execute; then
784 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
785 fi
786 fi
787}
788
789#
790# Check for zlib, needed by VBoxSVC, Runtime, ...
791#
792check_z()
793{
794 test_header zlib
795 cat > .tmp_src.cc << EOF
796#include <cstdio>
797#include <zlib.h>
798extern "C" int main(void)
799{
800 printf("found version %s", ZLIB_VERSION);
801#if ZLIB_VERNUM >= 0x1210
802 printf(", OK.\n");
803 return 0;
804#else
805 printf(", expected version 1.2.1 or higher\n");
806 return 1;
807#endif
808}
809EOF
810 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
811 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
812 if test_execute; then
813 cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
814 cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
815 fi
816 fi
817}
818
819#
820# Check for libpng, needed by kchmviewer
821#
822check_png()
823{
824 test_header libpng
825 cat > .tmp_src.cc << EOF
826#include <cstdio>
827#include <png.h>
828extern "C" int main(void)
829{
830 printf("found version %s", PNG_LIBPNG_VER_STRING);
831#if PNG_LIBPNG_VER >= 10205
832 printf(", OK.\n");
833 return 0;
834#else
835 printf(", expected version 1.2.5 or higher\n");
836 return 1;
837#endif
838}
839EOF
840 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
841# if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then
842 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
843# if test_execute nofatal; then
844 if test_execute; then
845 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
846 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
847 fi
848 fi
849}
850
851#
852# Check for pam, needed by VRDPAuth
853# Version 79 was introduced in 9/2005, do we support older versions?
854# Debian/sarge uses 76
855# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
856#
857check_pam()
858{
859 test_header pam
860 cat > .tmp_src.cc << EOF
861#include <cstdio>
862#include <security/pam_appl.h>
863extern "C" int main(void)
864{
865 printf("found version %d", __LIBPAM_VERSION);
866 if (__LIBPAM_VERSION >= 76)
867 {
868 printf(", OK.\n");
869 return 0;
870 }
871 else
872 {
873 printf(", expected version 76 or higher\n");
874 return 1;
875 }
876}
877EOF
878 if test_compile "-lpam" pam pam nofatal; then
879 if test_execute nofatal; then
880 return 0;
881 fi
882 fi
883 test_header linux_pam
884 cat > .tmp_src.cc << EOF
885#include <cstdio>
886#include <security/pam_appl.h>
887extern "C" int main(void)
888{
889 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
890 if (__LINUX_PAM__ >= 1)
891 {
892 printf(", OK.\n");
893 return 0;
894 }
895 else
896 {
897 printf(", expected version 1.0 or higher\n");
898 return 1;
899 }
900}
901EOF
902 if test_compile "-lpam" pam pam; then
903 test_execute
904 fi
905}
906
907
908#
909# Check for the SDL library, needed by VBoxSDL and VirtualBox
910# We depend at least on version 1.2.7
911#
912check_sdl()
913{
914 test_header SDL
915 if which_wrapper sdl-config > /dev/null; then
916 FLGSDL=`sdl-config --cflags`
917 INCSDL=`strip_I "$FLGSDL"`
918 LIBSDL=`sdl-config --libs`
919 LIBSDLMAIN="-lSDLmain"
920 [ "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
921 cat > .tmp_src.cc << EOF
922#include <cstdio>
923#include <SDL/SDL.h>
924#include <SDL/SDL_main.h>
925extern "C" int main(void)
926{
927 printf("found version %d.%d.%d",
928 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
929#if SDL_VERSION_ATLEAST(1,2,7)
930 printf(", OK.\n");
931 return 0;
932#else
933 printf(", expected version 1.2.7 or higher\n");
934 return 1;
935#endif
936}
937EOF
938 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
939 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL" SDL SDL; then
940 if test_execute; then
941 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
942 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
943 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
944 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
945 fi
946 fi
947 else
948 log_failure "not found"
949 fail
950 fi
951}
952
953#
954# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
955#
956check_sdl_ttf()
957{
958 test_header SDL_ttf
959 cat > .tmp_src.cc << EOF
960#include <cstdio>
961#include <SDL/SDL_ttf.h>
962#ifndef SDL_TTF_MAJOR_VERSION
963#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
964#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
965#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
966#endif
967extern "C" int main(void)
968{
969 printf("found version %d.%d.%d",
970 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
971#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
972 printf(", OK.\n");
973 return 0;
974#else
975 printf(", expected version 2.0.6 or higher\n");
976 return 1;
977#endif
978}
979EOF
980 if test_compile "-lSDL_ttf" SDL_ttf SDL_ttf; then
981 test_execute
982 fi
983}
984
985#
986# Check for libasound, needed by the ALSA audio backend
987#
988check_alsa()
989{
990 test_header ALSA
991 cat > .tmp_src.cc << EOF
992#include <cstdio>
993#include <alsa/asoundlib.h>
994extern "C" int main(void)
995{
996 printf("found version %d.%d.%d",
997 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
998#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
999 printf(", OK.\n");
1000 return 0;
1001#else
1002 printf(", expected version 1.0.6 or higher\n");
1003 return 1;
1004#endif
1005}
1006EOF
1007 if test_compile "-lasound" asound asound; then
1008 test_execute
1009 fi
1010}
1011
1012#
1013# Check for PulseAudio
1014#
1015check_pulse()
1016{
1017 test_header "PulseAudio"
1018 cat > .tmp_src.cc << EOF
1019#include <cstdio>
1020#include <pulse/version.h>
1021extern "C" int main(void)
1022{
1023 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1024#if PA_API_VERSION >= 9
1025 printf(", OK.\n");
1026 return 0;
1027#else
1028 printf(", expected version 0.9.0 (API version 9) or higher\n");
1029 return 1;
1030#endif
1031}
1032EOF
1033 if test_compile "-lpulse" pulse pulse; then
1034 test_execute
1035 fi
1036}
1037
1038#
1039# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1040#
1041check_xcursor()
1042{
1043 test_header Xcursor
1044 cat > .tmp_src.cc << EOF
1045#include <cstdio>
1046#include <X11/Xlib.h>
1047#include <X11/Xcursor/Xcursor.h>
1048extern "C" int main(void)
1049{
1050 XcursorImage *cursor = XcursorImageCreate (10, 10);
1051 XcursorImageDestroy(cursor);
1052 return 0;
1053}
1054EOF
1055 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1056 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1057 log_success "found"
1058 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1059 fi
1060}
1061
1062#
1063# Check for the X libraries (Xext, X11)
1064#
1065check_x()
1066{
1067 test_header "X libraries"
1068 cat > .tmp_src.cc << EOF
1069#include <cstdio>
1070#include <X11/Xlib.h>
1071extern "C" int main(void)
1072{
1073 Display *dpy;
1074 int scrn_num;
1075 Screen *scrn;
1076 Window win;
1077
1078 dpy = XOpenDisplay(NULL);
1079 scrn_num = DefaultScreen(dpy);
1080 scrn = ScreenOfDisplay(dpy, scrn_num);
1081 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1082 0, 16, InputOutput, CopyFromParent, 0, NULL);
1083 XDestroyWindow(dpy, win);
1084}
1085EOF
1086 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1087 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1088 log_success "found"
1089 fi
1090}
1091
1092#
1093# Check for the QT library, needed by VirtualBox
1094#
1095check_qt()
1096{
1097 test_header Qt
1098 cat > .tmp_src.cc << EOF
1099#include <cstdio>
1100#include <qglobal.h>
1101extern "C" int main(void)
1102{
1103 printf("found version %s", QT_VERSION_STR);
1104#if QT_VERSION >= 0x030305
1105 printf(", OK.\n");
1106 return 0;
1107#elif QT_VERSION >= 0x030300
1108 printf("\n ** WARNING: QT < 3.3.5 has known problems!\n");
1109#else
1110 printf(", expected version 3.3.0 or higher\n");
1111 return 1;
1112#endif
1113}
1114EOF
1115 found_qt=0
1116 libs="lib"
1117 [ "$LIB" = "lib64" ] && libs="$libs lib64"
1118 for q in $QTDIR; do
1119 for l in $libs; do
1120 echo "compiling the following source file:" >> $LOG
1121 cat .tmp_src.cc >> $LOG
1122 echo "using the following command line:" >> $LOG
1123 echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt $LIBPTHREAD" >> $LOG
1124 $CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt $LIBPTHREAD >> $LOG 2>&1
1125 if [ $? -eq 0 ]; then
1126 if test_execute; then
1127 cnf_append "QTDIR" "`cd $q ; pwd`"
1128 found_qt=1
1129 break
1130 fi
1131 fi
1132 done
1133 if [ $found_qt -eq 1 ]; then
1134 break
1135 fi
1136 done
1137 if [ $found_qt -ne 1 ]; then
1138 echo
1139 echo " Qt not found at \"$QTDIR\" or Qt headers not found"
1140 echo " Check the file $LOG for detailed error information."
1141 fail
1142 return 1
1143 fi
1144 test_header "Qt devtools"
1145 if check_avail "$q/bin/moc" QTDIR/bin; then
1146 moc_ver=`$q/bin/moc 2>&1 -v|sed 's+^.*(Qt \(.*\))+\1+'`
1147 if [ $? -ne 0 ]; then
1148 log_failure "not found"
1149 fail
1150 else
1151 log_success "found version $moc_ver"
1152 fi
1153 fi
1154}
1155
1156#
1157# Check whether static libstdc++ is installed
1158#
1159check_staticlibstdcxx()
1160{
1161 test_header "static stc++ library"
1162 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1163 cat > .tmp_src.cc << EOF
1164#include <string>
1165
1166extern "C" int main(void)
1167{
1168 std::string s = "test";
1169 return 0;
1170}
1171EOF
1172 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1173 log_success "found"
1174 fi
1175}
1176
1177#
1178# Check for Linux sources
1179#
1180check_linux()
1181{
1182 test_header "Linux kernel sources"
1183 cat > .tmp_src.c << EOF
1184#include <linux/version.h>
1185int printf(const char *format, ...);
1186int main(void)
1187{
1188 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1189 (LINUX_VERSION_CODE % 65536) / 256,
1190 LINUX_VERSION_CODE % 256);
1191#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1192 printf(", OK.\n");
1193 return 0;
1194#else
1195 printf(", expected version 2.4.0 or higher\n");
1196 return 1;
1197#endif
1198}
1199EOF
1200 echo "compiling the following source file:" >> $LOG
1201 cat .tmp_src.c >> $LOG
1202 echo "using the following command line:" >> $LOG
1203 echo "$CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1204 $CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1205 if [ $? -ne 0 ]; then
1206 echo
1207 echo " Linux kernel headers not found at $LINUX"
1208 echo " Check the file $LOG for detailed error information."
1209 fail
1210 else
1211 if test_execute; then
1212 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1213 fi
1214 fi
1215}
1216
1217#
1218# Check for kchmviewer, needed to display the online help
1219#
1220check_kchmviewer()
1221{
1222 test_header kchmviewer
1223 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1224 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1225 if [ $? -ne 0 ]; then
1226 log_failure "not found"
1227 fail
1228 else
1229 log_success "found version $kchmviewer_ver"
1230 fi
1231 fi
1232}
1233
1234#
1235# Check for the kBuild tools, we don't support GNU make
1236#
1237check_kbuild()
1238{
1239 test_header kBuild
1240 if check_avail "$KBUILDDIR_BIN/kmk" KBUILDDIR really; then
1241 log_success "found"
1242 echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
1243 echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
1244 echo "export BUILD_TARGET=\"$OS\"" >> $ENV
1245 echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
1246 echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
1247 echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
1248 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1249 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1250 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1251 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1252 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1253 if [ "$OS" = "solaris" ]; then
1254 # Because of sh being non-default shell in Solaris we need to export PATH again when
1255 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1256 echo "PATH=\"$ORGPATH\"" >> $ENV
1257 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1258 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1259 else
1260 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1261 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1262 fi
1263 echo "export PATH" >> $ENV
1264 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1265 fi
1266}
1267
1268
1269#
1270# Check for compiler.h
1271# Some Linux distributions include "compiler.h" in their libc linux
1272# headers package, some don't. Most don't need it, building might (!)
1273# not succeed on openSUSE without it.
1274#
1275# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1276#
1277check_compiler_h()
1278{
1279 test_header compiler.h
1280 if ! test -f "/usr/include/linux/compiler.h"; then
1281 cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
1282 log_success "compiler.h not found"
1283 else
1284 log_success "compiler.h found"
1285 fi
1286}
1287
1288
1289#
1290# Check if we are able to build 32-bit applications (needed for the guest additions)
1291#
1292check_32bit()
1293{
1294 test_header "32-bit support"
1295 cat > .tmp_src.c << EOF
1296#include <stdint.h>
1297int main(void)
1298{
1299 return 0;
1300}
1301EOF
1302 echo "compiling the following source file:" >> $LOG
1303 cat .tmp_src.c >> $LOG
1304 echo "using the following command line:" >> $LOG
1305 echo "$CC -m32 -O -Wall -o .tmp_out .tmp_src.c" >> $LOG
1306 $CC -m32 -O -Wall -o .tmp_out .tmp_src.c >> $LOG 2>&1
1307 if [ $? -ne 0 ]; then
1308 echo
1309 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1310 echo " Check the file $LOG for detailed error information."
1311 fail
1312 fi
1313 log_success ""
1314}
1315
1316#
1317# Setup wine
1318#
1319setup_wine()
1320{
1321 test_header "Wine support"
1322 if ! which_wrapper wine > /dev/null; then
1323 echo " wine binary not found"
1324 fail
1325 fi
1326 if ! which_wrapper wineprefixcreate > /dev/null; then
1327 echo " wineprefixcreate not found"
1328 fail
1329 fi
1330 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1331 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1332 rm -rf $WINEPREFIX
1333 mkdir -p $WINEPREFIX
1334 touch $WINEPREFIX/.no_prelaunch_window_flag
1335 if ! wineprefixcreate -q > /dev/null 2>&1; then
1336 echo " wineprefixcreate failed"
1337 fail
1338 fi
1339 tmp=.tmp.wine.reg
1340 rm -f $tmp
1341 echo 'REGEDIT4' > $tmp
1342 echo '' >> $tmp
1343 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1344 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
1345 echo '' >> $tmp
1346 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1347 echo '"itss"="native"' >> $tmp
1348 echo '' >> $tmp
1349 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1350 echo '"itss"="native"' >> $tmp
1351 echo '' >> $tmp
1352 if ! wine regedit $tmp > /dev/null 2>&1; then
1353 rm -f $tmp
1354 echo " failed to load registry changes (path)."
1355 fail
1356 fi
1357 rm -f $tmp
1358 log_success "found"
1359}
1360
1361
1362#
1363# Show help
1364#
1365show_help()
1366{
1367 cat << EOF
1368Usage: ./configure [OPTIONS]...
1369
1370Configuration:
1371 -h, --help display this help and exit
1372 --nofatal don't abort on errors
1373 --disable-xpcom disable XPCOM and related stuff
1374 --disable-sdl-ttf disable SDL_ttf detection
1375 --disable-pulse disable PulseAudio detection
1376 --build-xalan build xalan & xerces from sources (not OSE!)
1377 --build-libxml2 build libxml2 from sources (not OSE!)
1378 --setup-wine setup a Wine directory and register the hhc hack
1379
1380Paths:
1381 --with-gcc=PATH location of the gcc compiler [$CC]
1382 --with-g++=PATH location of the g++ compiler [$CXX]
1383 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1384 --with-iasl=PATH location of the iasl compiler [$IASL]
1385 --with-linux=DIR Linux kernel source directory [$LINUX]
1386 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1387 --with-qt-dir=DIR directory for QT headers/libraries [$QTDIR]
1388 --with-xalan=LIB location of the xalan library [$LIBXALAN]
1389 --with-xalan-incdir=DIR location of the xalan headers [/usr/include /usr/local/include]
1390 --with-xalan-libdir=DIR location of the xalan library [/usr/lib /usr/local/lib]
1391 --with-xerces=LIB location of the xerces library [$LIBXERCES]
1392 --with-xerces-incdir=DIR location of the xerces headers [/usr/include /usr/local/include]
1393 --with-xerces-libdir=DIR location of the xerces library [/usr/lib /usr/local/lib]
1394
1395Build type:
1396 -d, --build-debug build with debugging symbols and assertions
1397 --build-headless build headless (without any X11 frontend)
1398EOF
1399 exit 0
1400}
1401
1402
1403#
1404# The body.
1405#
1406
1407# scan command line options
1408for option in $*; do
1409 case "$option" in
1410 --help|-help|-h)
1411 show_help
1412 ;;
1413 --nofatal)
1414 nofatal=1
1415 ;;
1416 --with-gcc=*)
1417 CC=`echo $option | cut -d'=' -f2`
1418 ;;
1419 --with-g++=*)
1420 CXX=`echo $option | cut -d'=' -f2`
1421 ;;
1422 --with-kbuild=*)
1423 KBUILDDIR=`echo $option | cut -d'=' -f2`
1424 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1425 echo "Error: KBUILDDIR contains invalid characters!"
1426 exit 1
1427 fi
1428 ;;
1429 --with-qt-dir=*)
1430 QTDIR=`echo $option | cut -d'=' -f2`
1431 ;;
1432 --with-iasl=*)
1433 IASL=`echo $option | cut -d'=' -f2`
1434 ;;
1435 --with-linux=*)
1436 LINUX=`echo $option | cut -d'=' -f2`
1437 ;;
1438 --with-mkisofs=*)
1439 MKISOFS=`echo $option | cut -d'=' -f2`
1440 ;;
1441 --with-xalan=*)
1442 LIBXALAN=`echo $option | cut -d'=' -f2`
1443 ;;
1444 --with-xalan-libdir=*)
1445 LIBXALAN_DIR=`echo $option | cut -d'=' -f2`
1446 ;;
1447 --with-xalan-incdir=*)
1448 INCXALAN=`echo $option | cut -d'=' -f2`
1449 ;;
1450 --with-xerces=*)
1451 LIBXERCES=`echo $option | cut -d'=' -f2`
1452 ;;
1453 --with-xerces-libdir=*)
1454 LIBXERCES_DIR=`echo $option | cut -d'=' -f2`
1455 ;;
1456 --with-xerces-incdir=*)
1457 INCXERCES=`echo $option | cut -d'=' -f2`
1458 ;;
1459 --disable-xpcom)
1460 WITH_XPCOM=0
1461 ;;
1462 --disable-sdl-ttf)
1463 WITH_SDL_TTF=0
1464 ;;
1465 --disable-qt)
1466 WITH_QT=0
1467 ;;
1468 --disable-pulse)
1469 WITH_PULSE=0
1470 ;;
1471 --build-debug|-d)
1472 BUILD_TYPE=debug
1473 ;;
1474 --build-xalan)
1475 LIBXERCES=
1476 LIBXERCES_DIR=
1477 LIBXALAN=
1478 LIBXALAN_DIR=
1479 ;;
1480 --build-libxml2)
1481 BUILD_LIBXML2=1
1482 ;;
1483 --build-headless)
1484 HEADLESS=1
1485 WITH_SDL=0
1486 WITH_SDL_TTF=0
1487 WITH_X11=0
1488 WITH_QT=0
1489 ;;
1490 --ose)
1491 OSE=2
1492 ;;
1493 --odir=*)
1494 ODIR="`echo $option | cut -d'=' -f2`/"
1495 ;;
1496 --setup-wine)
1497 SETUP_WINE=1
1498 ;;
1499 *)
1500 echo
1501 echo "Unrecognized option \"$option\""
1502 echo
1503 show_help
1504 ;;
1505 esac
1506done
1507
1508[ -n "$LIBXALAN_DIR" ] && LIBXALAN="-L$LIBXALAN_DIR $LIBXALAN"
1509[ -n "$LIBXERCES_DIR" ] && LIBXERCES="-L$LIBXERCES_DIR $LIBXERCES"
1510
1511LOG="$ODIR$LOG"
1512ENV="$ODIR$ENV"
1513CNF="$ODIR$CNF"
1514
1515# initialize output files
1516cat > $LOG << EOF
1517# Log file generated by
1518#
1519# '$0 $*'
1520#
1521
1522EOF
1523cat > $CNF << EOF
1524# -*- Makefile -*-
1525#
1526# automatically generated by
1527#
1528# '$0 $*'
1529#
1530# It will be completely overwritten if configure is executed again.
1531#
1532
1533EOF
1534cat > $ENV << EOF
1535#!/bin/bash
1536#
1537# automatically generated by
1538#
1539# '$0 $*'
1540#
1541# It will be completely overwritten if configure is executed again.
1542# Make sure you source this file once before you start to build VBox.
1543#
1544
1545EOF
1546
1547# test if we are OSE
1548if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
1549 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
1550 echo >> $LOG
1551 OSE=0
1552fi
1553
1554if [ "$BUILD_TYPE" = "debug" ]; then
1555 echo "Creating DEBUG build!" >> $LOG
1556fi
1557
1558# first determine our environment
1559check_environment
1560check_kbuild
1561
1562# append the tools directory to the default search path
1563echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
1564export PATH
1565
1566# some things are not available in for OSE
1567if [ $OSE -ge 1 ]; then
1568 cnf_append "VBOX_OSE" "1"
1569 cnf_append "VBOX_WITH_TESTSUITE" ""
1570 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
1571
1572 if [ "$OS" = "linux" ]; then
1573 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
1574 else
1575 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
1576 fi
1577 echo >> $CNF
1578fi
1579
1580# headless
1581if [ -n "$HEADLESS" ]; then
1582 cnf_append "VBOX_HEADLESS" "1"
1583fi
1584
1585# emit disable directives corresponding to any --disable-xxx options.
1586[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
1587[ $WITH_QT -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
1588[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
1589
1590# the tools
1591check_gcc
1592[ "$OS" != "darwin" ] && check_as86
1593[ "$OS" != "darwin" ] && check_bcc
1594[ "$OS" != "darwin" ] && check_iasl
1595# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
1596# [ "$OS" != "darwin" ] && check_yasm
1597[ "$OS" != "darwin" ] && check_xsltproc
1598[ $OSE -eq 0 ] && check_mkisofs
1599
1600# the libraries
1601[ "$OS" != "darwin" ] && check_pthread
1602[ $WITH_XPCOM -eq 1 ] && check_xalan
1603[ $WITH_XPCOM -eq 1 ] && check_xerces
1604[ $WITH_XPCOM -eq 1 ] && check_libxml2
1605[ $WITH_LIBIDL -eq 1 ] && check_libidl
1606[ $OSE -eq 0 ] && check_ssl
1607[ "$OS" != "darwin" ] && check_z
1608[ $OSE -eq 0 ] && check_png
1609[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
1610[ $WITH_SDL -eq 1 ] && check_sdl
1611[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
1612[ $WITH_X11 -eq 1 ] && check_x
1613[ $WITH_X11 -eq 1 ] && check_xcursor
1614[ $WITH_QT -eq 1 ] && check_qt
1615
1616# Linux-specific
1617if [ "$OS" = "linux" ]; then
1618 check_staticlibstdcxx
1619 check_linux
1620 check_alsa
1621 if [ $WITH_PULSE -eq 1 ]; then
1622 check_pulse
1623 else
1624 cnf_append "VBOX_WITH_PULSE" ""
1625 fi
1626 check_compiler_h
1627 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
1628fi
1629
1630[ -n "$SETUP_WINE" ] && setup_wine
1631
1632# success!
1633echo
1634echo "Successfully generated '$CNF' and '$ENV'."
1635echo "Source '$ENV' once before you start to build VBox:"
1636echo ""
1637echo " source $ENV"
1638echo " kmk"
1639echo ""
1640if [ "$OS" = "linux" ]; then
1641 echo "To compile the kernel module, do:"
1642 echo ""
1643 echo " cd ./out/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
1644 echo " make"
1645 echo ""
1646fi
1647echo "Enjoy!"
1648cleanup
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