Back to index

cell-binutils  2.17cvs20070401
sysdep.h
Go to the documentation of this file.
00001 /* sysdep.h -- handle host dependencies for the BFD library
00002    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
00003    Free Software Foundation, Inc.
00004    Written by Cygnus Support.
00005 
00006 This file is part of BFD, the Binary File Descriptor library.
00007 
00008 This program is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; either version 2 of the License, or
00011 (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00021 
00022 #ifndef BFD_SYSDEP_H
00023 #define BFD_SYSDEP_H
00024 
00025 #include "ansidecl.h"
00026 
00027 #include "config.h"
00028 
00029 #ifdef HAVE_STDDEF_H
00030 #include <stddef.h>
00031 #endif
00032 
00033 #include <stdio.h>
00034 #include <sys/types.h>
00035 #include <sys/stat.h>
00036 
00037 #include <errno.h>
00038 #if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
00039 extern int errno;
00040 #endif
00041 
00042 #ifdef STRING_WITH_STRINGS
00043 #include <string.h>
00044 #include <strings.h>
00045 #else
00046 #ifdef HAVE_STRING_H
00047 #include <string.h>
00048 #else
00049 #ifdef HAVE_STRINGS_H
00050 #include <strings.h>
00051 #else
00052 extern char *strchr ();
00053 extern char *strrchr ();
00054 #endif
00055 #endif
00056 #endif
00057 
00058 #ifdef HAVE_STDLIB_H
00059 #include <stdlib.h>
00060 #endif
00061 
00062 #ifdef TIME_WITH_SYS_TIME
00063 #include <sys/time.h>
00064 #include <time.h>
00065 #else
00066 #ifdef HAVE_SYS_TIME_H
00067 #include <sys/time.h>
00068 #else
00069 #include <time.h>
00070 #endif
00071 #endif
00072 
00073 #ifdef HAVE_UNISTD_H
00074 #include <unistd.h>
00075 #endif
00076 
00077 #ifdef USE_BINARY_FOPEN
00078 #include "fopen-bin.h"
00079 #else
00080 #include "fopen-same.h"
00081 #endif
00082 
00083 #ifdef HAVE_FCNTL_H
00084 #include <fcntl.h>
00085 #else
00086 #ifdef HAVE_SYS_FILE_H
00087 #include <sys/file.h>
00088 #endif
00089 #endif
00090 
00091 #ifndef O_RDONLY
00092 #define O_RDONLY 0
00093 #endif
00094 #ifndef O_WRONLY
00095 #define O_WRONLY 1
00096 #endif
00097 #ifndef O_RDWR
00098 #define O_RDWR 2
00099 #endif
00100 #ifndef O_ACCMODE
00101 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
00102 #endif
00103 
00104 #ifndef SEEK_SET
00105 #define SEEK_SET 0
00106 #endif
00107 #ifndef SEEK_CUR
00108 #define SEEK_CUR 1
00109 #endif
00110 
00111 #include "filenames.h"
00112 
00113 #if !HAVE_DECL_FFS
00114 extern int ffs (int);
00115 #endif
00116 
00117 #if !HAVE_DECL_FREE
00118 extern void free ();
00119 #endif
00120 
00121 #if !HAVE_DECL_GETENV
00122 extern char *getenv ();
00123 #endif
00124 
00125 #if !HAVE_DECL_MALLOC
00126 extern PTR malloc ();
00127 #endif
00128 
00129 #if !HAVE_DECL_REALLOC
00130 extern PTR realloc ();
00131 #endif
00132 
00133 #if !HAVE_DECL_STPCPY
00134 extern char *stpcpy (char *__dest, const char *__src);
00135 #endif
00136 
00137 #if !HAVE_DECL_STRSTR
00138 extern char *strstr ();
00139 #endif
00140 
00141 #ifdef HAVE_FTELLO
00142 #if !HAVE_DECL_FTELLO
00143 extern off_t ftello (FILE *stream);
00144 #endif
00145 #endif
00146 
00147 #ifdef HAVE_FTELLO64
00148 #if !HAVE_DECL_FTELLO64
00149 extern off64_t ftello64 (FILE *stream);
00150 #endif
00151 #endif
00152 
00153 #ifdef HAVE_FSEEKO
00154 #if !HAVE_DECL_FSEEKO
00155 extern int fseeko (FILE *stream, off_t offset, int whence);
00156 #endif
00157 #endif
00158 
00159 #ifdef HAVE_FSEEKO64
00160 #if !HAVE_DECL_FSEEKO64
00161 extern int fseeko64 (FILE *stream, off64_t offset, int whence);
00162 #endif
00163 #endif
00164 
00165 /* Define offsetof for those systems which lack it */
00166 
00167 #ifndef offsetof
00168 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00169 #endif
00170 
00171 #ifdef ENABLE_NLS
00172 #include <libintl.h>
00173 /* Note the use of dgetext() and PACKAGE here, rather than gettext().
00174 
00175    This is because the code in this directory is used to build a library which
00176    will be linked with code in other directories to form programs.  We want to
00177    maintain a seperate translation file for this directory however, rather
00178    than being forced to merge it with that of any program linked to libbfd.
00179    This is a library, so it cannot depend on the catalog currently loaded.
00180 
00181    In order to do this, we have to make sure that when we extract messages we
00182    use the OPCODES domain rather than the domain of the program that included
00183    the bfd library, (eg OBJDUMP).  Hence we use dgettext (PACKAGE, String)
00184    and define PACKAGE to be 'bfd'.  (See the code in configure).  */
00185 #define _(String) dgettext (PACKAGE, String)
00186 #ifdef gettext_noop
00187 #define N_(String) gettext_noop (String)
00188 #else
00189 #define N_(String) (String)
00190 #endif
00191 #else
00192 # define gettext(Msgid) (Msgid)
00193 # define dgettext(Domainname, Msgid) (Msgid)
00194 # define dcgettext(Domainname, Msgid, Category) (Msgid)
00195 # define textdomain(Domainname) while (0) /* nothing */
00196 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
00197 # define _(String) (String)
00198 # define N_(String) (String)
00199 #endif
00200 
00201 #endif /* ! defined (BFD_SYSDEP_H) */