diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-03-24 16:34:45 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-03-24 19:52:10 -0700 |
commit | cc3112b6d0434d8e7ecbe3832a5aa48cd0f5185d (patch) | |
tree | a11ed4903ab92d146eaa314f07e7c1fe61b32db4 /main.c | |
parent | f871e026bedc296c235dae02e533617fe9a4d3f2 (diff) |
Add additional predefines needed to match Solaris compilers
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -48,6 +48,10 @@ in this Software without prior written authorization from The Open Group. #include <stdarg.h> +#ifdef __sun +# include <sys/utsname.h> +#endif + #ifdef DEBUG int _debugmask; #endif @@ -170,6 +174,25 @@ main(int argc, char *argv[]) define2(psymp->s_name, psymp->s_value, &maininclist); psymp++; } +#ifdef __sun + /* Solaris predefined values that are computed, not hardcoded */ + { + struct utsname name; + + if (uname(&name) >= 0) { + char osrevdef[SYS_NMLN + SYS_NMLN + 5]; + snprintf(osrevdef, sizeof(osrevdef), "__%s_%s", + name.sysname, name.release); + + for (p = osrevdef; *p != '\0'; p++) { + if (!isalnum(*p)) { + *p = '_'; + } + } + define2(osrevdef, "1", &maininclist); + } + } +#endif if (argc == 2 && argv[1][0] == '@') { struct stat ast; int afd; |