diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-06-20 11:55:42 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2006-06-20 11:55:42 +0200 |
commit | fe5568e99010574916f5b2607a173a34f2340891 (patch) | |
tree | 8bb868030ca7ee7205fdfbd8750e29fe2049be3b /libgomp/configure.ac | |
parent | 2a79fd67a509a9f020ed7492436c63eff7979802 (diff) | |
download | gcc-fe5568e99010574916f5b2607a173a34f2340891.zip gcc-fe5568e99010574916f5b2607a173a34f2340891.tar.gz gcc-fe5568e99010574916f5b2607a173a34f2340891.tar.bz2 |
re PR libgomp/26175 (In gcc-4.2.0 libgomp/.../powerpc/futex.h SYS_futex undefined)
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.
From-SVN: r114809
Diffstat (limited to 'libgomp/configure.ac')
-rw-r--r-- | libgomp/configure.ac | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 606a0fd..f653b70 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 |