1/* $NetBSD: conf.h,v 1.11 1997/03/25 13:56:36 lukem Exp $ */ 2 3/* example RCS compile-time configuration */ 4 5/* Id: conf.heg,v 1.17 1995/06/02 18:19:00 eggert Exp */ 6 7/* 8 * This example RCS compile-time configuration describes a host that conforms 9 * to Standard C (1990) and to Posix 1003.1b-1993 with Memory Mapped Files, 10 * and has GNU diffutils 2.7 or later. If you can't get conf.sh to work, 11 * copy this file to conf.h and edit conf.h by hand; see ../INSTALL.RCS. 12 */ 13 14#define exitmain(n) return n /* how to exit from main() */ 15/* #define _POSIX_C_SOURCE 2147483647L */ /* if strict C + Posix 1003.1b-1993 or later */ 16/* #define _POSIX_SOURCE */ /* if strict C + Posix 1003.1-1990 */ 17 18#include <errno.h> 19#include <stdio.h> 20#include <time.h> 21 22/* Comment out #include lines below that do not work. */ 23#include <sys/types.h> 24#include <sys/stat.h> 25#include <dirent.h> 26#include <fcntl.h> 27#include <limits.h> 28/* #include <mach/mach.h> */ 29/* #include <net/errno.h> */ 30#include <pwd.h> 31/* #include <siginfo.h> */ 32#include <signal.h> 33#include <stdlib.h> 34#include <string.h> 35#include <sys/mman.h> 36#include <sys/wait.h> 37/* #include <ucontext.h> */ 38#include <unistd.h> 39#include <utime.h> 40/* #include <vfork.h> */ 41 42/* Define boolean symbols to be 0 (false, the default), or 1 (true). */ 43#define has_sys_param_h 1 /* Does #include <sys/param.h> work? */ 44/* extern int errno; */ /* Uncomment if <errno.h> doesn't declare errno. */ 45#define has_readlink 1 /* Does readlink() work? */ 46#define readlink_isreg_errno EINVAL /* errno after readlink on regular file */ 47 48#if has_readlink && !defined(MAXSYMLINKS) 49# if has_sys_param_h 50# include <sys/param.h> 51# endif 52# ifndef MAXSYMLINKS 53# define MAXSYMLINKS 20 /* BSD; not standard yet */ 54# endif 55#endif 56 57/* Comment out the typedefs below if the types are already declared. */ 58/* Fix any uncommented typedefs that are wrong. */ 59/* typedef int mode_t; */ 60/* typedef long off_t; */ 61/* typedef int pid_t; */ 62/* typedef int sig_atomic_t; */ 63/* typedef unsigned size_t; */ 64/* typedef int ssize_t; */ 65/* typedef long time_t; */ 66/* typedef int uid_t; */ 67 68/* Comment out the keyword definitions below if the keywords work. */ 69/* #define const */ 70/* #define volatile */ 71 72/* Define boolean symbols to be 0 (false, the default), or 1 (true). */ 73#define has_prototypes 1 /* Do function prototypes work? */ 74#define has_stdarg 1 /* Does <stdarg.h> work? */ 75/* #define has_varargs ? */ /* Does <varargs.h> work? */ 76#define va_start_args 2 /* How many args does va_start() take? */ 77 78#if O_BINARY 79 /* Text and binary i/o behave differently. */ 80 /* This is incompatible with Posix and Unix. */ 81# define FOPEN_RB "rb" 82# define FOPEN_R_WORK (Expand==BINARY_EXPAND ? "r" : "rb") 83# define FOPEN_WB "wb" 84# define FOPEN_W_WORK (Expand==BINARY_EXPAND ? "w" : "wb") 85# define FOPEN_WPLUS_WORK (Expand==BINARY_EXPAND ? "w+" : "w+b") 86# define OPEN_O_BINARY O_BINARY 87#else 88 /* 89 * Text and binary i/o behave the same. 90 * Omit "b", since some nonstandard hosts reject it. 91 */ 92# define FOPEN_RB "r" 93# define FOPEN_R_WORK "r" 94# define FOPEN_WB "w" 95# define FOPEN_W_WORK "w" 96# define FOPEN_WPLUS_WORK "w+" 97# define OPEN_O_BINARY 0 98#endif 99 100/* This may need changing on non-Unix systems (notably DOS). */ 101#define OPEN_CREAT_READONLY (S_IRUSR|S_IRGRP|S_IROTH) /* lock file mode */ 102#define OPEN_O_LOCK 0 /* extra open flags for creating lock file */ 103#define OPEN_O_WRONLY O_WRONLY /* main open flag for creating a lock file */ 104 105/* Define or comment out the following symbols as needed. */ 106#if has_prototypes 107# define P(params) params 108#else 109# define P(params) () 110#endif 111#if has_stdarg 112# include <stdarg.h> 113#else 114# if has_varargs 115# include <varargs.h> 116# else 117 typedef char *va_list; 118# define va_dcl int va_alist; 119# define va_start(ap) ((ap) = (va_list)&va_alist) 120# define va_arg(ap,t) (((t*) ((ap)+=sizeof(t))) [-1]) 121# define va_end(ap) 122# endif 123#endif 124#if va_start_args == 2 125# define vararg_start va_start 126#else 127# define vararg_start(ap,p) va_start(ap) 128#endif 129#define bad_chmod_close 0 /* Can chmod() close file descriptors? */ 130#define bad_creat0 0 /* Do writes fail after creat(f,0)? */ 131#define bad_fopen_wplus 0 /* Does fopen(f,"w+") fail to truncate f? */ 132#define getlogin_is_secure 0 /* Is getlogin() secure? Usually it's not. */ 133#define has_attribute_noreturn 1 /* Does __attribute__((noreturn)) work? */ 134#if has_attribute_noreturn 135# define exiting __attribute__((noreturn)) 136#else 137# define exiting 138#endif 139#define has_dirent 1 /* Do opendir(), readdir(), closedir() work? */ 140#define void_closedir 0 /* Does closedir() yield void? */ 141#define has_fchmod 1 /* Does fchmod() work? */ 142#define has_fflush_input 0 /* Does fflush() work on input files? */ 143#define has_fputs 1 /* Does fputs() work? */ 144#define has_ftruncate 1 /* Does ftruncate() work? */ 145#define has_getuid 1 /* Does getuid() work? */ 146#define has_getpwuid 1 /* Does getpwuid() work? */ 147#define has_memcmp 1 /* Does memcmp() work? */ 148#define has_memcpy 1 /* Does memcpy() work? */ 149#define has_memmove 1 /* Does memmove() work? */ 150#define has_map_fd 0 /* Does map_fd() work? */ 151#define has_mmap 1 /* Does mmap() work on regular files? */ 152#define has_madvise 0 /* Does madvise() work? */ 153#define mmap_signal SIGBUS /* signal received if you reference nonexistent part of mmapped file */ 154#define has_rename 1 /* Does rename() work? */ 155#define bad_a_rename 0 /* Does rename(A,B) fail if A is unwritable? */ 156#define bad_b_rename 0 /* Does rename(A,B) fail if B is unwritable? */ 157#define bad_NFS_rename 0 /* Can rename(A,B) falsely report success? */ 158/* typedef int void; */ /* Some ancient compilers need this. */ 159#define VOID (void) /* 'VOID e;' discards the value of an expression 'e'. */ 160#define has_seteuid 1 /* Does seteuid() work? See ../INSTALL.RCS. */ 161#define has_setreuid 0 /* Does setreuid() work? See ../INSTALL.RCS. */ 162#define has_setuid 1 /* Does setuid() exist? */ 163#define has_sigaction 1 /* Does struct sigaction work? */ 164#define has_sa_sigaction 1 /* Does struct sigaction have sa_sigaction? */ 165#define has_signal 1 /* Does signal() work? */ 166#define signal_type void /* type returned by signal handlers */ 167#define sig_zaps_handler 0 /* Must a signal handler reinvoke signal()? */ 168/* #define has_sigblock ? */ /* Does sigblock() work? */ 169/* #define sigmask(s) (1 << ((s)-1)) */ /* Yield mask for signal number. */ 170typedef size_t fread_type; /* type returned by fread() and fwrite() */ 171typedef size_t freadarg_type; /* type of their size arguments */ 172typedef void *malloc_type; /* type returned by malloc() */ 173#define has_getcwd 1 /* Does getcwd() work? */ 174/* #define has_getwd ? */ /* Does getwd() work? */ 175#define needs_getabsname 0 /* Must we define getabsname? */ 176#define has_mktemp 1 /* Does mktemp() work? */ 177#define has_mkstemp 1 /* Does mkstemp() work? (needs has_mktemp=1 too) */ 178#define has_NFS 1 /* Might NFS be used? */ 179#define has_psiginfo 0 /* Does psiginfo() work? */ 180#define has_psignal 1 /* Does psignal() work? */ 181/* #define has_si_errno ? */ /* Does siginfo_t have si_errno? */ 182/* #define has_sys_siglist ? */ /* Does sys_siglist[] work? */ 183/* #define strchr index */ /* Use old-fashioned name for strchr()? */ 184/* #define strrchr rindex */ /* Use old-fashioned name for strrchr()? */ 185#define bad_unlink 0 /* Does unlink() fail on unwritable files? */ 186#define has_vfork 1 /* Does vfork() work? */ 187#define has_fork 1 /* Does fork() work? */ 188#define has_spawn 0 /* Does spawn*() work? */ 189#define has_waitpid 1 /* Does waitpid() work? */ 190#define bad_wait_if_SIGCHLD_ignored 0 /* Does ignoring SIGCHLD break wait()? */ 191#define RCS_SHELL "/bin/sh" /* shell to run RCS subprograms */ 192#define has_printf_dot 1 /* Does "%.2d" print leading 0? */ 193#define has_vfprintf 1 /* Does vfprintf() work? */ 194#define has_attribute_format_printf 1 /* Does __attribute__((format(printf,N,N+1))) work? */ 195#if has_attribute_format_printf 196# define printf_string(m, n) __attribute__((format(printf, m, n))) 197#else 198# define printf_string(m, n) 199#endif 200#if has_attribute_format_printf && has_attribute_noreturn 201 /* Work around a bug in GCC 2.5.x. */ 202# define printf_string_exiting(m, n) __attribute__((format(printf, m, n), noreturn)) 203#else 204# define printf_string_exiting(m, n) printf_string(m, n) exiting 205#endif 206/* #define has__doprintf ? */ /* Does _doprintf() work? */ 207/* #define has__doprnt ? */ /* Does _doprnt() work? */ 208/* #undef EXIT_FAILURE */ /* Uncomment this if EXIT_FAILURE is broken. */ 209#define large_memory 1 /* Can main memory hold entire RCS files? */ 210#ifndef LONG_MAX 211#define LONG_MAX 2147483647L /* long maximum */ 212#endif 213/* Do struct stat s and t describe the same file? Answer d if unknown. */ 214#define same_file(s,t,d) ((s).st_ino==(t).st_ino && (s).st_dev==(t).st_dev) 215#define has_utimbuf 1 /* Does struct utimbuf work? */ 216#define CO "/usr/bin/co" /* name of 'co' program */ 217#define COMPAT2 0 /* Are version 2 files supported? */ 218#define DIFF "/usr/bin/diff" /* name of 'diff' program */ 219#define DIFF3 "/usr/bin/diff3" /* name of 'diff3' program */ 220#define DIFF3_BIN 1 /* Is diff3 user-visible (not the /usr/lib auxiliary)? */ 221#define DIFFFLAGS "-an" /* Make diff output suitable for RCS. */ 222#define DIFF_L 1 /* Does diff -L work? */ 223#define DIFF_SUCCESS 0 /* DIFF status if no differences are found */ 224#define DIFF_FAILURE 1 /* DIFF status if differences are found */ 225#define DIFF_TROUBLE 2 /* DIFF status if trouble */ 226#define ED "/bin/ed" /* name of 'ed' program (used only if !DIFF3_BIN) */ 227#define MERGE "/usr/bin/merge" /* name of 'merge' program */ 228#define TMPDIR "/tmp" /* default directory for temporary files */ 229#define SLASH '/' /* principal filename separator */ 230#define SLASHes '/' /* `case SLASHes:' labels all filename separators */ 231#define isSLASH(c) ((c) == SLASH) /* Is arg a filename separator? */ 232#define ROOTPATH(p) isSLASH((p)[0]) /* Is p an absolute pathname? */ 233#define X_DEFAULT ",v/" /* default value for -x option */ 234#define SLASHSLASH_is_SLASH 1 /* Are // and / the same directory? */ 235#define ALL_ABSOLUTE 1 /* Do all subprograms satisfy ROOTPATH? */ 236#define DIFF_ABSOLUTE 1 /* Is ROOTPATH(DIFF) true? */ 237#define SENDMAIL "/usr/bin/mail" /* how to send mail */ 238#define TZ_must_be_set 0 /* Must TZ be set for gmtime() to work? */ 239 240 241 242/* Adjust the following declarations as needed. */ 243 244 245/* The rest is for the benefit of non-standard, traditional hosts. */ 246/* Don't bother to declare functions that in traditional hosts do not appear, */ 247/* or are declared in .h files, or return int or void. */ 248 249 250/* traditional BSD */ 251 252#if has_sys_siglist && !defined(sys_siglist) 253 extern char const * const sys_siglist[]; 254#endif 255 256 257/* Posix (ISO/IEC 9945-1: 1990 / IEEE Std 1003.1-1990) */ 258 259/* <fcntl.h> */ 260#ifdef O_CREAT 261# define open_can_creat 1 262#else 263# define open_can_creat 0 264# define O_RDONLY 0 265# define O_WRONLY 1 266# define O_RDWR 2 267# define O_CREAT 01000 268# define O_TRUNC 02000 269#endif 270#ifndef O_EXCL 271#define O_EXCL 0 272#endif 273 274/* <sys/stat.h> */ 275#ifndef S_IRUSR 276# ifdef S_IREAD 277# define S_IRUSR S_IREAD 278# else 279# define S_IRUSR 0400 280# endif 281# ifdef S_IWRITE 282# define S_IWUSR S_IWRITE 283# else 284# define S_IWUSR (S_IRUSR/2) 285# endif 286#endif 287#ifndef S_IRGRP 288# if has_getuid 289# define S_IRGRP (S_IRUSR / 0010) 290# define S_IWGRP (S_IWUSR / 0010) 291# define S_IROTH (S_IRUSR / 0100) 292# define S_IWOTH (S_IWUSR / 0100) 293# else 294 /* single user OS -- not Posix or Unix */ 295# define S_IRGRP 0 296# define S_IWGRP 0 297# define S_IROTH 0 298# define S_IWOTH 0 299# endif 300#endif 301#ifndef S_ISREG 302#define S_ISREG(n) (((n) & S_IFMT) == S_IFREG) 303#endif 304 305/* <sys/wait.h> */ 306#ifndef WEXITSTATUS 307#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) 308#undef WIFEXITED /* Avoid 4.3BSD incompatibility with Posix. */ 309#endif 310#ifndef WIFEXITED 311#define WIFEXITED(stat_val) (((stat_val) & 0377) == 0) 312#endif 313#ifndef WTERMSIG 314#define WTERMSIG(stat_val) ((stat_val) & 0177) 315#undef WIFSIGNALED /* Avoid 4.3BSD incompatibility with Posix. */ 316#endif 317#ifndef WIFSIGNALED 318#define WIFSIGNALED(stat_val) ((unsigned)(stat_val) - 1 < 0377) 319#endif 320 321/* <unistd.h> */ 322char *getlogin P((void)); 323#ifndef STDIN_FILENO 324# define STDIN_FILENO 0 325# define STDOUT_FILENO 1 326# define STDERR_FILENO 2 327#endif 328#if has_fork && !has_vfork 329# undef vfork 330# define vfork fork 331#endif 332#if has_getcwd || !has_getwd 333 char *getcwd P((char*,size_t)); 334#else 335 char *getwd P((char*)); 336#endif 337#if has_setuid && !has_seteuid 338# undef seteuid 339# define seteuid setuid 340#endif 341#if has_spawn 342# if ALL_ABSOLUTE 343# define spawn_RCS spawnv 344# else 345# define spawn_RCS spawnvp 346# endif 347#else 348# if ALL_ABSOLUTE 349# define exec_RCS execv 350# else 351# define exec_RCS execvp 352# endif 353#endif 354 355/* utime.h */ 356#if !has_utimbuf 357 struct utimbuf { time_t actime, modtime; }; 358#endif 359 360 361/* Standard C library */ 362 363/* <stdio.h> */ 364#ifndef L_tmpnam 365#define L_tmpnam 32 /* power of 2 > sizeof("/usr/tmp/xxxxxxxxxxxxxxx") */ 366#endif 367#ifndef SEEK_SET 368#define SEEK_SET 0 369#endif 370#ifndef SEEK_CUR 371#define SEEK_CUR 1 372#endif 373#if has_mktemp 374 char *mktemp P((char*)); /* traditional */ 375#else 376 char *tmpnam P((char*)); 377#endif 378 379/* <stdlib.h> */ 380char *getenv P((char const*)); 381#ifndef __NetBSD__ 382void _exit P((int)) exiting; 383void exit P((int)) exiting; 384#endif 385malloc_type malloc P((size_t)); 386malloc_type realloc P((malloc_type,size_t)); 387#ifndef EXIT_FAILURE 388#define EXIT_FAILURE 1 389#endif 390#ifndef EXIT_SUCCESS 391#define EXIT_SUCCESS 0 392#endif 393 394/* <string.h> */ 395char *strcpy P((char*,char const*)); 396char *strchr P((char const*,int)); 397char *strrchr P((char const*,int)); 398void *memcpy P((void*,void const*,size_t)); 399#if has_memmove 400 void *memmove P((void*,void const*,size_t)); 401#endif 402 403/* <time.h> */ 404time_t time P((time_t*)); 405