configure revision 1f87655855174de7f44e9a661c594b4a05f0eb20
# The purpose of this script is to check for all external tools, headers, and
# libraries VBox OSE depends on.
#
# Copyright (C) 2006-2009 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) 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.
#
LC_ALL=C
export LC_ALL
# append some extra paths
# Solaris (order of paths important for tr, echo, grep, sed to work)
{
have_ancient_which="yes"
else
have_ancient_which="no"
fi
fi
echo "$retval"
unset retval
else
fi
}
;;
;;
;;
OS='solaris'
;;
*)
echo "Cannot determine OS!"
exit 1
;;
esac
#
# Defaults
#
OSE=1
OUT_PATH=""
TARGET_CPU=""
WITH_QT4=1
WITH_SDL=1
WITH_X11=1
WITH_VDE=0
WITH_VNC=0
CC="gcc"
CC32=""
CC64=""
CXX="g++"
CXX32=""
CXX64=""
BCC="bcc"
YASM="yasm"
IASL="iasl"
AS86="as86"
XSLTPROC="xsltproc"
GENISOIMAGE="genisoimage"
MKISOFS="mkisofs"
INCCRYPTO=""
LIBCRYPTO="-lcrypto"
LIBPTHREAD="-lpthread"
LIBCAP="-lcap"
GSOAP=""
GSOAP_IMPORT=""
LIBXCURSOR="-lXcursor"
LIBXMU="-lXmu"
LIBXINERAMA="-lXinerama"
LIBXRANDR="-lXrandr"
MAKESELF="makeself"
MESA="-lGL"
INCZ=""
LIBZ="-lz"
INCVNCSERVER=""
LIBVNCSERVER="-lvncserver"
CXX_FLAGS=""
if [ "$OS" = "freebsd" ]; then
else
INCCURL=""
LIBCURL="-lcurl"
INCPNG=""
LIBPNG="-lpng"
fi
QT4UIC3DIR="/usr/bin"
else
fi
KCHMVIEWER="kchmviewer"
BUILD_TYPE="release"
# the restricting tool is ar (mri mode).
INVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
echo "Error: VBox base path contains invalid characters!"
exit 1
fi
if [ "$OS" = "darwin" ]; then
else
ECHO_N="echo -n"
fi
cleanup()
{
}
fail()
{
echo "Check $LOG for details"
exit 1
fi
}
log()
{
echo "$1"
}
{
echo "OK."
echo >> $LOG
echo >> $LOG
}
{
echo
echo " ** $1!"
echo >> $LOG
}
{
}
strip_l()
{
}
strip_L()
{
}
strip_I()
{
}
prefix_I()
{
}
{
if [ -z "$1" ]; then
log_failure "$2 is empty"
fail $3
return 1
elif which_wrapper $1 > /dev/null; then
return 0
else
log_failure "$1 (variable $2) not found"
fail $3
return 1
fi
}
# Prepare a test
{
$ECHO_N "Checking for $1: "
}
# Compile a test
# $2 library name
# $3 package name
# $4 if this argument is 'nofatal', don't abort
{
$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
if [ $? -ne 0 ]; then
if [ -z "$4" ]; then
echo
echo " $2 not found at $1 or $3 headers not found"
echo " Check the file $LOG for detailed error information."
else
echo >> $LOG
echo >> $LOG
fi
return 1
fi
return 0
}
# Execute a compiled test binary
{
rc=$?
cat $ODIR.test_execute.log | tee -a $LOG
fail $1
return 1
fi
echo >> $LOG
echo >> $LOG
return 0
}
# Execute a compiled test binary
{
rc=$?
cat $ODIR.test_execute.log | tee -a $LOG
return 1
fi
echo >> $LOG
echo >> $LOG
return 0
}
#
# Check for OS, MACHINE, CPU
#
{
BUILD_MACHINE='x86'
LIB='lib'
;;
BUILD_MACHINE='amd64'
BUILD_CPU='k8'
# see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
LIB='lib64'
else
# 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
# ones. (The sed has some sideeffects, but they shouldn't harm us...)
-e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
export PATH
LIB='lib/64'
fi
;;
*)
log_failure "Cannot determine system"
exit 1
;;
esac
DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
}
#
# Check for gcc with version >= 3.2.
# We depend on a working gcc, if we fail terminate in every case.
#
{
if [ $? -ne 0 ]; then
log_failure "cannot execute '$CC -dumpversion'"
fi
if [ $? -ne 0 ]; then
log_failure "cannot execute '$CXX -dumpversion'"
fi
log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
log_success "found version $cc_ver"
# gcc-4.0 is allowed for Darwin only
log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<7"
else
log_success "found version $cc_ver"
fi
else
fi
fi
CC32="undefined"
CXX32="undefined"
fi
cnf_append "TOOL_GCC3_CC" "$CC"
cnf_append "TOOL_GCC3_AS" "$CC"
cnf_append "TOOL_GCC3_LD" "$CC"
cnf_append "TOOL_GXX3_CC" "$CC"
cnf_append "TOOL_GXX3_AS" "$CC"
fi
cnf_append "TOOL_GCC3_CXX" "$CXX"
cnf_append "TOOL_GXX3_CXX" "$CXX"
cnf_append "TOOL_GXX3_LD" "$CXX"
fi
cnf_append "TOOL_GCC32_CC" "$CC32"
cnf_append "TOOL_GCC32_AS" "$CC32"
cnf_append "TOOL_GCC32_LD" "$CC32"
cnf_append "TOOL_GXX32_CC" "$CC32"
cnf_append "TOOL_GXX32_AS" "$CC32"
fi
cnf_append "TOOL_GCC32_CXX" "$CXX32"
cnf_append "TOOL_GXX32_CXX" "$CXX32"
cnf_append "TOOL_GXX32_LD" "$CXX32"
fi
# this isn't not necessary, there is not such tool.
cnf_append "TOOL_GCC64_CC" "$CC64"
cnf_append "TOOL_GCC64_AS" "$CC64"
cnf_append "TOOL_GCC64_LD" "$CC64"
cnf_append "TOOL_GXX64_CC" "$CC64"
cnf_append "TOOL_GXX64_AS" "$CC64"
fi
cnf_append "TOOL_GCC64_CXX" "$CXX64"
cnf_append "TOOL_GXX64_CXX" "$CXX64"
cnf_append "TOOL_GXX64_LD" "$CXX64"
fi
# Solaris sports a 32-bit gcc/g++.
fi
fi
fi
}
#
# Check for the bcc compiler, needed for compiling the BIOS
#
{
if [ $? -ne 0 ]; then
log_failure "BCC not found"
else
cat > $ODIR.tmp_src.c << EOF
int foo(a)
int a;
{
return 0;
}
EOF
if [ $? -ne 0 ]; then
log_failure "BCC not working"
else
log_success "found version $bcc_ver"
cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
fi
unset bcc_path
unset bcc_dir
fi
fi
}
#
# Check for the as86 assembler, needed for compiling the BIOS
#
{
if [ $? -ne 0 ]; then
log_failure "as86 not found"
else
log_success "found version $as86_ver"
fi
fi
}
#
# Check for yasm, needed to compile assembler files
#
{
if [ $? -ne 0 ]; then
log_failure "yasm not found"
else
yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
if [ $yasm_ver_mul -lt 501 ]; then
log_failure "found version $yasm_ver, expected at least 0.5.1"
else
log_success "found version $yasm_ver"
fi
fi
fi
}
#
# Check for the iasl ACPI compiler, needed to compile vbox.dsl
#
{
if [ $? -ne 0 ]; then
log_failure "iasl not found"
else
log_success "found version $iasl_ver"
fi
fi
}
#
# Check for xsltproc, needed by Main
#
{
if [ $? -ne 0 ]; then
log_failure "xsltproc not found"
else
log_success "found"
fi
fi
}
#
# Check for mkisofs, needed to build the CDROM image containing the additions
#
{
if which_wrapper $GENISOIMAGE > /dev/null; then
if [ $? -ne 0 ]; then
log_failure "mkisofs not found"
else
log_success "found $mkisofs_ver"
fi
if [ $? -ne 0 ]; then
log_failure "mkisofs not working"
else
log_success "found $mkisofs_ver"
fi
fi
}
#
# Check for libxml2, needed by VBoxSettings and Runtime.
# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
#
{
if which_wrapper pkg-config > /dev/null; then
libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
if [ $? -ne 0 ]; then
log_failure "libxml2 not found"
else
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <libxml/xmlversion.h>
extern "C" int main(void)
{
printf("found version %s", LIBXML_DOTTED_VERSION);
#if LIBXML_VERSION >= 20626
printf(", OK.\n");
return 0;
#else
printf(", expected version 2.6.26 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
fi
fi
fi
elif which_wrapper xml2-config; then
libxml2_ver=`xml2-config --version`
if [ $? -ne 0 ]; then
log_failure "xml2-config not found"
else
log_success "found version $libxml2_ver"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <libxml/xmlversion.h>
extern "C" int main(void)
{
printf("found version %s", LIBXML_DOTTED_VERSION);
#if LIBXML_VERSION >= 20626
printf(", OK.\n");
return 0;
#else
printf(", expected version 2.6.26 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
fi
fi
fi
else
log_failure "neither pkg-config nor xml2-config found"
fi
fi
}
#
# Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.15,
# as Solaris right now has no newer version and it definitely works.
# 1.1.17 is available on Ubuntu Edgy which fulfils the minimal libxml2
# requirement (2.6.26).
#
{
if which_wrapper pkg-config > /dev/null; then
libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
if [ $? -ne 0 ]; then
log_failure "libxslt not found"
else
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <libxslt/xsltconfig.h>
extern "C" int main(void)
{
printf("found version %s", LIBXSLT_DOTTED_VERSION);
#if LIBXSLT_VERSION >= 10117
printf(", OK.\n");
return 0;
#else
printf(", expected version 1.1.17 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
fi
fi
fi
elif which_wrapper xslt-config; then
libxslt_ver=`xslt-config --version`
if [ $? -ne 0 ]; then
log_failure "xslt-config not working"
else
log_success "found version $libxslt_ver"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <libxslt/xsltconfig.h>
extern "C" int main(void)
{
printf("found version %s", LIBXSLT_DOTTED_VERSION);
#if LIBXSLT_VERSION >= 10117
printf(", OK.\n");
return 0;
#else
printf(", expected version 1.1.17 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
fi
fi
fi
else
log_failure "neither pkg-config nor xslt-config found"
fi
fi
}
#
# Check for libIDL, needed by xpcom
#
{
if which_wrapper libIDL-config-2 > /dev/null; then
libidl_ver=`libIDL-config-2 --version`
if [ $? -ne 0 ]; then
log_failure "libIDL-config-2 not working"
else
log_success "found version $libidl_ver"
fi
if [ $? -ne 0 ]; then
log_failure "libIDL-config not working"
else
log_success "found version $libidl_ver"
fi
fi
}
#
# Check for openssl, needed for RDP and S3
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <openssl/opensslv.h>
extern "C" int main(void)
{
printf("found version %s", OPENSSL_VERSION_TEXT);
#if OPENSSL_VERSION_NUMBER >= 0x00908000
printf(", OK.\n");
return 0;
#else
printf(", expected version 0.9.8 or higher\n");
return 1;
#endif
}
EOF
if test_execute nofatal; then
fi
fi
fi
}
#
# Check for pthread, needed by VBoxSVC, frontends, ...
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <pthread.h>
extern "C" int main(void)
{
pthread_mutex_t mutex;
if (pthread_mutex_init(&mutex, NULL)) {
printf("pthread_mutex_init() failed\n");
return 1;
}
if (pthread_mutex_lock(&mutex)) {
printf("pthread_mutex_lock() failed\n");
return 1;
}
if (pthread_mutex_unlock(&mutex)) {
printf("pthread_mutex_unlock() failed\n");
return 1;
}
printf("found, OK.\n");
}
EOF
if test_compile $LIBPTHREAD pthread pthread; then
if test_execute; then
fi
fi
}
#
# Check for zlib, needed by VBoxSVC, Runtime, ...
#
check_z()
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <zlib.h>
extern "C" int main(void)
{
printf("found version %s", ZLIB_VERSION);
#if ZLIB_VERNUM >= 0x1210
printf(", OK.\n");
return 0;
#else
printf(", expected version 1.2.1 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append " SDK_VBOX_ZLIB_INCS" "$INCZ"
fi
fi
}
#
# Check for libpng, needed by kchmviewer
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <png.h>
extern "C" int main(void)
{
printf("found version %s", PNG_LIBPNG_VER_STRING);
#if PNG_LIBPNG_VER >= 10205
printf(", OK.\n");
return 0;
#else
printf(", expected version 1.2.5 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
fi
fi
}
#
# Check for libvncserver, needed for VNC in OSE
#
{
cat > $ODIR.tmp_src.cc <<EOF
#include <cstdio>
#include <rfb/rfbconfig.h>
extern "C" int main()
{
const char* v=LIBVNCSERVER_VERSION;
unsigned int major = 0, minor = 0, micro = 0;
for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
if (*v == '.') v++;
for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
if (*v == '.') v++;
for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
if (major*10000 + minor*100 + micro >= 907)
{
printf(", OK.\n");
return 0;
}
else
{
printf(", expected version 0.9.7 or higher\n");
return 1;
}
}
EOF
if test_execute; then
cnf_append "VBOX_WITH_VNC" "1"
fi
fi
}
#
# Check for libcurl, needed by S3
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <curl/curl.h>
extern "C" int main(void)
{
printf("found version %s", LIBCURL_VERSION);
#if 10000*LIBCURL_VERSION_MAJOR + 100*LIBCURL_VERSION_MINOR + LIBCURL_VERSION_PATCH >= 71601
printf(", OK.\n");
return 0;
#else
printf(", expected version 7.16.1 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
cnf_append "SDK_VBOX_LIBCURL_INCS" "$INCCURL"
fi
fi
fi
}
#
# 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.
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <security/pam_appl.h>
extern "C" int main(void)
{
printf("found version %d", __LIBPAM_VERSION);
if (__LIBPAM_VERSION >= 76)
{
printf(", OK.\n");
return 0;
}
else
{
printf(", expected version 76 or higher\n");
return 1;
}
}
EOF
if test_execute nofatal; then
return 0;
fi
fi
echo "pam0.x not found"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <security/pam_appl.h>
extern "C" int main(void)
{
printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
if (__LINUX_PAM__ >= 1)
{
printf(", OK.\n");
return 0;
}
else
{
printf(", expected version 1.0 or higher\n");
return 1;
}
}
EOF
fi
}
#
# Check for the SDL library, needed by VBoxSDL and VirtualBox
# We depend at least on version 1.2.7
#
{
fi
foundsdl=1
INCSDL="$PATH_SDK_LIBSDL/Headers"
FLDSDL="-framework SDL"
else
log_failure "SDL framework not found"
fi
else
if which_wrapper sdl-config > /dev/null; then
LIBSDLMAIN="-lSDLmain"
foundsdl=1
fi
fi
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <SDL.h>
#include <SDL_main.h>
#undef main
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(", OK.\n");
return 0;
#else
printf(", expected version 1.2.7 or higher\n");
return 1;
#endif
}
EOF
if test_execute; then
fi
fi
else
log_failure "SDL not found"
fi
}
#
# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <SDL_ttf.h>
#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
#endif
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(", OK.\n");
return 0;
#else
printf(", expected version 2.0.6 or higher\n");
return 1;
#endif
}
EOF
if ! test_execute nofatal; then
cnf_append "VBOX_WITH_SECURELABEL" ""
fi
else
echo "not found -- disabling VBoxSDL secure label."
cnf_append "VBOX_WITH_SECURELABEL" ""
fi
}
#
# Check for libasound, needed by the ALSA audio backend
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#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(", OK.\n");
return 0;
#else
printf(", expected version 1.0.6 or higher\n");
return 1;
#endif
}
EOF
fi
}
#
# Check for PulseAudio
#
{
test_header "PulseAudio"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <pulse/version.h>
extern "C" int main(void)
{
printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
#if PA_API_VERSION >= 9
printf(", OK.\n");
return 0;
#else
printf(", expected version 0.9.0 (API version 9) or higher\n");
return 1;
#endif
}
EOF
fi
}
#
# Check for the X libraries (Xext, X11)
#
check_x()
{
test_header "X libraries"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <X11/Xlib.h>
extern "C" int main(void)
{
Display *dpy;
int scrn_num;
Screen *scrn;
Window win;
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);
XCloseDisplay(dpy);
}
EOF
log_success "found"
fi
}
#
# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <X11/Xlib.h>
#include <X11/Xcursor/Xcursor.h>
extern "C" int main(void)
{
XcursorImage *cursor = XcursorImageCreate (10, 10);
XcursorImageDestroy(cursor);
return 0;
}
EOF
log_success "found"
fi
}
#
# Check for the Xinerama library, needed by the Qt GUI
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
extern "C" int main(void)
{
Display *dpy;
Bool flag;
dpy = XOpenDisplay(NULL);
if (dpy)
{
flag = XineramaIsActive(dpy);
XCloseDisplay(dpy);
}
}
EOF
log_success "found"
fi
}
#
# Check for the Xinerama library, needed by the Qt GUI
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
extern "C" int main(void)
{
Display *dpy;
Bool flag;
int major, minor;
dpy = XOpenDisplay(NULL);
if (dpy)
{
flag = XRRQueryVersion(dpy, &major, &minor);
XCloseDisplay(dpy);
}
}
EOF
log_success "found"
fi
}
#
# Check for OpenGL
#
{
test_header "OpenGL support"
echo "enabled"
cnf_append "VBOX_WITH_CROGL" "1"
else
fi
}
#
# Check for the Xmu library, needed by OpenGL
#
{
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xmu/StdCmap.h>
extern "C" int main(void)
{
Display *dpy;
int scrn_num;
Screen *scrn;
dpy = XOpenDisplay(NULL);
if (dpy)
{
scrn_num = DefaultScreen(dpy);
scrn = ScreenOfDisplay(dpy, scrn_num);
Status status = XmuLookupStandardColormap(dpy, RootWindowOfScreen(scrn), 0,
24, XA_RGB_DEFAULT_MAP, False, True);
printf("Status = %x\n", status);
XCloseDisplay(dpy);
}
return 0;
}
EOF
log_success "found"
fi
}
#
# Check for Mesa, needed by OpenGL
#
{
test_header "Mesa / GLU"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/glu.h>
extern "C" int main(void)
{
Display *dpy;
int major, minor;
dpy = XOpenDisplay(NULL);
if (dpy)
{
Bool glx_version = glXQueryVersion(dpy, &major, &minor);
XCloseDisplay(dpy);
if (glx_version)
{
printf("found version %u.%u, OK.\n", major, minor);
return 0;
}
}
printf("found (inactive), OK.\n");
return 0;
}
EOF
[ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
fi
}
#
# Check for the Qt4 library, needed by the VirtualBox frontend
#
# Currently not fatal.
#
{
# First check if there is the internal version of Qt. If yes nothing else
# has to be done.
QT_INTERNAL=`/bin/ls -rd1 $PWD/tools/$BUILD_TARGET.$BUILD_PLATFORM_ARCH/qt/* 2> /dev/null`
for t in $QT_INTERNAL; do
cnf_append "VBOX_WITH_QT4_SUN" "1"
log_success "use internal version"
return
fi
done
# Now try the user provided directory and some of the standard directories.
PATH_SDK_QT4="$t"
break
fi
done
# Add the necessary params for building the test application
foundqt4=1
FLGQT4="-framework QtCore"
else
log_failure "Qt4 framework not found (can be disabled using --disable-qt4)"
fi
else
if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
# default is to use pkg-config
if which_wrapper pkg-config > /dev/null; then
# this braindead path is necessary for mdv2008.1
qt4_ver=`\
pkg-config QtCore --modversion 2>> $LOG`
if [ $? -ne 0 ]; then
log_failure "QtCore not found"
else
FLGQT4=`\
LIBQT4=`\
foundqt4=1
fi
else
log_failure "pkg-config not found"
fi
else
# do it the old way (e.g. user has specified QT4DIR)
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <QtGlobal>
extern "C" int main(void)
{
printf("found version %s", QT_VERSION_STR);
#if QT_VERSION >= 0x040400
printf(", OK.\n");
return 0;
#else
printf(", expected version 4.4.0 or higher\n");
return 1;
#endif
}
EOF
FLGQT4="-DQT_SHARED"
foundqt4=2
break;
fi
foundqt4=1
break;
fi
done
fi
fi
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <QtGlobal>
extern "C" int main(void)
{
printf("found version %s", QT_VERSION_STR);
#if QT_VERSION >= 0x040400
printf(", OK.\n");
return 0;
#else
printf(", expected version 4.4.0 or higher\n");
return 1;
#endif
}
EOF
# Successful build & run the test application so add the necessary
# params to AutoConfig.kmk
cnf_append "PATH_SDK_QT4_INC" "$PATH_SDK_QT4/Frameworks"
cnf_append "PATH_SDK_QT4_LIB" "$PATH_SDK_QT4/Frameworks"
cnf_append "PATH_SDK_QT4" "$PATH_SDK_QT4/Frameworks"
# Check for the moc tool in the Qt directory found & some standard
# directories.
cnf_append "PATH_TOOL_QT4" "$q"
cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
fi
done
else
# strip .../QtCore as we add components ourself
# store only the first path, remove all other pathes
cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
# this is not quite right since the qt libpath does not have to be first...
cnf_append "VBOX_WITH_QT4_SUN" "1"
fi
test_header "Qt4 devtools"
# first try it with a suffix, some platforms use that
if [ $? -ne 0 ]; then
log_failure "moc-qt4 not working"
else
log_success "found version $moc_ver"
cnf_append "VBOX_PATH_QT4" "$q"
cnf_append "PATH_SDK_QT4" "$q"
cnf_append "PATH_TOOL_QT4" "$q"
cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
cnf_append "TOOL_QT4_BIN_SUFF" "-qt4"
return
fi
if [ $? -ne 0 ]; then
log_failure "moc not working"
else
log_success "found version $moc_ver"
cnf_append "VBOX_PATH_QT4" "$q"
cnf_append "PATH_SDK_QT4" "$q"
cnf_append "PATH_TOOL_QT4" "$q"
cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
return
fi
fi
done
fi
fi
else
log_failure "qt4 not working"
fi
else
log_failure "qt4 not found"
fi
}
#
# Check whether static libstdc++ is installed. This library is required
# for the Linux guest additions.
#
{
test_header "static stc++ library"
cat > $ODIR.tmp_src.cc << EOF
#include <string>
extern "C" int main(void)
{
std::string s = "test";
return 0;
}
EOF
log_success "found"
fi
}
#
# Check for Linux sources
#
{
test_header "Linux kernel sources"
cat > $ODIR.tmp_src.c << EOF
#include <linux/version.h>
int printf(const char *format, ...);
int main(void)
{
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(", OK.\n");
return 0;
#else
printf(", expected version 2.4.0 or higher\n");
return 1;
#endif
}
EOF
if [ $? -ne 0 ]; then
echo
echo " Linux kernel headers not found at $LINUX"
echo " Check the file $LOG for detailed error information."
else
if test_execute; then
fi
fi
}
#
# Check for kchmviewer, needed to display the online help
# (unused as we ship kchmviewer)
#
{
if [ $? -ne 0 ]; then
log_failure "kchmviewer not working"
else
log_success "found version $kchmviewer_ver"
fi
fi
}
#
# Check for the kBuild tools, we don't support GNU make
#
{
# 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
else
fi
KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
# Currently there are no amd64 kBuild bins. So use the x86 variant in any case.
KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.x86"
KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
# check for installed kBuild
else
fi
log_success "found"
}
#
# Check for compiler.h
# 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.
#
#
{
log_success "compiler.h not found"
else
cnf_append "VBOX_WITH_LINUX_COMPILER_H" "1"
log_success "compiler.h found"
fi
}
#
# Check for libcap.
# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
# sockets for doing ICMP requests.
#
{
test_header "libcap library"
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <sys/types.h>
#include <sys/capability.h>
extern "C" int main(void)
{
char buf[1024];
cap_t caps = cap_get_proc();
snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
return 0;
}
EOF
if test_compile $LIBCAP libcap libcap; then
if test_execute; then
log_success "found"
fi
fi
}
#
# Check if we are able to build 32-bit applications (needed for the guest additions)
#
{
test_header "32-bit support"
cat > $ODIR.tmp_src.c << EOF
#include <stdint.h>
int main(void)
{
return 0;
}
EOF
if [ $? -ne 0 ]; then
echo
echo " Check the file $LOG for detailed error information."
else
rc=$?
echo
echo " Cannot execute 32-bit applications! Either enable 32-bit support in the"
echo " kernel configuration or use --disable-vmmraw to disable 32-bit guests."
return 1
fi
fi
log_success ""
}
#
# Check for Python
#
{
test_header "Python support"
echo "enabled"
cnf_append "VBOX_WITH_PYTHON" "1"
return
fi
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
#include <Python.h>
extern "C" int main(void)
{
Py_Initialize();
printf("found version %s", PY_VERSION);
#if PY_VERSION_HEX >= 0x02030000
printf(", OK.\n");
return 0;
#else
printf(", expected version 2.3 or higher\n");
return 1;
#endif
}
EOF
# For Solaris we use libpython2.4 for compatibility with Solaris 10 and passing IPS pkg audit
SUPPYTHONLIBS="python2.7 python2.6 python2.5 python2.4 python2.3"
else
SUPPYTHONLIBS="python2.4"
fi
for p in $PYTHONDIR; do
for d in $SUPPYTHONLIBS; do
if [ $? -eq 0 ]; then
found=1
break
fi
done
done
done
if test_execute; then
cnf_append "VBOX_WITH_PYTHON" "1"
cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
else
log_failure "Python not working"
fi
else
log_failure "Python not found"
fi
}
#
# Check for Java
#
{
test_header "Java support"
}
#
# Setup wine
#
{
test_header "Wine support"
if ! which_wrapper wine > /dev/null; then
echo " wine binary not found"
fi
if ! which_wrapper wine > /dev/null; then
echo " wine not found"
fi
"0")
if ! which_wrapper wineprefixcreate > /dev/null; then
echo " wineprefixcreate not found"
fi
;;
*) eval "wineprefixcreate() { true ; }" ;; # now created automatically
esac
export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
mkdir -p $WINEPREFIX
if ! wineprefixcreate -q > /dev/null 2>&1; then
echo " wineprefixcreate failed"
fi
echo "\"PATH\"=\"c:\\\\\\\\windows\\\\\\\\system32;c:\\\\\\\\windows;z:$DEVDIR/win.x86/vcc/v8/bin/Microsoft.VC80.CRT;z:$DEVDIR/win.x86/HTML_Help_Workshop/v1.3\"" >> $tmp
echo " failed to load registry changes (path)."
fi
log_success "found"
}
#
# Check for gSOAP.
#
{
test_header "GSOAP compiler"
GSOAP="/usr"
fi
fi
fi
cnf_append "VBOX_GSOAP_INSTALLED" "1"
cnf_append "VBOX_PATH_GSOAP" "$GSOAP"
cnf_append "VBOX_PATH_GSOAP_IMPORT" "$GSOAP_IMPORT"
cnf_append "VBOX_GSOAP_CXX_SOURCES" "$GSOAP/share/gsoap/stdsoap2.cpp"
else
cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
fi
cnf_append "VBOX_GSOAP_CXX_LIBS" "libgsoap++"
log_success "found"
else
log_failure "stlvector.h not found -- disabling webservice"
cnf_append "VBOX_WITH_WEBSERVICES" ""
fi
else
log_failure "stdsoap2.h not found -- disabling webservice"
cnf_append "VBOX_WITH_WEBSERVICES" ""
fi
else
log_failure "wsdl2h not found -- disabling webservice"
cnf_append "VBOX_WITH_WEBSERVICES" ""
fi
else
log_failure "soapcpp2 not found -- disabling webservice"
cnf_append "VBOX_WITH_WEBSERVICES" ""
fi
}
#
# Determines the Darwin version.
#
{
test_header "Darwin version"
darwin_ver=`uname -r`
10\.*)
darwin_ver="10.6"
cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
else
fi
# test "$CC" = "gcc" && CC="gcc-4.0"
# test "$CXX" = "g++" && CXX="g++-4.0"
;;
9\.*)
darwin_ver="10.5"
# test "$CC" = "gcc" && CC="gcc-4.0"
# test "$CXX" = "g++" && CXX="g++-4.0"
cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
cnf_append "VBOX_MACOS_10_5_WORKAROUND" "1"
;;
8\.*)
darwin_ver="10.4"
# test "$CC" = "gcc" && CC="gcc-4.0"
# test "$CXX" = "g++" && CXX="g++-4.0"
cnf_append "VBOX_WITH_COCOA_QT" ""
cnf_append "VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6" "1"
;;
*)
echo " failed to determine Darwin version. (uname -r: $darwin_ver)"
darwin_ver="unknown"
;;
esac
log_success "found version $darwin_ver (SDK: $sdk)"
}
{
test_header "makeself"
if [ $? -ne 0 ]; then
log_failure "makeself not working"
else
log_success "found version $makeself_ver"
fi
fi
}
#
# 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.
# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
#
{
test_header "i386-elf-gcc"
i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
echo " failed to find i386-elf-gcc"
fi
log_success "found $i386_elf_gcc"
}
#
# Show help
#
{
cat << EOF
Usage: ./configure [OPTIONS]...
Configuration:
-h, --help display this help and exit
--nofatal don't abort on errors
EOF
[ $WITH_XPCOM -eq 1 ] && echo " --disable-xpcom disable XPCOM and related stuff"
[ $WITH_PYTHON -eq 1 ] && echo " --disable-python disable python bindings"
[ $WITH_JAVA -eq 1 ] && echo " --disable-java disable java bindings"
[ $WITH_VMMRAW -eq 1 ] && echo " --disable-vmmraw disable VMM raw mode (VT-x/AMD-V mandatory!)"
[ $WITH_SDL_TTF -eq 1 ] && echo " --disable-sdl-ttf disable SDL_ttf detection"
[ $WITH_ALSA -eq 1 ] && echo " --disable-alsa disable the ALSA sound backend"
[ $WITH_PULSE -eq 1 ] && echo " --disable-pulse disable the PulseAudio backend"
[ $WITH_DBUS -eq 1 ] && echo " --disable-dbus don't use DBus and hal for hardware detection"
[ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
[ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
[ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
[ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
cat << EOF
--disable-hardening don't be strict about /dev/vboxdrv access
--build-libxml2 build libxml2 from sources
--build-libxslt build libxslt from sources
EOF
--build-libssl build openssl from sources
--build-libcurl build libcurl from sources
EOF
cat << EOF
Paths:
--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-mkisofs=PATH location of mkisofs [$MKISOFS]
EOF
[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
[ $WITH_GSOAP -eq 1 ] && echo " (soapcpp2 and wsdl2h, soapstd2.h, libgsoap++.a/so)"
[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
cat << EOF
--with-openssl-dir=DIR directory for OpenSSL headers/libraries
--out-path=PATH the folder to which configuration and build output
should go
Build type:
-d, --build-debug build with debugging symbols and assertions
--build-profile build with profiling support
--build-headless build headless (without any GUI frontend)
EOF
exit 0
}
#
# The body.
#
# test if we are OSE
OSE=0
# Set this as a reminder to print a log message once we know the path of the
# log file
NOT_OSE=1
fi
# Change OS specific defaults; must be before all other stuff
if [ "$OS" = "darwin" ]; then
WITH_SDL=0
WITH_X11=0
fi
# scan command line options
;;
--nofatal)
nofatal=1
;;
ENV_ONLY=1
;;
;;
--with-g++=*)
;;
echo "Error: KBUILDDIR contains invalid characters!"
exit 1
fi
;;
;;
INCCRYPTO="-I${OPENSSLDIR}/include"
LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a"
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
;;
--enable-webservice)
;;
WITH_VNC=1
;;
;;
;;
;;
WITH_VDE=1
;;
;;
;;
;;
;;
;;
;;
HEADLESS=1
WITH_SDL=0
WITH_X11=0
WITH_QT4=0
;;
--ose)
OSE=2
;;
--odir=*)
;;
if [ -d $out_path ]; then
cd $out_path
cd $saved_path
# This variable has not *yet* been overridden. That can still happen.
fi
else
exit 1
fi
;;
;;
*)
echo
echo "Unrecognized option \"$option\""
echo
;;
esac
done
# initialize output files
# Log file generated by
#
# '$0 $*'
#
EOF
# -*- Makefile -*-
#
# automatically generated by
#
# '$0 $*'
#
# It will be completely overwritten if configure is executed again.
#
EOF
#!/bin/bash
#
# automatically generated by
#
# '$0 $*'
#
# It will be completely overwritten if configure is executed again.
# Make sure you source this file once before you start to build VBox.
#
EOF
# Print log warning about OSE if necessary
if [ -n "$NOT_OSE" ]; then
echo "Found RDP server, assuming VBOX_OSE = FALSE" >> $LOG
echo >> $LOG
fi
if [ "$BUILD_TYPE" = "debug" ]; then
echo "Creating DEBUG build!" >> $LOG
elif [ "$BUILD_TYPE" = "profile" ]; then
echo "Creating PROFILE build!" >> $LOG
fi
# first determine our environment
[ -n "$ENV_ONLY" ] && exit 0
# append the tools directory to the default search path
export PATH
# if we will be writing to a different out directory then set this up now
echo "AUTOCFG=$OUT_PATH/AutoConfig.kmk" >> $ENV
echo "export AUTOCFG" >> $ENV
echo "LOCALCFG=$OUT_PATH/LocalConfig.kmk" >> $ENV
echo "export LOCALCFG" >> $ENV
echo "export PATH_OUT_BASE" >> $ENV
fi
# some things are not available in for OSE
cnf_append "VBOX_OSE" "1"
cnf_append "VBOX_WITH_TESTSUITE" ""
cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
if [ "$OS" = "linux" ]; then
cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
else
cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
fi
echo >> $CNF
fi
# headless
if [ -n "$HEADLESS" ]; then
cnf_append "VBOX_HEADLESS" "1"
fi
# emit disable directives corresponding to any --disable-xxx options.
cnf_append "VBOX_WITH_CROGL" ""
cnf_append "VBOX_WITH_VIDEOHWACCEL" ""
cnf_append "VBOX_GUI_USE_QGL" ""
fi
# Darwin-specific
if [ "$OS" = "darwin" ]; then
fi
# the tools
# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
# [ "$OS" != "darwin" ] && check_yasm
# the libraries
# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
# PulseAudio
cnf_append "VBOX_WITH_PULSE" ""
fi
fi
# Linux-specific
if [ "$OS" = "linux" ]; then
# don't check for the static libstdc++ in the PUEL version as we build the
# additions at a dedicated box
else
cnf_append "VBOX_LINUX_SRC" ""
cnf_append "VBOX_WITH_VBOXDRV" ""
cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
fi
else
cnf_append "VBOX_WITH_ALSA" ""
fi
cnf_append "VBOX_WITH_DBUS" ""
fi
fi
[ -n "$SETUP_WINE" ] && setup_wine
else
cnf_append "VBOX_WITH_WEBSERVICES" ""
fi
fi
# VDE
cnf_append "VBOX_WITH_VDE" "1"
fi
fi
# DOCS
cnf_append "VBOX_WITH_DOCS" ""
cnf_append "VBOX_WITH_DOCS_PACKING" ""
fi
# VNC server support
if [ $WITH_VNC = 1 ]; then
else
cnf_append "VBOX_WITH_VNC" ""
fi
fi
# success!
echo
echo "Source '$ENV' once before you start to build VBox:"
echo ""
echo " source $ENV"
echo " kmk"
echo ""
if [ "$OS" = "linux" ]; then
else
fi
echo "To compile the kernel modules, do:"
echo ""
echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"
echo " make"
echo ""
fi
echo ""
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 ""
else
echo ""
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 +++"
echo ""
fi
echo "Enjoy!"