summaryrefslogtreecommitdiff
path: root/sun.cf
blob: 1081891f6bcfd5fc7c619f7ccf8f94adff1dfcf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
XCOMM $XdotOrg: xc/config/cf/sun.cf,v 1.9 2004/08/19 16:28:42 kem Exp $
XCOMM platform:  $Xorg: sun.cf,v 1.4 2000/08/17 19:41:48 cpqbld Exp $




XCOMM platform:  $XFree86: xc/config/cf/sun.cf,v 3.70 2004/01/13 02:42:51 tsi Exp $

#ifndef OSName
# define OSName		DefaultOSName
#endif
#ifndef OSMajorVersion
# define OSMajorVersion	DefaultOSMajorVersion
#endif
#ifndef OSMinorVersion
# define OSMinorVersion	DefaultOSMinorVersion
#endif
#ifndef OSTeenyVersion
# define OSTeenyVersion	DefaultOSTeenyVersion
#endif
XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion)

/* For various reasons, Sun uses different settings when compiling the
 * X Window System packages included in Solaris than are normally used
 * by most people building the X.Org software releases.   Sun also has
 * two different X server hierarchies in Solaris - Xsun in /usr/openwin
 * and Xorg in /usr/X11.
 *
 * If you want to try to match Sun's settings as closely as possible
 * add this setting to your host.def:
 *  #define BuildLikeSun YES
 *
 * If you're trying to match the openwin directory layout as well, you'll
 * need to also add:
 *  #define ProjectRoot /usr/openwin
 * otherwise it will use /usr/X11.  (Note that these settings match closer
 * to Sun's Xorg delivery in /usr/X11 than the older X11R6.6-based delivery
 * in /usr/openwin though.)
 */
#ifndef BuildLikeSun
# define BuildLikeSun NO
#endif

#if BuildLikeSun
# ifndef ProjectRoot
#  define ProjectRoot		/usr/X11
# endif
# ifndef DocDir
#  define DocDir		Concat(ProjectRoot,/share/doc)
# endif
# ifndef ManDirectoryRoot
#  define ManDirectoryRoot	Concat(ProjectRoot,/share/man)
# endif
# ifndef ManSuffix
#  define ManSuffix		1
# endif
# ifndef LibraryCCOptions
#  if DoSharedLib && defined(SharedLibraryCCOptions)
#   define LibraryCCOptions SharedLibraryCCOptions ArchLibraryCCOptions
#  else
#   define LibraryCCOptions DefaultCCOptions ArchLibraryCCOptions
#  endif
# endif
#endif

/* Flag passed to makestrs in Xt build to control string array names in the
 * libXt headers.   -solarisabinames matches those used in the libXt in
 * Solaris, but not in other OS'es.
 */
#ifndef SolarisABIFlag
# if BuildLikeSun
#  define SolarisABIFlag -solarisabinames
# else
#  define SolarisABIFlag /**/
# endif
#endif

/*
 * Compiler setup.  This sun.cf file knows what options to use with
 * certain compilers, including Sun C, CenterLine C, and gcc.  It
 * also understands how to set some of the options for various C++
 * compilers, including Sun C++ and CenterLine C++.
 *
 * === C Compiler Setup ==========================================
 *
 * For SunPro C, define HasSunC to YES in site.def.
 * For CenterLine C, define HasCenterLineC to YES in site.def
 * For gcc, gcc2 or gcc3, define HasGcc, HasGcc2 or HasGcc3 to YES in site.def
 * For other compilers, define HasSunC to NO in site.def, then
 *    provide appropriate values for the various compiler related
 *    configuration variables used here.
 *
 * If you don't tell us which C compiler you have, we assume you have
 * the SunPro C compiler under Solaris 2.x, and the bundled /bin/cc
 * under SunOS 4.1.x
 *
 * === C++ Compiler Setup ==========================================
 *
 * For SunPro C++, define HasSunCplusplus to YES in site.def
 * For CenterLine C++, define HasCenterLineCplusplus to YES in site.def
 * For Gnu g++ 2.6.x, define HasGcc2ForCplusplus to YES in site.def
 * For other compilers, define HasCplusplus to YES in site.def, and
 *    check to see if you need to provide values for CplusplusOptions
 *    and/or DefaultCplusplusOptions.
 *
 * In any case, you may also need to set CplusplusDependIncludes.
 *
 * If you say you have the SunPro C++ compiler, we assume you have
 * version 3.0.x of the compiler.  If you have version 4.0.x instead,
 * define CplusplusCompilerMajorVersion as 4 in site.def.
 *
 */

#ifndef HasGcc3
#define HasGcc3 NO
#endif
#ifndef HasGcc2
#define HasGcc2 HasGcc3
#endif
#ifndef HasGcc
#define HasGcc HasGcc2
#endif

