OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [config/] [futex.m4] - Diff between revs 827 and 840

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 827 Rev 840
dnl ----------------------------------------------------------------------
dnl ----------------------------------------------------------------------
dnl This whole bit snagged from libgomp.
dnl This whole bit snagged from libgomp.
 
 
dnl
dnl
dnl GCC_LINUX_FUTEX
dnl GCC_LINUX_FUTEX
dnl    (SHELL-CODE_HANDLER)
dnl    (SHELL-CODE_HANDLER)
dnl
dnl
AC_DEFUN([GCC_LINUX_FUTEX],[dnl
AC_DEFUN([GCC_LINUX_FUTEX],[dnl
GCC_ENABLE(linux-futex,default, ,[use the Linux futex system call],
GCC_ENABLE(linux-futex,default, ,[use the Linux futex system call],
           permit yes|no|default)
           permit yes|no|default)
case "$target" in
case "$target" in
  *-linux*)
  *-linux*)
    case "$enable_linux_futex" in
    case "$enable_linux_futex" in
      default)
      default)
        # If headers don't have gettid/futex syscalls definition, then
        # If headers don't have gettid/futex syscalls definition, then
        # default to no, otherwise there will be compile time failures.
        # default to no, otherwise there will be compile time failures.
        # Otherwise, default to yes.  If we don't detect we are
        # Otherwise, default to yes.  If we don't detect we are
        # compiled/linked against NPTL and not cross-compiling, check
        # compiled/linked against NPTL and not cross-compiling, check
        # if programs are run by default against NPTL and if not, issue
        # if programs are run by default against NPTL and if not, issue
        # a warning.
        # a warning.
        enable_linux_futex=no
        enable_linux_futex=no
        AC_LINK_IFELSE(
        AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(
         [AC_LANG_PROGRAM(
          [#include <sys/syscall.h>
          [#include <sys/syscall.h>
           int lk;],
           int lk;],
          [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],
          [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],
          [save_LIBS="$LIBS"
          [save_LIBS="$LIBS"
           LIBS="-lpthread $LIBS"
           LIBS="-lpthread $LIBS"
           AC_LINK_IFELSE(
           AC_LINK_IFELSE(
           [AC_LANG_PROGRAM(
           [AC_LANG_PROGRAM(
            [#ifndef _GNU_SOURCE
            [#ifndef _GNU_SOURCE
             #define _GNU_SOURCE 1
             #define _GNU_SOURCE 1
             #endif
             #endif
             #include <pthread.h>
             #include <pthread.h>
             pthread_t th; void *status;],
             pthread_t th; void *status;],
            [pthread_tryjoin_np (th, &status);])],[enable_linux_futex=yes],
            [pthread_tryjoin_np (th, &status);])],[enable_linux_futex=yes],
            [if test x$cross_compiling = xno; then
            [if test x$cross_compiling = xno; then
               if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \
               if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \
                  | LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then :; else
                  | 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.
                 AC_MSG_WARN([The kernel might not support futex or gettid syscalls.
If so, please configure with --disable-linux-futex])
If so, please configure with --disable-linux-futex])
               fi
               fi
             fi
             fi
             enable_linux_futex=yes])
             enable_linux_futex=yes])
           LIBS="$save_LIBS"])
           LIBS="$save_LIBS"])
        ;;
        ;;
      yes)
      yes)
        AC_LINK_IFELSE(
        AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(
         [AC_LANG_PROGRAM(
          [#include <sys/syscall.h>
          [#include <sys/syscall.h>
           int lk;],
           int lk;],
          [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],[],
          [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],[],
          [AC_MSG_ERROR([SYS_gettid and SYS_futex required for --enable-linux-futex])])
          [AC_MSG_ERROR([SYS_gettid and SYS_futex required for --enable-linux-futex])])
        ;;
        ;;
    esac
    esac
    ;;
    ;;
  *)
  *)
    enable_linux_futex=no
    enable_linux_futex=no
    ;;
    ;;
esac
esac
if test x$enable_linux_futex = xyes; then
if test x$enable_linux_futex = xyes; then
  $1
  $1
fi
fi
])
])
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.