Formerly arscan.c.~27~
[make.git] / make.h
blobd1a3a6990d512700bc53704d485d80c566de832d
1 /* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993
2 Free Software Foundation, Inc.
3 This file is part of GNU Make.
5 GNU Make is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 GNU Make is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNU Make; see the file COPYING. If not, write to
17 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 /* AIX requires this to be the first thing in the file. */
20 #if defined (_AIX) && !defined (__GNUC__)
21 #pragma alloca
22 #endif
24 #include "config.h"
25 #undef HAVE_CONFIG_H
26 #define HAVE_CONFIG_H
28 #ifdef CRAY
29 /* This must happen before #include <signal.h> so
30 that the declaration therein is changed. */
31 #define signal bsdsignal
32 #endif
34 #define _GNU_SOURCE
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #include <signal.h>
38 #include <stdio.h>
39 #include <ctype.h>
40 #include <time.h>
41 #include <errno.h>
43 #ifndef errno
44 extern int errno;
45 #endif
47 #ifdef HAVE_UNISTD_H
48 #include <unistd.h>
49 #ifdef _POSIX_VERSION
50 #define POSIX
51 #endif
52 #endif
54 #if !defined (HAVE_SYS_SIGLIST) && defined (HAVE__SYS_SIGLIST)
55 #define sys_siglist _sys_siglist
56 #define HAVE_SYS_SIGLIST /* Now we have it. */
58 /* It was declared in <signal.h>, with who knows what type.
59 Don't declare it again and risk conflicting. */
60 #define SYS_SIGLIST_DECLARED
61 #endif
63 #ifdef HAVE_SYS_SIGLIST
64 #ifndef SYS_SIGLIST_DECLARED
65 extern char *sys_siglist[];
66 #endif
67 #else
68 #include "signame.h"
69 #endif
71 #ifndef isblank
72 #define isblank(c) ((c) == ' ' || (c) == '\t')
73 #endif
75 #if !defined(NSIG) && defined(_NSIG)
76 #define NSIG _NSIG
77 #endif
79 #ifndef RETSIGTYPE
80 #define RETSIGTYPE void
81 #endif
83 #ifndef sigmask
84 #define sigmask(sig) (1 << ((sig) - 1))
85 #endif
87 #ifdef HAVE_LIMITS_H
88 #include <limits.h>
89 #endif
90 #ifdef HAVE_SYS_PARAM_H
91 #include <sys/param.h>
92 #endif
94 #ifndef PATH_MAX
95 #ifndef POSIX
96 #define PATH_MAX MAXPATHLEN
97 #endif /* Not POSIX. */
98 #endif /* No PATH_MAX. */
99 #ifndef MAXPATHLEN
100 #define MAXPATHLEN 1024
101 #endif /* No MAXPATHLEN. */
103 #ifdef PATH_MAX
104 #define GET_PATH_MAX PATH_MAX
105 #define PATH_VAR(var) char var[PATH_MAX]
106 #else
107 #define NEED_GET_PATH_MAX
108 extern unsigned int get_path_max ();
109 #define GET_PATH_MAX (get_path_max ())
110 #define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
111 #endif
113 #ifdef uts
114 #ifdef S_ISREG
115 #undef S_ISREG
116 #endif
117 #ifdef S_ISDIR
118 #undef S_ISDIR
119 #endif
120 #endif /* uts. */
122 #ifndef S_ISREG
123 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
124 #endif
125 #ifndef S_ISDIR
126 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
127 #endif
130 #if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
131 #include <stdlib.h>
132 #include <string.h>
133 #define ANSI_STRING
134 #else /* No standard headers. */
136 #ifdef HAVE_STRING_H
137 #include <string.h>
138 #define ANSI_STRING
139 #else
140 #include <strings.h>
141 #endif
142 #ifdef HAVE_MEMORY_H
143 #include <memory.h>
144 #endif
146 extern char *malloc (), *realloc ();
147 extern void free ();
149 extern void qsort ();
150 extern void abort (), exit ();
152 #endif /* Standard headers. */
154 #ifdef ANSI_STRING
156 #ifndef index
157 #define index(s, c) strchr((s), (c))
158 #endif
159 #ifndef rindex
160 #define rindex(s, c) strrchr((s), (c))
161 #endif
163 #ifndef bcmp
164 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
165 #endif
166 #ifndef bzero
167 #define bzero(s, n) memset ((s), 0, (n))
168 #endif
169 #ifndef bcopy
170 #define bcopy(s, d, n) memcpy ((d), (s), (n))
171 #endif
173 #else /* Not ANSI_STRING. */
175 #ifndef bcmp
176 extern int bcmp ();
177 #endif
178 #ifndef bzero
179 extern void bzero ();
180 #endif
181 #ifndef bcopy
182 extern void bcopy ();
183 #endif
185 #endif /* ANSI_STRING. */
186 #undef ANSI_STRING
189 #ifdef __GNUC__
190 #undef alloca
191 #define alloca(n) __builtin_alloca (n)
192 #else /* Not GCC. */
193 #ifdef HAVE_ALLOCA_H
194 #include <alloca.h>
195 #else /* Not HAVE_ALLOCA_H. */
196 #ifndef _AIX
197 extern char *alloca ();
198 #endif /* Not AIX. */
199 #endif /* HAVE_ALLOCA_H. */
200 #endif /* GCC. */
202 #ifndef iAPX286
203 #define streq(a, b) \
204 ((a) == (b) || \
205 (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
206 #else
207 /* Buggy compiler can't handle this. */
208 #define streq(a, b) (strcmp ((a), (b)) == 0)
209 #endif
211 /* Add to VAR the hashing value of C, one character in a name. */
212 #define HASH(var, c) \
213 ((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
215 #if defined(__GNUC__) || defined(ENUM_BITFIELDS)
216 #define ENUM_BITFIELD(bits) :bits
217 #else
218 #define ENUM_BITFIELD(bits)
219 #endif
221 extern void die ();
222 extern void message (), fatal (), error ();
223 extern void makefile_error (), makefile_fatal ();
224 extern void pfatal_with_name (), perror_with_name ();
225 extern char *savestring (), *concat ();
226 extern char *xmalloc (), *xrealloc ();
227 extern char *find_next_token (), *next_token (), *end_of_token ();
228 extern void collapse_continuations (), remove_comments ();
229 extern char *sindex (), *lindex ();
230 extern int alpha_compare ();
231 extern void print_spaces ();
232 extern struct dep *copy_dep_chain ();
233 extern char *find_percent ();
235 #ifndef NO_ARCHIVES
236 extern int ar_name ();
237 extern void ar_parse_name ();
238 extern int ar_touch ();
239 extern time_t ar_member_date ();
240 #endif
242 extern void dir_load ();
243 extern int dir_file_exists_p (), file_exists_p (), file_impossible_p ();
244 extern void file_impossible ();
245 extern char *dir_name ();
247 extern void define_default_variables ();
248 extern void set_default_suffixes (), install_default_implicit_rules ();
249 extern void convert_to_pattern (), count_implicit_rule_limits ();
250 extern void create_pattern_rule ();
252 extern void build_vpath_lists (), construct_vpath_list ();
253 extern int vpath_search ();
255 extern void construct_include_path ();
256 extern void uniquize_deps ();
258 extern int update_goal_chain ();
259 extern void notice_finished_file ();
261 extern void user_access (), make_access (), child_access ();
264 #ifdef HAVE_VFORK_H
265 #include <vfork.h>
266 #endif
268 #if !defined (__GNU_LIBRARY__) && !defined (POSIX)
270 #ifdef HAVE_SIGSETMASK
271 extern int sigsetmask ();
272 extern int sigblock ();
273 #endif
274 extern int kill ();
275 extern int atoi ();
276 extern long int atol ();
277 extern int unlink (), stat (), fstat ();
278 extern int pipe (), close (), read (), write (), open ();
279 extern long int lseek ();
281 #endif /* Not GNU C library or POSIX. */
283 #ifdef HAVE_GETCWD
284 extern char *getcwd ();
285 #else
286 extern char *getwd ();
287 #define getcwd(buf, len) getwd (buf)
288 #endif
290 #if !defined(__GNU_LIBRARY__) && (!defined(vfork) || !defined(POSIX))
291 #ifdef POSIX
292 extern pid_t vfork ();
293 #else
294 extern int vfork ();
295 #endif
296 #endif
298 extern char **environ;
300 extern char *reading_filename;
301 extern unsigned int *reading_lineno_ptr;
303 extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
304 extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
305 extern int env_overrides, no_builtin_rules_flag, print_version_flag;
306 extern int print_directory_flag;
308 extern unsigned int job_slots;
309 extern double max_load_average;
311 extern char *program;
312 extern char *starting_directory;
313 extern unsigned int makelevel;
315 extern unsigned int commands_started;
318 #define DEBUGPR(msg) \
319 do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
320 fflush (stdout); } while (0)