VirtualBox

source: vbox/trunk/configure@ 19356

Last change on this file since 19356 was 19356, checked in by vboxsync, 16 years ago

more for integration of libcurl

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 57.2 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 LIBCURL_VERSION_MAJOR >= 7 && LIBCURL_VERSION_MINOR >= 19
941 printf(", OK.\n");
942 return 0;
943#else
944 printf(", expected version 7.19.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 if which_wrapper "$q/bin/moc" > /dev/null; then
1428 moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1429 if [ $? -ne 0 ]; then
1430 log_failure "not found"
1431 fail
1432 else
1433 log_success "found version $moc_ver"
1434 cnf_append "VBOX_PATH_QT4" "$q"
1435 cnf_append "PATH_SDK_QT4" "$q"
1436 cnf_append "PATH_TOOL_QT4" "$q"
1437 cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1438 return
1439 fi
1440 fi
1441 done
1442 fi
1443 fi
1444 else
1445 log_failure "not found"
1446 fail
1447 fi
1448 else
1449 log_failure "not found"
1450 fail
1451 fi
1452}
1453
1454
1455#
1456# Check whether static libstdc++ is installed. This library is required
1457# for the Linux guest additions.
1458#
1459check_staticlibstdcxx()
1460{
1461 test_header "static stc++ library"
1462 libstdcxx=`$CXX -print-file-name=libstdc++.a`
1463 cat > $ODIR.tmp_src.cc << EOF
1464#include <string>
1465
1466extern "C" int main(void)
1467{
1468 std::string s = "test";
1469 return 0;
1470}
1471EOF
1472 if test_compile "$libstdcxx" libstdc++ libstdc++; then
1473 log_success "found"
1474 fi
1475}
1476
1477
1478#
1479# Check for Linux sources
1480#
1481check_linux()
1482{
1483 test_header "Linux kernel sources"
1484 cat > $ODIR.tmp_src.c << EOF
1485#include <linux/version.h>
1486int printf(const char *format, ...);
1487int main(void)
1488{
1489 printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1490 (LINUX_VERSION_CODE % 65536) / 256,
1491 LINUX_VERSION_CODE % 256);
1492#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1493 printf(", OK.\n");
1494 return 0;
1495#else
1496 printf(", expected version 2.4.0 or higher\n");
1497 return 1;
1498#endif
1499}
1500EOF
1501 echo "compiling the following source file:" >> $LOG
1502 cat $ODIR.tmp_src.c >> $LOG
1503 echo "using the following command line:" >> $LOG
1504 echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1505 $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1506 if [ $? -ne 0 ]; then
1507 echo
1508 echo " Linux kernel headers not found at $LINUX"
1509 echo " Check the file $LOG for detailed error information."
1510 fail
1511 else
1512 if test_execute; then
1513 cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1514 fi
1515 fi
1516}
1517
1518
1519#
1520# Check for kchmviewer, needed to display the online help
1521# (unused as we ship kchmviewer)
1522#
1523check_kchmviewer()
1524{
1525 test_header kchmviewer
1526 if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1527 kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1528 if [ $? -ne 0 ]; then
1529 log_failure "not found"
1530 fail
1531 else
1532 log_success "found version $kchmviewer_ver"
1533 fi
1534 fi
1535}
1536
1537
1538#
1539# Check for the kBuild tools, we don't support GNU make
1540#
1541check_kbuild()
1542{
1543 test_header kBuild
1544 if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1545 KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1546 echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1547 echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1548 echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1549 echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1550 echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1551 if [ "$OS" = "solaris" ]; then
1552 # Because of sh being non-default shell in Solaris we need to export PATH again when
1553 # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1554 echo "PATH=\"$ORGPATH\"" >> $ENV
1555 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1556 echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1557 else
1558 echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1559 echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1560 fi
1561 echo "export PATH" >> $ENV
1562 echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1563 KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1564 elif check_avail "kmk" KBUILDDIR really; then
1565 # check for installed kBuild
1566 KBUILD_SED="`which_wrapper kmk_sed`"
1567 else
1568 fail
1569 fi
1570 log_success "found"
1571}
1572
1573
1574#
1575# Check for compiler.h
1576# Some Linux distributions include "compiler.h" in their libc linux
1577# headers package, some don't. Most don't need it, building might (!)
1578# not succeed on openSUSE without it.
1579#
1580# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1581#
1582check_compiler_h()
1583{
1584 test_header compiler.h
1585 if ! test -f "/usr/include/linux/compiler.h"; then
1586 log_success "compiler.h not found"
1587 else
1588 cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
1589 log_success "compiler.h found"
1590 fi
1591}
1592
1593#
1594# Check for libcap.
1595# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1596# sockets for doing ICMP requests.
1597#
1598check_libcap()
1599{
1600 test_header "libcap library"
1601 cat > $ODIR.tmp_src.cc << EOF
1602#include <cstdio>
1603#include <sys/types.h>
1604#include <sys/capability.h>
1605
1606extern "C" int main(void)
1607{
1608 char buf[1024];
1609 cap_t caps = cap_get_proc();
1610 snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1611 return 0;
1612}
1613EOF
1614 if test_compile $LIBCAP libcap libcap; then
1615 if test_execute; then
1616 log_success "found"
1617 fi
1618 fi
1619}
1620
1621#
1622# Check if we are able to build 32-bit applications (needed for the guest additions)
1623#
1624check_32bit()
1625{
1626 test_header "32-bit support"
1627 cat > $ODIR.tmp_src.c << EOF
1628#include <stdint.h>
1629int main(void)
1630{
1631 return 0;
1632}
1633EOF
1634 echo "compiling the following source file:" >> $LOG
1635 cat $ODIR.tmp_src.c >> $LOG
1636 echo "using the following command line:" >> $LOG
1637 echo "$CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c" >> $LOG
1638 $CC -m32 -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c >> $LOG 2>&1
1639 if [ $? -ne 0 ]; then
1640 echo
1641 echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1642 echo " Check the file $LOG for detailed error information."
1643 fail
1644 fi
1645 log_success ""
1646}
1647
1648
1649#
1650# Check for Python
1651#
1652check_python()
1653{
1654 test_header "python support"
1655 cat > $ODIR.tmp_src.cc << EOF
1656#include <cstdio>
1657#include <Python.h>
1658extern "C" int main(void)
1659{
1660 Py_Initialize();
1661 printf("found version %s", PY_VERSION);
1662#if PY_VERSION_HEX >= 0x02030000
1663 printf(", OK.\n");
1664 return 0;
1665#else
1666 printf(", expected version 2.3 or higher\n");
1667 return 1;
1668#endif
1669}
1670EOF
1671 found=
1672# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
1673 if [ "$OS" != "solaris" ]; then
1674 SUPPYTHONLIBS="python2.6 python2.5 python2.4 python2.3"
1675 else
1676 SUPPYTHONLIBS="python2.4"
1677 fi
1678 for p in $PYTHONDIR; do
1679 for d in $SUPPYTHONLIBS; do
1680 for b in lib64 lib/64 lib; do
1681 echo "compiling the following source file:" >> $LOG
1682 cat $ODIR.tmp_src.cc >> $LOG
1683 echo "using the following command line:" >> $LOG
1684 echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1685 $CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1686 if [ $? -eq 0 ]; then
1687 found=1
1688 break
1689 fi
1690 done
1691 if [ -n "$found" ]; then break; fi
1692 done
1693 if [ -n "$found" ]; then break; fi
1694 done
1695 if [ -n "$found" ]; then
1696 if test_execute; then
1697 cnf_append "VBOX_WITH_PYTHON" "1"
1698 cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1699 cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1700 else
1701 log_failure "not found"
1702 fail
1703 fi
1704 else
1705 log_failure "not found"
1706 fail
1707 fi
1708}
1709
1710
1711#
1712# Setup wine
1713#
1714setup_wine()
1715{
1716 test_header "Wine support"
1717 if ! which_wrapper wine > /dev/null; then
1718 echo " wine binary not found"
1719 fail
1720 fi
1721 if ! which_wrapper wineprefixcreate > /dev/null; then
1722 echo " wineprefixcreate not found"
1723 fail
1724 fi
1725 export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1726 echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1727 rm -rf $WINEPREFIX
1728 mkdir -p $WINEPREFIX
1729 touch $WINEPREFIX/.no_prelaunch_window_flag
1730 if ! wineprefixcreate -q > /dev/null 2>&1; then
1731 echo " wineprefixcreate failed"
1732 fail
1733 fi
1734 tmp=.tmp.wine.reg
1735 rm -f $tmp
1736 echo 'REGEDIT4' > $tmp
1737 echo '' >> $tmp
1738 echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1739 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
1740 echo '' >> $tmp
1741 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1742 echo '"itss"="native"' >> $tmp
1743 echo '' >> $tmp
1744 echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1745 echo '"itss"="native"' >> $tmp
1746 echo '' >> $tmp
1747 if ! wine regedit $tmp > /dev/null 2>&1; then
1748 rm -f $tmp
1749 echo " failed to load registry changes (path)."
1750 fail
1751 fi
1752 rm -f $tmp
1753 log_success "found"
1754}
1755
1756#
1757# Check for gSOAP.
1758#
1759check_gsoap()
1760{
1761 test_header "GSOAP compiler"
1762 if [ -z "$GSOAP" ]; then
1763 GSOAP="/usr"
1764 fi
1765 if which_wrapper "$GSOAP/bin/soapcpp2" > /dev/null; then
1766 if which_wrapper "$GSOAP/bin/wsdl2h" > /dev/null; then
1767 if [ -f "$GSOAP/include/stdsoap2.h" ]; then
1768 # TODO: Check for libgsoap++.a/so
1769
1770 if [ -z "$GSOAP_IMPORT" ]; then
1771 GSOAP_IMPORT="$GSOAP/share/gsoap/import"
1772 if [ ! -d "$GSOAP_IMPORT" -a -d "$GSOAP/include/gsoap" ]; then
1773 GSOAP_IMPORT="$GSOAP/include/gsoap"
1774 fi
1775 fi
1776 if [ -f "$GSOAP_IMPORT/stlvector.h" ]; then
1777 cnf_append "VBOX_GSOAP_INSTALLED" "1"
1778 cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
1779 cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
1780 if [ -f "$GSOAP/share/gsoap/stdsoap2.cpp" ]; then
1781 cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
1782 else
1783 cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
1784 fi
1785 cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoap++"
1786 log_success "found"
1787 else
1788 log_failure "stlvector.h not found -- disabling webservice"
1789 cnf_append "VBOX_WITH_WEBSERVICES" ""
1790 fi
1791 else
1792 log_failure "stdsoap2.h not found -- disabling webservice"
1793 cnf_append "VBOX_WITH_WEBSERVICES" ""
1794 fi
1795 else
1796 log_failure "wsdl2h not found -- disabling webservice"
1797 cnf_append "VBOX_WITH_WEBSERVICES" ""
1798 fi
1799 else
1800 log_failure "soapcpp2 not found -- disabling webservice"
1801 cnf_append "VBOX_WITH_WEBSERVICES" ""
1802 fi
1803}
1804
1805
1806#
1807# Determines the Darwin version.
1808# @todo This should really check the Xcode/SDK version.
1809#
1810check_darwinversion()
1811{
1812 test_header "Darwin version"
1813 darwin_ver=`uname -r`
1814 case "$darwin_ver" in
1815 9\.*)
1816 darwin_ver="10.5"
1817 #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
1818 ;;
1819 8\.*)
1820 darwin_ver="10.4"
1821 ;;
1822 *)
1823 echo " failed to determin darwin version. (uname -r: $darwin_ver)"
1824 fail
1825 darwin_ver="unknown"
1826 ;;
1827 esac
1828 log_success "found version $darwin_ver"
1829}
1830
1831
1832#
1833# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1834# is around to prevent confusion when the build fails in src/recompiler.
1835# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1836#
1837check_i386elfgcc()
1838{
1839 test_header "i386-elf-gcc"
1840 i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1841 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1842 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1843 test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1844 if test -z "$i386_elf_gcc"; then
1845 echo " failed to find i386-elf-gcc"
1846 fail
1847 fi
1848 log_success "found $i386_elf_gcc"
1849}
1850
1851
1852#
1853# Show help
1854#
1855show_help()
1856{
1857 cat << EOF
1858Usage: ./configure [OPTIONS]...
1859
1860Configuration:
1861 -h, --help display this help and exit
1862 --nofatal don't abort on errors
1863 --disable-xpcom disable XPCOM and related stuff
1864 --disable-python disable python bindings
1865 --disable-sdl-ttf disable SDL_ttf detection
1866 --disable-alsa disable the ALSA sound backend
1867 --disable-pulse disable the PulseAudio backend
1868 --disable-dbus don't use DBus and hal for hardware detection
1869 --disable-kmods don't build Linux kernel modules (host and guest)
1870 --disable-hardening don't be strict about /dev/vboxdrv access
1871 --disable-opengl disable OpenGL support
1872 --enable-webservice enable the webservice stuff
1873 --build-libxml2 build libxml2 from sources
1874 --build-libxslt build libxslt from sources
1875 --setup-wine setup a Wine directory and register the hhc hack
1876
1877Paths:
1878 --with-gcc=PATH location of the gcc compiler [$CC]
1879 --with-g++=PATH location of the g++ compiler [$CXX]
1880 --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1881 --with-iasl=PATH location of the iasl compiler [$IASL]
1882 --with-linux=DIR Linux kernel source directory [$LINUX]
1883 --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1884 --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
1885 --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries
1886 (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)
1887 --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)
1888 --out-path=PATH the folder to which configuration and build output
1889 should go
1890
1891Build type:
1892 -d, --build-debug build with debugging symbols and assertions
1893 --build-profile build with profiling support
1894 --build-headless build headless (without any X11 frontend)
1895EOF
1896 exit 0
1897}
1898
1899
1900#
1901# The body.
1902#
1903
1904# scan command line options
1905for option in $*; do
1906 case "$option" in
1907 --help|-help|-h)
1908 show_help
1909 ;;
1910 --nofatal)
1911 nofatal=1
1912 ;;
1913 --env-only)
1914 ENV_ONLY=1
1915 ;;
1916 --with-gcc=*)
1917 CC=`echo $option | cut -d'=' -f2`
1918 ;;
1919 --with-g++=*)
1920 CXX=`echo $option | cut -d'=' -f2`
1921 ;;
1922 --with-kbuild=*)
1923 KBUILDDIR=`echo $option | cut -d'=' -f2`
1924 if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1925 echo "Error: KBUILDDIR contains invalid characters!"
1926 exit 1
1927 fi
1928 ;;
1929 --with-qt-dir=*|--with-qt4-dir=*)
1930 QT4DIR=`echo $option | cut -d'=' -f2`
1931 QT4DIR_PKGCONFIG=0
1932 ;;
1933 --with-gsoap-dir=*)
1934 GSOAP=`echo $option | cut -d'=' -f2`
1935 ;;
1936 --with-gsoap-import=*)
1937 GSOAP_IMPORT=`echo $option | cut -d'=' -f2`
1938 ;;
1939 --with-iasl=*)
1940 IASL=`echo $option | cut -d'=' -f2`
1941 ;;
1942 --with-linux=*)
1943 LINUX=`echo $option | cut -d'=' -f2`
1944 ;;
1945 --with-mkisofs=*)
1946 MKISOFS=`echo $option | cut -d'=' -f2`
1947 ;;
1948 --disable-xpcom)
1949 WITH_XPCOM=0
1950 ;;
1951 --disable-python)
1952 WITH_PYTHON=0
1953 ;;
1954 --disable-sdl-ttf)
1955 WITH_SDL_TTF=0
1956 ;;
1957 --disable-qt)
1958 WITH_QT4=0
1959 ;;
1960 --disable-qt4)
1961 WITH_QT4=0
1962 ;;
1963 --disable-alsa)
1964 WITH_ALSA=0
1965 ;;
1966 --disable-pulse)
1967 WITH_PULSE=0
1968 ;;
1969 --disable-dbus)
1970 WITH_DBUS=0
1971 ;;
1972 --disable-kmods)
1973 WITH_KMODS=0
1974 ;;
1975 --disable-opengl)
1976 WITH_OPENGL=0
1977 ;;
1978 --disable-hardening)
1979 WITH_HARDENING=0
1980 ;;
1981 --enable-hardening)
1982 WITH_HARDENING=2
1983 ;;
1984 --enable-webservice)
1985 WITH_GSOAP=1
1986 ;;
1987 --build-debug|-d)
1988 BUILD_TYPE=debug
1989 ;;
1990 --build-profile)
1991 BUILD_TYPE=profile
1992 ;;
1993 --build-libxml2)
1994 BUILD_LIBXML2=1
1995 ;;
1996 --build-libxslt)
1997 BUILD_LIBXSLT=1
1998 ;;
1999 --build-headless)
2000 HEADLESS=1
2001 WITH_SDL=0
2002 WITH_SDL_TTF=0
2003 WITH_X11=0
2004 WITH_OPENGL=0
2005 WITH_QT4=0
2006 ;;
2007 --ose)
2008 OSE=2
2009 ;;
2010 --odir=*)
2011 ODIR="`echo $option | cut -d'=' -f2`/"
2012 ODIR_OVERRIDE=1
2013 ;;
2014 --out-path=*)
2015 out_path="`echo $option | cut -d'=' -f2`/"
2016 if [ -d $out_path ]; then
2017 saved_path="`pwd`"
2018 cd $out_path
2019 OUT_PATH="`pwd`"
2020 cd $saved_path
2021 OUT_PATH_OVERRIDE=1
2022 if [ $ODIR_OVERRIDE -eq 0 ]; then
2023 # This variable has not *yet* been overridden. That can still happen.
2024 ODIR=$OUT_PATH/
2025 fi
2026 else
2027 echo "Error: invalid folder \"$out_path\" in option \"$option\""
2028 exit 1
2029 fi
2030 ;;
2031 --setup-wine)
2032 SETUP_WINE=1
2033 ;;
2034 *)
2035 echo
2036 echo "Unrecognized option \"$option\""
2037 echo
2038 show_help
2039 ;;
2040 esac
2041done
2042
2043LOG="$ODIR$LOG"
2044ENV="$ODIR$ENV"
2045CNF="$ODIR$CNF"
2046
2047# initialize output files
2048cat > $LOG << EOF
2049# Log file generated by
2050#
2051# '$0 $*'
2052#
2053
2054EOF
2055cat > $CNF << EOF
2056# -*- Makefile -*-
2057#
2058# automatically generated by
2059#
2060# '$0 $*'
2061#
2062# It will be completely overwritten if configure is executed again.
2063#
2064
2065EOF
2066cat > $ENV << EOF
2067#!/bin/bash
2068#
2069# automatically generated by
2070#
2071# '$0 $*'
2072#
2073# It will be completely overwritten if configure is executed again.
2074# Make sure you source this file once before you start to build VBox.
2075#
2076
2077EOF
2078
2079# test if we are OSE
2080if [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
2081 echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
2082 echo >> $LOG
2083 OSE=0
2084fi
2085
2086if [ "$BUILD_TYPE" = "debug" ]; then
2087 echo "Creating DEBUG build!" >> $LOG
2088elif [ "$BUILD_TYPE" = "profile" ]; then
2089 echo "Creating PROFILE build!" >> $LOG
2090fi
2091
2092# first determine our environment
2093check_environment
2094check_kbuild
2095
2096[ -n "$ENV_ONLY" ] && exit 0
2097
2098# append the tools directory to the default search path
2099echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
2100export PATH
2101
2102# if we will be writing to a different out directory then set this up now
2103if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2104 echo "export AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
2105 echo "export LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
2106 echo "export PATH_OUT_BASE=$OUT_PATH" >> $ENV
2107fi
2108
2109# some things are not available in for OSE
2110if [ $OSE -ge 1 ]; then
2111 cnf_append "VBOX_OSE" "1"
2112 cnf_append "VBOX_WITH_TESTSUITE" ""
2113 cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
2114
2115 if [ "$OS" = "linux" ]; then
2116 cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
2117 else
2118 cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
2119 fi
2120 echo >> $CNF
2121fi
2122
2123# headless
2124if [ -n "$HEADLESS" ]; then
2125 cnf_append "VBOX_HEADLESS" "1"
2126fi
2127
2128if [ $WITH_OPENGL -eq 0 ]; then
2129 cnf_append "VBOX_WITH_CROGL" ""
2130fi
2131
2132if [ "$OS" = "darwin" ]; then
2133 # On Darwin we want to build against Qt4 only. WITH_QT4 is enabled by
2134 # default so disable Qt3. --disable-qt disables both Qt3 and Qt4 GUI now,
2135 # --disable-qt4 disables only the Qt4 GUI (which is not appropriate for
2136 # Darwin as we disable the Qt3 here anyway.
2137 # (Qt3 builds for Intel Macs are usually not threaded or for X11. And they
2138 # don't contain our patches, which means the result isn't really usable.)
2139 BUILD_LIBXSLT=1
2140 BUILD_LIBXML2=1
2141fi
2142
2143# emit disable directives corresponding to any --disable-xxx options.
2144[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
2145[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
2146[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
2147[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
2148[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
2149
2150# the tools
2151check_gcc
2152[ "$OS" != "darwin" ] && check_as86
2153[ "$OS" != "darwin" ] && check_bcc
2154[ "$OS" != "darwin" ] && check_iasl
2155# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
2156# [ "$OS" != "darwin" ] && check_yasm
2157[ "$OS" != "darwin" ] && check_xsltproc
2158[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
2159
2160# the libraries
2161[ "$OS" != "darwin" ] && check_pthread
2162[ $WITH_XPCOM -eq 1 ] && check_libxml2
2163[ $WITH_XPCOM -eq 1 ] && check_libxslt
2164[ $WITH_LIBIDL -eq 1 ] && check_libidl
2165# build openssl on Darwin in every case
2166[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
2167[ "$OS" != "darwin" ] && check_z
2168[ "$OS" != "darwin" -a "$OS" != "freebsd" ] && check_png
2169[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_curl
2170[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
2171[ $WITH_SDL -eq 1 ] && check_sdl
2172[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
2173[ $WITH_X11 -eq 1 ] && check_x
2174# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
2175# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
2176[ $WITH_X11 -eq 1 ] && check_xcursor
2177[ $WITH_OPENGL -eq 1 ] && check_xmu
2178[ $WITH_OPENGL -eq 1 ] && check_mesa
2179[ $WITH_QT4 -eq 1 ] && check_qt4
2180[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
2181
2182# Linux-specific
2183if [ "$OS" = "linux" ]; then
2184 # don't check for the static libstdc++ in the PUEL version as we build the
2185 # additions at a dedicated box
2186 [ $OSE -ge 1 ] && check_staticlibstdcxx
2187 if [ $WITH_KMODS -eq 1 ]; then
2188 check_linux
2189 else
2190 cnf_append "VBOX_LINUX_SRC" ""
2191 cnf_append "VBOX_WITH_VBOXDRV" ""
2192 cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
2193 fi
2194 if [ $WITH_ALSA -eq 1 ]; then
2195 check_alsa
2196 else
2197 cnf_append "VBOX_WITH_ALSA" ""
2198 fi
2199 if [ $WITH_PULSE -eq 1 ]; then
2200 check_pulse
2201 else
2202 cnf_append "VBOX_WITH_PULSE" ""
2203 fi
2204 if [ $WITH_DBUS -eq 0 ]; then
2205 cnf_append "VBOX_WITH_DBUS" ""
2206 fi
2207 check_libcap
2208 check_compiler_h
2209 [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
2210fi
2211
2212[ -n "$SETUP_WINE" ] && setup_wine
2213
2214if [ $OSE -ge 1 ]; then
2215 if [ $WITH_GSOAP -eq 1 ]; then
2216 check_gsoap
2217 else
2218 cnf_append "VBOX_WITH_WEBSERVICES" ""
2219 fi
2220fi
2221
2222# Darwin-specific
2223if [ "$OS" = "darwin" ]; then
2224 check_darwinversion
2225 check_i386elfgcc
2226fi
2227
2228# success!
2229echo
2230echo "Successfully generated '$CNF' and '$ENV'."
2231echo "Source '$ENV' once before you start to build VBox:"
2232echo ""
2233echo " source $ENV"
2234echo " kmk"
2235echo ""
2236if [ "$OS" = "linux" ]; then
2237 if [ $OUT_PATH_OVERRIDE -eq 1 ]; then
2238 vbox_out_path=$OUT_PATH
2239 else
2240 vbox_out_path=./out
2241 fi
2242 echo "To compile the kernel modules, do:"
2243 echo ""
2244 echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
2245 echo " make"
2246 echo ""
2247fi
2248if [ $WITH_HARDENING -gt 0 ]; then
2249 echo ""
2250 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2251 echo " Hardening is enabled which means that the VBox binaries will not run from"
2252 echo " the binary directory. The binaries have to be installed suid root and some"
2253 echo " more prerequisites have to be fulfilled which is normally done by installing"
2254 echo " the final package. For development, the hardening feature can be disabled"
2255 echo " by specifying the --disable-hardening parameter. Please never disable that"
2256 echo " feature for the final distribution!"
2257 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2258 echo ""
2259else
2260 echo ""
2261 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2262 echo " Hardening is disabled. Please do NOT build packages for distribution with"
2263 echo " disabled hardening!"
2264 echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
2265 echo ""
2266fi
2267echo "Enjoy!"
2268cleanup
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