Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx /* Miscellaneous global declarations and portability cruft for GNU Make.
     5         kx Copyright (C) 1988-2020 Free Software Foundation, Inc.
     5         kx This file is part of GNU Make.
     5         kx 
     5         kx GNU Make is free software; you can redistribute it and/or modify it under the
     5         kx terms of the GNU General Public License as published by the Free Software
     5         kx Foundation; either version 3 of the License, or (at your option) any later
     5         kx version.
     5         kx 
     5         kx GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     5         kx WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     5         kx A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     5         kx 
     5         kx You should have received a copy of the GNU General Public License along with
     5         kx this program.  If not, see <http://www.gnu.org/licenses/>.  */
     5         kx 
     5         kx /* We use <config.h> instead of "config.h" so that a compilation
     5         kx    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
     5         kx    (which it would do because makeint.h was found in $srcdir).  */
     5         kx #include <config.h>
     5         kx #undef  HAVE_CONFIG_H
     5         kx #define HAVE_CONFIG_H 1
     5         kx 
     5         kx /* Specify we want GNU source code.  This must be defined before any
     5         kx    system headers are included.  */
     5         kx 
     5         kx #define _GNU_SOURCE 1
     5         kx 
     5         kx /* AIX requires this to be the first thing in the file.  */
     5         kx #if HAVE_ALLOCA_H
     5         kx # include <alloca.h>
     5         kx #else
     5         kx # ifdef _AIX
     5         kx  #pragma alloca
     5         kx # else
     5         kx #  if !defined(__GNUC__) && !defined(WINDOWS32)
     5         kx #   ifndef alloca /* predefined by HP cc +Olibcalls */
     5         kx char *alloca ();
     5         kx #   endif
     5         kx #  endif
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx /* Some versions of GCC (e.g., 10.x) set the warn_unused_result attribute on
     5         kx    __builtin_alloca.  This causes alloca(0) to fail and is not easily worked
     5         kx    around so avoid it via the preprocessor.
     5         kx    See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98055  */
     5         kx 
     5         kx #if defined (__has_builtin)
     5         kx # if __has_builtin (__builtin_alloca)
     5         kx #   define free_alloca()
     5         kx # else
     5         kx #  define free_alloca() alloca (0)
     5         kx # endif
     5         kx #else
     5         kx # define free_alloca() alloca (0)
     5         kx #endif
     5         kx 
     5         kx /* Disable assert() unless we're a maintainer.
     5         kx    Some asserts are compute-intensive.  */
     5         kx #ifndef MAKE_MAINTAINER_MODE
     5         kx # define NDEBUG 1
     5         kx #endif
     5         kx 
     5         kx /* Include the externally-visible content.
     5         kx    Be sure to use the local one, and not one installed on the system.
     5         kx    Define GMK_BUILDING_MAKE for proper selection of dllexport/dllimport
     5         kx    declarations for MS-Windows.  */
     5         kx #ifdef WINDOWS32
     5         kx # define GMK_BUILDING_MAKE
     5         kx #endif
     5         kx #include "gnumake.h"
     5         kx 
     5         kx #ifdef  CRAY
     5         kx /* This must happen before #include <signal.h> so
     5         kx    that the declaration therein is changed.  */
     5         kx # define signal bsdsignal
     5         kx #endif
     5         kx 
     5         kx /* If we're compiling for the dmalloc debugger, turn off string inlining.  */
     5         kx #if defined(HAVE_DMALLOC_H) && defined(__GNUC__)
     5         kx # define __NO_STRING_INLINES
     5         kx #endif
     5         kx 
     5         kx #include <stddef.h>
     5         kx #include <sys/types.h>
     5         kx #include <sys/stat.h>
     5         kx #include <signal.h>
     5         kx #include <stdio.h>
     5         kx #include <ctype.h>
     5         kx 
     5         kx #ifdef HAVE_SYS_TIMEB_H
     5         kx /* SCO 3.2 "devsys 4.2" has a prototype for 'ftime' in <time.h> that bombs
     5         kx    unless <sys/timeb.h> has been included first.  */
     5         kx # include <sys/timeb.h>
     5         kx #endif
     5         kx #if TIME_WITH_SYS_TIME
     5         kx # include <sys/time.h>
     5         kx # include <time.h>
     5         kx #else
     5         kx # if HAVE_SYS_TIME_H
     5         kx #  include <sys/time.h>
     5         kx # else
     5         kx #  include <time.h>
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx #include <errno.h>
     5         kx 
     5         kx #ifndef errno
     5         kx extern int errno;
     5         kx #endif
     5         kx 
     5         kx #ifdef __VMS
     5         kx /* In strict ANSI mode, VMS compilers should not be defining the
     5         kx    VMS macro.  Define it here instead of a bulk edit for the correct code.
     5         kx  */
     5         kx # ifndef VMS
     5         kx #  define VMS
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx #ifdef  HAVE_UNISTD_H
     5         kx # include <unistd.h>
     5         kx /* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
     5         kx    POSIX.1 behavior with 'cc -YPOSIX', which predefines POSIX itself!  */
     5         kx # if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS)
     5         kx #  define POSIX 1
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx /* Some systems define _POSIX_VERSION but are not really POSIX.1.  */
     5         kx #if (defined (butterfly) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386)))
     5         kx # undef POSIX
     5         kx #endif
     5         kx 
     5         kx #if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
     5         kx # define POSIX 1
     5         kx #endif
     5         kx 
     5         kx #ifndef RETSIGTYPE
     5         kx # define RETSIGTYPE     void
     5         kx #endif
     5         kx 
     5         kx #ifndef sigmask
     5         kx # define sigmask(sig)   (1 << ((sig) - 1))
     5         kx #endif
     5         kx 
     5         kx #ifndef HAVE_SA_RESTART
     5         kx # define SA_RESTART 0
     5         kx #endif
     5         kx 
     5         kx #ifdef HAVE_VFORK_H
     5         kx # include <vfork.h>
     5         kx #endif
     5         kx 
     5         kx #ifdef  HAVE_LIMITS_H
     5         kx # include <limits.h>
     5         kx #endif
     5         kx #ifdef  HAVE_SYS_PARAM_H
     5         kx # include <sys/param.h>
     5         kx #endif
     5         kx 
     5         kx #ifndef PATH_MAX
     5         kx # ifndef POSIX
     5         kx #  define PATH_MAX      MAXPATHLEN
     5         kx # endif
     5         kx #endif
     5         kx #ifndef MAXPATHLEN
     5         kx # define MAXPATHLEN 1024
     5         kx #endif
     5         kx 
     5         kx #ifdef  PATH_MAX
     5         kx # define GET_PATH_MAX   PATH_MAX
     5         kx # define PATH_VAR(var)  char var[PATH_MAX+1]
     5         kx #else
     5         kx # define NEED_GET_PATH_MAX 1
     5         kx # define GET_PATH_MAX   (get_path_max ())
     5         kx # define PATH_VAR(var)  char *var = alloca (GET_PATH_MAX+1)
     5         kx unsigned int get_path_max (void);
     5         kx #endif
     5         kx 
     5         kx #ifndef CHAR_BIT
     5         kx # define CHAR_BIT 8
     5         kx #endif
     5         kx 
     5         kx #ifndef USHRT_MAX
     5         kx # define USHRT_MAX 65535
     5         kx #endif
     5         kx 
     5         kx /* Nonzero if the integer type T is signed.
     5         kx    Use <= to avoid GCC warnings about always-false expressions.  */
     5         kx #define INTEGER_TYPE_SIGNED(t) ((t) -1 <= 0)
     5         kx 
     5         kx /* The minimum and maximum values for the integer type T.
     5         kx    Use ~ (t) 0, not -1, for portability to 1's complement hosts.  */
     5         kx #define INTEGER_TYPE_MINIMUM(t) \
     5         kx   (! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))
     5         kx #define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t))
     5         kx 
     5         kx #ifndef CHAR_MAX
     5         kx # define CHAR_MAX INTEGER_TYPE_MAXIMUM (char)
     5         kx #endif
     5         kx 
     5         kx #ifdef STAT_MACROS_BROKEN
     5         kx # ifdef S_ISREG
     5         kx #  undef S_ISREG
     5         kx # endif
     5         kx # ifdef S_ISDIR
     5         kx #  undef S_ISDIR
     5         kx # endif
     5         kx #endif  /* STAT_MACROS_BROKEN.  */
     5         kx 
     5         kx #ifndef S_ISREG
     5         kx # define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
     5         kx #endif
     5         kx #ifndef S_ISDIR
     5         kx # define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
     5         kx #endif
     5         kx 
     5         kx #ifdef VMS
     5         kx # include <fcntl.h>
     5         kx # include <types.h>
     5         kx # include <unixlib.h>
     5         kx # include <unixio.h>
     5         kx # include <perror.h>
     5         kx /* Needed to use alloca on VMS.  */
     5         kx # include <builtins.h>
     5         kx 
     5         kx extern int vms_use_mcr_command;
     5         kx extern int vms_always_use_cmd_file;
     5         kx extern int vms_gnv_shell;
     5         kx extern int vms_comma_separator;
     5         kx extern int vms_legacy_behavior;
     5         kx extern int vms_unix_simulation;
     5         kx #endif
     5         kx 
     5         kx #if !defined(__attribute__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__)
     5         kx /* Don't use __attribute__ if it's not supported.  */
     5         kx # define ATTRIBUTE(x)
     5         kx #else
     5         kx # define ATTRIBUTE(x) __attribute__ (x)
     5         kx #endif
     5         kx 
     5         kx /* The __-protected variants of 'format' and 'printf' attributes
     5         kx    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
     5         kx #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
     5         kx # define __format__ format
     5         kx # define __printf__ printf
     5         kx #endif
     5         kx 
     5         kx #define UNUSED   ATTRIBUTE ((unused))
     5         kx #define NORETURN ATTRIBUTE ((noreturn))
     5         kx 
     5         kx #if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)
     5         kx # include <stdlib.h>
     5         kx # include <string.h>
     5         kx # define ANSI_STRING 1
     5         kx #else   /* No standard headers.  */
     5         kx # ifdef HAVE_STRING_H
     5         kx #  include <string.h>
     5         kx #  define ANSI_STRING 1
     5         kx # else
     5         kx #  include <strings.h>
     5         kx # endif
     5         kx # ifdef HAVE_MEMORY_H
     5         kx #  include <memory.h>
     5         kx # endif
     5         kx # ifdef HAVE_STDLIB_H
     5         kx #  include <stdlib.h>
     5         kx # else
     5         kx void *malloc (int);
     5         kx void *realloc (void *, int);
     5         kx void free (void *);
     5         kx 
     5         kx void abort (void) NORETURN;
     5         kx void exit (int) NORETURN;
     5         kx # endif /* HAVE_STDLIB_H.  */
     5         kx 
     5         kx #endif /* Standard headers.  */
     5         kx 
     5         kx /* These should be in stdlib.h.  Make sure we have them.  */
     5         kx #ifndef EXIT_SUCCESS
     5         kx # define EXIT_SUCCESS 0
     5         kx #endif
     5         kx #ifndef EXIT_FAILURE
     5         kx # define EXIT_FAILURE 1
     5         kx #endif
     5         kx 
     5         kx #ifndef  ANSI_STRING
     5         kx 
     5         kx /* SCO Xenix has a buggy macro definition in <string.h>.  */
     5         kx #undef  strerror
     5         kx #if !defined(__DECC)
     5         kx char *strerror (int errnum);
     5         kx #endif
     5         kx 
     5         kx #endif  /* !ANSI_STRING.  */
     5         kx #undef  ANSI_STRING
     5         kx 
     5         kx #if HAVE_INTTYPES_H
     5         kx # include <inttypes.h>
     5         kx #endif
     5         kx #if HAVE_STDINT_H
     5         kx # include <stdint.h>
     5         kx #endif
     5         kx #define FILE_TIMESTAMP uintmax_t
     5         kx 
     5         kx #if !defined(HAVE_STRSIGNAL)
     5         kx char *strsignal (int signum);
     5         kx #endif
     5         kx 
     5         kx #if !defined(HAVE_UMASK)
     5         kx typedef int mode_t;
     5         kx extern mode_t umask (mode_t);
     5         kx #endif
     5         kx 
     5         kx /* ISDIGIT offers the following features:
     5         kx    - Its arg may be any int or unsigned int; it need not be an unsigned char.
     5         kx    - It's guaranteed to evaluate its argument exactly once.
     5         kx       NOTE!  Make relies on this behavior, don't change it!
     5         kx    - It's typically faster.
     5         kx    POSIX 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
     5         kx    only '0' through '9' are digits.  Prefer ISDIGIT to isdigit() unless
     5         kx    it's important to use the locale's definition of 'digit' even when the
     5         kx    host does not conform to POSIX.  */
     5         kx #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
     5         kx 
     5         kx /* Test if two strings are equal. Is this worthwhile?  Should be profiled.  */
     5         kx #define streq(a, b) \
     5         kx    ((a) == (b) || \
     5         kx     (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
     5         kx 
     5         kx /* Test if two strings are equal, but match case-insensitively on systems
     5         kx    which have case-insensitive filesystems.  Should only be used for
     5         kx    filenames!  */
     5         kx #ifdef HAVE_CASE_INSENSITIVE_FS
     5         kx # define patheq(a, b) \
     5         kx     ((a) == (b) \
     5         kx      || (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \
     5         kx          && (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1))))
     5         kx #else
     5         kx # define patheq(a, b) streq(a, b)
     5         kx #endif
     5         kx 
     5         kx #define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
     5         kx 
     5         kx #if defined(ENUM_BITFIELDS) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
     5         kx # define ENUM_BITFIELD(bits)    :bits
     5         kx #else
     5         kx # define ENUM_BITFIELD(bits)
     5         kx #endif
     5         kx 
     5         kx /* Handle gettext and locales.  */
     5         kx 
     5         kx #if HAVE_LOCALE_H
     5         kx # include <locale.h>
     5         kx #else
     5         kx # define setlocale(category, locale)
     5         kx #endif
     5         kx 
     5         kx #include <gettext.h>
     5         kx 
     5         kx #define _(msgid)            gettext (msgid)
     5         kx #define N_(msgid)           gettext_noop (msgid)
     5         kx #define S_(msg1,msg2,num)   ngettext (msg1,msg2,num)
     5         kx 
     5         kx /* This is needed for getcwd() and chdir(), on some W32 systems.  */
     5         kx #if defined(HAVE_DIRECT_H)
     5         kx # include <direct.h>
     5         kx #endif
     5         kx 
     5         kx #ifdef WINDOWS32
     5         kx # include <fcntl.h>
     5         kx # include <malloc.h>
     5         kx # define pipe(_p)        _pipe((_p), 512, O_BINARY)
     5         kx # define kill(_pid,_sig) w32_kill((_pid),(_sig))
     5         kx /* MSVC and Watcom C don't have ftruncate.  */
     5         kx # if defined(_MSC_VER) || defined(__WATCOMC__)
     5         kx #  define ftruncate(_fd,_len) _chsize(_fd,_len)
     5         kx # endif
     5         kx /* MinGW64 doesn't have _S_ISDIR.  */
     5         kx # ifndef _S_ISDIR
     5         kx #  define _S_ISDIR(m)  S_ISDIR(m)
     5         kx # endif
     5         kx 
     5         kx void sync_Path_environment (void);
     5         kx int w32_kill (pid_t pid, int sig);
     5         kx int find_and_set_default_shell (const char *token);
     5         kx 
     5         kx /* indicates whether or not we have Bourne shell */
     5         kx extern int no_default_sh_exe;
     5         kx 
     5         kx /* is default_shell unixy? */
     5         kx extern int unixy_shell;
     5         kx 
     5         kx /* We don't have a preferred fixed value for LOCALEDIR.  */
     5         kx # ifndef LOCALEDIR
     5         kx #  define LOCALEDIR NULL
     5         kx # endif
     5         kx 
     5         kx /* Include only the minimal stuff from windows.h.   */
     5         kx # define WIN32_LEAN_AND_MEAN
     5         kx #endif  /* WINDOWS32 */
     5         kx 
     5         kx #define ANY_SET(_v,_m)  (((_v)&(_m)) != 0)
     5         kx #define NONE_SET(_v,_m) (! ANY_SET ((_v),(_m)))
     5         kx 
     5         kx #define MAP_NUL         0x0001
     5         kx #define MAP_BLANK       0x0002
     5         kx #define MAP_NEWLINE     0x0004
     5         kx #define MAP_COMMENT     0x0008
     5         kx #define MAP_SEMI        0x0010
     5         kx #define MAP_EQUALS      0x0020
     5         kx #define MAP_COLON       0x0040
     5         kx #define MAP_VARSEP      0x0080
     5         kx #define MAP_PIPE        0x0100
     5         kx #define MAP_DOT         0x0200
     5         kx #define MAP_COMMA       0x0400
     5         kx 
     5         kx /* These are the valid characters for a user-defined function.  */
     5         kx #define MAP_USERFUNC    0x2000
     5         kx /* This means not only a '$', but skip the variable reference.  */
     5         kx #define MAP_VARIABLE    0x4000
     5         kx /* The set of characters which are directory separators is OS-specific.  */
     5         kx #define MAP_DIRSEP      0x8000
     5         kx 
     5         kx #ifdef VMS
     5         kx # define MAP_VMSCOMMA   MAP_COMMA
     5         kx #else
     5         kx # define MAP_VMSCOMMA   0x0000
     5         kx #endif
     5         kx 
     5         kx #define MAP_SPACE       (MAP_BLANK|MAP_NEWLINE)
     5         kx 
     5         kx /* Handle other OSs.
     5         kx    To overcome an issue parsing paths in a DOS/Windows environment when
     5         kx    built in a unix based environment, override the PATH_SEPARATOR_CHAR
     5         kx    definition unless being built for Cygwin. */
     5         kx #if defined(HAVE_DOS_PATHS) && !defined(__CYGWIN__)
     5         kx # undef PATH_SEPARATOR_CHAR
     5         kx # define PATH_SEPARATOR_CHAR ';'
     5         kx # define MAP_PATHSEP    MAP_SEMI
     5         kx #elif !defined(PATH_SEPARATOR_CHAR)
     5         kx # if defined (VMS)
     5         kx #  define PATH_SEPARATOR_CHAR (vms_comma_separator ? ',' : ':')
     5         kx #  define MAP_PATHSEP    (vms_comma_separator ? MAP_COMMA : MAP_SEMI)
     5         kx # else
     5         kx #  define PATH_SEPARATOR_CHAR ':'
     5         kx #  define MAP_PATHSEP    MAP_COLON
     5         kx # endif
     5         kx #elif PATH_SEPARATOR_CHAR == ':'
     5         kx # define MAP_PATHSEP     MAP_COLON
     5         kx #elif PATH_SEPARATOR_CHAR == ';'
     5         kx # define MAP_PATHSEP     MAP_SEMI
     5         kx #elif PATH_SEPARATOR_CHAR == ','
     5         kx # define MAP_PATHSEP     MAP_COMMA
     5         kx #else
     5         kx # error "Unknown PATH_SEPARATOR_CHAR"
     5         kx #endif
     5         kx 
     5         kx #define STOP_SET(_v,_m) ANY_SET(stopchar_map[(unsigned char)(_v)],(_m))
     5         kx 
     5         kx #define ISBLANK(c)      STOP_SET((c),MAP_BLANK)
     5         kx #define ISSPACE(c)      STOP_SET((c),MAP_SPACE)
     5         kx #define END_OF_TOKEN(c) STOP_SET((c),MAP_SPACE|MAP_NUL)
     5         kx #define NEXT_TOKEN(s)   while (ISSPACE (*(s))) ++(s)
     5         kx 
     5         kx /* We can't run setrlimit when using posix_spawn.  */
     5         kx #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && !defined(USE_POSIX_SPAWN)
     5         kx # define SET_STACK_SIZE
     5         kx #endif
     5         kx #ifdef SET_STACK_SIZE
     5         kx # include <sys/resource.h>
     5         kx extern struct rlimit stack_limit;
     5         kx #endif
     5         kx 
     5         kx #include <glob.h>
     5         kx 
     5         kx #define NILF ((floc *)0)
     5         kx 
     5         kx #define CSTRLEN(_s)           (sizeof (_s)-1)
     5         kx #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s)
     5         kx 
     5         kx /* The number of bytes needed to represent the largest integer as a string.  */
     5         kx #define INTSTR_LENGTH         CSTRLEN ("18446744073709551616")
     5         kx 
     5         kx #define DEFAULT_TTYNAME "true"
     5         kx #ifdef HAVE_TTYNAME
     5         kx # define TTYNAME(_f) ttyname (_f)
     5         kx #else
     5         kx # define TTYNAME(_f) DEFAULT_TTYNAME
     5         kx #endif
     5         kx 
     5         kx 
     5         kx 
     5         kx /* Specify the location of elements read from makefiles.  */
     5         kx typedef struct
     5         kx   {
     5         kx     const char *filenm;
     5         kx     unsigned long lineno;
     5         kx     unsigned long offset;
     5         kx   } floc;
     5         kx 
     5         kx const char *concat (unsigned int, ...);
     5         kx void message (int prefix, size_t length, const char *fmt, ...)
     5         kx               ATTRIBUTE ((__format__ (__printf__, 3, 4)));
     5         kx void error (const floc *flocp, size_t length, const char *fmt, ...)
     5         kx             ATTRIBUTE ((__format__ (__printf__, 3, 4)));
     5         kx void fatal (const floc *flocp, size_t length, const char *fmt, ...)
     5         kx             ATTRIBUTE ((noreturn, __format__ (__printf__, 3, 4)));
     5         kx void out_of_memory () NORETURN;
     5         kx 
     5         kx /* When adding macros to this list be sure to update the value of
     5         kx    XGETTEXT_OPTIONS in the po/Makevars file.  */
     5         kx #define O(_t,_a,_f)           _t((_a), 0, (_f))
     5         kx #define OS(_t,_a,_f,_s)       _t((_a), strlen (_s), (_f), (_s))
     5         kx #define OSS(_t,_a,_f,_s1,_s2) _t((_a), strlen (_s1) + strlen (_s2), \
     5         kx                                  (_f), (_s1), (_s2))
     5         kx #define OSSS(_t,_a,_f,_s1,_s2,_s3) _t((_a), strlen (_s1) + strlen (_s2) + strlen (_s3), \
     5         kx                                       (_f), (_s1), (_s2), (_s3))
     5         kx #define ON(_t,_a,_f,_n)       _t((_a), INTSTR_LENGTH, (_f), (_n))
     5         kx #define ONN(_t,_a,_f,_n1,_n2) _t((_a), INTSTR_LENGTH*2, (_f), (_n1), (_n2))
     5         kx 
     5         kx #define OSN(_t,_a,_f,_s,_n)   _t((_a), strlen (_s) + INTSTR_LENGTH, \
     5         kx                                  (_f), (_s), (_n))
     5         kx #define ONS(_t,_a,_f,_n,_s)   _t((_a), INTSTR_LENGTH + strlen (_s), \
     5         kx                                  (_f), (_n), (_s))
     5         kx 
     5         kx void die (int) NORETURN;
     5         kx void pfatal_with_name (const char *) NORETURN;
     5         kx void perror_with_name (const char *, const char *);
     5         kx #define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s))
     5         kx void *xmalloc (size_t);
     5         kx void *xcalloc (size_t);
     5         kx void *xrealloc (void *, size_t);
     5         kx char *xstrdup (const char *);
     5         kx char *xstrndup (const char *, size_t);
     5         kx char *find_next_token (const char **, size_t *);
     5         kx char *next_token (const char *);
     5         kx char *end_of_token (const char *);
     5         kx void collapse_continuations (char *);
     5         kx char *lindex (const char *, const char *, int);
     5         kx int alpha_compare (const void *, const void *);
     5         kx void print_spaces (unsigned int);
     5         kx char *find_percent (char *);
     5         kx const char *find_percent_cached (const char **);
     5         kx FILE *get_tmpfile (char **, const char *);
     5         kx ssize_t writebuf (int, const void *, size_t);
     5         kx ssize_t readbuf (int, void *, size_t);
     5         kx 
     5         kx #ifndef HAVE_MEMRCHR
     5         kx void *memrchr(const void *, int, size_t);
     5         kx #endif
     5         kx 
     5         kx #ifndef NO_ARCHIVES
     5         kx int ar_name (const char *);
     5         kx void ar_parse_name (const char *, char **, char **);
     5         kx int ar_touch (const char *);
     5         kx time_t ar_member_date (const char *);
     5         kx 
     5         kx typedef long int (*ar_member_func_t) (int desc, const char *mem, int truncated,
     5         kx                                       long int hdrpos, long int datapos,
     5         kx                                       long int size, long int date, int uid,
     5         kx                                       int gid, unsigned int mode,
     5         kx                                       const void *arg);
     5         kx 
     5         kx long int ar_scan (const char *archive, ar_member_func_t function, const void *arg);
     5         kx int ar_name_equal (const char *name, const char *mem, int truncated);
     5         kx #ifndef VMS
     5         kx int ar_member_touch (const char *arname, const char *memname);
     5         kx #endif
     5         kx #endif
     5         kx 
     5         kx int dir_file_exists_p (const char *, const char *);
     5         kx int file_exists_p (const char *);
     5         kx int file_impossible_p (const char *);
     5         kx void file_impossible (const char *);
     5         kx const char *dir_name (const char *);
     5         kx void print_dir_data_base (void);
     5         kx void dir_setup_glob (glob_t *);
     5         kx void hash_init_directories (void);
     5         kx 
     5         kx void define_default_variables (void);
     5         kx void undefine_default_variables (void);
     5         kx void set_default_suffixes (void);
     5         kx void install_default_suffix_rules (void);
     5         kx void install_default_implicit_rules (void);
     5         kx 
     5         kx void build_vpath_lists (void);
     5         kx void construct_vpath_list (char *pattern, char *dirpath);
     5         kx const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr,
     5         kx                           unsigned int* vpath_index, unsigned int* path_index);
     5         kx int gpath_search (const char *file, size_t len);
     5         kx 
     5         kx void construct_include_path (const char **arg_dirs);
     5         kx 
     5         kx void user_access (void);
     5         kx void make_access (void);
     5         kx void child_access (void);
     5         kx 
     5         kx char *strip_whitespace (const char **begpp, const char **endpp);
     5         kx 
     5         kx void show_goal_error (void);
     5         kx 
     5         kx /* String caching  */
     5         kx void strcache_init (void);
     5         kx void strcache_print_stats (const char *prefix);
     5         kx int strcache_iscached (const char *str);
     5         kx const char *strcache_add (const char *str);
     5         kx const char *strcache_add_len (const char *str, size_t len);
     5         kx 
     5         kx /* Guile support  */
     5         kx int guile_gmake_setup (const floc *flocp);
     5         kx 
     5         kx /* Loadable object support.  Sets to the strcached name of the loaded file.  */
     5         kx typedef int (*load_func_t)(const floc *flocp);
     5         kx int load_file (const floc *flocp, const char **filename, int noerror);
     5         kx void unload_file (const char *name);
     5         kx 
     5         kx /* Maintainer mode support */
     5         kx #ifdef MAKE_MAINTAINER_MODE
     5         kx # define SPIN(_s) spin (_s)
     5         kx void spin (const char* suffix);
     5         kx #else
     5         kx # define SPIN(_s)
     5         kx #endif
     5         kx 
     5         kx /* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
     5         kx    because such systems often declare them in header files anyway.  */
     5         kx 
     5         kx #if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32)
     5         kx 
     5         kx long int atol ();
     5         kx # ifndef VMS
     5         kx long int lseek ();
     5         kx # endif
     5         kx 
     5         kx # ifdef  HAVE_GETCWD
     5         kx #  if !defined(VMS) && !defined(__DECC) && !defined(getcwd)
     5         kx char *getcwd ();
     5         kx #  endif
     5         kx # else
     5         kx char *getwd ();
     5         kx #  define getcwd(buf, len)       getwd (buf)
     5         kx # endif
     5         kx 
     5         kx #endif  /* Not GNU C library or POSIX.  */
     5         kx 
     5         kx #if !HAVE_STRCASECMP
     5         kx # if HAVE_STRICMP
     5         kx #  define strcasecmp stricmp
     5         kx # elif HAVE_STRCMPI
     5         kx #  define strcasecmp strcmpi
     5         kx # else
     5         kx /* Create our own, in misc.c */
     5         kx int strcasecmp (const char *s1, const char *s2);
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx #if !HAVE_STRNCASECMP
     5         kx # if HAVE_STRNICMP
     5         kx #  define strncasecmp strnicmp
     5         kx # elif HAVE_STRNCMPI
     5         kx #  define strncasecmp strncmpi
     5         kx # else
     5         kx /* Create our own, in misc.c */
     5         kx int strncasecmp (const char *s1, const char *s2, int n);
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx #define OUTPUT_SYNC_NONE    0
     5         kx #define OUTPUT_SYNC_LINE    1
     5         kx #define OUTPUT_SYNC_TARGET  2
     5         kx #define OUTPUT_SYNC_RECURSE 3
     5         kx 
     5         kx /* Non-GNU systems may not declare this in unistd.h.  */
     5         kx extern char **environ;
     5         kx 
     5         kx extern const floc *reading_file;
     5         kx extern const floc **expanding_var;
     5         kx 
     5         kx extern unsigned short stopchar_map[];
     5         kx 
     5         kx extern int just_print_flag, run_silent, ignore_errors_flag, keep_going_flag;
     5         kx extern int print_data_base_flag, question_flag, touch_flag, always_make_flag;
     5         kx extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
     5         kx extern int print_version_flag, print_directory, check_symlink_flag;
     5         kx extern int warn_undefined_variables_flag, posix_pedantic;
     5         kx extern int not_parallel, second_expansion, clock_skew_detected;
     5         kx extern int rebuilding_makefiles, one_shell, output_sync, verify_flag;
     5         kx extern unsigned long command_count;
     5         kx 
     5         kx extern const char *default_shell;
     5         kx 
     5         kx /* can we run commands via 'sh -c xxx' or must we use batch files? */
     5         kx extern int batch_mode_shell;
     5         kx 
     5         kx /* Resetting the command script introduction prefix character.  */
     5         kx #define RECIPEPREFIX_NAME          ".RECIPEPREFIX"
     5         kx #define RECIPEPREFIX_DEFAULT       '\t'
     5         kx extern char cmd_prefix;
     5         kx 
     5         kx extern unsigned int job_slots;
     5         kx extern double max_load_average;
     5         kx 
     5         kx extern const char *program;
     5         kx 
     5         kx #ifdef VMS
     5         kx const char *vms_command (const char *argv0);
     5         kx const char *vms_progname (const char *argv0);
     5         kx 
     5         kx void vms_exit (int);
     5         kx # define _exit(foo) vms_exit(foo)
     5         kx # define exit(foo) vms_exit(foo)
     5         kx 
     5         kx extern char *program_name;
     5         kx 
     5         kx void
     5         kx set_program_name (const char *arv0);
     5         kx 
     5         kx int
     5         kx need_vms_symbol (void);
     5         kx 
     5         kx int
     5         kx create_foreign_command (const char *command, const char *image);
     5         kx 
     5         kx int
     5         kx vms_export_dcl_symbol (const char *name, const char *value);
     5         kx 
     5         kx int
     5         kx vms_putenv_symbol (const char *string);
     5         kx 
     5         kx void
     5         kx vms_restore_symbol (const char *string);
     5         kx 
     5         kx #endif
     5         kx 
     5         kx void remote_setup (void);
     5         kx void remote_cleanup (void);
     5         kx int start_remote_job_p (int);
     5         kx int start_remote_job (char **, char **, int, int *, pid_t *, int *);
     5         kx int remote_status (int *, int *, int *, int);
     5         kx void block_remote_children (void);
     5         kx void unblock_remote_children (void);
     5         kx int remote_kill (pid_t id, int sig);
     5         kx void print_variable_data_base (void);
     5         kx void print_vpath_data_base (void);
     5         kx 
     5         kx extern char *starting_directory;
     5         kx extern unsigned int makelevel;
     5         kx extern char *version_string, *remote_description, *make_host;
     5         kx 
     5         kx extern unsigned int commands_started;
     5         kx 
     5         kx extern int handling_fatal_signal;
     5         kx 
     5         kx #ifndef MIN
     5         kx #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
     5         kx #endif
     5         kx #ifndef MAX
     5         kx #define MAX(_a,_b) ((_a)>(_b)?(_a):(_b))
     5         kx #endif
     5         kx 
     5         kx #define MAKE_SUCCESS 0
     5         kx #define MAKE_TROUBLE 1
     5         kx #define MAKE_FAILURE 2
     5         kx 
     5         kx /* Set up heap debugging library dmalloc.  */
     5         kx 
     5         kx #ifdef HAVE_DMALLOC_H
     5         kx #include <dmalloc.h>
     5         kx #endif
     5         kx 
     5         kx #ifndef initialize_main
     5         kx # ifdef __EMX__
     5         kx #  define initialize_main(pargc, pargv) \
     5         kx                           { _wildcard(pargc, pargv); _response(pargc, pargv); }
     5         kx # else
     5         kx #  define initialize_main(pargc, pargv)
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx #ifdef __EMX__
     5         kx # if !defined chdir
     5         kx #  define chdir _chdir2
     5         kx # endif
     5         kx # if !defined getcwd
     5         kx #  define getcwd _getcwd2
     5         kx # endif
     5         kx 
     5         kx /* NO_CHDIR2 causes make not to use _chdir2() and _getcwd2() instead of
     5         kx    chdir() and getcwd(). This avoids some error messages for the
     5         kx    make testsuite but restricts the drive letter support. */
     5         kx # ifdef NO_CHDIR2
     5         kx #  warning NO_CHDIR2: usage of drive letters restricted
     5         kx #  undef chdir
     5         kx #  undef getcwd
     5         kx # endif
     5         kx #endif
     5         kx 
     5         kx #ifndef initialize_main
     5         kx # define initialize_main(pargc, pargv)
     5         kx #endif
     5         kx 
     5         kx 
     5         kx /* Some systems (like Solaris, PTX, etc.) do not support the SA_RESTART flag
     5         kx    properly according to POSIX.  So, we try to wrap common system calls with
     5         kx    checks for EINTR.  Note that there are still plenty of system calls that
     5         kx    can fail with EINTR but this, reportedly, gets the vast majority of
     5         kx    failure cases.  If you still experience failures you'll need to either get
     5         kx    a system where SA_RESTART works, or you need to avoid -j.  */
     5         kx 
     5         kx #define EINTRLOOP(_v,_c)   while (((_v)=_c)==-1 && errno==EINTR)
     5         kx 
     5         kx /* While system calls that return integers are pretty consistent about
     5         kx    returning -1 on failure and setting errno in that case, functions that
     5         kx    return pointers are not always so well behaved.  Sometimes they return
     5         kx    NULL for expected behavior: one good example is readdir() which returns
     5         kx    NULL at the end of the directory--and _doesn't_ reset errno.  So, we have
     5         kx    to do it ourselves here.  */
     5         kx 
     5         kx #define ENULLLOOP(_v,_c)   do { errno = 0; (_v) = _c; } \
     5         kx                            while((_v)==0 && errno==EINTR)