]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - binutils/sysdep.h
2012-05-11 Yao Qi <yao@codesourcery.com>
[thirdparty/binutils-gdb.git] / binutils / sysdep.h
CommitLineData
3db64b00
AM
1/* sysdep.h -- handle host dependencies for binutils
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
dbb7c441 3 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2012
4cef8a9f 4 Free Software Foundation, Inc.
3db64b00
AM
5
6 This file is part of GNU Binutils.
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
32866df7 10 the Free Software Foundation; either version 3 of the License, or
3db64b00
AM
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, MA 02110-1301, USA. */
21\f
22#ifndef _BIN_SYSDEP_H
23#define _BIN_SYSDEP_H
24
8d25cc3d 25#include "alloca-conf.h"
3db64b00
AM
26#include "ansidecl.h"
27#include <stdio.h>
28#include <sys/types.h>
29
30#include "bfdver.h"
3db64b00
AM
31
32#include <stdarg.h>
33
34#ifdef USE_BINARY_FOPEN
35#include "fopen-bin.h"
36#else
37#include "fopen-same.h"
38#endif
39
40#include <errno.h>
41#ifndef errno
42extern int errno;
43#endif
44
45#ifdef HAVE_UNISTD_H
46#include <unistd.h>
47#endif
48
49#ifdef HAVE_STRING_H
50#include <string.h>
51#else
52#ifdef HAVE_STRINGS_H
53#include <strings.h>
54#else
55extern char *strchr ();
56extern char *strrchr ();
57#endif
58#endif
59
60#ifdef HAVE_STDLIB_H
61#include <stdlib.h>
62#endif
63
64#ifdef HAVE_FCNTL_H
65#include <fcntl.h>
66#else
67#ifdef HAVE_SYS_FILE_H
68#include <sys/file.h>
69#endif
70#endif
71
dbb7c441
AM
72#ifdef HAVE_SYS_STAT_H
73#include <sys/stat.h>
74#endif
75
4cef8a9f
AM
76#include "binary-io.h"
77
3db64b00
AM
78#if !HAVE_DECL_STPCPY
79extern char *stpcpy (char *, const char *);
80#endif
81
82#if !HAVE_DECL_STRSTR
83extern char *strstr ();
84#endif
85
86#ifdef HAVE_SBRK
87#if !HAVE_DECL_SBRK
88extern char *sbrk ();
89#endif
90#endif
91
92#if !HAVE_DECL_GETENV
93extern char *getenv ();
94#endif
95
96#if !HAVE_DECL_ENVIRON
97extern char **environ;
98#endif
99
100#if !HAVE_DECL_FPRINTF
101extern int fprintf (FILE *, const char *, ...);
102#endif
103
104#if !HAVE_DECL_SNPRINTF
105extern int snprintf(char *, size_t, const char *, ...);
106#endif
107
108#if !HAVE_DECL_VSNPRINTF
109extern int vsnprintf(char *, size_t, const char *, va_list);
110#endif
111
112#ifndef O_RDONLY
113#define O_RDONLY 0
114#endif
115
116#ifndef O_RDWR
117#define O_RDWR 2
118#endif
119
120#ifndef SEEK_SET
121#define SEEK_SET 0
122#endif
123#ifndef SEEK_CUR
124#define SEEK_CUR 1
125#endif
126#ifndef SEEK_END
127#define SEEK_END 2
128#endif
129
3db64b00
AM
130#ifdef HAVE_LOCALE_H
131# ifndef ENABLE_NLS
132 /* The Solaris version of locale.h always includes libintl.h. If we have
133 been configured with --disable-nls then ENABLE_NLS will not be defined
134 and the dummy definitions of bindtextdomain (et al) below will conflict
135 with the defintions in libintl.h. So we define these values to prevent
136 the bogus inclusion of libintl.h. */
137# define _LIBINTL_H
138# define _LIBGETTEXT_H
139# endif
140# include <locale.h>
141#endif
142
143#ifdef ENABLE_NLS
144# include <libintl.h>
145# define _(String) gettext (String)
146# ifdef gettext_noop
147# define N_(String) gettext_noop (String)
148# else
149# define N_(String) (String)
150# endif
151#else
152# define gettext(Msgid) (Msgid)
153# define dgettext(Domainname, Msgid) (Msgid)
154# define dcgettext(Domainname, Msgid, Category) (Msgid)
155# define textdomain(Domainname) while (0) /* nothing */
156# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
157# define _(String) (String)
158# define N_(String) (String)
159#endif
160
161/* Used by ar.c and objcopy.c. */
162#define BUFSIZE 8192
163
0dafdf3f
L
164/* For PATH_MAX. */
165#ifdef HAVE_LIMITS_H
166#include <limits.h>
167#endif
168
169#ifndef PATH_MAX
170/* For MAXPATHLEN. */
171# ifdef HAVE_SYS_PARAM_H
172# include <sys/param.h>
173# endif
174# ifndef PATH_MAX
175# ifdef MAXPATHLEN
176# define PATH_MAX MAXPATHLEN
177# else
178# define PATH_MAX 1024
179# endif
180# endif
181#endif
182
3db64b00 183#endif /* _BIN_SYSDEP_H */