system.h revision 57844
1238384Sjkim/* system.h - Get common system includes and various definitions and 2280304Sjkim declarations based on autoconf macros. 3280304Sjkim Copyright (C) 1998, 1999 Free Software Foundation, Inc. 4280304Sjkim 5280304SjkimThis file is part of GNU CC. 6238384Sjkim 7238384SjkimGNU CC is free software; you can redistribute it and/or modify 8238384Sjkimit under the terms of the GNU General Public License as published by 9238384Sjkimthe Free Software Foundation; either version 2, or (at your option) 10238384Sjkimany later version. 11238384Sjkim 12238384SjkimGNU CC is distributed in the hope that it will be useful, 13238384Sjkimbut WITHOUT ANY WARRANTY; without even the implied warranty of 14238384SjkimMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15280304SjkimGNU General Public License for more details. 16238384Sjkim 17238384SjkimYou should have received a copy of the GNU General Public License 18238384Sjkimalong with GNU CC; see the file COPYING. If not, write to 19238384Sjkimthe Free Software Foundation, 59 Temple Place - Suite 330, 20238384SjkimBoston, MA 02111-1307, USA. */ 21238384Sjkim 22238384Sjkim#ifndef __GCC_SYSTEM_H__ 23238384Sjkim#define __GCC_SYSTEM_H__ 24238384Sjkim 25238384Sjkim/* This is the location of the online document giving information how 26238384Sjkim to report bugs. If you change this string, also check for strings 27238384Sjkim not under control of the preprocessor. */ 28238384Sjkim#define GCCBUGURL "<URL:http://www.gnu.org/software/gcc/bugs.html>" 29238384Sjkim 30238384Sjkim/* We must include stdarg.h/varargs.h before stdio.h. */ 31238384Sjkim#ifdef ANSI_PROTOTYPES 32238384Sjkim#include <stdarg.h> 33238384Sjkim#else 34238384Sjkim#include <varargs.h> 35238384Sjkim#endif 36238384Sjkim 37238384Sjkim#include <stdio.h> 38238384Sjkim 39238384Sjkim/* Define a generic NULL if one hasn't already been defined. */ 40238384Sjkim#ifndef NULL 41238384Sjkim#define NULL 0 42238384Sjkim#endif 43238384Sjkim 44238384Sjkim/* The compiler is not a multi-threaded application and therefore we 45238384Sjkim do not have to use the locking functions. 46238384Sjkim 47238384Sjkim NEED_DECLARATION_PUTC_UNLOCKED actually indicates whether or not 48238384Sjkim the IO code is multi-thread safe by default. If it is not declared, 49238384Sjkim then do not worry about using the _unlocked functions. 50238384Sjkim 51238384Sjkim fputs_unlocked is an extension and needs to be prototyped specially. */ 52238384Sjkim 53238384Sjkim#if defined HAVE_PUTC_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED 54238384Sjkim# undef putc 55238384Sjkim# define putc(C, Stream) putc_unlocked (C, Stream) 56238384Sjkim#endif 57238384Sjkim#if defined HAVE_FPUTC_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED 58238384Sjkim# undef fputc 59238384Sjkim# define fputc(C, Stream) fputc_unlocked (C, Stream) 60238384Sjkim#endif 61238384Sjkim#if defined HAVE_FPUTS_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED 62238384Sjkim# undef fputs 63280304Sjkim# define fputs(String, Stream) fputs_unlocked (String, Stream) 64280304Sjkim# ifdef NEED_DECLARATION_FPUTS_UNLOCKED 65280304Sjkimextern int fputs_unlocked PROTO ((const char *, FILE *)); 66238384Sjkim# endif 67238384Sjkim#endif 68280304Sjkim 69280304Sjkim#include <ctype.h> 70280304Sjkim 71280304Sjkim/* Jim Meyering writes: 72280304Sjkim 73280304Sjkim "... Some ctype macros are valid only for character codes that 74280304Sjkim isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when 75280304Sjkim using /bin/cc or gcc but without giving an ansi option). So, all 76280304Sjkim ctype uses should be through macros like ISPRINT... If 77280304Sjkim STDC_HEADERS is defined, then autoconf has verified that the ctype 78280304Sjkim macros don't need to be guarded with references to isascii. ... 79280304Sjkim Defining isascii to 1 should let any compiler worth its salt 80280304Sjkim eliminate the && through constant folding." 81280304Sjkim 82280304Sjkim Bruno Haible adds: 83280304Sjkim 84280304Sjkim "... Furthermore, isupper(c) etc. have an undefined result if c is 85280304Sjkim outside the range -1 <= c <= 255. One is tempted to write isupper(c) 86280304Sjkim with c being of type `char', but this is wrong if c is an 8-bit 87280304Sjkim character >= 128 which gets sign-extended to a negative value. 88280304Sjkim The macro ISUPPER protects against this as well." */ 89280304Sjkim 90280304Sjkim#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) 91280304Sjkim# define IN_CTYPE_DOMAIN(c) 1 92280304Sjkim#else 93280304Sjkim# define IN_CTYPE_DOMAIN(c) isascii(c) 94280304Sjkim#endif 95280304Sjkim 96280304Sjkim#ifdef isblank 97280304Sjkim# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c)) 98238384Sjkim#else 99238384Sjkim# define ISBLANK(c) ((c) == ' ' || (c) == '\t') 100280304Sjkim#endif 101280304Sjkim#ifdef isgraph 102280304Sjkim# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c)) 103280304Sjkim#else 104280304Sjkim# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c)) 105280304Sjkim#endif 106280304Sjkim 107280304Sjkim#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) 108280304Sjkim#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c)) 109280304Sjkim#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) 110280304Sjkim#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) 111280304Sjkim#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) 112280304Sjkim#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c)) 113280304Sjkim#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) 114280304Sjkim#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) 115280304Sjkim#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c)) 116280304Sjkim#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) 117280304Sjkim 118280304Sjkim/* ISDIGIT differs from ISDIGIT_LOCALE, as follows: 119280304Sjkim - Its arg may be any int or unsigned int; it need not be an unsigned char. 120280304Sjkim - It's guaranteed to evaluate its argument exactly once. 121280304Sjkim - It's typically faster. 122280304Sjkim Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that 123280304Sjkim only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless 124280304Sjkim it's important to use the locale's definition of `digit' even when the 125280304Sjkim host does not conform to Posix. */ 126280304Sjkim#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) 127280304Sjkim 128280304Sjkim 129280304Sjkim#include <sys/types.h> 130238384Sjkim#include <errno.h> 131238384Sjkim 132280304Sjkim#ifndef errno 133280304Sjkimextern int errno; 134238384Sjkim#endif 135280304Sjkim 136280304Sjkim#ifdef STRING_WITH_STRINGS 137280304Sjkim# include <string.h> 138280304Sjkim# include <strings.h> 139280304Sjkim#else 140280304Sjkim# ifdef HAVE_STRING_H 141280304Sjkim# include <string.h> 142280304Sjkim# else 143280304Sjkim# ifdef HAVE_STRINGS_H 144280304Sjkim# include <strings.h> 145280304Sjkim# endif 146280304Sjkim# endif 147238384Sjkim#endif 148280304Sjkim 149280304Sjkim#ifdef HAVE_STDLIB_H 150280304Sjkim# include <stdlib.h> 151280304Sjkim#endif 152280304Sjkim 153280304Sjkim#ifdef HAVE_UNISTD_H 154280304Sjkim# include <unistd.h> 155280304Sjkim#endif 156280304Sjkim 157280304Sjkim#ifdef HAVE_SYS_PARAM_H 158280304Sjkim# include <sys/param.h> 159238384Sjkim#endif 160280304Sjkim 161280304Sjkim#if HAVE_LIMITS_H 162280304Sjkim# include <limits.h> 163280304Sjkim#endif 164280304Sjkim 165280304Sjkim/* Find HOST_WIDEST_INT and set its bit size, type and print macros. 166280304Sjkim It will be the largest integer mode supported by the host which may 167280304Sjkim (or may not) be larger than HOST_WIDE_INT. This must appear after 168280304Sjkim <limits.h> since we only use `long long' if its bigger than a 169280304Sjkim `long' and also if it is supported by macros in limits.h. For old 170280304Sjkim hosts which don't have a limits.h (and thus won't include it in 171280304Sjkim stage2 cause we don't rerun configure) we assume gcc supports long 172280304Sjkim long.) Note, you won't get these defined if you don't include 173280304Sjkim {ht}config.h before this file to set the HOST_BITS_PER_* macros. */ 174280304Sjkim 175280304Sjkim#ifndef HOST_WIDEST_INT 176280304Sjkim# if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_LONGLONG) 177280304Sjkim# if (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) || defined (LLONG_MAX) || defined (__GNUC__)) 178280304Sjkim# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG 179280304Sjkim# define HOST_WIDEST_INT long long 180280304Sjkim# define HOST_WIDEST_INT_PRINT_DEC "%lld" 181280304Sjkim# define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" 182280304Sjkim# define HOST_WIDEST_INT_PRINT_HEX "0x%llx" 183280304Sjkim# else 184280304Sjkim# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG 185238384Sjkim# define HOST_WIDEST_INT long 186280304Sjkim# define HOST_WIDEST_INT_PRINT_DEC "%ld" 187280304Sjkim# define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu" 188280304Sjkim# define HOST_WIDEST_INT_PRINT_HEX "0x%lx" 189280304Sjkim# endif /*(long long>long) && (LONG_LONG_MAX||LONGLONG_MAX||LLONG_MAX||GNUC)*/ 190280304Sjkim# endif /* defined(HOST_BITS_PER_LONG) && defined(HOST_BITS_PER_LONGLONG) */ 191280304Sjkim#endif /* ! HOST_WIDEST_INT */ 192280304Sjkim 193280304Sjkim#ifdef TIME_WITH_SYS_TIME 194280304Sjkim# include <sys/time.h> 195280304Sjkim# include <time.h> 196280304Sjkim#else 197280304Sjkim# if HAVE_SYS_TIME_H 198280304Sjkim# include <sys/time.h> 199238384Sjkim# else 200238384Sjkim# ifdef HAVE_TIME_H 201280304Sjkim# include <time.h> 202280304Sjkim# endif 203280304Sjkim# endif 204238384Sjkim#endif 205280304Sjkim 206280304Sjkim#ifdef HAVE_FCNTL_H 207280304Sjkim# include <fcntl.h> 208280304Sjkim#else 209280304Sjkim# ifdef HAVE_SYS_FILE_H 210280304Sjkim# include <sys/file.h> 211280304Sjkim# endif 212238384Sjkim#endif 213280304Sjkim 214280304Sjkim#ifndef SEEK_SET 215280304Sjkim# define SEEK_SET 0 216280304Sjkim# define SEEK_CUR 1 217280304Sjkim# define SEEK_END 2 218280304Sjkim#endif 219280304Sjkim#ifndef F_OK 220280304Sjkim# define F_OK 0 221280304Sjkim# define X_OK 1 222280304Sjkim# define W_OK 2 223280304Sjkim# define R_OK 4 224280304Sjkim#endif 225238384Sjkim#ifndef O_RDONLY 226280304Sjkim# define O_RDONLY 0 227280304Sjkim#endif 228238384Sjkim#ifndef O_WRONLY 229238384Sjkim# define O_WRONLY 1 230238384Sjkim#endif 231280304Sjkim 232280304Sjkim/* Some systems define these in, e.g., param.h. We undefine these names 233280304Sjkim here to avoid the warnings. We prefer to use our definitions since we 234238384Sjkim know they are correct. */ 235280304Sjkim 236280304Sjkim#undef MIN 237280304Sjkim#undef MAX 238280304Sjkim#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) 239280304Sjkim#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) 240280304Sjkim 241280304Sjkim#ifdef HAVE_SYS_WAIT_H 242238384Sjkim#include <sys/wait.h> 243280304Sjkim#endif 244280304Sjkim 245280304Sjkim#ifndef WIFSIGNALED 246280304Sjkim#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f) 247280304Sjkim#endif 248238384Sjkim#ifndef WTERMSIG 249280304Sjkim#define WTERMSIG(S) ((S) & 0x7f) 250280304Sjkim#endif 251280304Sjkim#ifndef WIFEXITED 252280304Sjkim#define WIFEXITED(S) (((S) & 0xff) == 0) 253238384Sjkim#endif 254280304Sjkim#ifndef WEXITSTATUS 255238384Sjkim#define WEXITSTATUS(S) (((S) & 0xff00) >> 8) 256280304Sjkim#endif 257280304Sjkim#ifndef WSTOPSIG 258280304Sjkim#define WSTOPSIG WEXITSTATUS 259280304Sjkim#endif 260280304Sjkim 261238384Sjkim 262280304Sjkim 263280304Sjkim#ifndef bcopy 264280304Sjkim# ifdef HAVE_BCOPY 265280304Sjkim# ifdef NEED_DECLARATION_BCOPY 266280304Sjkimextern void bcopy (); 267280304Sjkim# endif 268280304Sjkim# else /* ! HAVE_BCOPY */ 269280304Sjkim# define bcopy(src,dst,len) memmove((dst),(src),(len)) 270280304Sjkim# endif 271280304Sjkim#endif 272280304Sjkim 273280304Sjkim#ifndef bcmp 274280304Sjkim# ifdef HAVE_BCMP 275280304Sjkim# ifdef NEED_DECLARATION_BCMP 276280304Sjkimextern int bcmp (); 277280304Sjkim# endif 278280304Sjkim# else /* ! HAVE_BCMP */ 279280304Sjkim# define bcmp(left,right,len) memcmp ((left),(right),(len)) 280280304Sjkim# endif 281280304Sjkim#endif 282280304Sjkim 283280304Sjkim#ifndef bzero 284280304Sjkim# ifdef HAVE_BZERO 285238384Sjkim# ifdef NEED_DECLARATION_BZERO 286280304Sjkimextern void bzero (); 287280304Sjkim# endif 288238384Sjkim# else /* ! HAVE_BZERO */ 289238384Sjkim# define bzero(dst,len) memset ((dst),0,(len)) 290280304Sjkim# endif 291280304Sjkim#endif 292280304Sjkim 293280304Sjkim#ifndef index 294280304Sjkim# ifdef HAVE_INDEX 295280304Sjkim# ifdef NEED_DECLARATION_INDEX 296280304Sjkimextern char *index (); 297280304Sjkim# endif 298280304Sjkim# else /* ! HAVE_INDEX */ 299280304Sjkim# define index strchr 300280304Sjkim# endif 301280304Sjkim#endif 302280304Sjkim 303280304Sjkim#ifndef rindex 304280304Sjkim# ifdef HAVE_RINDEX 305280304Sjkim# ifdef NEED_DECLARATION_RINDEX 306280304Sjkimextern char *rindex (); 307280304Sjkim# endif 308280304Sjkim# else /* ! HAVE_RINDEX */ 309280304Sjkim# define rindex strrchr 310280304Sjkim# endif 311280304Sjkim#endif 312280304Sjkim 313280304Sjkim#ifdef NEED_DECLARATION_ATOF 314280304Sjkimextern double atof (); 315280304Sjkim#endif 316280304Sjkim 317280304Sjkim#ifdef NEED_DECLARATION_ATOL 318280304Sjkimextern long atol(); 319280304Sjkim#endif 320280304Sjkim 321280304Sjkim#ifdef NEED_DECLARATION_FREE 322280304Sjkimextern void free (); 323280304Sjkim#endif 324280304Sjkim 325280304Sjkim#ifdef NEED_DECLARATION_GETCWD 326280304Sjkimextern char *getcwd (); 327280304Sjkim#endif 328280304Sjkim 329238384Sjkim#ifdef NEED_DECLARATION_GETENV 330280304Sjkimextern char *getenv (); 331280304Sjkim#endif 332280304Sjkim 333238384Sjkim#ifdef NEED_DECLARATION_GETWD 334280304Sjkimextern char *getwd (); 335280304Sjkim#endif 336238384Sjkim 337280304Sjkim#ifdef NEED_DECLARATION_SBRK 338280304Sjkimextern char *sbrk (); 339280304Sjkim#endif 340280304Sjkim 341280304Sjkim#ifdef NEED_DECLARATION_STRSTR 342238384Sjkimextern char *strstr (); 343280304Sjkim#endif 344280304Sjkim 345280304Sjkim#ifdef HAVE_STRERROR 346280304Sjkim# ifdef NEED_DECLARATION_STRERROR 347280304Sjkim# ifndef strerror 348280304Sjkimextern char *strerror (); 349280304Sjkim# endif 350280304Sjkim# endif 351280304Sjkim#else /* ! HAVE_STRERROR */ 352238384Sjkimextern int sys_nerr; 353280304Sjkimextern char *sys_errlist[]; 354280304Sjkim#endif /* HAVE_STRERROR */ 355280304Sjkim 356280304Sjkim#ifdef HAVE_STRSIGNAL 357280304Sjkim# ifdef NEED_DECLARATION_STRSIGNAL 358280304Sjkim# ifndef strsignal 359280304Sjkimextern char * strsignal (); 360280304Sjkim# endif 361280304Sjkim# endif 362280304Sjkim#else /* ! HAVE_STRSIGNAL */ 363280304Sjkim# ifndef SYS_SIGLIST_DECLARED 364280304Sjkim# ifndef NO_SYS_SIGLIST 365280304Sjkimextern char * sys_siglist[]; 366280304Sjkim# endif 367280304Sjkim# endif 368280304Sjkim#endif /* HAVE_STRSIGNAL */ 369238384Sjkim 370238384Sjkim#ifdef HAVE_GETRLIMIT 371280304Sjkim# ifdef NEED_DECLARATION_GETRLIMIT 372280304Sjkim# ifndef getrlimit 373280304Sjkimextern int getrlimit (); 374280304Sjkim# endif 375280304Sjkim# endif 376280304Sjkim#endif 377238384Sjkim 378280304Sjkim#ifdef HAVE_SETRLIMIT 379280304Sjkim# ifdef NEED_DECLARATION_SETRLIMIT 380280304Sjkim# ifndef setrlimit 381280304Sjkimextern int setrlimit (); 382280304Sjkim# endif 383280304Sjkim# endif 384280304Sjkim#endif 385280304Sjkim 386280304Sjkim/* HAVE_VOLATILE only refers to the stage1 compiler. We also check 387280304Sjkim __STDC__ and assume gcc sets it and has volatile in stage >=2. */ 388280304Sjkim#if !defined(HAVE_VOLATILE) && !defined(__STDC__) && !defined(volatile) 389280304Sjkim#define volatile 390280304Sjkim#endif 391280304Sjkim 392280304Sjkim/* Redefine abort to report an internal error w/o coredump, and reporting the 393280304Sjkim location of the error in the source file. 394280304Sjkim Some files undefine abort again, so we must prototype the real thing 395280304Sjkim for their sake. */ 396280304Sjkim#ifdef NEED_DECLARATION_ABORT 397280304Sjkimextern void abort (); 398280304Sjkim#endif 399238384Sjkimextern void fatal PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; 400280304Sjkim 401280304Sjkim#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) 402280304Sjkim#define abort() fatal ("Internal compiler error at %s:%d\n", \ 403280304Sjkim trim_filename (__FILE__), __LINE__) 404280304Sjkim#else 405280304Sjkim#define abort() fatal ("Internal compiler error in `%s', at %s:%d\n" \ 406280304Sjkim "Please submit a full bug report.\n" \ 407280304Sjkim "See %s for instructions.", \ 408280304Sjkim __PRETTY_FUNCTION__, trim_filename (__FILE__), __LINE__, GCCBUGURL) 409280304Sjkim#endif /* recent gcc */ 410280304Sjkim 411280304Sjkim/* trim_filename is in toplev.c. Define a stub macro for files that 412280304Sjkim don't link toplev.c. toplev.h will reset it to the real version. */ 413280304Sjkim#define trim_filename(x) (x) 414280304Sjkim 415280304Sjkim/* Define a STRINGIFY macro that's right for ANSI or traditional C. 416280304Sjkim HAVE_CPP_STRINGIFY only refers to the stage1 compiler. Assume that 417280304Sjkim (non-traditional) gcc used in stage2 or later has this feature. 418280304Sjkim 419280304Sjkim Note: if the argument passed to STRINGIFY is itself a macro, eg 420280304Sjkim #define foo bar, STRINGIFY(foo) will produce "foo", not "bar". 421238384Sjkim Although the __STDC__ case could be made to expand this via a layer 422269686Sjkim of indirection, the traditional C case can not do so. Therefore 423280304Sjkim this behavior is not supported. */ 424280304Sjkim#ifndef STRINGIFY 425280304Sjkim# if defined(HAVE_CPP_STRINGIFY) || (defined(__GNUC__) && defined(__STDC__)) 426280304Sjkim# define STRINGIFY(STRING) #STRING 427280304Sjkim# else 428280304Sjkim# define STRINGIFY(STRING) "STRING" 429280304Sjkim# endif 430280304Sjkim#endif /* ! STRINGIFY */ 431280304Sjkim 432280304Sjkim#if HAVE_SYS_STAT_H 433280304Sjkim# include <sys/stat.h> 434269686Sjkim#endif 435280304Sjkim 436280304Sjkim/* Test if something is a normal file. */ 437280304Sjkim#ifndef S_ISREG 438280304Sjkim#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 439269686Sjkim#endif 440280304Sjkim 441280304Sjkim/* Test if something is a directory. */ 442280304Sjkim#ifndef S_ISDIR 443280304Sjkim#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 444280304Sjkim#endif 445280304Sjkim 446280304Sjkim/* Test if something is a character special file. */ 447280304Sjkim#ifndef S_ISCHR 448280304Sjkim#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 449269686Sjkim#endif 450280304Sjkim 451280304Sjkim/* Test if something is a socket. */ 452269686Sjkim#ifndef S_ISSOCK 453238384Sjkim# ifdef S_IFSOCK 454280304Sjkim# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 455280304Sjkim# else 456238384Sjkim# define S_ISSOCK(m) 0 457284285Sjkim# endif 458284285Sjkim#endif 459280304Sjkim 460280304Sjkim/* Test if something is a FIFO. */ 461238384Sjkim#ifndef S_ISFIFO 462280304Sjkim# ifdef S_IFIFO 463280304Sjkim# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 464280304Sjkim# else 465238384Sjkim# define S_ISFIFO(m) 0 466280304Sjkim# endif 467280304Sjkim#endif 468238384Sjkim 469238384Sjkim/* Approximate O_NONBLOCK. */ 470280304Sjkim#ifndef O_NONBLOCK 471280304Sjkim#define O_NONBLOCK O_NDELAY 472280304Sjkim#endif 473280304Sjkim 474280304Sjkim/* Approximate O_NOCTTY. */ 475238384Sjkim#ifndef O_NOCTTY 476238384Sjkim#define O_NOCTTY 0 477280304Sjkim#endif 478280304Sjkim 479280304Sjkim/* Define well known filenos if the system does not define them. */ 480280304Sjkim#ifndef STDIN_FILENO 481280304Sjkim# define STDIN_FILENO 0 482238384Sjkim#endif 483238384Sjkim#ifndef STDOUT_FILENO 484280304Sjkim# define STDOUT_FILENO 1 485280304Sjkim#endif 486280304Sjkim#ifndef STDERR_FILENO 487280304Sjkim# define STDERR_FILENO 2 488280304Sjkim#endif 489238384Sjkim 490238384Sjkim/* Some systems have mkdir that takes a single argument. */ 491280304Sjkim#ifdef MKDIR_TAKES_ONE_ARG 492280304Sjkim# define mkdir(a,b) mkdir(a) 493280304Sjkim#endif 494280304Sjkim 495280304Sjkim/* Get libiberty declarations. */ 496238384Sjkim#include "libiberty.h" 497280304Sjkim 498280304Sjkim#endif /* __GCC_SYSTEM_H__ */ 499238384Sjkim