1 /* sysdep.h -- handle host dependencies for binutils 2 Copyright (C) 1991-2014 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 22 #define _BIN_SYSDEP_H 23 24 #include "alloca-conf.h" 25 #include "ansidecl.h" 26 #include <stdio.h> 27 #include <sys/types.h> 28 29 #include "bfdver.h" 30 31 #include <stdarg.h> 32 33 #ifdef USE_BINARY_FOPEN 34 #include "fopen-bin.h" 35 #else 36 #include "fopen-same.h" 37 #endif 38 39 #include <errno.h> 40 #ifndef errno 41 extern int errno; 42 #endif 43 44 #ifdef HAVE_UNISTD_H 45 #include <unistd.h> 46 #endif 47 48 #ifdef STRING_WITH_STRINGS 49 #include <string.h> 50 #include <strings.h> 51 #else 52 #ifdef HAVE_STRING_H 53 #include <string.h> 54 #else 55 #ifdef HAVE_STRINGS_H 56 #include <strings.h> 57 #else 58 extern char *strchr (); 59 extern char *strrchr (); 60 #endif 61 #endif 62 #endif 63 64 #ifdef HAVE_STDLIB_H 65 #include <stdlib.h> 66 #endif 67 68 #ifdef HAVE_FCNTL_H 69 #include <fcntl.h> 70 #else 71 #ifdef HAVE_SYS_FILE_H 72 #include <sys/file.h> 73 #endif 74 #endif 75 76 #ifdef HAVE_SYS_STAT_H 77 #include <sys/stat.h> 78 #endif 79 80 #include "binary-io.h" 81 82 #if !HAVE_DECL_STPCPY 83 extern char *stpcpy (char *, const char *); 84 #endif 85 86 #if !HAVE_DECL_STRSTR 87 extern char *strstr (); 88 #endif 89 90 #ifdef HAVE_SBRK 91 #if !HAVE_DECL_SBRK 92 extern char *sbrk (); 93 #endif 94 #endif 95 96 #if !HAVE_DECL_GETENV 97 extern char *getenv (); 98 #endif 99 100 #if !HAVE_DECL_ENVIRON 101 extern char **environ; 102 #endif 103 104 #if !HAVE_DECL_FPRINTF 105 extern int fprintf (FILE *, const char *, ...); 106 #endif 107 108 #if !HAVE_DECL_SNPRINTF 109 extern int snprintf(char *, size_t, const char *, ...); 110 #endif 111 112 #if !HAVE_DECL_VSNPRINTF 113 extern int vsnprintf(char *, size_t, const char *, va_list); 114 #endif 115 116 #if !HAVE_DECL_STRNLEN 117 size_t strnlen (const char *, size_t); 118 #endif 119 120 #ifndef O_RDONLY 121 #define O_RDONLY 0 122 #endif 123 124 #ifndef O_RDWR 125 #define O_RDWR 2 126 #endif 127 128 #ifndef SEEK_SET 129 #define SEEK_SET 0 130 #endif 131 #ifndef SEEK_CUR 132 #define SEEK_CUR 1 133 #endif 134 #ifndef SEEK_END 135 #define SEEK_END 2 136 #endif 137 138 #ifdef HAVE_LOCALE_H 139 # ifndef ENABLE_NLS 140 /* The Solaris version of locale.h always includes libintl.h. If we have 141 been configured with --disable-nls then ENABLE_NLS will not be defined 142 and the dummy definitions of bindtextdomain (et al) below will conflict 143 with the defintions in libintl.h. So we define these values to prevent 144 the bogus inclusion of libintl.h. */ 145 # define _LIBINTL_H 146 # define _LIBGETTEXT_H 147 # endif 148 # include <locale.h> 149 #endif 150 151 #ifdef ENABLE_NLS 152 # include <libintl.h> 153 # define _(String) gettext (String) 154 # ifdef gettext_noop 155 # define N_(String) gettext_noop (String) 156 # else 157 # define N_(String) (String) 158 # endif 159 #else 160 # define gettext(Msgid) (Msgid) 161 # define dgettext(Domainname, Msgid) (Msgid) 162 # define dcgettext(Domainname, Msgid, Category) (Msgid) 163 # define textdomain(Domainname) while (0) /* nothing */ 164 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ 165 # define _(String) (String) 166 # define N_(String) (String) 167 #endif 168 169 /* Used by ar.c and objcopy.c. */ 170 #define BUFSIZE 8192 171 172 /* For PATH_MAX. */ 173 #ifdef HAVE_LIMITS_H 174 #include <limits.h> 175 #endif 176 177 #ifndef PATH_MAX 178 /* For MAXPATHLEN. */ 179 # ifdef HAVE_SYS_PARAM_H 180 # include <sys/param.h> 181 # endif 182 # ifndef PATH_MAX 183 # ifdef MAXPATHLEN 184 # define PATH_MAX MAXPATHLEN 185 # else 186 # define PATH_MAX 1024 187 # endif 188 # endif 189 #endif 190 191 #endif /* _BIN_SYSDEP_H */ 192