133965Sjdp/* sysdep.h -- handle host dependencies for the BFD library 2218822Sdim Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007 378828Sobrien Free Software Foundation, Inc. 433965Sjdp Written by Cygnus Support. 533965Sjdp 633965SjdpThis file is part of BFD, the Binary File Descriptor library. 733965Sjdp 833965SjdpThis program is free software; you can redistribute it and/or modify 933965Sjdpit under the terms of the GNU General Public License as published by 1033965Sjdpthe Free Software Foundation; either version 2 of the License, or 1133965Sjdp(at your option) any later version. 1233965Sjdp 1333965SjdpThis program is distributed in the hope that it will be useful, 1433965Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of 1533965SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1633965SjdpGNU General Public License for more details. 1733965Sjdp 1833965SjdpYou should have received a copy of the GNU General Public License 1933965Sjdpalong with this program; if not, write to the Free Software 20218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2133965Sjdp 2233965Sjdp#ifndef BFD_SYSDEP_H 2333965Sjdp#define BFD_SYSDEP_H 2433965Sjdp 25218822Sdim#include "config.h" 26218822Sdim 2733965Sjdp#include "ansidecl.h" 2833965Sjdp 2933965Sjdp#ifdef HAVE_STDDEF_H 3033965Sjdp#include <stddef.h> 3133965Sjdp#endif 3233965Sjdp 3333965Sjdp#include <stdio.h> 3433965Sjdp#include <sys/types.h> 3533965Sjdp#include <sys/stat.h> 3633965Sjdp 3733965Sjdp#include <errno.h> 3833965Sjdp#if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO)) 3933965Sjdpextern int errno; 4033965Sjdp#endif 4133965Sjdp 42218822Sdim#ifdef STRING_WITH_STRINGS 43218822Sdim#include <string.h> 44218822Sdim#include <strings.h> 45218822Sdim#else 4633965Sjdp#ifdef HAVE_STRING_H 4733965Sjdp#include <string.h> 4833965Sjdp#else 4933965Sjdp#ifdef HAVE_STRINGS_H 5033965Sjdp#include <strings.h> 5133965Sjdp#else 5233965Sjdpextern char *strchr (); 5333965Sjdpextern char *strrchr (); 5433965Sjdp#endif 5533965Sjdp#endif 56218822Sdim#endif 5733965Sjdp 5833965Sjdp#ifdef HAVE_STDLIB_H 5933965Sjdp#include <stdlib.h> 6033965Sjdp#endif 6133965Sjdp 6233965Sjdp#ifdef TIME_WITH_SYS_TIME 6333965Sjdp#include <sys/time.h> 6433965Sjdp#include <time.h> 6533965Sjdp#else 6633965Sjdp#ifdef HAVE_SYS_TIME_H 6733965Sjdp#include <sys/time.h> 6833965Sjdp#else 6933965Sjdp#include <time.h> 7033965Sjdp#endif 7133965Sjdp#endif 7233965Sjdp 7333965Sjdp#ifdef HAVE_UNISTD_H 7433965Sjdp#include <unistd.h> 7533965Sjdp#endif 7633965Sjdp 7733965Sjdp#ifdef USE_BINARY_FOPEN 7833965Sjdp#include "fopen-bin.h" 7933965Sjdp#else 8033965Sjdp#include "fopen-same.h" 8133965Sjdp#endif 8233965Sjdp 8333965Sjdp#ifdef HAVE_FCNTL_H 8433965Sjdp#include <fcntl.h> 8533965Sjdp#else 8633965Sjdp#ifdef HAVE_SYS_FILE_H 8733965Sjdp#include <sys/file.h> 8833965Sjdp#endif 8933965Sjdp#endif 9033965Sjdp 9133965Sjdp#ifndef O_RDONLY 9233965Sjdp#define O_RDONLY 0 9333965Sjdp#endif 9433965Sjdp#ifndef O_WRONLY 9533965Sjdp#define O_WRONLY 1 9633965Sjdp#endif 9733965Sjdp#ifndef O_RDWR 9833965Sjdp#define O_RDWR 2 9933965Sjdp#endif 10033965Sjdp#ifndef O_ACCMODE 10133965Sjdp#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) 10233965Sjdp#endif 10333965Sjdp 10433965Sjdp#ifndef SEEK_SET 10533965Sjdp#define SEEK_SET 0 10633965Sjdp#endif 10733965Sjdp#ifndef SEEK_CUR 10833965Sjdp#define SEEK_CUR 1 10933965Sjdp#endif 11033965Sjdp 11161843Sobrien#include "filenames.h" 11261843Sobrien 113218822Sdim#if !HAVE_DECL_FFS 114218822Sdimextern int ffs (int); 11533965Sjdp#endif 11633965Sjdp 117218822Sdim#if !HAVE_DECL_FREE 118218822Sdimextern void free (); 119218822Sdim#endif 120218822Sdim 121218822Sdim#if !HAVE_DECL_GETENV 122218822Sdimextern char *getenv (); 123218822Sdim#endif 124218822Sdim 125218822Sdim#if !HAVE_DECL_MALLOC 12633965Sjdpextern PTR malloc (); 12733965Sjdp#endif 12833965Sjdp 129218822Sdim#if !HAVE_DECL_REALLOC 13033965Sjdpextern PTR realloc (); 13133965Sjdp#endif 13233965Sjdp 133218822Sdim#if !HAVE_DECL_STPCPY 134218822Sdimextern char *stpcpy (char *__dest, const char *__src); 13533965Sjdp#endif 13633965Sjdp 137218822Sdim#if !HAVE_DECL_STRSTR 138218822Sdimextern char *strstr (); 13933965Sjdp#endif 14033965Sjdp 141218822Sdim#ifdef HAVE_FTELLO 142218822Sdim#if !HAVE_DECL_FTELLO 143218822Sdimextern off_t ftello (FILE *stream); 144218822Sdim#endif 145218822Sdim#endif 146218822Sdim 147218822Sdim#ifdef HAVE_FTELLO64 148218822Sdim#if !HAVE_DECL_FTELLO64 149218822Sdimextern off64_t ftello64 (FILE *stream); 150218822Sdim#endif 151218822Sdim#endif 152218822Sdim 153218822Sdim#ifdef HAVE_FSEEKO 154218822Sdim#if !HAVE_DECL_FSEEKO 155218822Sdimextern int fseeko (FILE *stream, off_t offset, int whence); 156218822Sdim#endif 157218822Sdim#endif 158218822Sdim 159218822Sdim#ifdef HAVE_FSEEKO64 160218822Sdim#if !HAVE_DECL_FSEEKO64 161218822Sdimextern int fseeko64 (FILE *stream, off64_t offset, int whence); 162218822Sdim#endif 163218822Sdim#endif 164218822Sdim 16589857Sobrien/* Define offsetof for those systems which lack it */ 16689857Sobrien 16789857Sobrien#ifndef offsetof 16889857Sobrien#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 16989857Sobrien#endif 17089857Sobrien 17160484Sobrien#ifdef ENABLE_NLS 17260484Sobrien#include <libintl.h> 17377298Sobrien/* Note the use of dgetext() and PACKAGE here, rather than gettext(). 17477298Sobrien 17577298Sobrien This is because the code in this directory is used to build a library which 17677298Sobrien will be linked with code in other directories to form programs. We want to 17777298Sobrien maintain a seperate translation file for this directory however, rather 17877298Sobrien than being forced to merge it with that of any program linked to libbfd. 17977298Sobrien This is a library, so it cannot depend on the catalog currently loaded. 18077298Sobrien 18177298Sobrien In order to do this, we have to make sure that when we extract messages we 18277298Sobrien use the OPCODES domain rather than the domain of the program that included 18377298Sobrien the bfd library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String) 18477298Sobrien and define PACKAGE to be 'bfd'. (See the code in configure). */ 18560484Sobrien#define _(String) dgettext (PACKAGE, String) 18660484Sobrien#ifdef gettext_noop 18760484Sobrien#define N_(String) gettext_noop (String) 18860484Sobrien#else 18960484Sobrien#define N_(String) (String) 19060484Sobrien#endif 19160484Sobrien#else 19261843Sobrien# define gettext(Msgid) (Msgid) 19361843Sobrien# define dgettext(Domainname, Msgid) (Msgid) 19461843Sobrien# define dcgettext(Domainname, Msgid, Category) (Msgid) 19561843Sobrien# define textdomain(Domainname) while (0) /* nothing */ 19661843Sobrien# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ 19761843Sobrien# define _(String) (String) 19861843Sobrien# define N_(String) (String) 19960484Sobrien#endif 20060484Sobrien 20133965Sjdp#endif /* ! defined (BFD_SYSDEP_H) */ 202