blob: d543edff2ede739748dda4f3e60205e95852a5f9 [file] [log] [blame]
subrata_modak3d8666c2008-11-11 08:31:27 +00001dnl
2dnl Copyright (c) Red Hat Inc., 2008
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12dnl the GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software
Wanlong Gao4548c6c2012-10-19 18:03:36 +080016dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
subrata_modak3d8666c2008-11-11 08:31:27 +000017dnl
18dnl Author: Masatake YAMATO <yamato@redhat.com>
19dnl
20
21dnl
22dnl LTP_CHECK_SYSCALL_SIGNALFD
23dnl --------------------------
24dnl
25dnl * Checking the existence of the libc wrapper for signalfd.
26dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FUNCTION is set to "yes".
27dnl
28dnl * Checking the existence of signalfd.h.
29dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_HEADER is set to "yes".
30dnl
31dnl * Checking the prefix used in fileds for signalfd_siginfo structure.
32dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FIELD_PREFIX is set to "given".
33dnl
34dnl About cpp macros defined in this macro,
35dnl see testcases/kernel/syscalls/signalfd/signalfd01.c of ltp.
36dnl
37
38AC_DEFUN([LTP_CHECK_SYSCALL_SIGNALFD],
39[dnl
40_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
41_LTP_CHECK_SYSCALL_SIGNALFD_HEADER
42
subrata_modakae5eb2c2008-11-18 09:00:57 +000043if test x"$LTP_SYSCALL_SIGNALFD_HEADER" = xyes; then
subrata_modak3d8666c2008-11-11 08:31:27 +000044 _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
45fi]dnl
46)dnl
47
48dnl _LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
49dnl ------------------------------------
50dnl
51dnl
52AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION],[dnl
53AC_CHECK_FUNCS(signalfd,[LTP_SYSCALL_SIGNALFD_FUNCTION=yes])])
54
55dnl _LTP_CHECK_SYSCALL_SIGNALFD_HEADER
56dnl ----------------------------------
57dnl
58dnl
59AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_HEADER],
60[dnl
yaberauneya80a06b52009-12-20 00:39:37 +000061AC_CHECK_HEADERS([sys/signalfd.h linux/types.h])
62AC_CHECK_HEADERS([linux/signalfd.h signalfd.h],[dnl
63LTP_SYSCALL_SIGNALFD_HEADER=yes],,[dnl
subrata_modak3d8666c2008-11-11 08:31:27 +000064#ifdef HAVE_LINUX_TYPES_H
65#include <linux/types.h>
subrata_modakf647cb42008-11-20 09:12:12 +000066#endif
subrata_modak3d8666c2008-11-11 08:31:27 +000067]dnl
68)dnl
69]dnl
70)dnl
71
72dnl _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
73dnl ----------------------------------------
74dnl
75dnl
76AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX],
77[dnl
78AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo, struct signalfd_siginfo.signo],[dnl
yaberauneya80a06b52009-12-20 00:39:37 +000079LTP_SYSCALL_SIGNALFD_FIELD_PREFIX=given],,[dnl
subrata_modak3d8666c2008-11-11 08:31:27 +000080#if defined HAVE_SYS_SIGNALFD_H
81#include <sys/signalfd.h>
82#elif defined HAVE_LINUX_SIGNALFD_H
subrata_modake94ba552008-11-20 09:35:07 +000083#ifdef HAVE_LINUX_TYPES_H
84#include <linux/types.h>
85#endif
subrata_modak3d8666c2008-11-11 08:31:27 +000086#include <linux/signalfd.h>
87#elif defined HAVE_SIGNALFD_H
88#include <signalfd.h>
89#endif])
90]dnl
91)dnl