#ifndef HasSunC
# if HasCenterLineC || HasGcc || HasGcc2 || HasGcc3 || (OSMajorVersion < 5)
#  define HasSunC NO
# else
#  define HasSunC YES
# endif
#endif

#if HasSunC
# ifndef CCompilerMajorVersion
#  define CCompilerMajorVersion DefaultSunProCCompilerMajorVersion
# endif
# ifndef CCompilerMinorVersion
#  define CCompilerMinorVersion DefaultSunProCCompilerMinorVersion
# endif
XCOMM SunPro C CCompilerMajorVersion./**/CCompilerMinorVersion

/* Choose some reasonable default optimizer flags based on compiler &
   OS versions */
# ifndef OptimizedCDebugFlags
#  if (CCompilerMajorVersion > 5) || \
	(CCompilerMajorVersion == 5 && CCompilerMinorVersion > 2)
#   define OptimizedCDebugFlags -xO4 -xbuiltin=%all -xlibmil -xstrconst ArchOptimizedFlags
#  else
#   define OptimizedCDebugFlags -xO4 -xstrconst ArchOptimizedFlags
#  endif
# endif
# ifndef ArchOptimizedFlags
#  if OSMajorVersion == 5
#   if defined(SparcArchitecture) && !defined(Sparc64Architecture)
#    if OSMinorVersion > 9 /* Solaris 10 and later only run on UltraSPARC's */
#     define ArchOptimizedFlags -xarch=v8plus
#    else
#     define ArchOptimizedFlags -xarch=v8
#    endif
#   elif defined(i386Architecture) || defined(AMD64Architecture)
#    if (CCompilerMajorVersion > 5) || \
	(CCompilerMajorVersion == 5 && CCompilerMinorVersion >= 7)
/* -xregs=no%frameptr is required on x86 when compiling at -xO4 or higher to
 * avoid losing stack frame pointers so you can't get stack traces or debug.
 * This may lose a small bit of performance, so you can override by adding
 * #define FramePtrFlags -xregs=frameptr if you care about performance more
 * than debuggability.
 */
#     ifndef FramePtrFlags
#      define FramePtrFlags -xregs=no%frameptr
#     endif
#    endif
#    ifndef FramePtrFlags
#     define FramePtrFlags /* */
#    endif
#    if defined(i386Architecture) && (OSMinorVersion > 8)
       /* Solaris 9 and later require Pentium or better */
#      define ArchOptimizedFlags -xpentium FramePtrFlags
#    else
#     define ArchOptimizedFlags FramePtrFlags
#    endif
#   endif
#  endif
#  ifndef ArchOptimizedFlags
#   define ArchOptimizedFlags /**/
#  endif
# endif
# ifndef DefaultCDebugFlags
#  define DefaultCDebugFlags OptimizedCDebugFlags
# endif
# ifndef SharedLibraryLdCmd
#  define SharedLibraryLdCmd $(CC)
# endif
/* Flags for lint version included with Sun C compilers */
# if OSMajorVersion >= 5
#  ifndef LintLibFlag
#   define LintLibFlag -y -o
#  endif
#  ifndef LintOpts
#   define LintOpts -b -h -u -erroff=E_INDISTING_FROM_TRUNC2 $(LINTSECFLAG) ExtraLibraries MathLibrary -lc
#  endif
#  ifndef LintSecFlag
#   if (CCompilerMajorVersion > 5) || \
       (CCompilerMajorVersion == 5 && CCompilerMinorVersion >= 6)
#    define LintSecFlag -errsecurity=standard
#   else
#    define LintSecFlag /**/
#   endif
#  endif
      LINTSECFLAG = LintSecFlag
#  ifndef LintLibReferences
#   define LintLibReferences(varname,libname,libsource)                    @@\
       Concat(LINT,varname) = _UseCat(-L $(LINTLIBDIR) -l, -L libsource -l,libname)
#  endif

# endif /* Lint Flags for Solaris */

#endif /* HasSunC */

#ifndef ArchLibraryCCOptions
# if HasSunC && defined(SparcArchitecture) && CCompilerMajorVersion > 3
#  define ArchLibraryCCOptions -xregs=no%appl
# else
#  define ArchLibraryCCOptions
# endif
#endif /* ArchLibraryCCOptions */

/* we used to have this here :
 *
 * #if HasSunC
 * # ifndef CCompilerMajorVersion
 * #  define CCompilerMajorVersion 3
 * #  define DefaultCDebugFlags	-xO3
 * #  define OptimizedCDebugFlags	-xO3
 * # endif
 * #endif
 */

