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