bfd.m4 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. dnl This file was derived from acinclude.m4.
  2. dnl
  3. dnl Copyright (C) 2012-2022 Free Software Foundation, Inc.
  4. dnl
  5. dnl This file is free software; you can redistribute it and/or modify
  6. dnl it under the terms of the GNU General Public License as published by
  7. dnl the Free Software Foundation; either version 3 of the License, or
  8. dnl (at your option) any later version.
  9. dnl
  10. dnl This program is distributed in the hope that it will be useful,
  11. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. dnl GNU General Public License for more details.
  14. dnl
  15. dnl You should have received a copy of the GNU General Public License
  16. dnl along with this program; see the file COPYING3. If not see
  17. dnl <http://www.gnu.org/licenses/>.
  18. dnl
  19. dnl Check for sys/procfs.h, enforcing structured /proc on Solaris.
  20. AC_DEFUN([BFD_SYS_PROCFS_H],
  21. [AC_DEFINE(_STRUCTURED_PROC, 1, [Use structured /proc on Solaris.])
  22. AC_CHECK_HEADERS(sys/procfs.h)])
  23. dnl Check for existence of a type $1 in sys/procfs.h
  24. AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
  25. [AC_REQUIRE([BFD_SYS_PROCFS_H])
  26. AC_MSG_CHECKING([for $1 in sys/procfs.h])
  27. AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
  28. [AC_TRY_COMPILE([
  29. #define _SYSCALL32
  30. #include <sys/procfs.h>],
  31. [$1 avar],
  32. bfd_cv_have_sys_procfs_type_$1=yes,
  33. bfd_cv_have_sys_procfs_type_$1=no
  34. )])
  35. if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
  36. AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
  37. [Define if <sys/procfs.h> has $1.])
  38. fi
  39. AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
  40. ])
  41. dnl Check for existence of member $2 in type $1 in sys/procfs.h
  42. AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
  43. [AC_REQUIRE([BFD_SYS_PROCFS_H])
  44. AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
  45. AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
  46. [AC_TRY_COMPILE([
  47. #define _SYSCALL32
  48. #include <sys/procfs.h>],
  49. [$1 avar; void* aref = (void*) &avar.$2],
  50. bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
  51. bfd_cv_have_sys_procfs_type_member_$1_$2=no
  52. )])
  53. if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
  54. AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
  55. [Define if <sys/procfs.h> has $1.$2.])
  56. fi
  57. AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
  58. ])