133965Sjdp/* sysdep.h -- handle host dependencies for the GNU linker
2130561Sobrien   Copyright 1995, 1996, 1997, 1999, 2002, 2003
3130561Sobrien   Free Software Foundation, Inc.
433965Sjdp
533965Sjdp   This file is part of GLD, the Gnu Linker.
633965Sjdp
733965Sjdp   GLD is free software; you can redistribute it and/or modify
833965Sjdp   it under the terms of the GNU General Public License as published by
933965Sjdp   the Free Software Foundation; either version 2, or (at your option)
1033965Sjdp   any later version.
1133965Sjdp
1233965Sjdp   GLD is distributed in the hope that it will be useful,
1333965Sjdp   but WITHOUT ANY WARRANTY; without even the implied warranty of
1433965Sjdp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1533965Sjdp   GNU General Public License for more details.
1633965Sjdp
1733965Sjdp   You should have received a copy of the GNU General Public License
1833965Sjdp   along with GLD; see the file COPYING.  If not, write to the Free
19218822Sdim   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20218822Sdim   02110-1301, USA.  */
2133965Sjdp
2233965Sjdp#ifndef LD_SYSDEP_H
2333965Sjdp#define LD_SYSDEP_H
2433965Sjdp
2533965Sjdp#include "config.h"
2633965Sjdp
2733965Sjdp#include <stdio.h>
2833965Sjdp#include <sys/types.h>
2933965Sjdp#include <sys/stat.h>
3033965Sjdp
3133965Sjdp#ifdef HAVE_STRING_H
3233965Sjdp#include <string.h>
3333965Sjdp#else
3433965Sjdp#ifdef HAVE_STRINGS_H
3533965Sjdp#include <strings.h>
3633965Sjdp#else
3733965Sjdpextern char *strchr ();
3833965Sjdpextern char *strrchr ();
3933965Sjdp#endif
4033965Sjdp#endif
4133965Sjdp
4233965Sjdp#ifdef HAVE_STDLIB_H
4333965Sjdp#include <stdlib.h>
4433965Sjdp#endif
4533965Sjdp
4633965Sjdp#ifdef HAVE_UNISTD_H
4733965Sjdp#include <unistd.h>
4833965Sjdp#endif
4933965Sjdp
50130561Sobrien/* for PATH_MAX */
51130561Sobrien#ifdef HAVE_LIMITS_H
52130561Sobrien#include <limits.h>
53130561Sobrien#endif
54130561Sobrien/* for MAXPATHLEN */
55130561Sobrien#ifdef HAVE_SYS_PARAM_H
56130561Sobrien#include <sys/param.h>
57223262Sbenl#ifndef __PAST_END
58223262Sbenl# define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset])
59130561Sobrien#endif
60223262Sbenl#endif
61130561Sobrien#ifdef PATH_MAX
62130561Sobrien# define LD_PATHMAX PATH_MAX
63130561Sobrien#else
64130561Sobrien# ifdef MAXPATHLEN
65130561Sobrien#  define LD_PATHMAX MAXPATHLEN
66130561Sobrien# else
67130561Sobrien#  define LD_PATHMAX 1024
68130561Sobrien# endif
69130561Sobrien#endif
70130561Sobrien
71130561Sobrien#ifdef HAVE_REALPATH
72130561Sobrien# define REALPATH(a,b) realpath (a, b)
73130561Sobrien#else
74130561Sobrien# define REALPATH(a,b) NULL
75130561Sobrien#endif
76130561Sobrien
7733965Sjdp#ifdef USE_BINARY_FOPEN
7833965Sjdp#include "fopen-bin.h"
7933965Sjdp#else
8033965Sjdp#include "fopen-same.h"
8133965Sjdp#endif
8233965Sjdp
83218822Sdim#if !HAVE_DECL_STRSTR
8433965Sjdpextern char *strstr ();
8533965Sjdp#endif
8633965Sjdp
87218822Sdim#if !HAVE_DECL_FREE
8833965Sjdpextern void free ();
8933965Sjdp#endif
9033965Sjdp
91218822Sdim#if !HAVE_DECL_GETENV
9233965Sjdpextern char *getenv ();
9333965Sjdp#endif
9433965Sjdp
95218822Sdim#if !HAVE_DECL_ENVIRON
9660484Sobrienextern char **environ;
9760484Sobrien#endif
9860484Sobrien
9933965Sjdp#endif /* ! defined (LD_SYSDEP_H) */
100