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 | ||
df7b86aa NC |
25 | #ifdef PACKAGE |
26 | #error sysdep.h must be included in lieu of config.h | |
27 | #endif | |
28 | ||
252b5132 RH |
29 | #include "config.h" |
30 | ||
31 | #include <stdio.h> | |
32 | #include <sys/types.h> | |
33 | #include <sys/stat.h> | |
5d3236ee | 34 | #include <stdarg.h> |
252b5132 | 35 | |
208a4923 NC |
36 | #ifdef STRING_WITH_STRINGS |
37 | #include <string.h> | |
38 | #include <strings.h> | |
39 | #else | |
252b5132 RH |
40 | #ifdef HAVE_STRING_H |
41 | #include <string.h> | |
42 | #else | |
43 | #ifdef HAVE_STRINGS_H | |
44 | #include <strings.h> | |
45 | #else | |
46 | extern char *strchr (); | |
47 | extern char *strrchr (); | |
48 | #endif | |
49 | #endif | |
208a4923 | 50 | #endif |
252b5132 RH |
51 | |
52 | #ifdef HAVE_STDLIB_H | |
53 | #include <stdlib.h> | |
54 | #endif | |
55 | ||
56 | #ifdef HAVE_UNISTD_H | |
57 | #include <unistd.h> | |
58 | #endif | |
59 | ||
939ba9d0 NC |
60 | /* for PATH_MAX */ |
61 | #ifdef HAVE_LIMITS_H | |
62 | #include <limits.h> | |
63 | #endif | |
64 | /* for MAXPATHLEN */ | |
65 | #ifdef HAVE_SYS_PARAM_H | |
66 | #include <sys/param.h> | |
67 | #endif | |
68 | #ifdef PATH_MAX | |
69 | # define LD_PATHMAX PATH_MAX | |
70 | #else | |
71 | # ifdef MAXPATHLEN | |
72 | # define LD_PATHMAX MAXPATHLEN | |
73 | # else | |
74 | # define LD_PATHMAX 1024 | |
75 | # endif | |
76 | #endif | |
77 | ||
78 | #ifdef HAVE_REALPATH | |
79 | # define REALPATH(a,b) realpath (a, b) | |
80 | #else | |
81 | # define REALPATH(a,b) NULL | |
82 | #endif | |
83 | ||
5d3236ee DK |
84 | #ifdef HAVE_UNISTD_H |
85 | #include <unistd.h> | |
86 | #endif | |
87 | ||
252b5132 RH |
88 | #ifdef USE_BINARY_FOPEN |
89 | #include "fopen-bin.h" | |
90 | #else | |
91 | #include "fopen-same.h" | |
92 | #endif | |
93 | ||
5d3236ee DK |
94 | #ifdef HAVE_FCNTL_H |
95 | #include <fcntl.h> | |
96 | #else | |
97 | #ifdef HAVE_SYS_FILE_H | |
98 | #include <sys/file.h> | |
99 | #endif | |
100 | #endif | |
101 | ||
3917d5d5 | 102 | #ifdef HAVE_DLFCN_H |
5d3236ee DK |
103 | #include <dlfcn.h> |
104 | #endif | |
105 | ||
106 | #ifndef O_RDONLY | |
107 | #define O_RDONLY 0 | |
108 | #endif | |
109 | #ifndef O_WRONLY | |
110 | #define O_WRONLY 1 | |
111 | #endif | |
112 | #ifndef O_RDWR | |
113 | #define O_RDWR 2 | |
114 | #endif | |
115 | #ifndef O_ACCMODE | |
116 | #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) | |
117 | #endif | |
118 | /* Systems that don't already define this, don't need it. */ | |
119 | #ifndef O_BINARY | |
120 | #define O_BINARY 0 | |
121 | #endif | |
122 | ||
123 | #ifndef SEEK_SET | |
124 | #define SEEK_SET 0 | |
125 | #endif | |
126 | #ifndef SEEK_CUR | |
127 | #define SEEK_CUR 1 | |
128 | #endif | |
129 | #ifndef SEEK_END | |
130 | #define SEEK_END 2 | |
131 | #endif | |
132 | ||
502bdb00 | 133 | #if !HAVE_DECL_STRSTR |
252b5132 RH |
134 | extern char *strstr (); |
135 | #endif | |
136 | ||
502bdb00 | 137 | #if !HAVE_DECL_FREE |
252b5132 RH |
138 | extern void free (); |
139 | #endif | |
140 | ||
502bdb00 | 141 | #if !HAVE_DECL_GETENV |
252b5132 RH |
142 | extern char *getenv (); |
143 | #endif | |
144 | ||
502bdb00 | 145 | #if !HAVE_DECL_ENVIRON |
252b5132 RH |
146 | extern char **environ; |
147 | #endif | |
148 | ||
149 | #endif /* ! defined (LD_SYSDEP_H) */ |