I have a feeling that you are not the only test-for-individual-features
advocate who cannot explain how it would work in an actual case.
Refer to the Feature Test Macros section in
http://docs.sun.com/app/docs/doc/816-0220/6m6nkorrh?a=view. I think
test-for-features does depend on symbols predefined by the compiler. IMHO
test-for-features is a concept, whether one uses tools is an implementation
issue. I think one can achieve the goal without using autoconf, for example.
One can include those _POSIX_C_SOURCE=199309L stuff manually in a program.
Actually I did that in one of my programs:
#if defined __SUNPRO_C /* if Sun cc is used on Solaris */
#if defined __SunOS_5_9
#define _XOPEN_SOURCE
#define _XOPEN_VERSION 4
#elif defined __SunOS_5_10
#define _POSIX_C_SOURCE 200112L
#endif
#elif defined __GNUC__ && defined __sun /* if a GCC-compatible compiler is
used on Solaris. GCC cannot
determine the Solaris version, so
the two Solaris 9 macros are used
because they are (expected to be)
valid in Solaris 10 (and above). */
#define _XOPEN_SOURCE
#define _XOPEN_VERSION 4
#endif
This is done in order to use the POSIX-conformed prototype of shmdt() on
Solaris, which requires the definition of _XOPEN_SOURCE and _XOPEN_VERSION=4.
And it is pain to find out which macro to #include because Sun fails to
indicate that in the man page of shmdt().
Another example is:
#ifdef __sun
#define _POSIX_PTHREAD_SEMANTICS /* POSIX conformance of sigwait()
on Solaris requires the definition
of _POSIX_PTHREAD_SEMANTICS */
#endif
static sigset_t usr2;
int func()
{
int ret, sig;
ret = sigwait(&usr2, &sig);
...
}
One can see that I still need to test for __sun and the Solaris version above.
That goes to my original question: whether there are such for Open Solaris.
Someone seemed to suggest that test-for-features would eliminate that need.
OK, tell me how in these actual cases.
And if one cannot do it by hand, then one can't do it by tools either.
--
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
[email protected]