171671b9obrien/* sysdep.h -- handle host dependencies for the BFD library
2d0f678fdim   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007
371671b9obrien   Free Software Foundation, Inc.
471671b9obrien   Written by Cygnus Support.
571671b9obrien
671671b9obrienThis file is part of BFD, the Binary File Descriptor library.
771671b9obrien
871671b9obrienThis program is free software; you can redistribute it and/or modify
971671b9obrienit under the terms of the GNU General Public License as published by
1071671b9obrienthe Free Software Foundation; either version 2 of the License, or
1171671b9obrien(at your option) any later version.
1271671b9obrien
1371671b9obrienThis program is distributed in the hope that it will be useful,
1471671b9obrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1571671b9obrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1671671b9obrienGNU General Public License for more details.
1771671b9obrien
1871671b9obrienYou should have received a copy of the GNU General Public License
1971671b9obrienalong with this program; if not, write to the Free Software
200acbbeedimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2171671b9obrien
2271671b9obrien#ifndef BFD_SYSDEP_H
2371671b9obrien#define BFD_SYSDEP_H
2471671b9obrien
2571671b9obrien#include "config.h"
2671671b9obrien
27d0f678fdim#include "ansidecl.h"
28d0f678fdim
2971671b9obrien#ifdef HAVE_STDDEF_H
3071671b9obrien#include <stddef.h>
3171671b9obrien#endif
3271671b9obrien
3371671b9obrien#include <stdio.h>
3471671b9obrien#include <sys/types.h>
3571671b9obrien#include <sys/stat.h>
3671671b9obrien
3771671b9obrien#include <errno.h>
3871671b9obrien#if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
3971671b9obrienextern int errno;
4071671b9obrien#endif
4171671b9obrien
420acbbeedim#ifdef STRING_WITH_STRINGS
430acbbeedim#include <string.h>
440acbbeedim#include <strings.h>
450acbbeedim#else
4671671b9obrien#ifdef HAVE_STRING_H
4771671b9obrien#include <string.h>
4871671b9obrien#else
4971671b9obrien#ifdef HAVE_STRINGS_H
5071671b9obrien#include <strings.h>
5171671b9obrien#else
5271671b9obrienextern char *strchr ();
5371671b9obrienextern char *strrchr ();
5471671b9obrien#endif
5571671b9obrien#endif
560acbbeedim#endif
5771671b9obrien
5871671b9obrien#ifdef HAVE_STDLIB_H
5971671b9obrien#include <stdlib.h>
6071671b9obrien#endif
6171671b9obrien
6271671b9obrien#ifdef TIME_WITH_SYS_TIME
6371671b9obrien#include <sys/time.h>
6471671b9obrien#include <time.h>
6571671b9obrien#else
6671671b9obrien#ifdef HAVE_SYS_TIME_H
6771671b9obrien#include <sys/time.h>
6871671b9obrien#else
6971671b9obrien#include <time.h>
7071671b9obrien#endif
7171671b9obrien#endif
7271671b9obrien
7371671b9obrien#ifdef HAVE_UNISTD_H
7471671b9obrien#include <unistd.h>
7571671b9obrien#endif
7671671b9obrien
7771671b9obrien#ifdef USE_BINARY_FOPEN
7871671b9obrien#include "fopen-bin.h"
7971671b9obrien#else
8071671b9obrien#include "fopen-same.h"
8171671b9obrien#endif
8271671b9obrien
8371671b9obrien#ifdef HAVE_FCNTL_H
8471671b9obrien#include <fcntl.h>
8571671b9obrien#else
8671671b9obrien#ifdef HAVE_SYS_FILE_H
8771671b9obrien#include <sys/file.h>
8871671b9obrien#endif
8971671b9obrien#endif
9071671b9obrien
9171671b9obrien#ifndef O_RDONLY
9271671b9obrien#define O_RDONLY 0
9371671b9obrien#endif
9471671b9obrien#ifndef O_WRONLY
9571671b9obrien#define O_WRONLY 1
9671671b9obrien#endif
9771671b9obrien#ifndef O_RDWR
9871671b9obrien#define O_RDWR 2
9971671b9obrien#endif
10071671b9obrien#ifndef O_ACCMODE
10171671b9obrien#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
10271671b9obrien#endif
10371671b9obrien
10471671b9obrien#ifndef SEEK_SET
10571671b9obrien#define SEEK_SET 0
10671671b9obrien#endif
10771671b9obrien#ifndef SEEK_CUR
10871671b9obrien#define SEEK_CUR 1
10971671b9obrien#endif
11071671b9obrien
11171671b9obrien#include "filenames.h"
11271671b9obrien
1130acbbeedim#if !HAVE_DECL_FFS
1140acbbeedimextern int ffs (int);
11571671b9obrien#endif
11671671b9obrien
1170acbbeedim#if !HAVE_DECL_FREE
1180acbbeedimextern void free ();
1190acbbeedim#endif
1200acbbeedim
1210acbbeedim#if !HAVE_DECL_GETENV
1220acbbeedimextern char *getenv ();
1230acbbeedim#endif
1240acbbeedim
1250acbbeedim#if !HAVE_DECL_MALLOC
12671671b9obrienextern PTR malloc ();
12771671b9obrien#endif
12871671b9obrien
1290acbbeedim#if !HAVE_DECL_REALLOC
13071671b9obrienextern PTR realloc ();
13171671b9obrien#endif
13271671b9obrien
1330acbbeedim#if !HAVE_DECL_STPCPY
1340acbbeedimextern char *stpcpy (char *__dest, const char *__src);
13571671b9obrien#endif
13671671b9obrien
1370acbbeedim#if !HAVE_DECL_STRSTR
1380acbbeedimextern char *strstr ();
1390acbbeedim#endif
1400acbbeedim
1410acbbeedim#ifdef HAVE_FTELLO
1420acbbeedim#if !HAVE_DECL_FTELLO
1430acbbeedimextern off_t ftello (FILE *stream);
1440acbbeedim#endif
1450acbbeedim#endif
1460acbbeedim
1470acbbeedim#ifdef HAVE_FTELLO64
1480acbbeedim#if !HAVE_DECL_FTELLO64
1490acbbeedimextern off64_t ftello64 (FILE *stream);
1500acbbeedim#endif
1510acbbeedim#endif
1520acbbeedim
1530acbbeedim#ifdef HAVE_FSEEKO
1540acbbeedim#if !HAVE_DECL_FSEEKO
1550acbbeedimextern int fseeko (FILE *stream, off_t offset, int whence);
1560acbbeedim#endif
1570acbbeedim#endif
1580acbbeedim
1590acbbeedim#ifdef HAVE_FSEEKO64
1600acbbeedim#if !HAVE_DECL_FSEEKO64
1610acbbeedimextern int fseeko64 (FILE *stream, off64_t offset, int whence);
1620acbbeedim#endif
16371671b9obrien#endif
16471671b9obrien
16571671b9obrien/* Define offsetof for those systems which lack it */
16671671b9obrien
16771671b9obrien#ifndef offsetof
16871671b9obrien#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
16971671b9obrien#endif
17071671b9obrien
17171671b9obrien#ifdef ENABLE_NLS
17271671b9obrien#include <libintl.h>
17371671b9obrien/* Note the use of dgetext() and PACKAGE here, rather than gettext().
17471671b9obrien
17571671b9obrien   This is because the code in this directory is used to build a library which
17671671b9obrien   will be linked with code in other directories to form programs.  We want to
17771671b9obrien   maintain a seperate translation file for this directory however, rather
17871671b9obrien   than being forced to merge it with that of any program linked to libbfd.
17971671b9obrien   This is a library, so it cannot depend on the catalog currently loaded.
18071671b9obrien
18171671b9obrien   In order to do this, we have to make sure that when we extract messages we
18271671b9obrien   use the OPCODES domain rather than the domain of the program that included
18371671b9obrien   the bfd library, (eg OBJDUMP).  Hence we use dgettext (PACKAGE, String)
18471671b9obrien   and define PACKAGE to be 'bfd'.  (See the code in configure).  */
18571671b9obrien#define _(String) dgettext (PACKAGE, String)
18671671b9obrien#ifdef gettext_noop
18771671b9obrien#define N_(String) gettext_noop (String)
18871671b9obrien#else
18971671b9obrien#define N_(String) (String)
19071671b9obrien#endif
19171671b9obrien#else
19271671b9obrien# define gettext(Msgid) (Msgid)
19371671b9obrien# define dgettext(Domainname, Msgid) (Msgid)
19471671b9obrien# define dcgettext(Domainname, Msgid, Category) (Msgid)
19571671b9obrien# define textdomain(Domainname) while (0) /* nothing */
19671671b9obrien# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
19771671b9obrien# define _(String) (String)
19871671b9obrien# define N_(String) (String)
19971671b9obrien#endif
20071671b9obrien
20171671b9obrien#endif /* ! defined (BFD_SYSDEP_H) */
202