#ifndef HasSunCplusplus
# define HasSunCplusplus HasSunC	/* ??? */
#endif
#if HasSunCplusplus
# ifndef HasCplusplus
#  define HasCplusplus YES
#  define OptimizedCplusplusDebugFlags	-xO4 -xbuiltin=%all -xlibmil
# endif
# ifndef CplusplusCompilerMajorVersion
#  ifdef DefaultSunProCplusplusCompilerMajorVersion
#   define CplusplusCompilerMajorVersion DefaultSunProCplusplusCompilerMajorVersion
#  else
#   define CplusplusCompilerMajorVersion 3
#  endif
# endif
# ifndef CplusplusCompilerMinorVersion
#  ifdef DefaultSunProCplusplusCompilerMinorVersion
#   define CplusplusCompilerMinorVersion DefaultSunProCplusplusCompilerMinorVersion
#  else
#   define CplusplusCompilerMinorVersion 0
#  endif
# endif
# ifndef CplusplusLibC
#  if CplusplusCompilerMajorVersion >= 5
#   define CplusplusLibC -norunpath -lCrun
#  endif
# endif
XCOMM SunPro C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion
#endif

/* we used to have this here :
 *
 * # ifndef CplusplusCompilerMajorVersion
 * #  define CplusplusCompilerMajorVersion	4
 * # endif
 */

#if HasCenterLineC
# ifndef CcCmd
#  define CcCmd clcc
# endif
#endif

#if HasCenterLineCplusplus
# ifndef HasCplusplus
#  define HasCplusplus YES
# endif
# ifndef DefaultCplusplusOptions
#  define DefaultCplusplusOptions -Xa
# endif
# ifndef CplusplusOptions
#  define CplusplusOptions -Xa
# endif
#endif

#if OSMajorVersion < 4 || (OSMajorVersion == 4 && OSMinorVersion < 1)
/* We do not guarantee this will work */
# define BootstrapCFlags	-DNOSTDHDRS
# define StandardDefines	-DNOSTDHDRS
# define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
#endif

#if OSMajorVersion == 4
# if OSMinorVersion == 1
#  define HasPoll		YES
# endif
# if OSMinorVersion > 1 || (OSMinorVersion == 1 && OSTeenyVersion > 1)
/* You ALSO need this if you have Sun ld patch 100170-06 or later to 4.1.1 */
#  define SunPost411FCSLd	YES
# endif
#endif

/* The Xsun server was not building for SunOS 5.7 due to
   includes of <sys/cg2reg.h>.
*/
#if OSMajorVersion < 5
# define IncludeCG2HeaderDefine	-DINCLUDE_CG2_HEADER
#else
# define IncludeCG2HeaderDefine /**/
#endif

#if defined(i386Architecture) || defined(AMD64Architecture)
# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
#  define OSServerExtraDefines	-D__SOL8__
# endif
#endif

#if !HasGcc
# if HasSunC
#  if defined(AMD64Architecture)
#   define AsmArch amd64
#   define AsmFlags -xarch=amd64
#  elif defined(i386Architecture)
#   define AsmArch ia32
#   define AsmFlags /**/
#  elif defined(Sparc64Architecture)
#   define AsmArch sparcv8plus
#   define AsmFlags -xarch=v9
#  elif defined(SparcArchitecture)
#   define AsmArch sparcv8plus
#   define AsmFlags -xarch=v8plus
#  endif
#  ifndef CompilerServerExtraDefines
#   define CompilerServerExtraDefines $(SERVERSRC)/hw/xfree86/os-support/sunos/AsmArch.il
#  endif
# endif
#endif

#ifndef CompilerServerExtraDefines
# define CompilerServerExtraDefines /**/
#endif

#ifndef OSServerExtraDefines
# define OSServerExtraDefines	/**/
#endif

#ifndef ArchServerExtraDefines
# if defined(Sparc64Architecture) || defined(AMD64Architecture)
#  define ArchServerExtraDefines -D_XSERVER64
# else
#  define ArchServerExtraDefines /**/
# endif
#endif

#define ServerOSDefines		XFree86ServerOSDefines IncludeCG2HeaderDefine
#define ServerExtraDefines	AllocateLocalDefines XFree86ServerDefines \
				CompilerServerExtraDefines \
				OSServerExtraDefines ArchServerExtraDefines

#ifndef HasPerl
/* Solaris 8 comes with perl.  Earlier versions don't. */
# if (OSMajorVersion == 5) && (OSMinorVersion >= 8)
#  define HasPerl		YES
# else
#  define HasPerl		NO
# endif
#endif

#ifndef XkbServerDefines
# if BuildLikeSun
#  define XkbServerDefines  -DXKB_ALWAYS_USES_SOFT_REPEAT \
	-DXKM_OUTPUT_DIR='"/var/run/xkb/"' -DXKM_OUTPUT_DIR_MODE=0775 \
	-DMAKE_XKM_OUTPUT_DIR
# else
#  define XkbServerDefines  -DXKB_ALWAYS_USES_SOFT_REPEAT
# endif
#endif

