There are no predefined C compilation flags which will do this for you.
You can always roll your own. Here's one example:
quarry-228% cc a.c -c -DUNIX_V40=`uname -a | grep -c "V3.2"`
If you add -v you can see what the UNIX_V40 macro becomes:
quarry-229% cc a.c -c -DUNIX_V40=`uname -a | grep -c "V3.2"` -v
/usr/lib/cmplrs/cc/gemc_cc -D__LANGUAGE_C__ -D__unix__ -D__osf__ -D__alpha
-D_SYSTYPE_BSD -D_LONGLONG -DLANGUAGE_C -Dunix -DSYSTYPE_BSD -DUNIX_V40=0
-I/usr/include -preempt_symbol -g0 -O2 -std0 -o a.o a.c
quarry-230% cc a.c -c -DUNIX_V40=`uname -a | grep -c "V4.0"` -v
/usr/lib/cmplrs/cc/gemc_cc -D__LANGUAGE_C__ -D__unix__ -D__osf__ -D__alpha
-D_SYSTYPE_BSD -D_LONGLONG -DLANGUAGE_C -Dunix -DSYSTYPE_BSD -DUNIX_V40=1
-I/usr/include -preempt_symbol -g0 -O2 -std0 -o a.o a.c
Be careful about defining macros with decimal points in them. For
example -DVERSION=V3.2 treats V3.2 as two separate preprocessing
tokens. You're better off defining the macros to be zero or nonzero
numeric values.
|