configure revision 9dab0783f1c18514294d60033f5d7ac0f41de039
97a9a944b5887e91042b019776c41d5dd74557aferikabele# The purpose of this script is to check for all external tools, headers, and
97a9a944b5887e91042b019776c41d5dd74557aferikabele# libraries VBox OSE depends on.
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive# Copyright (C) 2006-2012 Oracle Corporation
b686b6a420bde7f78c416b90be11db94cb789979nd# This file is part of VirtualBox Open Source Edition (OSE), as
b686b6a420bde7f78c416b90be11db94cb789979nd# available from http://www.virtualbox.org. This file is free software;
b686b6a420bde7f78c416b90be11db94cb789979nd# you can redistribute it and/or modify it under the terms of the GNU
b686b6a420bde7f78c416b90be11db94cb789979nd# General Public License (GPL) as published by the Free Software
b686b6a420bde7f78c416b90be11db94cb789979nd# Foundation, in version 2 as it comes in the "COPYING" file of the
b686b6a420bde7f78c416b90be11db94cb789979nd# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b686b6a420bde7f78c416b90be11db94cb789979nd# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4b5981e276e93df97c34e4da05ca5cf8bbd937dand# append some extra paths
b686b6a420bde7f78c416b90be11db94cb789979nd# Solaris (order of paths important for tr, echo, grep, sed to work)
3b3b7fc78d1f5bfc2769903375050048ff41ff26ndPATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd# Wrapper for ancient /usr/bin/which on darwin that always returns 0
b686b6a420bde7f78c416b90be11db94cb789979nd if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
b686b6a420bde7f78c416b90be11db94cb789979ndOS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
c3a3c963ad3f5b4d816b66117406d4e793049119slive echo "Cannot determine OS!"
3b58542e01ec69422f3086db5825a12fc77b726endLIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisdQT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd# the restricting tool is ar (mri mode).
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisdif (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
4c881d2fffa365e2e0c5e25eb1cf77f4f9406e44chrisd echo "Error: VBox base path contains invalid characters!"
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
e0fe7c83f67461f3dc676d90661551edfa111be0covener echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
e0fe7c83f67461f3dc676d90661551edfa111be0covener echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
e0fe7c83f67461f3dc676d90661551edfa111be0covener echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
e71a4cb937081adb50d5673a1c083a5a7b1a1ab1poirier elif which_wrapper $1 > /dev/null; then
8de9acdcea53109461287090fe0069a665352833rbowen# Prepare a test
8de9acdcea53109461287090fe0069a665352833rbowen# Compile a test
8de9acdcea53109461287090fe0069a665352833rbowen# $1 compile flags/libs
8de9acdcea53109461287090fe0069a665352833rbowen# $2 library name
8de9acdcea53109461287090fe0069a665352833rbowen# $3 package name
8de9acdcea53109461287090fe0069a665352833rbowen# $4 if this argument is 'nofatal', don't abort
8de9acdcea53109461287090fe0069a665352833rbowen echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
8de9acdcea53109461287090fe0069a665352833rbowen $CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd if [ $? -ne 0 ]; then
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd echo " Check the file $LOG for detailed error information."
3b58542e01ec69422f3086db5825a12fc77b726end# Execute a compiled test binary
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd if [ $rc -ne 0 ]; then
3b58542e01ec69422f3086db5825a12fc77b726end# Execute a compiled test binary
9744ea3da59d6e7b787c47853db57c324414a9ednd LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
3b58542e01ec69422f3086db5825a12fc77b726end if [ $rc -ne 0 ]; then
1ad1c5f9a82d056966dcca9c6108c5ace8eed446rbowen# Check for OS, MACHINE, CPU
da57d338b0977cbdc021606d3230194a8ad4a56cnd [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
da57d338b0977cbdc021606d3230194a8ad4a56cnd i[3456789]86|x86|i86pc|BePC)
4c881d2fffa365e2e0c5e25eb1cf77f4f9406e44chrisd # on AMD64 systems, 64bit libs are usually located in /usr/lib64
4c881d2fffa365e2e0c5e25eb1cf77f4f9406e44chrisd # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
cb87a91abb4084fe5fa5a53047aeb6dcf9094115jim # Solaris doesn't seem to subscribe to fhs, libs are usually in
cb87a91abb4084fe5fa5a53047aeb6dcf9094115jim # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
cb87a91abb4084fe5fa5a53047aeb6dcf9094115jim # alternative binaries can be found in 'amd64' subdirs of the 'bin'
49acc6accb4061182ef84dc991aaa346ad01a8ecsf # ones. So, in order to find the right stuff (esp. sdl-config) we'll
cb87a91abb4084fe5fa5a53047aeb6dcf9094115jim # have to make sure the */bin/amd64 dirs are searched before the */bin
cb87a91abb4084fe5fa5a53047aeb6dcf9094115jim # ones. (The sed has some sideeffects, but they shouldn't harm us...)
cb87a91abb4084fe5fa5a53047aeb6dcf9094115jim echo "64-bit Solaris detected, hacking the PATH" >> $LOG
49acc6accb4061182ef84dc991aaa346ad01a8ecsf PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
b686b6a420bde7f78c416b90be11db94cb789979nd [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
b686b6a420bde7f78c416b90be11db94cb789979nd log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
8de9acdcea53109461287090fe0069a665352833rbowen# Check for gcc with version >= 3.2.
8de9acdcea53109461287090fe0069a665352833rbowen# We depend on a working gcc, if we fail terminate in every case.
3b58542e01ec69422f3086db5825a12fc77b726end if [ $? -ne 0 ]; then
3a6ae8b015850ba60719ed97ae549e27eee84f0drbowen if [ $? -ne 0 ]; then
3a6ae8b015850ba60719ed97ae549e27eee84f0drbowen log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
8de9acdcea53109461287090fe0069a665352833rbowen elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd elif [ $cc_maj -lt 3 \
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd -o $cc_maj -gt 4 ]; then
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<8"
4c881d2fffa365e2e0c5e25eb1cf77f4f9406e44chrisd if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
8eb7c1fd1d6abcf2529dcb265573b194aba56794chrisd if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
49acc6accb4061182ef84dc991aaa346ad01a8ecsf if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
49acc6accb4061182ef84dc991aaa346ad01a8ecsf if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
b686b6a420bde7f78c416b90be11db94cb789979nd if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
# The only exception is detecting OpenWatcom in tools/common/openwatcom.
unset wasm_ver
unset wc_wasm
unset wc_bin
if [ $? -ne 0 ]; then
if [ $yasm_ver_mul -lt 501 ]; then
# Check for the iasl ACPI compiler, needed to compile vbox.dsl
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
if which_wrapper $GENISOIMAGE > /dev/null; then
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
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
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"