VirtualBox

source: vbox/trunk/configure@ 6155

Last change on this file since 6155 was 6125, checked in by vboxsync, 17 years ago

removed the remaining VBoxXML part

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