VirtualBox

source: vbox/trunk/configure@ 7455

Last change on this file since 7455 was 7395, checked in by vboxsync, 17 years ago

configure: actually check against 1.1.17

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