]> git.pond.sub.org Git - empserver/commitdiff
Autoconfigure MinGW: socket library, thread package. Rewrite thread
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 21 Jan 2006 08:11:07 +0000 (08:11 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 21 Jan 2006 08:11:07 +0000 (08:11 +0000)
package selection.

GNUmakefile.in
configure.ac

index 050cc6b41acf0d438e5599cc064382bc15ad5bd5..bf57bab32863ddc5478a4dedb593a43a8b30ff2a 100644 (file)
@@ -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
index 1bc1a4e760de4caa079f496b41e3c5cfa115dfd7..18ddc455562fbfe652ea6f7fa4629d27c8780352 100644 (file)
@@ -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
+fi
+if test -z "$with_pthread" || test "$with_pthread" = no; then
+    if test "$ac_cv_func_makecontext" = yes; then
+       empthread=LWP
     fi
-    ;;
-yes*)
-    empthread=LWP ;;
-*yes)
-    empthread=POSIX ;;
-*)
+    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