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