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