TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
+TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
# default parameters
prefix=""
EXESUF=""
gdbstub="yes"
slirp="yes"
+vde="yes"
fmod_lib=""
fmod_inc=""
+oss_lib=""
vnc_tls="yes"
bsd="no"
linux="no"
build_docs="no"
uname_release=""
curses="yes"
+aio="yes"
nptl="yes"
mixemu="no"
+bluez="yes"
+signalfd="no"
+eventfd="no"
# OS specific
targetos=`uname -s`
;;
GNU/kFreeBSD)
audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd"
+audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
FreeBSD)
bsd="yes"
audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd"
+audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
;;
OpenBSD)
bsd="yes"
+openbsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd"
+oss_lib="-lossaudio"
;;
Darwin)
bsd="yes"
;;
*)
audio_drv_list="oss"
-audio_possible_drivers="oss alsa sdl esd"
+audio_possible_drivers="oss alsa sdl esd pa"
linux="yes"
linux_user="yes"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
;;
--fmod-inc=*) fmod_inc="$optarg"
;;
- --audio-card-list=*) audio_card_list="$optarg"
+ --oss-lib=*) oss_lib="$optarg"
+ ;;
+ --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
;;
--audio-drv-list=*) audio_drv_list="$optarg"
;;
--disable-vnc-tls) vnc_tls="no"
;;
- --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
- ;;
--disable-slirp) slirp="no"
;;
+ --disable-vde) vde="no"
+ ;;
--disable-kqemu) kqemu="no"
;;
--disable-brlapi) brlapi="no"
;;
+ --disable-bluez) bluez="no"
+ ;;
--enable-profiler) profiler="yes"
;;
--enable-cocoa)
;;
--enable-mixemu) mixemu="yes"
;;
+ --disable-aio) aio="no"
+ ;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
done
-if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
- AIOLIBS=
-else
- # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
- AIOLIBS="-lrt -lpthread"
-fi
-
# default flags for all hosts
-CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
+CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
+CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
LDFLAGS="$LDFLAGS -g"
if test "$werror" = "yes" ; then
CFLAGS="$CFLAGS -Werror"
fi
+if ld --version 2>/dev/null | grep -q "GNU ld" ; then
+ LDFLAGS="$LDFLAGS -Wl,--warn-common"
+fi
+
#
# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
echo " --disable-werror disable compilation abort on warning"
echo " --disable-sdl disable SDL"
echo " --enable-cocoa enable COCOA (Mac OS X only)"
-echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers"
echo " --audio-card-list=LIST set list of additional emulated audio cards"
echo " --disable-brlapi disable BrlAPI"
echo " --disable-vnc-tls disable TLS encryption for VNC server"
echo " --disable-curses disable curses output"
+echo " --disable-bluez disable bluez stack connectivity"
echo " --disable-nptl disable usermode NPTL support"
echo " --enable-system enable all system emulation targets"
echo " --disable-system disable all system emulation targets"
echo " --disable-darwin-user disable all darwin usermode emulation targets"
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
+echo " --oss-lib path to OSS library"
echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
+echo " --disable-vde disable support for vde network"
+echo " --disable-aio disable AIO support"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
exit 1
fi
+# check compiler to see if we're on mingw32
+cat > $TMPC <<EOF
+#include <windows.h>
+#ifndef _WIN32
+#error not windows
+#endif
+int main(void) {}
+EOF
+
+if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
+ mingw32="yes"
+fi
+
if test "$mingw32" = "yes" ; then
linux="no"
EXESUF=".exe"
oss="no"
+ linux_user="no"
+fi
+
+if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
+ AIOLIBS=
+elif [ "$bsd" = "yes" ]; then
+ AIOLIBS="-lpthread"
+else
+ # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
+ AIOLIBS="-lrt -lpthread"
fi
# Check for gcc4, error if pre-gcc4
hostlongbits="64"
fi
+# ppc specific hostlongbits selection
+if test "$cpu" = "powerpc" ; then
+ if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
+ grep -q __powerpc64__ $TMPI && hostlongbits=64
+ else
+ echo hostlongbits test failed
+ exit 1
+ fi
+fi
+
# check gcc options support
cat > $TMPC <<EOF
int main(void) {
sdl=no
sdl_static=no
- if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
- # win32 cross compilation case
- sdl_config="i386-mingw32msvc-sdl-config"
- sdl=yes
- else
- # normal SDL probe
cat > $TMPC << EOF
#include <SDL.h>
#undef main /* We don't want SDL to override our main() */
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
- _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
- if test "$_sdlversion" -lt 121 ; then
- sdl_too_old=yes
- else
- if test "$cocoa" = "no" ; then
- sdl=yes
- fi
+ if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
+ _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
+ if test "$_sdlversion" -lt 121 ; then
+ sdl_too_old=yes
+ else
+ if test "$cocoa" = "no" ; then
+ sdl=yes
+ fi
+ fi
+
+ # static link with sdl ?
+ if test "$sdl" = "yes" ; then
+ aa="no"
+ `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
+ sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
+ if [ "$aa" = "yes" ] ; then
+ sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
fi
- # static link with sdl ?
- if test "$sdl" = "yes" ; then
- aa="no"
- `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
- sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
- if [ "$aa" = "yes" ] ; then
- sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
- fi
-
- if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
- sdl_static=yes
- fi
- fi # static link
- fi # sdl compile test
- fi # cross compilation
+ if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
+ sdl_static=yes
+ fi
+ fi # static link
+ fi # sdl compile test
else
# Make sure to disable cocoa if sdl was set
if test "$sdl" = "yes" ; then
##########################################
# VNC TLS detection
if test "$vnc_tls" = "yes" ; then
- `pkg-config gnutls` || vnc_tls="no"
+cat > $TMPC <<EOF
+#include <gnutls/gnutls.h>
+int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
+EOF
+ vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
+ vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
+ if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
+ $vnc_tls_libs 2> /dev/null ; then
+ :
+ else
+ vnc_tls="no"
+ fi
fi
-if test "$vnc_tls" = "yes" ; then
- vnc_tls_cflags=`pkg-config --cflags gnutls`
- vnc_tls_libs=`pkg-config --libs gnutls`
+
+##########################################
+# vde libraries probe
+if test "$vde" = "yes" ; then
+ cat > $TMPC << EOF
+#include <libvdeplug.h>
+int main(void)
+{
+ struct vde_open_args a = {0, 0, 0};
+ vde_open("", "", &a);
+ return 0;
+}
+EOF
+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev/null ; then
+ :
+ else
+ vde="no"
+ fi
fi
##########################################
fi
}
+audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
for drv in $audio_drv_list; do
case $drv in
alsa)
esd)
audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
;;
+
+ pa)
+ audio_drv_probe $drv pulse/simple.h -lpulse-simple \
+ "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+ ;;
+
+ oss|sdl|core|wav|dsound)
+ # XXX: Probes for CoreAudio, DirectSound, SDL(?)
+ ;;
+
+ *)
+ echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
+ echo
+ echo "Error: Unknown driver '$drv' selected"
+ echo "Possible drivers are: $audio_possible_drivers"
+ echo
+ exit 1
+ }
+ ;;
esac
done
fi
fi # test "$curses"
+##########################################
+# bluez support probe
+if test "$bluez" = "yes" ; then
+ `pkg-config bluez` || bluez="no"
+fi
+if test "$bluez" = "yes" ; then
+ cat > $TMPC << EOF
+#include <bluetooth/bluetooth.h>
+int main(void) { return bt_error(0); }
+EOF
+ bluez_cflags=`pkg-config --cflags bluez`
+ bluez_libs=`pkg-config --libs bluez`
+ if $cc $ARCH_CFLAGS -o $TMPE ${OS_FLAGS} $bluez_cflags $TMPC \
+ $bluez_libs 2> /dev/null ; then
+ :
+ else
+ bluez="no"
+ fi
+fi
+
+##########################################
+# AIO probe
+if test "$aio" = "yes" ; then
+ aio=no
+ cat > $TMPC << EOF
+#include <aio.h>
+int main(void) { return aio_write(NULL); }
+EOF
+ if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
+ aio=yes
+ fi
+fi
+
+##########################################
+# signalfd probe
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <signal.h>
+int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
+EOF
+
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ signalfd=yes
+fi
+
+##########################################
+# eventfd probe
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <sys/syscall.h>
+int main(void) { return syscall(SYS_eventfd, 0); }
+EOF
+
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ eventfd=yes
+fi
+
# Check if tools are available to build documentation.
if [ -x "`which texi2html 2>/dev/null`" ] && \
[ -x "`which pod2man 2>/dev/null`" ]; then
[ ! -z "$uname_release" ] && \
echo "uname -r $uname_release"
echo "NPTL support $nptl"
+echo "vde support $vde"
+echo "AIO support $aio"
if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
echo "#define HOST_MIPS64 1" >> $config_h
;;
powerpc)
- echo "ARCH=ppc" >> $config_mak
- echo "#define HOST_PPC 1" >> $config_h
+ if test "$hostlongbits" = "32"; then
+ echo "ARCH=ppc" >> $config_mak
+ echo "#define HOST_PPC 1" >> $config_h
+ else
+ echo "ARCH=ppc64" >> $config_mak
+ echo "#define HOST_PPC64 1" >> $config_h
+ fi
;;
s390)
echo "ARCH=s390" >> $config_mak
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
fi
fi
+
+if [ "$openbsd" = "yes" ] ; then
+ echo "#define ENOTSUP 4096" >> $config_h
+fi
+
if test "$darwin" = "yes" ; then
echo "CONFIG_DARWIN=yes" >> $config_mak
echo "#define CONFIG_DARWIN 1" >> $config_h
echo "CONFIG_SLIRP=yes" >> $config_mak
echo "#define CONFIG_SLIRP 1" >> $config_h
fi
+if test "$vde" = "yes" ; then
+ echo "CONFIG_VDE=yes" >> $config_mak
+ echo "#define CONFIG_VDE 1" >> $config_h
+ echo "VDE_LIBS=-lvdeplug" >> $config_mak
+fi
for card in $audio_card_list; do
def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
echo "$def=yes" >> $config_mak
if test "$drv" = "fmod"; then
echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
+ elif test "$drv" = "oss"; then
+ echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
fi
done
echo "" >>$config_h
echo "#define CONFIG_BRLAPI 1" >> $config_h
echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
fi
+if test "$bluez" = "yes" ; then
+ echo "CONFIG_BLUEZ=yes" >> $config_mak
+ echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
+ echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
+ echo "#define CONFIG_BLUEZ 1" >> $config_h
+fi
+if test "$aio" = "yes" ; then
+ echo "#define CONFIG_AIO 1" >> $config_h
+ echo "CONFIG_AIO=yes" >> $config_mak
+fi
+if test "$signalfd" = "yes" ; then
+ echo "#define CONFIG_signalfd 1" >> $config_h
+fi
+if test "$eventfd" = "yes" ; then
+ echo "#define CONFIG_eventfd 1" >> $config_h
+fi
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
;;
alpha)
echo "TARGET_ARCH=alpha" >> $config_mak
- echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
echo "#define TARGET_ARCH \"alpha\"" >> $config_h
echo "#define TARGET_ALPHA 1" >> $config_h
- echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
;;
arm|armeb)
echo "TARGET_ARCH=arm" >> $config_mak
;;
sh4|sh4eb)
echo "TARGET_ARCH=sh4" >> $config_mak
- echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
echo "#define TARGET_ARCH \"sh4\"" >> $config_h
echo "#define TARGET_SH4 1" >> $config_h
- echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
bflt="yes"
+ target_nptl="yes"
;;
sparc)
echo "TARGET_ARCH=sparc" >> $config_mak
done
fi
-rm -f $TMPO $TMPC $TMPE $TMPS
+rm -f $TMPO $TMPC $TMPE $TMPS $TMPI