configure revision 3ce63e79b7b0a95c5fb4240af3f8c5768607b88d
# The purpose of this script is to check for all external tools, headers, and # libraries VBox OSE depends on. # Copyright (C) 2006-2007 Sun Microsystems, Inc. # This file is part of VirtualBox Open Source Edition (OSE), as # you can redistribute it and/or modify it under the terms of the GNU # General Public License as published by the Free Software Foundation, # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE # distribution. VirtualBox OSE is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY of any kind. # append some extra paths # Solaris (order of paths important for tr, echo, grep, sed to work) # Wrapper for ancient /usr/bin/which on darwin that always returns 0 # the restricting tool is ar (mri mode). echo "Error: VBox base path contains invalid characters!" # darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it. if [
"`uname`" =
"Darwin" ];
then if [ -z "$nofatal" -o "x$1" != "x" ]; then if [ -n "$1" ]; then $ECHO_N "$1, "; fi echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g' echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g' echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g' echo "***** Checking $1 *****" >> $LOG echo "compiling the following source file:" >> $LOG echo "using the following command line:" >> $LOG echo " $2 not found at $1 or $3 headers not found" echo " Check the file $LOG for detailed error information." # Execute a compiled test binary echo "executing the binary" >> $LOG # Execute a compiled test binary echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG # Check for OS, MACHINE, CPU if [ "$OS" != "solaris" ]; then # on AMD64 systems, 64bit libs are usually located in /usr/lib64 # Solaris doesn't seem to subscribe to fhs, libs are usually in # a '64' subdirectory of the standard 'lib' dirs while some 64-bit # alternative binaries can be found in 'amd64' subdirs of the 'bin' # ones. So, in order to find the right stuff (esp. sdl-config) we'll # have to make sure the */bin/amd64 dirs are searched before the */bin # ones. (The sed has some sideeffects, but they shouldn't harm us...) echo "64-bit Solaris detected, hacking the PATH" >> $LOG PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \ -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' ` echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV echo "export BUILD_TARGET=\"$OS\"" >> $ENV # Check for gcc with version >= 3.2. # We depend on a working gcc, if we fail terminate in every case. # gcc-4.0 is allowed for Darwin only if [ "$CC" != "gcc" ]; then if [ "$CXX" != "g++" ]; then if [ "$CC32" != "gcc -m32" ]; then if [ "$CXX32" != "g++ -m32" ]; then # this isn't not necessary, there is not such tool. # Solaris sports a 32-bit gcc/g++. [ "$CC" = "gcc" ] && CC="gcc -m64" [ "$CXX" = "g++" ] && CXX="g++ -m64" # Check for the bcc compiler, needed for compiling the BIOS echo "compiling the following source file:" >> $LOG echo "using the following command line:" >> $LOG # Check for the as86 assembler, needed for compiling the BIOS # Check for yasm, needed to compile assembler files # Check for the iasl ACPI compiler, needed to compile vbox.dsl # Check for xsltproc, needed by Main # Check for mkisofs, needed to build the CDROM image containing the additions # Check for libxml2, needed by VBoxSettings # 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release) #include <libxml/xmlversion.h> extern "C" int main(void) printf("found version %s", LIBXML_DOTTED_VERSION); #if LIBXML_VERSION >= 20626 printf(", expected version 2.6.26 or higher\n"); #include <libxml/xmlversion.h> extern "C" int main(void) printf("found version %s", LIBXML_DOTTED_VERSION); #if LIBXML_VERSION >= 20626 printf(", expected version 2.6.26 or higher\n"); # Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.17. # This library is available on Ubuntu Edgy which fulfils the minimal libxml2 #include <libxslt/xsltconfig.h> extern "C" int main(void) printf("found version %s", LIBXSLT_DOTTED_VERSION); #if LIBXSLT_VERSION >= 10117 printf(", expected version 1.1.17 or higher\n"); #include <libxslt/xsltconfig.h> extern "C" int main(void) printf("found version %s", LIBXSLT_DOTTED_VERSION); #if LIBXSLT_VERSION >= 10117 printf(", expected version 1.1.17 or higher\n"); # Check for libIDL, needed by xpcom # Check for openssl, needed for RDP #include <openssl/opensslv.h> extern "C" int main(void) printf("found version %s", OPENSSL_VERSION_TEXT); #if OPENSSL_VERSION_NUMBER >= 0x0090700 printf(", expected version 0.9.7 or higher\n"); # Check for pthread, needed by VBoxSVC, frontends, ... extern "C" int main(void) if (pthread_mutex_init(&mutex, NULL)) { printf("pthread_mutex_init() failed\n"); if (pthread_mutex_lock(&mutex)) { printf("pthread_mutex_lock() failed\n"); if (pthread_mutex_unlock(&mutex)) { printf("pthread_mutex_unlock() failed\n"); # Check for zlib, needed by VBoxSVC, Runtime, ... extern "C" int main(void) printf("found version %s", ZLIB_VERSION); #if ZLIB_VERNUM >= 0x1210 printf(", expected version 1.2.1 or higher\n"); # Check for libpng, needed by kchmviewer extern "C" int main(void) printf("found version %s", PNG_LIBPNG_VER_STRING); #if PNG_LIBPNG_VER >= 10205 printf(", expected version 1.2.5 or higher\n"); # if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then # if test_execute nofatal; then # Check for pam, needed by VRDPAuth # Version 79 was introduced in 9/2005, do we support older versions? # OpenSUSE comes with 0.99.xxx where they changed the versioning scheme. #include <security/pam_appl.h> extern "C" int main(void) printf("found version %d", __LIBPAM_VERSION); if (__LIBPAM_VERSION >= 76) printf(", expected version 76 or higher\n"); #include <security/pam_appl.h> extern "C" int main(void) printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__); printf(", expected version 1.0 or higher\n"); # Check for the SDL library, needed by VBoxSDL and VirtualBox # We depend at least on version 1.2.7 if [ "$OS" = "darwin" ]; then extern "C" int main(int argc, char** argv) printf("found version %d.%d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); #if SDL_VERSION_ATLEAST(1,2,7) printf(", expected version 1.2.7 or higher\n"); # Check for the SDL_ttf library, needed by VBoxSDL (secure label) #ifndef SDL_TTF_MAJOR_VERSION #define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION #define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION #define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL extern "C" int main(void) printf("found version %d.%d.%d", SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL); #if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006 printf(", expected version 2.0.6 or higher\n"); # Check for libasound, needed by the ALSA audio backend #include <alsa/asoundlib.h> extern "C" int main(void) printf("found version %d.%d.%d", SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR); #if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006 printf(", expected version 1.0.6 or higher\n"); #include <pulse/version.h> extern "C" int main(void) printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION); printf(", expected version 0.9.0 (API version 9) or higher\n"); # Check for the Xcursor library, needed by VBoxSDL and VBoxBFE #include <X11/Xcursor/Xcursor.h> extern "C" int main(void) XcursorImage *cursor = XcursorImageCreate (10, 10); XcursorImageDestroy(cursor); # Check for the X libraries (Xext, X11) extern "C" int main(void) dpy = XOpenDisplay(NULL); scrn_num = DefaultScreen(dpy); scrn = ScreenOfDisplay(dpy, scrn_num); win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100, 0, 16, InputOutput, CopyFromParent, 0, NULL); XDestroyWindow(dpy, win); # Check for the Qt4 library, needed by the VirtualBox frontend if [ "$OS" = "darwin" ]; then log_failure "Qt4 framework not found (can be disabled using --disable-qt4)" # default is to use pkg-config # this braindead path is necessary for mdv2008.1 # do it the old way (e.g. user has specified QT4DIR) extern "C" int main(void) printf("found version %s", QT_VERSION_STR); #if QT_VERSION >= 0x040300 printf(", expected version 4.3.0 or higher\n"); extern "C" int main(void) printf("found version %s", QT_VERSION_STR); #if QT_VERSION >= 0x040300 printf(", expected version 4.3.0 or higher\n"); if [ "$OS" != "darwin" ]; then # strip .../QtCore as we add components ourself # store only the first path, remove all other pathes # this is not quite right since the qt libpath does not have to be first... # Check whether static libstdc++ is installed extern "C" int main(void) # Check for Linux sources #include <linux/version.h> int printf(const char *format, ...); printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536, (LINUX_VERSION_CODE % 65536) / 256, LINUX_VERSION_CODE % 256); #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0) printf(", expected version 2.4.0 or higher\n"); echo "compiling the following source file:" >> $LOG echo "using the following command line:" >> $LOG echo " Linux kernel headers not found at $LINUX" echo " Check the file $LOG for detailed error information." # Check for kchmviewer, needed to display the online help # (unused as we ship kchmviewer) # Check for the kBuild tools, we don't support GNU make echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV if [ "$OS" = "solaris" ]; then # Because of sh being non-default shell in Solaris we need to export PATH again when # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly. echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV echo "export PATH" >> $ENV echo "unset path_kbuild_bin path_dev_bin" >> $ENV # check for installed kBuild # Some Linux distributions include "compiler.h" in their libc linux # headers package, some don't. Most don't need it, building might (!) # not succeed on openSUSE without it. # Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW # sockets for doing ICMP requests. #include <sys/capability.h> extern "C" int main(void) cap_t caps = cap_get_proc(); snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL)); # Check if we are able to build 32-bit applications (needed for the guest additions) echo "compiling the following source file:" >> $LOG echo "using the following command line:" >> $LOG echo " Cannot compile 32-bit applications (missing headers and/or libraries)!" echo " Check the file $LOG for detailed error information." extern "C" int main(void) printf("found version %s", PY_VERSION); #if PY_VERSION_HEX >= 0x02030000 printf(", expected version 2.3 or higher\n"); echo "compiling the following source file:" >> $LOG echo "using the following command line:" >> $LOG if [ -n "$found" ]; then break; fi if [ -n "$found" ]; then break; fi echo " wine binary not found" echo " wineprefixcreate not found" echo " wineprefixcreate failed" echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp echo '"itss"="native"' >> $tmp echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp echo '"itss"="native"' >> $tmp echo " failed to load registry changes (path)." # TODO: Check for libgsoap++.a/so log_failure "soapcpp2 not found -- disabling webservice" # Determines the Darwin version. # @todo This should really check the Xcode/SDK version. #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1" echo " failed to determin darwin version. (uname -r: $darwin_ver)" # Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc # is around to prevent confusion when the build fails in src/recompiler. echo " failed to find i386-elf-gcc" Usage: ./configure [OPTIONS]... -h, --help display this help and exit --nofatal don't abort on errors --disable-xpcom disable XPCOM and related stuff --disable-python disable python bindings --disable-sdl-ttf disable SDL_ttf detection --disable-alsa disable the ALSA sound backend --disable-pulse disable the PulseAudio backend --disable-dbus don't use DBus and hal for hardware detection --disable-kmods don't build Linux kernel modules (host and guest) --disable-hardening don't be strict about /dev/vboxdrv access --enable-webservice enable the webservice stuff --build-libxml2 build libxml2 from sources --build-libxslt build libxslt from sources --setup-wine setup a Wine directory and register the hhc hack --with-gcc=PATH location of the gcc compiler [$CC] --with-g++=PATH location of the g++ compiler [$CXX] --with-kbuild=DIR kbuild directory [$KBUILDDIR] --with-iasl=PATH location of the iasl compiler [$IASL] --with-linux=DIR Linux kernel source directory [$LINUX] --with-mkisofs=PATH location of mkisofs [$MKISOFS] --with-qt-dir=DIR directory for Qt4 headers/libraries [pkgconfig] --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so) --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h) --out-path=PATH the folder to which configuration and build output -d, --build-debug build with debugging symbols and assertions --build-profile build with profiling support --build-headless build headless (without any X11 frontend) # scan command line options echo "Error: KBUILDDIR contains invalid characters!" # This variable has not *yet* been overridden. That can still happen. echo "Unrecognized option \"$option\"" # initialize output files # automatically generated by # It will be completely overwritten if configure is executed again. # automatically generated by # It will be completely overwritten if configure is executed again. # Make sure you source this file once before you start to build VBox. echo "Found USB devices, assuming VBOX_OSE = FALSE" >>
$LOG echo "Creating DEBUG build!" >>
$LOG echo "Creating PROFILE build!" >>
$LOG # first determine our environment # append the tools directory to the default search path # if we will be writing to a different out directory then set this up now # some things are not available in for OSE if [
"$OS" =
"linux" ];
then if [
"$OS" =
"darwin" ];
then # On Darwin we want to build against Qt4 only. WITH_QT4 is enabled by # default so disable Qt3. --disable-qt disables both Qt3 and Qt4 GUI now, # --disable-qt4 disables only the Qt4 GUI (which is not appropriate for # Darwin as we disable the Qt3 here anyway. # (Qt3 builds for Intel Macs are usually not threaded or for X11. And they # don't contain our patches, which means the result isn't really usable.) # emit disable directives corresponding to any --disable-xxx options. # don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs # [ "$OS" != "darwin" ] && check_yasm # build openssl on Darwin in every case # TODO check for mesa-common-dev (GL/glx.h) # TODO check for libglu1-mesa-dev (GL/glu.h) if [
"$OS" =
"linux" ];
then if [
"$OS" =
"darwin" ];
then echo "Successfully generated '$CNF' and '$ENV'." echo "Source '$ENV' once before you start to build VBox:" if [
"$OS" =
"linux" ];
then echo "To compile the kernel module, do:" echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++" echo " Hardening is enabled which means that the VBox binaries will not run from" echo " the binary directory. The binaries have to be installed suid root and some" echo " more prerequisites have to be fulfilled which is normally done by installing" echo " the final package. For development, the hardening feature can be disabled" echo " by specifying the --disable-hardening parameter. Please never disable that" echo " feature for the final distribution!" echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++" echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++" echo " Hardening is disabled. Please do NOT build packages for distribution with" echo " disabled hardening!" echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"