Correct ChangeLog entry.
[binutils.git] / bfd / sysdep.h
blob9695190299fdab3eb4ef64546af67c520a974dcf
1 /* sysdep.h -- handle host dependencies for the BFD library
2 Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007
3 Free Software Foundation, Inc.
4 Written by Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
23 #ifndef BFD_SYSDEP_H
24 #define BFD_SYSDEP_H
26 #include "config.h"
28 #include "ansidecl.h"
30 #ifdef HAVE_STDDEF_H
31 #include <stddef.h>
32 #endif
34 #include <stdio.h>
35 #include <sys/types.h>
36 #include <sys/stat.h>
38 #include <errno.h>
39 #if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
40 extern int errno;
41 #endif
43 #ifdef STRING_WITH_STRINGS
44 #include <string.h>
45 #include <strings.h>
46 #else
47 #ifdef HAVE_STRING_H
48 #include <string.h>
49 #else
50 #ifdef HAVE_STRINGS_H
51 #include <strings.h>
52 #else
53 extern char *strchr ();
54 extern char *strrchr ();
55 #endif
56 #endif
57 #endif
59 #ifdef HAVE_STDLIB_H
60 #include <stdlib.h>
61 #endif
63 #ifdef TIME_WITH_SYS_TIME
64 #include <sys/time.h>
65 #include <time.h>
66 #else
67 #ifdef HAVE_SYS_TIME_H
68 #include <sys/time.h>
69 #else
70 #include <time.h>
71 #endif
72 #endif
74 #ifdef HAVE_UNISTD_H
75 #include <unistd.h>
76 #endif
78 #ifdef USE_BINARY_FOPEN
79 #include "fopen-bin.h"
80 #else
81 #include "fopen-same.h"
82 #endif
84 #ifdef HAVE_FCNTL_H
85 #include <fcntl.h>
86 #else
87 #ifdef HAVE_SYS_FILE_H
88 #include <sys/file.h>
89 #endif
90 #endif
92 #ifndef O_RDONLY
93 #define O_RDONLY 0
94 #endif
95 #ifndef O_WRONLY
96 #define O_WRONLY 1
97 #endif
98 #ifndef O_RDWR
99 #define O_RDWR 2
100 #endif
101 #ifndef O_ACCMODE
102 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
103 #endif
105 #ifndef SEEK_SET
106 #define SEEK_SET 0
107 #endif
108 #ifndef SEEK_CUR
109 #define SEEK_CUR 1
110 #endif
112 #include "filenames.h"
114 #if !HAVE_DECL_FFS
115 extern int ffs (int);
116 #endif
118 #if !HAVE_DECL_FREE
119 extern void free ();
120 #endif
122 #if !HAVE_DECL_GETENV
123 extern char *getenv ();
124 #endif
126 #if !HAVE_DECL_MALLOC
127 extern PTR malloc ();
128 #endif
130 #if !HAVE_DECL_REALLOC
131 extern PTR realloc ();
132 #endif
134 #if !HAVE_DECL_STPCPY
135 extern char *stpcpy (char *__dest, const char *__src);
136 #endif
138 #if !HAVE_DECL_STRSTR
139 extern char *strstr ();
140 #endif
142 #ifdef HAVE_FTELLO
143 #if !HAVE_DECL_FTELLO
144 extern off_t ftello (FILE *stream);
145 #endif
146 #endif
148 #ifdef HAVE_FTELLO64
149 #if !HAVE_DECL_FTELLO64
150 extern off64_t ftello64 (FILE *stream);
151 #endif
152 #endif
154 #ifdef HAVE_FSEEKO
155 #if !HAVE_DECL_FSEEKO
156 extern int fseeko (FILE *stream, off_t offset, int whence);
157 #endif
158 #endif
160 #ifdef HAVE_FSEEKO64
161 #if !HAVE_DECL_FSEEKO64
162 extern int fseeko64 (FILE *stream, off64_t offset, int whence);
163 #endif
164 #endif
166 /* Define offsetof for those systems which lack it */
168 #ifndef offsetof
169 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
170 #endif
172 #ifdef ENABLE_NLS
173 #include <libintl.h>
174 /* Note the use of dgetext() and PACKAGE here, rather than gettext().
176 This is because the code in this directory is used to build a library which
177 will be linked with code in other directories to form programs. We want to
178 maintain a seperate translation file for this directory however, rather
179 than being forced to merge it with that of any program linked to libbfd.
180 This is a library, so it cannot depend on the catalog currently loaded.
182 In order to do this, we have to make sure that when we extract messages we
183 use the OPCODES domain rather than the domain of the program that included
184 the bfd library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String)
185 and define PACKAGE to be 'bfd'. (See the code in configure). */
186 #define _(String) dgettext (PACKAGE, String)
187 #ifdef gettext_noop
188 #define N_(String) gettext_noop (String)
189 #else
190 #define N_(String) (String)
191 #endif
192 #else
193 # define gettext(Msgid) (Msgid)
194 # define dgettext(Domainname, Msgid) (Msgid)
195 # define dcgettext(Domainname, Msgid, Category) (Msgid)
196 # define textdomain(Domainname) while (0) /* nothing */
197 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
198 # define _(String) (String)
199 # define N_(String) (String)
200 #endif
202 #endif /* ! defined (BFD_SYSDEP_H) */