diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-08 16:14:49 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-08 16:14:49 +0000 |
commit | cfbdd7def6579707128299d6429c1273e778a97f (patch) | |
tree | 8424b6e62d8e9172cc8b7a69773bcbcc62b63024 /config | |
parent | d7c85fac4113c7c6a43781b366093eb9aca0b00f (diff) | |
download | gcc-cfbdd7def6579707128299d6429c1273e778a97f.tar.gz |
libstdc++-v3/
* configure.ac (--enable-linux-futex): Add new configure option.
(HAVE_LINUX_FUTEX): New AC_DEFINE.
* Makefile.in: Rebuilt.
* aclocal.m4: Rebuilt.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/cpu/generic/cxxabi_tweaks.h (_GLIBCXX_GUARD_BIT,
_GLIBCXX_GUARD_PENDING_BIT, _GLIBCXX_GUARD_WAITING_BIT): Define.
* config/cpu/arm/cxxabi_tweaks.h (_GLIBCXX_GUARD_BIT,
_GLIBCXX_GUARD_PENDING_BIT, _GLIBCXX_GUARD_WAITING_BIT): Define.
* libsupc++/guard.cc: Include climits and syscall.h.
(_GLIBCXX_USE_FUTEX): Define if futex syscall and atomic builtins
are supported.
(_GLIBCXX_FUTEX_WAIT, _GLIBCXX_FUTEX_WAKE): Likewise.
(__guard_test_bit): New static inline.
(__cxa_guard_acquire, __cxa_guard_release, __cxa_guard_abort): Use
atomic builtins and futex syscall if _GLIBCXX_USE_FUTEX.
config/
* futex.m4: New file.
libgomp/
* configure.ac: Move futex checking into ../config/futex.m4.
* configure: Rebuilt.
* aclocal.m4: Rebuilt.
* Makefile.in: Rebuilt.
* configure.tgt: Rename have_tls to gcc_cv_have_tls to match
2007-10-15 ../config/tls.m4 change.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131399 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'config')
-rw-r--r-- | config/ChangeLog | 4 | ||||
-rw-r--r-- | config/futex.m4 | 64 |
2 files changed, 68 insertions, 0 deletions
diff --git a/config/ChangeLog b/config/ChangeLog index 77082b4a3e1..8343f066a86 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2008-01-08 Jakub Jelinek <jakub@redhat.com> + + * futex.m4: New file. + 2007-12-06 Richard Sandiford <rsandifo@nildram.co.uk> * mt-sde (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Use +=, not =. diff --git a/config/futex.m4 b/config/futex.m4 new file mode 100644 index 00000000000..e95144dd16a --- /dev/null +++ b/config/futex.m4 @@ -0,0 +1,64 @@ +dnl ---------------------------------------------------------------------- +dnl This whole bit snagged from libgomp. + +dnl +dnl GCC_LINUX_FUTEX +dnl (SHELL-CODE_HANDLER) +dnl +AC_DEFUN([GCC_LINUX_FUTEX],[dnl +GCC_ENABLE(linux-futex,default, ,[use the Linux futex system call], + permit yes|no|default) +case "$target" in + *-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);])], + [save_LIBS="$LIBS" + LIBS="-lpthread $LIBS" + 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 :; else + 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]) + LIBS="$save_LIBS"]) + ;; + 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 + ;; + *) + enable_linux_futex=no + ;; +esac +if test x$enable_linux_futex = xyes; then + $1 +fi +]) |