Merge branch 'vendor/GCC50'
[dragonfly.git] / contrib / binutils-2.25 / binutils / sysdep.h
1 /* sysdep.h -- handle host dependencies for binutils
2    Copyright (C) 1991-2014 Free Software Foundation, Inc.
3
4    This file is part of GNU Binutils.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
19 \f
20 #ifndef _BIN_SYSDEP_H
21 #define _BIN_SYSDEP_H
22
23 #include "alloca-conf.h"
24 #include "ansidecl.h"
25 #include <stdio.h>
26 #include <sys/types.h>
27
28 #include "bfdver.h"
29
30 #include <stdarg.h>
31
32 #ifdef USE_BINARY_FOPEN
33 #include "fopen-bin.h"
34 #else
35 #include "fopen-same.h"
36 #endif
37
38 #include <errno.h>
39 #ifndef errno
40 extern int errno;
41 #endif
42
43 #ifdef HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
46
47 #ifdef STRING_WITH_STRINGS
48 #include <string.h>
49 #include <strings.h>
50 #else
51 #ifdef HAVE_STRING_H
52 #include <string.h>
53 #else
54 #ifdef HAVE_STRINGS_H
55 #include <strings.h>
56 #else
57 extern char *strchr ();
58 extern char *strrchr ();
59 #endif
60 #endif
61 #endif
62
63 #ifdef HAVE_STDLIB_H
64 #include <stdlib.h>
65 #endif
66
67 #ifdef HAVE_FCNTL_H
68 #include <fcntl.h>
69 #else
70 #ifdef HAVE_SYS_FILE_H
71 #include <sys/file.h>
72 #endif
73 #endif
74
75 #ifdef HAVE_SYS_STAT_H
76 #include <sys/stat.h>
77 #endif
78
79 #include "binary-io.h"
80
81 #if !HAVE_DECL_STPCPY
82 extern char *stpcpy (char *, const char *);
83 #endif
84
85 #if !HAVE_DECL_STRSTR
86 extern char *strstr ();
87 #endif
88
89 #ifdef HAVE_SBRK
90 #if !HAVE_DECL_SBRK
91 extern char *sbrk ();
92 #endif
93 #endif
94
95 #if !HAVE_DECL_GETENV
96 extern char *getenv ();
97 #endif
98
99 #if !HAVE_DECL_ENVIRON
100 extern char **environ;
101 #endif
102
103 #if !HAVE_DECL_FPRINTF
104 extern int fprintf (FILE *, const char *, ...);
105 #endif
106
107 #if !HAVE_DECL_SNPRINTF
108 extern int snprintf(char *, size_t, const char *, ...);
109 #endif
110
111 #if !HAVE_DECL_VSNPRINTF
112 extern int vsnprintf(char *, size_t, const char *, va_list);
113 #endif
114
115 #if !HAVE_DECL_STRNLEN
116 size_t strnlen (const char *, size_t);
117 #endif
118
119 #ifndef O_RDONLY
120 #define O_RDONLY 0
121 #endif
122
123 #ifndef O_RDWR
124 #define O_RDWR 2
125 #endif
126
127 #ifndef SEEK_SET
128 #define SEEK_SET 0
129 #endif
130 #ifndef SEEK_CUR
131 #define SEEK_CUR 1
132 #endif
133 #ifndef SEEK_END
134 #define SEEK_END 2
135 #endif
136
137 #ifdef HAVE_LOCALE_H
138 # ifndef ENABLE_NLS
139    /* The Solaris version of locale.h always includes libintl.h.  If we have
140       been configured with --disable-nls then ENABLE_NLS will not be defined
141       and the dummy definitions of bindtextdomain (et al) below will conflict
142       with the defintions in libintl.h.  So we define these values to prevent
143       the bogus inclusion of libintl.h.  */
144 #  define _LIBINTL_H
145 #  define _LIBGETTEXT_H
146 # endif
147 # include <locale.h>
148 #endif
149
150 #ifdef ENABLE_NLS
151 # include <libintl.h>
152 # define _(String) gettext (String)
153 # ifdef gettext_noop
154 #  define N_(String) gettext_noop (String)
155 # else
156 #  define N_(String) (String)
157 # endif
158 #else
159 # define gettext(Msgid) (Msgid)
160 # define dgettext(Domainname, Msgid) (Msgid)
161 # define dcgettext(Domainname, Msgid, Category) (Msgid)
162 # define textdomain(Domainname) while (0) /* nothing */
163 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
164 # define _(String) (String)
165 # define N_(String) (String)
166 #endif
167
168 /* Used by ar.c and objcopy.c.  */
169 #define BUFSIZE 8192
170
171 /* For PATH_MAX.  */
172 #ifdef HAVE_LIMITS_H
173 #include <limits.h>
174 #endif
175
176 #ifndef PATH_MAX
177 /* For MAXPATHLEN.  */
178 # ifdef HAVE_SYS_PARAM_H
179 #  include <sys/param.h>
180 # endif
181 # ifndef PATH_MAX
182 #  ifdef MAXPATHLEN
183 #   define PATH_MAX MAXPATHLEN
184 #  else
185 #   define PATH_MAX 1024
186 #  endif
187 # endif
188 #endif
189
190 #endif /* _BIN_SYSDEP_H */