subrata_modak | 3d8666c | 2008-11-11 08:31:27 +0000 | [diff] [blame] | 1 | dnl |
| 2 | dnl Copyright (c) Red Hat Inc., 2008 |
| 3 | dnl |
| 4 | dnl This program is free software; you can redistribute it and/or modify |
| 5 | dnl it under the terms of the GNU General Public License as published by |
| 6 | dnl the Free Software Foundation; either version 2 of the License, or |
| 7 | dnl (at your option) any later version. |
| 8 | dnl |
| 9 | dnl This program is distributed in the hope that it will be useful, |
| 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 12 | dnl the GNU General Public License for more details. |
| 13 | dnl |
| 14 | dnl You should have received a copy of the GNU General Public License |
| 15 | dnl along with this program; if not, write to the Free Software |
| 16 | dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | dnl |
| 18 | dnl Author: Masatake YAMATO <yamato@redhat.com> |
| 19 | dnl |
| 20 | |
| 21 | dnl |
| 22 | dnl LTP_CHECK_SYSCALL_SIGNALFD |
| 23 | dnl -------------------------- |
| 24 | dnl |
| 25 | dnl * Checking the existence of the libc wrapper for signalfd. |
| 26 | dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FUNCTION is set to "yes". |
| 27 | dnl |
| 28 | dnl * Checking the existence of signalfd.h. |
| 29 | dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_HEADER is set to "yes". |
| 30 | dnl |
| 31 | dnl * Checking the prefix used in fileds for signalfd_siginfo structure. |
| 32 | dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FIELD_PREFIX is set to "given". |
| 33 | dnl |
| 34 | dnl About cpp macros defined in this macro, |
| 35 | dnl see testcases/kernel/syscalls/signalfd/signalfd01.c of ltp. |
| 36 | dnl |
| 37 | |
| 38 | AC_DEFUN([LTP_CHECK_SYSCALL_SIGNALFD], |
| 39 | [dnl |
| 40 | _LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION |
| 41 | _LTP_CHECK_SYSCALL_SIGNALFD_HEADER |
| 42 | |
subrata_modak | ae5eb2c | 2008-11-18 09:00:57 +0000 | [diff] [blame] | 43 | if test x"$LTP_SYSCALL_SIGNALFD_HEADER" = xyes; then |
subrata_modak | 3d8666c | 2008-11-11 08:31:27 +0000 | [diff] [blame] | 44 | _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX |
| 45 | fi]dnl |
| 46 | )dnl |
| 47 | |
| 48 | dnl _LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION |
| 49 | dnl ------------------------------------ |
| 50 | dnl |
| 51 | dnl |
| 52 | AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION],[dnl |
| 53 | AC_CHECK_FUNCS(signalfd,[LTP_SYSCALL_SIGNALFD_FUNCTION=yes])]) |
| 54 | |
| 55 | dnl _LTP_CHECK_SYSCALL_SIGNALFD_HEADER |
| 56 | dnl ---------------------------------- |
| 57 | dnl |
| 58 | dnl |
| 59 | AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_HEADER], |
| 60 | [dnl |
subrata_modak | e94ba55 | 2008-11-20 09:35:07 +0000 | [diff] [blame^] | 61 | AC_CHECK_HEADERS(sys/signalfd.h) |
vapier | 1862b4a | 2008-11-12 19:29:11 +0000 | [diff] [blame] | 62 | AC_CHECK_HEADERS_ONCE([linux/types.h]) |
subrata_modak | e94ba55 | 2008-11-20 09:35:07 +0000 | [diff] [blame^] | 63 | AC_CHECK_HEADERS(linux/signalfd.h signalfd.h,[dnl |
subrata_modak | 3d8666c | 2008-11-11 08:31:27 +0000 | [diff] [blame] | 64 | LTP_SYSCALL_SIGNALFD_HEADER=yes],[],[dnl |
| 65 | #ifdef HAVE_LINUX_TYPES_H |
| 66 | #include <linux/types.h> |
subrata_modak | f647cb4 | 2008-11-20 09:12:12 +0000 | [diff] [blame] | 67 | #endif |
subrata_modak | 3d8666c | 2008-11-11 08:31:27 +0000 | [diff] [blame] | 68 | ]dnl |
| 69 | )dnl |
| 70 | ]dnl |
| 71 | )dnl |
| 72 | |
| 73 | dnl _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX |
| 74 | dnl ---------------------------------------- |
| 75 | dnl |
| 76 | dnl |
| 77 | AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX], |
| 78 | [dnl |
| 79 | AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo, struct signalfd_siginfo.signo],[dnl |
| 80 | LTP_SYSCALL_SIGNALFD_FIELD_PREFIX=given],[],[dnl |
subrata_modak | 3d8666c | 2008-11-11 08:31:27 +0000 | [diff] [blame] | 81 | #if defined HAVE_SYS_SIGNALFD_H |
| 82 | #include <sys/signalfd.h> |
| 83 | #elif defined HAVE_LINUX_SIGNALFD_H |
subrata_modak | e94ba55 | 2008-11-20 09:35:07 +0000 | [diff] [blame^] | 84 | #ifdef HAVE_LINUX_TYPES_H |
| 85 | #include <linux/types.h> |
| 86 | #endif |
subrata_modak | 3d8666c | 2008-11-11 08:31:27 +0000 | [diff] [blame] | 87 | #include <linux/signalfd.h> |
| 88 | #elif defined HAVE_SIGNALFD_H |
| 89 | #include <signalfd.h> |
| 90 | #endif]) |
| 91 | ]dnl |
| 92 | )dnl |