#if OSMajorVersion > 4
# define ConnectionFlags		-DTCPCONN -DUNIXCONN -DLOCALCONN
# if HasSunC
#  ifdef DefaultSunProCCompilerDir
#   ifndef  CcCmd
#    define CcCmd		DefaultSunProCCompilerDir/cc
#   endif
#  endif
#  ifdef DefaultSunProCplusplusCompilerDir
#   ifndef  CplusplusCmd
#    define CplusplusCmd	DefaultSunProCplusplusCompilerDir/CC
#   endif
#   ifndef  CplusplusFilt
#    define CplusplusFilt	DefaultSunProCplusplusCompilerDir/c++filt
#   endif
#   ifndef  CplusplusWhatdir
#    define CplusplusWhatdir	DefaultSunProCplusplusCompilerDir/whatdir
#   endif
#  else /* DefaultSunProCplusplusCompilerDir not defined */
#   ifndef  CplusplusWhatdir
#    define CplusplusWhatdir	whatdir
#   endif
#  endif /* DefaultSunProCplusplusCompilerDir */
#  ifndef  CplusplusDependIncludes
#   if CplusplusCompilerMajorVersion > 3
#    define CplusplusDependIncludes	-I`CplusplusWhatdir CC`/../include/CC
#   elif CplusplusCompilerMajorVersion > 2
#    define CplusplusDependIncludes	-I/opt/SUNWspro/SC3.0/include/CC
#   else
#    define CplusplusDependIncludes	-I/opt/SUNWspro/SC2.0.1/include/CC
#   endif
#  endif
# endif /* HasSunC */

# if HasSunC && (CCompilerMajorVersion < 3)
#  define BootstrapCFlags	-DSVR4
# else
#  define BootstrapCFlags	/* none needed */
# endif
# ifndef XawI18nDefines
#  if OSMinorVersion < 4
#   define XawI18nDefines    -DHAS_WCTYPE_H -DHAS_ISW_FUNCS
#  else
#   define XawI18nDefines    -DHAS_WCHAR_H -DHAS_ISW_FUNCS
#  endif
# endif
# if OSMinorVersion > 10
#  define InstallCmd	    /usr/gnu/bin/install
# elif OSMinorVersion > 3
#  define InstallCmd	    /usr/ucb/install
# endif
#ifndef LargefileDefines
# if (OSMajorVersion > 5) || (OSMajorVersion == 5 && OSMinorVersion >= 6)
#  define LargefileDefines -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
# else
#  define LargefileDefines /* */
# endif
#endif
# ifdef AMD64Architecture
#  define StandardDefines	-Dsun -DSVR4 -D__EXTENSIONS__ -D__amd64
#  define ToolkitStringsABIOptions	-intelabi SolarisABIFlag
# elif defined(i386Architecture)
#  if (OSMajorVersion < 4) || ((OSMajorVersion == 5) && (OSMinorVersion <= 5))
#   define StandardDefines	-Dsun -Di386 -DSVR4 -D__EXTENSIONS__ -D__i386 \
				-D__SOL64__ LargefileDefines
#  else
#   define StandardDefines	-Dsun -Di386 -DSVR4 -D__EXTENSIONS__ -D__i386 \
                                LargefileDefines
#  endif
#  define ToolkitStringsABIOptions	-intelabi SolarisABIFlag
# else
#  define StandardDefines	  -Dsun -Dsparc -DSVR4 -D__EXTENSIONS__ LargefileDefines
#  define ToolkitStringsABIOptions	-sparcabi SolarisABIFlag
# endif
/* Socket support was in separate libraries before 5.12, then merged to libc */
# if (OSMajorVersion == 5) && (OSMinorVersion < 12)
#  define ExtraLibraries -lsocket -lnsl
# else
#  define ExtraLibraries /**/
# endif
# define HasWeakSymbols	  YES
# if OSMinorVersion > 1
#  ifndef ThreadedX
#   define ThreadedX	  YES
#  endif
#  define MTSafeAPIDefines	-DXUSE_MTSAFE_API -DXUSE_NETDB_R_API
/* Thread support was in separate library before 5.10, then merged to libc */
#  if (OSMajorVersion == 5) && (OSMinorVersion < 10)
#   if HasSunC && CCompilerMajorVersion > 2
#    define ThreadsCompileFlags -mt
#   else
#    define ThreadsLibraries -lthread
#   endif
#   if HasSunCplusplus && CplusplusCompilerMajorVersion > 3
#    define ThreadsCplusplusCompileFlags -mt
#   else
#    define ThreadsCplusplusLibraries -lthread
#   endif
#   define SystemMTDefines -D_REENTRANT
#  else
   /* Solaris 10 & later */
