1994-03-23 14:53:21 +00:00
|
|
|
|
/* Miscellaneous global declarations and portability cruft for GNU Make.
|
1997-08-27 20:30:54 +00:00
|
|
|
|
Copyright (C) 1988,89,90,91,92,93,94,95,96,97 Free Software Foundation, Inc.
|
1992-01-20 19:14:46 +00:00
|
|
|
|
This file is part of GNU Make.
|
|
|
|
|
|
|
|
|
|
GNU Make is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GNU Make is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GNU Make; see the file COPYING. If not, write to
|
1999-03-05 05:55:11 +00:00
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1992-07-26 22:30:45 +00:00
|
|
|
|
/* AIX requires this to be the first thing in the file. */
|
|
|
|
|
#if defined (_AIX) && !defined (__GNUC__)
|
|
|
|
|
#pragma alloca
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-08-12 21:19:12 +00:00
|
|
|
|
/* We use <config.h> instead of "config.h" so that a compilation
|
|
|
|
|
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
|
|
|
|
|
(which it would do because make.h was found in $srcdir). */
|
|
|
|
|
#include <config.h>
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#undef HAVE_CONFIG_H
|
|
|
|
|
#define HAVE_CONFIG_H 1
|
1992-12-20 22:57:06 +00:00
|
|
|
|
|
1996-03-20 14:57:41 +00:00
|
|
|
|
|
|
|
|
|
/* Use prototypes if available. */
|
|
|
|
|
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# undef PARAMS
|
|
|
|
|
# define PARAMS(protos) protos
|
1996-03-20 14:57:41 +00:00
|
|
|
|
#else /* Not C++ or ANSI C. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# undef PARAMS
|
|
|
|
|
# define PARAMS(protos) ()
|
1996-03-20 14:57:41 +00:00
|
|
|
|
#endif /* C++ or ANSI C. */
|
|
|
|
|
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef CRAY
|
1992-09-02 21:53:59 +00:00
|
|
|
|
/* This must happen before #include <signal.h> so
|
|
|
|
|
that the declaration therein is changed. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define signal bsdsignal
|
1992-09-02 21:53:59 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#define _GNU_SOURCE 1
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <ctype.h>
|
1993-10-28 00:09:14 +00:00
|
|
|
|
#ifdef HAVE_SYS_TIMEB_H
|
1993-10-14 19:08:38 +00:00
|
|
|
|
/* SCO 3.2 "devsys 4.2" has a prototype for `ftime' in <time.h> that bombs
|
|
|
|
|
unless <sys/timeb.h> has been included first. Does every system have a
|
|
|
|
|
<sys/timeb.h>? If any does not, configure should check for it. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# include <sys/timeb.h>
|
1993-10-28 00:09:14 +00:00
|
|
|
|
#endif
|
1992-06-11 05:30:34 +00:00
|
|
|
|
#include <time.h>
|
1992-07-01 00:52:39 +00:00
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef errno
|
1992-07-01 00:52:39 +00:00
|
|
|
|
extern int errno;
|
|
|
|
|
#endif
|
1992-06-11 05:30:34 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef isblank
|
|
|
|
|
# define isblank(c) ((c) == ' ' || (c) == '\t')
|
1993-04-14 17:34:15 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
# include <unistd.h>
|
1994-05-21 20:27:18 +00:00
|
|
|
|
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
|
|
|
|
|
POSIX.1 behavior with `cc -YPOSIX', which predefines POSIX itself! */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS)
|
|
|
|
|
# define POSIX 1
|
|
|
|
|
# endif
|
1992-06-11 05:30:34 +00:00
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1993-07-08 23:51:22 +00:00
|
|
|
|
/* Some systems define _POSIX_VERSION but are not really POSIX.1. */
|
1996-03-20 14:57:41 +00:00
|
|
|
|
#if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386)))
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# undef POSIX
|
1993-05-14 20:40:38 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1993-09-17 04:49:17 +00:00
|
|
|
|
#if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define POSIX 1
|
1993-09-17 04:49:17 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-07-30 20:54:47 +00:00
|
|
|
|
#if defined (HAVE_SYS_SIGLIST) && !defined (SYS_SIGLIST_DECLARED)
|
1992-11-23 20:41:02 +00:00
|
|
|
|
extern char *sys_siglist[];
|
|
|
|
|
#endif
|
1998-07-30 20:54:47 +00:00
|
|
|
|
|
|
|
|
|
#if !defined (HAVE_SYS_SIGLIST) || !defined (HAVE_STRSIGNAL)
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# include "signame.h"
|
1992-11-23 20:41:02 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1993-04-14 17:34:15 +00:00
|
|
|
|
/* Some systems do not define NSIG in <signal.h>. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef NSIG
|
|
|
|
|
# ifdef _NSIG
|
|
|
|
|
# define NSIG _NSIG
|
|
|
|
|
# else
|
|
|
|
|
# define NSIG 32
|
|
|
|
|
# endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef RETSIGTYPE
|
|
|
|
|
# define RETSIGTYPE void
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef sigmask
|
|
|
|
|
# define sigmask(sig) (1 << ((sig) - 1))
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef HAVE_LIMITS_H
|
|
|
|
|
# include <limits.h>
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
|
# include <sys/param.h>
|
1992-06-11 05:30:34 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef PATH_MAX
|
|
|
|
|
# ifndef POSIX
|
|
|
|
|
# define PATH_MAX MAXPATHLEN
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#ifndef MAXPATHLEN
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define MAXPATHLEN 1024
|
|
|
|
|
#endif
|
1992-06-11 05:30:34 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef PATH_MAX
|
|
|
|
|
# define GET_PATH_MAX PATH_MAX
|
|
|
|
|
# define PATH_VAR(var) char var[PATH_MAX]
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#else
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define NEED_GET_PATH_MAX 1
|
|
|
|
|
# define GET_PATH_MAX (get_path_max ())
|
|
|
|
|
# define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
|
1996-03-20 14:57:41 +00:00
|
|
|
|
extern unsigned int get_path_max PARAMS ((void));
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1997-04-07 07:21:16 +00:00
|
|
|
|
#ifndef CHAR_BIT
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define CHAR_BIT 8
|
1997-04-07 07:21:16 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Nonzero if the integer type T is signed. */
|
|
|
|
|
#define INTEGER_TYPE_SIGNED(t) ((t) -1 < 0)
|
|
|
|
|
|
|
|
|
|
/* The minimum and maximum values for the integer type T.
|
|
|
|
|
Use ~ (t) 0, not -1, for portability to 1's complement hosts. */
|
|
|
|
|
#define INTEGER_TYPE_MINIMUM(t) \
|
|
|
|
|
(! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))
|
|
|
|
|
#define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t))
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef STAT_MACROS_BROKEN
|
|
|
|
|
# ifdef S_ISREG
|
|
|
|
|
# undef S_ISREG
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef S_ISDIR
|
|
|
|
|
# undef S_ISDIR
|
|
|
|
|
# endif
|
|
|
|
|
#endif /* STAT_MACROS_BROKEN. */
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef S_ISREG
|
|
|
|
|
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef S_ISDIR
|
|
|
|
|
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1996-03-20 14:57:41 +00:00
|
|
|
|
#ifdef VMS
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# include <stdio.h>
|
|
|
|
|
# include <types.h>
|
|
|
|
|
# include <unixlib.h>
|
|
|
|
|
# include <unixio.h>
|
|
|
|
|
# include <errno.h>
|
|
|
|
|
# include <perror.h>
|
1996-03-20 14:57:41 +00:00
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef __attribute__
|
|
|
|
|
/* This feature is available in gcc versions 2.5 and later. */
|
|
|
|
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
|
|
|
|
# define __attribute__(x)
|
|
|
|
|
# endif
|
|
|
|
|
/* The __-protected variants of `format' and `printf' attributes
|
|
|
|
|
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
|
|
|
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
|
|
|
|
# define __format__ format
|
|
|
|
|
# define __printf__ printf
|
|
|
|
|
# endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)
|
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
# include <string.h>
|
|
|
|
|
# define ANSI_STRING 1
|
|
|
|
|
#else /* No standard headers. */
|
|
|
|
|
# ifdef HAVE_STRING_H
|
|
|
|
|
# include <string.h>
|
|
|
|
|
# define ANSI_STRING 1
|
|
|
|
|
# else
|
|
|
|
|
# include <strings.h>
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef HAVE_MEMORY_H
|
|
|
|
|
# include <memory.h>
|
|
|
|
|
# endif
|
|
|
|
|
# ifdef HAVE_STDLIB_H
|
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
# else
|
1996-03-20 14:57:41 +00:00
|
|
|
|
extern char *malloc PARAMS ((int));
|
|
|
|
|
extern char *realloc PARAMS ((char *, int));
|
|
|
|
|
extern void free PARAMS ((char *));
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
extern void abort PARAMS ((void)) __attribute__ ((noreturn));
|
|
|
|
|
extern void exit PARAMS ((int)) __attribute__ ((noreturn));
|
|
|
|
|
# endif /* HAVE_STDLIB_H. */
|
1992-07-26 22:30:45 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#endif /* Standard headers. */
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#if ST_MTIM_NSEC
|
|
|
|
|
# if HAVE_INTTYPES_H
|
|
|
|
|
# include <inttypes.h>
|
|
|
|
|
# endif
|
|
|
|
|
# define FILE_TIMESTAMP uintmax_t
|
|
|
|
|
#else
|
|
|
|
|
# define FILE_TIMESTAMP time_t
|
1992-07-26 22:30:45 +00:00
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef ANSI_STRING
|
1993-04-12 20:51:32 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# ifndef index
|
|
|
|
|
# define index(s, c) strchr((s), (c))
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef rindex
|
|
|
|
|
# define rindex(s, c) strrchr((s), (c))
|
|
|
|
|
# endif
|
1993-04-12 20:51:32 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# ifndef bcmp
|
|
|
|
|
# define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef bzero
|
|
|
|
|
# define bzero(s, n) memset ((s), 0, (n))
|
|
|
|
|
# endif
|
|
|
|
|
# if defined(HAVE_MEMMOVE) && !defined(bcopy)
|
|
|
|
|
# define bcopy(s, d, n) memmove ((d), (s), (n))
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
#else /* Not ANSI_STRING. */
|
|
|
|
|
|
|
|
|
|
# ifndef bcmp
|
|
|
|
|
extern int bcmp PARAMS ((const char *, const char *, int));
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef bzero
|
|
|
|
|
extern void bzero PARAMS ((char *, int));
|
1993-04-12 20:51:32 +00:00
|
|
|
|
#endif
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# ifndef bcopy
|
|
|
|
|
extern void bcopy PARAMS ((const char *b1, char *b2, int));
|
|
|
|
|
# endif
|
1993-04-12 20:51:32 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#endif /* ANSI_STRING. */
|
|
|
|
|
#undef ANSI_STRING
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1994-02-04 21:28:53 +00:00
|
|
|
|
/* SCO Xenix has a buggy macro definition in <string.h>. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#undef strerror
|
1994-02-04 21:28:53 +00:00
|
|
|
|
|
1996-03-20 14:57:41 +00:00
|
|
|
|
#if !defined(ANSI_STRING) && !defined(__DECC)
|
|
|
|
|
extern char *strerror PARAMS ((int errnum));
|
1994-02-04 21:28:53 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef __GNUC__
|
|
|
|
|
# undef alloca
|
|
|
|
|
# define alloca(n) __builtin_alloca (n)
|
|
|
|
|
#else /* Not GCC. */
|
|
|
|
|
# ifdef HAVE_ALLOCA_H
|
|
|
|
|
# include <alloca.h>
|
|
|
|
|
# else /* Not HAVE_ALLOCA_H. */
|
|
|
|
|
# ifndef _AIX
|
1992-01-20 19:14:46 +00:00
|
|
|
|
extern char *alloca ();
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# endif /* Not AIX. */
|
|
|
|
|
# endif /* HAVE_ALLOCA_H. */
|
|
|
|
|
#endif /* GCC. */
|
|
|
|
|
|
|
|
|
|
#ifndef iAPX286
|
|
|
|
|
# define streq(a, b) \
|
|
|
|
|
((a) == (b) || \
|
|
|
|
|
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
|
|
|
|
|
# ifdef HAVE_CASE_INSENSITIVE_FS
|
|
|
|
|
# define strieq(a, b) \
|
|
|
|
|
((a) == (b) || \
|
|
|
|
|
(tolower(*(a)) == tolower(*(b)) && (*(a) == '\0' || !strcmpi ((a) + 1, (b) + 1))))
|
|
|
|
|
# else
|
|
|
|
|
# define strieq(a, b) \
|
|
|
|
|
((a) == (b) || \
|
|
|
|
|
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
|
|
|
|
|
# endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#else
|
|
|
|
|
/* Buggy compiler can't handle this. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define streq(a, b) (strcmp ((a), (b)) == 0)
|
|
|
|
|
# define strieq(a, b) (strcmp ((a), (b)) == 0)
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-03-19 04:27:56 +00:00
|
|
|
|
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
|
|
|
|
|
|
1992-01-20 19:14:46 +00:00
|
|
|
|
/* Add to VAR the hashing value of C, one character in a name. */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#define HASH(var, c) \
|
1992-01-20 19:14:46 +00:00
|
|
|
|
((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
|
1998-07-30 20:54:47 +00:00
|
|
|
|
#ifdef HAVE_CASE_INSENSITIVE_FS /* Fold filenames */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define HASHI(var, c) \
|
|
|
|
|
((var += tolower((c))), (var = ((var) << 7) + ((var) >> 20)))
|
1996-05-13 18:38:38 +00:00
|
|
|
|
#else
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define HASHI(var, c) HASH(var,c)
|
1996-05-13 18:38:38 +00:00
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
|
|
|
|
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define ENUM_BITFIELD(bits) :bits
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#else
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define ENUM_BITFIELD(bits)
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1997-04-07 07:21:16 +00:00
|
|
|
|
#if defined(__MSDOS__) || defined(WINDOWS32)
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define PATH_SEPARATOR_CHAR ';'
|
1997-08-27 20:30:54 +00:00
|
|
|
|
#else
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# if defined(VMS)
|
|
|
|
|
# define PATH_SEPARATOR_CHAR ','
|
|
|
|
|
# else
|
|
|
|
|
# define PATH_SEPARATOR_CHAR ':'
|
|
|
|
|
# endif
|
1997-08-27 20:30:54 +00:00
|
|
|
|
#endif
|
1996-05-22 21:51:45 +00:00
|
|
|
|
|
1997-04-07 07:21:16 +00:00
|
|
|
|
#ifdef WINDOWS32
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# include <fcntl.h>
|
|
|
|
|
# include <malloc.h>
|
|
|
|
|
# define pipe(p) _pipe(p, 512, O_BINARY)
|
|
|
|
|
# define kill(pid,sig) w32_kill(pid,sig)
|
1996-05-22 21:51:45 +00:00
|
|
|
|
|
|
|
|
|
extern void sync_Path_environment(void);
|
|
|
|
|
extern int kill(int pid, int sig);
|
|
|
|
|
extern int safe_stat(char *file, struct stat *sb);
|
1998-10-03 05:39:55 +00:00
|
|
|
|
extern char *end_of_token_w32(char *s, char stopchar);
|
1998-07-30 20:54:47 +00:00
|
|
|
|
extern int find_and_set_default_shell(char *token);
|
|
|
|
|
|
|
|
|
|
/* indicates whether or not we have Bourne shell */
|
|
|
|
|
extern int no_default_sh_exe;
|
|
|
|
|
|
|
|
|
|
/* is default_shell unixy? */
|
|
|
|
|
extern int unixy_shell;
|
|
|
|
|
#endif /* WINDOWS32 */
|
1998-10-03 05:39:55 +00:00
|
|
|
|
|
|
|
|
|
struct floc
|
|
|
|
|
{
|
|
|
|
|
char *filenm;
|
|
|
|
|
unsigned long lineno;
|
|
|
|
|
};
|
|
|
|
|
#define NILF ((struct floc *)0)
|
|
|
|
|
|
1994-07-25 23:27:48 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
/* Fancy processing for variadic functions in both ANSI and pre-ANSI
|
|
|
|
|
compilers. */
|
|
|
|
|
#if defined __STDC__ && __STDC__
|
|
|
|
|
extern void message (int prefix, const char *fmt, ...)
|
|
|
|
|
__attribute__ ((__format__ (__printf__, 2, 3)));
|
|
|
|
|
extern void error (const struct floc *flocp, const char *fmt, ...)
|
|
|
|
|
__attribute__ ((__format__ (__printf__, 2, 3)));
|
|
|
|
|
extern void fatal (const struct floc *flocp, const char *fmt, ...)
|
|
|
|
|
__attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
|
|
|
|
|
#else
|
1996-03-20 14:57:41 +00:00
|
|
|
|
extern void message ();
|
|
|
|
|
extern void error ();
|
1998-10-03 05:39:55 +00:00
|
|
|
|
extern void fatal ();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
extern void die PARAMS ((int)) __attribute__ ((noreturn));
|
|
|
|
|
extern void log_working_directory PARAMS ((int));
|
|
|
|
|
extern void pfatal_with_name PARAMS ((char *)) __attribute__ ((noreturn));
|
|
|
|
|
extern void perror_with_name PARAMS ((char *, char *));
|
|
|
|
|
extern char *savestring PARAMS ((char *, unsigned int));
|
|
|
|
|
extern char *concat PARAMS ((char *, char *, char *));
|
|
|
|
|
extern char *xmalloc PARAMS ((unsigned int));
|
|
|
|
|
extern char *xrealloc PARAMS ((char *, unsigned int));
|
1999-03-05 07:13:12 +00:00
|
|
|
|
extern char *xstrdup PARAMS ((const char *));
|
1998-10-03 05:39:55 +00:00
|
|
|
|
extern char *find_next_token PARAMS ((char **, unsigned int *));
|
|
|
|
|
extern char *next_token PARAMS ((char *));
|
|
|
|
|
extern char *end_of_token PARAMS ((char *));
|
|
|
|
|
extern void collapse_continuations PARAMS ((char *));
|
|
|
|
|
extern void remove_comments PARAMS((char *));
|
|
|
|
|
extern char *sindex PARAMS ((char *, unsigned int, char *, unsigned int));
|
|
|
|
|
extern char *lindex PARAMS ((char *, char *, int));
|
|
|
|
|
extern int alpha_compare PARAMS ((const void *, const void *));
|
|
|
|
|
extern void print_spaces PARAMS ((unsigned int));
|
|
|
|
|
extern char *find_char_unquote PARAMS ((char *, char *, int));
|
|
|
|
|
extern char *find_percent PARAMS ((char *));
|
|
|
|
|
|
|
|
|
|
#ifndef NO_ARCHIVES
|
|
|
|
|
extern int ar_name PARAMS ((char *));
|
|
|
|
|
extern void ar_parse_name PARAMS ((char *, char **, char **));
|
|
|
|
|
extern int ar_touch PARAMS ((char *));
|
|
|
|
|
extern time_t ar_member_date PARAMS ((char *));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
extern int dir_file_exists_p PARAMS ((char *, char *));
|
|
|
|
|
extern int file_exists_p PARAMS ((char *));
|
|
|
|
|
extern int file_impossible_p PARAMS ((char *));
|
|
|
|
|
extern void file_impossible PARAMS ((char *));
|
|
|
|
|
extern char *dir_name PARAMS ((char *));
|
|
|
|
|
|
|
|
|
|
extern void define_default_variables PARAMS ((void));
|
|
|
|
|
extern void set_default_suffixes PARAMS ((void));
|
|
|
|
|
extern void install_default_suffix_rules PARAMS ((void));
|
|
|
|
|
extern void install_default_implicit_rules PARAMS ((void));
|
|
|
|
|
|
|
|
|
|
extern void build_vpath_lists PARAMS ((void));
|
|
|
|
|
extern void construct_vpath_list PARAMS ((char *pattern, char *dirpath));
|
|
|
|
|
extern int vpath_search PARAMS ((char **file, FILE_TIMESTAMP *mtime_ptr));
|
|
|
|
|
extern int gpath_search PARAMS ((char *file, int len));
|
|
|
|
|
|
|
|
|
|
extern void construct_include_path PARAMS ((char **arg_dirs));
|
|
|
|
|
|
|
|
|
|
extern void user_access PARAMS ((void));
|
|
|
|
|
extern void make_access PARAMS ((void));
|
|
|
|
|
extern void child_access PARAMS ((void));
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_VFORK_H
|
|
|
|
|
# include <vfork.h>
|
1992-06-11 05:30:34 +00:00
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1994-05-23 22:25:30 +00:00
|
|
|
|
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
|
1997-08-18 18:11:04 +00:00
|
|
|
|
because such systems often declare them in header files anyway. */
|
1994-05-23 22:25:30 +00:00
|
|
|
|
|
1997-04-07 07:21:16 +00:00
|
|
|
|
#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32)
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1992-06-11 05:30:34 +00:00
|
|
|
|
extern long int atol ();
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# ifndef VMS
|
1992-01-20 19:14:46 +00:00
|
|
|
|
extern long int lseek ();
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# endif
|
1993-04-12 20:51:32 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#endif /* Not GNU C library or POSIX. */
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifdef HAVE_GETCWD
|
1992-01-20 19:14:46 +00:00
|
|
|
|
extern char *getcwd ();
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# ifdef VMS
|
1996-03-20 14:57:41 +00:00
|
|
|
|
extern char *getwd PARAMS ((char *));
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
#else
|
|
|
|
|
extern char *getwd ();
|
1998-10-03 05:39:55 +00:00
|
|
|
|
# define getcwd(buf, len) getwd (buf)
|
1992-06-11 05:30:34 +00:00
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
extern const struct floc *reading_file;
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
extern char **environ;
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
|
|
|
|
extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
|
|
|
|
|
extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
|
|
|
|
|
extern int env_overrides, no_builtin_rules_flag, print_version_flag;
|
1993-06-25 19:20:49 +00:00
|
|
|
|
extern int print_directory_flag, warn_undefined_variables_flag;
|
1994-10-24 23:11:57 +00:00
|
|
|
|
extern int posix_pedantic;
|
1997-08-18 18:11:04 +00:00
|
|
|
|
extern int clock_skew_detected;
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-07-30 20:54:47 +00:00
|
|
|
|
/* can we run commands via 'sh -c xxx' or must we use batch files? */
|
|
|
|
|
extern int batch_mode_shell;
|
|
|
|
|
|
1992-01-20 19:14:46 +00:00
|
|
|
|
extern unsigned int job_slots;
|
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files.
(distfiles): Add $(amigafiles).
(amigafiles): New variable.
Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de>
* Added Amiga support in commands.c, dir.c, function.c,
job.c, main.c, make.h, read.c, remake.c
* commands.c: Amiga has neither SIGHUP nor SIGQUIT
* dir.c: Amiga has filenames with Upper- and Lowercase,
but "FileName" is the same as "filename". Added strieq()
which is use to compare filenames. This is like streq()
on all other systems. Also there is no such thing as
"." under AmigaDOS.
* function.c: On Amiga, the environment is not passed as envp,
there are no pipes and Amiga can't fork. Use my own function
to create a new child.
* job.c: default_shell is "" (The system automatically chooses
a shell for me). Have to use the same workaround as MSDOS for
running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't
known on Amiga. Cloned code to run children from MSDOS. Own
version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga.
* main.c: Force stack to 20000 bytes. Read environment from ENV:
device. On Amiga, exec_command() does return, so I exit()
afterwards.
* make.h: Added strieq() to compare filenames.
* read.c: Amiga needs special extension to have passwd. Only
one include-dir. "Makefile" and "makefile" are the same.
Added "SMakefile". Added special code to handle device names (xxx:)
and "./" in rules.
* remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib"
instead of "lib%s.a".
* main.c, rule.c, variable.c: Avoid floats at all costs.
* vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
|
|
|
|
#ifndef NO_FLOAT
|
1992-01-20 19:14:46 +00:00
|
|
|
|
extern double max_load_average;
|
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files.
(distfiles): Add $(amigafiles).
(amigafiles): New variable.
Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de>
* Added Amiga support in commands.c, dir.c, function.c,
job.c, main.c, make.h, read.c, remake.c
* commands.c: Amiga has neither SIGHUP nor SIGQUIT
* dir.c: Amiga has filenames with Upper- and Lowercase,
but "FileName" is the same as "filename". Added strieq()
which is use to compare filenames. This is like streq()
on all other systems. Also there is no such thing as
"." under AmigaDOS.
* function.c: On Amiga, the environment is not passed as envp,
there are no pipes and Amiga can't fork. Use my own function
to create a new child.
* job.c: default_shell is "" (The system automatically chooses
a shell for me). Have to use the same workaround as MSDOS for
running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't
known on Amiga. Cloned code to run children from MSDOS. Own
version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga.
* main.c: Force stack to 20000 bytes. Read environment from ENV:
device. On Amiga, exec_command() does return, so I exit()
afterwards.
* make.h: Added strieq() to compare filenames.
* read.c: Amiga needs special extension to have passwd. Only
one include-dir. "Makefile" and "makefile" are the same.
Added "SMakefile". Added special code to handle device names (xxx:)
and "./" in rules.
* remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib"
instead of "lib%s.a".
* main.c, rule.c, variable.c: Avoid floats at all costs.
* vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
|
|
|
|
#else
|
|
|
|
|
extern int max_load_average;
|
|
|
|
|
#endif
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
|
|
|
|
extern char *program;
|
1993-02-04 18:23:27 +00:00
|
|
|
|
extern char *starting_directory;
|
1992-01-20 19:14:46 +00:00
|
|
|
|
extern unsigned int makelevel;
|
1993-08-19 20:36:09 +00:00
|
|
|
|
extern char *version_string, *remote_description;
|
1993-02-04 18:23:27 +00:00
|
|
|
|
|
1993-01-25 23:30:16 +00:00
|
|
|
|
extern unsigned int commands_started;
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1993-05-06 21:30:40 +00:00
|
|
|
|
extern int handling_fatal_signal;
|
|
|
|
|
|
1992-01-20 19:14:46 +00:00
|
|
|
|
|
1998-10-03 05:39:55 +00:00
|
|
|
|
#ifndef MIN
|
|
|
|
|
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef MAX
|
|
|
|
|
#define MAX(_a,_b) ((_a)>(_b)?(_a):(_b))
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-04-14 22:37:04 +00:00
|
|
|
|
#define DEBUGPR(msg) \
|
|
|
|
|
do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
|
1998-10-03 05:39:55 +00:00
|
|
|
|
fflush (stdout); } while (0)
|
1996-03-20 14:57:41 +00:00
|
|
|
|
|
|
|
|
|
#ifdef VMS
|
|
|
|
|
# ifndef EXIT_FAILURE
|
|
|
|
|
# define EXIT_FAILURE 3
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef EXIT_SUCCESS
|
|
|
|
|
# define EXIT_SUCCESS 1
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef EXIT_TROUBLE
|
|
|
|
|
# define EXIT_TROUBLE 2
|
|
|
|
|
# endif
|
|
|
|
|
#else
|
|
|
|
|
# ifndef EXIT_FAILURE
|
|
|
|
|
# define EXIT_FAILURE 2
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef EXIT_SUCCESS
|
|
|
|
|
# define EXIT_SUCCESS 0
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef EXIT_TROUBLE
|
|
|
|
|
# define EXIT_TROUBLE 1
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|