generic.h (7046B)
1 /* generic.h -- anything you don't #undef at the end remains in effect. 2 The ONLY things that go in here are generic indicator flags; it's up 3 to your programs to declare and call things based on those flags. 4 5 You should only need to make changes via a minimal system-specific section 6 at the end of this file. To build a new section, rip through this and 7 check everything it mentions on your platform, and #undef that which needs 8 it. If you generate a system-specific section you didn't find in here, 9 please mail me a copy so I can update the "master". 10 11 I realize I'm probably inventing another pseudo-standard here, but 12 goddamnit, everybody ELSE has already, and I can't include all of their 13 hairball schemes too. HAVE_xx conforms to the gnu/autoconf usage and 14 seems to be the most common format. In fact, I dug a lot of these out 15 of autoconf and tried to common them all together using "stupidh" to 16 collect data from platforms. 17 18 In disgust... _H* 940910, 941115. Pseudo-version: 1.1 */ 19 20 #ifndef GENERIC_H /* only run through this once */ 21 #define GENERIC_H 22 23 /* =============================== */ 24 /* System calls, lib routines, etc */ 25 /* =============================== */ 26 27 /* How does your system declare malloc, void or char? Usually void, but go 28 ask the SunOS people why they had to be different... */ 29 #define VOID_MALLOC 30 31 /* notably from fwtk/firewall.h: posix locking? */ 32 #define HAVE_FLOCK /* otherwise it's lockf() */ 33 34 /* if you don't have setsid(), you might have setpgrp(). 35 #define HAVE_SETSID 36 37 /* random() is generally considered better than rand() */ 38 /* xxx: rand48? */ 39 #define HAVE_RANDOM 40 41 /* if your machine doesn't have lstat(), it should have stat() [dos...] */ 42 #define HAVE_LSTAT 43 44 /* different kinds of term ioctls. How to recognize them, very roughly: 45 sysv/POSIX_ME_HARDER: termio[s].h, struct termio[s], tty.c_*[] 46 bsd/old stuff: sgtty.h, ioctl(TIOCSETP), sgttyb.sg_*, tchars.t_* 47 #define HAVE_TERMIOS 48 49 /* dbm vs ndbm */ 50 #define HAVE_NDBM 51 52 /* extended utmp/wtmp stuff. MOST machines still do NOT have this SV-ism */ 53 #define UTMPX 54 55 /* some systems have nice() which takes *relative* values... [resource.h] */ 56 #define HAVE_SETPRIORITY 57 58 /* a sysvism, I think, but ... */ 59 #define HAVE_SYSINFO 60 61 /* punted for now: setown / siocspgrp ... see firewall.h */ 62 63 /* ============= */ 64 /* Include files */ 65 /* ============= */ 66 67 /* Presence of these can be determined via a script that sniffs them 68 out if you aren't sure. */ 69 70 /* stdlib comes with most modern compilers, but ya never know */ 71 #define HAVE_STDLIB_H 72 73 /* not on a DOS box! */ 74 #define HAVE_UNISTD_H 75 76 /* stdarg is a weird one */ 77 #define HAVE_STDARG_H 78 79 /* dir.h or maybe ndir.h otherwise. */ 80 #define HAVE_DIRENT_H 81 82 /* string or strings */ 83 #define HAVE_STRINGS_H 84 85 /* if you don't have lastlog.h, what you want might be in login.h */ 86 #define HAVE_LASTLOG_H 87 88 /* predefines for _PATH_various */ 89 #define HAVE_PATHS_H 90 91 /* assorted others */ 92 #define HAVE_PARAM_H 93 #define HAVE_SYSMACROS_H /* in sys/! */ 94 #define HAVE_TTYENT_H /* securetty et al */ 95 96 /* ==================== */ 97 98 /* Still maybe have to do something about the following, if it's even 99 worth it. I just grepped a lot of these out of various code, without 100 looking them up yet: 101 102 #define HAVE_EINPROGRESS 103 #define HAVE_F_SETOWN 104 #define HAVE_SETENV ... now *there's* a hairy one; **environ is portable 105 #define BIG_ENDIAN/little_endian ... *please* try to avoid this stupidity 106 #define HAVE_GETUSERSHELL ... you could always pull it out of getpwent() 107 #define HAVE_SETE[UG]ID ... lib or syscall, it varies on diff platforms 108 #define HAVE_STRCHR ... should actually be handled by string/strings 109 #define HAVE_PSTAT 110 #define HAVE_ST_BLKSIZE ... a stat() thing? 111 #define HAVE_IP_TOS 112 #define HAVE_STRFTIME ... screw this, we should just INCLUDE one for lame 113 old boxes that don't have it [sunos 3.x, early 4.x?] 114 #define HAVE_VFPRINTF 115 #define HAVE_SHADOW_PASSWD ... in its multitudinous schemes?? ... how 116 about sumpin' like #define SHADOW_PASSWD_TYPE ... could get grody. 117 #define SIG* ... what a swamp, punt for now; should all be in signal.h 118 #define HAVE_STRCSPN ... see larry wall's comment in the fwtk regex code 119 #define ULTRIX_AUTH ... bwahaha. 120 #define HAVE_YP or NIS or whatever you wanna call it this week 121 randomness about VARARGS?? 122 123 There's also the issue about WHERE various .h files live, sys/ or otherwise. 124 There's a BIG swamp lurking where network code of any sort lives. 125 126 */ 127 128 /* ======================== */ 129 /* System-specific sections */ 130 /* ======================== */ 131 132 /* By turning OFF various bits of the above, you can customize for 133 a given platform. /* 134 135 /* DOS boxes, with MSC; you may need to adapt to a different compiler. */ 136 #ifdef MSDOS 137 #undef HAVE_FLOCK 138 #undef HAVE_RANDOM 139 #undef HAVE_LSTAT 140 #undef HAVE_TERMIOS 141 #undef UTMPX 142 #undef HAVE_SYSINFO 143 #undef HAVE_UNISTD_H 144 #undef HAVE_DIRENT_H /* unless you have the k00l little wrapper from L5!! */ 145 #undef HAVE_STRINGS_H 146 #undef HAVE_LASTLOG_H 147 #undef HAVE_PATHS_H 148 #undef HAVE_PARAM_H 149 #undef HAVE_SYSMACROS_H 150 #undef HAVE_TTYENT_H 151 #endif /* MSDOS */ 152 153 /* buglix 4.x; dunno about 3.x on down. should be bsd4.2. */ 154 #ifdef ULTRIX 155 #undef UTMPX 156 #undef HAVE_PATHS_H 157 #undef HAVE_SYSMACROS_H 158 #endif /* buglix */ 159 160 /* some of this might still be broken on older sunoses */ 161 #ifdef SUNOS 162 #undef VOID_MALLOC 163 #undef UTMPX 164 #undef HAVE_PATHS_H 165 #endif /* sunos */ 166 167 /* "contact your vendor for a fix" */ 168 #ifdef SOLARIS 169 /* has UTMPX */ 170 #undef HAVE_SETPRIORITY 171 #undef HAVE_STRINGS_H /* this is genuinely the case, go figure */ 172 #undef HAVE_PATHS_H 173 #undef HAVE_TTYENT_H 174 #endif /* SOLARIS */ 175 176 /* whatever aix variant MIT had at the time */ 177 #ifdef AIX 178 #undef UTMPX 179 #undef HAVE_LASTLOG_H 180 #define HAVE_LOGIN_H /* "special", in the educational sense */ 181 #endif /* aix */ 182 183 /* linux, which is trying as desperately as the gnu folks can to be 184 POSIXLY_CORRECT. I think I'm gonna hurl... */ 185 #ifdef LINUX 186 #undef UTMPX 187 #undef HAVE_SYSINFO 188 #undef HAVE_TTYENT_H 189 #endif /* linux */ 190 191 /* irix 5.x; may not be correct for earlier ones */ 192 #ifdef IRIX 193 /* wow, does irix really have everything?! */ 194 #endif /* irix */ 195 196 /* osf on alphas */ 197 #ifdef OSF 198 #undef UTMPX 199 #endif /* osf */ 200 201 /* they's some FUCKED UP paths in this one! */ 202 #ifdef FREEBSD 203 #undef UTMPX 204 #undef HAVE_SYSINFO 205 #undef HAVE_LASTLOG_H 206 #undef HAVE_SYSMACROS_H 207 #endif /* freebsd */ 208 209 /* From the sidewinder site, of all places; may be unreliable */ 210 #ifdef BSDI 211 #undef UTMPX 212 #undef HAVE_LASTLOG_H 213 #undef HAVE_SYSMACROS_H 214 #undef HAVE_TTYENT_H 215 /* and their malloc.h was in sys/ ?! */ 216 #endif /* bsdi */ 217 218 /* netbsd/44lite, jives with amiga-netbsd from cactus */ 219 #ifdef NETBSD 220 #undef UTMPX 221 #undef HAVE_SYSINFO 222 #undef HAVE_LASTLOG_H 223 #endif /* netbsd */ 224 225 /* Make some "generic" assumptions if all else fails */ 226 #ifdef GENERIC 227 #undef HAVE_FLOCK 228 #if defined(SYSV) && (SYSV < 4) /* TW leftover: old SV doesnt have symlinks */ 229 #undef HAVE_LSTAT 230 #endif /* old SYSV */ 231 #undef HAVE_TERMIOS 232 #undef UTMPX 233 #undef HAVE_PATHS_H 234 #endif /* generic */ 235 236 /* ================ */ 237 #endif /* GENERIC_H */