b306088153f3fba6bd12e64d94ed9a0c472de820
[chise/xemacs-chise.git.1] / src / s / sol2.h
1 /* Synched up with: Completely divergent from FSF. */
2 #define SOLARIS2 1
3 #define POSIX 1
4
5 #ifndef USG
6 #define USG
7 #endif
8
9 #ifndef USG5_4
10 #define USG5_4
11 #endif
12
13 #if OS_RELEASE >= 57
14 #define HAVE_GETLOADAVG
15 #endif
16
17 /* Fix understandable GCC lossage on Solaris 2.6 */
18 #if defined(__GNUC__) && OS_RELEASE >= 56 && !defined(NOT_C_CODE)
19
20 /* GCC va_list munging is a little messed up */
21 #define __GNUC_VA_LIST
22 #define _VA_LIST_
23 #define _VA_LIST va_list
24 typedef void *__gnuc_va_list;
25 typedef __gnuc_va_list va_list;
26
27 /* Missing prototypes for functions added in Solaris 2.6 */
28 #include <sys/types.h>
29 struct msghdr;
30 struct sockaddr;
31 extern int     __xnet_bind    (int, const struct sockaddr *, size_t);
32 extern int     __xnet_listen  (int, int);
33 extern int     __xnet_connect (int, const struct sockaddr *, size_t);
34 extern ssize_t __xnet_recvmsg (int, struct msghdr *, int);
35 extern ssize_t __xnet_sendmsg (int, const struct msghdr *, int);
36 extern ssize_t __xnet_sendto  (int, const void *, size_t, int, const struct sockaddr *, size_t);
37 extern int     __xnet_socket  (int, int, int);
38 extern int     __xnet_socketpair (int, int, int, int *);
39 extern int     __xnet_getsockopt (int, int, int, void *, size_t *);
40 #endif /* GCC && >= Solaris 2.6 && C code */
41
42 #include "usg5-4-2.h"   /* XEmacs change from 5-4 to 5-4-2 */
43 #undef PC /* Defined in x86 /usr/include/sys/reg.h */
44
45 /* SIGIO seems to be working under Solaris and it makes ^G work better... */
46 #undef BROKEN_SIGIO
47
48 /* eggert@twinsun.com said these work in Solaris.
49    Perhaps they work in all kinds of SVR4, but this is more conservative.  */
50 #undef BROKEN_TIOCGETC
51 #undef BROKEN_TIOCGWINSZ
52
53 #ifdef NOT_C_CODE
54 #define ORDINARY_LINK
55 /* XEmacs change -- some Motif packages need -lgen to get regex and regcmp */
56
57 #undef LIBS_SYSTEM
58 #define LIBS_SYSTEM "-lsocket -lnsl -lelf -lgen -ldl"
59
60 /* SYSTEM_MALLOC must be defined if dbx/RTC is going to be used.  dbx/RTC does
61    not work with a static definition of malloc(). */
62 /* We want to be able to test out ralloc.c. */
63 /* #define SYSTEM_MALLOC */
64
65 /* XEmacs: there used to be a special definition of
66    PTY_TTY_NAME_SPRINTF here that was identical to the
67    other SYSV R4 definitions except that it didn't
68    block SIGCHLD around the call to grantpt().  This
69    is *not* in 19.29 and is almost certainly incorrect.
70  */
71
72 #undef UNEXEC
73 #if OS_RELEASE < 56
74 #define UNEXEC "unexsol2.o"
75 #else
76 #define UNEXEC "unexsol2-6.o"
77 #endif
78
79 #else /* C_CODE */
80
81 #if OS_RELEASE <= 53
82 /* Solaris 2.3 has a bug in XListFontsWithInfo.  */
83 #define BROKEN_XLISTFONTSWITHINFO
84 #endif
85
86 /* XEmacs addition: Raymond Toy says XEmacs completely misses SIGCHLD
87    when compiled with GCC 2.7.0 (but not, apparently, with SunPro C?),
88    X11R6, and Solaris 2.4.
89
90    Someone else submitted a simple test program that duplicates this
91    behavior, and says it has something to do with the fact that X11R6
92    links with the threads library. */
93
94 #ifdef THIS_IS_X11R6
95 #define BROKEN_SIGCHLD
96 #endif
97
98 #if OS_RELEASE < 55
99
100 #if __STDC__ == 1 && defined(__SUNPRO_C)
101 #define _POSIX_C_SOURCE 1
102 #include <setjmp.h>
103 #undef _POSIX_C_SOURCE
104 #endif /* cc -Xc */
105
106 /* Missing prototype, added in Solaris 2.5 */
107 extern void *__builtin_alloca (size_t);
108 #endif /* before SunOS 5.5 */
109
110 #if OS_RELEASE == 55
111 /* The following functions were added in Solaris 2.5,
112    but they forgot to add prototypes to the system header files. */
113 int getpagesize (void);
114 long random (void);
115 void srandom (unsigned int seed);
116 int usleep (unsigned int useconds);
117 #endif /* SunOS 5.5 */
118
119 /* 2.5 now has `random' back in libc but we don't want to use it. */
120 #if OS_RELEASE >= 55
121 #undef HAVE_RANDOM
122 /* Apparently not necessary here, and it causes 10% CPU chewage. */
123 #undef BROKEN_SIGCHLD
124 #endif /* >= SunOS 5.5 */
125
126 #if OS_RELEASE < 56
127 /* Missing prototypes, added in Solaris 2.6 */
128 struct timeval;
129 int utimes (char *file, struct timeval *tvp);
130 int gethostname (char *name, int namelen);
131 #endif /* before SunOS 5.6 */
132
133 #include <sys/utsname.h> /* warning: macro redefined: SYS_NMLN */
134
135 /* XEmacs: Solaris has sigsetjmp but using it leads to core dumps at
136    least under 2.4 */
137 #undef _setjmp
138 #define _setjmp setjmp
139
140 #endif /* C_CODE */