VirtualBox

source: vbox/trunk/configure@ 5534

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

LIB and PATH hacks for 64-bit solaris.

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