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