VirtualBox

source: vbox/trunk/configure@ 7830

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

configure: fixed SDL_main

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