VirtualBox

source: vbox/trunk/configure@ 7294

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

configure: force building of libssl on Darwin

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