File: futex.m4

package info (click to toggle)
gdb 7.12-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 216,152 kB
  • ctags: 304,881
  • sloc: ansic: 2,141,328; asm: 331,662; exp: 133,348; makefile: 57,698; sh: 23,586; yacc: 14,054; cpp: 12,262; perl: 5,300; python: 4,685; ada: 4,343; xml: 3,670; pascal: 3,120; lisp: 1,516; cs: 879; lex: 624; f90: 457; sed: 228; awk: 142; objc: 134; java: 73; fortran: 43
file content (64 lines) | stat: -rw-r--r-- 1,890 bytes parent folder | download | duplicates (66)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
])