configure revision 84d364e3b796400adda19a80a6ddea5cdc68e67b
181e56d8b348d301d615ccf5465ae600fee2867berikabele# The purpose of this script is to check for all external tools, headers, and
181e56d8b348d301d615ccf5465ae600fee2867berikabele# libraries VBox OSE depends on.
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive# Copyright (C) 2006-2009 Sun Microsystems, Inc.
5a58787efeb02a1c3f06569d019ad81fd2efa06end# This file is part of VirtualBox Open Source Edition (OSE), as
5a58787efeb02a1c3f06569d019ad81fd2efa06end# available from http://www.virtualbox.org. This file is free software;
5a58787efeb02a1c3f06569d019ad81fd2efa06end# you can redistribute it and/or modify it under the terms of the GNU
5a58787efeb02a1c3f06569d019ad81fd2efa06end# General Public License as published by the Free Software Foundation,
5a58787efeb02a1c3f06569d019ad81fd2efa06end# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
5a58787efeb02a1c3f06569d019ad81fd2efa06end# distribution. VirtualBox OSE is distributed in the hope that it will
5a58787efeb02a1c3f06569d019ad81fd2efa06end# be useful, but WITHOUT ANY WARRANTY of any kind.
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd# append some extra paths
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd# Solaris (order of paths important for tr, echo, grep, sed to work)
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7ndPATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen# Wrapper for ancient /usr/bin/which on darwin that always returns 0
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
36488004520b3a22fbd37ef8e10e5641be154ac1sliveLIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
aaf7b7f4cc1be050310c3d7f48bce0ec67e174e4ndQT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr /usr/local"
5a58787efeb02a1c3f06569d019ad81fd2efa06end# the restricting tool is ar (mri mode).
36488004520b3a22fbd37ef8e10e5641be154ac1sliveif (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
aaf7b7f4cc1be050310c3d7f48bce0ec67e174e4nd echo "Error: VBox base path contains invalid characters!"
36488004520b3a22fbd37ef8e10e5641be154ac1slive# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
181e56d8b348d301d615ccf5465ae600fee2867berikabele rm -f $ODIR.tmp_src.cc $ODIR.tmp_src.c $ODIR.tmp_out $ODIR.test_execute.log
36488004520b3a22fbd37ef8e10e5641be154ac1slive echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
36488004520b3a22fbd37ef8e10e5641be154ac1slive echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
36488004520b3a22fbd37ef8e10e5641be154ac1slive echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
36488004520b3a22fbd37ef8e10e5641be154ac1slive elif which_wrapper $1 > /dev/null; then
5a58787efeb02a1c3f06569d019ad81fd2efa06end# Prepare a test
5d81a8bafa2703e966db5bfd5abb33b176d47589nd# Compile a test
aaf7b7f4cc1be050310c3d7f48bce0ec67e174e4nd# $1 compile flags/libs
181e56d8b348d301d615ccf5465ae600fee2867berikabele# $2 library name
36488004520b3a22fbd37ef8e10e5641be154ac1slive# $3 package name
aaf7b7f4cc1be050310c3d7f48bce0ec67e174e4nd# $4 if this argument is 'nofatal', don't abort
d8163ab600e3bdf7d0b1724da4c86babbd44d646nd echo "$CXX -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc \"$1\"" >> $LOG
d8163ab600e3bdf7d0b1724da4c86babbd44d646nd $CXX -g -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.cc $1 >> $LOG 2>&1
d8163ab600e3bdf7d0b1724da4c86babbd44d646nd if [ $? -ne 0 ]; then
181e56d8b348d301d615ccf5465ae600fee2867berikabele echo " $2 not found at $1 or $3 headers not found"
36488004520b3a22fbd37ef8e10e5641be154ac1slive echo " Check the file $LOG for detailed error information."
6b75cb86a77a962682d6a42d861822943c1e9683slive# Execute a compiled test binary
181e56d8b348d301d615ccf5465ae600fee2867berikabele if [ $rc -ne 0 ]; then
f36d6b9fd84a70b9be1819ed376e67327f763db9slive# Execute a compiled test binary
6b75cb86a77a962682d6a42d861822943c1e9683slive echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
125d98ea072ec180d9c84b447fdb72b9d0abd911nd LD_LIBRARY_PATH=$1 $ODIR.tmp_out > $ODIR.test_execute.log
6b75cb86a77a962682d6a42d861822943c1e9683slive if [ $rc -ne 0 ]; then
5d81a8bafa2703e966db5bfd5abb33b176d47589nd# Check for OS, MACHINE, CPU
5d81a8bafa2703e966db5bfd5abb33b176d47589nd OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
f36d6b9fd84a70b9be1819ed376e67327f763db9slive [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
f36d6b9fd84a70b9be1819ed376e67327f763db9slive i[3456789]86|x86|i86pc)
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # on AMD64 systems, 64bit libs are usually located in /usr/lib64
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # Solaris doesn't seem to subscribe to fhs, libs are usually in
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # alternative binaries can be found in 'amd64' subdirs of the 'bin'
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # ones. So, in order to find the right stuff (esp. sdl-config) we'll
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # have to make sure the */bin/amd64 dirs are searched before the */bin
f36d6b9fd84a70b9be1819ed376e67327f763db9slive # ones. (The sed has some sideeffects, but they shouldn't harm us...)
f36d6b9fd84a70b9be1819ed376e67327f763db9slive echo "64-bit Solaris detected, hacking the PATH" >> $LOG
734b788a9d97cb637eda7a50c36853ae426a8655nd PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
36488004520b3a22fbd37ef8e10e5641be154ac1slive [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
734b788a9d97cb637eda7a50c36853ae426a8655nd log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
181e56d8b348d301d615ccf5465ae600fee2867berikabele echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
2b3d9d9ea2b368cce27c9693b6ac263b4f101b4cslive echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
2b3d9d9ea2b368cce27c9693b6ac263b4f101b4cslive echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
2b3d9d9ea2b368cce27c9693b6ac263b4f101b4cslive# Check for gcc with version >= 3.2.
2b3d9d9ea2b368cce27c9693b6ac263b4f101b4cslive# We depend on a working gcc, if we fail terminate in every case.
2b3d9d9ea2b368cce27c9693b6ac263b4f101b4cslive if [ $? -ne 0 ]; then
181e56d8b348d301d615ccf5465ae600fee2867berikabele if [ $? -ne 0 ]; then
181e56d8b348d301d615ccf5465ae600fee2867berikabele log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
36488004520b3a22fbd37ef8e10e5641be154ac1slive elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "OS" = "darwin" ]; then
36488004520b3a22fbd37ef8e10e5641be154ac1slive log " WARNING: gcc version 4.4 was not extensively tested with the"
181e56d8b348d301d615ccf5465ae600fee2867berikabele log " VirtualBox source code! Continue at your own risk!"
aaf7b7f4cc1be050310c3d7f48bce0ec67e174e4nd elif [ $cc_maj -lt 3 \
36488004520b3a22fbd37ef8e10e5641be154ac1slive -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
36488004520b3a22fbd37ef8e10e5641be154ac1slive -o $cc_maj -gt 4 ]; then
36488004520b3a22fbd37ef8e10e5641be154ac1slive log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<4"
36488004520b3a22fbd37ef8e10e5641be154ac1slive if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
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 pkg-config > /dev/null; then
if [ $? -ne 0 ]; then
cat > $ODIR.tmp_src.cc << EOF
if test_execute; then
elif which_wrapper xslt-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_compile $LIBCRYPTO libcrypto openssl; then
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
# 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
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
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 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
# 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
--nofatal)
--with-g++=*)
--ose)
--odir=*)
if [ -d $out_path ]; then
cd $out_path
cd $saved_path
echo "Unrecognized option \"$option\""
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"