1 | #!/bin/bash
|
---|
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 | # If you received this file as part of a commercial VirtualBox
|
---|
17 | # distribution, then only the terms of your commercial VirtualBox
|
---|
18 | # license agreement apply instead of the previous paragraph.
|
---|
19 | #
|
---|
20 |
|
---|
21 | LC_ALL=C
|
---|
22 | export LC_ALL
|
---|
23 |
|
---|
24 | #
|
---|
25 | # Defaults
|
---|
26 | #
|
---|
27 | OSE=1
|
---|
28 | WITH_XPCOM=1
|
---|
29 | WITH_LIBIDL=1
|
---|
30 | WITH_QT=1
|
---|
31 | WITH_SDL_TTF=1
|
---|
32 | WITH_HAL=1
|
---|
33 | CC="gcc"
|
---|
34 | CXX="g++"
|
---|
35 | BCC="bcc"
|
---|
36 | YASM="yasm"
|
---|
37 | IASL="iasl"
|
---|
38 | AS86="as86"
|
---|
39 | XSLTPROC="xsltproc"
|
---|
40 | GENISOIMAGE="genisoimage"
|
---|
41 | MKISOFS="mkisofs"
|
---|
42 | INCXALAN=""
|
---|
43 | LIBXALAN="-lxalan-c"
|
---|
44 | INCXERCES=""
|
---|
45 | LIBXERCES="-lxerces-c"
|
---|
46 | INCSDL="/usr/include/SDL"
|
---|
47 | LIBSDL="-lSDL"
|
---|
48 | LIBSDLMAIN="-lSDLmain"
|
---|
49 | LIBCRYPTO="-lcrypto"
|
---|
50 | LIBPTHREAD="-lpthread"
|
---|
51 | LIBX11="-L/usr/X11R6/lib -lXext -lX11"
|
---|
52 | LIBXCURSOR="-lXcursor"
|
---|
53 | INCZ=""
|
---|
54 | LIBZ="-lz"
|
---|
55 | INCPNG=""
|
---|
56 | LIBPNG="-lpng"
|
---|
57 | CFLAGSHAL="-I/usr/include/hal -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include"
|
---|
58 | LIBPATHHAL=""
|
---|
59 | LIBHAL="-lhal -ldbus-1"
|
---|
60 | QTDIR="/usr/qt/3 /usr/lib/qt3 /usr/lib/qt-3.3 /usr/share/qt3 /usr/lib64/qt-3.3"
|
---|
61 | KBUILDDIR="`cd $(dirname $0); pwd`/kBuild"
|
---|
62 | DEVDIR="`cd $(dirname $0); pwd`/tools"
|
---|
63 | if [ -d /lib/modules/`uname -r`/build ]; then
|
---|
64 | LINUX="/lib/modules/`uname -r`/build"
|
---|
65 | else
|
---|
66 | LINUX="/usr/src/linux"
|
---|
67 | fi
|
---|
68 | KCHMVIEWER="kchmviewer"
|
---|
69 | LOG="configure.log"
|
---|
70 | CNF="AutoConfig.kmk"
|
---|
71 | ENV="env.sh"
|
---|
72 | BUILD_TYPE="release"
|
---|
73 | # the restricting tool is ar (mri mode).
|
---|
74 | INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
|
---|
75 |
|
---|
76 | if (cd $(dirname $0); pwd)|grep -q "$INVALID_CHARS"; then
|
---|
77 | echo "Error: VBox base path contains invalid characters!"
|
---|
78 | exit 1
|
---|
79 | fi
|
---|
80 |
|
---|
81 | function cleanup()
|
---|
82 | {
|
---|
83 | rm -f .tmp_src.cc .tmp_src.c .tmp_out .test_execute.log
|
---|
84 | }
|
---|
85 |
|
---|
86 | function fail()
|
---|
87 | {
|
---|
88 | if [ -z "$nofatal" -o "x$1" != "x" ]; then
|
---|
89 | cleanup
|
---|
90 | rm -f $ENV
|
---|
91 | exit 1
|
---|
92 | fi
|
---|
93 | }
|
---|
94 |
|
---|
95 | function log_success()
|
---|
96 | {
|
---|
97 | if [ -n "$1" ]; then echo -n "$1, "; fi
|
---|
98 | echo "OK."
|
---|
99 | echo -e "$1\n\n" >> $LOG
|
---|
100 | }
|
---|
101 |
|
---|
102 | function log_failure()
|
---|
103 | {
|
---|
104 | echo -e "\n ** $1!"
|
---|
105 | echo -e "** $1!\n" >> $LOG
|
---|
106 | }
|
---|
107 |
|
---|
108 | function cnf_append()
|
---|
109 | {
|
---|
110 | printf "%-30s := %s\n" "$1" "$2" >> $CNF
|
---|
111 | }
|
---|
112 |
|
---|
113 | function strip_l()
|
---|
114 | {
|
---|
115 | echo "$1"|sed 's|-l\([^ ]\+\)|\1|g'
|
---|
116 | }
|
---|
117 |
|
---|
118 | function strip_L()
|
---|
119 | {
|
---|
120 | echo "$1"|sed 's|-L\([^ ]\+\)|\1|g'
|
---|
121 | }
|
---|
122 |
|
---|
123 | # Wrapper for ancient /usr/bin/which on darwin that always returns 0
|
---|
124 | function which_wrapper()
|
---|
125 | {
|
---|
126 | if [ -z "$have_ancient_which" ]; then
|
---|
127 | if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
|
---|
128 | have_ancient_which="yes"
|
---|
129 | else
|
---|
130 | have_ancient_which="no"
|
---|
131 | fi
|
---|
132 | fi
|
---|
133 | if [ "$have_ancient_which" = "yes" ]; then
|
---|
134 | local retval=`which $* 2>/dev/null`
|
---|
135 | echo "$retval"
|
---|
136 | test -n "$retval" -a -e "$retval"
|
---|
137 | else
|
---|
138 | which $* 2> /dev/null
|
---|
139 | fi
|
---|
140 | }
|
---|
141 |
|
---|
142 | function check_avail()
|
---|
143 | {
|
---|
144 | if [ -z "$1" ]; then
|
---|
145 | log_failure "$2 is empty"
|
---|
146 | fail $3
|
---|
147 | return 1
|
---|
148 | elif which_wrapper $1 > /dev/null; then
|
---|
149 | return 0
|
---|
150 | else
|
---|
151 | log_failure "$1 (variable $2) not found"
|
---|
152 | fail $3
|
---|
153 | return 1
|
---|
154 | fi
|
---|
155 | }
|
---|
156 |
|
---|
157 | # Prepare a test
|
---|
158 | function test_header()
|
---|
159 | {
|
---|
160 | echo "***** Checking $1 *****" >> $LOG
|
---|
161 | echo -n "Checking for $1: "
|
---|
162 | }
|
---|
163 |
|
---|
164 | # Compile a test
|
---|
165 | function test_compile()
|
---|
166 | {
|
---|
167 | echo "compiling the following source file:" >> $LOG
|
---|
168 | cat .tmp_src.cc >> $LOG
|
---|
169 | echo "using the following command line:" >> $LOG
|
---|
170 | echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc \"$1\"" >> $LOG
|
---|
171 | $CXX -O -Wall -o .tmp_out .tmp_src.cc $1 >> $LOG 2>&1
|
---|
172 | if (($?!=0)); then
|
---|
173 | if [ -z "$4" ]; then
|
---|
174 | echo -e "\n $2 not found at $1 or $3 headers not found"
|
---|
175 | echo " Check the file $LOG for detailed error information."
|
---|
176 | fail
|
---|
177 | else
|
---|
178 | echo "not found."
|
---|
179 | echo -e "\n" >> $LOG
|
---|
180 | fi
|
---|
181 | return 1
|
---|
182 | fi
|
---|
183 | return 0
|
---|
184 | }
|
---|
185 |
|
---|
186 | # Execute a compiled test binary
|
---|
187 | function test_execute()
|
---|
188 | {
|
---|
189 | echo "executing the binary" >> $LOG
|
---|
190 | ./.tmp_out > .test_execute.log
|
---|
191 | rc=$?
|
---|
192 | cat .test_execute.log | tee -a $LOG
|
---|
193 | if (($rc!=0)); then
|
---|
194 | fail $1
|
---|
195 | return 1
|
---|
196 | fi
|
---|
197 | echo -e "\n\n" >> $LOG
|
---|
198 | return 0
|
---|
199 | }
|
---|
200 |
|
---|
201 | #
|
---|
202 | # Check for OS, MACHINE, CPU
|
---|
203 | #
|
---|
204 | function check_environment()
|
---|
205 | {
|
---|
206 | test_header environment
|
---|
207 | CPU=`uname -m`
|
---|
208 | case "$CPU" in
|
---|
209 | i[3456789]86|x86)
|
---|
210 | MACHINE='x86'
|
---|
211 | LIB='lib'
|
---|
212 | ;;
|
---|
213 | x86_64|amd64)
|
---|
214 | MACHINE='amd64'
|
---|
215 | CPU='k8'
|
---|
216 | # on AMD64 systems, 64bit libs are usually located in /usr/lib64
|
---|
217 | # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
|
---|
218 | LIB='lib64'
|
---|
219 | ;;
|
---|
220 | *)
|
---|
221 | log_failure "Cannot determine system"
|
---|
222 | exit 1
|
---|
223 | ;;
|
---|
224 | esac
|
---|
225 | OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr 'A-Z' 'a-z'`
|
---|
226 | case "$OS" in
|
---|
227 | linux)
|
---|
228 | ;;
|
---|
229 | darwin)
|
---|
230 | ;;
|
---|
231 | *)
|
---|
232 | log_failure "Cannot determine OS"
|
---|
233 | exit 1
|
---|
234 | ;;
|
---|
235 | esac
|
---|
236 | DEVDIR_BIN="$DEVDIR/$OS.$MACHINE/bin"
|
---|
237 | KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$MACHINE"
|
---|
238 | log_success "Determined $OS.$MACHINE"
|
---|
239 |
|
---|
240 | # Automatically disable XPCOM on darwin.
|
---|
241 | if [ "$OS" = "darwin" -a $WITH_XPCOM -eq 1 ]; then
|
---|
242 | WITH_XPCOM=0
|
---|
243 | WITH_LIBIDL=0
|
---|
244 | WITH_QT=0
|
---|
245 | echo "Disabling checks for XPCOM related components."
|
---|
246 | fi
|
---|
247 | }
|
---|
248 |
|
---|
249 | #
|
---|
250 | # Check for gcc with version >= 3.2.
|
---|
251 | # We depend on a working gcc, if we fail terminate in every case.
|
---|
252 | #
|
---|
253 | function check_gcc()
|
---|
254 | {
|
---|
255 | test_header gcc
|
---|
256 | if check_avail "$CC" CC really; then
|
---|
257 | cc_ver=`$CC -dumpversion`
|
---|
258 | if check_avail "$CXX" CXX really; then
|
---|
259 | cxx_ver=`$CXX -dumpversion`
|
---|
260 | cc_maj=`echo $cc_ver|cut -d. -f1`
|
---|
261 | cc_min=`echo $cc_ver|cut -d. -f2`
|
---|
262 | if [ "x$cc_ver" != "x$cxx_ver" ]; then
|
---|
263 | log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
|
---|
264 | fail really
|
---|
265 | elif (($cc_maj>3)); then
|
---|
266 | log_success "found version $cc_ver"
|
---|
267 | elif (($cc_maj<3 || $cc_min<2)); then
|
---|
268 | log_failure "gcc version $cc_ver found, expected at least gcc version 3.2"
|
---|
269 | fail really
|
---|
270 | else
|
---|
271 | log_success "found version $cc_ver"
|
---|
272 | fi
|
---|
273 | if [ "$CC" != "gcc" ]; then
|
---|
274 | cnf_append "TOOL_GCC3_CC" "$CC"
|
---|
275 | cnf_append "TOOL_GCC3_AS" "$CC"
|
---|
276 | cnf_append "TOOL_GXX3_CC" "$CC"
|
---|
277 | cnf_append "TOOL_GXX3_AS" "$CC"
|
---|
278 | fi
|
---|
279 | if [ "$CXX" != "g++" ]; then
|
---|
280 | cnf_append "TOOL_GCC3_CXX" "$CXX"
|
---|
281 | cnf_append "TOOL_GCC3_LD" "$CXX"
|
---|
282 | cnf_append "TOOL_GXX3_CXX" "$CXX"
|
---|
283 | cnf_append "TOOL_GXX3_LD" "$CXX"
|
---|
284 | fi
|
---|
285 | fi
|
---|
286 | fi
|
---|
287 | }
|
---|
288 |
|
---|
289 | #
|
---|
290 | # Check for the bcc compiler, needed for compiling the BIOS
|
---|
291 | #
|
---|
292 | function check_bcc()
|
---|
293 | {
|
---|
294 | test_header bcc
|
---|
295 | if check_avail "$BCC" BCC; then
|
---|
296 | bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
|
---|
297 | if (($?!=0)); then
|
---|
298 | log_failure "not found"
|
---|
299 | fail
|
---|
300 | else
|
---|
301 | echo "compiling the following source file:" >> $LOG
|
---|
302 | echo '
|
---|
303 | int foo(a)
|
---|
304 | int a;
|
---|
305 | {
|
---|
306 | return 0;
|
---|
307 | }
|
---|
308 | ' > .tmp_src.c
|
---|
309 | cat .tmp_src.c >> $LOG
|
---|
310 | local bcc_path=`which_wrapper $BCC`
|
---|
311 | local bcc_dir="`dirname $bcc_path`/"
|
---|
312 | echo "using the following command line:" >> $LOG
|
---|
313 | echo "$BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c" >> $LOG
|
---|
314 | $BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c >> $LOG 2>&1
|
---|
315 | if (($?!=0)); then
|
---|
316 | log_failure "not found"
|
---|
317 | fail
|
---|
318 | else
|
---|
319 | log_success "found version $bcc_ver"
|
---|
320 | cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
|
---|
321 | fi
|
---|
322 | fi
|
---|
323 | fi
|
---|
324 | }
|
---|
325 |
|
---|
326 | #
|
---|
327 | # Check for the as86 assembler, needed for compiling the BIOS
|
---|
328 | #
|
---|
329 | function check_as86()
|
---|
330 | {
|
---|
331 | test_header as86
|
---|
332 | if check_avail "$AS86" AS86; then
|
---|
333 | as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
|
---|
334 | if (($?!=0)); then
|
---|
335 | log_failure "not found"
|
---|
336 | fail
|
---|
337 | else
|
---|
338 | log_success "found version $as86_ver"
|
---|
339 | cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
|
---|
340 | fi
|
---|
341 | fi
|
---|
342 | }
|
---|
343 |
|
---|
344 | #
|
---|
345 | # Check for yasm, needed to compile assembler files
|
---|
346 | #
|
---|
347 | function check_yasm()
|
---|
348 | {
|
---|
349 | test_header yasm
|
---|
350 | if check_avail "$YASM" YASM; then
|
---|
351 | yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
|
---|
352 | if (($?!=0)); then
|
---|
353 | log_failure "not found"
|
---|
354 | fail
|
---|
355 | else
|
---|
356 | yasm_maj=`echo $yasm_ver|cut -d. -f1`
|
---|
357 | yasm_min=`echo $yasm_ver|cut -d. -f2`
|
---|
358 | yasm_rev=`echo $yasm_ver|cut -d. -f3`
|
---|
359 | yasm_ver_mul=$(($yasm_maj*10000+$yasm_min*100+$yasm_rev))
|
---|
360 | if (($yasm_ver_mul<501)); then
|
---|
361 | log_failure "found version $yasm_ver, expected at least 0.5.1"
|
---|
362 | fail
|
---|
363 | else
|
---|
364 | log_success "found version $yasm_ver"
|
---|
365 | fi
|
---|
366 | fi
|
---|
367 | fi
|
---|
368 | }
|
---|
369 |
|
---|
370 | #
|
---|
371 | # Check for the iasl ACPI compiler, needed to compile vbox.dsl
|
---|
372 | #
|
---|
373 | function check_iasl()
|
---|
374 | {
|
---|
375 | test_header iasl
|
---|
376 | if check_avail "$IASL" IASL; then
|
---|
377 | iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
|
---|
378 | if (($?!=0)); then
|
---|
379 | log_failure "not found"
|
---|
380 | fail
|
---|
381 | else
|
---|
382 | log_success "found version $iasl_ver"
|
---|
383 | cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
|
---|
384 | fi
|
---|
385 | fi
|
---|
386 | }
|
---|
387 |
|
---|
388 | #
|
---|
389 | # Check for xsltproc, needed by Main
|
---|
390 | #
|
---|
391 | function check_xsltproc()
|
---|
392 | {
|
---|
393 | test_header xslt
|
---|
394 | if check_avail "$XSLTPROC" XSLTPROC; then
|
---|
395 | xsltproc_ver=`$XSLTPROC --version`
|
---|
396 | if (($?!=0)); then
|
---|
397 | log_failure "not found"
|
---|
398 | fail
|
---|
399 | else
|
---|
400 | log_success "found"
|
---|
401 | cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
|
---|
402 | fi
|
---|
403 | fi
|
---|
404 | }
|
---|
405 |
|
---|
406 | #
|
---|
407 | # Check for mkisofs, needed to build the CDROM image containing the additions
|
---|
408 | #
|
---|
409 | function check_mkisofs()
|
---|
410 | {
|
---|
411 | test_header mkisofs
|
---|
412 | if which_wrapper $GENISOIMAGE > /dev/null; then
|
---|
413 | mkisofs_ver=`$GENISOIMAGE --version`
|
---|
414 | if (($?!=0)); then
|
---|
415 | log_failure "not found"
|
---|
416 | fail
|
---|
417 | else
|
---|
418 | log_success "found $mkisofs_ver"
|
---|
419 | cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
|
---|
420 | fi
|
---|
421 | elif check_avail "$MKISOFS" MKISOFS; then
|
---|
422 | mkisofs_ver=`$MKISOFS --version`
|
---|
423 | if (($?!=0)); then
|
---|
424 | log_failure "not found"
|
---|
425 | fail
|
---|
426 | else
|
---|
427 | log_success "found $mkisofs_ver"
|
---|
428 | cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
|
---|
429 | fi
|
---|
430 | fi
|
---|
431 | }
|
---|
432 |
|
---|
433 | #
|
---|
434 | # Check for xalan, needed by VBoxXML
|
---|
435 | #
|
---|
436 | function check_xalan()
|
---|
437 | {
|
---|
438 | if [ -n "$LIBXALAN" ]; then
|
---|
439 | test_header xalan
|
---|
440 | echo '
|
---|
441 | #include <cstdio>
|
---|
442 | #include <xalanc/Include/XalanVersion.hpp>
|
---|
443 | extern "C" int main(void)
|
---|
444 | {
|
---|
445 | printf("found version %d.%d.%d",
|
---|
446 | XALAN_VERSION_MAJOR, XALAN_VERSION_MINOR, XALAN_VERSION_REVISION);
|
---|
447 | #if _XALAN_VERSION >= 10800
|
---|
448 | printf(", OK.\n");
|
---|
449 | return 0;
|
---|
450 | #else
|
---|
451 | printf(", expected version 1.8.0 or higher\n");
|
---|
452 | return 1;
|
---|
453 | #endif
|
---|
454 | }
|
---|
455 | ' > .tmp_src.cc
|
---|
456 | if test_compile "$LIBXALAN $LIBPTHREAD ${INCXALAN:+-I$INCXALAN}" xalan xalanc; then
|
---|
457 | if test_execute; then
|
---|
458 | cnf_append "SDK_VBOX_XALAN_LIBS" "`strip_l $LIBXALAN`"
|
---|
459 | cnf_append "SDK_VBOX_XALAN_INCS" "$INCXALAN"
|
---|
460 | fi
|
---|
461 | fi
|
---|
462 | else
|
---|
463 | echo "Building xalan from shipped sources."
|
---|
464 | echo -e "Building xalan from shipped sources.\n\n" >> $LOG
|
---|
465 | fi
|
---|
466 | }
|
---|
467 |
|
---|
468 | #
|
---|
469 | # Check for xerces, needed by VBoxXML
|
---|
470 | #
|
---|
471 | function check_xerces()
|
---|
472 | {
|
---|
473 | if [ -n "$LIBXERCES" ]; then
|
---|
474 | test_header xerces
|
---|
475 | echo '
|
---|
476 | #include <cstdio>
|
---|
477 | #include <xercesc/util/XercesVersion.hpp>
|
---|
478 | extern "C" int main(void)
|
---|
479 | {
|
---|
480 | printf("found version %d.%d.%d",
|
---|
481 | XERCES_VERSION_MAJOR, XERCES_VERSION_MINOR, XERCES_VERSION_REVISION);
|
---|
482 | #if _XERCES_VERSION >= 20500
|
---|
483 | printf(", OK.\n");
|
---|
484 | return 0;
|
---|
485 | #else
|
---|
486 | printf(", expected version 2.5.0 or higher");
|
---|
487 | return 1;
|
---|
488 | #endif
|
---|
489 | }
|
---|
490 | ' > .tmp_src.cc
|
---|
491 | if test_compile "$LIBXERCES $LIBPTHREAD ${INCXERCES:+-I$INCXERCES}" xerces xercesc; then
|
---|
492 | if test_execute; then
|
---|
493 | cnf_append "SDK_VBOX_XERCES_LIBS" "`strip_l $LIBXERCES`"
|
---|
494 | cnf_append "SDK_VBOX_XERCES_INCS" "$INCXERCES"
|
---|
495 | fi
|
---|
496 | fi
|
---|
497 | else
|
---|
498 | echo "Building xerces from shipped sources."
|
---|
499 | echo -e "Building xerces from shipped sources.\n\n" >> $LOG
|
---|
500 | fi
|
---|
501 | }
|
---|
502 |
|
---|
503 | #
|
---|
504 | # Check for libIDL, needed by xpcom
|
---|
505 | #
|
---|
506 | check_libidl()
|
---|
507 | {
|
---|
508 | test_header libIDL
|
---|
509 |
|
---|
510 | if which_wrapper libIDL-config-2 > /dev/null; then
|
---|
511 | libidl_ver=`libIDL-config-2 --version`
|
---|
512 | if (($?!=0)); then
|
---|
513 | log_failure "not found"
|
---|
514 | fail
|
---|
515 | else
|
---|
516 | log_success "found version $libidl_ver"
|
---|
517 | cnf_append "VBOX_LIBIDL_CONFIG" \
|
---|
518 | "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
|
---|
519 | fi
|
---|
520 | elif check_avail "libIDL-config" libIDL-config; then
|
---|
521 | libidl_ver=`libIDL-config --version`
|
---|
522 | if (($?!=0)); then
|
---|
523 | log_failure "not found"
|
---|
524 | fail
|
---|
525 | else
|
---|
526 | log_success "found version $libidl_ver"
|
---|
527 | cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
|
---|
528 | fi
|
---|
529 | fi
|
---|
530 | }
|
---|
531 |
|
---|
532 | #
|
---|
533 | # Check for openssl, needed for RDP
|
---|
534 | #
|
---|
535 | function check_ssl()
|
---|
536 | {
|
---|
537 | test_header ssl
|
---|
538 | echo '
|
---|
539 | #include <cstdio>
|
---|
540 | #include <openssl/opensslv.h>
|
---|
541 | extern "C" int main(void)
|
---|
542 | {
|
---|
543 | printf("found version %s", OPENSSL_VERSION_TEXT);
|
---|
544 | #if OPENSSL_VERSION_NUMBER >= 0x0090700
|
---|
545 | printf(", OK.\n");
|
---|
546 | return 0;
|
---|
547 | #else
|
---|
548 | printf(", expected version 0.9.7 or higher\n");
|
---|
549 | return 1;
|
---|
550 | #endif
|
---|
551 | }
|
---|
552 | ' > .tmp_src.cc
|
---|
553 | if test_compile $LIBCRYPTO libcrypto openssl; then
|
---|
554 | if test_execute nofatal; then
|
---|
555 | cnf_append "SDK_VBOX_OPENSSL_INCS" ""
|
---|
556 | cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l $LIBCRYPTO`"
|
---|
557 | fi
|
---|
558 | fi
|
---|
559 | }
|
---|
560 |
|
---|
561 | #
|
---|
562 | # Check for pthread, needed by VBoxSVC, frontends, ...
|
---|
563 | #
|
---|
564 | function check_pthread()
|
---|
565 | {
|
---|
566 | test_header pthread
|
---|
567 | echo '
|
---|
568 | #include <cstdio>
|
---|
569 | #include <pthread.h>
|
---|
570 | extern "C" int main(void)
|
---|
571 | {
|
---|
572 | pthread_mutex_t mutex;
|
---|
573 | if (pthread_mutex_init(&mutex, NULL)) {
|
---|
574 | printf("pthread_mutex_init() failed\n");
|
---|
575 | return 1;
|
---|
576 | }
|
---|
577 | if (pthread_mutex_lock(&mutex)) {
|
---|
578 | printf("pthread_mutex_lock() failed\n");
|
---|
579 | return 1;
|
---|
580 | }
|
---|
581 | if (pthread_mutex_unlock(&mutex)) {
|
---|
582 | printf("pthread_mutex_unlock() failed\n");
|
---|
583 | return 1;
|
---|
584 | }
|
---|
585 | printf("found, OK.\n");
|
---|
586 | }
|
---|
587 | ' > .tmp_src.cc
|
---|
588 | if test_compile $LIBPTHREAD pthread pthread; then
|
---|
589 | if test_execute; then
|
---|
590 | cnf_append "LIB_PTHREAD" "`strip_l $LIBPTHREAD`"
|
---|
591 | fi
|
---|
592 | fi
|
---|
593 | }
|
---|
594 |
|
---|
595 | #
|
---|
596 | # Check for zlib, needed by VBoxSVC, Runtime, ...
|
---|
597 | #
|
---|
598 | function check_z()
|
---|
599 | {
|
---|
600 | test_header zlib
|
---|
601 | echo '
|
---|
602 | #include <cstdio>
|
---|
603 | #include <zlib.h>
|
---|
604 | extern "C" int main(void)
|
---|
605 | {
|
---|
606 | printf("found version %s", ZLIB_VERSION);
|
---|
607 | #if ZLIB_VERNUM >= 0x1210
|
---|
608 | printf(", OK.\n");
|
---|
609 | return 0;
|
---|
610 | #else
|
---|
611 | printf(", expected version 1.2.1 or higher\n");
|
---|
612 | return 1;
|
---|
613 | #endif
|
---|
614 | }
|
---|
615 | ' > .tmp_src.cc
|
---|
616 | if test_compile "$LIBZ ${INCZ:+-I$INCZ}" zlib zlib; then
|
---|
617 | if test_execute; then
|
---|
618 | cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l $LIBZ`"
|
---|
619 | cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
|
---|
620 | fi
|
---|
621 | fi
|
---|
622 | }
|
---|
623 |
|
---|
624 | #
|
---|
625 | # Check for libpng, needed by kchmviewer
|
---|
626 | #
|
---|
627 | function check_png()
|
---|
628 | {
|
---|
629 | test_header libpng
|
---|
630 | echo '
|
---|
631 | #include <cstdio>
|
---|
632 | #include <png.h>
|
---|
633 | extern "C" int main(void)
|
---|
634 | {
|
---|
635 | printf("found version %s", PNG_LIBPNG_VER_STRING);
|
---|
636 | #if PNG_LIBPNG_VER >= 10205
|
---|
637 | printf(", OK.\n");
|
---|
638 | return 0;
|
---|
639 | #else
|
---|
640 | printf(", expected version 1.2.5 or higher\n");
|
---|
641 | return 1;
|
---|
642 | #endif
|
---|
643 | }
|
---|
644 | ' > .tmp_src.cc
|
---|
645 | if test_compile "$LIBPNG ${INCPNG:+-I$INCPNG}" libpng libpng nofatal; then
|
---|
646 | if test_execute nofatal; then
|
---|
647 | cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l $LIBPNG`"
|
---|
648 | cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
|
---|
649 | fi
|
---|
650 | fi
|
---|
651 | }
|
---|
652 |
|
---|
653 | #
|
---|
654 | # Check for pam, needed by VRDPAuth
|
---|
655 | # Version 79 was introduced in 9/2005, do we support older versions?
|
---|
656 | # Debian/sarge uses 76
|
---|
657 | # OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
|
---|
658 | #
|
---|
659 | function check_pam()
|
---|
660 | {
|
---|
661 | test_header pam
|
---|
662 | echo '
|
---|
663 | #include <cstdio>
|
---|
664 | #include <security/pam_appl.h>
|
---|
665 | extern "C" int main(void)
|
---|
666 | {
|
---|
667 | printf("found version %d", __LIBPAM_VERSION);
|
---|
668 | if (__LIBPAM_VERSION >= 76)
|
---|
669 | {
|
---|
670 | printf(", OK.\n");
|
---|
671 | return 0;
|
---|
672 | }
|
---|
673 | else
|
---|
674 | {
|
---|
675 | printf(", expected version 76 or higher\n");
|
---|
676 | return 1;
|
---|
677 | }
|
---|
678 | }
|
---|
679 | ' > .tmp_src.cc
|
---|
680 | if test_compile "-lpam" pam pam nofatal; then
|
---|
681 | if test_execute nofatal; then
|
---|
682 | return 0;
|
---|
683 | fi
|
---|
684 | fi
|
---|
685 | test_header linux_pam
|
---|
686 | echo '
|
---|
687 | #include <cstdio>
|
---|
688 | #include <security/pam_appl.h>
|
---|
689 | extern "C" int main(void)
|
---|
690 | {
|
---|
691 | printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
|
---|
692 | if (__LINUX_PAM__ >= 1)
|
---|
693 | {
|
---|
694 | printf(", OK.\n");
|
---|
695 | return 0;
|
---|
696 | }
|
---|
697 | else
|
---|
698 | {
|
---|
699 | printf(", expected version 1.0 or higher\n");
|
---|
700 | return 1;
|
---|
701 | }
|
---|
702 | }
|
---|
703 | ' > .tmp_src.cc
|
---|
704 | if test_compile "-lpam" pam pam; then
|
---|
705 | test_execute
|
---|
706 | fi
|
---|
707 | }
|
---|
708 |
|
---|
709 | #
|
---|
710 | # Check for the SDL library, needed by VBoxSDL and VirtualBox
|
---|
711 | # We depend at least on version 1.2.7
|
---|
712 | #
|
---|
713 | function check_sdl()
|
---|
714 | {
|
---|
715 | test_header SDL
|
---|
716 | echo '
|
---|
717 | #include <cstdio>
|
---|
718 | #include <SDL/SDL.h>
|
---|
719 | #include <SDL/SDL_main.h>
|
---|
720 | extern "C" int main(void)
|
---|
721 | {
|
---|
722 | printf("found version %d.%d.%d",
|
---|
723 | SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
|
---|
724 | #if SDL_VERSION_ATLEAST(1,2,7)
|
---|
725 | printf(", OK.\n");
|
---|
726 | return 0;
|
---|
727 | #else
|
---|
728 | printf(", expected version 1.2.7 or higher\n");
|
---|
729 | return 1;
|
---|
730 | #endif
|
---|
731 | }
|
---|
732 | ' > .tmp_src.cc
|
---|
733 | if test_compile "$LIBSDL $LIBSDLMAIN ${INCSDL:+-I$INCSDL}" SDL SDL; then
|
---|
734 | if test_execute; then
|
---|
735 | cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l $LIBSDL`"
|
---|
736 | cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l $LIBSDLMAIN`"
|
---|
737 | [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
|
---|
738 | fi
|
---|
739 | fi
|
---|
740 | }
|
---|
741 |
|
---|
742 | #
|
---|
743 | # Check for the SDL_ttf library, needed by VBoxSDL (secure label)
|
---|
744 | #
|
---|
745 | function check_sdl_ttf()
|
---|
746 | {
|
---|
747 | test_header SDL_ttf
|
---|
748 | echo '
|
---|
749 | #include <cstdio>
|
---|
750 | #include <SDL/SDL_ttf.h>
|
---|
751 | #ifndef SDL_TTF_MAJOR_VERSION
|
---|
752 | #define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
|
---|
753 | #define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
|
---|
754 | #define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
|
---|
755 | #endif
|
---|
756 | extern "C" int main(void)
|
---|
757 | {
|
---|
758 | printf("found version %d.%d.%d",
|
---|
759 | SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
|
---|
760 | #if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
|
---|
761 | printf(", OK.\n");
|
---|
762 | return 0;
|
---|
763 | #else
|
---|
764 | printf(", expected version 2.0.6 or higher\n");
|
---|
765 | return 1;
|
---|
766 | #endif
|
---|
767 | }
|
---|
768 | ' > .tmp_src.cc
|
---|
769 | if test_compile "-lSDL_ttf" SDL_ttf SDL_ttf; then
|
---|
770 | test_execute
|
---|
771 | fi
|
---|
772 | }
|
---|
773 |
|
---|
774 | #
|
---|
775 | # Check for libasound, needed by the ALSA audio backend
|
---|
776 | #
|
---|
777 | function check_alsa()
|
---|
778 | {
|
---|
779 | test_header ALSA
|
---|
780 | echo '
|
---|
781 | #include <alsa/asoundlib.h>
|
---|
782 | extern "C" int main(void)
|
---|
783 | {
|
---|
784 | printf("found version %d.%d.%d",
|
---|
785 | SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
|
---|
786 | #if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
|
---|
787 | printf(", OK.\n");
|
---|
788 | return 0;
|
---|
789 | #else
|
---|
790 | printf(", expected version 1.0.6 or higher\n");
|
---|
791 | return 1;
|
---|
792 | #endif
|
---|
793 | }
|
---|
794 | ' > .tmp_src.cc
|
---|
795 | if test_compile "-lasound" asound asound; then
|
---|
796 | test_execute
|
---|
797 | fi
|
---|
798 | }
|
---|
799 |
|
---|
800 | #
|
---|
801 | # Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
|
---|
802 | #
|
---|
803 | function check_xcursor()
|
---|
804 | {
|
---|
805 | test_header Xcursor
|
---|
806 | echo '
|
---|
807 | #include <cstdio>
|
---|
808 | #include <X11/Xlib.h>
|
---|
809 | #include <X11/Xcursor/Xcursor.h>
|
---|
810 | extern "C" int main(void)
|
---|
811 | {
|
---|
812 | XcursorImage *cursor = XcursorImageCreate (10, 10);
|
---|
813 | XcursorImageDestroy(cursor);
|
---|
814 | return 0;
|
---|
815 | }
|
---|
816 | ' > .tmp_src.cc
|
---|
817 | if test_compile "$LIBX11 $LIBXCURSOR" Xcursor Xcursor; then
|
---|
818 | log_success "found"
|
---|
819 | cnf_append "LIB_XCURSOR" "`strip_l $LIBXCURSOR`"
|
---|
820 | fi
|
---|
821 | }
|
---|
822 |
|
---|
823 | #
|
---|
824 | # Check for the X libraries (Xext, X11)
|
---|
825 | #
|
---|
826 | function check_x()
|
---|
827 | {
|
---|
828 | test_header "X libraries"
|
---|
829 | echo '
|
---|
830 | #include <cstdio>
|
---|
831 | #include <X11/Xlib.h>
|
---|
832 | extern "C" int main(void)
|
---|
833 | {
|
---|
834 | Display *dpy;
|
---|
835 | int scrn_num;
|
---|
836 | Screen *scrn;
|
---|
837 | Window win;
|
---|
838 |
|
---|
839 | dpy = XOpenDisplay(NULL);
|
---|
840 | scrn_num = DefaultScreen(dpy);
|
---|
841 | scrn = ScreenOfDisplay(dpy, scrn_num);
|
---|
842 | win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
|
---|
843 | 0, 16, InputOutput, CopyFromParent, 0, NULL);
|
---|
844 | XDestroyWindow(dpy, win);
|
---|
845 | }
|
---|
846 | ' > .tmp_src.cc
|
---|
847 | if test_compile "$LIBX11" Xlibs Xlibs; then
|
---|
848 | log_success "found"
|
---|
849 | fi
|
---|
850 | }
|
---|
851 |
|
---|
852 | #
|
---|
853 | # Check for the QT library, needed by VirtualBox
|
---|
854 | #
|
---|
855 | function check_qt()
|
---|
856 | {
|
---|
857 | test_header Qt
|
---|
858 | echo '
|
---|
859 | #include <cstdio>
|
---|
860 | #include <qglobal.h>
|
---|
861 | extern "C" int main(void)
|
---|
862 | {
|
---|
863 | printf("found version %s", QT_VERSION_STR);
|
---|
864 | #if QT_VERSION >= 0x030305
|
---|
865 | printf(", OK.\n");
|
---|
866 | return 0;
|
---|
867 | #elif QT_VERSION >= 0x030300
|
---|
868 | printf("\n ** WARNING: QT < 3.3.5 has known problems!\n");
|
---|
869 | #else
|
---|
870 | printf(", expected version 3.3.0 or higher\n");
|
---|
871 | return 1;
|
---|
872 | #endif
|
---|
873 | }
|
---|
874 | ' > .tmp_src.cc
|
---|
875 | found_qt=0
|
---|
876 | libs="lib"
|
---|
877 | [ "$LIB" = "lib64" ] && libs="$libs lib64"
|
---|
878 | for q in $QTDIR; do
|
---|
879 | for l in $libs; do
|
---|
880 | echo "compiling the following source file:" >> $LOG
|
---|
881 | cat .tmp_src.cc >> $LOG
|
---|
882 | echo "using the following command line:" >> $LOG
|
---|
883 | echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt" >> $LOG
|
---|
884 |
|
---|
885 | $CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt >> $LOG 2>&1
|
---|
886 | if (($?==0)); then
|
---|
887 | if test_execute; then
|
---|
888 | cnf_append "QTDIR" "`cd $q ; pwd`"
|
---|
889 | found_qt=1
|
---|
890 | break
|
---|
891 | fi
|
---|
892 | fi
|
---|
893 | done
|
---|
894 | if (($found_qt==1)); then
|
---|
895 | break
|
---|
896 | fi
|
---|
897 | done
|
---|
898 | if (($found_qt!=1)); then
|
---|
899 | echo -e "\n Qt not found at \"$QTDIR\" or Qt headers not found"
|
---|
900 | echo " Check the file $LOG for detailed error information."
|
---|
901 | fail
|
---|
902 | return 1
|
---|
903 | fi
|
---|
904 | test_header "Qt devtools"
|
---|
905 | if check_avail "$q/bin/moc" QTDIR/bin; then
|
---|
906 | moc_ver=`$q/bin/moc 2>&1 -v|sed 's+^.*(Qt \(.*\))+\1+'`
|
---|
907 | if (($?!=0)); then
|
---|
908 | log_failure "not found"
|
---|
909 | fail
|
---|
910 | else
|
---|
911 | log_success "found version $moc_ver"
|
---|
912 | fi
|
---|
913 | fi
|
---|
914 | }
|
---|
915 |
|
---|
916 | #
|
---|
917 | # Check for Linux sources
|
---|
918 | #
|
---|
919 | function check_linux()
|
---|
920 | {
|
---|
921 | test_header "Linux kernel sources"
|
---|
922 | echo '
|
---|
923 | #include <linux/version.h>
|
---|
924 | int printf(const char *format, ...);
|
---|
925 | int main(void)
|
---|
926 | {
|
---|
927 | printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
|
---|
928 | (LINUX_VERSION_CODE % 65536) / 256,
|
---|
929 | LINUX_VERSION_CODE % 256);
|
---|
930 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
|
---|
931 | printf(", OK.\n");
|
---|
932 | return 0;
|
---|
933 | #else
|
---|
934 | printf(", expected version 2.4.0 or higher\n");
|
---|
935 | return 1;
|
---|
936 | #endif
|
---|
937 | }
|
---|
938 | ' > .tmp_src.c
|
---|
939 | echo "compiling the following source file:" >> $LOG
|
---|
940 | cat .tmp_src.c >> $LOG
|
---|
941 | echo "using the following command line:" >> $LOG
|
---|
942 | echo "$CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
|
---|
943 | $CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
|
---|
944 | if (($?!=0)); then
|
---|
945 | echo -e "\n Linux kernel headers not found at $LINUX"
|
---|
946 | echo " Check the file $LOG for detailed error information."
|
---|
947 | fail
|
---|
948 | else
|
---|
949 | if test_execute; then
|
---|
950 | cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
|
---|
951 | fi
|
---|
952 | fi
|
---|
953 | }
|
---|
954 |
|
---|
955 | #
|
---|
956 | # Check for kchmviewer, needed to display the online help
|
---|
957 | #
|
---|
958 | function check_kchmviewer()
|
---|
959 | {
|
---|
960 | test_header kchmviewer
|
---|
961 | if check_avail "$KCHMVIEWER" KCHMVIEWER; then
|
---|
962 | kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
|
---|
963 | if (($?!=0)); then
|
---|
964 | log_failure "not found"
|
---|
965 | fail
|
---|
966 | else
|
---|
967 | log_success "found version $kchmviewer_ver"
|
---|
968 | fi
|
---|
969 | fi
|
---|
970 | }
|
---|
971 |
|
---|
972 | #
|
---|
973 | # Check for the kBuild tools, we don't support GNU make
|
---|
974 | #
|
---|
975 | function check_kbuild()
|
---|
976 | {
|
---|
977 | test_header kBuild
|
---|
978 | if check_avail "$KBUILDDIR_BIN/kmk" KBUILDDIR really; then
|
---|
979 | log_success "found"
|
---|
980 | echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
|
---|
981 | echo "export BUILD_PLATFORM_ARCH=\"$MACHINE\"" >> $ENV
|
---|
982 | echo "export BUILD_TARGET=\"$OS\"" >> $ENV
|
---|
983 | echo "export BUILD_TARGET_ARCH=\"$MACHINE\"" >> $ENV
|
---|
984 | echo "export BUILD_TARGET_CPU=\"$CPU\"" >> $ENV
|
---|
985 | echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
|
---|
986 | echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
|
---|
987 | echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
|
---|
988 | echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
|
---|
989 | echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
|
---|
990 | echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
|
---|
991 | echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
|
---|
992 | echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
|
---|
993 | echo "export PATH" >> $ENV
|
---|
994 | echo "unset path_kbuild_bin path_dev_bin" >> $ENV
|
---|
995 | fi
|
---|
996 | }
|
---|
997 |
|
---|
998 |
|
---|
999 | #
|
---|
1000 | # Check for compiler.h
|
---|
1001 | # Some Linux distributions include "compiler.h" in their libc linux
|
---|
1002 | # headers package, some don't. Most don't need it, building might (!)
|
---|
1003 | # not succeed on openSUSE without it.
|
---|
1004 | #
|
---|
1005 | # See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
|
---|
1006 | #
|
---|
1007 | function check_compiler_h
|
---|
1008 | {
|
---|
1009 | test_header compiler.h
|
---|
1010 | if ! test -f "/usr/include/linux/compiler.h"; then
|
---|
1011 | cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
|
---|
1012 | log_success "compiler.h not found"
|
---|
1013 | else
|
---|
1014 | log_success "compiler.h found"
|
---|
1015 | fi
|
---|
1016 | }
|
---|
1017 |
|
---|
1018 |
|
---|
1019 | #
|
---|
1020 | # Check for the libhal library for obtaining hardware information on Linux
|
---|
1021 | #
|
---|
1022 | function check_libhal()
|
---|
1023 | {
|
---|
1024 | test_header libhal
|
---|
1025 | pc_cflagshal=`pkg-config hal --cflags 2>/dev/null`
|
---|
1026 | pc_libhal=`pkg-config hal --libs-only-l 2>/dev/null`
|
---|
1027 | pc_libpathhal=`pkg-config hal --libs-only-L 2>/dev/null`
|
---|
1028 | pc_verhal=`pkg-config hal --modversion 2>/dev/null`
|
---|
1029 | if [ ! -z "$pc_cflagshal" ]; then # is this acceptable?
|
---|
1030 | CFLAGSHAL=$pc_cflagshal
|
---|
1031 | LIBPATHHAL=$pc_libpathhal
|
---|
1032 | LIBHAL=$pc_libhal
|
---|
1033 | fi
|
---|
1034 | echo '
|
---|
1035 | #include <cstdio>
|
---|
1036 | #include <libhal.h>
|
---|
1037 | extern "C" int main(void)
|
---|
1038 | {
|
---|
1039 | DBusError dbusError;
|
---|
1040 | dbus_error_init (&dbusError);
|
---|
1041 | LibHalContext *halContext = libhal_ctx_new();
|
---|
1042 | if (halContext != 0)
|
---|
1043 | {
|
---|
1044 | libhal_ctx_free(halContext);
|
---|
1045 | }
|
---|
1046 | return 0;
|
---|
1047 | }
|
---|
1048 | ' > .tmp_src.cc
|
---|
1049 | if test_compile "$CFLAGSHAL $LIBPATHHAL $LIBHAL" libhal libhal; then
|
---|
1050 | log_success "found version $pc_verhal"
|
---|
1051 | cnf_append "LIB_HAL_CFLAGS" "$CFLAGSHAL"
|
---|
1052 | cnf_append "LIB_HAL_LIBS" "`strip_l $LIBHAL`"
|
---|
1053 | cnf_append "LIB_HAL_LIBPATH" "`strip_L $LIBPATHHAL`"
|
---|
1054 | cnf_append "VBOX_WITH_LIBHAL" "1"
|
---|
1055 | fi
|
---|
1056 | }
|
---|
1057 |
|
---|
1058 |
|
---|
1059 | #
|
---|
1060 | # Show help
|
---|
1061 | #
|
---|
1062 | function show_help()
|
---|
1063 | {
|
---|
1064 | cat << EOF
|
---|
1065 | Usage: ./configure [OPTIONS]...
|
---|
1066 |
|
---|
1067 | Configuration:
|
---|
1068 | -h, --help display this help and exit
|
---|
1069 | --nofatal don't abort on errors
|
---|
1070 | --disable-xpcom disable XPCOM and related stuff
|
---|
1071 | --disable-sdl-ttf disable SDL_ttf detection
|
---|
1072 | --build-xalan build xalan & xerces from shipped sources
|
---|
1073 | --without-hal do not use libhal, even if it is available
|
---|
1074 |
|
---|
1075 | Paths:
|
---|
1076 | --with-gcc=PATH location of the gcc compiler [$CC]
|
---|
1077 | --with-g++=PATH location of the g++ compiler [$CXX]
|
---|
1078 | --with-kbuild=DIR kbuild directory [$KBUILDDIR]
|
---|
1079 | --with-iasl=PATH location of the iasl compiler [$IASL]
|
---|
1080 | --with-hal-cflags=FLAGS cflags for libhal [$CFLAGSHAL]
|
---|
1081 | --with-hal=LIB location of the libhal libraries [$LIBHAL]
|
---|
1082 | --with-linux=DIR Linux kernel source directory [$LINUX]
|
---|
1083 | --with-mkisofs=PATH location of mkisofs [$MKISOFS]
|
---|
1084 | --with-qt-dir=DIR directory for QT headers/libraries [$QTDIR]
|
---|
1085 | --with-xalan=LIB location of the xalan library [$LIBXALAN]
|
---|
1086 | --with-xerces=LIB location of the xerces library [$LIBXERCES]
|
---|
1087 |
|
---|
1088 | Build type:
|
---|
1089 | -d, --build-debug build with debugging symbols and assertions
|
---|
1090 | EOF
|
---|
1091 | exit 0
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 |
|
---|
1095 | #
|
---|
1096 | # The body.
|
---|
1097 | #
|
---|
1098 |
|
---|
1099 | # scan command line options
|
---|
1100 | for option; do
|
---|
1101 | case "$option" in
|
---|
1102 | --help|-help|-h)
|
---|
1103 | show_help
|
---|
1104 | ;;
|
---|
1105 | --nofatal)
|
---|
1106 | nofatal=1
|
---|
1107 | ;;
|
---|
1108 | --with-gcc=*)
|
---|
1109 | CC=`echo $option | cut -d'=' -f2`
|
---|
1110 | ;;
|
---|
1111 | --with-g++=*)
|
---|
1112 | CXX=`echo $option | cut -d'=' -f2`
|
---|
1113 | ;;
|
---|
1114 | --with-kbuild=*)
|
---|
1115 | KBUILDDIR=`echo $option | cut -d'=' -f2`
|
---|
1116 | if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
|
---|
1117 | echo "Error: KBUILDDIR contains invalid characters!"
|
---|
1118 | exit 1
|
---|
1119 | fi
|
---|
1120 | ;;
|
---|
1121 | --with-qt-dir=*)
|
---|
1122 | QTDIR=`echo $option | cut -d'=' -f2`
|
---|
1123 | ;;
|
---|
1124 | --with-hal-dir=*)
|
---|
1125 | INCHAL=`echo $option | cut -d'=' -f2`
|
---|
1126 | ;;
|
---|
1127 | --with-hal=*)
|
---|
1128 | LIBHAL=`echo $option | cut -d'=' -f2`
|
---|
1129 | ;;
|
---|
1130 | --with-iasl=*)
|
---|
1131 | IASL=`echo $option | cut -d'=' -f2`
|
---|
1132 | ;;
|
---|
1133 | --with-linux=*)
|
---|
1134 | LINUX=`echo $option | cut -d'=' -f2`
|
---|
1135 | ;;
|
---|
1136 | --with-mkisofs=*)
|
---|
1137 | MKISOFS=`echo $option | cut -d'=' -f2`
|
---|
1138 | ;;
|
---|
1139 | --with-xalan=*)
|
---|
1140 | LIBXALAN=`echo $option | cut -d'=' -f2`
|
---|
1141 | ;;
|
---|
1142 | --with-xerces=*)
|
---|
1143 | LIBXERCES=`echo $option | cut -d'=' -f2`
|
---|
1144 | ;;
|
---|
1145 | --disable-xpcom)
|
---|
1146 | WITH_XPCOM=0
|
---|
1147 | ;;
|
---|
1148 | --disable-sdl-ttf)
|
---|
1149 | WITH_SDL_TTF=0
|
---|
1150 | ;;
|
---|
1151 | --disable-qt)
|
---|
1152 | WITH_QT=0
|
---|
1153 | ;;
|
---|
1154 | --without-hal)
|
---|
1155 | WITH_HAL=0
|
---|
1156 | ;;
|
---|
1157 | --build-debug|-d)
|
---|
1158 | BUILD_TYPE=debug
|
---|
1159 | ;;
|
---|
1160 | --build-xalan)
|
---|
1161 | LIBXERCES=``
|
---|
1162 | LIBXALAN=``
|
---|
1163 | ;;
|
---|
1164 | --ose)
|
---|
1165 | OSE=2
|
---|
1166 | ;;
|
---|
1167 | --odir=*)
|
---|
1168 | ODIR=`echo $option | cut -d'=' -f2`
|
---|
1169 | ;;
|
---|
1170 | *)
|
---|
1171 | echo
|
---|
1172 | echo "Unrecognized option \"$option\""
|
---|
1173 | echo
|
---|
1174 | show_help
|
---|
1175 | ;;
|
---|
1176 | esac
|
---|
1177 | done
|
---|
1178 |
|
---|
1179 | LOG="${ODIR:+$ODIR/}$LOG"
|
---|
1180 | ENV="${ODIR:+$ODIR/}$ENV"
|
---|
1181 | CNF="${ODIR:+$ODIR/}$CNF"
|
---|
1182 |
|
---|
1183 | # initialize output files
|
---|
1184 | cat > $LOG << EOF
|
---|
1185 | # Log file generated by
|
---|
1186 | #
|
---|
1187 | # '$0 $*'
|
---|
1188 | #
|
---|
1189 |
|
---|
1190 | EOF
|
---|
1191 | cat > $CNF << EOF
|
---|
1192 | # -*- Makefile -*-
|
---|
1193 | #
|
---|
1194 | # automatically generated by
|
---|
1195 | #
|
---|
1196 | # '$0 $*'
|
---|
1197 | #
|
---|
1198 | # It will be completely overwritten if configure is executed again.
|
---|
1199 | #
|
---|
1200 |
|
---|
1201 | EOF
|
---|
1202 | cat > $ENV << EOF
|
---|
1203 | #!/bin/bash
|
---|
1204 | #
|
---|
1205 | # automatically generated by
|
---|
1206 | #
|
---|
1207 | # '$0 $*'
|
---|
1208 | #
|
---|
1209 | # It will be completely overwritten if configure is executed again.
|
---|
1210 | # Make sure you source this file once before you start to build VBox.
|
---|
1211 | #
|
---|
1212 |
|
---|
1213 | EOF
|
---|
1214 |
|
---|
1215 | # test if we are OSE
|
---|
1216 | if (($OSE==1)) && [ -d "`cd $(dirname $0); pwd`/src/VBox/Devices/USB" ]; then
|
---|
1217 | echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
|
---|
1218 | echo >> $LOG
|
---|
1219 | OSE=0
|
---|
1220 | fi
|
---|
1221 |
|
---|
1222 | # first determine our environment
|
---|
1223 | check_environment
|
---|
1224 | check_kbuild
|
---|
1225 |
|
---|
1226 | # some things are not available in for OSE
|
---|
1227 | if (($OSE)); then
|
---|
1228 | cnf_append "VBOX_OSE" "1"
|
---|
1229 | cnf_append "VBOX_WITH_TESTSUITE" ""
|
---|
1230 | cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
|
---|
1231 |
|
---|
1232 | if [ "$OS" = "linux" ]; then
|
---|
1233 | cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
|
---|
1234 | else
|
---|
1235 | cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
|
---|
1236 | fi
|
---|
1237 | echo >> $CNF
|
---|
1238 | fi
|
---|
1239 |
|
---|
1240 | # emit disable directives corresponding to any --disable-xxx options.
|
---|
1241 | (($WITH_XPCOM==0)) && cnf_append "VBOX_WITH_MAIN" ""
|
---|
1242 | (($WITH_QT==0)) && cnf_append "VBOX_WITH_QTGUI" ""
|
---|
1243 | (($WITH_SDL_TTF==0)) && cnf_append "VBOX_WITH_SECURELABEL" ""
|
---|
1244 |
|
---|
1245 | # append the tools directory to the default search path
|
---|
1246 | echo "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
|
---|
1247 |
|
---|
1248 | # append some extra paths
|
---|
1249 | PATH="$PATH:/opt/gnome/bin"
|
---|
1250 |
|
---|
1251 | # the tools
|
---|
1252 | check_gcc
|
---|
1253 | [ "$OS" != "darwin" ] && check_as86
|
---|
1254 | [ "$OS" != "darwin" ] && check_bcc
|
---|
1255 | [ "$OS" != "darwin" ] && check_iasl
|
---|
1256 | # don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
|
---|
1257 | # [ "$OS" != "darwin" ] && check_yasm
|
---|
1258 | [ "$OS" != "darwin" ] && check_xsltproc
|
---|
1259 | (($OSE==0)) && check_mkisofs
|
---|
1260 |
|
---|
1261 | # the libraries
|
---|
1262 | [ "$OS" != "darwin" ] && check_pthread
|
---|
1263 | (($WITH_XPCOM==1)) && check_xalan
|
---|
1264 | (($WITH_XPCOM==1)) && check_xerces
|
---|
1265 | (($WITH_LIBIDL==1)) && check_libidl
|
---|
1266 | (($OSE==0)) && check_ssl
|
---|
1267 | [ "$OS" != "darwin" ] && check_z
|
---|
1268 | (($OSE==0)) && check_png
|
---|
1269 | (($OSE==0)) && [ "$OS" = "linux" ] && check_pam
|
---|
1270 | [ "$OS" != "darwin" ] && check_sdl
|
---|
1271 | (($WITH_SDL_TTF==1)) && (($OSE==0)) && check_sdl_ttf
|
---|
1272 | [ "$OS" != "darwin" ] && check_alsa
|
---|
1273 | [ "$OS" != "darwin" ] && check_x
|
---|
1274 | [ "$OS" != "darwin" ] && check_xcursor
|
---|
1275 | (($WITH_QT==1)) && check_qt
|
---|
1276 |
|
---|
1277 | # Linux-specific
|
---|
1278 | [ "$OS" = "linux" ] && check_linux
|
---|
1279 | [ "$OS" = "linux" ] && check_compiler_h
|
---|
1280 | [ "$OS" = "linux" -a "$WITH_HAL" = "1" ] && check_libhal
|
---|
1281 |
|
---|
1282 | # success!
|
---|
1283 | echo
|
---|
1284 | echo "Successfully generated '$CNF' and '$ENV'."
|
---|
1285 | echo "Source '$ENV' once before you start to build VBox:"
|
---|
1286 | echo ""
|
---|
1287 | echo " source $ENV"
|
---|
1288 | echo " kmk"
|
---|
1289 | echo ""
|
---|
1290 | if [ "$OS" = "linux" ]; then
|
---|
1291 | echo "To compile the kernel module, do:"
|
---|
1292 | echo ""
|
---|
1293 | echo " cd ./out/$OS.$MACHINE/$BUILD_TYPE/bin/src"
|
---|
1294 | echo " make"
|
---|
1295 | echo ""
|
---|
1296 | fi
|
---|
1297 | echo "Enjoy!"
|
---|
1298 | cleanup
|
---|