VirtualBox

source: vbox/trunk/configure@ 7363

Last change on this file since 7363 was 7306, checked in by vboxsync, 17 years ago

libxslt still not needed

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 41.0 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 not 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
611#
612check_libxslt()
613{
614 if [ -z "$BUILD_LIBXSLT" ]; then
615 test_header libxslt
616 if which_wrapper pkg-config > /dev/null; then
617 libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
618 if [ $? -ne 0 ]; then
619 log_failure "not found"
620 fail
621 else
622 FLGXSLT=`pkg-config libxslt --cflags`
623 INCXSLT=`strip_I "$FLGXSLT"`
624 LIBXSLT=`pkg-config libxslt --libs`
625 cat > .tmp_src.cc << EOF
626#include <cstdio>
627#include <libxslt/xsltconfig.h>
628extern "C" int main(void)
629{
630 printf("found version %s", LIBXSLT_DOTTED_VERSION);
631#if LIBXSLT_VERSION >= 10122
632 printf(", OK.\n");
633 return 0;
634#else
635 printf(", expected version 1.1.22 or higher\n");
636 return 1;
637#endif
638}
639EOF
640 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
641 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
642 if test_execute; then
643 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
644 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
645 fi
646 fi
647 fi
648 elif which_wrapper xslt-config; then
649 libxslt_ver=`xslt-config --version`
650 if [ $? -ne 0 ]; then
651 log_failure "not found"
652 fail
653 else
654 log_success "found version $libxslt_ver"
655 FLGXSLT=`xslt-config --cflags`
656 INCXSLT=`strip_I "$FLGXSLT"`
657 LIBXSLT=`xslt-config --libs`
658 cat > .tmp_src.cc << EOF
659#include <cstdio>
660#include <libxslt/xsltconfig.h>
661extern "C" int main(void)
662{
663 printf("found version %s", LIBXSLT_DOTTED_VERSION);
664#if LIBXSLT_VERSION >= 10122
665 printf(", OK.\n");
666 return 0;
667#else
668 printf(", expected version 1.1.22 or higher\n");
669 return 1;
670#endif
671}
672EOF
673 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
674 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
675 if test_execute; then
676 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
677 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
678 fi
679 fi
680 fi
681 else
682 log_failure "neither pkg-config nor xslt-config found"
683 fail
684 fi
685 fi
686}
687
688#
689# Check for libIDL, needed by xpcom
690#
691check_libidl()
692{
693 test_header libIDL
694
695 if which_wrapper libIDL-config-2 > /dev/null; then
696 libidl_ver=`libIDL-config-2 --version`
697 if [ $? -ne 0 ]; then
698 log_failure "not found"
699 fail
700 else
701 log_success "found version $libidl_ver"
702 cnf_append "VBOX_LIBIDL_CONFIG" \
703 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
704 fi
705 elif check_avail "libIDL-config" libIDL-config; then
706 libidl_ver=`libIDL-config --version`
707 if [ $? -ne 0 ]; then
708 log_failure "not found"
709 fail
710 else
711 log_success "found version $libidl_ver"
712 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
713 fi
714 fi
715}
716
717#
718# Check for openssl, needed for RDP
719#
720check_ssl()
721{
722 test_header ssl
723 cat > .tmp_src.cc << EOF
724#include <cstdio>
725#include <openssl/opensslv.h>
726extern "C" int main(void)
727{
728 printf("found version %s", OPENSSL_VERSION_TEXT);
729#if OPENSSL_VERSION_NUMBER >= 0x0090700
730 printf(", OK.\n");
731 return 0;
732#else
733 printf(", expected version 0.9.7 or higher\n");
734 return 1;
735#endif
736}
737EOF
738 if test_compile $LIBCRYPTO libcrypto openssl; then
739 if test_execute nofatal; then
740 cnf_append "SDK_VBOX_OPENSSL_INCS" ""
741 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
742 fi
743 fi
744}
745
746#
747# Check for pthread, needed by VBoxSVC, frontends, ...
748#
749check_pthread()
750{
751 test_header pthread
752 cat > .tmp_src.cc << EOF
753#include <cstdio>
754#include <pthread.h>
755extern "C" int main(void)
756{
757 pthread_mutex_t mutex;
758 if (pthread_mutex_init(&mutex, NULL)) {
759 printf("pthread_mutex_init() failed\n");
760 return 1;
761 }
762 if (pthread_mutex_lock(&mutex)) {
763 printf("pthread_mutex_lock() failed\n");
764 return 1;
765 }
766 if (pthread_mutex_unlock(&mutex)) {
767 printf("pthread_mutex_unlock() failed\n");
768 return 1;
769 }
770 printf("found, OK.\n");
771}
772EOF
773 if test_compile $LIBPTHREAD pthread pthread; then
774 if test_execute; then
775 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
776 fi
777 fi
778}
779
780#
781# Check for zlib, needed by VBoxSVC, Runtime, ...
782#
783check_z()
784{
785 test_header zlib
786 cat > .tmp_src.cc << EOF
787#include <cstdio>
788#include <zlib.h>
789extern "C" int main(void)
790{
791 printf("found version %s", ZLIB_VERSION);
792#if ZLIB_VERNUM >= 0x1210
793 printf(", OK.\n");
794 return 0;
795#else
796 printf(", expected version 1.2.1 or higher\n");
797 return 1;
798#endif
799}
800EOF
801 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
802 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
803 if test_execute; then
804 cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
805 cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
806 fi
807 fi
808}
809
810#
811# Check for libpng, needed by kchmviewer
812#
813check_png()
814{
815 test_header libpng
816 cat > .tmp_src.cc << EOF
817#include <cstdio>
818#include <png.h>
819extern "C" int main(void)
820{
821 printf("found version %s", PNG_LIBPNG_VER_STRING);
822#if PNG_LIBPNG_VER >= 10205
823 printf(", OK.\n");
824 return 0;
825#else
826 printf(", expected version 1.2.5 or higher\n");
827 return 1;
828#endif
829}
830EOF
831 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
832# if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then
833 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
834# if test_execute nofatal; then
835 if test_execute; then
836 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
837 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
838 fi
839 fi
840}
841
842#
843# Check for pam, needed by VRDPAuth
844# Version 79 was introduced in 9/2005, do we support older versions?
845# Debian/sarge uses 76
846# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
847#
848check_pam()
849{
850 test_header pam
851 cat > .tmp_src.cc << EOF
852#include <cstdio>
853#include <security/pam_appl.h>
854extern "C" int main(void)
855{
856 printf("found version %d", __LIBPAM_VERSION);
857 if (__LIBPAM_VERSION >= 76)
858 {
859 printf(", OK.\n");
860 return 0;
861 }
862 else
863 {
864 printf(", expected version 76 or higher\n");
865 return 1;
866 }
867}
868EOF
869 if test_compile "-lpam" pam pam nofatal; then
870 if test_execute nofatal; then
871 return 0;
872 fi
873 fi
874 test_header linux_pam
875 cat > .tmp_src.cc << EOF
876#include <cstdio>
877#include <security/pam_appl.h>
878extern "C" int main(void)
879{
880 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
881 if (__LINUX_PAM__ >= 1)
882 {
883 printf(", OK.\n");
884 return 0;
885 }
886 else
887 {
888 printf(", expected version 1.0 or higher\n");
889 return 1;
890 }
891}
892EOF
893 if test_compile "-lpam" pam pam; then
894 test_execute
895 fi
896}
897
898
899#
900# Check for the SDL library, needed by VBoxSDL and VirtualBox
901# We depend at least on version 1.2.7
902#
903check_sdl()
904{
905 test_header SDL
906 if which_wrapper sdl-config > /dev/null; then
907 FLGSDL=`sdl-config --cflags`
908 INCSDL=`strip_I "$FLGSDL"`
909 LIBSDL=`sdl-config --libs`
910 LIBSDLMAIN="-lSDLmain"
911 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
912 cat > .tmp_src.cc << EOF
913#include <cstdio>
914#include <SDL/SDL.h>
915#include <SDL/SDL_main.h>
916extern "C" int main(void)
917{
918 printf("found version %d.%d.%d",
919 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
920#if SDL_VERSION_ATLEAST(1,2,7)
921 printf(", OK.\n");
922 return 0;
923#else
924 printf(", expected version 1.2.7 or higher\n");
925 return 1;
926#endif
927}
928EOF
929 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
930 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL" SDL SDL; then
931 if test_execute; then
932 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
933 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
934 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
935 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
936 fi
937 fi
938 else
939 log_failure "not found"
940 fail
941 fi
942}
943
944#
945# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
946#
947check_sdl_ttf()
948{
949 test_header SDL_ttf
950 cat > .tmp_src.cc << EOF
951#include <cstdio>
952#include <SDL/SDL_ttf.h>
953#ifndef SDL_TTF_MAJOR_VERSION
954#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
955#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
956#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
957#endif
958extern "C" int main(void)
959{
960 printf("found version %d.%d.%d",
961 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
962#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
963 printf(", OK.\n");
964 return 0;
965#else
966 printf(", expected version 2.0.6 or higher\n");
967 return 1;
968#endif
969}
970EOF
971 if test_compile "-lSDL_ttf" SDL_ttf SDL_ttf; then
972 test_execute
973 fi
974}
975
976#
977# Check for libasound, needed by the ALSA audio backend
978#
979check_alsa()
980{
981 test_header ALSA
982 cat > .tmp_src.cc << EOF
983#include <cstdio>
984#include <alsa/asoundlib.h>
985extern "C" int main(void)
986{
987 printf("found version %d.%d.%d",
988 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
989#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
990 printf(", OK.\n");
991 return 0;
992#else
993 printf(", expected version 1.0.6 or higher\n");
994 return 1;
995#endif
996}
997EOF
998 if test_compile "-lasound" asound asound; then
999 test_execute
1000 fi
1001}
1002
1003#
1004# Check for PulseAudio
1005#
1006check_pulse()
1007{
1008 test_header "PulseAudio"
1009 cat > .tmp_src.cc << EOF
1010#include <cstdio>
1011#include <pulse/version.h>
1012extern "C" int main(void)
1013{
1014 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1015#if PA_API_VERSION >= 9
1016 printf(", OK.\n");
1017 return 0;
1018#else
1019 printf(", expected version 0.9.0 (API version 9) or higher\n");
1020 return 1;
1021#endif
1022}
1023EOF
1024 if test_compile "-lpulse" pulse pulse; then
1025 test_execute
1026 fi
1027}
1028
1029#
1030# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1031#
1032check_xcursor()
1033{
1034 test_header Xcursor
1035 cat > .tmp_src.cc << EOF
1036#include <cstdio>
1037#include <X11/Xlib.h>
1038#include <X11/Xcursor/Xcursor.h>
1039extern "C" int main(void)
1040{
1041 XcursorImage *cursor = XcursorImageCreate (10, 10);
1042 XcursorImageDestroy(cursor);
1043 return 0;
1044}
1045EOF
1046 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1047 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1048 log_success "found"
1049 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1050 fi
1051}
1052
1053#
1054# Check for the X libraries (Xext, X11)
1055#
1056check_x()
1057{
1058 test_header "X libraries"
1059 cat > .tmp_src.cc << EOF
1060#include <cstdio>
1061#include <X11/Xlib.h>
1062extern "C" int main(void)
1063{
1064 Display *dpy;
1065 int scrn_num;
1066 Screen *scrn;
1067 Window win;
1068
1069 dpy = XOpenDisplay(NULL);
1070 scrn_num = DefaultScreen(dpy);
1071 scrn = ScreenOfDisplay(dpy, scrn_num);
1072 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1073 0, 16, InputOutput, CopyFromParent, 0, NULL);
1074 XDestroyWindow(dpy, win);
1075}
1076EOF
1077 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1078 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1079 log_success "found"
1080 fi
1081}
1082
1083#
1084# Check for the QT library, needed by VirtualBox
1085#
1086check_qt3()
1087{
1088 test_header Qt3
1089 cat > .tmp_src.cc << EOF
1090#include <cstdio>
1091#include <qglobal.h>
1092extern "C" int main(void)
1093{
1094 printf("found version %s", QT_VERSION_STR);
1095#if QT_VERSION >= 0x030305
1096 printf(", OK.\n");
1097 return 0;
1098#elif QT_VERSION >= 0x030300
1099 printf("\n ** WARNING: QT < 3.3.5 has known problems!\n");
1100#else
1101 printf(", expected version 3.3.0 or higher\n");
1102 return 1;
1103#endif
1104}
1105EOF
1106 found_qt=0
1107 libs="lib"
1108 [ "$LIB" = "lib64" ] && libs="$libs lib64"
1109 for q in $QTDIR; do
1110 for l in $libs; do
1111 echo "compiling the following source file:" >> $LOG
1112 cat .tmp_src.cc >> $LOG
1113 echo "using the following command line:" >> $LOG
1114 echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt $LIBPTHREAD" >> $LOG
1115 $CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt $LIBPTHREAD >> $LOG 2>&1
1116 if [ $? -eq 0 ]; then
1117 if test_execute; then
1118 cnf_append "QTDIR" "`cd $q ; pwd`"
1119 found_qt=1
1120 break
1121 fi
1122 fi
1123 done
1124 if [ $found_qt -eq 1 ]; then
1125 break
1126 fi
1127 done
1128 if [ $found_qt -ne 1 ]; then
1129 echo
1130 echo " Qt not found at \"$QTDIR\" or Qt headers not found"
1131 echo " Check the file $LOG for detailed error information."
1132 fail
1133 return 1
1134 fi
1135 test_header "Qt devtools"
1136 if check_avail "$q/bin/moc" QTDIR/bin; then
1137 moc_ver=`$q/bin/moc 2>&1 -v|sed 's+^.*(Qt \(.*\))+\1+'`
1138 if [ $? -ne 0 ]; then
1139 log_failure "not found"
1140 fail
1141 else
1142 log_success "found version $moc_ver"
1143 fi
1144 fi
1145}
1146
1147#
1148# Check for the QT library, needed by VirtualBox4
1149#
1150# Currently not fatal.
1151#
1152check_qt4()
1153{
1154 test_header Qt4
1155 if which_wrapper pkg-config > /dev/null; then
1156 qt4_ver=`pkg-config QtGui --modversion 2>> $LOG`
1157 if [ $? -ne 0 ]; then
1158 log_failure "not found"
1159# fail
1160 else
1161 FLGQT4=`pkg-config QtGui --cflags`
1162 INCQT4=`strip_I "$FLGQT4"`
1163 LIBQT4=`pkg-config QtGui --libs`
1164 cat > .tmp_src.cc << EOF
1165#include <cstdio>
1166#include <Qt/qglobal.h>
1167extern "C" int main(void)
1168{
1169 printf("found version %s", QT_VERSION_STR);
1170#if QT_VERSION >= 0x030305
1171 printf(", OK.\n");
1172 return 0;
1173#elif QT_VERSION >= 0x030300
1174 printf("\n ** WARNING: QT < 3.3.5 has known problems!\n");
1175#else
1176 printf(", expected version 3.3.0 or higher\n");
1177 return 1;
1178#endif
1179}
1180EOF
1181 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1182 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4" qt4 qt4 nofatal; then
1183 if test_execute; then
1184 cnf_append "SDK_VBOX_LIBQT4_INCS" "$INCQT4"
1185 cnf_append "SDK_VBOX_LIBQT4_LIBS" "`strip_l "$LIBQT4"`"
1186 fi
1187 fi
1188 fi
1189 else
1190 log_failure "pkg-config not found"
1191# fail
1192 fi
1193}
1194
1195
1196#
1197# Check whether static libstdc++ is installed
1198#
1199check_staticlibstdcxx()
1200{
1201 test_header "static stc++ library"
1202 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1203 cat > .tmp_src.cc << EOF
1204#include <string>
1205
1206extern "C" int main(void)
1207{
1208 std::string s = "test";
1209 return 0;
1210}
1211EOF
1212 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1213 log_success "found"
1214 fi
1215}
1216
1217#
1218# Check for Linux sources
1219#
1220check_linux()
1221{
1222 test_header "Linux kernel sources"
1223 cat > .tmp_src.c << EOF
1224#include <linux/version.h>
1225int printf(const char *format, ...);
1226int main(void)
1227{
1228 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1229 (LINUX_VERSION_CODE % 65536) / 256,
1230 LINUX_VERSION_CODE % 256);
1231#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1232 printf(", OK.\n");
1233 return 0;
1234#else
1235 printf(", expected version 2.4.0 or higher\n");
1236 return 1;
1237#endif
1238}
1239EOF
1240 echo "compiling the following source file:" >> $LOG
1241 cat .tmp_src.c >> $LOG
1242 echo "using the following command line:" >> $LOG
1243 echo "$CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1244 $CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1245 if [ $? -ne 0 ]; then
1246 echo
1247 echo " Linux kernel headers not found at $LINUX"
1248 echo " Check the file $LOG for detailed error information."
1249 fail
1250 else
1251 if test_execute; then
1252 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1253 fi
1254 fi
1255}
1256
1257#
1258# Check for kchmviewer, needed to display the online help
1259#
1260check_kchmviewer()
1261{
1262 test_header kchmviewer
1263 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1264 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1265 if [ $? -ne 0 ]; then
1266 log_failure "not found"
1267 fail
1268 else
1269 log_success "found version $kchmviewer_ver"
1270 fi
1271 fi
1272}
1273
1274#
1275# Check for the kBuild tools, we don't support GNU make
1276#
1277check_kbuild()
1278{
1279 test_header kBuild
1280 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1281 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1282 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1283 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1284 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1285 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1286 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1287 if [ "$OS" = "solaris" ]; then
1288 # Because of sh being non-default shell in Solaris we need to export PATH again when
1289 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1290 echo "PATH=\"$ORGPATH\"" >> $ENV
1291 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1292 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1293 else
1294 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1295 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1296 fi
1297 echo "export PATH" >> $ENV
1298 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1299 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1300 elif check_avail "kmk" KBUILDDIR really; then
1301 # check for installed kBuild
1302 KBUILD_SED="`which_wrapper kmk_sed`"
1303 else
1304 fail
1305 fi
1306 log_success "found"
1307}
1308
1309
1310#
1311# Check for compiler.h
1312# Some Linux distributions include "compiler.h" in their libc linux
1313# headers package, some don't. Most don't need it, building might (!)
1314# not succeed on openSUSE without it.
1315#
1316# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1317#
1318check_compiler_h()
1319{
1320 test_header compiler.h
1321 if ! test -f "/usr/include/linux/compiler.h"; then
1322 cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
1323 log_success "compiler.h not found"
1324 else
1325 log_success "compiler.h found"
1326 fi
1327}
1328
1329
1330#
1331# Check if we are able to build 32-bit applications (needed for the guest additions)
1332#
1333check_32bit()
1334{
1335 test_header "32-bit support"
1336 cat > .tmp_src.c << EOF
1337#include <stdint.h>
1338int main(void)
1339{
1340 return 0;
1341}
1342EOF
1343 echo "compiling the following source file:" >> $LOG
1344 cat .tmp_src.c >> $LOG
1345 echo "using the following command line:" >> $LOG
1346 echo "$CC -m32 -O -Wall -o .tmp_out .tmp_src.c" >> $LOG
1347 $CC -m32 -O -Wall -o .tmp_out .tmp_src.c >> $LOG 2>&1
1348 if [ $? -ne 0 ]; then
1349 echo
1350 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1351 echo " Check the file $LOG for detailed error information."
1352 fail
1353 fi
1354 log_success ""
1355}
1356
1357#
1358# Setup wine
1359#
1360setup_wine()
1361{
1362 test_header "Wine support"
1363 if ! which_wrapper wine > /dev/null; then
1364 echo " wine binary not found"
1365 fail
1366 fi
1367 if ! which_wrapper wineprefixcreate > /dev/null; then
1368 echo " wineprefixcreate not found"
1369 fail
1370 fi
1371 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1372 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1373 rm -rf $WINEPREFIX
1374 mkdir -p $WINEPREFIX
1375 touch $WINEPREFIX/.no_prelaunch_window_flag
1376 if ! wineprefixcreate -q > /dev/null 2>&1; then
1377 echo " wineprefixcreate failed"
1378 fail
1379 fi
1380 tmp=.tmp.wine.reg
1381 rm -f $tmp
1382 echo 'REGEDIT4' > $tmp
1383 echo '' >> $tmp
1384 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1385 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
1386 echo '' >> $tmp
1387 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1388 echo '"itss"="native"' >> $tmp
1389 echo '' >> $tmp
1390 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1391 echo '"itss"="native"' >> $tmp
1392 echo '' >> $tmp
1393 if ! wine regedit $tmp > /dev/null 2>&1; then
1394 rm -f $tmp
1395 echo " failed to load registry changes (path)."
1396 fail
1397 fi
1398 rm -f $tmp
1399 log_success "found"
1400}
1401
1402
1403#
1404# Show help
1405#
1406show_help()
1407{
1408 cat << EOF
1409Usage: ./configure [OPTIONS]...
1410
1411Configuration:
1412 -h, --help display this help and exit
1413 --nofatal don't abort on errors
1414 --disable-xpcom disable XPCOM and related stuff
1415 --disable-sdl-ttf disable SDL_ttf detection
1416 --disable-pulse disable PulseAudio detection
1417 --disable-kmods don't build Linux kernel modules (host and guest)
1418 --build-libxml2 build libxml2 from sources
1419 --build-libxslt build libxslt from sources (not OSE!)
1420 --setup-wine setup a Wine directory and register the hhc hack
1421
1422Paths:
1423 --with-gcc=PATH location of the gcc compiler [$CC]
1424 --with-g++=PATH location of the g++ compiler [$CXX]
1425 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1426 --with-iasl=PATH location of the iasl compiler [$IASL]
1427 --with-linux=DIR Linux kernel source directory [$LINUX]
1428 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1429 --with-qt-dir=DIR directory for QT headers/libraries [$QTDIR]
1430
1431Build type:
1432 -d, --build-debug build with debugging symbols and assertions
1433 --build-profile build with profiling support
1434 --build-headless build headless (without any X11 frontend)
1435EOF
1436 exit 0
1437}
1438
1439
1440#
1441# The body.
1442#
1443
1444# scan command line options
1445for option in $*; do
1446 case "$option" in
1447 --help|-help|-h)
1448 show_help
1449 ;;
1450 --nofatal)
1451 nofatal=1
1452 ;;
1453 --with-gcc=*)
1454 CC=`echo $option | cut -d'=' -f2`
1455 ;;
1456 --with-g++=*)
1457 CXX=`echo $option | cut -d'=' -f2`
1458 ;;
1459 --with-kbuild=*)
1460 KBUILDDIR=`echo $option | cut -d'=' -f2`
1461 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1462 echo "Error: KBUILDDIR contains invalid characters!"
1463 exit 1
1464 fi
1465 ;;
1466 --with-qt-dir=*)
1467 QTDIR=`echo $option | cut -d'=' -f2`
1468 ;;
1469 --with-iasl=*)
1470 IASL=`echo $option | cut -d'=' -f2`
1471 ;;
1472 --with-linux=*)
1473 LINUX=`echo $option | cut -d'=' -f2`
1474 ;;
1475 --with-mkisofs=*)
1476 MKISOFS=`echo $option | cut -d'=' -f2`
1477 ;;
1478 --disable-xpcom)
1479 WITH_XPCOM=0
1480 ;;
1481 --disable-sdl-ttf)
1482 WITH_SDL_TTF=0
1483 ;;
1484 --disable-qt)
1485 WITH_QT=0
1486 ;;
1487 --disable-pulse)
1488 WITH_PULSE=0
1489 ;;
1490 --disable-kmods)
1491 WITH_KMODS=0
1492 ;;
1493 --build-debug|-d)
1494 BUILD_TYPE=debug
1495 ;;
1496 --build-profile)
1497 BUILD_TYPE=profile
1498 ;;
1499 --build-libxml2)
1500 BUILD_LIBXML2=1
1501 ;;
1502 --build-libxslt)
1503 BUILD_LIBXSLT=1
1504 ;;
1505 --build-headless)
1506 HEADLESS=1
1507 WITH_SDL=0
1508 WITH_SDL_TTF=0
1509 WITH_X11=0
1510 WITH_QT=0
1511 ;;
1512 --ose)
1513 OSE=2
1514 ;;
1515 --odir=*)
1516 ODIR="`echo $option | cut -d'=' -f2`/"
1517 ;;
1518 --setup-wine)
1519 SETUP_WINE=1
1520 ;;
1521 *)
1522 echo
1523 echo "Unrecognized option \"$option\""
1524 echo
1525 show_help
1526 ;;
1527 esac
1528done
1529
1530LOG="$ODIR$LOG"
1531ENV="$ODIR$ENV"
1532CNF="$ODIR$CNF"
1533
1534# initialize output files
1535cat > $LOG << EOF
1536# Log file generated by
1537#
1538# '$0 $*'
1539#
1540
1541EOF
1542cat > $CNF << EOF
1543# -*- Makefile -*-
1544#
1545# automatically generated by
1546#
1547# '$0 $*'
1548#
1549# It will be completely overwritten if configure is executed again.
1550#
1551
1552EOF
1553cat > $ENV << EOF
1554#!/bin/bash
1555#
1556# automatically generated by
1557#
1558# '$0 $*'
1559#
1560# It will be completely overwritten if configure is executed again.
1561# Make sure you source this file once before you start to build VBox.
1562#
1563
1564EOF
1565
1566# test if we are OSE
1567if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
1568 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
1569 echo >> $LOG
1570 OSE=0
1571fi
1572
1573if [ "$BUILD_TYPE" = "debug" ]; then
1574 echo "Creating DEBUG build!" >> $LOG
1575elif [ "$BUILD_TYPE" = "profile" ]; then
1576 echo "Creating PROFILE build!" >> $LOG
1577fi
1578
1579# first determine our environment
1580check_environment
1581check_kbuild
1582
1583# append the tools directory to the default search path
1584echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
1585export PATH
1586
1587# some things are not available in for OSE
1588if [ $OSE -ge 1 ]; then
1589 cnf_append "VBOX_OSE" "1"
1590 cnf_append "VBOX_WITH_TESTSUITE" ""
1591 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
1592
1593 if [ "$OS" = "linux" ]; then
1594 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
1595 else
1596 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
1597 fi
1598 echo >> $CNF
1599fi
1600
1601# headless
1602if [ -n "$HEADLESS" ]; then
1603 cnf_append "VBOX_HEADLESS" "1"
1604fi
1605
1606# emit disable directives corresponding to any --disable-xxx options.
1607[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
1608[ $WITH_QT -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
1609[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
1610
1611# the tools
1612check_gcc
1613[ "$OS" != "darwin" ] && check_as86
1614[ "$OS" != "darwin" ] && check_bcc
1615[ "$OS" != "darwin" ] && check_iasl
1616# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
1617# [ "$OS" != "darwin" ] && check_yasm
1618[ "$OS" != "darwin" ] && check_xsltproc
1619[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
1620
1621# the libraries
1622[ "$OS" != "darwin" ] && check_pthread
1623# build libxml2 on Darwin in every case
1624[ "$OS" != "darwin" ] || BUILD_LIBXML2=1
1625[ $WITH_XPCOM -eq 1 ] && check_libxml2
1626# build libxslt on Darwin in every case
1627[ "$OS" != "darwin" ] || BUILD_LIBXSLT=1
1628#[ $WITH_XPCOM -eq 1 ] && check_libxslt
1629[ $WITH_LIBIDL -eq 1 ] && check_libidl
1630# build openssl on Darwin in every case
1631[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
1632[ "$OS" != "darwin" ] && check_z
1633[ "$OS" != "darwin" ] && check_png
1634[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
1635[ $WITH_SDL -eq 1 ] && check_sdl
1636[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
1637[ $WITH_X11 -eq 1 ] && check_x
1638[ $WITH_X11 -eq 1 ] && check_xcursor
1639[ $WITH_QT -eq 1 ] && check_qt3
1640[ $WITH_QT -eq 1 ] && check_qt4
1641
1642# Linux-specific
1643if [ "$OS" = "linux" ]; then
1644 check_staticlibstdcxx
1645 if [ $WITH_KMODS -eq 1 ]; then
1646 check_linux
1647 else
1648 cnf_append "VBOX_LINUX_SRC" ""
1649 cnf_append "VBOX_WITH_VBOXDRV" ""
1650 cnf_append "VBOX_WITH_LINUX_ADDITIONS_32BIT_R0" ""
1651 fi
1652 check_alsa
1653 if [ $WITH_PULSE -eq 1 ]; then
1654 check_pulse
1655 else
1656 cnf_append "VBOX_WITH_PULSE" ""
1657 fi
1658 check_compiler_h
1659 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
1660fi
1661
1662[ -n "$SETUP_WINE" ] && setup_wine
1663
1664# success!
1665echo
1666echo "Successfully generated '$CNF' and '$ENV'."
1667echo "Source '$ENV' once before you start to build VBox:"
1668echo ""
1669echo " source $ENV"
1670echo " kmk"
1671echo ""
1672if [ "$OS" = "linux" ]; then
1673 echo "To compile the kernel module, do:"
1674 echo ""
1675 echo " cd ./out/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
1676 echo " make"
1677 echo ""
1678fi
1679echo "Enjoy!"
1680cleanup
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