33129252ea256ed02d1ec454cd86a6deabcbf0ce
[deliverable/binutils-gdb.git] / 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 #ifndef O_RDONLY
116 #define O_RDONLY 0
117 #endif
118
119 #ifndef O_RDWR
120 #define O_RDWR 2
121 #endif
122
123 #ifndef SEEK_SET
124 #define SEEK_SET 0
125 #endif
126 #ifndef SEEK_CUR
127 #define SEEK_CUR 1
128 #endif
129 #ifndef SEEK_END
130 #define SEEK_END 2
131 #endif
132
133 #ifdef HAVE_LOCALE_H
134 # ifndef ENABLE_NLS
135 /* The Solaris version of locale.h always includes libintl.h. If we have
136 been configured with --disable-nls then ENABLE_NLS will not be defined
137 and the dummy definitions of bindtextdomain (et al) below will conflict
138 with the defintions in libintl.h. So we define these values to prevent
139 the bogus inclusion of libintl.h. */
140 # define _LIBINTL_H
141 # define _LIBGETTEXT_H
142 # endif
143 # include <locale.h>
144 #endif
145
146 #ifdef ENABLE_NLS
147 # include <libintl.h>
148 # define _(String) gettext (String)
149 # ifdef gettext_noop
150 # define N_(String) gettext_noop (String)
151 # else
152 # define N_(String) (String)
153 # endif
154 #else
155 # define gettext(Msgid) (Msgid)
156 # define dgettext(Domainname, Msgid) (Msgid)
157 # define dcgettext(Domainname, Msgid, Category) (Msgid)
158 # define textdomain(Domainname) while (0) /* nothing */
159 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
160 # define _(String) (String)
161 # define N_(String) (String)
162 #endif
163
164 /* Used by ar.c and objcopy.c. */
165 #define BUFSIZE 8192
166
167 /* For PATH_MAX. */
168 #ifdef HAVE_LIMITS_H
169 #include <limits.h>
170 #endif
171
172 #ifndef PATH_MAX
173 /* For MAXPATHLEN. */
174 # ifdef HAVE_SYS_PARAM_H
175 # include <sys/param.h>
176 # endif
177 # ifndef PATH_MAX
178 # ifdef MAXPATHLEN
179 # define PATH_MAX MAXPATHLEN
180 # else
181 # define PATH_MAX 1024
182 # endif
183 # endif
184 #endif
185
186 #endif /* _BIN_SYSDEP_H */
This page took 0.032976 seconds and 4 git commands to generate.