VirtualBox

root/trunk/configure

Revision 10629, 49.4 kB (checked in by vboxsync, 1 week ago)

configure: write Qt4 include path as well

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
Line 
1 #!/bin/sh
2 # The purpose of this script is to check for all external tools, headers, and
3 # libraries VBox OSE depends on.
4
5 #
6 # Copyright (C) 2006-2007 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
17 LC_ALL=C
18 export LC_ALL
19
20 # append some extra paths
21 PATH="$PATH:/opt/gnome/bin"
22 # Solaris (order of paths important for tr, echo, grep, sed to work)
23 PATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
24 ORGPATH=$PATH
25
26 #
27 # Defaults
28 #
29 OSE=1
30 ODIR="`pwd`/"
31 SETUP_WINE=
32 TARGET_MACHINE=""
33 TARGET_CPU=""
34 WITH_XPCOM=1
35 WITH_LIBIDL=1
36 WITH_QT=1
37 WITH_QT4=1
38 WITH_SDL=1
39 WITH_SDL_TTF=1
40 WITH_X11=1
41 WITH_ALSA=1
42 WITH_PULSE=1
43 WITH_KMODS=1
44 CC="gcc"
45 CC_COMPAT=""
46 CC32=""
47 CC64=""
48 CXX="g++"
49 CXX32=""
50 CXX64=""
51 BCC="bcc"
52 YASM="yasm"
53 IASL="iasl"
54 AS86="as86"
55 XSLTPROC="xsltproc"
56 GENISOIMAGE="genisoimage"
57 MKISOFS="mkisofs"
58 BUILD_LIBXML2=
59 BUILD_LIBXSLT=
60 LIBCRYPTO="-lcrypto"
61 LIBPTHREAD="-lpthread"
62 LIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
63 INCX11="/usr/local/include"
64 LIBXCURSOR="-lXcursor"
65 INCZ=""
66 LIBZ="-lz"
67 INCPNG=""
68 LIBPNG="-lpng"
69 QT3DIR="/usr/qt/3 /usr/lib/qt3 /usr/lib/qt-3.3 /usr/share/qt3 /usr/lib64/qt-3.3 /usr/X11R6 /usr/lib/qt"
70 QT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr"
71 QT4DIR_PKGCONFIG=1
72 QT4UIC3DIR="/usr/bin"
73 KBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
74 DEVDIR="`cd \`dirname $0\`; pwd`/tools"
75 if [ -d "/lib/modules/`uname -r`/build" ]; then
76  LINUX="/lib/modules/`uname -r`/build"
77 else
78  LINUX="/usr/src/linux"
79 fi
80 KCHMVIEWER="kchmviewer"
81 LOG="configure.log"
82 CNF="AutoConfig.kmk"
83 ENV="env.sh"
84 BUILD_TYPE="release"
85 # the restricting tool is ar (mri mode).
86 INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
87
88 if (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
89   echo "Error: VBox base path contains invalid characters!"
90   exit 1
91 fi
92
93 # darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
94 if [ "`uname`" = "Darwin" ]; then
95   ECHO_N="/bin/echo -n"
96 else
97   ECHO_N="echo -n"
98 fi
99
100
101 cleanup()
102 {
103   rm -f .tmp_src.cc .tmp_src.c .tmp_out .test_execute.log
104 }
105
106 fail()
107 {
108   if [ -z "$nofatal" -o "x$1" != "x" ]; then
109     cleanup
110     rm -f $ENV
111     exit 1
112   fi
113 }
114
115 log()
116 {
117   echo "$1"
118   echo "$1" >> $LOG
119 }
120
121 log_success()
122 {
123   if [ -n "$1" ]; then $ECHO_N "$1, "; fi
124   echo "OK."
125   echo "$1" >> $LOG
126   echo >> $LOG
127   echo >> $LOG
128 }
129
130 log_failure()
131 {
132   echo
133   echo "  ** $1!"
134   echo "** $1!" >> $LOG
135   echo >> $LOG
136 }
137
138 cnf_append()
139 {
140   printf "%-30s := %s\n" "$1" "$2" >> $CNF
141 }
142
143 strip_l()
144 {
145   echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
146 }
147
148 strip_L()
149 {
150   echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
151 }
152
153 strip_I()
154 {
155   echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
156 }
157
158 prefix_I()
159 {
160   echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
161 }
162
163 # Wrapper for ancient /usr/bin/which on darwin that always returns 0
164 which_wrapper()
165 {
166   if [ -z "$have_ancient_which" ]; then
167     if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
168       have_ancient_which="yes"
169     else
170       have_ancient_which="no"
171     fi
172   fi
173   if [ "$have_ancient_which" = "yes" ]; then
174     retval=`which $* 2>/dev/null`
175     echo "$retval"
176     test -n "$retval" -a -x "$retval"
177     unset retval
178   else
179     which $* 2> /dev/null
180   fi
181 }
182
183 check_avail()
184 {
185    if [ -z "$1" ]; then
186      log_failure "$2 is empty"
187      fail $3
188      return 1
189    elif which_wrapper $1 > /dev/null; then
190      return 0
191    else
192      log_failure "$1 (variable $2) not found"
193      fail $3
194      return 1
195    fi
196 }
197
198 # Prepare a test
199 test_header()
200 {
201   echo "***** Checking $1 *****" >> $LOG
202   $ECHO_N "Checking for $1: "
203 }
204
205 # Compile a test
206 test_compile()
207 {
208   echo "compiling the following source file:" >> $LOG
209   cat .tmp_src.cc >> $LOG
210   echo "using the following command line:" >> $LOG
211   echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc \"$1\"" >> $LOG
212   $CXX -O -Wall -o .tmp_out .tmp_src.cc $1 >> $LOG 2>&1
213   if [ $? -ne 0 ]; then
214     if [ -z "$4" ]; then
215       echo
216       echo "  $2 not found at $1 or $3 headers not found"
217       echo "  Check the file $LOG for detailed error information."
218       fail
219     else
220       echo "not found."
221       echo >> $LOG
222       echo >> $LOG
223     fi
224     return 1
225   fi
226   return 0
227 }
228
229 # Execute a compiled test binary
230 test_execute()
231 {
232   echo "executing the binary" >> $LOG
233   ./.tmp_out > .test_execute.log
234   rc=$?
235   cat .test_execute.log | tee -a $LOG
236   if [ $rc -ne 0 ]; then
237     fail $1
238     return 1
239   fi
240   echo >> $LOG
241   echo >> $LOG
242   return 0
243 }
244
245 # Execute a compiled test binary
246 test_execute_path()
247 {
248   echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
249   LD_LIBRARY_PATH=$1 ./.tmp_out > .test_execute.log
250   rc=$?
251   cat .test_execute.log | tee -a $LOG
252   if [ $rc -ne 0 ]; then
253     fail
254     return 1
255   fi
256   echo >> $LOG
257   echo >> $LOG
258   return 0
259 }
260
261 #
262 # Check for OS, MACHINE, CPU
263 #
264 check_environment()
265 {
266   test_header environment
267   OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
268   case "$OS" in
269     linux)
270       ;;
271     darwin)
272       ;;
273     freebsd)
274       ;;
275     sunos)
276       OS='solaris'
277       ;;
278     *)
279       log_failure "Cannot determine OS"
280       exit 1
281       ;;
282   esac
283   BUILD_CPU=`uname -m`
284   [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
285   case "$BUILD_CPU" in
286     i[3456789]86|x86|i86pc)
287       BUILD_MACHINE='x86'
288       LIB='lib'
289       ;;
290     x86_64|amd64)
291       BUILD_MACHINE='amd64'
292       BUILD_CPU='k8'
293       if [ "$OS" != "solaris" ]; then
294         # on AMD64 systems, 64bit libs are usually located in /usr/lib64
295         # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
296         LIB='lib64'
297       else
298         # Solaris doesn't seem to subscribe to fhs, libs are usually in
299         # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
300         # alternative binaries can be found in 'amd64' subdirs of the 'bin'
301         # ones. So, in order to find the right stuff (esp. sdl-config) we'll
302         # have to make sure the */bin/amd64 dirs are searched before the */bin
303         # ones. (The sed has some sideeffects, but they shouldn't harm us...)
304         echo "64-bit Solaris detected, hacking the PATH" >> $LOG
305         echo "old PATH: $PATH" >> $LOG
306         PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
307                                    -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
308         export PATH
309         echo "new PATH: $PATH" >> $LOG
310         LIB='lib/64'
311       fi
312       ;;
313     *)
314       log_failure "Cannot determine system"
315       exit 1
316       ;;
317   esac
318   [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
319   [ -z "$TARGET_CPU"     ] && TARGET_CPU=$BUILD_CPU
320   DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
321   log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
322
323   echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
324   echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
325   echo "export BUILD_TARGET=\"$OS\"" >> $ENV
326   echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
327   echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
328   echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
329 }
330
331 #
332 # Check for gcc with version >= 3.2.
333 # We depend on a working gcc, if we fail terminate in every case.
334 #
335 check_gcc()
336 {
337   test_header gcc
338   if [ -n "$CC_COMPAT" ]; then
339     if check_avail "$CC_COMPAT" CC_COMPAT really; then
340       cc_compat_ver=`$CC_COMPAT -dumpversion` 2>/dev/null
341       if [ $? -ne 0 ]; then
342         log_failure "cannot execute '$CC_COMPAT -dumpversion'"
343         fail really
344       fi
345       cc_compat_maj=`echo $cc_compat_ver|cut -d. -f1`
346       cc_compat_min=`echo $cc_compat_ver|cut -d. -f2`
347       if [ $cc_compat_maj -lt 3 \
348          -o \( $cc_compat_maj -eq 3 -a $cc_compat_min -lt 2 \) \
349          -o \( $cc_compat_maj -eq 4 -a $cc_compat_min -lt 1 \) \
350          -o \( $cc_compat_maj -eq 4 -a $cc_compat_min -gt 2 \) \
351          -o $cc_compat_maj -gt 4 ]; then
352         log ""
353         log "  ** Version $cc_compat_ver of the compatibility gcc found. Expected gcc 3.x with x>1"
354         log "  ** or gcc 4.x with 0<x<3"
355         fail really
356       fi
357       cnf_append "VBOX_RECOMPILER_OP_GCC" "$CC_COMPAT"
358     fi
359   fi
360   if check_avail "$CC" CC really; then
361     cc_ver=`$CC -dumpversion` 2>/dev/null
362     if [ $? -ne 0 ]; then
363       log_failure "cannot execute '$CC -dumpversion'"
364       fail really
365     fi
366     if check_avail "$CXX" CXX really; then
367       cxx_ver=`$CXX -dumpversion` 2>/dev/null
368       if [ $? -ne 0 ]; then
369         log_failure "cannot execute '$CXX -dumpversion'"
370         fail really
371       fi
372       cc_maj=`echo $cc_ver|cut -d. -f1`
373       cc_min=`echo $cc_ver|cut -d. -f2`
374       if [ "x$cc_ver" != "x$cxx_ver" ]; then
375         log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
376         fail really
377       elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "OS" = "darwin" ]; then
378         log_success "found version $cc_ver"
379       elif [ $cc_maj -eq 4 -a $cc_min -eq 3 ]; then
380         if [ -z "$CC_COMPAT" ]; then
381           log ""
382           log "  ** There are known problems with gcc version 4.3 when compiling the recompiler"
383           log "  ** stuff. You need to specify a compatibility compiler with version < 4.3. Look"
384           log "  ** for a package compat-gcc-34 on Fedora systems or something similar on other"
385           log "  ** distributions and call configure with parameter --with-gcc-compat=gcc34."
386           fail really
387         fi
388       # gcc-4.0 is allowed for Darwin only
389       elif [ $cc_maj -lt 3 \
390              -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
391              -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
392              -o \( $cc_maj -eq 4 -a $cc_min -gt 3 \) \
393              -o $cc_maj -gt 4 ]; then
394         log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<4"
395         fail really
396       else
397         log_success "found version $cc_ver"
398       fi
399       if [ "$BUILD_MACHINE" = "amd64" ]; then
400         [ -z "$CC32"  ] && CC32="$CC -m32"
401         [ -z "$CXX32" ] && CXX32="$CXX -m32"
402       else
403         [ -z "$CC32"  ] && CC32="$CC"
404         [ -z "$CXX32" ] && CXX32="$CXX"
405       fi
406       if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
407         [ -z "$CC64"  ] && CC64="$CC -m64"
408         [ -z "$CXX64" ] && CXX64="$CXX -m64"
409       fi
410       if [ "$CC" != "gcc" ]; then
411         cnf_append "TOOL_GCC3_CC"   "$CC"
412         cnf_append "TOOL_GCC3_AS"   "$CC"
413         cnf_append "TOOL_GCC3_LD"   "$CC"
414         cnf_append "TOOL_GXX3_CC"   "$CC"
415         cnf_append "TOOL_GXX3_AS"   "$CC"
416       fi
417       if [ "$CXX" != "g++" ]; then
418         cnf_append "TOOL_GCC3_CXX"  "$CXX"
419         cnf_append "TOOL_GXX3_CXX"  "$CXX"
420         cnf_append "TOOL_GXX3_LD"   "$CXX"
421       fi
422       if [ "$CC32" != "gcc -m32" ]; then
423         cnf_append "TOOL_GCC32_CC"  "$CC32"
424         cnf_append "TOOL_GCC32_AS"  "$CC32"
425         cnf_append "TOOL_GCC32_LD"  "$CC32"
426         cnf_append "TOOL_GXX32_CC"  "$CC32"
427         cnf_append "TOOL_GXX32_AS"  "$CC32"
428       fi
429       if [ "$CXX32" != "g++ -m32" ]; then
430         cnf_append "TOOL_GCC32_CXX" "$CXX32"
431         cnf_append "TOOL_GXX32_CXX" "$CXX32"
432         cnf_append "TOOL_GXX32_LD"  "$CXX32"
433       fi
434       # this isn't not necessary, there is not such tool.
435       if [ -n "$CC64" ]; then
436         cnf_append "TOOL_GCC64_CC"  "$CC64"
437         cnf_append "TOOL_GCC64_AS"  "$CC64"
438         cnf_append "TOOL_GCC64_LD"  "$CC64"
439         cnf_append "TOOL_GXX64_CC"  "$CC64"
440         cnf_append "TOOL_GXX64_AS"  "$CC64"
441       fi
442       if [ -n "$CXX64" ]; then
443         cnf_append "TOOL_GCC64_CXX" "$CXX64"
444         cnf_append "TOOL_GXX64_CXX" "$CXX64"
445         cnf_append "TOOL_GXX64_LD"  "$CXX64"
446       fi
447       # Solaris sports a 32-bit gcc/g++.
448       if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
449         [ "$CC" = "gcc" ] && CC="gcc -m64"
450         [ "$CXX" = "g++" ] && CXX="g++ -m64"
451       fi
452     fi
453   fi
454 }
455
456 #
457 # Check for the bcc compiler, needed for compiling the BIOS
458 #
459 check_bcc()
460 {
461   test_header bcc
462   if check_avail "$BCC" BCC; then
463     bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
464     if [ $? -ne 0 ]; then
465       log_failure "not found"
466       fail
467     else
468       echo "compiling the following source file:" >> $LOG
469       cat > .tmp_src.c << EOF
470 int foo(a)
471   int a;
472 {
473   return 0;
474 }
475 EOF
476       cat .tmp_src.c >> $LOG
477       bcc_path=`which_wrapper $BCC`
478       bcc_dir="`dirname $bcc_path`/"
479       echo "using the following command line:" >> $LOG
480       echo "$BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c" >> $LOG
481       $BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c >> $LOG 2>&1
482       if [ $? -ne 0 ]; then
483         log_failure "not found"
484         fail
485       else
486         log_success "found version $bcc_ver"
487         cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
488       fi
489       unset bcc_path
490       unset bcc_dir
491     fi
492   fi
493 }
494
495 #
496 # Check for the as86 assembler, needed for compiling the BIOS
497 #
498 check_as86()
499 {
500   test_header as86
501   if check_avail "$AS86" AS86; then
502     as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
503     if [ $? -ne 0 ]; then
504       log_failure "not found"
505       fail
506     else
507       log_success "found version $as86_ver"
508       cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
509     fi
510   fi
511 }
512
513 #
514 # Check for yasm, needed to compile assembler files
515 #
516 check_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 # Check for the iasl ACPI compiler, needed to compile vbox.dsl
541 #
542 check_iasl()
543 {
544   test_header iasl
545   if check_avail "$IASL" IASL; then
546     iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
547     if [ $? -ne 0 ]; then
548       log_failure "not found"
549       fail
550     else
551       log_success "found version $iasl_ver"
552       cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
553     fi
554   fi
555 }
556
557 #
558 # Check for xsltproc, needed by Main
559 #
560 check_xsltproc()
561 {
562   test_header xslt
563   if check_avail "$XSLTPROC" XSLTPROC; then
564     xsltproc_ver=`$XSLTPROC --version`
565     if [ $? -ne 0 ]; then
566       log_failure "not found"
567       fail
568     else
569       log_success "found"
570       cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
571     fi
572   fi
573 }
574
575 #
576 # Check for mkisofs, needed to build the CDROM image containing the additions
577 #
578 check_mkisofs()
579 {
580   test_header mkisofs
581   if which_wrapper $GENISOIMAGE > /dev/null; then
582     mkisofs_ver=`$GENISOIMAGE --version`
583     if [ $? -ne 0 ]; then
584       log_failure "not found"
585       fail
586     else
587       log_success "found $mkisofs_ver"
588       cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
589     fi
590   elif check_avail "$MKISOFS" MKISOFS; then
591     mkisofs_ver=`$MKISOFS --version`
592     if [ $? -ne 0 ]; then
593       log_failure "not found"
594       fail
595     else
596       log_success "found $mkisofs_ver"
597       cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
598     fi
599   fi
600 }
601
602 #
603 # Check for libxml2, needed by VBoxSettings
604 # 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
605 #
606 check_libxml2()
607 {
608   if [ -z "$BUILD_LIBXML2" ]; then
609     test_header libxml2
610     if which_wrapper pkg-config > /dev/null; then
611       libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
612       if [ $? -ne 0 ]; then
613         log_failure "not found"
614         fail
615       else
616         FLGXML2=`pkg-config libxml-2.0 --cflags`
617         INCXML2=`strip_I "$FLGXML2"`
618         LIBXML2=`pkg-config libxml-2.0 --libs`
619         cat > .tmp_src.cc << EOF
620 #include <cstdio>
621 #include <libxml/xmlversion.h>
622 extern "C" int main(void)
623 {
624   printf("found version %s", LIBXML_DOTTED_VERSION);
625 #if LIBXML_VERSION >= 20626
626   printf(", OK.\n");
627   return 0;
628 #else
629   printf(", expected version 2.6.26 or higher\n");
630   return 1;
631 #endif
632 }
633 EOF
634         [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
635         if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
636           if test_execute; then
637             cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
638             cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
639           fi
640         fi
641       fi
642     elif which_wrapper xml2-config; then
643       libxml2_ver=`xml2-config --version`
644       if [ $? -ne 0 ]; then
645         log_failure "not found"
646         fail
647       else
648         log_success "found version $libxml2_ver"
649         FLGXML2=`xml2-config --cflags`
650         INCXML2=`strip_I "$FLGXML2"`
651         LIBXML2=`xml2-config --libs`
652         cat > .tmp_src.cc << EOF
653 #include <cstdio>
654 #include <libxml/xmlversion.h>
655 extern "C" int main(void)
656 {
657   printf("found version %s", LIBXML_DOTTED_VERSION);
658 #if LIBXML_VERSION >= 20626
659   printf(", OK.\n");
660   return 0;
661 #else
662   printf(", expected version 2.6.26 or higher\n");
663   return 1;
664 #endif
665 }
666 EOF
667         [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
668         if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
669           if test_execute; then
670             cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
671             cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
672           fi
673         fi
674       fi
675     else
676       log_failure "neither pkg-config nor xml2-config found"
677       fail
678     fi
679   fi
680 }
681
682 #
683 # Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.17.
684 # This library is available on Ubuntu Edgy which fulfils the minimal libxml2
685 # requirement (2.6.26).
686 #
687 check_libxslt()
688 {
689   if [ -z "$BUILD_LIBXSLT" ]; then
690     test_header libxslt
691     if which_wrapper pkg-config > /dev/null; then
692       libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
693       if [ $? -ne 0 ]; then
694         log_failure "not found"
695         fail
696       else
697         FLGXSLT=`pkg-config libxslt --cflags`
698         INCXSLT=`strip_I "$FLGXSLT"`
699         LIBXSLT=`pkg-config libxslt --libs`
700         cat > .tmp_src.cc << EOF
701 #include <cstdio>
702 #include <libxslt/xsltconfig.h>
703 extern "C" int main(void)
704 {
705   printf("found version %s", LIBXSLT_DOTTED_VERSION);
706 #if LIBXSLT_VERSION >= 10117
707   printf(", OK.\n");
708   return 0;
709 #else
710   printf(", expected version 1.1.17 or higher\n");
711   return 1;
712 #endif
713 }
714 EOF
715         [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
716         if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
717           if test_execute; then
718             cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
719             cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
720           fi
721         fi
722       fi
723     elif which_wrapper xslt-config; then
724       libxslt_ver=`xslt-config --version`
725       if [ $? -ne 0 ]; then
726         log_failure "not found"
727         fail
728       else
729         log_success "found version $libxslt_ver"
730         FLGXSLT=`xslt-config --cflags`
731         INCXSLT=`strip_I "$FLGXSLT"`
732         LIBXSLT=`xslt-config --libs`
733         cat > .tmp_src.cc << EOF
734 #include <cstdio>
735 #include <libxslt/xsltconfig.h>
736 extern "C" int main(void)
737 {
738   printf("found version %s", LIBXSLT_DOTTED_VERSION);
739 #if LIBXSLT_VERSION >= 10117
740   printf(", OK.\n");
741   return 0;
742 #else
743   printf(", expected version 1.1.17 or higher\n");
744   return 1;
745 #endif
746 }
747 EOF
748         [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
749         if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
750           if test_execute; then
751             cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
752             cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
753           fi
754         fi
755       fi
756     else
757       log_failure "neither pkg-config nor xslt-config found"
758       fail
759     fi
760   fi
761 }
762
763 #
764 # Check for libIDL, needed by xpcom
765 #
766 check_libidl()
767 {
768   test_header libIDL
769
770   if which_wrapper libIDL-config-2 > /dev/null; then
771     libidl_ver=`libIDL-config-2 --version`
772     if [ $? -ne 0 ]; then
773       log_failure "not found"
774       fail
775     else
776       log_success "found version $libidl_ver"
777       cnf_append "VBOX_LIBIDL_CONFIG" \
778         "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
779     fi
780   elif check_avail "libIDL-config" libIDL-config; then
781     libidl_ver=`libIDL-config --version`
782     if [ $? -ne 0 ]; then
783       log_failure "not found"
784       fail
785     else
786       log_success "found version $libidl_ver"
787       cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
788     fi
789   fi
790 }
791
792 #
793 # Check for openssl, needed for RDP
794 #
795 check_ssl()
796 {
797   test_header ssl
798   cat > .tmp_src.cc << EOF
799 #include <cstdio>
800 #include <openssl/opensslv.h>
801 extern "C" int main(void)
802 {
803   printf("found version %s", OPENSSL_VERSION_TEXT);
804 #if OPENSSL_VERSION_NUMBER >= 0x0090700
805   printf(", OK.\n");
806   return 0;
807 #else
808   printf(", expected version 0.9.7 or higher\n");
809   return 1;
810 #endif
811 }
812 EOF
813   if test_compile $LIBCRYPTO libcrypto openssl; then
814     if test_execute nofatal; then
815       cnf_append "SDK_VBOX_OPENSSL_INCS" ""
816       cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
817     fi
818   fi
819 }
820
821 #
822 # Check for pthread, needed by VBoxSVC, frontends, ...
823 #
824 check_pthread()
825 {
826   test_header pthread
827   cat > .tmp_src.cc << EOF
828 #include <cstdio>
829 #include <pthread.h>
830 extern "C" int main(void)
831 {
832   pthread_mutex_t mutex;
833   if (pthread_mutex_init(&mutex, NULL)) {
834     printf("pthread_mutex_init() failed\n");
835     return 1;
836   }
837   if (pthread_mutex_lock(&mutex)) {
838     printf("pthread_mutex_lock() failed\n");
839     return 1;
840   }
841   if (pthread_mutex_unlock(&mutex)) {
842     printf("pthread_mutex_unlock() failed\n");
843     return 1;
844   }
845   printf("found, OK.\n");
846 }
847 EOF
848   if test_compile $LIBPTHREAD pthread pthread; then
849     if test_execute; then
850       cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
851     fi
852   fi
853 }
854
855 #
856 # Check for zlib, needed by VBoxSVC, Runtime, ...
857 #
858 check_z()
859 {
860   test_header zlib
861   cat > .tmp_src.cc << EOF
862 #include <cstdio>
863 #include <zlib.h>
864 extern "C" int main(void)
865 {
866   printf("found version %s", ZLIB_VERSION);
867 #if ZLIB_VERNUM >= 0x1210
868   printf(", OK.\n");
869   return 0;
870 #else
871   printf(", expected version 1.2.1 or higher\n");
872   return 1;
873 #endif
874 }
875 EOF
876   [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
877   if test_compile "$LIBZ $I_INCZ" zlib zlib; then
878     if test_execute; then
879       cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
880<