aboutsummaryrefslogtreecommitdiff
path: root/libgomp/configure.ac
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-20 09:55:42 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-20 09:55:42 +0000
commit2eca990d4a6be53a27ea63b245ab75ac08b7fa00 (patch)
tree8bb868030ca7ee7205fdfbd8750e29fe2049be3b /libgomp/configure.ac
parentf1716c6796fb047bec7d2ac210af45bb3a2f2f14 (diff)
PR libgomp/26175
PR libgomp/26477 * configure.ac: If neither --enable-linux-futex nor --disable-linux-futex is passed, determine the default by checking for compiling and/or running against NPTL. With --enable-linux-futex, check if SYS_gettid and SYS_futex are defined. * configure: Rebuilt. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114809 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/configure.ac')
-rw-r--r--libgomp/configure.ac46
1 files changed, 44 insertions, 2 deletions
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 606a0fd6ba6..f653b70422d 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -16,9 +16,9 @@ LIBGOMP_ENABLE(version-specific-runtime-libs, no, ,
AC_MSG_RESULT($enable_version_specific_runtime_libs)
AC_MSG_CHECKING([for --enable-linux-futex])
-LIBGOMP_ENABLE(linux-futex, yes,
+LIBGOMP_ENABLE(linux-futex, default, ,
[Use the Linux futex system call],
- permit yes|no)
+ permit yes|no|default)
AC_MSG_RESULT($enable_linux_futex)
# -------
@@ -171,6 +171,48 @@ case "$host" in
AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Define if the POSIX Semaphores do not work on your system.)
;;
+ *-linux*)
+ case "$enable_linux_futex" in
+ default)
+ # If headers don't have gettid/futex syscalls definition, then
+ # default to no, otherwise there will be compile time failures.
+ # Otherwise, default to yes. If we don't detect we are
+ # compiled/linked against NPTL and not cross-compiling, check
+ # if programs are run by default against NPTL and if not, issue
+ # a warning.
+ enable_linux_futex=no
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/syscall.h>
+ int lk;],
+ [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#ifndef _GNU_SOURCE
+ #define _GNU_SOURCE 1
+ #endif
+ #include <pthread.h>
+ pthread_t th; void *status;],
+ [pthread_tryjoin_np (th, &status);])],[enable_linux_futex=yes],
+ [if test x$cross_compiling = xno; then
+ if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \
+ | LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then
+ AC_MSG_WARN([The kernel might not support futex or gettid syscalls.
+If so, please configure with --disable-linux-futex])
+ fi
+ fi
+ enable_linux_futex=yes])])
+ ;;
+ yes)
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/syscall.h>
+ int lk;],
+ [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],[],
+ [AC_MSG_ERROR([SYS_gettid and SYS_futex required for --enable-linux-futex])])
+ ;;
+ esac
+ ;;
esac
# At least for glibc, clock_gettime is in librt. But don't pull that