-AC_MSG_CHECKING(how to link against winsock)
-save_LIBS="$LIBS"
-case $host_os in
- *mingw* ) GRAS_WINSOCK_DEP=-lws2_32;;
- * ) GRAS_WINSOCK_DEP="";;
-esac
-
-if test x$GRAS_WINSOCK_DEP = x; then
- AC_MSG_RESULT(not needed)
+SG_CONFIGURE_PART([Checking for threads, contexts or assimilated...])
+
+dnl #
+dnl # 1. determine possibilities
+dnl #
+
+dnl # check for MCSC method
+AC_MSG_CHECKING(on top of what can we build the contexts)
+AC_CHECK_HEADER(ucontext.h,,, [#include <sys/types.h>])
+AC_CHECK_FUNCS(makecontext swapcontext getcontext setcontext)
+AC_CHECK_MCSC(mcsc=yes, mcsc=no)
+
+dnl # check for pthread method
+AC_CHECK_HEADERS([pthread.h])
+AC_CHECK_LIB(pthread,pthread_create,pthread=yes, pthread=no)
+
+dnl #
+dnl # 2. make a general decision
+dnl #
+
+if test ".$mcsc" = .yes; then
+ mcsc=yes
+elif test ".$pthread" = .yes; then
+ pthread=yes