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