daily update
[binutils.git] / binutils / sysdep.h
blobe573637b8c72563836d063d33af672fdd09daeb1
1 /* sysdep.h -- handle host dependencies for binutils
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc.
6 This file is part of GNU Binutils.
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.
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.
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. */
22 #ifndef _BIN_SYSDEP_H
23 #define _BIN_SYSDEP_H
25 #include "alloca-conf.h"
26 #include "ansidecl.h"
27 #include <stdio.h>
28 #include <sys/types.h>
30 #include "bfdver.h"
32 #include <stdarg.h>
34 #ifdef USE_BINARY_FOPEN
35 #include "fopen-bin.h"
36 #else
37 #include "fopen-same.h"
38 #endif
40 #include <errno.h>
41 #ifndef errno
42 extern int errno;
43 #endif
45 #ifdef HAVE_UNISTD_H
46 #include <unistd.h>
47 #endif
49 #ifdef HAVE_STRING_H
50 #include <string.h>
51 #else
52 #ifdef HAVE_STRINGS_H
53 #include <strings.h>
54 #else
55 extern char *strchr ();
56 extern char *strrchr ();
57 #endif
58 #endif
60 #ifdef HAVE_STDLIB_H
61 #include <stdlib.h>
62 #endif
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
72 #include "binary-io.h"
74 #if !HAVE_DECL_STPCPY
75 extern char *stpcpy (char *, const char *);
76 #endif
78 #if !HAVE_DECL_STRSTR
79 extern char *strstr ();
80 #endif
82 #ifdef HAVE_SBRK
83 #if !HAVE_DECL_SBRK
84 extern char *sbrk ();
85 #endif
86 #endif
88 #if !HAVE_DECL_GETENV
89 extern char *getenv ();
90 #endif
92 #if !HAVE_DECL_ENVIRON
93 extern char **environ;
94 #endif
96 #if !HAVE_DECL_FPRINTF
97 extern int fprintf (FILE *, const char *, ...);
98 #endif
100 #if !HAVE_DECL_SNPRINTF
101 extern int snprintf(char *, size_t, const char *, ...);
102 #endif
104 #if !HAVE_DECL_VSNPRINTF
105 extern int vsnprintf(char *, size_t, const char *, va_list);
106 #endif
108 #ifndef O_RDONLY
109 #define O_RDONLY 0
110 #endif
112 #ifndef O_RDWR
113 #define O_RDWR 2
114 #endif
116 #ifndef SEEK_SET
117 #define SEEK_SET 0
118 #endif
119 #ifndef SEEK_CUR
120 #define SEEK_CUR 1
121 #endif
122 #ifndef SEEK_END
123 #define SEEK_END 2
124 #endif
126 #ifdef HAVE_LOCALE_H
127 # ifndef ENABLE_NLS
128 /* The Solaris version of locale.h always includes libintl.h. If we have
129 been configured with --disable-nls then ENABLE_NLS will not be defined
130 and the dummy definitions of bindtextdomain (et al) below will conflict
131 with the defintions in libintl.h. So we define these values to prevent
132 the bogus inclusion of libintl.h. */
133 # define _LIBINTL_H
134 # define _LIBGETTEXT_H
135 # endif
136 # include <locale.h>
137 #endif
139 #ifdef ENABLE_NLS
140 # include <libintl.h>
141 # define _(String) gettext (String)
142 # ifdef gettext_noop
143 # define N_(String) gettext_noop (String)
144 # else
145 # define N_(String) (String)
146 # endif
147 #else
148 # define gettext(Msgid) (Msgid)
149 # define dgettext(Domainname, Msgid) (Msgid)
150 # define dcgettext(Domainname, Msgid, Category) (Msgid)
151 # define textdomain(Domainname) while (0) /* nothing */
152 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
153 # define _(String) (String)
154 # define N_(String) (String)
155 #endif
157 /* Used by ar.c and objcopy.c. */
158 #define BUFSIZE 8192
160 /* For PATH_MAX. */
161 #ifdef HAVE_LIMITS_H
162 #include <limits.h>
163 #endif
165 #ifndef PATH_MAX
166 /* For MAXPATHLEN. */
167 # ifdef HAVE_SYS_PARAM_H
168 # include <sys/param.h>
169 # endif
170 # ifndef PATH_MAX
171 # ifdef MAXPATHLEN
172 # define PATH_MAX MAXPATHLEN
173 # else
174 # define PATH_MAX 1024
175 # endif
176 # endif
177 #endif
179 #endif /* _BIN_SYSDEP_H */