VirtualBox

source: vbox/trunk/configure@ 19454

Last change on this file since 19454 was 19452, checked in by vboxsync, 15 years ago

configure: fix picking up qt3 tools instead of the qt4 ones on FreeBSD. they use the suffix approach there.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 57.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-2009 Sun Microsystems, Inc.
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# Wrapper for ancient /usr/bin/which on darwin that always returns 0
27which_wrapper()
28{
29 if [ -z "$have_ancient_which" ]; then
30 if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
31 have_ancient_which="yes"
32 else
33 have_ancient_which="no"
34 fi
35 fi
36 if [ "$have_ancient_which" = "yes" ]; then
37 retval=`which $* 2>/dev/null`
38 echo "$retval"
39 test -n "$retval" -a -x "$retval"
40 unset retval
41 else
42 which $* 2> /dev/null
43 fi
44}
45
46
47#
48# Defaults
49#
50OSE=1
51ODIR="`pwd`/"
52ODIR_OVERRIDE=0
53OUT_PATH=""
54OUT_PATH_OVERRIDE=0
55SETUP_WINE=
56TARGET_MACHINE=""
57TARGET_CPU=""
58WITH_XPCOM=1
59WITH_PYTHON=1
60WITH_LIBIDL=1
61WITH_GSOAP=0
62WITH_QT4=1
63WITH_SDL=1
64WITH_SDL_TTF=1
65WITH_X11=1
66WITH_ALSA=1
67WITH_PULSE=1
68WITH_DBUS=1
69WITH_KMODS=1
70WITH_OPENGL=1
71WITH_HARDENING=1
72CC="gcc"
73CC32=""
74CC64=""
75CXX="g++"
76CXX32=""
77CXX64=""
78BCC="bcc"
79YASM="yasm"
80IASL="iasl"
81AS86="as86"
82XSLTPROC="xsltproc"
83GENISOIMAGE="genisoimage"
84MKISOFS="mkisofs"
85BUILD_LIBXML2=
86BUILD_LIBXSLT=
87LIBCRYPTO="-lcrypto"
88LIBPTHREAD="-lpthread"
89LIBCAP="-lcap"
90GSOAP=""
91GSOAP_IMPORT=""
92LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
93INCX11="/usr/local/include"
94LIBXCURSOR="-lXcursor"
95LIBXMU="-lXmu"
96MESA="-lGL"
97INCZ=""
98LIBZ="-lz"
99INCPNG=""
100LIBPNG="-lpng"
101INCCURL=""
102LIBCURL="-lcurl"
103PKGCONFIG="`which_wrapper pkg-config`"
104PYTHONDIR="/usr /usr/local"
105QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
106QT4DIR_PKGCONFIG=1
107QT4UIC3DIR="/usr/bin"
108KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
109DEVDIR="`cd \`dirname $0\`; pwd`/tools"
110if [ -d "/lib/modules/`uname -r`/build" ]; then
111 LINUX="/lib/modules/`uname -r`/build"
112else
113 LINUX="/usr/src/linux"
114fi
115KCHMVIEWER="kchmviewer"
116LOG="configure.log"
117CNF="AutoConfig.kmk"
118ENV="env.sh"
119BUILD_TYPE="release"
120# the restricting tool is ar (mri mode).
121INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
122
123if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
124 echo "Error: VBox base path contains invalid characters!"
125 exit 1
126fi
127
128# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
129if [ "`uname`" = "Darwin" ]; then
130 ECHO_N="/bin/echo -n"
131else
132 ECHO_N="echo -n"
133fi
134
135
136cleanup()
137{
138 rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
139}
140
141fail()
142{
143 if [ -z "$nofatal" -o "x$1" != "x" ]; then
144 cleanup
145 rm -f $ENV
146 exit 1
147 fi
148}
149
150log()
151{
152 echo "$1"
153 echo "$1" >> $LOG
154}
155
156log_success()
157{
158 if [ -n "$1" ]; then $ECHO_N "$1, "; fi
159 echo "OK."
160 echo "$1" >> $LOG
161 echo >> $LOG
162 echo >> $LOG
163}
164
165log_failure()
166{
167 echo
168 echo " ** $1!"
169 echo "** $1!" >> $LOG
170 echo >> $LOG
171}
172
173cnf_append()
174{
175 printf "%-30s := %s\n" "$1" "$2" >> $CNF
176}
177
178strip_l()
179{
180 echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
181}
182
183strip_L()
184{
185 echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
186}
187
188strip_I()
189{
190 echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
191}
192
193prefix_I()
194{
195 echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
196}
197
198check_avail()
199{
200 if [ -z "$1" ]; then
201 log_failure "$2 is empty"
202 fail $3
203 return 1
204 elif which_wrapper $1 > /dev/null; then
205 return 0
206 else
207 log_failure "$1 (variable $2) not found"
208 fail $3
209 return 1
210 fi
211}
212
213
214# Prepare a test
215test_header()
216{
217 echo "***** Checking $1 *****" >> $LOG
218 $ECHO_N "Checking for $1: "
219}
220
221
222# Compile a test
223# $1 compile flags/libs
224# $2 library name
225# $3 package name
226# $4 if this argument is 'nofatal', don't abort
227test_compile()
228{
229 echo "compiling the following source file:" >> $LOG
230 cat $ODIR.tmp_src.cc >> $LOG
231 echo "using the following command line:" >> $LOG
232 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
233 $CXX -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
234 if [ $? -ne 0 ]; then
235 if [ -z "$4" ]; then
236 echo
237 echo " $2 not found at $1 or $3 headers not found"
238 echo " Check the file $LOG for detailed error information."
239 fail
240 else
241 echo "not found."
242 echo >> $LOG
243 echo >> $LOG
244 fi
245 return 1
246 fi
247 return 0
248}
249
250
251# Execute a compiled test binary
252test_execute()
253{
254 echo "executing the binary" >> $LOG
255 $ODIR.tmp_out > $ODIR.test_execute.log
256 rc=$?
257 cat $ODIR.test_execute.log | tee -a $LOG
258 if [ $rc -ne 0 ]; then
259 fail $1
260 return 1
261 fi
262 echo >> $LOG
263 echo >> $LOG
264 return 0
265}
266
267
268# Execute a compiled test binary
269test_execute_path()
270{
271 echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
272 LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
273 rc=$?
274 cat $ODIR.test_execute.log | tee -a $LOG
275 if [ $rc -ne 0 ]; then
276 fail
277 return 1
278 fi
279 echo >> $LOG
280 echo >> $LOG
281 return 0
282}
283
284
285#
286# Check for OS, MACHINE, CPU
287#
288check_environment()
289{
290 test_header environment
291 OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
292 case "$OS" in
293 linux)
294 ;;
295 darwin)
296 ;;
297 freebsd)
298 ;;
299 sunos)
300 OS='solaris'
301 ;;
302 *)
303 log_failure "Cannot determine OS"
304 exit 1
305 ;;
306 esac
307 BUILD_CPU=`uname -m`
308 [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
309 case "$BUILD_CPU" in
310 i[3456789]86|x86|i86pc)
311 BUILD_MACHINE='x86'
312 LIB='lib'
313 ;;
314 x86_64|amd64)
315 BUILD_MACHINE='amd64'
316 BUILD_CPU='k8'
317 if [ "$OS" != "solaris" ]; then
318 # on AMD64 systems, 64bit libs are usually located in /usr/lib64
319 # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
320 LIB='lib64'
321 else
322 # Solaris doesn't seem to subscribe to fhs, libs are usually in
323 # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
324 # alternative binaries can be found in 'amd64' subdirs of the 'bin'
325 # ones. So, in order to find the right stuff (esp. sdl-config) we'll
326 # have to make sure the */bin/amd64 dirs are searched before the */bin
327 # ones. (The sed has some sideeffects, but they shouldn't harm us...)
328 echo "64-bit Solaris detected, hacking the PATH" >> $LOG
329 echo "old PATH: $PATH" >> $LOG
330 PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
331 -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
332 export PATH
333 echo "new PATH: $PATH" >> $LOG
334 LIB='lib/64'
335 fi
336 ;;
337 *)
338 log_failure "Cannot determine system"
339 exit 1
340 ;;
341 esac
342 [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
343 [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
344 DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
345 log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
346
347 echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
348 echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
349 echo "export BUILD_TARGET=\"$OS\"" >> $ENV
350 echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
351 echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
352 echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
353}
354
355#
356# Check for gcc with version >= 3.2.
357# We depend on a working gcc, if we fail terminate in every case.
358#
359check_gcc()
360{
361 test_header gcc
362 if check_avail "$CC" CC really; then
363 cc_ver=`$CC -dumpversion` 2>/dev/null
364 if [ $? -ne 0 ]; then
365 log_failure "cannot execute '$CC -dumpversion'"
366 fail really
367 fi
368 if check_avail "$CXX" CXX really; then
369 cxx_ver=`$CXX -dumpversion` 2>/dev/null
370 if [ $? -ne 0 ]; then
371 log_failure "cannot execute '$CXX -dumpversion'"
372 fail really
373 fi
374 cc_maj=`echo $cc_ver|cut -d. -f1`
375 cc_min=`echo $cc_ver|cut -d. -f2`
376 if [ "x$cc_ver" != "x$cxx_ver" ]; then
377 log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
378 fail really
379 elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "OS" = "darwin" ]; then
380 log_success "found version $cc_ver"
381 elif [ $cc_maj -eq 4 -a $cc_min -eq 4 ]; then
382 log_success "found version $cc_ver"
383 log " WARNING: gcc version 4.4 was not extensively tested with the"
384 log " VirtualBox source code! Continue at your own risk!"
385 # gcc-4.0 is allowed for Darwin only
386 elif [ $cc_maj -lt 3 \
387 -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
388 -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
389 -o \( $cc_maj -eq 4 -a $cc_min -gt 4 \) \
390 -o $cc_maj -gt 4 ]; then
391 log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<4"
392 fail really
393 else
394 log_success "found version $cc_ver"
395 fi
396 if [ "$BUILD_MACHINE" = "amd64" ]; then
397 [ -z "$CC32" ] && CC32="$CC -m32"
398 [ -z "$CXX32" ] && CXX32="$CXX -m32"
399 else
400 [ -z "$CC32" ] && CC32="$CC"
401 [ -z "$CXX32" ] && CXX32="$CXX"
402 fi
403 if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
404 [ -z "$CC64" ] && CC64="$CC -m64"
405 [ -z "$CXX64" ] && CXX64="$CXX -m64"
406 fi
407 if [ "$CC" != "gcc" ]; then
408 cnf_append "TOOL_GCC3_CC" "$CC"
409 cnf_append "TOOL_GCC3_AS" "$CC"
410 cnf_append "TOOL_GCC3_LD" "$CC"
411 cnf_append "TOOL_GXX3_CC" "$CC"
412 cnf_append "TOOL_GXX3_AS" "$CC"
413 fi
414 if [ "$CXX" != "g++" ]; then
415 cnf_append "TOOL_GCC3_CXX" "$CXX"
416 cnf_append "TOOL_GXX3_CXX" "$CXX"
417 cnf_append "TOOL_GXX3_LD" "$CXX"
418 fi
419 if [ "$CC32" != "gcc -m32" ]; then
420 cnf_append "TOOL_GCC32_CC" "$CC32"
421 cnf_append "TOOL_GCC32_AS" "$CC32"
422 cnf_append "TOOL_GCC32_LD" "$CC32"
423 cnf_append "TOOL_GXX32_CC" "$CC32"
424 cnf_append "TOOL_GXX32_AS" "$CC32"
425 fi
426 if [ "$CXX32" != "g++ -m32" ]; then
427 cnf_append "TOOL_GCC32_CXX" "$CXX32"
428 cnf_append "TOOL_GXX32_CXX" "$CXX32"
429 cnf_append "TOOL_GXX32_LD" "$CXX32"
430 fi
431 # this isn't not necessary, there is not such tool.
432 if [ -n "$CC64" ]; then
433 cnf_append "TOOL_GCC64_CC" "$CC64"
434 cnf_append "TOOL_GCC64_AS" "$CC64"
435 cnf_append "TOOL_GCC64_LD" "$CC64"
436 cnf_append "TOOL_GXX64_CC" "$CC64"
437 cnf_append "TOOL_GXX64_AS" "$CC64"
438 fi
439 if [ -n "$CXX64" ]; then
440 cnf_append "TOOL_GCC64_CXX" "$CXX64"
441 cnf_append "TOOL_GXX64_CXX" "$CXX64"
442 cnf_append "TOOL_GXX64_LD" "$CXX64"
443 fi
444 # Solaris sports a 32-bit gcc/g++.
445 if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
446 [ "$CC" = "gcc" ] && CC="gcc -m64"
447 [ "$CXX" = "g++" ] && CXX="g++ -m64"
448 fi
449 fi
450 fi
451}
452
453
454#
455# Check for the bcc compiler, needed for compiling the BIOS
456#
457check_bcc()
458{
459 test_header bcc
460 if check_avail "$BCC" BCC; then
461 bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
462 if [ $? -ne 0 ]; then
463 log_failure "not found"
464 fail
465 else
466 echo "compiling the following source file:" >> $LOG
467 cat > $ODIR.tmp_src.c << EOF
468int foo(a)
469 int a;
470{
471 return 0;
472}
473EOF
474 cat $ODIR.tmp_src.c >> $LOG
475 bcc_path=`which_wrapper $BCC`
476 bcc_dir="`dirname $bcc_path`/"
477 echo "using the following command line:" >> $LOG
478 echo "$BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
479 $BCC -B $bcc_dir -C-c -3 -S -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
480 if [ $? -ne 0 ]; then
481 log_failure "not found"
482 fail
483 else
484 log_success "found version $bcc_ver"
485 cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
486 fi
487 unset bcc_path
488 unset bcc_dir
489 fi
490 fi
491}
492
493
494#
495# Check for the as86 assembler, needed for compiling the BIOS
496#
497check_as86()
498{
499 test_header as86
500 if check_avail "$AS86" AS86; then
501 as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
502 if [ $? -ne 0 ]; then
503 log_failure "not found"
504 fail
505 else
506 log_success "found version $as86_ver"
507 cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
508 fi
509 fi
510}
511
512
513#
514# Check for yasm, needed to compile assembler files
515#
516check_yasm()
517{
518 test_header yasm
519 if check_avail "$YASM" YASM; then
520 yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
521 if [ $? -ne 0 ]; then
522 log_failure "not found"
523 fail
524 else
525 yasm_maj=`echo $yasm_ver|cut -d. -f1`
526 yasm_min=`echo $yasm_ver|cut -d. -f2`
527 yasm_rev=`echo $yasm_ver|cut -d. -f3`
528 yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
529 if [ $yasm_ver_mul -lt 501 ]; then
530 log_failure "found version $yasm_ver, expected at least 0.5.1"
531 fail
532 else
533 log_success "found version $yasm_ver"
534 fi
535 fi
536 fi
537}
538
539
540#
541# Check for the iasl ACPI compiler, needed to compile vbox.dsl
542#
543check_iasl()
544{
545 test_header iasl
546 if check_avail "$IASL" IASL; then
547 iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
548 if [ $? -ne 0 ]; then
549 log_failure "not found"
550 fail
551 else
552 log_success "found version $iasl_ver"
553 cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
554 fi
555 fi
556}
557
558
559#
560# Check for xsltproc, needed by Main
561#
562check_xsltproc()
563{
564 test_header xslt
565 if check_avail "$XSLTPROC" XSLTPROC; then
566 xsltproc_ver=`$XSLTPROC --version`
567 if [ $? -ne 0 ]; then
568 log_failure "not found"
569 fail
570 else
571 log_success "found"
572 cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
573 fi
574 fi
575}
576
577
578#
579# Check for mkisofs, needed to build the CDROM image containing the additions
580#
581check_mkisofs()
582{
583 test_header mkisofs
584 if which_wrapper $GENISOIMAGE > /dev/null; then
585 mkisofs_ver=`$GENISOIMAGE --version`
586 if [ $? -ne 0 ]; then
587 log_failure "not found"
588 fail
589 else
590 log_success "found $mkisofs_ver"
591 cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
592 fi
593 elif check_avail "$MKISOFS" MKISOFS; then
594 mkisofs_ver=`$MKISOFS --version`
595 if [ $? -ne 0 ]; then
596 log_failure "not found"
597 fail
598 else
599 log_success "found $mkisofs_ver"
600 cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
601 fi
602 fi
603}
604
605
606#
607# Check for libxml2, needed by VBoxSettings
608# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
609#
610check_libxml2()
611{
612 if [ -z "$BUILD_LIBXML2" ]; then
613 test_header libxml2
614 if which_wrapper pkg-config > /dev/null; then
615 libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
616 if [ $? -ne 0 ]; then
617 log_failure "not found"
618 fail
619 else
620 FLGXML2=`pkg-config libxml-2.0 --cflags`
621 INCXML2=`strip_I "$FLGXML2"`
622 LIBXML2=`pkg-config libxml-2.0 --libs`
623 cat > $ODIR.tmp_src.cc << EOF
624#include <cstdio>
625#include <libxml/xmlversion.h>
626extern "C" int main(void)
627{
628 printf("found version %s", LIBXML_DOTTED_VERSION);
629#if LIBXML_VERSION >= 20626
630 printf(", OK.\n");
631 return 0;
632#else
633 printf(", expected version 2.6.26 or higher\n");
634 return 1;
635#endif
636}
637EOF
638 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
639 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
640 if test_execute; then
641 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
642 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
643 fi
644 fi
645 fi
646 elif which_wrapper xml2-config; then
647 libxml2_ver=`xml2-config --version`
648 if [ $? -ne 0 ]; then
649 log_failure "not found"
650 fail
651 else
652 log_success "found version $libxml2_ver"
653 FLGXML2=`xml2-config --cflags`
654 INCXML2=`strip_I "$FLGXML2"`
655 LIBXML2=`xml2-config --libs`
656 cat > $ODIR.tmp_src.cc << EOF
657#include <cstdio>
658#include <libxml/xmlversion.h>
659extern "C" int main(void)
660{
661 printf("found version %s", LIBXML_DOTTED_VERSION);
662#if LIBXML_VERSION >= 20626
663 printf(", OK.\n");
664 return 0;
665#else
666 printf(", expected version 2.6.26 or higher\n");
667 return 1;
668#endif
669}
670EOF
671 [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
672 if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
673 if test_execute; then
674 cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
675 cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
676 fi
677 fi
678 fi
679 else
680 log_failure "neither pkg-config nor xml2-config found"
681 fail
682 fi
683 fi
684}
685
686
687#
688# Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.15,
689# as Solaris right now has no newer version and it definitely works.
690# 1.1.17 is available on Ubuntu Edgy which fulfils the minimal libxml2
691# requirement (2.6.26).
692#
693check_libxslt()
694{
695 if [ -z "$BUILD_LIBXSLT" ]; then
696 test_header libxslt
697 if which_wrapper pkg-config > /dev/null; then
698 libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
699 if [ $? -ne 0 ]; then
700 log_failure "not found"
701 fail
702 else
703 FLGXSLT=`pkg-config libxslt --cflags`
704 INCXSLT=`strip_I "$FLGXSLT"`
705 LIBXSLT=`pkg-config libxslt --libs`
706 cat > $ODIR.tmp_src.cc << EOF
707#include <cstdio>
708#include <libxslt/xsltconfig.h>
709extern "C" int main(void)
710{
711 printf("found version %s", LIBXSLT_DOTTED_VERSION);
712#if LIBXSLT_VERSION >= 10117
713 printf(", OK.\n");
714 return 0;
715#else
716 printf(", expected version 1.1.17 or higher\n");
717 return 1;
718#endif
719}
720EOF
721 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
722 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
723 if test_execute; then
724 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
725 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
726 fi
727 fi
728 fi
729 elif which_wrapper xslt-config; then
730 libxslt_ver=`xslt-config --version`
731 if [ $? -ne 0 ]; then
732 log_failure "not found"
733 fail
734 else
735 log_success "found version $libxslt_ver"
736 FLGXSLT=`xslt-config --cflags`
737 INCXSLT=`strip_I "$FLGXSLT"`
738 LIBXSLT=`xslt-config --libs`
739 cat > $ODIR.tmp_src.cc << EOF
740#include <cstdio>
741#include <libxslt/xsltconfig.h>
742extern "C" int main(void)
743{
744 printf("found version %s", LIBXSLT_DOTTED_VERSION);
745#if LIBXSLT_VERSION >= 10117
746 printf(", OK.\n");
747 return 0;
748#else
749 printf(", expected version 1.1.17 or higher\n");
750 return 1;
751#endif
752}
753EOF
754 [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
755 if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
756 if test_execute; then
757 cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
758 cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
759 fi
760 fi
761 fi
762 else
763 log_failure "neither pkg-config nor xslt-config found"
764 fail
765 fi
766 fi
767}
768
769
770#
771# Check for libIDL, needed by xpcom
772#
773check_libidl()
774{
775 test_header libIDL
776
777 if which_wrapper libIDL-config-2 > /dev/null; then
778 libidl_ver=`libIDL-config-2 --version`
779 if [ $? -ne 0 ]; then
780 log_failure "not found"
781 fail
782 else
783 log_success "found version $libidl_ver"
784 cnf_append "VBOX_LIBIDL_CONFIG" \
785 "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
786 fi
787 elif check_avail "libIDL-config" libIDL-config; then
788 libidl_ver=`libIDL-config --version`
789 if [ $? -ne 0 ]; then
790 log_failure "not found"
791 fail
792 else
793 log_success "found version $libidl_ver"
794 cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
795 fi
796 fi
797}
798
799
800#
801# Check for openssl, needed for RDP
802#
803check_ssl()
804{
805 test_header ssl
806 cat > $ODIR.tmp_src.cc << EOF
807#include <cstdio>
808#include <openssl/opensslv.h>
809extern "C" int main(void)
810{
811 printf("found version %s", OPENSSL_VERSION_TEXT);
812#if OPENSSL_VERSION_NUMBER >= 0x0090700
813 printf(", OK.\n");
814 return 0;
815#else
816 printf(", expected version 0.9.7 or higher\n");
817 return 1;
818#endif
819}
820EOF
821 if test_compile $LIBCRYPTO libcrypto openssl; then
822 if test_execute nofatal; then
823 cnf_append "SDK_VBOX_OPENSSL_INCS" ""
824 cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
825 fi
826 fi
827}
828
829
830#
831# Check for pthread, needed by VBoxSVC, frontends, ...
832#
833check_pthread()
834{
835 test_header pthread
836 cat > $ODIR.tmp_src.cc << EOF
837#include <cstdio>
838#include <pthread.h>
839extern "C" int main(void)
840{
841 pthread_mutex_t mutex;
842 if (pthread_mutex_init(&mutex, NULL)) {
843 printf("pthread_mutex_init() failed\n");
844 return 1;
845 }
846 if (pthread_mutex_lock(&mutex)) {
847 printf("pthread_mutex_lock() failed\n");
848 return 1;
849 }
850 if (pthread_mutex_unlock(&mutex)) {
851 printf("pthread_mutex_unlock() failed\n");
852 return 1;
853 }
854 printf("found, OK.\n");
855}
856EOF
857 if test_compile $LIBPTHREAD pthread pthread; then
858 if test_execute; then
859 cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
860 fi
861 fi
862}
863
864
865#
866# Check for zlib, needed by VBoxSVC, Runtime, ...
867#
868check_z()
869{
870 test_header zlib
871 cat > $ODIR.tmp_src.cc << EOF
872#include <cstdio>
873#include <zlib.h>
874extern "C" int main(void)
875{
876 printf("found version %s", ZLIB_VERSION);
877#if ZLIB_VERNUM >= 0x1210
878 printf(", OK.\n");
879 return 0;
880#else
881 printf(", expected version 1.2.1 or higher\n");
882 return 1;
883#endif
884}
885EOF
886 [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
887 if test_compile "$LIBZ $I_INCZ" zlib zlib; then
888 if test_execute; then
889 cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
890 cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
891 fi
892 fi
893}
894
895
896#
897# Check for libpng, needed by kchmviewer
898#
899check_png()
900{
901 test_header libpng
902 cat > $ODIR.tmp_src.cc << EOF
903#include <cstdio>
904#include <png.h>
905extern "C" int main(void)
906{
907 printf("found version %s", PNG_LIBPNG_VER_STRING);
908#if PNG_LIBPNG_VER >= 10205
909 printf(", OK.\n");
910 return 0;
911#else
912 printf(", expected version 1.2.5 or higher\n");
913 return 1;
914#endif
915}
916EOF
917 [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
918# if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then
919 if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
920# if test_execute nofatal; then
921 if test_execute; then
922 cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
923 cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
924 fi
925 fi
926}
927
928#
929# Check for libcurl, needed by S3
930#
931check_curl()
932{
933 test_header libcurl
934 cat > $ODIR.tmp_src.cc << EOF
935#include <cstdio>
936#include <curl/curl.h>
937extern "C" int main(void)
938{
939 printf("found version %s", LIBCURL_VERSION);
940#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR >= 71500
941 printf(", OK.\n");
942 return 0;
943#else
944 printf(", expected version 7.15.0 or higher\n");
945 return 1;
946#endif
947}
948EOF
949 [ -n "$INCCURL" ] && I_INCCURL=`prefix_I "$INCCURL"`
950# if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl nofatal; then
951 if test_compile "$LIBCURL $I_INCCURL" libcurl libcurl; then
952# if test_execute nofatal; then
953 if test_execute; then
954 cnf_append "SDK_VBOX_LIBCURL_LIBS" "`strip_l "$LIBCURL"`"
955 cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
956 fi
957 fi
958}
959
960
961#
962# Check for pam, needed by VRDPAuth
963# Version 79 was introduced in 9/2005, do we support older versions?
964# Debian/sarge uses 76
965# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
966#
967check_pam()
968{
969 test_header pam
970 cat > $ODIR.tmp_src.cc << EOF
971#include <cstdio>
972#include <security/pam_appl.h>
973extern "C" int main(void)
974{
975 printf("found version %d", __LIBPAM_VERSION);
976 if (__LIBPAM_VERSION >= 76)
977 {
978 printf(", OK.\n");
979 return 0;
980 }
981 else
982 {
983 printf(", expected version 76 or higher\n");
984 return 1;
985 }
986}
987EOF
988 if test_compile "-lpam" pam pam nofatal; then
989 if test_execute nofatal; then
990 return 0;
991 fi
992 fi
993 test_header linux_pam
994 cat > $ODIR.tmp_src.cc << EOF
995#include <cstdio>
996#include <security/pam_appl.h>
997extern "C" int main(void)
998{
999 printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
1000 if (__LINUX_PAM__ >= 1)
1001 {
1002 printf(", OK.\n");
1003 return 0;
1004 }
1005 else
1006 {
1007 printf(", expected version 1.0 or higher\n");
1008 return 1;
1009 }
1010}
1011EOF
1012 if test_compile "-lpam" pam pam; then
1013 test_execute
1014 fi
1015}
1016
1017
1018#
1019# Check for the SDL library, needed by VBoxSDL and VirtualBox
1020# We depend at least on version 1.2.7
1021#
1022check_sdl()
1023{
1024 test_header SDL
1025 if [ "$OS" = "darwin" ]; then
1026 if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
1027 PATH_SDK_LIBSDL="/System/Library/Frameworks/SDL.framework"
1028 elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
1029 PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
1030 fi
1031 if [ -n "$PATH_SDK_LIBSDL" ]; then
1032 foundsdl=1
1033 INCSDL="$PATH_SDK_LIBSDL/Headers"
1034 FLDSDL="-framework SDL"
1035 else
1036 log_failure "SDL framework not found"
1037 fail
1038 fi
1039 else
1040 if which_wrapper sdl-config > /dev/null; then
1041 FLGSDL=`sdl-config --cflags`
1042 INCSDL=`strip_I "$FLGSDL"`
1043 LIBSDL=`sdl-config --libs`
1044 LIBSDLMAIN="-lSDLmain"
1045 FLDSDL=
1046 foundsdl=1
1047 fi
1048 fi
1049 [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1050 if [ -n "$foundsdl" ]; then
1051 cat > $ODIR.tmp_src.cc << EOF
1052#include <cstdio>
1053#include <SDL.h>
1054#include <SDL_main.h>
1055#undef main
1056extern "C" int main(int argc, char** argv)
1057{
1058 printf("found version %d.%d.%d",
1059 SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1060#if SDL_VERSION_ATLEAST(1,2,7)
1061 printf(", OK.\n");
1062 return 0;
1063#else
1064 printf(", expected version 1.2.7 or higher\n");
1065 return 1;
1066#endif
1067}
1068EOF
1069 [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
1070 if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
1071 if test_execute; then
1072 cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1073 cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1074 cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
1075 [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1076 [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
1077 fi
1078 fi
1079 else
1080 log_failure "not found"
1081 fail
1082 fi
1083}
1084
1085
1086#
1087# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1088#
1089check_sdl_ttf()
1090{
1091 test_header SDL_ttf
1092 cat > $ODIR.tmp_src.cc << EOF
1093#include <cstdio>
1094#include <SDL_ttf.h>
1095#ifndef SDL_TTF_MAJOR_VERSION
1096#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1097#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1098#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1099#endif
1100extern "C" int main(void)
1101{
1102 printf("found version %d.%d.%d",
1103 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1104#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1105 printf(", OK.\n");
1106 return 0;
1107#else
1108 printf(", expected version 2.0.6 or higher\n");
1109 return 1;
1110#endif
1111}
1112EOF
1113 if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
1114 if ! test_execute nofatal; then
1115 cnf_append "VBOX_WITH_SECURELABEL" ""
1116 fi
1117 else
1118 cnf_append "VBOX_WITH_SECURELABEL" ""
1119 fi
1120}
1121
1122
1123#
1124# Check for libasound, needed by the ALSA audio backend
1125#
1126check_alsa()
1127{
1128 test_header ALSA
1129 cat > $ODIR.tmp_src.cc << EOF
1130#include <cstdio>
1131#include <alsa/asoundlib.h>
1132extern "C" int main(void)
1133{
1134 printf("found version %d.%d.%d",
1135 SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
1136#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
1137 printf(", OK.\n");
1138 return 0;
1139#else
1140 printf(", expected version 1.0.6 or higher\n");
1141 return 1;
1142#endif
1143}
1144EOF
1145 if test_compile "-lasound" asound asound; then
1146 test_execute
1147 fi
1148}
1149
1150
1151#
1152# Check for PulseAudio
1153#
1154check_pulse()
1155{
1156 test_header "PulseAudio"
1157 cat > $ODIR.tmp_src.cc << EOF
1158#include <cstdio>
1159#include <pulse/version.h>
1160extern "C" int main(void)
1161{
1162 printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1163#if PA_API_VERSION >= 9
1164 printf(", OK.\n");
1165 return 0;
1166#else
1167 printf(", expected version 0.9.0 (API version 9) or higher\n");
1168 return 1;
1169#endif
1170}
1171EOF
1172 if test_compile "-lpulse" pulse pulse; then
1173 test_execute
1174 fi
1175}
1176
1177
1178#
1179# Check for the X libraries (Xext, X11)
1180#
1181check_x()
1182{
1183 test_header "X libraries"
1184 cat > $ODIR.tmp_src.cc << EOF
1185#include <cstdio>
1186#include <X11/Xlib.h>
1187extern "C" int main(void)
1188{
1189 Display *dpy;
1190 int scrn_num;
1191 Screen *scrn;
1192 Window win;
1193
1194 dpy = XOpenDisplay(NULL);
1195 scrn_num = DefaultScreen(dpy);
1196 scrn = ScreenOfDisplay(dpy, scrn_num);
1197 win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1198 0, 16, InputOutput, CopyFromParent, 0, NULL);
1199 XDestroyWindow(dpy, win);
1200}
1201EOF
1202 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1203 if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1204 log_success "found"
1205 fi
1206}
1207
1208
1209#
1210# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1211#
1212check_xcursor()
1213{
1214 test_header Xcursor
1215 cat > $ODIR.tmp_src.cc << EOF
1216#include <cstdio>
1217#include <X11/Xlib.h>
1218#include <X11/Xcursor/Xcursor.h>
1219extern "C" int main(void)
1220{
1221 XcursorImage *cursor = XcursorImageCreate (10, 10);
1222 XcursorImageDestroy(cursor);
1223 return 0;
1224}
1225EOF
1226 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1227 if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1228 log_success "found"
1229 cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1230 fi
1231}
1232
1233
1234#
1235# Check for the Xmu library, needed by OpenGL
1236#
1237check_xmu()
1238{
1239 test_header Xmu
1240 cat > $ODIR.tmp_src.cc << EOF
1241#include <cstdio>
1242#include <X11/Xatom.h>
1243#include <X11/Xlib.h>
1244#include <X11/Xutil.h>
1245#include <X11/Xmu/StdCmap.h>
1246extern "C" int main(void)
1247{
1248 Display *dpy;
1249 int scrn_num;
1250 Screen *scrn;
1251
1252 dpy = XOpenDisplay(NULL);
1253 if (dpy)
1254 {
1255 scrn_num = DefaultScreen(dpy);
1256 scrn = ScreenOfDisplay(dpy, scrn_num);
1257 Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
1258 24, XA_RGB_DEFAULT_MAP, False, True);
1259 printf("Status = %x\n", status);
1260 }
1261 return 0;
1262}
1263EOF
1264 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1265 if test_compile "$LIBX11 $LIBXMU $I_INCX11" Xmu Xmu; then
1266 log_success "found"
1267 cnf_append "VBOX_XMU_LIBS" "`strip_l "$LIBXMU"`"
1268 fi
1269}
1270
1271
1272#
1273# Check for Mesa, needed by OpenGL
1274#
1275check_mesa()
1276{
1277 test_header "Mesa / GLU"
1278 cat > $ODIR.tmp_src.cc << EOF
1279#include <cstdio>
1280#include <X11/Xlib.h>
1281#include <GL/glx.h>
1282#include <GL/glu.h>
1283extern "C" int main(void)
1284{
1285 Display *dpy;
1286 int major, minor;
1287
1288 dpy = XOpenDisplay(NULL);
1289 if (dpy)
1290 {
1291 if (glXQueryVersion(dpy, &major, &minor))
1292 {
1293 printf("found version %u.%u, OK.\n", major, minor);
1294 return 0;
1295 }
1296 }
1297 printf("found (inactive), OK.\n");
1298 return 0;
1299}
1300EOF
1301 [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1302 if test_compile "$LIBX11 $MESA $I_INCX11" Mesa Mesa; then
1303 test_execute
1304 fi
1305}
1306
1307
1308#
1309# Check for the Qt4 library, needed by the VirtualBox frontend
1310#
1311# Currently not fatal.
1312#
1313check_qt4()
1314{
1315 foundqt4=
1316 test_header Qt4
1317 if [ "$OS" = "darwin" ]; then
1318 if [ -f "/System/Library/Frameworks/QtCore.framework/QtCore" ]; then
1319 PATH_SDK_QT4="/System/Library/Framework/QtCore.framework"
1320 elif [ -f "/Library/Frameworks/QtCore.framework/QtCore" ]; then
1321 PATH_SDK_QT4="/Library/Frameworks/QtCore.framework"
1322 fi
1323 if [ -n "$PATH_SDK_QT4" ]; then
1324 foundqt4=1
1325 INCQT4="$PATH_SDK_QT4/Headers"
1326 LIBQT4=
1327 FLGQT4="-framework QtCore"
1328 else
1329 log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
1330 fail
1331 fi
1332 else
1333 if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1334 # default is to use pkg-config
1335 if which_wrapper pkg-config > /dev/null; then
1336 # this braindead path is necessary for mdv2008.1
1337 qt4_ver=`\
1338 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1339 pkg-config QtCore --modversion 2>> $LOG`
1340 if [ $? -ne 0 ]; then
1341 log_failure "not found"
1342 fail
1343 else
1344 FLGQT4=`\
1345 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1346 pkg-config QtCore --cflags`
1347 INCQT4=`strip_I "$FLGQT4"`
1348 LIBQT4=`\
1349 PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1350 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1351 pkg-config QtCore --libs`
1352 foundqt4=1
1353 fi
1354 else
1355 log_failure "pkg-config not found"
1356 fail
1357 fi
1358 else
1359 # do it the old way (e.g. user has specified QT4DIR)
1360 cat > $ODIR.tmp_src.cc << EOF
1361#include <cstdio>
1362#include <QtGlobal>
1363extern "C" int main(void)
1364{
1365 printf("found version %s", QT_VERSION_STR);
1366#if QT_VERSION >= 0x040300
1367 printf(", OK.\n");
1368 return 0;
1369#else
1370 printf(", expected version 4.3.0 or higher\n");
1371 return 1;
1372#endif
1373}
1374EOF
1375 for q in $QT4DIR; do
1376 INCQT4="$q/include $q/include/QtCore"
1377 FLGQT4="-DQT_SHARED"
1378 I_INCQT4=`prefix_I "$INCQT4"`
1379 LIBQT4="-L$q/lib -lQtCoreVBox"
1380 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1381 foundqt4=2
1382 break;
1383 fi
1384 LIBQT4="-L$q/lib -lQtCore"
1385 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1386 foundqt4=1
1387 break;
1388 fi
1389 done
1390 fi
1391 fi
1392 if [ -n "$foundqt4" ]; then
1393 cat > $ODIR.tmp_src.cc << EOF
1394#include <cstdio>
1395#include <QtGlobal>
1396extern "C" int main(void)
1397{
1398 printf("found version %s", QT_VERSION_STR);
1399#if QT_VERSION >= 0x040300
1400 printf(", OK.\n");
1401 return 0;
1402#else
1403 printf(", expected version 4.3.0 or higher\n");
1404 return 1;
1405#endif
1406}
1407EOF
1408 [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1409 if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1410 if test_execute_path "`strip_L "$LIBQT4"`"; then
1411 if [ "$OS" != "darwin" ]; then
1412 # strip .../QtCore as we add components ourself
1413 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1414 # store only the first path, remove all other pathes
1415 # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1416 INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1417 cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1418 cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1419 cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1420 # this is not quite right since the qt libpath does not have to be first...
1421 cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1422 if [ "$foundqt4" = "2" ]; then
1423 cnf_append "VBOX_WITH_QT4_SUN" "1"
1424 fi
1425 test_header "Qt4 devtools"
1426 for q in $QT4DIR; do
1427 # first try it with a suffix, some platforms use that
1428 if which_wrapper "$q/bin/moc-qt4" > /dev/null; then
1429 moc_ver=`$q/bin/moc-qt4 -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1430 if [ $? -ne 0 ]; then
1431 log_failure "not found"
1432 fail
1433 else
1434 log_success "found version $moc_ver"
1435 cnf_append "VBOX_PATH_QT4" "$q"
1436 cnf_append "PATH_SDK_QT4" "$q"
1437 cnf_append "PATH_TOOL_QT4" "$q"
1438 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1439 cnf_append "TOOL_QT4_BIN_SUFF" "-qt4"
1440 return
1441 fi
1442 elif which_wrapper "$q/bin/moc" > /dev/null; then
1443 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1444 if [ $? -ne 0 ]; then
1445 log_failure "not found"
1446 fail
1447 else
1448 log_success "found version $moc_ver"
1449 cnf_append "VBOX_PATH_QT4" "$q"
1450 cnf_append "PATH_SDK_QT4" "$q"
1451 cnf_append "PATH_TOOL_QT4" "$q"
1452 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1453 return
1454 fi
1455 fi
1456 done
1457 fi
1458 fi
1459 else
1460 log_failure "not found"
1461 fail
1462 fi
1463 else
1464 log_failure "not found"
1465 fail
1466 fi
1467}
1468
1469
1470#
1471# Check whether static libstdc++ is installed. This library is required
1472# for the Linux guest additions.
1473#
1474check_staticlibstdcxx()
1475{
1476 test_header "static stc++ library"
1477 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1478 cat > $ODIR.tmp_src.cc << EOF
1479#include <string>
1480
1481extern "C" int main(void)
1482{
1483 std::string s = "test";
1484 return 0;
1485}
1486EOF
1487 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1488 log_success "found"
1489 fi
1490}
1491
1492
1493#
1494# Check for Linux sources
1495#
1496check_linux()
1497{
1498 test_header "Linux kernel sources"
1499 cat > $ODIR.tmp_src.c << EOF
1500#include <linux/version.h>
1501int printf(const char *format, ...);
1502int main(void)
1503{
1504 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1505 (LINUX_VERSION_CODE % 65536) / 256,
1506 LINUX_VERSION_CODE % 256);
1507#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1508 printf(", OK.\n");
1509 return 0;
1510#else
1511 printf(", expected version 2.4.0 or higher\n");
1512 return 1;
1513#endif
1514}
1515EOF
1516 echo "compiling the following source file:" >> $LOG
1517 cat $ODIR.tmp_src.c >> $LOG
1518 echo "using the following command line:" >> $LOG
1519 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1520 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1521 if [ $? -ne 0 ]; then
1522 echo
1523 echo " Linux kernel headers not found at $LINUX"
1524 echo " Check the file $LOG for detailed error information."
1525 fail
1526 else
1527 if test_execute; then
1528 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1529 fi
1530 fi
1531}
1532
1533
1534#
1535# Check for kchmviewer, needed to display the online help
1536# (unused as we ship kchmviewer)
1537#
1538check_kchmviewer()
1539{
1540 test_header kchmviewer
1541 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1542 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1543 if [ $? -ne 0 ]; then
1544 log_failure "not found"
1545 fail
1546 else
1547 log_success "found version $kchmviewer_ver"
1548 fi
1549 fi
1550}
1551
1552
1553#
1554# Check for the kBuild tools, we don't support GNU make
1555#
1556check_kbuild()
1557{
1558 test_header kBuild
1559 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1560 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1561 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1562 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1563 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1564 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1565 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1566 if [ "$OS" = "solaris" ]; then
1567 # Because of sh being non-default shell in Solaris we need to export PATH again when
1568 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1569 echo "PATH=\"$ORGPATH\"" >> $ENV
1570 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1571 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1572 else
1573 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1574 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1575 fi
1576 echo "export PATH" >> $ENV
1577 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1578 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1579 elif check_avail "kmk" KBUILDDIR really; then
1580 # check for installed kBuild
1581 KBUILD_SED="`which_wrapper kmk_sed`"
1582 else
1583 fail
1584 fi
1585 log_success "found"
1586}
1587
1588
1589#
1590# Check for compiler.h
1591# Some Linux distributions include "compiler.h" in their libc linux
1592# headers package, some don't. Most don't need it, building might (!)
1593# not succeed on openSUSE without it.
1594#
1595# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1596#
1597check_compiler_h()
1598{
1599 test_header compiler.h
1600 if ! test -f "/usr/include/linux/compiler.h"; then
1601 log_success "compiler.h not found"
1602 else
1603 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1604 log_success "compiler.h found"
1605 fi
1606}
1607
1608#
1609# Check for libcap.
1610# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1611# sockets for doing ICMP requests.
1612#
1613check_libcap()
1614{
1615 test_header "libcap library"
1616 cat > $ODIR.tmp_src.cc << EOF
1617#include <cstdio>
1618#include <sys/types.h>
1619#include <sys/capability.h>
1620
1621extern "C" int main(void)
1622{
1623 char buf[1024];
1624 cap_t caps = cap_get_proc();
1625 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1626 return 0;
1627}
1628EOF
1629 if test_compile $LIBCAP libcap libcap; then
1630 if test_execute; then
1631 log_success "found"
1632 fi
1633 fi
1634}
1635
1636#
1637# Check if we are able to build 32-bit applications (needed for the guest additions)
1638#
1639check_32bit()
1640{
1641 test_header "32-bit support"
1642 cat > $ODIR.tmp_src.c << EOF
1643#include <stdint.h>
1644int main(void)
1645{
1646 return 0;
1647}
1648EOF
1649 echo "compiling the following source file:" >> $LOG
1650 cat $ODIR.tmp_src.c >> $LOG
1651 echo "using the following command line:" >> $LOG
1652 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1653 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1654 if [ $? -ne 0 ]; then
1655 echo
1656 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1657 echo " Check the file $LOG for detailed error information."
1658 fail
1659 fi
1660 log_success ""
1661}
1662
1663
1664#
1665# Check for Python
1666#
1667check_python()
1668{
1669 test_header "python support"
1670 cat > $ODIR.tmp_src.cc << EOF
1671#include <cstdio>
1672#include <Python.h>
1673extern "C" int main(void)
1674{
1675 Py_Initialize();
1676 printf("found version %s", PY_VERSION);
1677#if PY_VERSION_HEX >= 0x02030000
1678 printf(", OK.\n");
1679 return 0;
1680#else
1681 printf(", expected version 2.3 or higher\n");
1682 return 1;
1683#endif
1684}
1685EOF
1686 found=
1687# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1688 if [ "$OS" != "solaris" ]; then
1689 SUPPYTHONLIBS="python2.6 python2.5 python2.4 python2.3"
1690 else
1691 SUPPYTHONLIBS="python2.4"
1692 fi
1693 for p in $PYTHONDIR; do
1694 for d in $SUPPYTHONLIBS; do
1695 for b in lib64 lib/64 lib; do
1696 echo "compiling the following source file:" >> $LOG
1697 cat $ODIR.tmp_src.cc >> $LOG
1698 echo "using the following command line:" >> $LOG
1699 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1700 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1701 if [ $? -eq 0 ]; then
1702 found=1
1703 break
1704 fi
1705 done
1706 if [ -n "$found" ]; then break; fi
1707 done
1708 if [ -n "$found" ]; then break; fi
1709 done
1710 if [ -n "$found" ]; then
1711 if test_execute; then
1712 cnf_append "VBOX_WITH_PYTHON" "1"
1713 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1714 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1715 else
1716 log_failure "not found"
1717 fail
1718 fi
1719 else
1720 log_failure "not found"
1721 fail
1722 fi
1723}
1724
1725
1726#
1727# Setup wine
1728#
1729setup_wine()
1730{
1731 test_header "Wine support"
1732 if ! which_wrapper wine > /dev/null; then
1733 echo " wine binary not found"
1734 fail
1735 fi
1736 if ! which_wrapper wineprefixcreate > /dev/null; then
1737 echo " wineprefixcreate not found"
1738 fail
1739 fi
1740 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1741 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1742 rm -rf $WINEPREFIX
1743 mkdir -p $WINEPREFIX
1744 touch $WINEPREFIX/.no_prelaunch_window_flag
1745 if ! wineprefixcreate -q > /dev/null 2>&1; then
1746 echo " wineprefixcreate failed"
1747 fail
1748 fi
1749 tmp=.tmp.wine.reg
1750 rm -f $tmp
1751 echo 'REGEDIT4' > $tmp
1752 echo '' >> $tmp
1753 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1754 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
1755 echo '' >> $tmp
1756 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1757 echo '"itss"="native"' >> $tmp
1758 echo '' >> $tmp
1759 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1760 echo '"itss"="native"' >> $tmp
1761 echo '' >> $tmp
1762 if ! wine regedit $tmp > /dev/null 2>&1; then
1763 rm -f $tmp
1764 echo " failed to load registry changes (path)."
1765 fail
1766 fi
1767 rm -f $tmp
1768 log_success "found"
1769}
1770
1771#
1772# Check for gSOAP.
1773#
1774check_gsoap()
1775{
1776 test_header "GSOAP compiler"
1777 if [ -z "$GSOAP" ]; then
1778 GSOAP="/usr"
1779 fi
1780 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1781 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1782 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1783 # TODO: Check for libgsoap++.a/so
1784
1785 if [ -z "$GSOAP_IMPORT" ]; then
1786 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1787 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1788 GSOAP_IMPORT="$GSOAP/include/gsoap"
1789 fi
1790 fi
1791 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1792 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1793 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1794 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1795 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
1796 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
1797 else
1798 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1799 fi
1800 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoap++"
1801 log_success "found"
1802 else
1803 log_failure "stlvector.h not found -- disabling webservice"
1804 cnf_append "VBOX_WITH_WEBSERVICES" ""
1805 fi
1806 else
1807 log_failure "stdsoap2.h not found -- disabling webservice"
1808 cnf_append "VBOX_WITH_WEBSERVICES" ""
1809 fi
1810 else
1811 log_failure "wsdl2h not found -- disabling webservice"
1812 cnf_append "VBOX_WITH_WEBSERVICES" ""
1813 fi
1814 else
1815 log_failure "soapcpp2 not found -- disabling webservice"
1816 cnf_append "VBOX_WITH_WEBSERVICES" ""
1817 fi
1818}
1819
1820
1821#
1822# Determines the Darwin version.
1823# @todo This should really check the Xcode/SDK version.
1824#
1825check_darwinversion()
1826{
1827 test_header "Darwin version"
1828 darwin_ver=`uname -r`
1829 case "$darwin_ver" in
1830 9\.*)
1831 darwin_ver="10.5"
1832 #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
1833 ;;
1834 8\.*)
1835 darwin_ver="10.4"
1836 ;;
1837 *)
1838 echo " failed to determin darwin version. (uname -r: $darwin_ver)"
1839 fail
1840 darwin_ver="unknown"
1841 ;;
1842 esac
1843 log_success "found version $darwin_ver"
1844}
1845
1846
1847#
1848# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1849# is around to prevent confusion when the build fails in src/recompiler.
1850# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1851#
1852check_i386elfgcc()
1853{
1854 test_header "i386-elf-gcc"
1855 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1856 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1857 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1858 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1859 if test -z "$i386_elf_gcc"; then
1860 echo " failed to find i386-elf-gcc"
1861 fail
1862 fi
1863 log_success "found $i386_elf_gcc"
1864}
1865
1866
1867#
1868# Show help
1869#
1870show_help()
1871{
1872 cat << EOF
1873Usage: ./configure [OPTIONS]...
1874
1875Configuration:
1876 -h, --help display this help and exit
1877 --nofatal don't abort on errors
1878 --disable-xpcom disable XPCOM and related stuff
1879 --disable-python disable python bindings
1880 --disable-sdl-ttf disable SDL_ttf detection
1881 --disable-alsa disable the ALSA sound backend
1882 --disable-pulse disable the PulseAudio backend
1883 --disable-dbus don't use DBus and hal for hardware detection
1884 --disable-kmods don't build Linux kernel modules (host and guest)
1885 --disable-hardening don't be strict about /dev/vboxdrv access
1886 --disable-opengl disable OpenGL support
1887 --enable-webservice enable the webservice stuff
1888 --build-libxml2 build libxml2 from sources
1889 --build-libxslt build libxslt from sources
1890 --setup-wine setup a Wine directory and register the hhc hack
1891
1892Paths:
1893 --with-gcc=PATH location of the gcc compiler [$CC]
1894 --with-g++=PATH location of the g++ compiler [$CXX]
1895 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1896 --with-iasl=PATH location of the iasl compiler [$IASL]
1897 --with-linux=DIR Linux kernel source directory [$LINUX]
1898 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1899 --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
1900 --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries
1901 (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)
1902 --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)
1903 --out-path=PATH the folder to which configuration and build output
1904 should go
1905
1906Build type:
1907 -d, --build-debug build with debugging symbols and assertions
1908 --build-profile build with profiling support
1909 --build-headless build headless (without any X11 frontend)
1910EOF
1911 exit 0
1912}
1913
1914
1915#
1916# The body.
1917#
1918
1919# scan command line options
1920for option in $*; do
1921 case "$option" in
1922 --help|-help|-h)
1923 show_help
1924 ;;
1925 --nofatal)
1926 nofatal=1
1927 ;;
1928 --env-only)
1929 ENV_ONLY=1
1930 ;;
1931 --with-gcc=*)
1932 CC=`echo $option | cut -d'=' -f2`
1933 ;;
1934 --with-g++=*)
1935 CXX=`echo $option | cut -d'=' -f2`
1936 ;;
1937 --with-kbuild=*)
1938 KBUILDDIR=`echo $option | cut -d'=' -f2`
1939 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1940 echo "Error: KBUILDDIR contains invalid characters!"
1941 exit 1
1942 fi
1943 ;;
1944 --with-qt-dir=*|--with-qt4-dir=*)
1945 QT4DIR=`echo $option | cut -d'=' -f2`
1946 QT4DIR_PKGCONFIG=0
1947 ;;
1948 --with-gsoap-dir=*)
1949 GSOAP=`echo $option | cut -d'=' -f2`
1950 ;;
1951 --with-gsoap-import=*)
1952 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
1953 ;;
1954 --with-iasl=*)
1955 IASL=`echo $option | cut -d'=' -f2`
1956 ;;
1957 --with-linux=*)
1958 LINUX=`echo $option | cut -d'=' -f2`
1959 ;;
1960 --with-mkisofs=*)
1961 MKISOFS=`echo $option | cut -d'=' -f2`
1962 ;;
1963 --disable-xpcom)
1964 WITH_XPCOM=0
1965 ;;
1966 --disable-python)
1967 WITH_PYTHON=0
1968 ;;
1969 --disable-sdl-ttf)
1970 WITH_SDL_TTF=0
1971 ;;
1972 --disable-qt)
1973 WITH_QT4=0
1974 ;;
1975 --disable-qt4)
1976 WITH_QT4=0
1977 ;;
1978 --disable-alsa)
1979 WITH_ALSA=0
1980 ;;
1981 --disable-pulse)
1982 WITH_PULSE=0
1983 ;;
1984 --disable-dbus)
1985 WITH_DBUS=0
1986 ;;
1987 --disable-kmods)
1988 WITH_KMODS=0
1989 ;;
1990 --disable-opengl)
1991 WITH_OPENGL=0
1992 ;;
1993 --disable-hardening)
1994 WITH_HARDENING=0
1995 ;;
1996 --enable-hardening)
1997 WITH_HARDENING=2
1998 ;;
1999 --enable-webservice)
2000 WITH_GSOAP=1
2001 ;;
2002 --build-debug|-d)
2003 BUILD_TYPE=debug
2004 ;;
2005 --build-profile)
2006 BUILD_TYPE=profile
2007 ;;
2008 --build-libxml2)
2009 BUILD_LIBXML2=1
2010 ;;
2011 --build-libxslt)
2012 BUILD_LIBXSLT=1
2013 ;;
2014 --build-headless)
2015 HEADLESS=1
2016 WITH_SDL=0
2017 WITH_SDL_TTF=0
2018 WITH_X11=0
2019 WITH_OPENGL=0
2020 WITH_QT4=0
2021 ;;
2022 --ose)
2023 OSE=2
2024 ;;
2025 --odir=*)
2026 ODIR="`echo $option | cut -d'=' -f2`/"
2027 ODIR_OVERRIDE=1
2028 ;;
2029 --out-path=*)
2030 out_path="`echo $option | cut -d'=' -f2`/"
2031 if [ -d $out_path ]; then
2032 saved_path="`pwd`"
2033 cd $out_path
2034 OUT_PATH="`pwd`"
2035 cd $saved_path
2036 OUT_PATH_OVERRIDE=1
2037 if [ $ODIR_OVERRIDE -eq 0 ]; then
2038 # This variable has not *yet* been overridden. That can still happen.
2039 ODIR=$OUT_PATH/
2040 fi
2041 else
2042 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2043 exit 1
2044 fi
2045 ;;
2046 --setup-wine)
2047 SETUP_WINE=1
2048 ;;
2049 *)
2050 echo
2051 echo "Unrecognized option \"$option\""
2052 echo
2053 show_help
2054 ;;
2055 esac
2056done
2057
2058LOG="$ODIR$LOG"
2059ENV="$ODIR$ENV"
2060CNF="$ODIR$CNF"
2061
2062# initialize output files
2063cat > $LOG << EOF
2064# Log file generated by
2065#
2066# '$0 $*'
2067#
2068
2069EOF
2070cat > $CNF << EOF
2071# -*- Makefile -*-
2072#
2073# automatically generated by
2074#
2075# '$0 $*'
2076#
2077# It will be completely overwritten if configure is executed again.
2078#
2079
2080EOF
2081cat > $ENV << EOF
2082#!/bin/bash
2083#
2084# automatically generated by
2085#
2086# '$0 $*'
2087#
2088# It will be completely overwritten if configure is executed again.
2089# Make sure you source this file once before you start to build VBox.
2090#
2091
2092EOF
2093
2094# test if we are OSE
2095if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
2096 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
2097 echo >> $LOG
2098 OSE=0
2099fi
2100
2101if [ "$BUILD_TYPE" = "debug" ]; then
2102 echo "Creating DEBUG build!" >> $LOG
2103elif [ "$BUILD_TYPE" = "profile" ]; then
2104 echo "Creating PROFILE build!" >> $LOG
2105fi
2106
2107# first determine our environment
2108check_environment
2109check_kbuild
2110
2111[ -n "$ENV_ONLY" ] && exit 0
2112
2113# append the tools directory to the default search path
2114echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2115export PATH
2116
2117# if we will be writing to a different out directory then set this up now
2118if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2119 echo "export AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2120 echo "export LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2121 echo "export PATH_OUT_BASE=$OUT_PATH" >> $ENV
2122fi
2123
2124# some things are not available in for OSE
2125if [ $OSE -ge 1 ]; then
2126 cnf_append "VBOX_OSE" "1"
2127 cnf_append "VBOX_WITH_TESTSUITE" ""
2128 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2129
2130 if [ "$OS" = "linux" ]; then
2131 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2132 else
2133 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2134 fi
2135 echo >> $CNF
2136fi
2137
2138# headless
2139if [ -n "$HEADLESS" ]; then
2140 cnf_append "VBOX_HEADLESS" "1"
2141fi
2142
2143if [ $WITH_OPENGL -eq 0 ]; then
2144 cnf_append "VBOX_WITH_CROGL" ""
2145fi
2146
2147if [ "$OS" = "darwin" ]; then
2148 BUILD_LIBXSLT=1
2149 BUILD_LIBXML2=1
2150fi
2151
2152# emit disable directives corresponding to any --disable-xxx options.
2153[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2154[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2155[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2156[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2157[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2158
2159# the tools
2160check_gcc
2161[ "$OS" != "darwin" ] && check_as86
2162[ "$OS" != "darwin" ] && check_bcc
2163[ "$OS" != "darwin" ] && check_iasl
2164# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2165# [ "$OS" != "darwin" ] && check_yasm
2166[ "$OS" != "darwin" ] && check_xsltproc
2167[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
2168
2169# the libraries
2170[ "$OS" != "darwin" ] && check_pthread
2171[ $WITH_XPCOM -eq 1 ] && check_libxml2
2172[ $WITH_XPCOM -eq 1 ] && check_libxslt
2173[ $WITH_LIBIDL -eq 1 ] && check_libidl
2174# build openssl on Darwin in every case
2175[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
2176[ "$OS" != "darwin" ] && check_z
2177[ "$OS" != "darwin" -a "$OS" != "freebsd" ] && check_png
2178[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_curl
2179[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2180[ $WITH_SDL -eq 1 ] && check_sdl
2181[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2182[ $WITH_X11 -eq 1 ] && check_x
2183# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2184# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2185[ $WITH_X11 -eq 1 ] && check_xcursor
2186[ $WITH_OPENGL -eq 1 ] && check_xmu
2187[ "$OS" != "darwin" -a $WITH_OPENGL -eq 1 ] && check_mesa
2188[ $WITH_QT4 -eq 1 ] && check_qt4
2189[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
2190
2191# Linux-specific
2192if [ "$OS" = "linux" ]; then
2193 # don't check for the static libstdc++ in the PUEL version as we build the
2194 # additions at a dedicated box
2195 [ $OSE -ge 1 ] && check_staticlibstdcxx
2196 if [ $WITH_KMODS -eq 1 ]; then
2197 check_linux
2198 else
2199 cnf_append "VBOX_LINUX_SRC" ""
2200 cnf_append "VBOX_WITH_VBOXDRV" ""
2201 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2202 fi
2203 if [ $WITH_ALSA -eq 1 ]; then
2204 check_alsa
2205 else
2206 cnf_append "VBOX_WITH_ALSA" ""
2207 fi
2208 if [ $WITH_PULSE -eq 1 ]; then
2209 check_pulse
2210 else
2211 cnf_append "VBOX_WITH_PULSE" ""
2212 fi
2213 if [ $WITH_DBUS -eq 0 ]; then
2214 cnf_append "VBOX_WITH_DBUS" ""
2215 fi
2216 check_libcap
2217 check_compiler_h
2218 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
2219fi
2220
2221[ -n "$SETUP_WINE" ] && setup_wine
2222
2223if [ $OSE -ge 1 ]; then
2224 if [ $WITH_GSOAP -eq 1 ]; then
2225 check_gsoap
2226 else
2227 cnf_append "VBOX_WITH_WEBSERVICES" ""
2228 fi
2229fi
2230
2231# Darwin-specific
2232if [ "$OS" = "darwin" ]; then
2233 check_darwinversion
2234 check_i386elfgcc
2235fi
2236
2237# success!
2238echo
2239echo "Successfully generated '$CNF' and '$ENV'."
2240echo "Source '$ENV' once before you start to build VBox:"
2241echo ""
2242echo " source $ENV"
2243echo " kmk"
2244echo ""
2245if [ "$OS" = "linux" ]; then
2246 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2247 vbox_out_path=$OUT_PATH
2248 else
2249 vbox_out_path=./out
2250 fi
2251 echo "To compile the kernel modules, do:"
2252 echo ""
2253 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2254 echo " make"
2255 echo ""
2256fi
2257if [ $WITH_HARDENING -gt 0 ]; then
2258 echo ""
2259 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2260 echo " Hardening is enabled which means that the VBox binaries will not run from"
2261 echo " the binary directory. The binaries have to be installed suid root and some"
2262 echo " more prerequisites have to be fulfilled which is normally done by installing"
2263 echo " the final package. For development, the hardening feature can be disabled"
2264 echo " by specifying the --disable-hardening parameter. Please never disable that"
2265 echo " feature for the final distribution!"
2266 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2267 echo ""
2268else
2269 echo ""
2270 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2271 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2272 echo " disabled hardening!"
2273 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2274 echo ""
2275fi
2276echo "Enjoy!"
2277cleanup
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