#   define SystemMTDefines -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
#  endif
#  define CplusplusSystemMTDefines SystemMTDefines
# endif 		/* OSMinorVersion > 1 */
# ifndef UseExportLists
#  if (OSMinorVersion > 4) && !HasGcc2
#   define UseExportLists YES
#  else
#   define UseExportLists NO
#  endif
# endif
# if OSMinorVersion > 5 /* Solaris 2.6 and later */
#  define HasSnprintf YES
# endif
# if OSMinorVersion > 7 /* Solaris 8 and later */
#  define HasStrlcat	YES
#  define HasStrcasecmp	YES
#  define HasVarRun	YES
# endif
# if OSMinorVersion > 9 /* Solaris 10 and later */
#  define HasSetenv	YES
#  define HasGetpeerucred YES
#  define HasGetoptLong YES
#  define DlLibrary	-lc  /* dlopen() is in libc in Solaris 10 */
# endif
# define HasVFork	NO
# define HasDlopen	YES
# define InstallXloadSetGID	NO /* libkstat doesn't require gid kmem */
# define InstKmemFlags	-g sys -m 2711
# define ShLibIncludeFile <sunLib.tmpl>
# define LinkerRuntimeLibraryPathFlag(path) Concat(-R,path)
# define RpathLoadFlags LinkerRuntimeLibraryPathFlag($(USRLIBDIRPATH))
/*
 * Set flags for position independent code before including sv4Lib.rules
 * if the compiler in use doesn't use standard SVR4 flags
 */
# if HasSunC || HasCenterLineC
#  define PositionIndependentCFlags -Kpic
#  define LargePositionIndependentCFlags -KPIC
#  ifdef Sparc64Architecture
#   define LargePICTable YES
#  endif
# endif
# if HasSunCplusplus || HasCenterLineCplusplus
#  define PositionIndependentCplusplusFlags -pic
#  define LargePositionIndependentCplusplusFlags -PIC
# endif
/* As is done in sco5.cf, we lie and say Solaris has NCURSES, since
 * the system curses is close enough for xorgcfg's purposes.  xorgcfg
 * should not depend on the NCURSES package but rather on a "capable curses",
 * of which NCURSES is just one.
 */
#define	HasNCurses		YES
#define NCursesLibName		-lcurses
#else /* not OSMajorVersion > 4 */
#define InstKmemFlags	  -g kmem -m 2711
#include <sunLib.rules>
#endif /* OSMajorVersion > 4 (else) */

/* Solaris 10 includes FreeType already.  It's also available in GNOME 2.0 for
 * Solaris 8 & 9, and in Solaris 9 4/03 and later, but there's no easy way to
 * detect that in imake, so users of those releases who want to use the
 * installed FreeType instead of the one in this tree should copy the following
 * two settings to their host.def.  Those who want to use the in-tree copy
 * regardless of OS version should add "#define HasFreetype2 NO" to host.def.
 */
#ifndef HasFreetype2
# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
#  define HasFreetype2 YES
#  ifndef Freetype2Dir
#   define Freetype2Dir /usr/sfw
#  endif
# else
#  define HasFreetype2 NO
# endif
#endif

#ifndef HasExpat
# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 10))
#  define HasExpat YES
#  ifndef ExpatDir
#   define ExpatDir /usr/sfw
#  endif
# else
#  define HasExpat NO
# endif
#endif

/* Solaris 10 includes fontconfig, but not the fcprivate.h header needed by
 * Xft1 library.
 */
#ifndef HasFontconfig
# define HasFontconfig NO
#endif

/* libpng was in /usr/sfw/lib on Solaris 9, moved to /usr/lib in Solaris 10 */
#ifndef HasLibpng
# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 9))
#  define HasLibpng YES
#  if !defined(LibpngDir) && ((OSMajorVersion == 5) && (OSMinorVersion == 9))
#   define LibpngDir /usr/sfw
#  endif
# else
#  define HasLibpng NO
# endif
#endif

#ifndef HasZlib
# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
#  define HasZlib YES
# else
#  define HasZlib NO
# endif
#endif

#ifndef TroffCmd
# if !(HasGroff)
#  define TroffCmd troff -Tpost
# endif
#endif

#define BuildLibPathVar	  LD_LIBRARY_PATH
#define HasNdbm		  YES
#define HasShm		  YES
#define HasSecureRPC	  YES
#define SetTtyGroup	  YES
#define HasPutenv	  YES
#define HasMkstemp        YES
#if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 8))
#define HasDevRandom	  YES	/* /dev/random is in Solaris 8 patches 	*/
#define PollDevRandom	  YES	/* /dev/random is poll()able on Solaris */
#endif
#if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 9))
# define HasIssetugid	  YES
#endif
#if defined(Sun3Architecture) || defined(SparcArchitecture) || defined(Sparc64Architecture)
# ifndef Xsun24Server
#  define Xsun24Server	  NO		/* color, mono, multiple depths */
# endif
# ifndef XsunServer
#  define XsunServer	  NO		/* color and mono, 8 bit only */
# endif
# ifndef XsunMonoServer
#  define XsunMonoServer	  NO		/* monochrome only */
# endif
# ifndef XorgServer
#  define XorgServer	(!(Xsun24Server || XsunServer || XsunMonoServer))
# endif
# undef BuildXF86DRI
# define BuildXF86DRI     NO
# if (OSMajorVersion > 4)
#  if !defined(AsOutputArchSize) || \
      ((AsOutputArchSize != 32) && (AsOutputArchSize != 64))
