Autoconfigure MinGW: socket library, thread package. Rewrite thread

package selection.
This commit is contained in:
Markus Armbruster 2006-01-21 08:11:07 +00:00
parent 23726b3799
commit a6587e7e46
2 changed files with 24 additions and 24 deletions

View file

@ -51,6 +51,9 @@ CFLAGS := $(CFLAGS) @PTHREAD_CFLAGS@
LDFLAGS := $(LDFLAGS) @PTHREAD_CFLAGS@ LDFLAGS := $(LDFLAGS) @PTHREAD_CFLAGS@
LDLIBS := @PTHREAD_LIBS@ $(LDLIBS) LDLIBS := @PTHREAD_LIBS@ $(LDLIBS)
endif endif
ifeq ($(empthread),Windows)
CFLAGS := $(CFLAGS) -mthreads
endif
termlibs := @termlibs@ termlibs := @termlibs@
CCDEPMODE := @CCDEPMODE@ CCDEPMODE := @CCDEPMODE@
@am__fastdepCC_TRUE@how_to_dep := fast @am__fastdepCC_TRUE@how_to_dep := fast

View file

@ -62,6 +62,11 @@ AC_SUBST(cvs_controlled,$cvs_controlled)
### Checks for libraries ### Checks for libraries
ACX_PTHREAD ACX_PTHREAD
LIB_SOCKET_NSL 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? # TODO turn this into a macro?
save_LIBS=$LIBS save_LIBS=$LIBS
@ -102,22 +107,24 @@ AC_ARG_WITH([pthread],
[use POSIX threads])) [use POSIX threads]))
# Select thread package # Select thread package
# TODO Windows empthread=
case "$ac_cv_func_makecontext$acx_pthread_ok" in if test "$with_pthread" != no; then
yesyes) if test "$acx_pthread_ok" = yes; then
if test -z "$with_pthread" || test "$with_pthread" = no; then
empthread=LWP
else
empthread=POSIX empthread=POSIX
fi fi
;; fi
yes*) if test -z "$with_pthread" || test "$with_pthread" = no; then
empthread=LWP ;; if test "$ac_cv_func_makecontext" = yes; then
*yes) empthread=LWP
empthread=POSIX ;; fi
*) case "$host_os" in
AC_MSG_ERROR([No usable thread package found]) *mingw32)
empthread=Windows ;;
esac esac
fi
if test -z "$empthread"; then
AC_MSG_ERROR([No usable thread package found])
fi
AC_SUBST(empthread) AC_SUBST(empthread)
AC_MSG_NOTICE([Using $empthread threads]) AC_MSG_NOTICE([Using $empthread threads])
case $empthread in 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]) ;; Windows) AC_DEFINE([EMPTH_W32], 1, [Define to use Windows threads]) ;;
esac 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 ### Output