From cc3112b6d0434d8e7ecbe3832a5aa48cd0f5185d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 24 Mar 2009 16:34:45 -0700 Subject: Add additional predefines needed to match Solaris compilers Signed-off-by: Alan Coopersmith --- main.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index a962ba5..6ae60f0 100644 --- a/main.c +++ b/main.c @@ -48,6 +48,10 @@ in this Software without prior written authorization from The Open Group. #include +#ifdef __sun +# include +#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; -- cgit v1.2.1