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