sysdep.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* sysdep.h -- handle host dependencies for binutils
  2. Copyright (C) 1991-2015 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 "alloca-conf.h"
  18. #include "ansidecl.h"
  19. #include <stdio.h>
  20. #include <sys/types.h>
  21. #include "bfdver.h"
  22. #include <stdarg.h>
  23. #ifdef USE_BINARY_FOPEN
  24. #include "fopen-bin.h"
  25. #else
  26. #include "fopen-same.h"
  27. #endif
  28. #include <errno.h>
  29. #ifndef errno
  30. extern int errno;
  31. #endif
  32. #ifdef HAVE_UNISTD_H
  33. #include <unistd.h>
  34. #endif
  35. #ifdef STRING_WITH_STRINGS
  36. #include <string.h>
  37. #include <strings.h>
  38. #else
  39. #ifdef HAVE_STRING_H
  40. #include <string.h>
  41. #else
  42. #ifdef HAVE_STRINGS_H
  43. #include <strings.h>
  44. #else
  45. extern char *strchr ();
  46. extern char *strrchr ();
  47. #endif
  48. #endif
  49. #endif
  50. #ifdef HAVE_STDLIB_H
  51. #include <stdlib.h>
  52. #endif
  53. #ifdef HAVE_FCNTL_H
  54. #include <fcntl.h>
  55. #else
  56. #ifdef HAVE_SYS_FILE_H
  57. #include <sys/file.h>
  58. #endif
  59. #endif
  60. #ifdef HAVE_SYS_STAT_H
  61. #include <sys/stat.h>
  62. #endif
  63. #include "binary-io.h"
  64. #if !HAVE_DECL_STPCPY
  65. extern char *stpcpy (char *, const char *);
  66. #endif
  67. #if !HAVE_DECL_STRSTR
  68. extern char *strstr ();
  69. #endif
  70. #ifdef HAVE_SBRK
  71. #if !HAVE_DECL_SBRK
  72. extern char *sbrk ();
  73. #endif
  74. #endif
  75. #if !HAVE_DECL_GETENV
  76. extern char *getenv ();
  77. #endif
  78. #if !HAVE_DECL_ENVIRON
  79. extern char **environ;
  80. #endif
  81. #if !HAVE_DECL_FPRINTF
  82. extern int fprintf (FILE *, const char *, ...);
  83. #endif
  84. #if !HAVE_DECL_SNPRINTF
  85. extern int snprintf(char *, size_t, const char *, ...);
  86. #endif
  87. #if !HAVE_DECL_VSNPRINTF
  88. extern int vsnprintf(char *, size_t, const char *, va_list);
  89. #endif
  90. #if !HAVE_DECL_STRNLEN
  91. size_t strnlen (const char *, size_t);
  92. #endif
  93. #ifndef O_RDONLY
  94. #define O_RDONLY 0
  95. #endif
  96. #ifndef O_RDWR
  97. #define O_RDWR 2
  98. #endif
  99. #ifndef SEEK_SET
  100. #define SEEK_SET 0
  101. #endif
  102. #ifndef SEEK_CUR
  103. #define SEEK_CUR 1
  104. #endif
  105. #ifndef SEEK_END
  106. #define SEEK_END 2
  107. #endif
  108. #ifdef HAVE_LOCALE_H
  109. # ifndef ENABLE_NLS
  110. /* The Solaris version of locale.h always includes libintl.h. If we have
  111. been configured with --disable-nls then ENABLE_NLS will not be defined
  112. and the dummy definitions of bindtextdomain (et al) below will conflict
  113. with the defintions in libintl.h. So we define these values to prevent
  114. the bogus inclusion of libintl.h. */
  115. # define _LIBINTL_H
  116. # define _LIBGETTEXT_H
  117. # endif
  118. # include <locale.h>
  119. #endif
  120. #ifdef ENABLE_NLS
  121. # include <libintl.h>
  122. # define _(String) gettext (String)
  123. # ifdef gettext_noop
  124. # define N_(String) gettext_noop (String)
  125. # else
  126. # define N_(String) (String)
  127. # endif
  128. #else
  129. # define gettext(Msgid) (Msgid)
  130. # define dgettext(Domainname, Msgid) (Msgid)
  131. # define dcgettext(Domainname, Msgid, Category) (Msgid)
  132. # define textdomain(Domainname) while (0) /* nothing */
  133. # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
  134. # define _(String) (String)
  135. # define N_(String) (String)
  136. #endif
  137. /* Used by ar.c and objcopy.c. */
  138. #define BUFSIZE 8192
  139. /* For PATH_MAX. */
  140. #ifdef HAVE_LIMITS_H
  141. #include <limits.h>
  142. #endif
  143. #ifndef PATH_MAX
  144. /* For MAXPATHLEN. */
  145. # ifdef HAVE_SYS_PARAM_H
  146. # include <sys/param.h>
  147. # endif
  148. # ifndef PATH_MAX
  149. # ifdef MAXPATHLEN
  150. # define PATH_MAX MAXPATHLEN
  151. # else
  152. # define PATH_MAX 1024
  153. # endif
  154. # endif
  155. #endif
  156. #endif /* _BIN_SYSDEP_H */