sun.cf revision 4c61c93d
1XCOMM $XdotOrg: xc/config/cf/sun.cf,v 1.9 2004/08/19 16:28:42 kem Exp $
2XCOMM platform:  $Xorg: sun.cf,v 1.4 2000/08/17 19:41:48 cpqbld Exp $
3
4
5
6
7XCOMM platform:  $XFree86: xc/config/cf/sun.cf,v 3.70 2004/01/13 02:42:51 tsi Exp $
8
9#ifndef OSName
10# define OSName		DefaultOSName
11#endif
12#ifndef OSMajorVersion
13# define OSMajorVersion	DefaultOSMajorVersion
14#endif
15#ifndef OSMinorVersion
16# define OSMinorVersion	DefaultOSMinorVersion
17#endif
18#ifndef OSTeenyVersion
19# define OSTeenyVersion	DefaultOSTeenyVersion
20#endif
21XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion)
22
23/* For various reasons, Sun uses different settings when compiling the 
24 * X Window System packages included in Solaris than are normally used
25 * by most people building the X.Org software releases.   Sun also has
26 * two different X server hierarchies in Solaris - Xsun in /usr/openwin
27 * and Xorg in /usr/X11.
28 *
29 * If you want to try to match Sun's settings as closely as possible
30 * add this setting to your host.def:
31 *  #define BuildLikeSun YES
32 *
33 * If you're trying to match the openwin directory layout as well, you'll 
34 * need to also add:
35 *  #define ProjectRoot /usr/openwin
36 * otherwise it will use /usr/X11.  (Note that these settings match closer
37 * to Sun's Xorg delivery in /usr/X11 than the older X11R6.6-based delivery
38 * in /usr/openwin though.)
39 */
40#ifndef BuildLikeSun
41# define BuildLikeSun NO
42#endif
43
44#if BuildLikeSun
45# ifndef ProjectRoot
46#  define ProjectRoot		/usr/X11
47# endif
48# ifndef DocDir
49#  define DocDir		Concat(ProjectRoot,/share/doc)
50# endif
51# ifndef ManDirectoryRoot
52#  define ManDirectoryRoot	Concat(ProjectRoot,/share/man)
53# endif
54# ifndef ManSuffix
55#  define ManSuffix		1
56# endif
57# ifndef LibraryCCOptions
58#  if DoSharedLib && defined(SharedLibraryCCOptions)
59#   define LibraryCCOptions SharedLibraryCCOptions ArchLibraryCCOptions
60#  else
61#   define LibraryCCOptions DefaultCCOptions ArchLibraryCCOptions
62#  endif
63# endif
64#endif
65
66/* Flag passed to makestrs in Xt build to control string array names in the
67 * libXt headers.   -solarisabinames matches those used in the libXt in 
68 * Solaris, but not in other OS'es.
69 */
70#ifndef SolarisABIFlag
71# if BuildLikeSun
72#  define SolarisABIFlag -solarisabinames
73# else
74#  define SolarisABIFlag /**/
75# endif
76#endif
77
78/*
79 * Compiler setup.  This sun.cf file knows what options to use with 
80 * certain compilers, including Sun C, CenterLine C, and gcc.  It 
81 * also understands how to set some of the options for various C++
82 * compilers, including Sun C++ and CenterLine C++.
83 *
84 * === C Compiler Setup ==========================================
85 *
86 * For SunPro C, define HasSunC to YES in site.def.  
87 * For CenterLine C, define HasCenterLineC to YES in site.def
88 * For gcc, gcc2 or gcc3, define HasGcc, HasGcc2 or HasGcc3 to YES in site.def
89 * For other compilers, define HasSunC to NO in site.def, then 
90 *    provide appropriate values for the various compiler related
91 *    configuration varibles used here.
92 * 
93 * If you don't tell us which C compiler you have, we assume you have 
94 * the SunPro C compiler under Solaris 2.x, and the bundled /bin/cc 
95 * under SunOS 4.1.x
96 *
97 * === C++ Compiler Setup ==========================================
98 *
99 * For SunPro C++, define HasSunCplusplus to YES in site.def
100 * For CenterLine C++, define HasCenterLineCplusplus to YES in site.def
101 * For Gnu g++ 2.6.x, define HasGcc2ForCplusplus to YES in site.def
102 * For other compilers, define HasCplusplus to YES in site.def, and 
103 *    check to see if you need to provide values for CplusplusOptions
104 *    and/or DefaultCplusplusOptions.
105 *
106 * In any case, you may also need to set CplusplusDependIncludes.
107 *
108 * If you say you have the SunPro C++ compiler, we assume you have 
109 * version 3.0.x of the compiler.  If you have version 4.0.x instead, 
110 * define CplusplusCompilerMajorVersion as 4 in site.def.
111 *
112 */
113
114#ifndef HasGcc3
115#define HasGcc3 NO
116#endif
117#ifndef HasGcc2
118#define HasGcc2 HasGcc3
119#endif
120#ifndef HasGcc
121#define HasGcc HasGcc2
122#endif
123
124#ifndef HasSunC
125# if HasCenterLineC || HasGcc || HasGcc2 || HasGcc3 || (OSMajorVersion < 5)
126#  define HasSunC NO
127# else
128#  define HasSunC YES
129# endif
130#endif
131
132#if HasSunC 
133# ifndef CCompilerMajorVersion
134#  define CCompilerMajorVersion DefaultSunProCCompilerMajorVersion
135# endif
136# ifndef CCompilerMinorVersion
137#  define CCompilerMinorVersion DefaultSunProCCompilerMinorVersion
138# endif
139XCOMM SunPro C CCompilerMajorVersion./**/CCompilerMinorVersion
140
141/* Choose some reasonable default optimizer flags based on compiler & 
142   OS versions */
143# ifndef OptimizedCDebugFlags
144#  if (CCompilerMajorVersion > 5) || \
145	(CCompilerMajorVersion == 5 && CCompilerMinorVersion > 2)
146#   define OptimizedCDebugFlags -xO4 -xbuiltin=%all -xlibmil -xstrconst ArchOptimizedFlags
147#  else
148#   define OptimizedCDebugFlags -xO4 -xstrconst ArchOptimizedFlags
149#  endif
150# endif
151# ifndef ArchOptimizedFlags
152#  if OSMajorVersion == 5 
153#   if defined(SparcArchitecture) && !defined(Sparc64Architecture)
154#    if OSMinorVersion > 9 /* Solaris 10 and later only run on UltraSPARC's */
155#     define ArchOptimizedFlags -xarch=v8plus
156#    else
157#     define ArchOptimizedFlags -xarch=v8
158#    endif
159#   elif defined(i386Architecture) || defined(AMD64Architecture)
160#    if (CCompilerMajorVersion > 5) || \
161	(CCompilerMajorVersion == 5 && CCompilerMinorVersion >= 7)
162/* -xregs=no%frameptr is required on x86 when compiling at -xO4 or higher to
163 * avoid losing stack frame pointers so you can't get stack traces or debug.
164 * This may lose a small bit of performance, so you can override by adding
165 * #define FramePtrFlags -xregs=frameptr if you care about performance more 
166 * than debuggability.
167 */
168#     ifndef FramePtrFlags
169#      define FramePtrFlags -xregs=no%frameptr
170#     endif
171#    endif
172#    ifndef FramePtrFlags
173#     define FramePtrFlags /* */
174#    endif
175#    if defined(i386Architecture) && (OSMinorVersion > 8)
176       /* Solaris 9 and later require Pentium or better */
177#      define ArchOptimizedFlags -xpentium FramePtrFlags
178#    else
179#     define ArchOptimizedFlags FramePtrFlags
180#    endif
181#   endif
182#  endif
183#  ifndef ArchOptimizedFlags
184#   define ArchOptimizedFlags /**/
185#  endif
186# endif
187# ifndef DefaultCDebugFlags
188#  define DefaultCDebugFlags OptimizedCDebugFlags
189# endif
190# ifndef SharedLibraryLdCmd
191#  define SharedLibraryLdCmd $(CC)
192# endif
193/* Flags for lint version included with Sun C compilers */
194# if OSMajorVersion >= 5
195#  ifndef LintLibFlag
196#   define LintLibFlag -y -o
197#  endif
198#  ifndef LintOpts
199#   define LintOpts -b -h -u -erroff=E_INDISTING_FROM_TRUNC2 $(LINTSECFLAG) ExtraLibraries MathLibrary -lc
200#  endif
201#  ifndef LintSecFlag
202#   if (CCompilerMajorVersion > 5) || \
203       (CCompilerMajorVersion == 5 && CCompilerMinorVersion >= 6)
204#    define LintSecFlag -errsecurity=standard
205#   else
206#    define LintSecFlag /**/
207#   endif
208#  endif
209      LINTSECFLAG = LintSecFlag
210#  ifndef LintLibReferences
211#   define LintLibReferences(varname,libname,libsource)                    @@\
212       Concat(LINT,varname) = _UseCat(-L $(LINTLIBDIR) -l, -L libsource -l,libname)
213#  endif
214
215# endif /* Lint Flags for Solaris */
216
217#endif /* HasSunC */
218
219#ifndef ArchLibraryCCOptions
220# if HasSunC && defined(SparcArchitecture) && CCompilerMajorVersion > 3
221#  define ArchLibraryCCOptions -xregs=no%appl
222# else
223#  define ArchLibraryCCOptions
224# endif
225#endif /* ArchLibraryCCOptions */
226
227/* we used to have this here :
228 *
229 * #if HasSunC 
230 * # ifndef CCompilerMajorVersion
231 * #  define CCompilerMajorVersion 3
232 * #  define DefaultCDebugFlags	-xO3
233 * #  define OptimizedCDebugFlags	-xO3
234 * # endif
235 * #endif
236 */
237
238#ifndef HasSunCplusplus
239# define HasSunCplusplus HasSunC	/* ??? */
240#endif
241#if HasSunCplusplus
242# ifndef HasCplusplus
243#  define HasCplusplus YES
244#  define OptimizedCplusplusDebugFlags	-xO4 -xbuiltin=%all -xlibmil
245# endif
246# ifndef CplusplusCompilerMajorVersion
247#  ifdef DefaultSunProCplusplusCompilerMajorVersion
248#   define CplusplusCompilerMajorVersion DefaultSunProCplusplusCompilerMajorVersion
249#  else
250#   define CplusplusCompilerMajorVersion 3
251#  endif
252# endif
253# ifndef CplusplusCompilerMinorVersion
254#  ifdef DefaultSunProCplusplusCompilerMinorVersion
255#   define CplusplusCompilerMinorVersion DefaultSunProCplusplusCompilerMinorVersion
256#  else
257#   define CplusplusCompilerMinorVersion 0
258#  endif
259# endif
260# ifndef CplusplusLibC
261#  if CplusplusCompilerMajorVersion >= 5
262#   define CplusplusLibC -norunpath -lCrun
263#  endif
264# endif
265XCOMM SunPro C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion
266#endif
267
268/* we used to have this here :
269 *
270 * # ifndef CplusplusCompilerMajorVersion
271 * #  define CplusplusCompilerMajorVersion	4
272 * # endif
273 */
274
275#if HasCenterLineC
276# ifndef CcCmd
277#  define CcCmd clcc
278# endif
279#endif
280
281#if HasCenterLineCplusplus
282# ifndef HasCplusplus
283#  define HasCplusplus YES
284# endif
285# ifndef DefaultCplusplusOptions
286#  define DefaultCplusplusOptions -Xa
287# endif
288# ifndef CplusplusOptions
289#  define CplusplusOptions -Xa
290# endif
291#endif
292
293#if OSMajorVersion < 4 || (OSMajorVersion == 4 && OSMinorVersion < 1)
294/* We do not guarantee this will work */
295# define BootstrapCFlags	-DNOSTDHDRS
296# define StandardDefines	-DNOSTDHDRS
297# define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
298#endif
299
300#if OSMajorVersion == 4 
301# if OSMinorVersion == 1
302#  define HasPoll		YES
303# endif
304# if OSMinorVersion > 1 || (OSMinorVersion == 1 && OSTeenyVersion > 1)
305/* You ALSO need this if you have Sun ld patch 100170-06 or later to 4.1.1 */
306#  define SunPost411FCSLd	YES
307# endif
308#endif
309
310/* The Xsun server was not building for SunOS 5.7 due to 
311   includes of <sys/cg2reg.h>. 
312*/
313#if OSMajorVersion < 5 
314# define IncludeCG2HeaderDefine	-DINCLUDE_CG2_HEADER
315#else
316# define IncludeCG2HeaderDefine /**/
317#endif
318
319#if defined(i386Architecture) || defined(AMD64Architecture)
320# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
321#  define OSServerExtraDefines	-D__SOL8__
322# endif
323#endif
324
325#if !HasGcc 
326# if HasSunC
327#  if defined(AMD64Architecture)
328#   define AsmArch amd64
329#   define AsmFlags -xarch=amd64
330#  elif defined(i386Architecture)
331#   define AsmArch ia32
332#   define AsmFlags /**/
333#  elif defined(Sparc64Architecture)
334#   define AsmArch sparcv8plus
335#   define AsmFlags -xarch=v9
336#  elif defined(SparcArchitecture)
337#   define AsmArch sparcv8plus
338#   define AsmFlags -xarch=v8plus
339#  endif
340#  ifndef CompilerServerExtraDefines
341#   define CompilerServerExtraDefines $(SERVERSRC)/hw/xfree86/os-support/sunos/AsmArch.il
342#  endif
343# endif
344#endif
345
346#ifndef CompilerServerExtraDefines
347# define CompilerServerExtraDefines /**/
348#endif
349
350#ifndef OSServerExtraDefines
351# define OSServerExtraDefines	/**/
352#endif
353
354#ifndef ArchServerExtraDefines
355# if defined(Sparc64Architecture) || defined(AMD64Architecture)
356#  define ArchServerExtraDefines -D_XSERVER64
357# else
358#  define ArchServerExtraDefines /**/
359# endif
360#endif
361
362#define ServerOSDefines		XFree86ServerOSDefines IncludeCG2HeaderDefine
363#define ServerExtraDefines	AllocateLocalDefines XFree86ServerDefines \
364				CompilerServerExtraDefines \
365				OSServerExtraDefines ArchServerExtraDefines
366
367#ifndef HasPerl
368/* Solaris 8 comes with perl.  Earlier versions don't. */
369# if (OSMajorVersion == 5) && (OSMinorVersion >= 8)
370#  define HasPerl		YES
371# else
372#  define HasPerl		NO
373# endif
374#endif
375
376#ifndef XkbServerDefines
377# if BuildLikeSun
378#  define XkbServerDefines  -DXKB_ALWAYS_USES_SOFT_REPEAT \
379	-DXKM_OUTPUT_DIR='"/var/run/xkb/"' -DXKM_OUTPUT_DIR_MODE=0775 \
380	-DMAKE_XKM_OUTPUT_DIR
381# else
382#  define XkbServerDefines  -DXKB_ALWAYS_USES_SOFT_REPEAT
383# endif
384#endif
385
386#if OSMajorVersion > 4
387# define ConnectionFlags		-DTCPCONN -DUNIXCONN -DLOCALCONN
388# if HasSunC
389#  ifdef DefaultSunProCCompilerDir
390#   ifndef  CcCmd
391#    define CcCmd		DefaultSunProCCompilerDir/cc
392#   endif
393#  endif
394#  ifdef DefaultSunProCplusplusCompilerDir
395#   ifndef  CplusplusCmd
396#    define CplusplusCmd	DefaultSunProCplusplusCompilerDir/CC
397#   endif
398#   ifndef  CplusplusFilt
399#    define CplusplusFilt	DefaultSunProCplusplusCompilerDir/c++filt
400#   endif
401#   ifndef  CplusplusWhatdir
402#    define CplusplusWhatdir	DefaultSunProCplusplusCompilerDir/whatdir
403#   endif
404#  else /* DefaultSunProCplusplusCompilerDir not defined */
405#   ifndef  CplusplusWhatdir
406#    define CplusplusWhatdir	whatdir
407#   endif
408#  endif /* DefaultSunProCplusplusCompilerDir */
409#  ifndef  CplusplusDependIncludes
410#   if CplusplusCompilerMajorVersion > 3
411#    define CplusplusDependIncludes	-I`CplusplusWhatdir CC`/../include/CC
412#   elif CplusplusCompilerMajorVersion > 2
413#    define CplusplusDependIncludes	-I/opt/SUNWspro/SC3.0/include/CC
414#   else
415#    define CplusplusDependIncludes	-I/opt/SUNWspro/SC2.0.1/include/CC
416#   endif
417#  endif 
418# endif /* HasSunC */
419
420# if HasSunC && (CCompilerMajorVersion < 3)
421#  define BootstrapCFlags	-DSVR4
422# else
423#  define BootstrapCFlags	/* none needed */
424# endif
425# ifndef XawI18nDefines
426#  if OSMinorVersion < 4
427#   define XawI18nDefines    -DHAS_WCTYPE_H -DHAS_ISW_FUNCS
428#  else
429#   define XawI18nDefines    -DHAS_WCHAR_H -DHAS_ISW_FUNCS
430#  endif
431# endif
432# if OSMinorVersion > 3
433#  define InstallCmd	    /usr/ucb/install
434# endif
435#ifndef LargefileDefines
436# if (OSMajorVersion > 5) || (OSMajorVersion == 5 && OSMinorVersion >= 6)
437#  define LargefileDefines -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
438# else
439#  define LargefileDefines /* */
440# endif
441#endif
442# ifdef AMD64Architecture
443#  define StandardDefines	-Dsun -DSVR4 -D__EXTENSIONS__ -D__amd64
444#  define ToolkitStringsABIOptions	-intelabi SolarisABIFlag
445# elif defined(i386Architecture)
446#  if (OSMajorVersion < 4) || ((OSMajorVersion == 5) && (OSMinorVersion <= 5))
447#   define StandardDefines	-Dsun -Di386 -DSVR4 -D__EXTENSIONS__ -D__i386 \
448				-D__SOL64__ LargefileDefines
449#  else
450#   define StandardDefines	-Dsun -Di386 -DSVR4 -D__EXTENSIONS__ -D__i386 \
451                                LargefileDefines
452#  endif
453#  define ToolkitStringsABIOptions	-intelabi SolarisABIFlag
454# else
455#  define StandardDefines	  -Dsun -Dsparc -DSVR4 -D__EXTENSIONS__ LargefileDefines
456#  define ToolkitStringsABIOptions	-sparcabi SolarisABIFlag
457# endif
458# define ExtraLibraries    -lsocket -lnsl
459# define HasWeakSymbols	  YES
460# if OSMinorVersion > 1
461#  ifndef ThreadedX
462#   define ThreadedX	  YES
463#  endif
464#  define MTSafeAPIDefines	-DXUSE_MTSAFE_API -DXUSE_NETDB_R_API
465#  if HasSunC && CCompilerMajorVersion > 2
466#   define ThreadsCompileFlags -mt
467#  else
468#   define SystemMTDefines -D_REENTRANT
469#   define ThreadsLibraries -lthread
470#  endif
471#  if HasSunCplusplus && CplusplusCompilerMajorVersion > 3
472#   define ThreadsCplusplusCompileFlags -mt
473#  else
474#   define CplusplusSystemMTDefines -D_REENTRANT
475#   define ThreadsCplusplusLibraries -lthread
476#  endif
477# endif 		/* OSMinorVersion > 1 */
478# ifndef UseExportLists
479#  if (OSMinorVersion > 4) && !HasGcc2
480#   define UseExportLists YES
481#  else
482#   define UseExportLists NO
483#  endif
484# endif
485# if OSMinorVersion > 5 /* Solaris 2.6 and later */
486#  define HasSnprintf YES
487# endif
488# if OSMinorVersion > 7 /* Solaris 8 and later */
489#  define HasStrlcat	YES
490#  define HasStrcasecmp	YES
491#  define HasVarRun	YES
492# endif
493# if OSMinorVersion > 9 /* Solaris 10 and later */
494#  define HasSetenv	YES
495#  define HasGetpeerucred YES
496#  define HasGetoptLong YES
497#  define DlLibrary	-lc  /* dlopen() is in libc in Solaris 10 */
498# endif
499# define HasVFork	NO
500# define HasDlopen	YES
501# define InstallXloadSetGID	NO /* libkstat doesn't require gid kmem */
502# define InstKmemFlags	-g sys -m 2711
503# define ShLibIncludeFile <sunLib.tmpl>
504# define LinkerRuntimeLibraryPathFlag(path) Concat(-R,path)
505# define RpathLoadFlags LinkerRuntimeLibraryPathFlag($(USRLIBDIRPATH))
506/*
507 * Set flags for position independent code before including sv4Lib.rules
508 * if the compiler in use doesn't use standard SVR4 flags
509 */
510# if HasSunC || HasCenterLineC
511#  define PositionIndependentCFlags -Kpic
512#  define LargePositionIndependentCFlags -KPIC
513#  ifdef Sparc64Architecture
514#   define LargePICTable YES
515#  endif
516# endif
517# if HasSunCplusplus || HasCenterLineCplusplus
518#  define PositionIndependentCplusplusFlags -pic
519#  define LargePositionIndependentCplusplusFlags -PIC
520# endif
521/* As is done in sco5.cf, we lie and say Solaris has NCURSES, since
522 * the system curses is close enough for xorgcfg's purposes.  xorgcfg
523 * should not depend on the NCURSES package but rather on a "capable curses", 
524 * of which NCURSES is just one.
525 */
526#define	HasNCurses		YES
527#define NCursesLibName		-lcurses
528#else /* not OSMajorVersion > 4 */
529#define InstKmemFlags	  -g kmem -m 2711
530#include <sunLib.rules>
531#endif /* OSMajorVersion > 4 (else) */
532
533/* Solaris 10 includes FreeType already.  It's also available in GNOME 2.0 for
534 * Solaris 8 & 9, and in Solaris 9 4/03 and later, but there's no easy way to
535 * detect that in imake, so users of those releases who want to use the 
536 * installed FreeType instead of the one in this tree should copy the following
537 * two settings to their host.def.  Those who want to use the in-tree copy
538 * regardless of OS version should add "#define HasFreetype2 NO" to host.def.
539 */
540#ifndef HasFreetype2
541# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
542#  define HasFreetype2 YES 
543#  ifndef Freetype2Dir
544#   define Freetype2Dir /usr/sfw
545#  endif
546# else
547#  define HasFreetype2 NO
548# endif
549#endif
550
551#ifndef HasExpat
552# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
553#  define HasExpat YES 
554#  ifndef ExpatDir
555#   define ExpatDir /usr/sfw
556#  endif
557# else
558#  define HasExpat NO
559# endif
560#endif
561
562/* Solaris 10 includes fontconfig, but not the fcprivate.h header needed by
563 * Xft1 library.
564 */
565#ifndef HasFontconfig
566# define HasFontconfig NO
567#endif
568
569/* libpng was in /usr/sfw/lib on Solaris 9, moved to /usr/lib in Solaris 10 */
570#ifndef HasLibpng
571# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 9))
572#  define HasLibpng YES 
573#  if !defined(LibpngDir) && ((OSMajorVersion == 5) && (OSMinorVersion == 9))
574#   define LibpngDir /usr/sfw
575#  endif
576# else
577#  define HasLibpng NO
578# endif
579#endif
580
581#ifndef HasZlib
582# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
583#  define HasZlib YES
584# else
585#  define HasZlib NO
586# endif
587#endif
588
589#ifndef TroffCmd
590# if !(HasGroff)
591#  define TroffCmd troff -Tpost
592# endif
593#endif
594
595#define BuildLibPathVar	  LD_LIBRARY_PATH
596#define HasNdbm		  YES
597#define HasShm		  YES
598#define HasSecureRPC	  YES
599#define SetTtyGroup	  YES
600#define HasPutenv	  YES
601#define HasMkstemp        YES
602#if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
603#define HasDevRandom	  YES	/* /dev/random is in Solaris 8 patches 	*/
604#define PollDevRandom	  YES	/* /dev/random is poll()able on Solaris */
605#endif
606#if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 9))
607# define HasIssetugid	  YES
608#endif
609#if defined(Sun3Architecture) || defined(SparcArchitecture) || defined(Sparc64Architecture)
610# ifndef Xsun24Server
611#  define Xsun24Server	  NO		/* color, mono, multiple depths */
612# endif
613# ifndef XsunServer
614#  define XsunServer	  NO		/* color and mono, 8 bit only */
615# endif
616# ifndef XsunMonoServer
617#  define XsunMonoServer	  NO		/* monochrome only */
618# endif
619# ifndef XorgServer
620#  define XorgServer	(!(Xsun24Server || XsunServer || XsunMonoServer))
621# endif 
622# undef BuildXF86DRI
623# define BuildXF86DRI     NO
624# if (OSMajorVersion > 4)
625#  if !defined(AsOutputArchSize) || \
626      ((AsOutputArchSize != 32) && (AsOutputArchSize != 64))
627#   undef AsOutputArchSize
628#   define AsOutputArchSize	32
629#  endif
630#  ifndef AsVISOption
631#   if AsOutputArchSize == 32
632#    ifdef UseGas
633#     define AsVISOption		-Av8plusa
634#    else
635#     define AsVISOption		-xarch=v8plusa
636#    endif
637#   else
638#    ifdef UseGas
639#     define AsVISOption		-Av9a
640#    else
641#     define AsVISOption		-xarch=v9a
642#    endif
643#   endif
644#  endif
645# endif
646#endif /* SPARC or Sun3/M68k */
647
648#if OSMajorVersion >= 4
649#define HasUsableFileMap YES
650#endif
651
652#ifndef UseDeprecatedKeyboardDriver
653#define UseDeprecatedKeyboardDriver YES
654#endif
655
656#if HasGcc
657# if OSMajorVersion > 4
658#  ifndef DefaultCCOptions
659#   ifdef UseInstalled
660#    define DefaultCCOptions -DNO_ASM
661#   elif OSMinorVersion > 6
662#    define DefaultCCOptions -DNO_ASM GccWarningOptions
663#   elif OSMinorVersion > 3
664#    define DefaultCCOptions -DNO_ASM GccWarningOptions -ansi -pedantic
665#   else
666#    define DefaultCCOptions -DNO_ASM
667#   endif
668#  endif
669# endif
670# if HasGcc2
671#  ifndef CcCmd
672#   define CcCmd gcc
673#  endif
674#  ifndef AsCmd
675#   define AsCmd CcCmd -c -x assembler
676#  endif
677#  ifndef OptimizedCDebugFlags
678#   ifdef i386Architecture
679#    define OptimizedCDebugFlags DefaultGcc2i386Opt
680#   elif defined(AMD64Architecture)
681#    define OptimizedCDebugFlags DefaultGcc2AMD64Opt
682#   else
683#    define OptimizedCDebugFlags -O2
684#   endif
685#  endif
686#  if !defined(SharedLibraryLoadFlags) && !defined(SharedLibraryLdCmd)
687#   if OSMajorVersion == 5 && OSMinorVersion > 6 && defined(i386Architecture)
688    /* This is to work around what appears to be a PIC bug in some gcc/egcs
689       versions that shows up with the Solaris 7/x86 <ctype.h>. */
690#    define SharedLibraryLdCmd $(LD)
691#    define SharedLibraryLoadFlags -G -z textwarn
692#   else
693#    define SharedLibraryLdCmd $(CC)
694#    define SharedLibraryLoadFlags -shared -z text
695#   endif
696#  endif
697# else
698#  define SharedLibraryCcCmd cc
699#  define ExtraLoadFlags -B/usr/bin/
700#  define AllocateLocalDefines /**/
701
702.c.o:
703	ClearmakeOSName	$(CC) -c $(CFLAGS) $*.c
704
705# endif /* HasGcc2 (else) */
706
707#else /* not HasGcc */
708
709# define AllocateLocalDefines -DINCLUDE_ALLOCA_H
710
711/* Set up compiler-dependent options for Sun C */
712/*
713 * To build 64-bit binaries define Sparc64Architecture or AMD64Architecture
714 * in your site.def or host.def file.
715 */
716# if HasSunC
717#  ifdef Sun3Architecture
718#   ifndef DefaultCCOptions
719#    define DefaultCCOptions -f68881 -pipe
720#   endif
721#  else	/* not defined(Sun3Architecture) */
722#   if OSMajorVersion < 5
723#    ifndef DefaultCCOptions
724#     define DefaultCCOptions -pipe
725#    endif
726#   else /* OSMajorVersion >= 5*/
727#     ifndef DefaultXArchOptions
728#      ifdef Sparc64Architecture
729#	define DefaultXArchOptions -xarch=v9
730#      elif defined(AMD64Architecture)
731#	define DefaultXArchOptions -xarch=generic64
732#      else
733#       define DefaultXArchOptions /* */
734#     endif
735#     ifndef DefaultCCOptions
736#      define DefaultCCOptions -Xa -v DefaultXArchOptions -z lazyload -z combreloc -xstrconst -xildoff
737#     endif
738#     ifndef DefaultCplusplusOptions
739#      define DefaultCplusplusOptions DefaultXArchOptions -z lazyload -z combreloc -xildoff
740#     endif
741#     ifndef SharedLibraryLoadFlags
742#      define SharedLibraryLoadFlags -G DefaultXArchOptions -z text $(EXTRA_LOAD_FLAGS)
743#     endif
744#    endif
745#   endif	
746#  endif	
747# endif
748
749/* Set compiler-dependent options for CenterLine C */
750
751# if HasCenterLineC
752#  ifndef DefaultCCOptions
753#   define DefaultCCOptions -Xt -w1 -DANSICPP -U__HIGHC__
754#  endif
755#  ifndef NeedConstPrototypes
756#   define NeedConstPrototypes YES
757#  endif
758#  ifndef NeedNestedPrototypes
759#   define NeedNestedPrototypes YES
760#  endif
761#  ifndef NeedVarargsPrototypes
762#   define NeedVarargsPrototypes YES
763#  endif
764# endif
765
766
767#endif /* HasGcc (else) */
768
769#if OSMajorVersion < 5
770# define SharedAllocateLocalDefines -DINCLUDE_ALLOCA_H
771# define LibraryCCOptions /* don't want special floating point */
772#else /* OSMajorVersion >= 5, i.e. Solaris 2.0 & later */
773/* Only load libraries when needed on Solaris 7 & later */
774# if OSMinorVersion >= 7 
775#  define LazyLoadFlag -z lazyload -z combreloc
776# else
777#  define LazyLoadFlag /* */
778# endif
779/* Link with extra mapfiles for some performance & security enhancements */
780#ifndef MapfileFlag
781# if HasSunC
782#  define MapfileFlag -M
783# else
784#  define MapfileFlag -Wl,-M,
785# endif
786#endif
787#ifndef Mapfile_BssAlign
788# if OSMinorVersion >= 9
789#  define Mapfile_BssAlign $(MAPFILEFLAG)/usr/lib/ld/map.bssalign
790# else
791#  define Mapfile_BssAlign /**/
792# endif
793#endif
794#ifndef Mapfile_PageAlign
795# if OSMinorVersion >= 10
796#  define Mapfile_PageAlign $(MAPFILEFLAG)/usr/lib/ld/map.pagealign
797# else
798#  define Mapfile_PageAlign /**/
799# endif
800#endif
801#ifndef Mapfile_NoExStack
802# if OSMinorVersion >= 9
803#  define Mapfile_NoExStack $(MAPFILEFLAG)/usr/lib/ld/map.noexstk
804# else
805#  define Mapfile_NoExStack /**/
806# endif
807#endif
808#ifndef Mapfile_NoExData
809# if defined(SparcArchitecture)
810/* SPARC archictecture requires PLT section in .data be executable, so
811   we can only make .bss, not all of .data no-exec on SPARC */
812#   define Mapfile_NoExData /**/
813# else
814#  if OSMinorVersion >= 10
815#   define Mapfile_NoExData $(MAPFILEFLAG)/usr/lib/ld/map.noexdata
816#  else
817#   define Mapfile_NoExData /**/
818#  endif
819# endif
820#endif
821       MAPFILEFLAG = MapfileFlag
822  MAPFILES_FOR_ALL = Mapfile_PageAlign Mapfile_NoExData
823MAPFILES_FOR_PROGS = Mapfile_BssAlign Mapfile_NoExStack
824/* ExtraLoadFlags apply to all binaries - programs & libraries */
825# ifndef ExtraLoadFlags
826#  define ExtraLoadFlags LazyLoadFlag $(MAPFILES_FOR_ALL)
827# endif
828/* ExtraLoadOptions only apply to programs */
829# ifndef ExtraLoadOptions
830#  define ExtraLoadOptions -B direct $(MAPFILES_FOR_PROGS)
831# endif
832#endif /* OSMajorVersion < 5 */
833
834/* 64-bit build support */
835#ifndef Solaris64bitSubdir
836# ifdef Sparc64Architecture
837#  define Solaris64bitSubdir	sparcv9
838# elif defined(AMD64Architecture)
839#  define Solaris64bitSubdir	amd64
840# endif
841#endif
842
843#ifdef Solaris64bitSubdir
844# define LibDirName Concat3(lib,/,Solaris64bitSubdir)
845#endif
846
847#if OSMajorVersion > 4
848# include <svr4.cf>
849#endif
850
851#ifndef ManKeywordsTarget
852# define ManKeywordsTarget(manpath)					@@\
853man_keywords::								@@\
854	catman -M $(DESTDIR)manpath -w
855#endif
856
857#if !defined(UsePamLibrary)
858# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 4))
859#  define UsePamLibrary		YES
860# endif
861#endif
862
863/* PAM appeared in SunOS 5.6 */
864#if !defined(HasPam)
865# if (OSMajorVersion > 5) || (OSMajorVersion == 5 && OSMinorVersion >= 6)
866#  define HasPam		YES
867# endif
868#endif
869
870#ifndef PamLibraries
871#define PamLibraries		-lpam
872#endif
873
874#ifndef HasMotif
875/* Solaris's Motif depends on Solaris libX11 and won't work with libX11 built
876 * from this tree, so only use it when using libX11 from outside the tree.
877 */
878# define HasMotif (defined(UseInstalled) || UseInstalledX11)
879# define MotifDir /usr/dt
880#endif /* !HasMotif */
881#ifndef HasMotif2
882/* Solaris's Motif2 version is broken and misses XmPrintShell
883 * (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1366) */
884# define HasMotif2 NO
885#endif /* !HasMotif2 */
886
887#define MotifDefines			\
888	-DNO_ISDIR -DNO_REGCOMP -DNO_ALLOCA -DBOGUS_MB_MAX -DNO_CONST
889#define PamUnixDefines		-DPAM_NIS
890#define TtLargePICTable		YES
891#define DtSvcDefines		-DXK_MISCELLANY -DMULTIBYTE -DNO_REGCOMP
892#define DtSearchDefines		-DI18N_MSG DtSvcDefines
893#define DtWidgetDefines		DtSearchDefines
894#define DtPrintDefines		DtSearchDefines
895
896#define baseDtMailDefines	\
897	-DSunOS=OSMajorVersion\#\#OSMinorVersion -DMMAP_NORESERVE -DSPRO_V2
898#if !defined(i386Architecture) && !defined(AMD64Architecture)
899# define DtMailDefines		baseDtMailDefines
900#else
901# define DtMailDefines		-DBIG_ENDIAN baseDtMailDefines
902#endif
903
904#define ArchitectureDefines	-DSUN_ARCHITECTURE
905
906#define TtClientExtraLibs	ExtraLibraries -ldl -lintl
907
908#define ExportListGenSource	elistgen.sun
909#define ShlibExportListOpt(filename)	-M filename
910
911#define CdeProjectDefines \
912	-DMULTIBYTE -DNLS16 -DMESSAGE_CAT -D_XOPEN_VERSION=4 \
913	-D_XOPEN_SOURCE -D__EXTENSIONS__ \
914	-DOSMAJORVERSION=OSMajorVersion -DOSMINORVERSION=OSMinorVersion
915
916
917/*
918 * Turn off HTML manpages like we do under NetBSD.
919 */
920#ifndef	BuildHtmlManPages
921#define	BuildHtmlManPages	NO
922#endif
923
924/*
925 * Turn off seperate configuration directories.
926 */
927#ifndef	UseSeparateConfDir
928#define	UseSeparateConfDir	NO
929#endif
930
931/* Hackery for building modules as Solaris shared objects with dependencies */
932#if MakeDllModules && DoLoadableServer
933
934/* If you change this, you will need to change find-deps.pl to match */
935#define DlModuleDependencyName(module) Concat(module,_deps)
936
937#define DlModuleTarget(module,deplist,modlist)                          @@\
938DepDynamicModuleTarget(module,deplist DlModuleDependencyName(module),modlist LazyLoadFlag `cat DlModuleDependencyName(module)`) @@\
939									@@\
940DlModuleDependencyName(module):						@@\
941	touch $@							@@\
942									@@\
943clean::                                                                 @@\
944        RemoveFile(DlModuleDependencyName(module))
945
946#define ObjectModuleTarget(module,objects)				@@\
947DlModuleTarget(Concat(module,_drv.so), objects, objects)
948
949#define LibraryModuleTarget(module,objects)				@@\
950NormalLibraryTarget(module, objects)					@@\
951DlModuleTarget(Concat3(lib,module,.so), objects, objects)
952
953#define DepLibraryModuleTarget(module,deplist,objects)			@@\
954NormalDepLibraryTarget(module, deplist, objects)			@@\
955DlModuleTarget(Concat3(lib,module,.so), deplist, objects)
956
957#endif
958