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