VirtualBox

source: vbox/trunk/configure@ 6199

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

configure: determine installed kBuild packages on Linux

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