configure revision 9967ed148bfc50ae01416acd10e6e9a54a0c2935
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# The purpose of this script is to check for all external tools, headers, and
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# libraries VBox OSE depends on.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Copyright (C) 2006-2013 Oracle Corporation
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync# available from http://www.virtualbox.org. This file is free software;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# you can redistribute it and/or modify it under the terms of the GNU
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# General Public License (GPL) as published by the Free Software
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# append some extra paths
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Solaris (order of paths important for tr, echo, grep, sed to work)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsyncPATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
9c2c08ce39651f0adb55b060bb55e4de44ce3786vboxsync# Wrapper for ancient /usr/bin/which on darwin that always returns 0
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsyncOS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr '[:upper:]' '[:lower:]'`
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "Cannot determine OS!"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsyncLIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsyncQT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# the restricting tool is ar (mri mode).
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsyncif (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "Error: VBox base path contains invalid characters!"
e2ad983545c3fedb23bd90b569f3a3191a51e017vboxsync# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
e2ad983545c3fedb23bd90b569f3a3191a51e017vboxsync rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
19cdc739ce4ec66bb50d9871dd87d9fbc170a7b8vboxsync echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync elif which_wrapper $1 > /dev/null; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Prepare a test
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Compile a test
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# $2 library name
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# $3 package name
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# $4 if this argument is 'nofatal', don't abort
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "compiling the following source file:" >> $LOG
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync $CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $? -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo " Check the file $LOG for detailed error information."
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Execute a compiled test binary
4c5ef6947980cbae4c19d4335bea6a4157cdc4bfvboxsync if [ $rc -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Execute a compiled test binary
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $rc -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Check for OS, MACHINE, CPU
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync i[3456789]86|x86|i86pc|BePC)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # on AMD64 systems, 64bit libs are usually located in /usr/lib64
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # Solaris doesn't seem to subscribe to fhs, libs are usually in
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # alternative binaries can be found in 'amd64' subdirs of the 'bin'
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # ones. So, in order to find the right stuff (esp. sdl-config) we'll
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # have to make sure the */bin/amd64 dirs are searched before the */bin
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # ones. (The sed has some sideeffects, but they shouldn't harm us...)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "64-bit Solaris detected, hacking the PATH" >> $LOG
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync echo "BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Check for gcc with version >= 3.2.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# We depend on a working gcc, if we fail terminate in every case.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $? -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $? -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync -o $cc_maj -gt 4 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<8"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync # this isn't not necessary, there is not such tool.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Check for the OpenWatcom compiler, needed for compiling the BIOS
6a746127f59129bb9f153ddf45a1ac093bc48ec2vboxsync# If the system has Open Watcom installed, WATCOM will be set in the
6a746127f59129bb9f153ddf45a1ac093bc48ec2vboxsync# environment. If the user has her/his own Open Watcom install it will be
6a746127f59129bb9f153ddf45a1ac093bc48ec2vboxsync# pointed to by on the command line, which will set the WATCOM variable.
6a746127f59129bb9f153ddf45a1ac093bc48ec2vboxsync# The only exception is detecting OpenWatcom in tools/common/openwatcom.
6a746127f59129bb9f153ddf45a1ac093bc48ec2vboxsync WATCOM=`/bin/ls -rd1 $PWD/tools/common/openwatcom/* 2> /dev/null | head -1`
6a746127f59129bb9f153ddf45a1ac093bc48ec2vboxsync log_failure "$WATCOM/$wc_bin/$prog does not exist or is not a regular file."
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync wasm_ver=`$WATCOM/$wc_bin/wasm -? 2>&1 | sed -e '1!d' -e 's/Open Watcom Assembler Version *//'`
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync log_failure "$WATCOM/$wc_bin/wasm -? did not produce the expected response"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Check for yasm, needed to compile assembler files
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $? -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $yasm_ver_mul -lt 501 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync log_failure "found version $yasm_ver, expected at least 0.5.1"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Check for the iasl ACPI compiler, needed to compile vbox.dsl
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $? -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync# Check for xsltproc, needed by Main
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if [ $? -ne 0 ]; then
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
35779b5ff92d92bc215bf98458583ed33162762fvboxsync# Check for mkisofs, needed to build the CDROM image containing the additions
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync 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
elif which_wrapper xml2-config; then
if [ $? -ne 0 ]; then
cat > $ODIR.tmp_src.cc << EOF
if test_execute; then
if which_wrapper libIDL-config-2 > /dev/null; then
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
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
if test_compile $LIBPTHREAD pthread pthread; then
if test_execute; then
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
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 [ $? -eq 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"