1dnl This file was derived from acinclude.m4.
2
3
4dnl See whether we need a declaration for a function.
5
6AC_DEFUN([BFD_NEED_DECLARATION],
7[AC_MSG_CHECKING([whether $1 must be declared])
8AC_CACHE_VAL(bfd_cv_decl_needed_$1,
9[AC_TRY_COMPILE([
10#include <stdio.h>
11#ifdef HAVE_STRING_H
12#include <string.h>
13#else
14#ifdef HAVE_STRINGS_H
15#include <strings.h>
16#endif
17#endif
18#ifdef HAVE_STDLIB_H
19#include <stdlib.h>
20#endif
21#ifdef HAVE_UNISTD_H
22#include <unistd.h>
23#endif],
24[char *(*pfn) = (char *(*)) $1],
25bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
26AC_MSG_RESULT($bfd_cv_decl_needed_$1)
27if test $bfd_cv_decl_needed_$1 = yes; then
28  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
29	    [Define if $1 is not declared in system header files.])
30fi
31])dnl
32
33
34dnl Check for existence of a type $1 in sys/procfs.h
35
36AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
37[AC_MSG_CHECKING([for $1 in sys/procfs.h])
38 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
39   [AC_TRY_COMPILE([
40#define _SYSCALL32
41#include <sys/procfs.h>],
42      [$1 avar],
43      bfd_cv_have_sys_procfs_type_$1=yes,
44      bfd_cv_have_sys_procfs_type_$1=no
45   )])
46 if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
47   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
48	     [Define if <sys/procfs.h> has $1.])
49 fi
50 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
51])
52
53
54dnl Check for existence of member $2 in type $1 in sys/procfs.h
55
56AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
57[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
58 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
59   [AC_TRY_COMPILE([
60#define _SYSCALL32
61#include <sys/procfs.h>],
62      [$1 avar; void* aref = (void*) &avar.$2],
63      bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
64      bfd_cv_have_sys_procfs_type_member_$1_$2=no
65   )])
66 if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
67   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
68	     [Define if <sys/procfs.h> has $1.$2.])
69 fi
70 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
71])
72
73