Fix BSD and Sun problems after coverity fixes
[oweals/cde.git] / cde / config / cf / sun.cf
1 XCOMM platform:  $TOG: sun.cf /main/176 1997/12/09 17:27:51 kaleb $
2
3 #ifndef OSName
4 # define OSName         DefaultOSName
5 #endif
6 #ifndef OSMajorVersion
7 # define OSMajorVersion DefaultOSMajorVersion
8 #endif
9 #ifndef OSMinorVersion
10 # define OSMinorVersion DefaultOSMinorVersion
11 #endif
12 #ifndef OSTeenyVersion
13 # define OSTeenyVersion DefaultOSTeenyVersion
14 #endif
15 XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion)
16
17 /*
18  * Compiler setup.  This sun.cf file knows what options to use with 
19  * certain compilers, including Sun C and gcc.  It also understands
20  * how to set some of the options for various C++ compilers, including
21  * Sun C++ and g++.
22  *
23  * === C Compiler Setup ==========================================
24  *
25  * For SunPro C, define HasSunC to YES in host.def.
26  * For Gnu gcc, define HasGcc2 to YES in host.def
27  * For other compilers, define HasSunC to NO in host.def, then
28  *    provide appropriate values for the various compiler related
29  *    configuration varibles used here.
30  * 
31  * If you don't tell us which C compiler you have, we assume you have 
32  * the Gcc C compiler under Solaris 5.x.
33  * under SunOS 4.1.x
34  *
35  * === C++ Compiler Setup ==========================================
36  *
37  * For SunPro C++, define HasSunCplusplus to YES in host.def
38  * For Gnu g++ 4.x, define HasGcc2ForCplusplus to YES in host.def
39  * For other compilers, define HasCplusplus to YES in host.def, and
40  *    check to see if you need to provide values for CplusplusOptions
41  *    and/or DefaultCplusplusOptions.
42  *
43  * In any case, you may also need to set CplusplusDependIncludes.
44  *
45  * If you say you have the SunPro C++ compiler, we assume you have 
46  * version 5.0.x of the compiler.  If you have version 4.0.x instead,
47  * define CplusplusCompilerMajorVersion as 4 in host.def.
48  *
49  */
50
51 #ifndef HasSunC
52 # if (HasGcc || HasGcc2 || OSMajorVersion < 5)
53 #  define HasSunC NO
54 # else
55 #  define HasSunC YES
56 # endif
57 #endif
58
59 #if HasSunC 
60 # ifndef CCompilerMajorVersion
61 #  define CCompilerMajorVersion DefaultSunProCCompilerMajorVersion
62 # endif
63 # ifndef CCompilerMinorVersion
64 #  define CCompilerMinorVersion DefaultSunProCCompilerMinorVersion
65 # endif
66 XCOMM SunPro C CCompilerMajorVersion./**/CCompilerMinorVersion
67 #endif
68
69 #if HasSunCplusplus
70 # ifndef HasCplusplus
71 #  define HasCplusplus YES
72 # endif
73 # ifndef CplusplusCompilerMajorVersion
74 #  ifdef DefaultSunProCplusplusCompilerMajorVersion
75 #   define CplusplusCompilerMajorVersion DefaultSunProCplusplusCompilerMajorVersion
76 #  else
77 #   define CplusplusCompilerMajorVersion 3
78 #  endif
79 # endif
80 # ifndef CplusplusCompilerMinorVersion
81 #  ifdef DefaultSunProCplusplusCompilerMinorVersion
82 #   define CplusplusCompilerMinorVersion DefaultSunProCplusplusCompilerMinorVersion
83 #  else
84 #   define CplusplusCompilerMinorVersion 0
85 #  endif
86 # endif
87 XCOMM SunPro C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion
88 #endif
89
90 #if HasGcc2
91 # ifndef CCompilerMajorVersion
92 #  define CCompilerMajorVersion DefaultGnuCCompilerMajorVersion
93 # endif
94 # ifndef CCompilerMinorVersion
95 #  define CCompilerMinorVersion DefaultGnuCCompilerMinorVersion
96 # endif
97 XCOMM Gnu C CCompilerMajorVersion./**/CCompilerMinorVersion
98 #endif
99
100 #if HasGcc2ForCplusplus
101 # ifndef HasCplusplus
102 #  define HasCplusplus YES
103 # endif
104 # ifndef CplusplusCompilerMajorVersion
105 #  ifdef DefaultGnuCplusplusCompilerMajorVersion
106 #   define CplusplusCompilerMajorVersion DefaultGnuCplusplusCompilerMajorVersion
107 #  else
108 #   define CplusplusCompilerMajorVersion 4
109 #  endif
110 # endif
111 # ifndef CplusplusCompilerMinorVersion
112 #  ifdef DefaultGnuCplusplusCompilerMinorVersion
113 #   define CplusplusCompilerMinorVersion DefaultGnuCplusplusCompilerMinorVersion
114 #  else
115 #   define CplusplusCompilerMinorVersion 6
116 #  endif
117 # endif
118 XCOMM Gnu C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion
119 #endif
120
121
122 #if OSMajorVersion > 4
123 #define MkdirHierCmd            mkdir -p
124 #endif
125
126 #ifndef OptimizedCDebugFlags
127 # define OptimizedCDebugFlags   -O2
128 #endif
129
130 #if OSMajorVersion < 4 || (OSMajorVersion == 4 && OSMinorVersion < 1)
131 /* We do not guarantee this will work */
132 # define BootstrapCFlags        -DNOSTDHDRS
133 # define StandardDefines        -DNOSTDHDRS
134 # define XawI18nDefines         -DUSE_XWCHAR_STRING -DUSE_XMBTOWC
135 #endif
136
137 #if OSMajorVersion == 4 
138 # if OSMinorVersion == 1
139 #  define HasPoll               YES
140 # endif
141 # if OSMinorVersion > 1 || (OSMinorVersion == 1 && OSTeenyVersion > 1)
142 /* You ALSO need this if you have Sun ld patch 100170-06 or later to 4.1.1 */
143 #  define SunPost411FCSLd       YES
144 # endif
145 #endif
146
147 #ifdef i386Architecture
148 # if OSMajorVersion > 4
149 #  define ServerExtraDefines    AllocateLocalDefines XFree86ServerDefines
150 #  define ServerOSDefines       XFree86ServerOSDefines
151 # else
152 #  define ServerExtraDefines AllocateLocalDefines
153 #  define ServerOSDefines       -DDDXOSINIT
154 # endif
155 #else
156 # define ServerExtraDefines AllocateLocalDefines
157 # define ServerOSDefines        -DDDXOSINIT
158 # define HasPlugin              YES
159 #endif
160
161 #define XkbServerDefines  -DXKB_ALWAYS_USES_SOFT_REPEAT
162
163 #if OSMajorVersion > 4
164 #define ConnectionFlags         -DTCPCONN -DUNIXCONN -DLOCALCONN
165 #if HasSunC
166 /* 
167  * Assume /opt/solarisstudio/bin/ contains symlinks to the appropriate tools
168  */
169 #ifndef  CcCmd
170 # define CcCmd                  /opt/solarisstudio/bin/cc
171 #endif
172 #ifndef  CplusplusCmd
173 # define CplusplusCmd           /opt/solarisstudio/bin/CC
174 #endif
175 #ifndef  CplusplusFilt
176 #  define CplusplusFilt         /opt/solarisstudio/bin/c++filt
177 #endif
178 #ifndef CplusplusLibC
179 #define CplusplusLibC           -L/opt/solarisstudio/lib -lCrun
180 #endif
181 #ifndef OptimizedCplusplusDebugFlags
182 # define OptimizedCplusplusDebugFlags   -O2 -erroff=attrskipunsup
183 #endif
184 #ifndef  CplusplusDependIncludes
185 #if CplusplusCompilerMajorVersion > 3
186 # define CplusplusDependIncludes        -I/opt/solarisstudio/prod/include/CC -I/opt/solarisstudio/prod/include/CC/Cstd -I/opt/solarisstudio/prod/include/CC/std
187 #elif CplusplusCompilerMajorVersion > 2
188 # define CplusplusDependIncludes        -I/opt/SUNWspro/SC3.0/include/CC
189 #else
190 # define CplusplusDependIncludes        -I/opt/SUNWspro/SC2.0.1/include/CC
191 #endif
192 #endif
193 #endif
194 # if HasSunC && (CCompilerMajorVersion < 3)
195 #  define BootstrapCFlags       -DSVR4
196 # else
197 #  define BootstrapCFlags       /* none needed */
198 # endif
199 # ifndef XawI18nDefines
200 #  if OSMinorVersion < 4
201 #   define XawI18nDefines    -DHAS_WCTYPE_H -DHAS_ISW_FUNCS
202 #  else
203 #   define XawI18nDefines    -DHAS_WCHAR_H -DHAS_ISW_FUNCS
204 #  endif
205 # endif
206 # if OSMinorVersion > 10
207 #  define InstallCmd        /usr/bin/ginstall
208 # elif OSMinorVersion > 3
209 #  define InstallCmd        /usr/ucb/install
210 # endif
211 # if defined(i386Architecture)
212 #  define StandardDefines               -Dsun -Di386 -DSVR4 -D__i386
213 #  define ToolkitStringsABIOptions      -intelabi
214 # elif defined(SparcArchitecture)
215 #  define StandardDefines               -Dsun -Dsparc -DSVR4 -D__sparc
216 #  define ToolkitStringsABIOptions      -sparcabi
217 # else
218 #  define StandardDefines               -Dsun -DSVR4
219 #  define ToolkitStringsABIOptions      -sparcabi
220 # endif
221 # define ExtraLibraries    -lsocket -lnsl
222 # if OSMinorVersion > 1
223 #  define ThreadedX       YES
224 #  define MTSafeAPIDefines      -DXUSE_MTSAFE_API -DXUSE_NETDB_R_API
225 #  if HasSunC && CCompilerMajorVersion > 2
226 #   define ThreadsCompileFlags -mt
227 #  else
228 #   define SystemMTDefines -D_REENTRANT
229 #   define ThreadsLibraries -lthread
230 #  endif
231 #  if HasSunCplusplus && CplusplusCompilerMajorVersion > 3
232 #   define ThreadsCplusplusCompileFlags -mt
233 #  else
234 #   define CplusplusSystemMTDefines -D_REENTRANT
235 #   define ThreadsCplusplusLibraries -lthread
236 #  endif
237 # endif                 /* OSMinorVersion > 1 */
238 # ifndef UseExportLists
239 #  define UseExportLists   NO
240 # endif
241 # define HasVFork          NO
242 # define InstKmemFlags    -g sys -m 2711
243 # define ShLibIncludeFile <sunLib.tmpl>
244 /*
245  * Set flags for position independent code before including sv4Lib.rules
246  * if the compiler in use doesn't use standard SVR4 flags
247  */
248 # if HasSunC
249 #  define PositionIndependentCFlags -Kpic
250 #  define LargePositionIndependentCFlags -KPIC
251 # endif
252 # if HasSunCplusplus
253 #  define PositionIndependentCplusplusFlags -pic
254 #  define LargePositionIndependentCplusplusFlags -PIC
255 # endif
256 #else /* not OSMajorVersion > 4 */
257 #define InstKmemFlags     -g kmem -m 2711
258 #include <sunLib.rules>
259 #endif /* OSMajorVersion > 4 (else) */
260
261 #define BuildLibPathVar   LD_LIBRARY_PATH
262 #define HasNdbm           YES
263 #define HasShm            YES
264 #define HasSecureRPC      YES
265 #define SetTtyGroup       YES
266 #define HasPutenv         YES
267 #ifndef i386Architecture
268 # ifndef Xsun24Server
269 #  define Xsun24Server    NO            /* color, mono, multiple depths */
270 # endif
271 # ifndef XsunServer
272 #  define XsunServer      YES           /* color and mono, 8 bit only */
273 # endif
274 # ifndef XsunMonoServer
275 #  define XsunMonoServer          NO            /* monochrome only */
276 # endif
277 #endif /* not i386Architecture */
278
279 #if HasGcc || HasGcc2
280 # if OSMajorVersion > 4 && defined(i386Architecture)
281 #  ifndef DefaultCCOptions
282 #    define DefaultCCOptions -DNO_ASM
283 #  endif
284 # endif
285 # if HasGcc2
286 #  define SharedLibraryLoadFlags -shared
287 #  define ExtraLoadFlags -Wl,-rpath,$(USRLIBDIRPATH)
288 #  if defined(i386Architecture) || defined(SparcArchitecture)
289 #   define CcCmd                gcc
290 #  endif
291 # else
292 #  define SharedLibraryCcCmd cc
293 #  define ExtraLoadFlags -B/usr/bin/
294 #  define AllocateLocalDefines /**/
295
296 .c.o:
297         ClearmakeOSName $(CC) -c $(CFLAGS) $*.c
298
299 # endif /* HasGcc2 (else) */
300
301 #else /* not HasGcc, not HasGcc2 */
302
303 # define AllocateLocalDefines -DINCLUDE_ALLOCA_H
304
305 /* Set up compiler-dependent options for Sun C */
306
307 # if HasSunC
308 #  ifdef Sun3Architecture
309 #   ifndef DefaultCCOptions
310 #    define DefaultCCOptions -f68881 -pipe
311 #   endif
312 #  else /* not defined(Sun3Architecture) */
313 #   if OSMajorVersion < 5
314 #    ifndef DefaultCCOptions
315 #     define DefaultCCOptions -pipe
316 #    endif
317 #   else /* OSMajorVersion >= 5*/
318 #    ifndef DefaultCCOptions
319 #     define DefaultCCOptions -Xa
320 #    endif
321 #   endif       
322 #  endif        
323 # endif
324
325 # define PexCCOptions DefaultCCOptions
326
327 #endif /* HasGcc || HasGcc2 (else) */
328
329 #if HasGcc2
330 CXXDEPENDINCLUDE :sh = CcCmd -v -x c++ /dev/null -fsyntax-only \
331                        2>&1 | sed -n 's/^ \(\/.*[cg]++.*\)/-I\1/p'
332 #define CplusplusDependIncludes $(CXXDEPENDINCLUDE)
333 #endif
334
335 #if HasGcc2ForCplusplus
336 #define CplusplusCmd    g++
337 #ifndef CplusplusLibC
338 #define CplusplusLibC   -L/usr/gnu/lib -lstdc++
339 #endif
340 #endif /* HasGcc2ForCplusplus */
341
342
343 #if OSMajorVersion < 5
344 # define SharedAllocateLocalDefines -DINCLUDE_ALLOCA_H
345 # define LibraryCCOptions /* don't want special floating point */
346 #endif /* OSMajorVersion < 5 */
347
348 #if OSMajorVersion > 4
349 # include <svr4.cf>
350 #endif
351
352 #ifndef ManKeywordsTarget
353 # define ManKeywordsTarget(manpath)                                     @@\
354 man_keywords::                                                          @@\
355         catman -M $(DESTDIR)manpath -w
356 #endif
357
358 #if !defined(UsePamLibrary)
359 # if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 4))
360 #  define UsePamLibrary         NO
361 # endif
362 #endif
363
364 #if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
365 #define SharedLibXau YES
366 #define SharedXauRev 6
367 #define SharedLibXdmcp YES
368 #define SharedXdmcpRev 6
369 #endif
370
371 #define DependFileName          .depend
372 #if HasSunC
373 #define DependDefines           -D__BUILTIN_VA_ARG_INCR
374 #endif
375
376 #define LdPreLib                -L/usr/X11/lib -L$(BUILDLIBDIR)
377 #define PamUnixDefines          -DPAM_NIS
378 #define TtLargePICTable         YES
379 #define DtSvcDefines            -DMULTIBYTE -DNO_REGCOMP
380 #define DtSearchDefines         -DI18N_MSG DtSvcDefines
381 #define DtWidgetDefines         DtSearchDefines
382 #define DtPrintDefines          DtSearchDefines
383
384 #ifndef CompressAllFonts
385 #define CompressAllFonts        YES
386 #endif
387
388 /* For DtHelp TIFF processing routines. */
389 #if defined(AMD64Architecture) || defined(i386Architecture)
390 #define LSBBitOrder             YES
391 #endif
392
393 #define baseDtMailDefines       \
394         -DSunOS=OSMajorVersion\#\#OSMinorVersion -DMMAP_NORESERVE -DSPRO_V2
395 #ifndef i386Architecture
396 # define DtMailDefines          baseDtMailDefines
397 #else
398 # define DtMailDefines          -DBIG_ENDIAN baseDtMailDefines
399 #endif
400
401 #define ArchitectureDefines     -DSUN_ARCHITECTURE
402
403 #define TtClientExtraLibs       ExtraLibraries -ldl -lintl
404
405 #ifndef TopMotifInclude
406 # define TopMotifInclude        /usr/X11/include
407 #endif
408
409 #define ShlibExportListOpt(filename)    -M filename
410
411 #define TtClientLibs $(TTLIB) $(XTOOLLIB) $(XLIB)
412 #define TtClientDepLibs $(DEPTTLIB) $(DEPXTOOLLIB) $(DEPXLIB)
413
414 #define CdeProjectDefines \
415         -DMULTIBYTE -DNLS16 -DMESSAGE_CAT -D__EXTENSIONS__ \
416         -DOSMAJORVERSION=OSMajorVersion -DOSMINORVERSION=OSMinorVersion