configure revision d9a4dcd59fc2806c8a7076cf07c9cb08385403fa
1N/A#!/bin/sh
1N/A# The purpose of this script is to check for all external tools, headers, and
1N/A# libraries VBox OSE depends on.
1N/A
1N/A#
1N/A# Copyright (C) 2006-2007 Sun Microsystems, Inc.
1N/A#
1N/A# This file is part of VirtualBox Open Source Edition (OSE), as
1N/A# available from http://www.virtualbox.org. This file is free software;
1N/A# you can redistribute it and/or modify it under the terms of the GNU
1N/A# General Public License as published by the Free Software Foundation,
1N/A# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
1N/A# distribution. VirtualBox OSE is distributed in the hope that it will
1N/A# be useful, but WITHOUT ANY WARRANTY of any kind.
1N/A#
1N/A
1N/ALC_ALL=C
1N/Aexport LC_ALL
1N/A
1N/A# append some extra paths
1N/APATH="$PATH:/opt/gnome/bin"
1N/A# Solaris (order of paths important for tr, echo, grep, sed to work)
1N/APATH="/usr/xpg4/bin:/usr/ucb:$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin"
1N/AORGPATH=$PATH
1N/A
1N/A# Wrapper for ancient /usr/bin/which on darwin that always returns 0
1N/Awhich_wrapper()
1N/A{
1N/A if [ -z "$have_ancient_which" ]; then
1N/A if which /bin/___cErTaINly_a_nOn_eXisTing_fIle___ 2> /dev/null > /dev/null; then
1N/A have_ancient_which="yes"
1N/A else
1N/A have_ancient_which="no"
1N/A fi
1N/A fi
1N/A if [ "$have_ancient_which" = "yes" ]; then
1N/A retval=`which $* 2>/dev/null`
1N/A echo "$retval"
1N/A test -n "$retval" -a -x "$retval"
1N/A unset retval
1N/A else
1N/A which $* 2> /dev/null
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Defaults
1N/A#
1N/AOSE=1
1N/AODIR="`pwd`/"
1N/ASETUP_WINE=
1N/ATARGET_MACHINE=""
1N/ATARGET_CPU=""
1N/AWITH_XPCOM=1
1N/AWITH_PYTHON=1
1N/AWITH_LIBIDL=1
1N/AWITH_QT3=1
1N/AWITH_QT4=1
1N/AWITH_SDL=1
1N/AWITH_SDL_TTF=1
1N/AWITH_X11=1
1N/AWITH_ALSA=1
1N/AWITH_PULSE=1
1N/AWITH_DBUS=1
1N/AWITH_KMODS=1
1N/AWITH_HARDENING=1
1N/ACC="gcc"
1N/ACC_COMPAT=""
1N/ACC32=""
1N/ACC64=""
1N/ACXX="g++"
1N/ACXX32=""
1N/ACXX64=""
1N/ABCC="bcc"
1N/AYASM="yasm"
1N/AIASL="iasl"
1N/AAS86="as86"
1N/AXSLTPROC="xsltproc"
1N/AGENISOIMAGE="genisoimage"
1N/AMKISOFS="mkisofs"
1N/ABUILD_LIBXML2=
1N/ABUILD_LIBXSLT=
1N/ALIBCRYPTO="-lcrypto"
1N/ALIBPTHREAD="-lpthread"
1N/ALIBCAP="-lcap"
1N/ALIBX11="-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11"
1N/AINCX11="/usr/local/include"
1N/ALIBXCURSOR="-lXcursor"
1N/AINCZ=""
1N/ALIBZ="-lz"
1N/AINCPNG=""
1N/ALIBPNG="-lpng"
1N/APKGCONFIG="`which_wrapper pkg-config`"
1N/APYTHONDIR="/usr /usr/local"
1N/AQT3DIR="/usr/qt/3 /usr/lib/qt3 /usr/lib/qt-3.3 /usr/share/qt3"
1N/AQT3DIR="$QT3DIR /usr/lib64/qt-3.3 /usr/X11R6 /usr/lib/qt"
1N/AQT4DIR="/usr/lib/qt4 /usr/share/qt4 /usr/lib64/qt4 /usr"
1N/AQT4DIR_PKGCONFIG=1
1N/AQT4UIC3DIR="/usr/bin"
1N/AKBUILDDIR="`cd \`dirname $0\`; pwd`/kBuild"
1N/ADEVDIR="`cd \`dirname $0\`; pwd`/tools"
1N/Aif [ -d "/lib/modules/`uname -r`/build" ]; then
1N/A LINUX="/lib/modules/`uname -r`/build"
1N/Aelse
1N/A LINUX="/usr/src/linux"
1N/Afi
1N/AKCHMVIEWER="kchmviewer"
1N/ALOG="configure.log"
1N/ACNF="AutoConfig.kmk"
1N/AENV="env.sh"
1N/ABUILD_TYPE="release"
1N/A# the restricting tool is ar (mri mode).
1N/AINVALID_CHARS="[^A-Za-z0-9/\\$:._-]"
1N/A
1N/Aif (cd `dirname $0`; pwd)|grep -q "$INVALID_CHARS"; then
1N/A echo "Error: VBox base path contains invalid characters!"
1N/A exit 1
1N/Afi
1N/A
1N/A# darwin /bin/sh has a builtin echo that doesn't grok -n. gotta love it.
1N/Aif [ "`uname`" = "Darwin" ]; then
1N/A ECHO_N="/bin/echo -n"
1N/Aelse
1N/A ECHO_N="echo -n"
1N/Afi
1N/A
1N/A
1N/Acleanup()
1N/A{
1N/A rm -f .tmp_src.cc .tmp_src.c .tmp_out .test_execute.log
1N/A}
1N/A
1N/Afail()
1N/A{
1N/A if [ -z "$nofatal" -o "x$1" != "x" ]; then
1N/A cleanup
1N/A rm -f $ENV
1N/A exit 1
1N/A fi
1N/A}
1N/A
1N/Alog()
1N/A{
1N/A echo "$1"
1N/A echo "$1" >> $LOG
1N/A}
1N/A
1N/Alog_success()
1N/A{
1N/A if [ -n "$1" ]; then $ECHO_N "$1, "; fi
1N/A echo "OK."
1N/A echo "$1" >> $LOG
1N/A echo >> $LOG
1N/A echo >> $LOG
1N/A}
1N/A
1N/Alog_failure()
1N/A{
1N/A echo
1N/A echo " ** $1!"
1N/A echo "** $1!" >> $LOG
1N/A echo >> $LOG
1N/A}
1N/A
1N/Acnf_append()
1N/A{
1N/A printf "%-30s := %s\n" "$1" "$2" >> $CNF
1N/A}
1N/A
1N/Astrip_l()
1N/A{
1N/A echo "$1"|$KBUILD_SED 's|-l\([^ ]\+\)|\1|g; s|^-[^l][^ ]*||g; s| -[^l][^ ]*||g; s|^ ||; s| *$||g'
1N/A}
1N/A
1N/Astrip_L()
1N/A{
1N/A echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g'
1N/A}
1N/A
1N/Astrip_I()
1N/A{
1N/A echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g'
1N/A}
1N/A
1N/Aprefix_I()
1N/A{
1N/A echo "$1"|$KBUILD_SED 's|^\/|-I/|g; s| \/| -I/|g'
1N/A}
1N/A
1N/Acheck_avail()
1N/A{
1N/A if [ -z "$1" ]; then
1N/A log_failure "$2 is empty"
1N/A fail $3
1N/A return 1
1N/A elif which_wrapper $1 > /dev/null; then
1N/A return 0
1N/A else
1N/A log_failure "$1 (variable $2) not found"
1N/A fail $3
1N/A return 1
1N/A fi
1N/A}
1N/A
1N/A
1N/A# Prepare a test
1N/Atest_header()
1N/A{
1N/A echo "***** Checking $1 *****" >> $LOG
1N/A $ECHO_N "Checking for $1: "
1N/A}
1N/A
1N/A
1N/A# Compile a test
1N/Atest_compile()
1N/A{
1N/A echo "compiling the following source file:" >> $LOG
1N/A cat .tmp_src.cc >> $LOG
1N/A echo "using the following command line:" >> $LOG
1N/A echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc \"$1\"" >> $LOG
1N/A $CXX -O -Wall -o .tmp_out .tmp_src.cc $1 >> $LOG 2>&1
1N/A if [ $? -ne 0 ]; then
1N/A if [ -z "$4" ]; then
1N/A echo
1N/A echo " $2 not found at $1 or $3 headers not found"
1N/A echo " Check the file $LOG for detailed error information."
1N/A fail
1N/A else
1N/A echo "not found."
1N/A echo >> $LOG
1N/A echo >> $LOG
1N/A fi
1N/A return 1
1N/A fi
1N/A return 0
1N/A}
1N/A
1N/A
1N/A# Execute a compiled test binary
1N/Atest_execute()
1N/A{
1N/A echo "executing the binary" >> $LOG
1N/A ./.tmp_out > .test_execute.log
1N/A rc=$?
1N/A cat .test_execute.log | tee -a $LOG
1N/A if [ $rc -ne 0 ]; then
1N/A fail $1
1N/A return 1
1N/A fi
1N/A echo >> $LOG
1N/A echo >> $LOG
1N/A return 0
1N/A}
1N/A
1N/A
1N/A# Execute a compiled test binary
1N/Atest_execute_path()
1N/A{
1N/A echo "executing the binary (LD_LIBRARY_PATH=$1)" >> $LOG
1N/A LD_LIBRARY_PATH=$1 ./.tmp_out > .test_execute.log
1N/A rc=$?
1N/A cat .test_execute.log | tee -a $LOG
1N/A if [ $rc -ne 0 ]; then
1N/A fail
1N/A return 1
1N/A fi
1N/A echo >> $LOG
1N/A echo >> $LOG
1N/A return 0
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for OS, MACHINE, CPU
1N/A#
1N/Acheck_environment()
1N/A{
1N/A test_header environment
1N/A OS=`uname -s | sed -e 's/GNU\/Linux/Linux/g' | tr [:upper:] [:lower:]`
1N/A case "$OS" in
1N/A linux)
1N/A ;;
1N/A darwin)
1N/A ;;
1N/A freebsd)
1N/A ;;
1N/A sunos)
1N/A OS='solaris'
1N/A ;;
1N/A *)
1N/A log_failure "Cannot determine OS"
1N/A exit 1
1N/A ;;
1N/A esac
1N/A BUILD_CPU=`uname -m`
1N/A [ "$OS" = "solaris" ] && BUILD_CPU=`isainfo | cut -f 1 -d ' '`
1N/A case "$BUILD_CPU" in
1N/A i[3456789]86|x86|i86pc)
1N/A BUILD_MACHINE='x86'
1N/A LIB='lib'
1N/A ;;
1N/A x86_64|amd64)
1N/A BUILD_MACHINE='amd64'
1N/A BUILD_CPU='k8'
1N/A if [ "$OS" != "solaris" ]; then
1N/A # on AMD64 systems, 64bit libs are usually located in /usr/lib64
1N/A # see http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64
1N/A LIB='lib64'
1N/A else
1N/A # Solaris doesn't seem to subscribe to fhs, libs are usually in
1N/A # a '64' subdirectory of the standard 'lib' dirs while some 64-bit
1N/A # alternative binaries can be found in 'amd64' subdirs of the 'bin'
1N/A # ones. So, in order to find the right stuff (esp. sdl-config) we'll
1N/A # have to make sure the */bin/amd64 dirs are searched before the */bin
1N/A # ones. (The sed has some sideeffects, but they shouldn't harm us...)
1N/A echo "64-bit Solaris detected, hacking the PATH" >> $LOG
1N/A echo "old PATH: $PATH" >> $LOG
1N/A PATH=`echo ":$PATH:" | sed -e 's,\(:[^:]*/bin\):,\1/amd64:\1:,g' \
1N/A -e 's/^:*//' -e 's/:*$//g' -e 's/::*/:/g' `
1N/A export PATH
1N/A echo "new PATH: $PATH" >> $LOG
1N/A LIB='lib/64'
1N/A fi
1N/A ;;
1N/A *)
1N/A log_failure "Cannot determine system"
1N/A exit 1
1N/A ;;
1N/A esac
1N/A [ -z "$TARGET_MACHINE" ] && TARGET_MACHINE=$BUILD_MACHINE
1N/A [ -z "$TARGET_CPU" ] && TARGET_CPU=$BUILD_CPU
1N/A DEVDIR_BIN="$DEVDIR/$OS.$BUILD_MACHINE/bin"
1N/A log_success "Determined build machine: $OS.$BUILD_MACHINE, target machine: $OS.$TARGET_MACHINE"
1N/A
1N/A echo "export BUILD_PLATFORM=\"$OS\"" >> $ENV
1N/A echo "export BUILD_PLATFORM_ARCH=\"$BUILD_MACHINE\"" >> $ENV
1N/A echo "export BUILD_TARGET=\"$OS\"" >> $ENV
1N/A echo "export BUILD_TARGET_ARCH=\"$TARGET_MACHINE\"" >> $ENV
1N/A echo "export BUILD_TARGET_CPU=\"$TARGET_CPU\"" >> $ENV
1N/A echo "export BUILD_TYPE=\"$BUILD_TYPE\"" >> $ENV
1N/A}
1N/A
1N/A#
1N/A# Check for gcc with version >= 3.2.
1N/A# We depend on a working gcc, if we fail terminate in every case.
1N/A#
1N/Acheck_gcc()
1N/A{
1N/A test_header gcc
1N/A if [ -n "$CC_COMPAT" ]; then
1N/A if check_avail "$CC_COMPAT" CC_COMPAT really; then
1N/A cc_compat_ver=`$CC_COMPAT -dumpversion` 2>/dev/null
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "cannot execute '$CC_COMPAT -dumpversion'"
1N/A fail really
1N/A fi
1N/A cc_compat_maj=`echo $cc_compat_ver|cut -d. -f1`
1N/A cc_compat_min=`echo $cc_compat_ver|cut -d. -f2`
1N/A if [ $cc_compat_maj -lt 3 \
1N/A -o \( $cc_compat_maj -eq 3 -a $cc_compat_min -lt 2 \) \
1N/A -o \( $cc_compat_maj -eq 4 -a $cc_compat_min -lt 1 \) \
1N/A -o \( $cc_compat_maj -eq 4 -a $cc_compat_min -gt 2 \) \
1N/A -o $cc_compat_maj -gt 4 ]; then
1N/A log ""
1N/A log " ** Version $cc_compat_ver of the compatibility gcc found. Expected gcc 3.x with x>1"
1N/A log " ** or gcc 4.x with 0<x<3"
1N/A fail really
1N/A fi
1N/A cnf_append "VBOX_RECOMPILER_OP_GCC" "$CC_COMPAT"
1N/A fi
1N/A fi
1N/A if check_avail "$CC" CC really; then
1N/A cc_ver=`$CC -dumpversion` 2>/dev/null
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "cannot execute '$CC -dumpversion'"
1N/A fail really
1N/A fi
1N/A if check_avail "$CXX" CXX really; then
1N/A cxx_ver=`$CXX -dumpversion` 2>/dev/null
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "cannot execute '$CXX -dumpversion'"
1N/A fail really
1N/A fi
1N/A cc_maj=`echo $cc_ver|cut -d. -f1`
1N/A cc_min=`echo $cc_ver|cut -d. -f2`
1N/A if [ "x$cc_ver" != "x$cxx_ver" ]; then
1N/A log_failure "gcc version $cc_ver does not match g++ version $cxx_ver"
1N/A fail really
1N/A elif [ $cc_maj -eq 4 -a $cc_min -eq 0 -a "OS" = "darwin" ]; then
1N/A log_success "found version $cc_ver"
1N/A elif [ $cc_maj -eq 4 -a $cc_min -eq 3 ]; then
1N/A if [ -z "$CC_COMPAT" ]; then
1N/A log ""
1N/A log " ** There are known problems with gcc version 4.3 when compiling the recompiler"
1N/A log " ** stuff. You need to specify a compatibility compiler with version < 4.3. Look"
1N/A log " ** for a package compat-gcc-34 on Fedora systems or something similar on other"
1N/A log " ** distributions and call configure with parameter --with-gcc-compat=gcc34."
1N/A fail really
1N/A fi
1N/A log_success "found version $cc_ver + compat version $cc_compat_ver"
1N/A # gcc-4.0 is allowed for Darwin only
1N/A elif [ $cc_maj -lt 3 \
1N/A -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
1N/A -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
1N/A -o \( $cc_maj -eq 4 -a $cc_min -gt 3 \) \
1N/A -o $cc_maj -gt 4 ]; then
1N/A log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<4"
1N/A fail really
1N/A else
1N/A log_success "found version $cc_ver"
1N/A fi
1N/A if [ "$BUILD_MACHINE" = "amd64" ]; then
1N/A [ -z "$CC32" ] && CC32="$CC -m32"
1N/A [ -z "$CXX32" ] && CXX32="$CXX -m32"
1N/A else
1N/A [ -z "$CC32" ] && CC32="$CC"
1N/A [ -z "$CXX32" ] && CXX32="$CXX"
1N/A fi
1N/A if [ "$BUILD_MACHINE" = "x86" -a "$TARGET_MACHINE" = "amd64" ]; then
1N/A [ -z "$CC64" ] && CC64="$CC -m64"
1N/A [ -z "$CXX64" ] && CXX64="$CXX -m64"
1N/A fi
1N/A if [ "$CC" != "gcc" ]; then
1N/A cnf_append "TOOL_GCC3_CC" "$CC"
1N/A cnf_append "TOOL_GCC3_AS" "$CC"
1N/A cnf_append "TOOL_GCC3_LD" "$CC"
1N/A cnf_append "TOOL_GXX3_CC" "$CC"
1N/A cnf_append "TOOL_GXX3_AS" "$CC"
1N/A fi
1N/A if [ "$CXX" != "g++" ]; then
1N/A cnf_append "TOOL_GCC3_CXX" "$CXX"
1N/A cnf_append "TOOL_GXX3_CXX" "$CXX"
1N/A cnf_append "TOOL_GXX3_LD" "$CXX"
1N/A fi
1N/A if [ "$CC32" != "gcc -m32" ]; then
1N/A cnf_append "TOOL_GCC32_CC" "$CC32"
1N/A cnf_append "TOOL_GCC32_AS" "$CC32"
1N/A cnf_append "TOOL_GCC32_LD" "$CC32"
1N/A cnf_append "TOOL_GXX32_CC" "$CC32"
1N/A cnf_append "TOOL_GXX32_AS" "$CC32"
1N/A fi
1N/A if [ "$CXX32" != "g++ -m32" ]; then
1N/A cnf_append "TOOL_GCC32_CXX" "$CXX32"
1N/A cnf_append "TOOL_GXX32_CXX" "$CXX32"
1N/A cnf_append "TOOL_GXX32_LD" "$CXX32"
1N/A fi
1N/A # this isn't not necessary, there is not such tool.
1N/A if [ -n "$CC64" ]; then
1N/A cnf_append "TOOL_GCC64_CC" "$CC64"
1N/A cnf_append "TOOL_GCC64_AS" "$CC64"
1N/A cnf_append "TOOL_GCC64_LD" "$CC64"
1N/A cnf_append "TOOL_GXX64_CC" "$CC64"
1N/A cnf_append "TOOL_GXX64_AS" "$CC64"
1N/A fi
1N/A if [ -n "$CXX64" ]; then
1N/A cnf_append "TOOL_GCC64_CXX" "$CXX64"
1N/A cnf_append "TOOL_GXX64_CXX" "$CXX64"
1N/A cnf_append "TOOL_GXX64_LD" "$CXX64"
1N/A fi
1N/A # Solaris sports a 32-bit gcc/g++.
1N/A if [ "$OS" = "solaris" -a "$BUILD_MACHINE" = "amd64" ]; then
1N/A [ "$CC" = "gcc" ] && CC="gcc -m64"
1N/A [ "$CXX" = "g++" ] && CXX="g++ -m64"
1N/A fi
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the bcc compiler, needed for compiling the BIOS
1N/A#
1N/Acheck_bcc()
1N/A{
1N/A test_header bcc
1N/A if check_avail "$BCC" BCC; then
1N/A bcc_ver=`$BCC -v 2>&1|grep version|sed 's+^bcc: version \(.*\)+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A echo "compiling the following source file:" >> $LOG
1N/A cat > .tmp_src.c << EOF
1N/Aint foo(a)
1N/A int a;
1N/A{
1N/A return 0;
1N/A}
1N/AEOF
1N/A cat .tmp_src.c >> $LOG
1N/A bcc_path=`which_wrapper $BCC`
1N/A bcc_dir="`dirname $bcc_path`/"
1N/A echo "using the following command line:" >> $LOG
1N/A echo "$BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c" >> $LOG
1N/A $BCC -B $bcc_dir -C-c -3 -S -o .tmp_out .tmp_src.c >> $LOG 2>&1
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $bcc_ver"
1N/A cnf_append "VBOX_BCC" "$bcc_path -B $bcc_dir"
1N/A fi
1N/A unset bcc_path
1N/A unset bcc_dir
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the as86 assembler, needed for compiling the BIOS
1N/A#
1N/Acheck_as86()
1N/A{
1N/A test_header as86
1N/A if check_avail "$AS86" AS86; then
1N/A as86_ver=`$AS86 -v 2>&1|grep version|sed 's+^as86 version: \(.*\)+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $as86_ver"
1N/A cnf_append "VBOX_AS86" "`which_wrapper $AS86`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for yasm, needed to compile assembler files
1N/A#
1N/Acheck_yasm()
1N/A{
1N/A test_header yasm
1N/A if check_avail "$YASM" YASM; then
1N/A yasm_ver=`$YASM --version|grep "^yasm"|sed 's+^yasm \(.*\)+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A yasm_maj=`echo $yasm_ver|cut -d. -f1`
1N/A yasm_min=`echo $yasm_ver|cut -d. -f2`
1N/A yasm_rev=`echo $yasm_ver|cut -d. -f3`
1N/A yasm_ver_mul=`expr $yasm_maj \* 10000 + $yasm_min \* 100 + $yasm_rev`
1N/A if [ $yasm_ver_mul -lt 501 ]; then
1N/A log_failure "found version $yasm_ver, expected at least 0.5.1"
1N/A fail
1N/A else
1N/A log_success "found version $yasm_ver"
1N/A fi
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the iasl ACPI compiler, needed to compile vbox.dsl
1N/A#
1N/Acheck_iasl()
1N/A{
1N/A test_header iasl
1N/A if check_avail "$IASL" IASL; then
1N/A iasl_ver=`$IASL|grep version|sed 's+^ASL.*version \([0-9]*\).*+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $iasl_ver"
1N/A cnf_append "VBOX_IASLCMD" "`which_wrapper $IASL`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for xsltproc, needed by Main
1N/A#
1N/Acheck_xsltproc()
1N/A{
1N/A test_header xslt
1N/A if check_avail "$XSLTPROC" XSLTPROC; then
1N/A xsltproc_ver=`$XSLTPROC --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found"
1N/A cnf_append "VBOX_XSLTPROC" "`which_wrapper $XSLTPROC`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for mkisofs, needed to build the CDROM image containing the additions
1N/A#
1N/Acheck_mkisofs()
1N/A{
1N/A test_header mkisofs
1N/A if which_wrapper $GENISOIMAGE > /dev/null; then
1N/A mkisofs_ver=`$GENISOIMAGE --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found $mkisofs_ver"
1N/A cnf_append "VBOX_MKISOFS" "`which_wrapper $GENISOIMAGE`"
1N/A fi
1N/A elif check_avail "$MKISOFS" MKISOFS; then
1N/A mkisofs_ver=`$MKISOFS --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found $mkisofs_ver"
1N/A cnf_append "VBOX_MKISOFS" "`which_wrapper $MKISOFS`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for libxml2, needed by VBoxSettings
1N/A# 2.6.24 is known to NOT work, 2.6.26 is known to work (there is no 2.6.25 release)
1N/A#
1N/Acheck_libxml2()
1N/A{
1N/A if [ -z "$BUILD_LIBXML2" ]; then
1N/A test_header libxml2
1N/A if which_wrapper pkg-config > /dev/null; then
1N/A libxml2_ver=`pkg-config libxml-2.0 --modversion 2>> $LOG`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A FLGXML2=`pkg-config libxml-2.0 --cflags`
1N/A INCXML2=`strip_I "$FLGXML2"`
1N/A LIBXML2=`pkg-config libxml-2.0 --libs`
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <libxml/xmlversion.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", LIBXML_DOTTED_VERSION);
1N/A#if LIBXML_VERSION >= 20626
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 2.6.26 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
1N/A if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
1N/A if test_execute; then
1N/A cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
1N/A cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
1N/A fi
1N/A fi
1N/A fi
1N/A elif which_wrapper xml2-config; then
1N/A libxml2_ver=`xml2-config --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $libxml2_ver"
1N/A FLGXML2=`xml2-config --cflags`
1N/A INCXML2=`strip_I "$FLGXML2"`
1N/A LIBXML2=`xml2-config --libs`
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <libxml/xmlversion.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", LIBXML_DOTTED_VERSION);
1N/A#if LIBXML_VERSION >= 20626
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 2.6.26 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCXML2" ] && I_INCXML2=`prefix_I "$INCXML2"`
1N/A if test_compile "$LIBXML2 $LIBPTHREAD $I_INCXML2" xml2 xml2; then
1N/A if test_execute; then
1N/A cnf_append "SDK_VBOX_LIBXML2_INCS" "$INCXML2"
1N/A cnf_append "SDK_VBOX_LIBXML2_LIBS" "`strip_l "$LIBXML2"`"
1N/A fi
1N/A fi
1N/A fi
1N/A else
1N/A log_failure "neither pkg-config nor xml2-config found"
1N/A fail
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for libxslt, needed by VBoxSettings. For now we depend on 1.1.17.
1N/A# This library is available on Ubuntu Edgy which fulfils the minimal libxml2
1N/A# requirement (2.6.26).
1N/A#
1N/Acheck_libxslt()
1N/A{
1N/A if [ -z "$BUILD_LIBXSLT" ]; then
1N/A test_header libxslt
1N/A if which_wrapper pkg-config > /dev/null; then
1N/A libxslt_ver=`pkg-config libxslt --modversion 2>> $LOG`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A FLGXSLT=`pkg-config libxslt --cflags`
1N/A INCXSLT=`strip_I "$FLGXSLT"`
1N/A LIBXSLT=`pkg-config libxslt --libs`
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <libxslt/xsltconfig.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", LIBXSLT_DOTTED_VERSION);
1N/A#if LIBXSLT_VERSION >= 10117
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 1.1.17 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
1N/A if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
1N/A if test_execute; then
1N/A cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
1N/A cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
1N/A fi
1N/A fi
1N/A fi
1N/A elif which_wrapper xslt-config; then
1N/A libxslt_ver=`xslt-config --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $libxslt_ver"
1N/A FLGXSLT=`xslt-config --cflags`
1N/A INCXSLT=`strip_I "$FLGXSLT"`
1N/A LIBXSLT=`xslt-config --libs`
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <libxslt/xsltconfig.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", LIBXSLT_DOTTED_VERSION);
1N/A#if LIBXSLT_VERSION >= 10117
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 1.1.17 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCXSLT" ] && I_INCXSLT=`prefix_I "$INCXSLT"`
1N/A if test_compile "$LIBXSLT $LIBPTHREAD $I_INCXSLT" xslt xslt; then
1N/A if test_execute; then
1N/A cnf_append "SDK_VBOX_LIBXSLT_INCS" "$INCXSLT"
1N/A cnf_append "SDK_VBOX_LIBXSLT_LIBS" "`strip_l "$LIBXSLT"`"
1N/A fi
1N/A fi
1N/A fi
1N/A else
1N/A log_failure "neither pkg-config nor xslt-config found"
1N/A fail
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for libIDL, needed by xpcom
1N/A#
1N/Acheck_libidl()
1N/A{
1N/A test_header libIDL
1N/A
1N/A if which_wrapper libIDL-config-2 > /dev/null; then
1N/A libidl_ver=`libIDL-config-2 --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $libidl_ver"
1N/A cnf_append "VBOX_LIBIDL_CONFIG" \
1N/A "PKG_CONFIG_PATH=`libIDL-config-2 --prefix`/$LIB/pkgconfig `which_wrapper libIDL-config-2`"
1N/A fi
1N/A elif check_avail "libIDL-config" libIDL-config; then
1N/A libidl_ver=`libIDL-config --version`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $libidl_ver"
1N/A cnf_append "VBOX_LIBIDL_CONFIG" "`which_wrapper libIDL-config`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for openssl, needed for RDP
1N/A#
1N/Acheck_ssl()
1N/A{
1N/A test_header ssl
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <openssl/opensslv.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", OPENSSL_VERSION_TEXT);
1N/A#if OPENSSL_VERSION_NUMBER >= 0x0090700
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 0.9.7 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A if test_compile $LIBCRYPTO libcrypto openssl; then
1N/A if test_execute nofatal; then
1N/A cnf_append "SDK_VBOX_OPENSSL_INCS" ""
1N/A cnf_append "SDK_VBOX_OPENSSL_LIBS" "`strip_l "$LIBCRYPTO"`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for pthread, needed by VBoxSVC, frontends, ...
1N/A#
1N/Acheck_pthread()
1N/A{
1N/A test_header pthread
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <pthread.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A pthread_mutex_t mutex;
1N/A if (pthread_mutex_init(&mutex, NULL)) {
1N/A printf("pthread_mutex_init() failed\n");
1N/A return 1;
1N/A }
1N/A if (pthread_mutex_lock(&mutex)) {
1N/A printf("pthread_mutex_lock() failed\n");
1N/A return 1;
1N/A }
1N/A if (pthread_mutex_unlock(&mutex)) {
1N/A printf("pthread_mutex_unlock() failed\n");
1N/A return 1;
1N/A }
1N/A printf("found, OK.\n");
1N/A}
1N/AEOF
1N/A if test_compile $LIBPTHREAD pthread pthread; then
1N/A if test_execute; then
1N/A cnf_append "LIB_PTHREAD" "`strip_l "$LIBPTHREAD"`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for zlib, needed by VBoxSVC, Runtime, ...
1N/A#
1N/Acheck_z()
1N/A{
1N/A test_header zlib
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <zlib.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", ZLIB_VERSION);
1N/A#if ZLIB_VERNUM >= 0x1210
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 1.2.1 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCZ" ] && I_INCZ=`prefix_I "$INCZ"`
1N/A if test_compile "$LIBZ $I_INCZ" zlib zlib; then
1N/A if test_execute; then
1N/A cnf_append "SDK_VBOX_ZLIB_LIBS" "`strip_l "$LIBZ"`"
1N/A cnf_append "SDK_VBOX_ZLIB_INCS" "$INCZ"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for libpng, needed by kchmviewer
1N/A#
1N/Acheck_png()
1N/A{
1N/A test_header libpng
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <png.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", PNG_LIBPNG_VER_STRING);
1N/A#if PNG_LIBPNG_VER >= 10205
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 1.2.5 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCPNG" ] && I_INCPNG=`prefix_I "$INCPNG"`
1N/A# if test_compile "$LIBPNG $I_INCPNG" libpng libpng nofatal; then
1N/A if test_compile "$LIBPNG $I_INCPNG" libpng libpng; then
1N/A# if test_execute nofatal; then
1N/A if test_execute; then
1N/A cnf_append "SDK_VBOX_LIBPNG_LIBS" "`strip_l "$LIBPNG"`"
1N/A cnf_append "SDK_VBOX_LIBPNG_INCS" "$INCPNG"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for pam, needed by VRDPAuth
1N/A# Version 79 was introduced in 9/2005, do we support older versions?
1N/A# Debian/sarge uses 76
1N/A# OpenSUSE comes with 0.99.xxx where they changed the versioning scheme.
1N/A#
1N/Acheck_pam()
1N/A{
1N/A test_header pam
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <security/pam_appl.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %d", __LIBPAM_VERSION);
1N/A if (__LIBPAM_VERSION >= 76)
1N/A {
1N/A printf(", OK.\n");
1N/A return 0;
1N/A }
1N/A else
1N/A {
1N/A printf(", expected version 76 or higher\n");
1N/A return 1;
1N/A }
1N/A}
1N/AEOF
1N/A if test_compile "-lpam" pam pam nofatal; then
1N/A if test_execute nofatal; then
1N/A return 0;
1N/A fi
1N/A fi
1N/A test_header linux_pam
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <security/pam_appl.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %d.%d", __LINUX_PAM__, __LINUX_PAM_MINOR__);
1N/A if (__LINUX_PAM__ >= 1)
1N/A {
1N/A printf(", OK.\n");
1N/A return 0;
1N/A }
1N/A else
1N/A {
1N/A printf(", expected version 1.0 or higher\n");
1N/A return 1;
1N/A }
1N/A}
1N/AEOF
1N/A if test_compile "-lpam" pam pam; then
1N/A test_execute
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the SDL library, needed by VBoxSDL and VirtualBox
1N/A# We depend at least on version 1.2.7
1N/A#
1N/Acheck_sdl()
1N/A{
1N/A test_header SDL
1N/A if [ "$OS" = "darwin" ]; then
1N/A if [ -f "/System/Library/Frameworks/SDL.framework/SDL" ]; then
1N/A PATH_SDK_LIBSDL="/System/Library/Framework/SDL.framework"
1N/A elif [ -f "/Library/Frameworks/SDL.framework/SDL" ]; then
1N/A PATH_SDK_LIBSDL="/Library/Frameworks/SDL.framework"
1N/A fi
1N/A if [ -n "$PATH_SDK_LIBSDL" ]; then
1N/A foundsdl=1
1N/A INCSDL="$PATH_SDK_LIBSDL/Headers"
1N/A FLDSDL="-framework SDL"
1N/A else
1N/A log_failure "SDL framework not found"
1N/A fail
1N/A fi
1N/A else
1N/A if which_wrapper sdl-config > /dev/null; then
1N/A FLGSDL=`sdl-config --cflags`
1N/A INCSDL=`strip_I "$FLGSDL"`
1N/A LIBSDL=`sdl-config --libs`
1N/A LIBSDLMAIN="-lSDLmain"
1N/A FLDSDL=
1N/A foundsdl=1
1N/A fi
1N/A fi
1N/A [ "$OS" = "linux" -o "$OS" = "darwin" -o "$OS" = "solaris" ] && LIBSDLMAIN=""
1N/A if [ -n "$foundsdl" ]; then
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <SDL.h>
1N/A#include <SDL_main.h>
1N/A#undef main
1N/Aextern "C" int main(int argc, char** argv)
1N/A{
1N/A printf("found version %d.%d.%d",
1N/A SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1N/A#if SDL_VERSION_ATLEAST(1,2,7)
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 1.2.7 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCSDL" ] && I_INCSDL=`prefix_I "$INCSDL"`
1N/A if test_compile "$LIBSDL $LIBSDLMAIN $I_INCSDL $FLDSDL" SDL SDL; then
1N/A if test_execute; then
1N/A cnf_append "LIB_SDK_LIBSDL_SDL" "`strip_l "$LIBSDL"`"
1N/A cnf_append "SDK_LIBSDL_LIBPATH" "`strip_L "$LIBSDL"`"
1N/A cnf_append "LIB_SDK_LIBSDL_SDLMAIN" "`strip_l "$LIBSDLMAIN"`"
1N/A [ -n "$INCSDL" ] && cnf_append "SDK_LIBSDL_INCS" "$INCSDL"
1N/A [ -n "$FLDSDL" ] && cnf_append "SDK_LIBSDL_LDFLAGS" "$FLDSDL"
1N/A fi
1N/A fi
1N/A else
1N/A log_failure "not found"
1N/A fail
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the SDL_ttf library, needed by VBoxSDL (secure label)
1N/A#
1N/Acheck_sdl_ttf()
1N/A{
1N/A test_header SDL_ttf
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <SDL_ttf.h>
1N/A#ifndef SDL_TTF_MAJOR_VERSION
1N/A#define SDL_TTF_MAJOR_VERSION TTF_MAJOR_VERSION
1N/A#define SDL_TTF_MINOR_VERSION TTF_MINOR_VERSION
1N/A#define SDL_TTF_PATCHLEVEL TTF_PATCHLEVEL
1N/A#endif
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %d.%d.%d",
1N/A SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL);
1N/A#if 10000*SDL_TTF_MAJOR_VERSION + 100*SDL_TTF_MINOR_VERSION + SDL_TTF_PATCHLEVEL >= 20006
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 2.0.6 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A if test_compile "-lSDL_ttf $I_INCSDL" SDL_ttf SDL_ttf nofatal; then
1N/A if ! test_execute nofatal; then
1N/A cnf_append "VBOX_WITH_SECURELABEL" ""
1N/A fi
1N/A else
1N/A cnf_append "VBOX_WITH_SECURELABEL" ""
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for libasound, needed by the ALSA audio backend
1N/A#
1N/Acheck_alsa()
1N/A{
1N/A test_header ALSA
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <alsa/asoundlib.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %d.%d.%d",
1N/A SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR);
1N/A#if 10000*SND_LIB_MAJOR + 100*SND_LIB_MINOR + SND_LIB_SUBMINOR >= 10006
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 1.0.6 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A if test_compile "-lasound" asound asound; then
1N/A test_execute
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for PulseAudio
1N/A#
1N/Acheck_pulse()
1N/A{
1N/A test_header "PulseAudio"
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <pulse/version.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s API version %d", pa_get_headers_version(), PA_API_VERSION);
1N/A#if PA_API_VERSION >= 9
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 0.9.0 (API version 9) or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A if test_compile "-lpulse" pulse pulse; then
1N/A test_execute
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the Xcursor library, needed by VBoxSDL and VBoxBFE
1N/A#
1N/Acheck_xcursor()
1N/A{
1N/A test_header Xcursor
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <X11/Xlib.h>
1N/A#include <X11/Xcursor/Xcursor.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A XcursorImage *cursor = XcursorImageCreate (10, 10);
1N/A XcursorImageDestroy(cursor);
1N/A return 0;
1N/A}
1N/AEOF
1N/A [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1N/A if test_compile "$LIBX11 $LIBXCURSOR $I_INCX11" Xcursor Xcursor; then
1N/A log_success "found"
1N/A cnf_append "VBOX_XCURSOR_LIBS" "`strip_l "$LIBXCURSOR"`"
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the X libraries (Xext, X11)
1N/A#
1N/Acheck_x()
1N/A{
1N/A test_header "X libraries"
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <X11/Xlib.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A Display *dpy;
1N/A int scrn_num;
1N/A Screen *scrn;
1N/A Window win;
1N/A
1N/A dpy = XOpenDisplay(NULL);
1N/A scrn_num = DefaultScreen(dpy);
1N/A scrn = ScreenOfDisplay(dpy, scrn_num);
1N/A win = XCreateWindow(dpy, RootWindowOfScreen(scrn), 0, 0, 100, 100,
1N/A 0, 16, InputOutput, CopyFromParent, 0, NULL);
1N/A XDestroyWindow(dpy, win);
1N/A}
1N/AEOF
1N/A [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
1N/A if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
1N/A log_success "found"
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the Qt3 library, needed by VirtualBox
1N/A#
1N/Acheck_qt3()
1N/A{
1N/A test_header Qt3
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <qglobal.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", QT_VERSION_STR);
1N/A#if QT_VERSION >= 0x030305
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#elif QT_VERSION >= 0x030300
1N/A printf("\n ** WARNING: QT < 3.3.5 has known problems!\n");
1N/A#else
1N/A printf(", expected version 3.3.0 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A found_qt=0
1N/A libs="lib"
1N/A [ "$LIB" = "lib64" ] && libs="$libs lib64"
1N/A for q in $QT3DIR; do
1N/A for l in $libs; do
1N/A echo "compiling the following source file:" >> $LOG
1N/A cat .tmp_src.cc >> $LOG
1N/A echo "using the following command line:" >> $LOG
1N/A echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt $LIBPTHREAD" >> $LOG
1N/A $CXX -O -Wall -o .tmp_out .tmp_src.cc -I$q/include -L$q/$l -lqt-mt $LIBPTHREAD >> $LOG 2>&1
1N/A if [ $? -eq 0 ]; then
1N/A if test_execute; then
1N/A cnf_append "PATH_SDK_QT3" "`cd $q ; pwd`"
1N/A found_qt=1
1N/A break
1N/A fi
1N/A fi
1N/A done
1N/A if [ $found_qt -eq 1 ]; then
1N/A break
1N/A fi
1N/A done
1N/A if [ $found_qt -ne 1 ]; then
1N/A echo
1N/A echo " Qt3 not found at \"$QT3DIR\" or Qt3 headers not found"
1N/A echo " Check the file $LOG for detailed error information."
1N/A fail
1N/A return 1
1N/A fi
1N/A test_header "Qt3 devtools"
1N/A if check_avail "$q/bin/moc" QT3DIR/bin; then
1N/A moc_ver=`$q/bin/moc 2>&1 -v|sed 's+^.*(Qt \(.*\))+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $moc_ver"
1N/A # cnf_append "VBOX_PATH_QT3" "$q" - later/never?
1N/A cnf_append "PATH_SDK_QT3" "$q"
1N/A cnf_append "PATH_SDK_QT3_LIB" "$q/$l"
1N/A cnf_append "PATH_SDK_QT3_INC" "$q/include"
1N/A cnf_append "PATH_TOOL_QT3_BIN" "$q/bin"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the Qt4 library, needed by VirtualBox4
1N/A#
1N/A# Currently not fatal.
1N/A#
1N/Acheck_qt4()
1N/A{
1N/A foundqt4=
1N/A test_header Qt4
1N/A if [ "$OS" = "darwin" ]; then
1N/A if [ -f "/System/Library/Frameworks/QtCore.framework/QtCore" ]; then
1N/A PATH_SDK_QT4="/System/Library/Framework/QtCore.framework"
1N/A elif [ -f "/Library/Frameworks/QtCore.framework/QtCore" ]; then
1N/A PATH_SDK_QT4="/Library/Frameworks/QtCore.framework"
1N/A fi
1N/A if [ -n "$PATH_SDK_QT4" ]; then
1N/A foundqt4=1
1N/A INCQT4="$PATH_SDK_QT4/Headers"
1N/A LIBQT4=
1N/A FLGQT4="-framework QtCore"
1N/A else
1N/A log_failure "Qt4 framework not found (can be disable using --disable-qt4)"
1N/A fail
1N/A fi
1N/A else
1N/A if [ $QT4DIR_PKGCONFIG -eq 1 ]; then
1N/A # default is to use pkg-config
1N/A if which_wrapper pkg-config > /dev/null; then
1N/A # this braindead path is necessary for mdv2008.1
1N/A qt4_ver=`\
1N/A PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1N/A pkg-config QtCore --modversion 2>> $LOG`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A FLGQT4=`\
1N/A PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1N/A pkg-config QtCore --cflags`
1N/A INCQT4=`strip_I "$FLGQT4"`
1N/A LIBQT4=`\
1N/A PKG_CONFIG_PATH=/usr/lib/qt4/lib/pkgconfig \
1N/A PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
1N/A pkg-config QtCore --libs`
1N/A foundqt4=1
1N/A fi
1N/A else
1N/A log_failure "pkg-config not found"
1N/A fail
1N/A fi
1N/A else
1N/A # do it the old way (e.g. user has specified QT4DIR)
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <QtGlobal>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", QT_VERSION_STR);
1N/A#if QT_VERSION >= 0x040300
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 4.3.0 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A for q in $QT4DIR; do
1N/A INCQT4="$q/include $q/include/QtCore"
1N/A FLGQT4="-DQT_SHARED"
1N/A I_INCQT4=`prefix_I "$INCQT4"`
1N/A LIBQT4="-L$q/lib -lVBoxQtCore"
1N/A if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1N/A foundqt4=2
1N/A break;
1N/A fi
1N/A LIBQT4="-L$q/lib -lQtCore"
1N/A if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1N/A foundqt4=1
1N/A break;
1N/A fi
1N/A done
1N/A fi
1N/A fi
1N/A if [ -n "$foundqt4" ]; then
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <QtGlobal>
1N/Aextern "C" int main(void)
1N/A{
1N/A printf("found version %s", QT_VERSION_STR);
1N/A#if QT_VERSION >= 0x040300
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 4.3.0 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A [ -n "$INCQT4" ] && I_INCQT4=`prefix_I "$INCQT4"`
1N/A if test_compile "$LIBQT4 $LIBPTHREAD $I_INCQT4 $FLGQT4" qt4 qt4 nofatal; then
1N/A if test_execute_path "`strip_L "$LIBQT4"`"; then
1N/A if [ "$OS" != "darwin" ]; then
1N/A # strip .../QtCore as we add components ourself
1N/A INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'`
1N/A # store only the first path, remove all other pathes
1N/A # most likely pkg-config gave us -I/usr/include/qt4 -I/usr/include/qt4/QtCore
1N/A INCQT4=`echo "$INCQT4"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'`
1N/A cnf_append "VBOX_PATH_QT4_LIB" "`strip_L "$LIBQT4"`"
1N/A cnf_append "SDK_QT4_LIBPATH" "`strip_L "$LIBQT4"`"
1N/A cnf_append "PATH_SDK_QT4_INC" "$INCQT4"
1N/A # this is not quite right since the qt libpath does not have to be first...
1N/A cnf_append "PATH_SDK_QT4_LIB" '$'"(firstword `strip_L "$LIBQT4"`)"
1N/A if [ "$foundqt4" = "2" ]; then
1N/A cnf_append "VBOX_WITH_QT4_SUN" "1"
1N/A fi
1N/A test_header "Qt4 devtools"
1N/A for q in $QT4DIR; do
1N/A if which_wrapper "$q/bin/moc" > /dev/null; then
1N/A moc_ver=`$q/bin/moc -v 2>&1|sed 's+^.*(Qt \(.*\))+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $moc_ver"
1N/A cnf_append "VBOX_PATH_QT4" "$q"
1N/A cnf_append "PATH_SDK_QT4" "$q"
1N/A cnf_append "PATH_TOOL_QT4" "$q"
1N/A cnf_append "PATH_TOOL_QT4_BIN" "$q/bin"
1N/A return
1N/A fi
1N/A fi
1N/A done
1N/A fi
1N/A fi
1N/A else
1N/A log_failure "not found"
1N/A fail
1N/A fi
1N/A else
1N/A log_failure "not found"
1N/A fail
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check whether static libstdc++ is installed
1N/A#
1N/Acheck_staticlibstdcxx()
1N/A{
1N/A test_header "static stc++ library"
1N/A libstdcxx=`$CXX -print-file-name=libstdc++.a`
1N/A cat > .tmp_src.cc << EOF
1N/A#include <string>
1N/A
1N/Aextern "C" int main(void)
1N/A{
1N/A std::string s = "test";
1N/A return 0;
1N/A}
1N/AEOF
1N/A if test_compile "$libstdcxx" libstdc++ libstdc++; then
1N/A log_success "found"
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for Linux sources
1N/A#
1N/Acheck_linux()
1N/A{
1N/A test_header "Linux kernel sources"
1N/A cat > .tmp_src.c << EOF
1N/A#include <linux/version.h>
1N/Aint printf(const char *format, ...);
1N/Aint main(void)
1N/A{
1N/A printf("found version %d.%d.%d", LINUX_VERSION_CODE / 65536,
1N/A (LINUX_VERSION_CODE % 65536) / 256,
1N/A LINUX_VERSION_CODE % 256);
1N/A#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 2.4.0 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A echo "compiling the following source file:" >> $LOG
1N/A cat .tmp_src.c >> $LOG
1N/A echo "using the following command line:" >> $LOG
1N/A echo "$CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include" >> $LOG
1N/A $CC -O -Wall -o .tmp_out .tmp_src.c -nostdinc -I$LINUX/include >> $LOG 2>&1
1N/A if [ $? -ne 0 ]; then
1N/A echo
1N/A echo " Linux kernel headers not found at $LINUX"
1N/A echo " Check the file $LOG for detailed error information."
1N/A fail
1N/A else
1N/A if test_execute; then
1N/A cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for kchmviewer, needed to display the online help
1N/A# (unused as we ship kchmviewer)
1N/A#
1N/Acheck_kchmviewer()
1N/A{
1N/A test_header kchmviewer
1N/A if check_avail "$KCHMVIEWER" KCHMVIEWER; then
1N/A kchmviewer_ver=`$KCHMVIEWER --version|grep "^KchmViewer:"|sed 's+^KchmViewer: \(.*\)+\1+'`
1N/A if [ $? -ne 0 ]; then
1N/A log_failure "not found"
1N/A fail
1N/A else
1N/A log_success "found version $kchmviewer_ver"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for the kBuild tools, we don't support GNU make
1N/A#
1N/Acheck_kbuild()
1N/A{
1N/A test_header kBuild
1N/A if which_wrapper "$KBUILDDIR/bin/$OS.$BUILD_MACHINE/kmk" > /dev/null; then
1N/A KBUILDDIR_BIN="$KBUILDDIR/bin/$OS.$BUILD_MACHINE"
1N/A echo "export PATH_KBUILD=\"`cd $KBUILDDIR ; pwd`\"" >> $ENV
1N/A echo "export PATH_DEVTOOLS=\"$DEVDIR\"" >> $ENV
1N/A echo "path_kbuild_bin=\"\$PATH_KBUILD/bin/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"" >> $ENV
1N/A echo "export PATH_KBUILD_BIN=\"\$path_kbuild_bin\"" >> $ENV
1N/A echo "path_dev_bin=\"\$PATH_DEVTOOLS/\$BUILD_TARGET.\$BUILD_PLATFORM_ARCH\"/bin" >> $ENV
1N/A if [ "$OS" = "solaris" ]; then
1N/A # Because of sh being non-default shell in Solaris we need to export PATH again when
1N/A # sourcing env.sh. Simply exporting from ./configure does not export PATH correctly.
1N/A echo "PATH=\"$ORGPATH\"" >> $ENV
1N/A echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1N/A echo "echo \"\$PATH\" | /usr/sfw/bin/ggrep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1N/A else
1N/A echo "echo \"\$PATH\" | grep -q \"\$path_kbuild_bin\" || PATH=\"\$path_kbuild_bin:\$PATH\"" >> $ENV
1N/A echo "echo \"\$PATH\" | grep -q \"\$path_dev_bin\" || PATH=\"\$path_dev_bin:\$PATH\"" >> $ENV
1N/A fi
1N/A echo "export PATH" >> $ENV
1N/A echo "unset path_kbuild_bin path_dev_bin" >> $ENV
1N/A KBUILD_SED="$KBUILDDIR_BIN/kmk_sed"
1N/A elif check_avail "kmk" KBUILDDIR really; then
1N/A # check for installed kBuild
1N/A KBUILD_SED="`which_wrapper kmk_sed`"
1N/A else
1N/A fail
1N/A fi
1N/A log_success "found"
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for compiler.h
1N/A# Some Linux distributions include "compiler.h" in their libc linux
1N/A# headers package, some don't. Most don't need it, building might (!)
1N/A# not succeed on openSUSE without it.
1N/A#
1N/A# See http://www.mail-archive.com/qemu-devel%40nongnu.org/msg07980.html
1N/A#
1N/Acheck_compiler_h()
1N/A{
1N/A test_header compiler.h
1N/A if ! test -f "/usr/include/linux/compiler.h"; then
1N/A cnf_append "VBOX_WITHOUT_LINUX_COMPILER_H" "1"
1N/A log_success "compiler.h not found"
1N/A else
1N/A log_success "compiler.h found"
1N/A fi
1N/A}
1N/A
1N/A#
1N/A# Check for libcap.
1N/A# Required to pass CAP_NET_RAW to our binaries to allow to open SOCK_RAW
1N/A# sockets for doing ICMP requests.
1N/A#
1N/Acheck_libcap()
1N/A{
1N/A test_header "libcap library"
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <sys/capability.h>
1N/A
1N/Aextern "C" int main(void)
1N/A{
1N/A char buf[1024];
1N/A cap_t caps = cap_get_proc();
1N/A snprintf(buf, sizeof(buf), "Current caps are '%s'\n", cap_to_text(caps, NULL));
1N/A return 0;
1N/A}
1N/AEOF
1N/A if test_compile $LIBCAP libcap libcap; then
1N/A if test_execute; then
1N/A log_success "found"
1N/A fi
1N/A fi
1N/A}
1N/A
1N/A#
1N/A# Check if we are able to build 32-bit applications (needed for the guest additions)
1N/A#
1N/Acheck_32bit()
1N/A{
1N/A test_header "32-bit support"
1N/A cat > .tmp_src.c << EOF
1N/A#include <stdint.h>
1N/Aint main(void)
1N/A{
1N/A return 0;
1N/A}
1N/AEOF
1N/A echo "compiling the following source file:" >> $LOG
1N/A cat .tmp_src.c >> $LOG
1N/A echo "using the following command line:" >> $LOG
1N/A echo "$CC -m32 -O -Wall -o .tmp_out .tmp_src.c" >> $LOG
1N/A $CC -m32 -O -Wall -o .tmp_out .tmp_src.c >> $LOG 2>&1
1N/A if [ $? -ne 0 ]; then
1N/A echo
1N/A echo " Cannot compile 32-bit applications (missing headers and/or libraries)!"
1N/A echo " Check the file $LOG for detailed error information."
1N/A fail
1N/A fi
1N/A log_success ""
1N/A}
1N/A
1N/A
1N/A#
1N/A# Check for Python
1N/A#
1N/Acheck_python()
1N/A{
1N/A test_header "python support"
1N/A cat > .tmp_src.cc << EOF
1N/A#include <cstdio>
1N/A#include <Python.h>
1N/Aextern "C" int main(void)
1N/A{
1N/A Py_Initialize();
1N/A printf("found version %s", PY_VERSION);
1N/A#if PY_VERSION_HEX >= 0x02030000
1N/A printf(", OK.\n");
1N/A return 0;
1N/A#else
1N/A printf(", expected version 2.3 or higher\n");
1N/A return 1;
1N/A#endif
1N/A}
1N/AEOF
1N/A found=
1N/A for p in $PYTHONDIR; do
1N/A for d in python2.6 python2.5 python2.4 python2.3; do
1N/A for b in lib64 lib/64 lib; do
1N/A echo "compiling the following source file:" >> $LOG
1N/A cat .tmp_src.cc >> $LOG
1N/A echo "using the following command line:" >> $LOG
1N/A echo "$CXX -O -Wall -o .tmp_out .tmp_src.cc -I$p/include/$d $p/$b/lib$d.so" >> $LOG
1N/A $CXX -O -Wall -o .tmp_out .tmp_src.cc -I$p/include/$d $p/$b/lib$d.so >> $LOG 2>&1
1N/A if [ $? -eq 0 ]; then
1N/A found=1
1N/A break
1N/A fi
1N/A done
1N/A if [ -n "$found" ]; then break; fi
1N/A done
1N/A if [ -n "$found" ]; then break; fi
1N/A done
1N/A if [ -n "$found" ]; then
1N/A if test_execute; then
1N/A cnf_append "VBOX_WITH_PYTHON" "1"
1N/A cnf_append "VBOX_PATH_PYTHON_INC" "$p/include/$d"
1N/A cnf_append "VBOX_LIB_PYTHON" "$p/$b/lib$d.so"
1N/A else
1N/A log_failure "not found"
1N/A fail
1N/A fi
1N/A else
1N/A log_failure "not found"
1N/A fail
1N/A fi
1N/A}
1N/A
1N/A
1N/A#
1N/A# Setup wine
1N/A#
1N/Asetup_wine()
1N/A{
1N/A test_header "Wine support"
1N/A if ! which_wrapper wine > /dev/null; then
1N/A echo " wine binary not found"
1N/A fail
1N/A fi
1N/A if ! which_wrapper wineprefixcreate > /dev/null; then
1N/A echo " wineprefixcreate not found"
1N/A fail
1N/A fi
1N/A export WINEPREFIX="${ODIR}wine.$BUILD_MACHINE"
1N/A echo "export WINEPREFIX=\"${ODIR}wine.$BUILD_MACHINE\"" >> $ENV
1N/A rm -rf $WINEPREFIX
1N/A mkdir -p $WINEPREFIX
1N/A touch $WINEPREFIX/.no_prelaunch_window_flag
1N/A if ! wineprefixcreate -q > /dev/null 2>&1; then
1N/A echo " wineprefixcreate failed"
1N/A fail
1N/A fi
1N/A tmp=.tmp.wine.reg
1N/A rm -f $tmp
1N/A echo 'REGEDIT4' > $tmp
1N/A echo '' >> $tmp
1N/A echo '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment]' >> $tmp
1N/A 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
1N/A echo '' >> $tmp
1N/A echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhc.exe\DllOverrides]' >> $tmp
1N/A echo '"itss"="native"' >> $tmp
1N/A echo '' >> $tmp
1N/A echo '[HKEY_CURRENT_USER\Software\Wine\AppDefaults\hhw.exe\DllOverrides]' >> $tmp
1N/A echo '"itss"="native"' >> $tmp
1N/A echo '' >> $tmp
1N/A if ! wine regedit $tmp > /dev/null 2>&1; then
1N/A rm -f $tmp
1N/A echo " failed to load registry changes (path)."
1N/A fail
1N/A fi
1N/A rm -f $tmp
1N/A log_success "found"
1N/A}
1N/A
1N/A
1N/A#
1N/A# Determines the Darwin version.
1N/A# @todo This should really check the Xcode/SDK version.
1N/A#
1N/Acheck_darwinversion()
1N/A{
1N/A test_header "Darwin version"
1N/A darwin_ver=`uname -r`
1N/A case "$darwin_ver" in
1N/A 9\.*)
1N/A darwin_ver="10.5"
1N/A #cnf_append "VBOX_TARGET_MAC_OS_X_VERSION_10_5" "1"
1N/A ;;
1N/A 8\.*)
1N/A darwin_ver="10.4"
1N/A ;;
1N/A *)
1N/A echo " failed to determin darwin version. (uname -r: $darwin_ver)"
1N/A fail
1N/A darwin_ver="unknown"
1N/A ;;
1N/A esac
1N/A log_success "found version $darwin_ver"
1N/A}
1N/A
1N/A
1N/A#
1N/A# Checks that i386-elf-gcc-3.4.6, i386-elf-gcc-3.4.3, i386-elf-gcc-3.4 or i386-elf-gcc
1N/A# is around to prevent confusion when the build fails in src/recompiler.
1N/A# Note. Keep the which order in sync with the $(which ) in src/recompiler/Makefile.kmk.
1N/A#
1N/Acheck_i386elfgcc()
1N/A{
1N/A test_header "i386-elf-gcc"
1N/A i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.6`
1N/A test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4.3`
1N/A test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc-3.4`
1N/A test -z "$i386_elf_gcc" && i386_elf_gcc=`which_wrapper i386-elf-gcc`
1N/A if test -z "$i386_elf_gcc"; then
1N/A echo " failed to find i386-elf-gcc"
1N/A fail
1N/A fi
1N/A log_success "found $i386_elf_gcc"
1N/A}
1N/A
1N/A
1N/A#
1N/A# Show help
1N/A#
1N/Ashow_help()
1N/A{
1N/A cat << EOF
1N/AUsage: ./configure [OPTIONS]...
1N/A
1N/AConfiguration:
1N/A -h, --help display this help and exit
1N/A --nofatal don't abort on errors
1N/A --disable-xpcom disable XPCOM and related stuff
1N/A --disable-python disable python bindings
1N/A --disable-sdl-ttf disable SDL_ttf detection
1N/A --disable-alsa disable the ALSA sound backend
1N/A --disable-pulse disable the PulseAudio backend
1N/A --disable-dbus don't use DBus and hal for hardware detection
1N/A --disable-kmods don't build Linux kernel modules (host and guest)
1N/A --disable-hardening don't be strict about /dev/vboxdrv access
1N/A --build-libxml2 build libxml2 from sources
1N/A --build-libxslt build libxslt from sources
1N/A --setup-wine setup a Wine directory and register the hhc hack
1N/A
1N/APaths:
1N/A --with-gcc=PATH location of the gcc compiler [$CC]
1N/A --with-g++=PATH location of the g++ compiler [$CXX]
1N/A --with-gcc-compat=PATH location of the gcc compiler for recompiler [$CC]
1N/A --with-kbuild=DIR kbuild directory [$KBUILDDIR]
1N/A --with-iasl=PATH location of the iasl compiler [$IASL]
1N/A --with-linux=DIR Linux kernel source directory [$LINUX]
1N/A --with-mkisofs=PATH location of mkisofs [$MKISOFS]
1N/A --with-qt-dir=DIR directory for Qt3 headers/libraries [$QT3DIR]
1N/A --with-qt4-dir=DIR directory for Qt4 headers/libraries [pkgconfig]
1N/A
1N/ABuild type:
1N/A -d, --build-debug build with debugging symbols and assertions
1N/A --build-profile build with profiling support
1N/A --build-headless build headless (without any X11 frontend)
1N/AEOF
1N/A exit 0
1N/A}
1N/A
1N/A
1N/A#
1N/A# The body.
1N/A#
1N/A
1N/A# scan command line options
1N/Afor option in $*; do
1N/A case "$option" in
1N/A --help|-help|-h)
1N/A show_help
1N/A ;;
1N/A --nofatal)
1N/A nofatal=1
1N/A ;;
1N/A --env-only)
1N/A ENV_ONLY=1
1N/A ;;
1N/A --with-gcc=*)
1N/A CC=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --with-g++=*)
1N/A CXX=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --with-gcc-compat=*)
1N/A CC_COMPAT=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --with-kbuild=*)
1N/A KBUILDDIR=`echo $option | cut -d'=' -f2`
1N/A if echo $KBUILDDIR|grep -q "$INVALID_CHARS"; then
1N/A echo "Error: KBUILDDIR contains invalid characters!"
1N/A exit 1
1N/A fi
1N/A ;;
1N/A --with-qt-dir=*)
1N/A QT3DIR=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --with-qt4-dir=*)
1N/A QT4DIR=`echo $option | cut -d'=' -f2`
1N/A QT4DIR_PKGCONFIG=0
1N/A ;;
1N/A --with-iasl=*)
1N/A IASL=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --with-linux=*)
1N/A LINUX=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --with-mkisofs=*)
1N/A MKISOFS=`echo $option | cut -d'=' -f2`
1N/A ;;
1N/A --disable-xpcom)
1N/A WITH_XPCOM=0
1N/A ;;
1N/A --disable-python)
1N/A WITH_PYTHON=0
1N/A ;;
1N/A --disable-sdl-ttf)
1N/A WITH_SDL_TTF=0
1N/A ;;
1N/A --disable-qt)
1N/A WITH_QT3=0
1N/A WITH_QT4=0
1N/A ;;
1N/A --disable-qt3)
1N/A WITH_QT3=0
1N/A ;;
1N/A --disable-qt4)
1N/A WITH_QT4=0
1N/A ;;
1N/A --disable-alsa)
1N/A WITH_ALSA=0
1N/A ;;
1N/A --disable-pulse)
1N/A WITH_PULSE=0
1N/A ;;
1N/A --disable-dbus)
1N/A WITH_DBUS=0
1N/A ;;
1N/A --disable-kmods)
1N/A WITH_KMODS=0
1N/A ;;
1N/A --disable-hardening)
1N/A WITH_HARDENING=0
1N/A ;;
1N/A --enable-hardening)
1N/A WITH_HARDENING=2
1N/A ;;
1N/A --build-debug|-d)
1N/A BUILD_TYPE=debug
1N/A ;;
1N/A --build-profile)
1N/A BUILD_TYPE=profile
1N/A ;;
1N/A --build-libxml2)
1N/A BUILD_LIBXML2=1
1N/A ;;
1N/A --build-libxslt)
1N/A BUILD_LIBXSLT=1
1N/A ;;
1N/A --build-headless)
1N/A HEADLESS=1
1N/A WITH_SDL=0
1N/A WITH_SDL_TTF=0
1N/A WITH_X11=0
1N/A WITH_QT3=0
1N/A WITH_QT4=0
1N/A ;;
1N/A --ose)
1N/A OSE=2
1N/A ;;
1N/A --odir=*)
1N/A ODIR="`echo $option | cut -d'=' -f2`/"
1N/A ;;
1N/A --setup-wine)
1N/A SETUP_WINE=1
1N/A ;;
1N/A *)
1N/A echo
1N/A echo "Unrecognized option \"$option\""
1N/A echo
1N/A show_help
1N/A ;;
1N/A esac
1N/Adone
1N/A
1N/ALOG="$ODIR$LOG"
1N/AENV="$ODIR$ENV"
1N/ACNF="$ODIR$CNF"
1N/A
1N/A# initialize output files
1N/Acat > $LOG << EOF
1N/A# Log file generated by
1N/A#
1N/A# '$0 $*'
1N/A#
1N/A
1N/AEOF
1N/Acat > $CNF << EOF
1N/A# -*- Makefile -*-
1N/A#
1N/A# automatically generated by
1N/A#
1N/A# '$0 $*'
1N/A#
1N/A# It will be completely overwritten if configure is executed again.
1N/A#
1N/A
1N/AEOF
1N/Acat > $ENV << EOF
1N/A#!/bin/bash
1N/A#
1N/A# automatically generated by
1N/A#
1N/A# '$0 $*'
1N/A#
1N/A# It will be completely overwritten if configure is executed again.
1N/A# Make sure you source this file once before you start to build VBox.
1N/A#
1N/A
1N/AEOF
1N/A
1N/A# test if we are OSE
1N/Aif [ $OSE -eq 1 -a -d "`cd \`dirname $0\`; pwd`/src/VBox/Devices/USB" ]; then
1N/A echo "Found USB devices, assuming VBOX_OSE = FALSE" >> $LOG
1N/A echo >> $LOG
1N/A OSE=0
1N/Afi
1N/A
1N/Aif [ "$BUILD_TYPE" = "debug" ]; then
1N/A echo "Creating DEBUG build!" >> $LOG
1N/Aelif [ "$BUILD_TYPE" = "profile" ]; then
1N/A echo "Creating PROFILE build!" >> $LOG
1N/Afi
1N/A
1N/A# first determine our environment
1N/Acheck_environment
1N/Acheck_kbuild
1N/A
1N/A[ -n "$ENV_ONLY" ] && exit 0
1N/A
1N/A# append the tools directory to the default search path
1N/Aecho "$PATH" | grep -q "$DEVDIR_BIN" || PATH="$PATH:$DEVDIR_BIN"
1N/Aexport PATH
1N/A
1N/A# some things are not available in for OSE
1N/Aif [ $OSE -ge 1 ]; then
1N/A cnf_append "VBOX_OSE" "1"
1N/A cnf_append "VBOX_WITH_TESTSUITE" ""
1N/A cnf_append "VBOX_WITH_WIN32_ADDITIONS" ""
1N/A
1N/A if [ "$OS" = "linux" ]; then
1N/A cnf_append "VBOX_WITH_LINUX_ADDITIONS" "1"
1N/A else
1N/A cnf_append "VBOX_WITH_LINUX_ADDITIONS" ""
1N/A fi
1N/A echo >> $CNF
1N/Afi
1N/A
1N/A# headless
1N/Aif [ -n "$HEADLESS" ]; then
1N/A cnf_append "VBOX_HEADLESS" "1"
1N/Afi
1N/A
1N/Aif [ "$OS" = "darwin" ]; then
1N/A # On Darwin we want to build against Qt4 only. WITH_QT4 is enabled by
1N/A # default so disable Qt3. --disable-qt disables both Qt3 and Qt4 GUI now,
1N/A # --disable-qt4 disables only the Qt4 GUI (which is not appropriate for
1N/A # Darwin as we disable the Qt3 here anyway.
1N/A # (Qt3 builds for Intel Macs are usually not threaded or for X11. And they
1N/A # don't contain our patches, which means the result isn't really usable.)
1N/A WITH_QT3=0
1N/A BUILD_LIBXSLT=1
1N/A BUILD_LIBXML2=1
1N/Afi
1N/A
1N/A# emit disable directives corresponding to any --disable-xxx options.
1N/A[ $WITH_XPCOM -eq 0 ] && cnf_append "VBOX_WITH_MAIN" ""
1N/A[ $WITH_QT3 -eq 0 ] && cnf_append "VBOX_WITH_QTGUI" ""
1N/A[ $WITH_QT4 -eq 0 ] && cnf_append "VBOX_WITH_QT4GUI" ""
1N/A[ $WITH_SDL_TTF -eq 0 ] && cnf_append "VBOX_WITH_SECURELABEL" ""
1N/A[ $WITH_HARDENING -eq 0 ] && cnf_append "VBOX_WITHOUT_HARDENING" "1"
1N/A[ $WITH_HARDENING -eq 2 ] && cnf_append "VBOX_WITH_HARDENING" "2"
1N/A
1N/A# the tools
1N/Acheck_gcc
1N/A[ "$OS" != "darwin" ] && check_as86
1N/A[ "$OS" != "darwin" ] && check_bcc
1N/A[ "$OS" != "darwin" ] && check_iasl
1N/A# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
1N/A# [ "$OS" != "darwin" ] && check_yasm
1N/A[ "$OS" != "darwin" ] && check_xsltproc
1N/A[ $OSE -eq 0 -a "$OS" != "darwin" ] && check_mkisofs
1N/A
1N/A# the libraries
1N/A[ "$OS" != "darwin" ] && check_pthread
1N/A[ $WITH_XPCOM -eq 1 ] && check_libxml2
1N/A[ $WITH_XPCOM -eq 1 ] && check_libxslt
1N/A[ $WITH_LIBIDL -eq 1 ] && check_libidl
1N/A# build openssl on Darwin in every case
1N/A[ "$OS" != "darwin" -a $OSE -eq 0 ] && check_ssl
1N/A[ "$OS" != "darwin" ] && check_z
1N/A[ "$OS" != "darwin" ] && check_png
1N/A[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
1N/A[ $WITH_SDL -eq 1 ] && check_sdl
1N/A[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
1N/A[ $WITH_X11 -eq 1 ] && check_x
1N/A# TODO check for Xmu (X11/Xmu/StdCmap.h)
1N/A# TODO check for mesa-common-dev (GL/glx.h)
1N/A# TODO check for libglu1-mesa-dev (GL/glu.h)
1N/A[ $WITH_X11 -eq 1 ] && check_xcursor
1N/A[ $WITH_QT3 -eq 1 ] && check_qt3
1N/A[ $WITH_QT4 -eq 1 ] && check_qt4
1N/A[ $WITH_PYTHON -eq 1 -a "$OS" != "darwin" ] && check_python
1N/A
1N/A# Linux-specific
1N/Aif [ "$OS" = "linux" ]; then
1N/A check_staticlibstdcxx
1N/A if [ $WITH_KMODS -eq 1 ]; then
1N/A check_linux
1N/A else
1N/A cnf_append "VBOX_LINUX_SRC" ""
1N/A cnf_append "VBOX_WITH_VBOXDRV" ""
1N/A cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
1N/A fi
1N/A if [ $WITH_ALSA -eq 1 ]; then
1N/A check_alsa
1N/A else
1N/A cnf_append "VBOX_WITH_ALSA" ""
1N/A fi
1N/A if [ $WITH_PULSE -eq 1 ]; then
1N/A check_pulse
1N/A else
1N/A cnf_append "VBOX_WITH_PULSE" ""
1N/A fi
1N/A if [ $WITH_DBUS -eq 0 ]; then
1N/A cnf_append "VBOX_WITH_DBUS" ""
1N/A fi
1N/A check_libcap
1N/A check_compiler_h
1N/A [ "$BUILD_MACHINE" = "amd64" ] && check_32bit
1N/Afi
1N/A
1N/A[ -n "$SETUP_WINE" ] && setup_wine
1N/A
1N/A# Darwin-specific
1N/Aif [ "$OS" = "darwin" ]; then
1N/A check_darwinversion
1N/A check_i386elfgcc
1N/Afi
1N/A
1N/A# success!
1N/Aecho
1N/Aecho "Successfully generated '$CNF' and '$ENV'."
1N/Aecho "Source '$ENV' once before you start to build VBox:"
1N/Aecho ""
1N/Aecho " source $ENV"
1N/Aecho " kmk"
1N/Aecho ""
1N/Aif [ "$OS" = "linux" ]; then
1N/A echo "To compile the kernel module, do:"
1N/A echo ""
1N/A echo " cd ./out/$OS.$TARGET_MACHINE/$BUILD_TYPE/bin/src/vboxdrv"
1N/A echo " make"
1N/A echo ""
1N/Afi
1N/Aif [ $WITH_HARDENING -gt 0 ]; then
1N/A echo ""
1N/A echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
1N/A echo " Hardening is enabled which means that the VBox binaries will not run from"
1N/A echo " the binary directory. The binaries have to be installed suid root and some"
1N/A echo " more prerequisites have to be fulfilled which is normally done by installing"
1N/A echo " the final package. For development, the hardening feature can be disabled"
1N/A echo " by specifying the --disable-hardening parameter. Please never disable that"
1N/A echo " feature for the final distribution!"
1N/A echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
1N/A echo ""
1N/Aelse
1N/A echo ""
1N/A echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
1N/A echo " Hardening is disabled. Please do NOT build packages for distribution with"
1N/A echo " disabled hardening!"
1N/A echo " +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
1N/A echo ""
1N/Afi
1N/Aecho "Enjoy!"
1N/Acleanup
1N/A