VirtualBox

source: vbox/trunk/configure@ 59

Last change on this file since 59 was 24, checked in by vboxsync, 18 years ago

AMD64 warning.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette