* bfd/bfd.m4 (BFD_HAVE_TIME_TYPE_MEMBER,
[external/binutils.git] / bfd / bfd.m4
1 dnl This file was derived from acinclude.m4.
2
3
4 dnl Check for existence of a type $1 in sys/procfs.h
5
6 AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
7 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
8  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
9    [AC_TRY_COMPILE([
10 #define _SYSCALL32
11 #include <sys/procfs.h>],
12       [$1 avar],
13       bfd_cv_have_sys_procfs_type_$1=yes,
14       bfd_cv_have_sys_procfs_type_$1=no
15    )])
16  if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
17    AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
18              [Define if <sys/procfs.h> has $1.])
19  fi
20  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
21 ])
22
23 dnl Check for existence of member $2 in type $1 in sys/procfs.h
24
25 AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
26 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
27  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
28    [AC_TRY_COMPILE([
29 #define _SYSCALL32
30 #include <sys/procfs.h>],
31       [$1 avar; void* aref = (void*) &avar.$2],
32       bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
33       bfd_cv_have_sys_procfs_type_member_$1_$2=no
34    )])
35  if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
36    AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
37              [Define if <sys/procfs.h> has $1.$2.])
38  fi
39  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
40 ])
41
42 dnl Check for existence of member $2 in type $1 in time.h
43
44 AC_DEFUN([BFD_HAVE_TIME_TYPE_MEMBER],
45 [AC_MSG_CHECKING([for $1.$2 in time.h])
46  AC_CACHE_VAL(bfd_cv_have_time_type_member_$2,
47    [AC_TRY_COMPILE([
48 #define _BSD_SOURCE 1
49 #include <time.h>],
50       [$1 avar; void* aref = (void*) &avar.$2],
51       bfd_cv_have_time_type_member_$2=yes,
52       bfd_cv_have_time_type_member_$2=no
53    )])
54  if test $bfd_cv_have_time_type_member_$2 = yes; then
55    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z]), 1,
56              [Define if <time.h> has $1.$2.])
57  fi
58  AC_MSG_RESULT($bfd_cv_have_time_type_member_$2)
59 ])
60
61 dnl Check for existence of member $2.$3 in type $1 in sys/stat.h
62
63 AC_DEFUN([BFD_HAVE_SYS_STAT_TYPE_MEMBER],
64 [AC_MSG_CHECKING([for $1.$2.$3 in sys/stat.h])
65  AC_CACHE_VAL(bfd_cv_have_sys_stat_type_member_$2_$3,
66    [AC_TRY_COMPILE([
67 #define _BSD_SOURCE 1
68 #include <sys/stat.h>],
69       [$1 avar; void* aref = (void*) &avar.$2.$3],
70       bfd_cv_have_sys_stat_type_member_$2_$3=yes,
71       bfd_cv_have_sys_stat_type_member_$2_$3=no
72    )])
73  if test $bfd_cv_have_sys_stat_type_member_$2_$3 = yes; then
74    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_]translit($3, [a-z], [A-Z]), 1,
75              [Define if <sys/stat.h> has $1.$2.$3])
76  fi
77  AC_MSG_RESULT($bfd_cv_have_sys_stat_type_member_$2_$3)
78 ])