configure revision 9aa7ac83ae5ac6201be6f3ce27fae1f1d0eff655
1d58ad531198113336e6d4d0256e786f09927647jdemendi# The purpose of this script is to check for all external tools, headers, and
1d58ad531198113336e6d4d0256e786f09927647jdemendi# libraries VBox OSE depends on.
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Copyright (C) 2006-2011 Oracle Corporation
1d58ad531198113336e6d4d0256e786f09927647jdemendi# This file is part of VirtualBox Open Source Edition (OSE), as
1d58ad531198113336e6d4d0256e786f09927647jdemendi# available from http://www.virtualbox.org. This file is free software;
1d58ad531198113336e6d4d0256e786f09927647jdemendi# you can redistribute it and/or modify it under the terms of the GNU
1d58ad531198113336e6d4d0256e786f09927647jdemendi# General Public License (GPL) as published by the Free Software
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Foundation, in version 2 as it comes in the "COPYING" file of the
1d58ad531198113336e6d4d0256e786f09927647jdemendi# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1d58ad531198113336e6d4d0256e786f09927647jdemendi# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1d58ad531198113336e6d4d0256e786f09927647jdemendi# append some extra paths
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Solaris (order of paths important for tr, echo, grep, sed to work)
1d58ad531198113336e6d4d0256e786f09927647jdemendiPATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Wrapper for ancient /usr/bin/which on darwin that always returns 0
53247d28ba99538f841a13ea2cde01c3faa3ef36kenneth_suter if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
1d58ad531198113336e6d4d0256e786f09927647jdemendiOS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "Cannot determine OS!"
1d58ad531198113336e6d4d0256e786f09927647jdemendiLIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
1d58ad531198113336e6d4d0256e786f09927647jdemendiQT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
1d58ad531198113336e6d4d0256e786f09927647jdemendi# the restricting tool is ar (mri mode).
1d58ad531198113336e6d4d0256e786f09927647jdemendiif (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "Error: VBox base path contains invalid characters!"
1d58ad531198113336e6d4d0256e786f09927647jdemendi# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
1d58ad531198113336e6d4d0256e786f09927647jdemendi rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
1d58ad531198113336e6d4d0256e786f09927647jdemendi elif which_wrapper $1 > /dev/null; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Prepare a test
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Compile a test
1d58ad531198113336e6d4d0256e786f09927647jdemendi# $2 library name
1d58ad531198113336e6d4d0256e786f09927647jdemendi# $3 package name
1d58ad531198113336e6d4d0256e786f09927647jdemendi# $4 if this argument is 'nofatal', don't abort
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "compiling the following source file:" >> $LOG
4503ae00bc651d48dca085ebfba4cfeafcc8bcafboli echo "$CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
4503ae00bc651d48dca085ebfba4cfeafcc8bcafboli $CXX $CXX_FLAGS -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
4503ae00bc651d48dca085ebfba4cfeafcc8bcafboli if [ $? -ne 0 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo " Check the file $LOG for detailed error information."
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Execute a compiled test binary
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ $rc -ne 0 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Execute a compiled test binary
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
1d58ad531198113336e6d4d0256e786f09927647jdemendi LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ $rc -ne 0 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Check for OS, MACHINE, CPU
1d58ad531198113336e6d4d0256e786f09927647jdemendi [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
1d58ad531198113336e6d4d0256e786f09927647jdemendi i[3456789]86|x86|i86pc)
1d58ad531198113336e6d4d0256e786f09927647jdemendi # on AMD64 systems, 64bit libs are usually located in /usr/lib64
1d58ad531198113336e6d4d0256e786f09927647jdemendi # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
1d58ad531198113336e6d4d0256e786f09927647jdemendi # Solaris doesn't seem to subscribe to fhs, libs are usually in
1d58ad531198113336e6d4d0256e786f09927647jdemendi # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
1d58ad531198113336e6d4d0256e786f09927647jdemendi # alternative binaries can be found in 'amd64' subdirs of the 'bin'
1d58ad531198113336e6d4d0256e786f09927647jdemendi # ones. So, in order to find the right stuff (esp. sdl-config) we'll
1d58ad531198113336e6d4d0256e786f09927647jdemendi # have to make sure the */bin/amd64 dirs are searched before the */bin
1d58ad531198113336e6d4d0256e786f09927647jdemendi # ones. (The sed has some sideeffects, but they shouldn't harm us...)
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "64-bit Solaris detected, hacking the PATH" >> $LOG
1d58ad531198113336e6d4d0256e786f09927647jdemendi PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
1d58ad531198113336e6d4d0256e786f09927647jdemendi [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
1d58ad531198113336e6d4d0256e786f09927647jdemendi log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
1d58ad531198113336e6d4d0256e786f09927647jdemendi echo "BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
1d58ad531198113336e6d4d0256e786f09927647jdemendi# Check for gcc with version >= 3.2.
1d58ad531198113336e6d4d0256e786f09927647jdemendi# We depend on a working gcc, if we fail terminate in every case.
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ $? -ne 0 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ $? -ne 0 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
1d58ad531198113336e6d4d0256e786f09927647jdemendi elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "$OS" = "darwin" ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
1d58ad531198113336e6d4d0256e786f09927647jdemendi -o $cc_maj -gt 4 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<7"
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ "$TARGET_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 0 ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ "$CC32" != "gcc -m32" -a "$CC32" != "undefined" ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ "$CXX32" != "g++ -m32" -a "$CXX32" != "undefined" ]; then
1d58ad531198113336e6d4d0256e786f09927647jdemendi # this isn't not necessary, there is not such tool.
1d58ad531198113336e6d4d0256e786f09927647jdemendi if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
04a13ed0142e4ee74842a64dd3d65153eaeb3d0cboli# Check for the bcc compiler, needed for compiling the BIOS
4c858fe08bd39b55ff1b0690065035e6bf0eb64ematthew_swift bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
4c858fe08bd39b55ff1b0690065035e6bf0eb64ematthew_swift if [ $? -ne 0 ]; then
cat > $ODIR.tmp_src.c << EOF
if [ $? -ne 0 ]; then
unset bcc_path
unset bcc_dir
if [ $? -ne 0 ]; then
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 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 [ $? -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"