#   undef AsOutputArchSize
#   define AsOutputArchSize	32
#  endif
#  ifndef AsVISOption
#   if AsOutputArchSize == 32
#    ifdef UseGas
#     define AsVISOption		-Av8plusa
#    else
#     define AsVISOption		-xarch=v8plusa
#    endif
#   else
#    ifdef UseGas
#     define AsVISOption		-Av9a
#    else
#     define AsVISOption		-xarch=v9a
#    endif
#   endif
#  endif
# endif
#endif /* SPARC or Sun3/M68k */

#if OSMajorVersion >= 4
#define HasUsableFileMmap YES
#endif

#ifndef UseDeprecatedKeyboardDriver
#define UseDeprecatedKeyboardDriver YES
#endif

#if HasGcc
# if OSMajorVersion > 4
#  ifndef DefaultCCOptions
#   ifdef UseInstalled
#    define DefaultCCOptions -DNO_ASM
#   elif OSMinorVersion > 6
#    define DefaultCCOptions -DNO_ASM GccWarningOptions
#   elif OSMinorVersion > 3
#    define DefaultCCOptions -DNO_ASM GccWarningOptions -ansi -pedantic
#   else
#    define DefaultCCOptions -DNO_ASM
#   endif
#  endif
# endif
# if HasGcc2
#  ifndef CcCmd
#   define CcCmd gcc
#  endif
#  ifndef AsCmd
#   define AsCmd CcCmd -c -x assembler
#  endif
#  ifndef OptimizedCDebugFlags
#   ifdef i386Architecture
#    define OptimizedCDebugFlags DefaultGcc2i386Opt
#   elif defined(AMD64Architecture)
#    define OptimizedCDebugFlags DefaultGcc2AMD64Opt
#   else
#    define OptimizedCDebugFlags -O2
#   endif
#  endif
#  if !defined(SharedLibraryLoadFlags) && !defined(SharedLibraryLdCmd)
#   if OSMajorVersion == 5 && OSMinorVersion > 6 && defined(i386Architecture)
    /* This is to work around what appears to be a PIC bug in some gcc/egcs
       versions that shows up with the Solaris 7/x86 <ctype.h>. */
#    define SharedLibraryLdCmd $(LD)
#    define SharedLibraryLoadFlags -G -z textwarn
#   else
#    define SharedLibraryLdCmd $(CC)
#    define SharedLibraryLoadFlags -shared -z text
#   endif
#  endif
# else
#  define SharedLibraryCcCmd cc
#  define ExtraLoadFlags -B/usr/bin/
#  define AllocateLocalDefines /**/

.c.o:
	ClearmakeOSName	$(CC) -c $(CFLAGS) $*.c

# endif /* HasGcc2 (else) */

#else /* not HasGcc */

# define AllocateLocalDefines -DINCLUDE_ALLOCA_H

/* Set up compiler-dependent options for Sun C */
/*
 * To build 64-bit binaries define Sparc64Architecture or AMD64Architecture
 * in your site.def or host.def file.
 */
# if HasSunC
#  ifdef Sun3Architecture
#   ifndef DefaultCCOptions
#    define DefaultCCOptions -f68881 -pipe
#   endif
#  else	/* not defined(Sun3Architecture) */
#   if OSMajorVersion < 5
#    ifndef DefaultCCOptions
#     define DefaultCCOptions -pipe
#    endif
#   else /* OSMajorVersion >= 5*/
#    ifndef DefaultXArchOptions
#     if ((CCompilerMajorVersion > 5) || \
          (CCompilerMajorVersion == 5) && (CCompilerMinorVersion >= 9))
      /* Sun Studio 12.0 (cc 5.9) or later */
