Subversion Repositories Kolibri OS

Rev

Rev 5197 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /* sysdep.h -- handle host dependencies for the BFD library
  2.    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2009
  3.    Free Software Foundation, Inc.
  4.    Written by Cygnus Support.
  5.  
  6.    This file is part of BFD, the Binary File Descriptor library.
  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
  10.    the Free Software Foundation; either version 3 of the License, or
  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,
  21.    MA 02110-1301, USA.  */
  22.  
  23. #ifndef BFD_SYSDEP_H
  24. #define BFD_SYSDEP_H
  25.  
  26. #ifdef PACKAGE
  27. #error sysdep.h must be included in lieu of config.h
  28. #endif
  29.  
  30. #include <stdarg.h>
  31.  
  32. #include "config.h"
  33.  
  34. #include "ansidecl.h"
  35.  
  36. #ifdef HAVE_STDDEF_H
  37. #include <stddef.h>
  38. #endif
  39.  
  40. #include <stdio.h>
  41. #include <sys/types.h>
  42. #include <sys/stat.h>
  43.  
  44. #include <errno.h>
  45. #if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
  46. extern int errno;
  47. #endif
  48.  
  49. #ifdef STRING_WITH_STRINGS
  50. #include <string.h>
  51. #include <strings.h>
  52. #else
  53. #ifdef HAVE_STRING_H
  54. #include <string.h>
  55. #else
  56. #ifdef HAVE_STRINGS_H
  57. #include <strings.h>
  58. #else
  59. extern char *strchr ();
  60. extern char *strrchr ();
  61. #endif
  62. #endif
  63. #endif
  64.  
  65. #ifdef HAVE_STDLIB_H
  66. #include <stdlib.h>
  67. #endif
  68.  
  69. #ifdef TIME_WITH_SYS_TIME
  70. #include <sys/time.h>
  71. #include <time.h>
  72. #else
  73. #ifdef HAVE_SYS_TIME_H
  74. #include <sys/time.h>
  75. #else
  76. #include <time.h>
  77. #endif
  78. #endif
  79.  
  80. #ifdef HAVE_UNISTD_H
  81. #include <unistd.h>
  82. #endif
  83.  
  84. #ifdef HAVE_SYS_RESOURCE_H
  85. #include <sys/resource.h>
  86. #endif /* HAVE_SYS_RESOURCE_H */
  87.  
  88. #ifdef USE_BINARY_FOPEN
  89. #include "fopen-bin.h"
  90. #else
  91. #include "fopen-same.h"
  92. #endif
  93.  
  94. #ifdef HAVE_FCNTL_H
  95. #include <fcntl.h>
  96. #else
  97. #ifdef HAVE_SYS_FILE_H
  98. #include <sys/file.h>
  99. #endif
  100. #endif
  101.  
  102. #ifndef O_RDONLY
  103. #define O_RDONLY 0
  104. #endif
  105. #ifndef O_WRONLY
  106. #define O_WRONLY 1
  107. #endif
  108. #ifndef O_RDWR
  109. #define O_RDWR 2
  110. #endif
  111. #ifndef O_ACCMODE
  112. #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
  113. #endif
  114.  
  115. #ifndef SEEK_SET
  116. #define SEEK_SET 0
  117. #endif
  118. #ifndef SEEK_CUR
  119. #define SEEK_CUR 1
  120. #endif
  121.  
  122. #include "filenames.h"
  123.  
  124. #if !HAVE_DECL_FFS
  125. extern int ffs (int);
  126. #endif
  127.  
  128. #if !HAVE_DECL_FREE
  129. extern void free ();
  130. #endif
  131.  
  132. #if !HAVE_DECL_GETENV
  133. extern char *getenv ();
  134. #endif
  135.  
  136. #if !HAVE_DECL_MALLOC
  137. extern PTR malloc ();
  138. #endif
  139.  
  140. #if !HAVE_DECL_REALLOC
  141. extern PTR realloc ();
  142. #endif
  143.  
  144. #if !HAVE_DECL_STPCPY
  145. extern char *stpcpy (char *__dest, const char *__src);
  146. #endif
  147.  
  148. #if !HAVE_DECL_STRSTR
  149. extern char *strstr ();
  150. #endif
  151.  
  152. #ifdef HAVE_FTELLO
  153. #if !HAVE_DECL_FTELLO
  154. extern off_t ftello (FILE *stream);
  155. #endif
  156. #endif
  157.  
  158. #ifdef HAVE_FTELLO64
  159. #if !HAVE_DECL_FTELLO64
  160. extern off64_t ftello64 (FILE *stream);
  161. #endif
  162. #endif
  163.  
  164. #ifdef HAVE_FSEEKO
  165. #if !HAVE_DECL_FSEEKO
  166. extern int fseeko (FILE *stream, off_t offset, int whence);
  167. #endif
  168. #endif
  169.  
  170. #ifdef HAVE_FSEEKO64
  171. #if !HAVE_DECL_FSEEKO64
  172. extern int fseeko64 (FILE *stream, off64_t offset, int whence);
  173. #endif
  174. #endif
  175.  
  176. /* Define offsetof for those systems which lack it */
  177.  
  178. #ifndef offsetof
  179. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  180. #endif
  181.  
  182. #ifdef ENABLE_NLS
  183. #include <libintl.h>
  184. /* Note the use of dgetext() and PACKAGE here, rather than gettext().
  185.  
  186.    This is because the code in this directory is used to build a library which
  187.    will be linked with code in other directories to form programs.  We want to
  188.    maintain a seperate translation file for this directory however, rather
  189.    than being forced to merge it with that of any program linked to libbfd.
  190.    This is a library, so it cannot depend on the catalog currently loaded.
  191.  
  192.    In order to do this, we have to make sure that when we extract messages we
  193.    use the OPCODES domain rather than the domain of the program that included
  194.    the bfd library, (eg OBJDUMP).  Hence we use dgettext (PACKAGE, String)
  195.    and define PACKAGE to be 'bfd'.  (See the code in configure).  */
  196. #define _(String) dgettext (PACKAGE, String)
  197. #ifdef gettext_noop
  198. #define N_(String) gettext_noop (String)
  199. #else
  200. #define N_(String) (String)
  201. #endif
  202. #else
  203. # define gettext(Msgid) (Msgid)
  204. # define dgettext(Domainname, Msgid) (Msgid)
  205. # define dcgettext(Domainname, Msgid, Category) (Msgid)
  206. # define textdomain(Domainname) while (0) /* nothing */
  207. # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
  208. # define _(String) (String)
  209. # define N_(String) (String)
  210. #endif
  211.  
  212. #endif /* ! defined (BFD_SYSDEP_H) */
  213.