Look again at standards(5).

Something like the following should work (simplified, i.e. I'm not using "make"
in this example):

OSVERS="`uname -s`-`uname -r`"
case "${OSVERS}" in
SunOS-5.[89]) BEST_STD_FLAG="-D_XOPEN_SOURCE=500";;
SunOS-5.1[01]) BEST_STD_FLAG="-D_XOPEN_SOURCE=600";;
*) echo "unsupported OS-version=${OSVERS}"; exit 1;;
esac

# ok if not all the following directories exist.  Use your own (if any) in
# place of /opt/local/bin, which is assumed to contain any tools that
# don't come with the system.  Maybe you want /usr/sfw/bin or something
# else, too...
PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:/opt/local/bin;export
 PATH

cc ${BEST_STD_FLAG} foo.c -o foo


That works because _XOPEN_SOURCE=500 (or 600) implies the flags needed
for lesser included standards as well; the header files will take care of that.
If you're curious about all the ugly details that you're _not_ really supposed
to depend on directly, look at sys/feature_tests.h

I agree it would be nice if the shmdt(2) man page had said "standard-conforming
version of shmdt() first appeared in XPG4" or something like that.

I don't know off the top of my head if autoconf/configure takes care of that
sort of thing for you by default, but I expect it could be made to without too
much trouble, and you could probably find plenty of examples to help you do
that sort of thing, although again, it's not something I've yet had to do 
myself.
--
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to