From a6587e7e46496e711a9665d455987927a3fc34d6 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 21 Jan 2006 08:11:07 +0000 Subject: [PATCH] Autoconfigure MinGW: socket library, thread package. Rewrite thread package selection. --- GNUmakefile.in | 3 +++ configure.ac | 45 +++++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/GNUmakefile.in b/GNUmakefile.in index 050cc6b4..bf57bab3 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -51,6 +51,9 @@ CFLAGS := $(CFLAGS) @PTHREAD_CFLAGS@ LDFLAGS := $(LDFLAGS) @PTHREAD_CFLAGS@ LDLIBS := @PTHREAD_LIBS@ $(LDLIBS) endif +ifeq ($(empthread),Windows) +CFLAGS := $(CFLAGS) -mthreads +endif termlibs := @termlibs@ CCDEPMODE := @CCDEPMODE@ @am__fastdepCC_TRUE@how_to_dep := fast diff --git a/configure.ac b/configure.ac index 1bc1a4e7..18ddc455 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,11 @@ AC_SUBST(cvs_controlled,$cvs_controlled) ### Checks for libraries ACX_PTHREAD LIB_SOCKET_NSL +# TODO merge this into LIB_SOCKET_NSL? +case "$host_os" in +*mingw32) + LIBS="-lws2_32 $LIBS" ;; +esac # TODO turn this into a macro? save_LIBS=$LIBS @@ -102,22 +107,24 @@ AC_ARG_WITH([pthread], [use POSIX threads])) # Select thread package -# TODO Windows -case "$ac_cv_func_makecontext$acx_pthread_ok" in -yesyes) - if test -z "$with_pthread" || test "$with_pthread" = no; then - empthread=LWP - else - empthread=POSIX +empthread= +if test "$with_pthread" != no; then + if test "$acx_pthread_ok" = yes; then + empthread=POSIX fi - ;; -yes*) - empthread=LWP ;; -*yes) - empthread=POSIX ;; -*) +fi +if test -z "$with_pthread" || test "$with_pthread" = no; then + if test "$ac_cv_func_makecontext" = yes; then + empthread=LWP + fi + case "$host_os" in + *mingw32) + empthread=Windows ;; + esac +fi +if test -z "$empthread"; then AC_MSG_ERROR([No usable thread package found]) -esac +fi AC_SUBST(empthread) AC_MSG_NOTICE([Using $empthread threads]) case $empthread in @@ -127,16 +134,6 @@ POSIX) AC_DEFINE([EMPTH_POSIX], 1, [Define to use POSIX threads]) ;; Windows) AC_DEFINE([EMPTH_W32], 1, [Define to use Windows threads]) ;; esac -op= -if test "$with_pthread" = no; then - op='==' -elif test "$with_pthread"; then - op='!=' -fi -if test "$op" && test "$empthread" $op POSIX; then - AC_MSG_WARN([Ignoring --with-pthread=$with_pthread]) -fi - ### Output