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 variables 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 > 10
433#  define InstallCmd	    /usr/gnu/bin/install
434# elif OSMinorVersion > 3
435#  define InstallCmd	    /usr/ucb/install
436# endif
437#ifndef LargefileDefines
438# if (OSMajorVersion > 5) || (OSMajorVersion == 5 && OSMinorVersion >= 6)
439#  define LargefileDefines -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
440# else
441#  define LargefileDefines /* */
442# endif
443#endif
444# ifdef AMD64Architecture
445#  define StandardDefines	-Dsun -DSVR4 -D__EXTENSIONS__ -D__amd64
446#  define ToolkitStringsABIOptions	-intelabi SolarisABIFlag
447# elif defined(i386Architecture)
448#  if (OSMajorVersion < 4) || ((OSMajorVersion == 5) && (OSMinorVersion <= 5))
449#   define StandardDefines	-Dsun -Di386 -DSVR4 -D__EXTENSIONS__ -D__i386 \
450				-D__SOL64__ LargefileDefines
451#  else
452#   define StandardDefines	-Dsun -Di386 -DSVR4 -D__EXTENSIONS__ -D__i386 \
453                                LargefileDefines
454#  endif
455#  define ToolkitStringsABIOptions	-intelabi SolarisABIFlag
456# else
457#  define StandardDefines	  -Dsun -Dsparc -DSVR4 -D__EXTENSIONS__ LargefileDefines
458#  define ToolkitStringsABIOptions	-sparcabi SolarisABIFlag
459# endif
460/* Socket support was in separate libraries before 5.12, then merged to libc */
461# if (OSMajorVersion == 5) && (OSMinorVersion < 12)
462#  define ExtraLibraries -lsocket -lnsl
463# else
464#  define ExtraLibraries /**/
465# endif
466# define HasWeakSymbols	  YES
467# if OSMinorVersion > 1
468#  ifndef ThreadedX
469#   define ThreadedX	  YES
470#  endif
471#  define MTSafeAPIDefines	-DXUSE_MTSAFE_API -DXUSE_NETDB_R_API
472/* Thread support was in separate library before 5.10, then merged to libc */
473#  if (OSMajorVersion == 5) && (OSMinorVersion < 10)
474#   if HasSunC && CCompilerMajorVersion > 2
475#    define ThreadsCompileFlags -mt
476#   else
477#    define ThreadsLibraries -lthread
478#   endif
479#   if HasSunCplusplus && CplusplusCompilerMajorVersion > 3
480#    define ThreadsCplusplusCompileFlags -mt
481#   else
482#    define ThreadsCplusplusLibraries -lthread
483#   endif
484#   define SystemMTDefines -D_REENTRANT
485#  else
486   /* Solaris 10 & later */
487#   define SystemMTDefines -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
488#  endif
489#  define CplusplusSystemMTDefines SystemMTDefines
490# endif 		/* OSMinorVersion > 1 */
491# ifndef UseExportLists
492#  if (OSMinorVersion > 4) && !HasGcc2
493#   define UseExportLists YES
494#  else
495#   define UseExportLists NO
496#  endif
497# endif
498# if OSMinorVersion > 5 /* Solaris 2.6 and later */
499#  define HasSnprintf YES
500# endif
501# if OSMinorVersion > 7 /* Solaris 8 and later */
502#  define HasStrlcat	YES
503#  define HasStrcasecmp	YES
504#  define HasVarRun	YES
505# endif
506# if OSMinorVersion > 9 /* Solaris 10 and later */
507#  define HasSetenv	YES
508#  define HasGetpeerucred YES
509#  define HasGetoptLong YES
510#  define DlLibrary	-lc  /* dlopen() is in libc in Solaris 10 */
511# endif
512# define HasVFork	NO
513# define HasDlopen	YES
514# define InstallXloadSetGID	NO /* libkstat doesn't require gid kmem */
515# define InstKmemFlags	-g sys -m 2711
516# define ShLibIncludeFile <sunLib.tmpl>
517# define LinkerRuntimeLibraryPathFlag(path) Concat(-R,path)
518# define RpathLoadFlags LinkerRuntimeLibraryPathFlag($(USRLIBDIRPATH))
519/*
520 * Set flags for position independent code before including sv4Lib.rules
521 * if the compiler in use doesn't use standard SVR4 flags
522 */
523# if HasSunC || HasCenterLineC
524#  define PositionIndependentCFlags -Kpic
525#  define LargePositionIndependentCFlags -KPIC
526#  ifdef Sparc64Architecture
527#   define LargePICTable YES
528#  endif
529# endif
530# if HasSunCplusplus || HasCenterLineCplusplus
531#  define PositionIndependentCplusplusFlags -pic
532#  define LargePositionIndependentCplusplusFlags -PIC
533# endif
534/* As is done in sco5.cf, we lie and say Solaris has NCURSES, since
535 * the system curses is close enough for xorgcfg's purposes.  xorgcfg
536 * should not depend on the NCURSES package but rather on a "capable curses",
537 * of which NCURSES is just one.
538 */
539#define	HasNCurses		YES
540#define NCursesLibName		-lcurses
541#else /* not OSMajorVersion > 4 */
542#define InstKmemFlags	  -g kmem -m 2711
543#include <sunLib.rules>
544#endif /* OSMajorVersion > 4 (else) */
545
546/* Solaris 10 includes FreeType already.  It's also available in GNOME 2.0 for
547 * Solaris 8 & 9, and in Solaris 9 4/03 and later, but there's no easy way to
548 * detect that in imake, so users of those releases who want to use the
549 * installed FreeType instead of the one in this tree should copy the following
550 * two settings to their host.def.  Those who want to use the in-tree copy
551 * regardless of OS version should add "#define HasFreetype2 NO" to host.def.
552 */
553#ifndef HasFreetype2
554# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
555#  define HasFreetype2 YES
556#  ifndef Freetype2Dir
557#   define Freetype2Dir /usr/sfw
558#  endif
559# else
560#  define HasFreetype2 NO
561# endif
562#endif
563
564#ifndef HasExpat
565# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
566#  define HasExpat YES
567#  ifndef ExpatDir
568#   define ExpatDir /usr/sfw
569#  endif
570# else
571#  define HasExpat NO
572# endif
573#endif
574
575/* Solaris 10 includes fontconfig, but not the fcprivate.h header needed by
576 * Xft1 library.
577 */
578#ifndef HasFontconfig
579# define HasFontconfig NO
580#endif
581
582/* libpng was in /usr/sfw/lib on Solaris 9, moved to /usr/lib in Solaris 10 */
583#ifndef HasLibpng
584# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 9))
585#  define HasLibpng YES
586#  if !defined(LibpngDir) && ((OSMajorVersion == 5) && (OSMinorVersion == 9))
587#   define LibpngDir /usr/sfw
588#  endif
589# else
590#  define HasLibpng NO
591# endif
592#endif
593
594#ifndef HasZlib
595# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
596#  define HasZlib YES
597# else
598#  define HasZlib NO
599# endif
600#endif
601
602#ifndef TroffCmd
603# if !(HasGroff)
604#  define TroffCmd troff -Tpost
605# endif
606#endif
607
608#define BuildLibPathVar	  LD_LIBRARY_PATH
609#define HasNdbm		  YES
610#define HasShm		  YES
611#define HasSecureRPC	  YES
612#define SetTtyGroup	  YES
613#define HasPutenv	  YES
614#define HasMkstemp        YES
615#if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
616#define HasDevRandom	  YES	/* /dev/random is in Solaris 8 patches 	*/
617#define PollDevRandom	  YES	/* /dev/random is poll()able on Solaris */
618#endif
619#if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 9))
620# define HasIssetugid	  YES
621#endif
622#if defined(Sun3Architecture) || defined(SparcArchitecture) || defined(Sparc64Architecture)
623# ifndef Xsun24Server
624#  define Xsun24Server	  NO		/* color, mono, multiple depths */
625# endif
626# ifndef XsunServer
627#  define XsunServer	  NO		/* color and mono, 8 bit only */
628# endif
629# ifndef XsunMonoServer
630#  define XsunMonoServer	  NO		/* monochrome only */
631# endif
632# ifndef XorgServer
633#  define XorgServer	(!(Xsun24Server || XsunServer || XsunMonoServer))
634# endif
635# undef BuildXF86DRI
636# define BuildXF86DRI     NO
637# if (OSMajorVersion > 4)
638#  if !defined(AsOutputArchSize) || \
639      ((AsOutputArchSize != 32) && (AsOutputArchSize != 64))
640#   undef AsOutputArchSize
641#   define AsOutputArchSize	32
642#  endif
643#  ifndef AsVISOption
644#   if AsOutputArchSize == 32
645#    ifdef UseGas
646#     define AsVISOption		-Av8plusa
647#    else
648#     define AsVISOption		-xarch=v8plusa
649#    endif
650#   else
651#    ifdef UseGas
652#     define AsVISOption		-Av9a
653#    else
654#     define AsVISOption		-xarch=v9a
655#    endif
656#   endif
657#  endif
658# endif
659#endif /* SPARC or Sun3/M68k */
660
661#if OSMajorVersion >= 4
662#define HasUsableFileMmap YES
663#endif
664
665#ifndef UseDeprecatedKeyboardDriver
666#define UseDeprecatedKeyboardDriver YES
667#endif
668
669#if HasGcc
670# if OSMajorVersion > 4
671#  ifndef DefaultCCOptions
672#   ifdef UseInstalled
673#    define DefaultCCOptions -DNO_ASM
674#   elif OSMinorVersion > 6
675#    define DefaultCCOptions -DNO_ASM GccWarningOptions
676#   elif OSMinorVersion > 3
677#    define DefaultCCOptions -DNO_ASM GccWarningOptions -ansi -pedantic
678#   else
679#    define DefaultCCOptions -DNO_ASM
680#   endif
681#  endif
682# endif
683# if HasGcc2
684#  ifndef CcCmd
685#   define CcCmd gcc
686#  endif
687#  ifndef AsCmd
688#   define AsCmd CcCmd -c -x assembler
689#  endif
690#  ifndef OptimizedCDebugFlags
691#   ifdef i386Architecture
692#    define OptimizedCDebugFlags DefaultGcc2i386Opt
693#   elif defined(AMD64Architecture)
694#    define OptimizedCDebugFlags DefaultGcc2AMD64Opt
695#   else
696#    define OptimizedCDebugFlags -O2
697#   endif
698#  endif
699#  if !defined(SharedLibraryLoadFlags) && !defined(SharedLibraryLdCmd)
700#   if OSMajorVersion == 5 && OSMinorVersion > 6 && defined(i386Architecture)
701    /* This is to work around what appears to be a PIC bug in some gcc/egcs
702       versions that shows up with the Solaris 7/x86 <ctype.h>. */
703#    define SharedLibraryLdCmd $(LD)
704#    define SharedLibraryLoadFlags -G -z textwarn
705#   else
706#    define SharedLibraryLdCmd $(CC)
707#    define SharedLibraryLoadFlags -shared -z text
708#   endif
709#  endif
710# else
711#  define SharedLibraryCcCmd cc
712#  define ExtraLoadFlags -B/usr/bin/
713#  define AllocateLocalDefines /**/
714
715.c.o:
716	ClearmakeOSName	$(CC) -c $(CFLAGS) $*.c
717
718# endif /* HasGcc2 (else) */
719
720#else /* not HasGcc */
721
722# define AllocateLocalDefines -DINCLUDE_ALLOCA_H
723
724/* Set up compiler-dependent options for Sun C */
725/*
726 * To build 64-bit binaries define Sparc64Architecture or AMD64Architecture
727 * in your site.def or host.def file.
728 */
729# if HasSunC
730#  ifdef Sun3Architecture
731#   ifndef DefaultCCOptions
732#    define DefaultCCOptions -f68881 -pipe
733#   endif
734#  else	/* not defined(Sun3Architecture) */
735#   if OSMajorVersion < 5
736#    ifndef DefaultCCOptions
737#     define DefaultCCOptions -pipe
738#    endif
739#   else /* OSMajorVersion >= 5*/
740#    ifndef DefaultXArchOptions
741#     if ((CCompilerMajorVersion > 5) || \
742          (CCompilerMajorVersion == 5) && (CCompilerMinorVersion >= 9))
743      /* Sun Studio 12.0 (cc 5.9) or later */
744#      if (defined(Sparc64Architecture) || defined(AMD64Architecture))
745#	define DefaultXArchOptions -m64
746#      else
747#	define DefaultXArchOptions -m32
748#      endif
749#     else
750#      ifdef Sparc64Architecture
751#	define DefaultXArchOptions -xarch=v9
752#      elif defined(AMD64Architecture)
753#	define DefaultXArchOptions -xarch=generic64
754#      else
755#       define DefaultXArchOptions /* */
756#      endif
757#     endif
758#     ifndef DefaultCCOptions
759#      define DefaultCCOptions -Xa -v DefaultXArchOptions -z lazyload -z combreloc -xstrconst -xildoff
760#     endif
761#     ifndef DefaultCplusplusOptions
762#      define DefaultCplusplusOptions DefaultXArchOptions -z lazyload -z combreloc -xildoff
763#     endif
764#     ifndef SharedLibraryLoadFlags
765#      define SharedLibraryLoadFlags -G DefaultXArchOptions -z text $(EXTRA_LOAD_FLAGS)
766#     endif
767#    endif
768#   endif
769#  endif
770# endif
771
772/* Set compiler-dependent options for CenterLine C */
773
774# if HasCenterLineC
775#  ifndef DefaultCCOptions
776#   define DefaultCCOptions -Xt -w1 -DANSICPP -U__HIGHC__
777#  endif
778#  ifndef NeedConstPrototypes
779#   define NeedConstPrototypes YES
780#  endif
781#  ifndef NeedNestedPrototypes
782#   define NeedNestedPrototypes YES
783#  endif
784#  ifndef NeedVarargsPrototypes
785#   define NeedVarargsPrototypes YES
786#  endif
787# endif
788
789
790#endif /* HasGcc (else) */
791
792#if OSMajorVersion < 5
793# define SharedAllocateLocalDefines -DINCLUDE_ALLOCA_H
794# define LibraryCCOptions /* don't want special floating point */
795#else /* OSMajorVersion >= 5, i.e. Solaris 2.0 & later */
796/* Only load libraries when needed on Solaris 7 & later */
797# if OSMinorVersion >= 7
798#  define LazyLoadFlag -z lazyload -z combreloc
799# else
800#  define LazyLoadFlag /* */
801# endif
802/* Link with extra mapfiles for some performance & security enhancements */
803#ifndef MapfileFlag
804# if HasSunC
805#  define MapfileFlag -M
806# else
807#  define MapfileFlag -Wl,-M,
808# endif
809#endif
810#ifndef Mapfile_BssAlign
811# if OSMinorVersion >= 9
812#  define Mapfile_BssAlign $(MAPFILEFLAG)/usr/lib/ld/map.bssalign
813# else
814#  define Mapfile_BssAlign /**/
815# endif
816#endif
817#ifndef Mapfile_PageAlign
818# if OSMinorVersion >= 10
819#  define Mapfile_PageAlign $(MAPFILEFLAG)/usr/lib/ld/map.pagealign
820# else
821#  define Mapfile_PageAlign /**/
822# endif
823#endif
824#ifndef Mapfile_NoExStack
825# if OSMinorVersion >= 9
826#  define Mapfile_NoExStack $(MAPFILEFLAG)/usr/lib/ld/map.noexstk
827# else
828#  define Mapfile_NoExStack /**/
829# endif
830#endif
831#ifndef Mapfile_NoExData
832# if defined(SparcArchitecture)
833/* SPARC architecture requires PLT section in .data be executable, so
834   we can only make .bss, not all of .data no-exec on SPARC */
835#   define Mapfile_NoExData /**/
836# else
837#  if OSMinorVersion >= 10
838#   define Mapfile_NoExData $(MAPFILEFLAG)/usr/lib/ld/map.noexdata
839#  else
840#   define Mapfile_NoExData /**/
841#  endif
842# endif
843#endif
844       MAPFILEFLAG = MapfileFlag
845  MAPFILES_FOR_ALL = Mapfile_PageAlign Mapfile_NoExData
846MAPFILES_FOR_PROGS = Mapfile_BssAlign Mapfile_NoExStack
847/* ExtraLoadFlags apply to all binaries - programs & libraries */
848# ifndef ExtraLoadFlags
849#  define ExtraLoadFlags LazyLoadFlag $(MAPFILES_FOR_ALL)
850# endif
851/* ExtraLoadOptions only apply to programs */
852# ifndef ExtraLoadOptions
853#  define ExtraLoadOptions -B direct $(MAPFILES_FOR_PROGS)
854# endif
855#endif /* OSMajorVersion < 5 */
856
857/* 64-bit build support */
858#ifndef Solaris64bitSubdir
859# ifdef Sparc64Architecture
860#  define Solaris64bitSubdir	sparcv9
861# elif defined(AMD64Architecture)
862#  define Solaris64bitSubdir	amd64
863# endif
864#endif
865
866#ifdef Solaris64bitSubdir
867# define LibDirName Concat3(lib,/,Solaris64bitSubdir)
868#endif
869
870#if ((OSMajorVersion == 5) && (OSMinorVersion <= 11))
871/* System V man page sections */
872# ifndef FileManSuffix
873#  define FileManSuffix	4		/* use just one tab or cpp will die */
874# endif
875# ifndef MiscManSuffix
876#  define MiscManSuffix	5		/* use just one tab or cpp will die */
877# endif
878# ifndef DriverManSuffix
879#  define DriverManSuffix	7	/* use just one tab or cpp will die */
880# endif
881# ifndef AdminManSuffix
882#  define AdminManSuffix	1m	/* use just one tab or cpp will die */
883# endif
884#else
885/* Bell Labs / BSD man page sections */
886# ifndef FileManSuffix
887#  define FileManSuffix	5		/* use just one tab or cpp will die */
888# endif
889# ifndef MiscManSuffix
890#  define MiscManSuffix	7		/* use just one tab or cpp will die */
891# endif
892# ifndef DriverManSuffix
893#  define DriverManSuffix	4	/* use just one tab or cpp will die */
894# endif
895# ifndef AdminManSuffix
896#  define AdminManSuffix	8	/* use just one tab or cpp will die */
897# endif
898#endif
899
900#if OSMajorVersion > 4
901# include <svr4.cf>
902#endif
903
904#ifndef ManKeywordsTarget
905# define ManKeywordsTarget(manpath)					@@\
906man_keywords::								@@\
907	catman -M $(DESTDIR)manpath -w
908#endif
909
910#if !defined(UsePamLibrary)
911# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 4))
912#  define UsePamLibrary		YES
913# endif
914#endif
915
916/* PAM appeared in SunOS 5.6 */
917#if !defined(HasPam)
918# if (OSMajorVersion > 5) || (OSMajorVersion == 5 && OSMinorVersion >= 6)
919#  define HasPam		YES
920# endif
921#endif
922
923#ifndef PamLibraries
924#define PamLibraries		-lpam
925#endif
926
927#ifndef HasMotif
928/* Solaris's Motif depends on Solaris libX11 and won't work with libX11 built
929 * from this tree, so only use it when using libX11 from outside the tree.
930 */
931# define HasMotif (defined(UseInstalled) || UseInstalledX11)
932# define MotifDir /usr/dt
933#endif /* !HasMotif */
934#ifndef HasMotif2
935/* Solaris's Motif2 version is broken and misses XmPrintShell
936 * (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1366) */
937# define HasMotif2 NO
938#endif /* !HasMotif2 */
939
940#define MotifDefines			\
941	-DNO_ISDIR -DNO_REGCOMP -DNO_ALLOCA -DBOGUS_MB_MAX -DNO_CONST
942#define PamUnixDefines		-DPAM_NIS
943#define TtLargePICTable		YES
944#define DtSvcDefines		-DXK_MISCELLANY -DMULTIBYTE -DNO_REGCOMP
945#define DtSearchDefines		-DI18N_MSG DtSvcDefines
946#define DtWidgetDefines		DtSearchDefines
947#define DtPrintDefines		DtSearchDefines
948
949#define baseDtMailDefines	\
950	-DSunOS=OSMajorVersion\#\#OSMinorVersion -DMMAP_NORESERVE -DSPRO_V2
951#if !defined(i386Architecture) && !defined(AMD64Architecture)
952# define DtMailDefines		baseDtMailDefines
953#else
954# define DtMailDefines		-DBIG_ENDIAN baseDtMailDefines
955#endif
956
957#define ArchitectureDefines	-DSUN_ARCHITECTURE
958
959#define TtClientExtraLibs	ExtraLibraries -ldl -lintl
960
961#define ExportListGenSource	elistgen.sun
962#define ShlibExportListOpt(filename)	-M filename
963
964#define CdeProjectDefines \
965	-DMULTIBYTE -DNLS16 -DMESSAGE_CAT -D_XOPEN_VERSION=4 \
966	-D_XOPEN_SOURCE -D__EXTENSIONS__ \
967	-DOSMAJORVERSION=OSMajorVersion -DOSMINORVERSION=OSMinorVersion
968
969
970/*
971 * Turn off HTML manpages like we do under NetBSD.
972 */
973#ifndef	BuildHtmlManPages
974#define	BuildHtmlManPages	NO
975#endif
976
977/*
978 * Turn off separate configuration directories.
979 */
980#ifndef	UseSeparateConfDir
981#define	UseSeparateConfDir	NO
982#endif
983
984/* Hackery for building modules as Solaris shared objects with dependencies */
985#if MakeDllModules && DoLoadableServer
986
987/* If you change this, you will need to change find-deps.pl to match */
988#define DlModuleDependencyName(module) Concat(module,_deps)
989
990#define DlModuleTarget(module,deplist,modlist)                          @@\
991DepDynamicModuleTarget(module,deplist DlModuleDependencyName(module),modlist LazyLoadFlag `cat DlModuleDependencyName(module)`) @@\
992									@@\
993DlModuleDependencyName(module):						@@\
994	touch $@							@@\
995									@@\
996clean::                                                                 @@\
997        RemoveFile(DlModuleDependencyName(module))
998
999#define ObjectModuleTarget(module,objects)				@@\
1000DlModuleTarget(Concat(module,_drv.so), objects, objects)
1001
1002#define LibraryModuleTarget(module,objects)				@@\
1003NormalLibraryTarget(module, objects)					@@\
1004DlModuleTarget(Concat3(lib,module,.so), objects, objects)
1005
1006#define DepLibraryModuleTarget(module,deplist,objects)			@@\
1007NormalDepLibraryTarget(module, deplist, objects)			@@\
1008DlModuleTarget(Concat3(lib,module,.so), deplist, objects)
1009
1010#endif
1011