#      if (defined(Sparc64Architecture) || defined(AMD64Architecture))
#	define DefaultXArchOptions -m64
#      else
#	define DefaultXArchOptions -m32
#      endif
#     else
#      ifdef Sparc64Architecture
#	define DefaultXArchOptions -xarch=v9
#      elif defined(AMD64Architecture)
#	define DefaultXArchOptions -xarch=generic64
#      else
#       define DefaultXArchOptions /* */
#      endif
#     endif
#     ifndef DefaultCCOptions
#      define DefaultCCOptions -Xa -v DefaultXArchOptions -z lazyload -z combreloc -xstrconst -xildoff
#     endif
#     ifndef DefaultCplusplusOptions
#      define DefaultCplusplusOptions DefaultXArchOptions -z lazyload -z combreloc -xildoff
#     endif
#     ifndef SharedLibraryLoadFlags
#      define SharedLibraryLoadFlags -G DefaultXArchOptions -z text $(EXTRA_LOAD_FLAGS)
#     endif
#    endif
#   endif
#  endif
# endif

/* Set compiler-dependent options for CenterLine C */

# if HasCenterLineC
#  ifndef DefaultCCOptions
#   define DefaultCCOptions -Xt -w1 -DANSICPP -U__HIGHC__
#  endif
#  ifndef NeedConstPrototypes
#   define NeedConstPrototypes YES
#  endif
#  ifndef NeedNestedPrototypes
#   define NeedNestedPrototypes YES
#  endif
#  ifndef NeedVarargsPrototypes
#   define NeedVarargsPrototypes YES
#  endif
# endif


#endif /* HasGcc (else) */

#if OSMajorVersion < 5
# define SharedAllocateLocalDefines -DINCLUDE_ALLOCA_H
# define LibraryCCOptions /* don't want special floating point */
#else /* OSMajorVersion >= 5, i.e. Solaris 2.0 & later */
/* Only load libraries when needed on Solaris 7 & later */
# if OSMinorVersion >= 7
#  define LazyLoadFlag -z lazyload -z combreloc
# else
#  define LazyLoadFlag /* */
# endif
/* Link with extra mapfiles for some performance & security enhancements */
#ifndef MapfileFlag
# if HasSunC
#  define MapfileFlag -M
# else
#  define MapfileFlag -Wl,-M,
# endif
#endif
#ifndef Mapfile_BssAlign
# if OSMinorVersion >= 9
#  define Mapfile_BssAlign $(MAPFILEFLAG)/usr/lib/ld/map.bssalign
# else
#  define Mapfile_BssAlign /**/
# endif
#endif
#ifndef Mapfile_PageAlign
# if OSMinorVersion >= 10
#  define Mapfile_PageAlign $(MAPFILEFLAG)/usr/lib/ld/map.pagealign
# else
#  define Mapfile_PageAlign /**/
# endif
#endif
#ifndef Mapfile_NoExStack
# if OSMinorVersion >= 9
#  define Mapfile_NoExStack $(MAPFILEFLAG)/usr/lib/ld/map.noexstk
# else
#  define Mapfile_NoExStack /**/
# endif
#endif
#ifndef Mapfile_NoExData
# if defined(SparcArchitecture)
/* SPARC architecture requires PLT section in .data be executable, so
   we can only make .bss, not all of .data no-exec on SPARC */
#   define Mapfile_NoExData /**/
# else
#  if OSMinorVersion >= 10
#   define Mapfile_NoExData $(MAPFILEFLAG)/usr/lib/ld/map.noexdata
#  else
#   define Mapfile_NoExData /**/
#  endif
# endif
#endif
       MAPFILEFLAG = MapfileFlag
  MAPFILES_FOR_ALL = Mapfile_PageAlign Mapfile_NoExData
MAPFILES_FOR_PROGS = Mapfile_BssAlign Mapfile_NoExStack
/* ExtraLoadFlags apply to all binaries - programs & libraries */
# ifndef ExtraLoadFlags
#  define ExtraLoadFlags LazyLoadFlag $(MAPFILES_FOR_ALL)
# endif
/* ExtraLoadOptions only apply to programs */
# ifndef ExtraLoadOptions
#  define ExtraLoadOptions -B direct $(MAPFILES_FOR_PROGS)
# endif
#endif /* OSMajorVersion < 5 */

/* 64-bit build support */
#ifndef Solaris64bitSubdir
# ifdef Sparc64Architecture
#  define Solaris64bitSubdir	sparcv9
# elif defined(AMD64Architecture)
#  define Solaris64bitSubdir	amd64
# endif
#endif

#ifdef Solaris64bitSubdir
# define LibDirName Concat3(lib,/,Solaris64bitSubdir)
#endif

#if ((OSMajorVersion == 5) && (OSMinorVersion <= 11))
/* System V man page sections */
# ifndef FileManSuffix
#  define FileManSuffix	4		/* use just one tab or cpp will die */
# endif
# ifndef MiscManSuffix
#  define MiscManSuffix	5		/* use just one tab or cpp will die */
# endif
# ifndef DriverManSuffix
#  define DriverManSuffix	7	/* use just one tab or cpp will die */
# endif
# ifndef AdminManSuffix
#  define AdminManSuffix	1m	/* use just one tab or cpp will die */
# endif
#else
/* Bell Labs / BSD man page sections */
# ifndef FileManSuffix
#  define FileManSuffix	5		/* use just one tab or cpp will die */
# endif
# ifndef MiscManSuffix
#  define MiscManSuffix	7		/* use just one tab or cpp will die */
# endif
# ifndef DriverManSuffix
#  define DriverManSuffix	4	/* use just one tab or cpp will die */
# endif
# ifndef AdminManSuffix
#  define AdminManSuffix	8	/* use just one tab or cpp will die */
# endif
#endif

