1d0f678fdim/* sysdep.h -- handle host dependencies for binutils
2d0f678fdim   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3d0f678fdim   2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
4d0f678fdim
5d0f678fdim   This file is part of GNU Binutils.
6d0f678fdim
7d0f678fdim   This program is free software; you can redistribute it and/or modify
8d0f678fdim   it under the terms of the GNU General Public License as published by
9d0f678fdim   the Free Software Foundation; either version 2 of the License, or
10d0f678fdim   (at your option) any later version.
11d0f678fdim
12d0f678fdim   This program is distributed in the hope that it will be useful,
13d0f678fdim   but WITHOUT ANY WARRANTY; without even the implied warranty of
14d0f678fdim   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15d0f678fdim   GNU General Public License for more details.
16d0f678fdim
17d0f678fdim   You should have received a copy of the GNU General Public License
18d0f678fdim   along with this program; if not, write to the Free Software
19d0f678fdim   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20d0f678fdim
21d0f678fdim#ifndef _BIN_SYSDEP_H
22d0f678fdim#define _BIN_SYSDEP_H
23d0f678fdim
24d0f678fdim#include "ansidecl.h"
25d0f678fdim#include <stdio.h>
26d0f678fdim#include <sys/types.h>
27d0f678fdim
28d0f678fdim#include "bfdver.h"
29d0f678fdim#include "config.h"
30d0f678fdim
31d0f678fdim#include <stdarg.h>
32d0f678fdim
33d0f678fdim#ifdef USE_BINARY_FOPEN
34d0f678fdim#include "fopen-bin.h"
35d0f678fdim#else
36d0f678fdim#include "fopen-same.h"
37d0f678fdim#endif
38d0f678fdim
39d0f678fdim#include <errno.h>
40d0f678fdim#ifndef errno
41d0f678fdimextern int errno;
42d0f678fdim#endif
43d0f678fdim
44d0f678fdim#ifdef HAVE_UNISTD_H
45d0f678fdim#include <unistd.h>
46d0f678fdim#endif
47d0f678fdim
48d0f678fdim#ifdef HAVE_STRING_H
49d0f678fdim#include <string.h>
50d0f678fdim#else
51d0f678fdim#ifdef HAVE_STRINGS_H
52d0f678fdim#include <strings.h>
53d0f678fdim#else
54d0f678fdimextern char *strchr ();
55d0f678fdimextern char *strrchr ();
56d0f678fdim#endif
57d0f678fdim#endif
58d0f678fdim
59d0f678fdim#ifdef HAVE_STDLIB_H
60d0f678fdim#include <stdlib.h>
61d0f678fdim#endif
62d0f678fdim
63d0f678fdim#ifdef HAVE_FCNTL_H
64d0f678fdim#include <fcntl.h>
65d0f678fdim#else
66d0f678fdim#ifdef HAVE_SYS_FILE_H
67d0f678fdim#include <sys/file.h>
68d0f678fdim#endif
69d0f678fdim#endif
70d0f678fdim
71d0f678fdim#if !HAVE_DECL_STPCPY
72d0f678fdimextern char *stpcpy (char *, const char *);
73d0f678fdim#endif
74d0f678fdim
75d0f678fdim#if !HAVE_DECL_STRSTR
76d0f678fdimextern char *strstr ();
77d0f678fdim#endif
78d0f678fdim
79d0f678fdim#ifdef HAVE_SBRK
80d0f678fdim#if !HAVE_DECL_SBRK
81d0f678fdimextern char *sbrk ();
82d0f678fdim#endif
83d0f678fdim#endif
84d0f678fdim
85d0f678fdim#if !HAVE_DECL_GETENV
86d0f678fdimextern char *getenv ();
87d0f678fdim#endif
88d0f678fdim
89d0f678fdim#if !HAVE_DECL_ENVIRON
90d0f678fdimextern char **environ;
91d0f678fdim#endif
92d0f678fdim
93d0f678fdim#if !HAVE_DECL_FPRINTF
94d0f678fdimextern int fprintf (FILE *, const char *, ...);
95d0f678fdim#endif
96d0f678fdim
97d0f678fdim#if !HAVE_DECL_SNPRINTF
98d0f678fdimextern int snprintf(char *, size_t, const char *, ...);
99d0f678fdim#endif
100d0f678fdim
101d0f678fdim#if !HAVE_DECL_VSNPRINTF
102d0f678fdimextern int vsnprintf(char *, size_t, const char *, va_list);
103d0f678fdim#endif
104d0f678fdim
105d0f678fdim#ifndef O_RDONLY
106d0f678fdim#define O_RDONLY 0
107d0f678fdim#endif
108d0f678fdim
109d0f678fdim#ifndef O_RDWR
110d0f678fdim#define O_RDWR 2
111d0f678fdim#endif
112d0f678fdim
113d0f678fdim#ifndef SEEK_SET
114d0f678fdim#define SEEK_SET 0
115d0f678fdim#endif
116d0f678fdim#ifndef SEEK_CUR
117d0f678fdim#define SEEK_CUR 1
118d0f678fdim#endif
119d0f678fdim#ifndef SEEK_END
120d0f678fdim#define SEEK_END 2
121d0f678fdim#endif
122d0f678fdim
123d0f678fdim#if defined(__GNUC__) && !defined(C_ALLOCA)
124d0f678fdim# undef alloca
125d0f678fdim# define alloca __builtin_alloca
126d0f678fdim#else
127d0f678fdim# if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
128d0f678fdim#  include <alloca.h>
129d0f678fdim# else
130d0f678fdim#  ifndef alloca /* predefined by HP cc +Olibcalls */
131d0f678fdim#   if !defined (__STDC__) && !defined (__hpux)
132d0f678fdimchar *alloca ();
133d0f678fdim#   else
134d0f678fdimvoid *alloca ();
135d0f678fdim#   endif /* __STDC__, __hpux */
136d0f678fdim#  endif /* alloca */
137d0f678fdim# endif /* HAVE_ALLOCA_H */
138d0f678fdim#endif
139d0f678fdim
140d0f678fdim#ifdef HAVE_LOCALE_H
141d0f678fdim# ifndef ENABLE_NLS
142d0f678fdim   /* The Solaris version of locale.h always includes libintl.h.  If we have
143d0f678fdim      been configured with --disable-nls then ENABLE_NLS will not be defined
144d0f678fdim      and the dummy definitions of bindtextdomain (et al) below will conflict
145d0f678fdim      with the defintions in libintl.h.  So we define these values to prevent
146d0f678fdim      the bogus inclusion of libintl.h.  */
147d0f678fdim#  define _LIBINTL_H
148d0f678fdim#  define _LIBGETTEXT_H
149d0f678fdim# endif
150d0f678fdim# include <locale.h>
151d0f678fdim#endif
152d0f678fdim
153d0f678fdim#ifdef ENABLE_NLS
154d0f678fdim# include <libintl.h>
155d0f678fdim# define _(String) gettext (String)
156d0f678fdim# ifdef gettext_noop
157d0f678fdim#  define N_(String) gettext_noop (String)
158d0f678fdim# else
159d0f678fdim#  define N_(String) (String)
160d0f678fdim# endif
161d0f678fdim#else
162d0f678fdim# define gettext(Msgid) (Msgid)
163d0f678fdim# define dgettext(Domainname, Msgid) (Msgid)
164d0f678fdim# define dcgettext(Domainname, Msgid, Category) (Msgid)
165d0f678fdim# define textdomain(Domainname) while (0) /* nothing */
166d0f678fdim# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
167d0f678fdim# define _(String) (String)
168d0f678fdim# define N_(String) (String)
169d0f678fdim#endif
170d0f678fdim
171d0f678fdim/* Used by ar.c and objcopy.c.  */
172d0f678fdim#define BUFSIZE 8192
173d0f678fdim
174d0f678fdim#endif /* _BIN_SYSDEP_H */
175