1/* sysdep.h -- handle host dependencies for binutils
2   Copyright (C) 1991-2022 Free Software Foundation, Inc.
3
4   This file is part of GNU Binutils.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 3 of the License, or
9   (at your option) any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
19
20#ifndef _BIN_SYSDEP_H
21#define _BIN_SYSDEP_H
22
23#include "config.h"
24#include <stdio.h>
25#ifdef HAVE_SYS_TYPES_H
26#include <sys/types.h>
27#endif
28#ifdef HAVE_SYS_STAT_H
29#include <sys/stat.h>
30#endif
31#include <stdlib.h>
32#include <string.h>
33#include <stdarg.h>
34#include <errno.h>
35#ifdef HAVE_UNISTD_H
36#include <unistd.h>
37#endif
38#ifdef HAVE_FCNTL_H
39#include <fcntl.h>
40#else
41#ifdef HAVE_SYS_FILE_H
42#include <sys/file.h>
43#endif
44#endif
45
46#include "ansidecl.h"
47#include "bfdver.h"
48
49#ifdef USE_BINARY_FOPEN
50#include "fopen-bin.h"
51#else
52#include "fopen-same.h"
53#endif
54
55#include "binary-io.h"
56
57#if !HAVE_DECL_STPCPY
58extern char *stpcpy (char *, const char *);
59#endif
60
61#ifdef HAVE_SBRK
62#if !HAVE_DECL_SBRK
63extern char *sbrk ();
64#endif
65#endif
66
67#if !HAVE_DECL_ENVIRON
68extern char **environ;
69#endif
70
71#ifndef O_RDONLY
72#define O_RDONLY 0
73#endif
74
75#ifndef O_RDWR
76#define O_RDWR 2
77#endif
78
79#ifndef SEEK_SET
80#define SEEK_SET 0
81#endif
82#ifndef SEEK_CUR
83#define SEEK_CUR 1
84#endif
85#ifndef SEEK_END
86#define SEEK_END 2
87#endif
88
89#ifndef ENABLE_NLS
90  /* The Solaris version of locale.h always includes libintl.h.  If we have
91     been configured with --disable-nls then ENABLE_NLS will not be defined
92     and the dummy definitions of bindtextdomain (et al) below will conflict
93     with the defintions in libintl.h.  So we define these values to prevent
94     the bogus inclusion of libintl.h.  */
95# define _LIBINTL_H
96# define _LIBGETTEXT_H
97#endif
98#include <locale.h>
99
100#ifdef ENABLE_NLS
101# include <libintl.h>
102# define _(String) gettext (String)
103# ifdef gettext_noop
104#  define N_(String) gettext_noop (String)
105# else
106#  define N_(String) (String)
107# endif
108#else
109# define gettext(Msgid) (Msgid)
110# define dgettext(Domainname, Msgid) (Msgid)
111# define dcgettext(Domainname, Msgid, Category) (Msgid)
112# define ngettext(Msgid1, Msgid2, n) \
113  (n == 1 ? Msgid1 : Msgid2)
114# define dngettext(Domainname, Msgid1, Msgid2, n) \
115  (n == 1 ? Msgid1 : Msgid2)
116# define dcngettext(Domainname, Msgid1, Msgid2, n, Category) \
117  (n == 1 ? Msgid1 : Msgid2)
118# define textdomain(Domainname) do {} while (0)
119# define bindtextdomain(Domainname, Dirname) do {} while (0)
120# define _(String) (String)
121# define N_(String) (String)
122#endif
123
124/* Used by ar.c and objcopy.c.  */
125#define BUFSIZE 8192
126
127#include <limits.h>
128
129#if SIZEOF_LONG_LONG > SIZEOF_LONG
130/* We can't use any bfd types here since readelf may define BFD64 and
131   objdump may not.  */
132#define HOST_WIDEST_INT	long long
133#else
134#define HOST_WIDEST_INT long
135#endif
136
137#define POISON_BFD_BOOLEAN 1
138
139#endif /* _BIN_SYSDEP_H */
140