VirtualBox

source: vbox/trunk/configure@ 7288

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

configure: build libxml2 on Darwin in every case

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