sysdep.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* sysdep.h -- handle host dependencies for binutils
  2. Copyright (C) 1991-2022 Free Software Foundation, Inc.
  3. This file is part of GNU Binutils.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #ifndef _BIN_SYSDEP_H
  16. #define _BIN_SYSDEP_H
  17. #include "config.h"
  18. #include <stdio.h>
  19. #ifdef HAVE_SYS_TYPES_H
  20. #include <sys/types.h>
  21. #endif
  22. #ifdef HAVE_SYS_STAT_H
  23. #include <sys/stat.h>
  24. #endif
  25. #include <stdlib.h>
  26. #include <string.h>
  27. #include <stdarg.h>
  28. #include <errno.h>
  29. #ifdef HAVE_UNISTD_H
  30. #include <unistd.h>
  31. #endif
  32. #ifdef HAVE_FCNTL_H
  33. #include <fcntl.h>
  34. #else
  35. #ifdef HAVE_SYS_FILE_H
  36. #include <sys/file.h>
  37. #endif
  38. #endif
  39. #include "ansidecl.h"
  40. #include "bfdver.h"
  41. #ifdef USE_BINARY_FOPEN
  42. #include "fopen-bin.h"
  43. #else
  44. #include "fopen-same.h"
  45. #endif
  46. #include "binary-io.h"
  47. #if !HAVE_DECL_STPCPY
  48. extern char *stpcpy (char *, const char *);
  49. #endif
  50. #ifdef HAVE_SBRK
  51. #if !HAVE_DECL_SBRK
  52. extern char *sbrk ();
  53. #endif
  54. #endif
  55. #if !HAVE_DECL_ENVIRON
  56. extern char **environ;
  57. #endif
  58. #ifndef O_RDONLY
  59. #define O_RDONLY 0
  60. #endif
  61. #ifndef O_RDWR
  62. #define O_RDWR 2
  63. #endif
  64. #ifndef SEEK_SET
  65. #define SEEK_SET 0
  66. #endif
  67. #ifndef SEEK_CUR
  68. #define SEEK_CUR 1
  69. #endif
  70. #ifndef SEEK_END
  71. #define SEEK_END 2
  72. #endif
  73. #ifndef ENABLE_NLS
  74. /* The Solaris version of locale.h always includes libintl.h. If we have
  75. been configured with --disable-nls then ENABLE_NLS will not be defined
  76. and the dummy definitions of bindtextdomain (et al) below will conflict
  77. with the defintions in libintl.h. So we define these values to prevent
  78. the bogus inclusion of libintl.h. */
  79. # define _LIBINTL_H
  80. # define _LIBGETTEXT_H
  81. #endif
  82. #include <locale.h>
  83. #ifdef ENABLE_NLS
  84. # include <libintl.h>
  85. # define _(String) gettext (String)
  86. # ifdef gettext_noop
  87. # define N_(String) gettext_noop (String)
  88. # else
  89. # define N_(String) (String)
  90. # endif
  91. #else
  92. # define gettext(Msgid) (Msgid)
  93. # define dgettext(Domainname, Msgid) (Msgid)
  94. # define dcgettext(Domainname, Msgid, Category) (Msgid)
  95. # define ngettext(Msgid1, Msgid2, n) \
  96. (n == 1 ? Msgid1 : Msgid2)
  97. # define dngettext(Domainname, Msgid1, Msgid2, n) \
  98. (n == 1 ? Msgid1 : Msgid2)
  99. # define dcngettext(Domainname, Msgid1, Msgid2, n, Category) \
  100. (n == 1 ? Msgid1 : Msgid2)
  101. # define textdomain(Domainname) do {} while (0)
  102. # define bindtextdomain(Domainname, Dirname) do {} while (0)
  103. # define _(String) (String)
  104. # define N_(String) (String)
  105. #endif
  106. /* Used by ar.c and objcopy.c. */
  107. #define BUFSIZE 8192
  108. #include <limits.h>
  109. #if SIZEOF_LONG_LONG > SIZEOF_LONG
  110. /* We can't use any bfd types here since readelf may define BFD64 and
  111. objdump may not. */
  112. #define HOST_WIDEST_INT long long
  113. #else
  114. #define HOST_WIDEST_INT long
  115. #endif
  116. #define POISON_BFD_BOOLEAN 1
  117. #endif /* _BIN_SYSDEP_H */