#if OSMajorVersion > 4
# include <svr4.cf>
#endif

#ifndef ManKeywordsTarget
# define ManKeywordsTarget(manpath)					@@\
man_keywords::								@@\
	catman -M $(DESTDIR)manpath -w
#endif

#if !defined(UsePamLibrary)
# if (OSMajorVersion > 5) || ((OSMajorVersion == 5) && (OSMinorVersion >= 4))
#  define UsePamLibrary		YES
# endif
#endif

/* PAM appeared in SunOS 5.6 */
#if !defined(HasPam)
# if (OSMajorVersion > 5) || (OSMajorVersion == 5 && OSMinorVersion >= 6)
#  define HasPam		YES
# endif
#endif

#ifndef PamLibraries
#define PamLibraries		-lpam
#endif

#ifndef HasMotif
/* Solaris's Motif depends on Solaris libX11 and won't work with libX11 built
 * from this tree, so only use it when using libX11 from outside the tree.
 */
# define HasMotif (defined(UseInstalled) || UseInstalledX11)
# define MotifDir /usr/dt
#endif /* !HasMotif */
#ifndef HasMotif2
/* Solaris's Motif2 version is broken and misses XmPrintShell
 * (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1366) */
# define HasMotif2 NO
#endif /* !HasMotif2 */

#define MotifDefines			\
	-DNO_ISDIR -DNO_REGCOMP -DNO_ALLOCA -DBOGUS_MB_MAX -DNO_CONST
#define PamUnixDefines		-DPAM_NIS
#define TtLargePICTable		YES
#define DtSvcDefines		-DXK_MISCELLANY -DMULTIBYTE -DNO_REGCOMP
#define DtSearchDefines		-DI18N_MSG DtSvcDefines
#define DtWidgetDefines		DtSearchDefines
#define DtPrintDefines		DtSearchDefines

#define baseDtMailDefines	\
	-DSunOS=OSMajorVersion\#\#OSMinorVersion -DMMAP_NORESERVE -DSPRO_V2
#if !defined(i386Architecture) && !defined(AMD64Architecture)
# define DtMailDefines		baseDtMailDefines
#else
# define DtMailDefines		-DBIG_ENDIAN baseDtMailDefines
#endif

#define ArchitectureDefines	-DSUN_ARCHITECTURE

#define TtClientExtraLibs	ExtraLibraries -ldl -lintl

#define ExportListGenSource	elistgen.sun
#define ShlibExportListOpt(filename)	-M filename

#define CdeProjectDefines \
	-DMULTIBYTE -DNLS16 -DMESSAGE_CAT -D_XOPEN_VERSION=4 \
	-D_XOPEN_SOURCE -D__EXTENSIONS__ \
	-DOSMAJORVERSION=OSMajorVersion -DOSMINORVERSION=OSMinorVersion


/*
 * Turn off HTML manpages like we do under NetBSD.
 */
#ifndef	BuildHtmlManPages
#define	BuildHtmlManPages	NO
#endif

/*
 * Turn off separate configuration directories.
 */
#ifndef	UseSeparateConfDir
#define	UseSeparateConfDir	NO
#endif

/* Hackery for building modules as Solaris shared objects with dependencies */
#if MakeDllModules && DoLoadableServer

/* If you change this, you will need to change find-deps.pl to match */
#define DlModuleDependencyName(module) Concat(module,_deps)

#define DlModuleTarget(module,deplist,modlist)                          @@\
DepDynamicModuleTarget(module,deplist DlModuleDependencyName(module),modlist LazyLoadFlag `cat DlModuleDependencyName(module)`) @@\
									@@\
DlModuleDependencyName(module):						@@\
	touch $@							@@\
									@@\
clean::                                                                 @@\
        RemoveFile(DlModuleDependencyName(module))

#define ObjectModuleTarget(module,objects)				@@\
DlModuleTarget(Concat(module,_drv.so), objects, objects)

#define LibraryModuleTarget(module,objects)				@@\
NormalLibraryTarget(module, objects)					@@\
DlModuleTarget(Concat3(lib,module,.so), objects, objects)

#define DepLibraryModuleTarget(module,deplist,objects)			@@\
NormalDepLibraryTarget(module, deplist, objects)			@@\
DlModuleTarget(Concat3(lib,module,.so), deplist, objects)

#endif