Macro SVR4 or __SVR4 for Xorg on Solaris
By williamxue on Apr 07, 2009
During investigate Opensolaris bug 6824625(And 6728611 ) . There is a issue about macro Xorg, the Xorg seems to be a remnant of old Imake world. For example, in app/luit/sys.c, it always use #ifdef SVR4 as switch. but on Solaris there is no pre-define for "SVR4", only pre-define "__SVR4". (check : CC -xdumpmacros -c dummy.c). For resolve this issue, X team support a header file <X11/Xosdefs.h>. So please include this header file in the program which need use CC or gcc pre-define macros. In Xosdefs.h:
#ifdef sun /\* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4 \* This check allows non-Imake configured programs to build correctly. \*/ #if defined(__SVR4) && !defined(SVR4) #define SVR4 1 #endif #endifThis issue also be discussed in xorg mail-list early (Some portabity issues). Alan gave the solution on Solaris.