Update my e-mail address.
[binutils-gdb.git] / bfd / sysdep.h
blob6906da90c9892bd5267daeae052afd80d106470b
1 /* sysdep.h -- handle host dependencies for the BFD library
2 Copyright (C) 1995-2017 Free Software Foundation, Inc.
3 Written by Cygnus Support.
5 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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,
20 MA 02110-1301, USA. */
22 #ifndef BFD_SYSDEP_H
23 #define BFD_SYSDEP_H
25 #ifdef PACKAGE
26 #error sysdep.h must be included in lieu of config.h
27 #endif
29 #include "config.h"
31 #include "ansidecl.h"
33 #ifdef HAVE_STDDEF_H
34 #include <stddef.h>
35 #endif
37 #include <stdio.h>
38 #include <sys/types.h>
39 #include <sys/stat.h>
41 #include <errno.h>
42 #if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
43 extern int errno;
44 #endif
46 #ifdef STRING_WITH_STRINGS
47 #include <string.h>
48 #include <strings.h>
49 #else
50 #ifdef HAVE_STRING_H
51 #include <string.h>
52 #else
53 #ifdef HAVE_STRINGS_H
54 #include <strings.h>
55 #else
56 extern char *strchr ();
57 extern char *strrchr ();
58 #endif
59 #endif
60 #endif
62 #ifdef HAVE_STDLIB_H
63 #include <stdlib.h>
64 #endif
66 #ifdef TIME_WITH_SYS_TIME
67 #include <sys/time.h>
68 #include <time.h>
69 #else
70 #ifdef HAVE_SYS_TIME_H
71 #include <sys/time.h>
72 #else
73 #include <time.h>
74 #endif
75 #endif
77 #ifdef HAVE_UNISTD_H
78 #include <unistd.h>
79 #endif
81 #ifdef HAVE_SYS_RESOURCE_H
82 #include <sys/resource.h>
83 #endif /* HAVE_SYS_RESOURCE_H */
85 #ifdef USE_BINARY_FOPEN
86 #include "fopen-bin.h"
87 #else
88 #include "fopen-same.h"
89 #endif
91 #ifdef HAVE_FCNTL_H
92 #include <fcntl.h>
93 #else
94 #ifdef HAVE_SYS_FILE_H
95 #include <sys/file.h>
96 #endif
97 #endif
99 #ifndef O_RDONLY
100 #define O_RDONLY 0
101 #endif
102 #ifndef O_WRONLY
103 #define O_WRONLY 1
104 #endif
105 #ifndef O_RDWR
106 #define O_RDWR 2
107 #endif
108 #ifndef O_ACCMODE
109 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
110 #endif
112 #ifndef SEEK_SET
113 #define SEEK_SET 0
114 #endif
115 #ifndef SEEK_CUR
116 #define SEEK_CUR 1
117 #endif
119 #include "filenames.h"
121 #if !HAVE_DECL_FFS
122 extern int ffs (int);
123 #endif
125 #if !HAVE_DECL_FREE
126 extern void free ();
127 #endif
129 #if !HAVE_DECL_GETENV
130 extern char *getenv ();
131 #endif
133 #if !HAVE_DECL_MALLOC
134 extern PTR malloc ();
135 #endif
137 #if !HAVE_DECL_REALLOC
138 extern PTR realloc ();
139 #endif
141 #if !HAVE_DECL_STPCPY
142 extern char *stpcpy (char *__dest, const char *__src);
143 #endif
145 #if !HAVE_DECL_STRSTR
146 extern char *strstr ();
147 #endif
149 #ifdef HAVE_FTELLO
150 #if !HAVE_DECL_FTELLO
151 extern off_t ftello (FILE *stream);
152 #endif
153 #endif
155 #ifdef HAVE_FTELLO64
156 #if !HAVE_DECL_FTELLO64
157 extern off64_t ftello64 (FILE *stream);
158 #endif
159 #endif
161 #ifdef HAVE_FSEEKO
162 #if !HAVE_DECL_FSEEKO
163 extern int fseeko (FILE *stream, off_t offset, int whence);
164 #endif
165 #endif
167 #ifdef HAVE_FSEEKO64
168 #if !HAVE_DECL_FSEEKO64
169 extern int fseeko64 (FILE *stream, off64_t offset, int whence);
170 #endif
171 #endif
173 #if !HAVE_DECL_STRNLEN
174 size_t strnlen (const char *, size_t);
175 #endif
177 /* Define offsetof for those systems which lack it */
179 #ifndef offsetof
180 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
181 #endif
183 #ifdef ENABLE_NLS
184 #include <libintl.h>
185 /* Note the use of dgetext() and PACKAGE here, rather than gettext().
187 This is because the code in this directory is used to build a library which
188 will be linked with code in other directories to form programs. We want to
189 maintain a seperate translation file for this directory however, rather
190 than being forced to merge it with that of any program linked to libbfd.
191 This is a library, so it cannot depend on the catalog currently loaded.
193 In order to do this, we have to make sure that when we extract messages we
194 use the OPCODES domain rather than the domain of the program that included
195 the bfd library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String)
196 and define PACKAGE to be 'bfd'. (See the code in configure). */
197 #define _(String) dgettext (PACKAGE, String)
198 #ifdef gettext_noop
199 #define N_(String) gettext_noop (String)
200 #else
201 #define N_(String) (String)
202 #endif
203 #else
204 # define gettext(Msgid) (Msgid)
205 # define dgettext(Domainname, Msgid) (Msgid)
206 # define dcgettext(Domainname, Msgid, Category) (Msgid)
207 # define textdomain(Domainname) while (0) /* nothing */
208 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
209 # define _(String) (String)
210 # define N_(String) (String)
211 #endif
213 #endif /* ! defined (BFD_SYSDEP_H) */