coroutine: adding configure choose mechanism for coroutine backend
Configure tries, as a default, ucontext functions for the coroutines. But now the user can force another backend by --with-coroutine=BACKEND option v2: Using --with-coroutine=BACKEND instead of enable disable individual configure options Signed-off-by: Alex Barcelo <abarcelo@ac.upc.edu> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
3194c8ceeb
commit
519175a2fd
37
configure
vendored
37
configure
vendored
@ -194,6 +194,7 @@ opengl=""
|
|||||||
zlib="yes"
|
zlib="yes"
|
||||||
guest_agent="yes"
|
guest_agent="yes"
|
||||||
libiscsi=""
|
libiscsi=""
|
||||||
|
coroutine=""
|
||||||
|
|
||||||
# parse CC options first
|
# parse CC options first
|
||||||
for opt do
|
for opt do
|
||||||
@ -784,6 +785,8 @@ for opt do
|
|||||||
;;
|
;;
|
||||||
--with-pkgversion=*) pkgversion=" ($optarg)"
|
--with-pkgversion=*) pkgversion=" ($optarg)"
|
||||||
;;
|
;;
|
||||||
|
--with-coroutine=*) coroutine="$optarg"
|
||||||
|
;;
|
||||||
--disable-docs) docs="no"
|
--disable-docs) docs="no"
|
||||||
;;
|
;;
|
||||||
--enable-docs) docs="yes"
|
--enable-docs) docs="yes"
|
||||||
@ -1110,6 +1113,8 @@ echo " --disable-usb-redir disable usb network redirection support"
|
|||||||
echo " --enable-usb-redir enable usb network redirection support"
|
echo " --enable-usb-redir enable usb network redirection support"
|
||||||
echo " --disable-guest-agent disable building of the QEMU Guest Agent"
|
echo " --disable-guest-agent disable building of the QEMU Guest Agent"
|
||||||
echo " --enable-guest-agent enable building of the QEMU Guest Agent"
|
echo " --enable-guest-agent enable building of the QEMU Guest Agent"
|
||||||
|
echo " --with-coroutine=BACKEND coroutine backend. Supported options:"
|
||||||
|
echo " gthread, ucontext, windows"
|
||||||
echo ""
|
echo ""
|
||||||
echo "NOTE: The object files are built at the place where configure is launched"
|
echo "NOTE: The object files are built at the place where configure is launched"
|
||||||
exit 1
|
exit 1
|
||||||
@ -2715,21 +2720,36 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# check if we have makecontext
|
# check and set a backend for coroutine
|
||||||
# (and that it's not a glibc stub which always returns -1)
|
|
||||||
|
|
||||||
ucontext_coroutine=no
|
# default is ucontext, but always fallback to gthread
|
||||||
if test "$darwin" != "yes"; then
|
# windows autodetected by make
|
||||||
cat > $TMPC << EOF
|
if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
|
||||||
|
if test "$darwin" != "yes"; then
|
||||||
|
cat > $TMPC << EOF
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
#ifdef __stub_makecontext
|
#ifdef __stub_makecontext
|
||||||
#error Ignoring glibc stub makecontext which will always fail
|
#error Ignoring glibc stub makecontext which will always fail
|
||||||
#endif
|
#endif
|
||||||
int main(void) { makecontext(0, 0, 0); return 0; }
|
int main(void) { makecontext(0, 0, 0); return 0; }
|
||||||
EOF
|
EOF
|
||||||
if compile_prog "" "" ; then
|
if compile_prog "" "" ; then
|
||||||
ucontext_coroutine=yes
|
coroutine_backend=ucontext
|
||||||
|
else
|
||||||
|
coroutine_backend=gthread
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Silently falling back into gthread backend under darwin"
|
||||||
fi
|
fi
|
||||||
|
elif test "$coroutine" = "gthread" ; then
|
||||||
|
coroutine_backend=gthread
|
||||||
|
elif test "$coroutine" = "windows" ; then
|
||||||
|
coroutine_backend=windows
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Error: unknown coroutine backend $coroutine"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
@ -2931,6 +2951,7 @@ echo "usb net redir $usb_redir"
|
|||||||
echo "OpenGL support $opengl"
|
echo "OpenGL support $opengl"
|
||||||
echo "libiscsi support $libiscsi"
|
echo "libiscsi support $libiscsi"
|
||||||
echo "build guest agent $guest_agent"
|
echo "build guest agent $guest_agent"
|
||||||
|
echo "coroutine backend $coroutine_backend"
|
||||||
|
|
||||||
if test "$sdl_too_old" = "yes"; then
|
if test "$sdl_too_old" = "yes"; then
|
||||||
echo "-> Your SDL version is too old - please upgrade to have SDL support"
|
echo "-> Your SDL version is too old - please upgrade to have SDL support"
|
||||||
@ -3246,7 +3267,7 @@ if test "$rbd" = "yes" ; then
|
|||||||
echo "CONFIG_RBD=y" >> $config_host_mak
|
echo "CONFIG_RBD=y" >> $config_host_mak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$ucontext_coroutine" = "yes" ; then
|
if test "$coroutine_backend" = "ucontext" ; then
|
||||||
echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
|
echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user