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