Upgrade GDB from 7.4.1 to 7.6.1 on the vendor branch
[dragonfly.git] / contrib / gdb-7 / bfd / sysdep.h
CommitLineData
5796c8dc
SS
1/* sysdep.h -- handle host dependencies for the BFD library
2 Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2009
3 Free Software Foundation, Inc.
4 Written by Cygnus Support.
5
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. */
22
23#ifndef BFD_SYSDEP_H
24#define BFD_SYSDEP_H
25
ef5ccd6c
JM
26#ifdef PACKAGE
27#error sysdep.h must be included in lieu of config.h
28#endif
29
5796c8dc
SS
30#include "config.h"
31
32#include "ansidecl.h"
33
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
47#ifdef STRING_WITH_STRINGS
48#include <string.h>
49#include <strings.h>
50#else
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
61#endif
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
116#include "filenames.h"
117
118#if !HAVE_DECL_FFS
119extern int ffs (int);
120#endif
121
122#if !HAVE_DECL_FREE
123extern void free ();
124#endif
125
126#if !HAVE_DECL_GETENV
127extern char *getenv ();
128#endif
129
130#if !HAVE_DECL_MALLOC
131extern PTR malloc ();
132#endif
133
134#if !HAVE_DECL_REALLOC
135extern PTR realloc ();
136#endif
137
138#if !HAVE_DECL_STPCPY
139extern char *stpcpy (char *__dest, const char *__src);
140#endif
141
142#if !HAVE_DECL_STRSTR
143extern char *strstr ();
144#endif
145
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
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
176#ifdef ENABLE_NLS
177#include <libintl.h>
178/* Note the use of dgetext() and PACKAGE here, rather than gettext().
179
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). */
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
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)
204#endif
205
206#endif /* ! defined (BFD_SYSDEP_H) */