1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

POSIX threads can be available while mutexes are not implemented

This is the odd case of WASI right now
This commit is contained in:
Frank Denis 2019-03-30 11:22:10 +01:00
parent daa6cb3e78
commit dfa8222d27

View File

@ -125,12 +125,25 @@ AC_ARG_WITH(pthreads, AC_HELP_STRING([--with-pthreads],
AS_IF([test "x$withval" = "xyes"], [
AX_PTHREAD([
AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files])
with_threads="yes"
LIBS="$PTHREAD_LIBS $LIBS"
PKGCONFIG_LIBS_PRIVATE="$PTHREAD_LIBS $PTHREAD_CFLAGS $PKGCONFIG_LIBS_PRIVATE"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]], [[
pthread_mutex_t mutex;
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
]]
)], [
AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files])
with_threads="yes"
LIBS="$PTHREAD_LIBS $LIBS"
PKGCONFIG_LIBS_PRIVATE="$PTHREAD_LIBS $PTHREAD_CFLAGS $PKGCONFIG_LIBS_PRIVATE"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
])
],
[ AC_MSG_NOTICE(pthread mutexes are not available) ]
)
], [with_threads="no"])
AC_ARG_WITH(safecode,