Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* sysdep.h -- handle host dependencies for the GNU linker |
208a4923 | 2 | Copyright 1995, 1996, 1997, 1999, 2002, 2003, 2005, 2007, 2012 |
1579bae1 | 3 | Free Software Foundation, Inc. |
252b5132 | 4 | |
f96b4a7b | 5 | This file is part of the GNU Binutils. |
252b5132 | 6 | |
f96b4a7b | 7 | This program is free software; you can redistribute it and/or modify |
252b5132 | 8 | it under the terms of the GNU General Public License as published by |
f96b4a7b NC |
9 | the Free Software Foundation; either version 3 of the License, or |
10 | (at your option) any later version. | |
252b5132 | 11 | |
f96b4a7b | 12 | This program is distributed in the hope that it will be useful, |
252b5132 RH |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
f96b4a7b NC |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
20 | MA 02110-1301, USA. */ | |
252b5132 RH |
21 | |
22 | #ifndef LD_SYSDEP_H | |
23 | #define LD_SYSDEP_H | |
24 | ||
252b5132 RH |
25 | #include "config.h" |
26 | ||
27 | #include <stdio.h> | |
28 | #include <sys/types.h> | |
29 | #include <sys/stat.h> | |
5d3236ee | 30 | #include <stdarg.h> |
252b5132 | 31 | |
208a4923 NC |
32 | #ifdef STRING_WITH_STRINGS |
33 | #include <string.h> | |
34 | #include <strings.h> | |
35 | #else | |
252b5132 RH |
36 | #ifdef HAVE_STRING_H |
37 | #include <string.h> | |
38 | #else | |
39 | #ifdef HAVE_STRINGS_H | |
40 | #include <strings.h> | |
41 | #else | |
42 | extern char *strchr (); | |
43 | extern char *strrchr (); | |
44 | #endif | |
45 | #endif | |
208a4923 | 46 | #endif |
252b5132 RH |
47 | |
48 | #ifdef HAVE_STDLIB_H | |
49 | #include <stdlib.h> | |
50 | #endif | |
51 | ||
52 | #ifdef HAVE_UNISTD_H | |
53 | #include <unistd.h> | |
54 | #endif | |
55 | ||
939ba9d0 NC |
56 | /* for PATH_MAX */ |
57 | #ifdef HAVE_LIMITS_H | |
58 | #include <limits.h> | |
59 | #endif | |
60 | /* for MAXPATHLEN */ | |
61 | #ifdef HAVE_SYS_PARAM_H | |
62 | #include <sys/param.h> | |
63 | #endif | |
64 | #ifdef PATH_MAX | |
65 | # define LD_PATHMAX PATH_MAX | |
66 | #else | |
67 | # ifdef MAXPATHLEN | |
68 | # define LD_PATHMAX MAXPATHLEN | |
69 | # else | |
70 | # define LD_PATHMAX 1024 | |
71 | # endif | |
72 | #endif | |
73 | ||
74 | #ifdef HAVE_REALPATH | |
75 | # define REALPATH(a,b) realpath (a, b) | |
76 | #else | |
77 | # define REALPATH(a,b) NULL | |
78 | #endif | |
79 | ||
5d3236ee DK |
80 | #ifdef HAVE_UNISTD_H |
81 | #include <unistd.h> | |
82 | #endif | |
83 | ||
252b5132 RH |
84 | #ifdef USE_BINARY_FOPEN |
85 | #include "fopen-bin.h" | |
86 | #else | |
87 | #include "fopen-same.h" | |
88 | #endif | |
89 | ||
5d3236ee DK |
90 | #ifdef HAVE_FCNTL_H |
91 | #include <fcntl.h> | |
92 | #else | |
93 | #ifdef HAVE_SYS_FILE_H | |
94 | #include <sys/file.h> | |
95 | #endif | |
96 | #endif | |
97 | ||
3917d5d5 | 98 | #ifdef HAVE_DLFCN_H |
5d3236ee DK |
99 | #include <dlfcn.h> |
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 | /* Systems that don't already define this, don't need it. */ | |
115 | #ifndef O_BINARY | |
116 | #define O_BINARY 0 | |
117 | #endif | |
118 | ||
119 | #ifndef SEEK_SET | |
120 | #define SEEK_SET 0 | |
121 | #endif | |
122 | #ifndef SEEK_CUR | |
123 | #define SEEK_CUR 1 | |
124 | #endif | |
125 | #ifndef SEEK_END | |
126 | #define SEEK_END 2 | |
127 | #endif | |
128 | ||
502bdb00 | 129 | #if !HAVE_DECL_STRSTR |
252b5132 RH |
130 | extern char *strstr (); |
131 | #endif | |
132 | ||
502bdb00 | 133 | #if !HAVE_DECL_FREE |
252b5132 RH |
134 | extern void free (); |
135 | #endif | |
136 | ||
502bdb00 | 137 | #if !HAVE_DECL_GETENV |
252b5132 RH |
138 | extern char *getenv (); |
139 | #endif | |
140 | ||
502bdb00 | 141 | #if !HAVE_DECL_ENVIRON |
252b5132 RH |
142 | extern char **environ; |
143 | #endif | |
144 | ||
145 | #endif /* ! defined (LD_SYSDEP_H) */ |