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