VirtualBox

source: vbox/trunk/configure@ 6079

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

configure: fixed parsing of libxml2 incs/libs

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