VirtualBox

source: vbox/trunk/configure@ 5408

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

Add configure check for static libstc++ on linux. Needed by the
additions.

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