(Answer) (Category) SCO comp.unix.sco.programmer FAQ. : (Category) SCO Development Environments. :
How to detect SCO product or version at compile time?
Ordinarily, this is a bad idea. Rather than basing your code on "am I on OpenServer or not?", you're typically more interested in, say, "do I have mmap(S) or not?" Programs like GNU autoconf provide a powerful way to test for features.

The SCO provided compilers and the GCC's that are truly OpenServer-aware all provide a manifest "_SCO_DS" that is set to one when targeting SCO OpenServer.



robertlipe@usa.net

That having been said heres some code that attempts to detect the various SCO
platforms upto and including Gemini - It will probably report UDK on 
Osr5 and UW as Gemini I.

#include <stdio.h>

main()
{
#if defined(_SCO_DS)
   printf("OpenServer\n");
#elif defined(__UNIXWARE__)
   printf("UnixWare gcc\n");
#elif defined(__USLC__)
#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ == 199409
   printf("Gemini I cc\n");
#else
   printf("UnixWare cc\n");
#endif
#elif defined(M_UNIX)
   printf("ODT 3 or earlier\n");
#else
   printf("Other platform\n");
#endif
}   
hops@sco.com
Heres a slight update that understands UW7 CC

#include <stdio.h>
   
main()
{
#if defined(_SCO_DS)
   printf("OpenServer\n");
#elif defined(__UNIXWARE__)
   printf("UnixWare gcc\n");
#elif defined(__USLC__)
# if defined( __STDC_VERSION__ ) && __STDC_VERSION__ == 199409
   printf("Gemini I cc (UW7 and UDK)\n");
# else
#    if defined(__SCO_VERSION__)
   printf("Gemini I CC (UW7 and UDK)\n");
#    else
   printf("UnixWare cc\n");
#    endif  /* SCO_VERSION */
# endif     /* STDC_VERSION */
#elif defined(M_UNIX)
   printf("ODT 3 or earlier\n");
#else
   printf("Other platform\n");
#endif


/*  uw7 ccs */
#if defined(__SCO_VERSION__)
   printf("__SCO_VERSION__ is %ld\n", __SCO_VERSION__);
#endif

}  
hops@sco.com
[Append to This Answer]
Previous: (Answer) How can I read kernel data through /dev/kmem in a user program?
Next: (Answer) How to write dialers
This document is: http://www.zenez.com/cgi-bin/scoprogfaq/faq?file=18
[Search] [Appearance]
This is a Faq-O-Matic 2.721.