source: binutils/trunk/bfd/sysdep.h@ 1973

Last change on this file since 1973 was 1973, checked in by Silvan Scherrer, 8 years ago

binutils: update trunk to version 2.27

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