configure revision 60f744412fc10626b2c748ab8df9c44db39f8886
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# The purpose of this script is to check for all external tools, headers, and
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# libraries VBox OSE depends on.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# Copyright (C) 2006-2013 Oracle Corporation
f202f2587b9ba4753afba49b796f599cc12b4d0fAndreas Gustafsson# This file is part of VirtualBox Open Source Edition (OSE), as
f202f2587b9ba4753afba49b796f599cc12b4d0fAndreas Gustafsson# available from http://www.virtualbox.org. This file is free software;
f202f2587b9ba4753afba49b796f599cc12b4d0fAndreas Gustafsson# you can redistribute it and/or modify it under the terms of the GNU
f202f2587b9ba4753afba49b796f599cc12b4d0fAndreas Gustafsson# General Public License (GPL) as published by the Free Software
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# Foundation, in version 2 as it comes in the "COPYING" file of the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
f5d30e2864e048a42c4dc1134993ae7efdb5d6c3Mark Andrews# append some extra paths
b5ad6dfea4cc3e7d1d322ac99f1e5a31096837c4Mark Andrews# Solaris (order of paths important for tr, echo, grep, sed to work)
f202f2587b9ba4753afba49b796f599cc12b4d0fAndreas GustafssonPATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Wrapper for ancient /usr/bin/which on darwin that always returns 0
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinOS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr '[:upper:]' '[:lower:]'`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "Cannot determine OS!"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinLIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob AusteinQT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# the restricting tool is ar (mri mode).
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinif (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "Error: VBox base path contains invalid characters!"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein elif which_wrapper $1 > /dev/null; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Prepare a test
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Compile a test
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# $2 library name
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# $3 package name
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# $4 if this argument is 'nofatal', don't abort
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "compiling the following source file:" >> $LOG
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "using the following command line:" >> $LOG
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein $CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo " $2 not found at $1 or $3 headers not found"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo " Check the file $LOG for detailed error information."
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Execute a compiled test binary
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $rc -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Execute a compiled test binary
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $rc -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for OS, MACHINE, CPU
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein i[3456789]86|x86|i86pc|BePC)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # on AMD64 systems, 64bit libs are usually located in /usr/lib64
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # Solaris doesn't seem to subscribe to fhs, libs are usually in
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # alternative binaries can be found in 'amd64' subdirs of the 'bin'
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # ones. So, in order to find the right stuff (esp. sdl-config) we'll
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # have to make sure the */bin/amd64 dirs are searched before the */bin
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # ones. (The sed has some sideeffects, but they shouldn't harm us...)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "64-bit Solaris detected, hacking the PATH" >> $LOG
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for gcc with version >= 3.2.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# We depend on a working gcc, if we fail terminate in every case.
a268fec7f54a89a0772a91da0511c8eae09e6157Mark Andrews if [ $? -ne 0 ]; then
a268fec7f54a89a0772a91da0511c8eae09e6157Mark Andrews log_failure "cannot execute '$CC -dumpversion'"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_failure "cannot execute '$CXX -dumpversion'"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein -o \( $cc_maj -eq 4 -a $cc_min -gt 8 \) \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein -o $cc_maj -gt 4 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<8"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein # this isn't not necessary, there is not such tool.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for the OpenWatcom compiler, needed for compiling the BIOS
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# If the system has Open Watcom installed, WATCOM will be set in the
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# environment. If the user has her/his own Open Watcom install it will be
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# pointed to by on the command line, which will set the WATCOM variable.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# The only exception is detecting OpenWatcom in tools/common/openwatcom.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein WATCOM=`/bin/ls -rd1 $PWD/tools/common/openwatcom/* 2> /dev/null | head -1`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_failure "$WATCOM/$wc_bin/$prog does not exist or is not a regular file."
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein wasm_ver=`$WATCOM/$wc_bin/wasm -? 2>&1 | sed -e '1!d' -e 's/Open Watcom Assembler Version *//'`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_failure "$WATCOM/$wc_bin/wasm -? did not produce the expected response"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for yasm, needed to compile assembler files
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $yasm_ver_mul -lt 501 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein log_failure "found version $yasm_ver, expected at least 0.5.1"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for the iasl ACPI compiler, needed to compile vbox.dsl
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for xsltproc, needed by Main
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for mkisofs, needed to build the CDROM image containing the additions
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for libxml2, needed by VBoxSettings and Runtime.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <cstdio>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <libxml/xmlversion.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinextern "C" int main(void)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("found version %s", LIBXML_DOTTED_VERSION);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#if LIBXML_VERSION >= 20626
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", OK.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", expected version 2.6.26 or higher\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <cstdio>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <libxml/xmlversion.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinextern "C" int main(void)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("found version %s", LIBXML_DOTTED_VERSION);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#if LIBXML_VERSION >= 20626
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", OK.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", expected version 2.6.26 or higher\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
1fc4793844c9613b17866c33dbeab8aaa94b66ffMark Andrews log_failure "neither pkg-config nor xml2-config found"
1fc4793844c9613b17866c33dbeab8aaa94b66ffMark Andrews# Check for libIDL, needed by xpcom
1fc4793844c9613b17866c33dbeab8aaa94b66ffMark Andrews if which_wrapper libIDL-config-2 > /dev/null; then
1fc4793844c9613b17866c33dbeab8aaa94b66ffMark Andrews if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein elif check_avail "libIDL-config" libIDL-config; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if [ $? -ne 0 ]; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for libdevmapper, needed by the VBoxVolInfo
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <cstdio>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#define private
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <libdevmapper.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein char version[80];
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (!dm_get_library_version(version, sizeof(version)))
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("dm_get_library_version() failed.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein const char* v=version;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein unsigned int major = 0, minor = 0, micro = 0;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (*v == '.') v++;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (*v == '.') v++;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("found version %s", version);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (major*10000 + minor*100 + micro >= 10200)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", OK.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", expected version 1.02 or higher\n");
3389b6215abbffc02cc1b6e640f05987ca9f816fMark Andrews if test_compile "$LIBDEVMAPPER $INCDEVMAPPER" libdevmapper libdevmapper; then
3389b6215abbffc02cc1b6e640f05987ca9f816fMark Andrews# Check for openssl, needed for RDP and S3
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <cstdio>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <openssl/opensslv.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <openssl/ssl.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinextern "C" int main(void)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("found version %s", OPENSSL_VERSION_TEXT);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein SSL_library_init();
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#if OPENSSL_VERSION_NUMBER >= 0x00908000
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", OK.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", expected version 0.9.8 or higher\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if test_compile "$INCCRYPTO $LIBCRYPTO" libcrypto openssl; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "SDK_VBOX_OPENSSL_INCS" "`strip_I "$INCCRYPTO"`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "SDK_VBOX_BLD_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for pthread, needed by VBoxSVC, frontends, ...
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <cstdio>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <pthread.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinextern "C" int main(void)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein pthread_mutex_t mutex;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (pthread_mutex_init(&mutex, NULL)) {
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("pthread_mutex_init() failed\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (pthread_mutex_lock(&mutex)) {
f202f2587b9ba4753afba49b796f599cc12b4d0fAndreas Gustafsson printf("pthread_mutex_lock() failed\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if (pthread_mutex_unlock(&mutex)) {
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("pthread_mutex_unlock() failed\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("found, OK.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein if test_compile $LIBPTHREAD pthread pthread; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for zlib, needed by VBoxSVC, Runtime, ...
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <cstdio>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#include <zlib.h>
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinextern "C" int main(void)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf("found version %s", ZLIB_VERSION);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#if ZLIB_VERNUM >= 0x1210
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", OK.\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein printf(", expected version 1.2.1 or higher\n");
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein echo "if1of (\$(KBUILD_TARGET),darwin freebsd haiku linux solaris)" >> $CNF
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein cnf_append " SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Check for libpng, needed by kchmviewer
cat > $ODIR.tmp_src.cc << EOF
if test_execute; then
cat > $ODIR.tmp_src.cc <<EOF
if test_execute; then
cat > $ODIR.tmp_src.cc << EOF
if test_execute; then
# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
cat > $ODIR.tmp_src.cc << EOF
if test_execute nofatal; then
cat > $ODIR.tmp_src.cc << EOF
foundsdl=1
if which_wrapper sdl-config > /dev/null; then
foundsdl=1
cat > $ODIR.tmp_src.cc << EOF
if test_execute; then
cat > $ODIR.tmp_src.cc << EOF
if ! test_execute nofatal; then
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.cc << EOF
[ $PASSIVE_MESA -eq 1 ] && unset DISPLAY
for t in $QT_INTERNAL; do
foundqt4=1
if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
if which_wrapper pkg-config > /dev/null; then
pkg-config QtCore --modversion 2>> $LOG`
if [ $? -ne 0 ]; then
foundqt4=1
cat > $ODIR.tmp_src.cc << EOF
foundqt4=2
foundqt4=1
cat > $ODIR.tmp_src.cc << EOF
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
if which_wrapper pkg-config > /dev/null; then
if [ $? -ne 0 ]; then
cat > $ODIR.tmp_src.cc << EOF
if test_execute; then
cat > $ODIR.tmp_src.cc << EOF
cat > $ODIR.tmp_src.c << EOF
if [ $? -ne 0 ]; then
if test_execute; then
if [ $? -ne 0 ]; then
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
# Check for compiler.h
# Some Linux distributions include "compiler.h" in their libc linux
cat > $ODIR.tmp_src.cc << EOF
if test_compile $LIBCAP libcap libcap; then
if test_execute; then
cat > $ODIR.tmp_src.c << EOF
if [ $? -ne 0 ]; then
rc=$?
cat > $ODIR.tmp_src.cc << EOF
for p in $PYTHONDIR; do
for d in $SUPPYTHONLIBS; do
for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
if [ $? -eq 0 ]; then
found=1
if test_execute; then
if ! which_wrapper wine > /dev/null; then
if ! which_wrapper wine > /dev/null; then
if ! which_wrapper wineprefixcreate > /dev/null; then
mkdir -p $WINEPREFIX
if ! wineprefixcreate -q > /dev/null 2>&1; then
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
if which_wrapper pkg-config > /dev/null; then
if [ $? -eq 0 ]; then
if [ $? -ne 0 ]; then
# 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.
cat << EOF
cat << EOF
cat << EOF
[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-dir=PATH directory for gSOAP compiler/headers/libraries"
[ $WITH_GSOAP -eq 1 ] && echo " --with-gsoap-import=PATH directory for gSOAP import files (stlvector.h)"
cat << EOF
--nofatal)
--with-g++=*)
--ose)
--odir=*)
if [ -d $out_path ]; then
cd $out_path
cd $saved_path
echo "Unrecognized option \"$option\""
if [ -n "$NOT_OSE" ]; then
echo >> $LOG
export PATH
echo >> $CNF
if [ -n "$HEADLESS" ]; then
# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
echo "Source '$ENV' once before you start to build VBox:"
echo " source $ENV"
echo " cd $vbox_out_path/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src"