mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
configure: check that errno is threadsafe
Without `-pthread` specified to the compiler, errno is not threadsafe on Solaris (as _REENTRANT is undefined, and _POSIX_C_SOURCE may not be set until after the inclusion of <errno.h>). Work on #3340.
This commit is contained in:
parent
3289797248
commit
ee15f1b987
1 changed files with 28 additions and 0 deletions
28
configure.ac
28
configure.ac
|
@ -536,6 +536,34 @@ else
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Check that threads actually work on Solaris
|
||||
AC_MSG_CHECKING([for threadsafe errno])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
void *thread1_func(void *p_arg)
|
||||
{
|
||||
errno = 1;
|
||||
return 0;
|
||||
}
|
||||
],[
|
||||
errno = 0;
|
||||
pthread_t t1;
|
||||
pthread_create(&t1, NULL, thread1_func, NULL);
|
||||
pthread_join(t1, NULL);
|
||||
return errno;
|
||||
])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_FAILURE([errno is not threadsafe - check your compiler settings])
|
||||
],
|
||||
[AC_MSG_RESULT(crosscompiling, skipped)]
|
||||
)
|
||||
|
||||
pcre2_min_version=10.21
|
||||
EXTRA_PCRE2=
|
||||
AC_ARG_WITH(
|
||||
|
|
Loading…
Reference in a new issue