summaryrefslogtreecommitdiff
path: root/util/cf/FreeBSD.cf
blob: 8296dd47beeec8999a8a0c690c43378533367b2d (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
XCOMM platform:  $Xorg: FreeBSD.cf,v 1.3 2000/08/17 19:41:45 cpqbld Exp $
XCOMM platform:  $XdotOrg: xc/config/cf/FreeBSD.cf,v 1.10 2004/08/15 00:03:36 anholt Exp $
XCOMM
XCOMM
XCOMM
XCOMM platform:  $XFree86: xc/config/cf/FreeBSD.cf,v 3.147 2004/01/28 01:46:21 dawes Exp $

#ifndef UseElfFormat
#define UseElfFormat		DefaultToElfFormat
#endif

#if UseElfFormat
#define OSBinaryFormat		[ELF]
#else
#define OSBinaryFormat		[a.out]
#endif

#ifndef OSName
#define OSName			DefaultOSName OSBinaryFormat
#endif
#ifndef OSVendor
#define OSVendor		/**/
#endif
#ifndef OSMajorVersion
#define OSMajorVersion		DefaultOSMajorVersion
#endif
#ifndef OSMinorVersion
#define OSMinorVersion		DefaultOSMinorVersion
#endif
#ifndef OSTeenyVersion
#define OSTeenyVersion		DefaultOSTeenyVersion
#endif

#ifndef OSRelVersion
/* Include this to get finer-grained information about the OS version */
#include "/usr/include/osreldate.h"
#define OSRelVersion __FreeBSD_version
#endif

XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) (OSRelVersion)


#define HasCplusplus		YES
#define GccUsesGas		YES
#define UseGas			YES
#define GnuCpp			YES
#define HasNdbm			YES
#define HasPutenv		YES
#define HasSnprintf		YES
#if OSMajorVersion == 3 && OSMinorVersion >= 3 || OSMajorVersion > 3
# define HasStrlcat		YES
#endif
#if OSMajorVersion == 4 && OSMinorVersion >= 2 || OSMajorVersion > 4
# define HasBasename		YES
#else
# define HasBasename		NO
#endif
#define HasBSD44Sockets 	YES
#define HasDlopen		YES
#if ((OSRelVersion >= 410002) && OSRelVersion < 500000) || (OSRelVersion >= 500012)
#define HasSetProcTitle		YES
#endif
#ifndef HasLibCrypt
# define HasLibCrypt		YES
#endif
#ifndef HasShm
# define HasShm			YES
#endif
#define HasWChar32		YES
#define HasUsableFileMmap	YES
#define HasNCurses		YES
#define HasVarRun		YES
#define HasVarDb		YES
#ifndef BuildPDFdocs
# define BuildPDFdocs NO
#endif
#if (OSMajorVersion >= 3)
#define HasIssetugid		YES
#define HasPoll			YES
#endif

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

/* All versions define AF_INET6. 3.x and earlier don't have IPv6 support. */
#if OSMajorVersion < 4
#ifndef BuildIPv6
#define BuildIPv6		NO
#endif
#endif

#define IPv6SocketsAlsoIPv4	NO

#if (OSMajorVersion > 1)
#define InstallXloadSetGID	NO
#else
#define InstallXloadSetGID	YES
#endif

#define HasWeakSymbols		UseElfFormat

/*
 * Multi-thread safe libs 
 */	
/* 2.2.7 and later has libc_r (POSIX threads) */
#if OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7 || \
    OSMajorVersion >= 3
# define HasPosixThreads	YES
# define ThreadedX		YES
# define HasThreadSafeAPI	YES
# if OSRelVersion < 501000
#  define MTSafeAPIDefines	-DXUSE_MTSAFE_API -DXNO_MTSAFE_PWDAPI
# else
#  define MTSafeAPIDefines	-DXUSE_MTSAFE_API
# endif
# if (OSRelVersion < 500043)
#  define NeedUIThrStubs	YES
# endif
# if (OSRelVersion >= 502102)
#  define ThreadsLibraries	-lpthread
# elif (OSRelVersion >= 500016)
#  define ThreadsLibraries	-lc_r
# else
#  define ThreadsLibraries	-pthread
# endif
# define SystemMTDefines	-D_THREAD_SAFE
#endif

/* This fixes linking C programs against libGLU on FreeBSD 3.x */
#if (OSMajorVersion == 3)
#define SharedGLUReqs		$(LDPRELIB) $(XLIB) $(GLXLIB) -lstdc++ -lgcc
#endif

#define AvoidNullMakeCommand	YES
#define StripInstalledPrograms	YES
#define CompressAllFonts	YES
#define Malloc0ReturnsNull	YES
#define NeedConstPrototypes	YES
#define NeedFunctionPrototypes	YES
#define NeedNestedPrototypes	YES
#define NeedVarargsPrototypes	YES
#define NeedWidePrototypes	NO

#define HasPlugin		YES
#define VendorHasX11R6_3libXext	YES	/* XC or XFree86 >= 3.3.1 */

#define MkdirHierCmd		mkdir -p

#ifndef LexCmd
#define LexCmd			flex -l
#endif
#ifndef HasFlex
#define HasFlex			YES
#endif

#ifndef HasMktemp
#if (OSMajorVersion >= 4) || (OSMajorVersion == 3 && OSMinorVersion >= 1) || \
	(OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7)
#define HasMktemp		YES
#else
#define HasMktemp		NO
#endif
#endif

/*
 * 2.2.x has perl 4 by default, not perl 5.
 */
#if (OSMajorVersion <= 2)
#ifndef HasPerl5
#define HasPerl5		NO
#endif
#endif

#ifndef CcCmd
#define CcCmd			cc
#endif
#ifndef CplusplusCmd
#define CplusplusCmd		c++
#endif
#define CppCmd			/usr/bin/cpp
#define PreProcessCmd		CppCmd
#define StandardCppOptions	-traditional
#define StandardCppDefines	/**/
#ifndef DefaultCCOptions
#if defined(UseInstalled)
#define DefaultCCOptions	/**/
#else
#if defined(HasGcc3) && HasGcc3
#define NoSystemWarn		-Wno-system-headers
#else
#define NoSystemWarn
#endif
#define DefaultCCOptions	-ansi -pedantic NoSystemWarn -Dasm=__asm \
	GccWarningOptions
#endif
#endif
#ifndef ExtraLibraries
/* support for multi-byte locales is in libxpg4 rather than libc */
#if (OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2)) && \
    !(OSMajorVersion == 4 && OSRelVersion >= 400020) && \
    !(OSRelVersion >= 500005)
#define ExtraLibraries		-lxpg4
#else
#define ExtraLibraries		/**/
#endif
#endif
#ifndef UseGnuMalloc
/* 2.2 doesn't really have GnuMalloc */
#if OSMajorVersion < 2 || (OSMajorVersion == 2 && OSMinorVersion < 2)
#define UseGnuMalloc		YES
#else
#define UseGnuMalloc		NO
#endif
#endif
/* 2.2.2 and later has setusercontext() */
#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 2) || \
     (OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 2)
#define HasSetUserContext	YES
#endif

#if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 6)
#define HasGetpeereid		YES
#endif

/* 3.3(?) and later has support for setting MTRRs */
#ifndef HasMTRRSupport
#if OSMajorVersion > 3 || (OSMajorVersion == 3 && OSMinorVersion >= 3)
#define HasMTRRSupport		YES
#else
#define HasMTRRSupport		NO
#endif
#endif

/*
 * Drivers that don't need AGP can work with 4.0, but we don't have a
 * mechanism for specifying a subset of drivers in the OS.cf files yet.
 */
#ifndef BuildXF86DRI
#if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1)
#define BuildXF86DRI		YES
#endif
#endif

/*
 * 4.1/i386 and 5.0/i386,alpha,ia64,amd64 have the AGP driver.
 */
#ifndef HasAgpGart
#if defined(i386Architecture) && \
	(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1))
#define HasAgpGart		YES
#endif
#if (defined(AlphaArchitecture) || defined(ia64Architecture) || \
	defined(AMD64Architecture)) && (OSMajorVersion >= 5)
#define HasAgpGart		YES
#endif
#endif

/*
 * SSE and 3DNow will be autodetected, so binutils is the only 
 * requirement for enabling this.  By 4.2 they were all supported.
 */
#if defined(AMD64Architecture) || defined(i386Architecture) && \
	(OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 2))
# define HasX86Support          YES
# define HasMMXSupport		YES
# define Has3DNowSupport	YES
# define HasSSESupport		YES
#else
# define HasX86Support	        NO
# define HasMMXSupport		NO
# define Has3DNowSupport	NO
# define HasSSESupport		NO
#endif

/* 
 * This doesn't work the way it does on every other system. On FreeBSD it's
 * only a "hint, not a demand", whatever that means. Note that this is not 
 * what it says in the ld and ld.so man pages, which are rather vague on the
 * matter.
 *
 * But we do know that if a) you do what the X Project team does and set your 
 * ProjectRoot to something like "/X11", and b) you have other X libraries, 
 * e.g. in /usr/X11R6/lib, and you have added /usr/X11R6/lib to your 
 * ld.so.cache with ldconfig, then any programs linked with this "hint" will
 * find that ld.so ignores the "hint" at runtime and loads the libraries in 
 * the ld.so.cache, i.e.the wrong ones, instead! Empirically we find that
 * the run-path is only used as a last resort to find the libraries, after
 * the LD_LIBRARY_PATH and ld.so.cache.
 *
 * N. B. to FreeBSD users who are not familiar with the semantics of the run-
 * path on other systems. The run-path is akin to a per-program ld.so.cache. 
 * If a program is linked with a run-path, that run-path should take 
 * precedence over _everything_ else! In my opinion ldconfig and the 
 * ld.so.cache should be deprecated immediately now that FreeBSD has run-
 * paths. Any program that needs libraries that are outside the "well known" 
 * locations should be linked with a run-path.
 *
 * All of which begs the question: If this option doesn't work in any useful
 * way, why did they (FreeBSD) bother to add it? It would be nice if FreeBSD
 * would fix ld.so so that run-paths are truly useful.
 *
 * Using run-paths is added with the intent that vendors who ship X for 
 * FreeBSD should use it too. Once everyone uses it then there will be no 
 * reason for FreeBSD to assume that it knows where X libraries are installed 
 * and they can remove it from the list of directories they add to ld.so.cache 
 * in their /etc/rc file.
 */

#ifndef UseRpath
# define UseRpath		YES
#endif

#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2)

# ifndef RpathLoadFlags
#  if UseRpath
#   if UseElfFormat
#    define RpathLoadFlags	-Wl,-rpath,$(USRLIBDIRPATH)
#   else
#    define RpathLoadFlags	-Wl,-R,$(USRLIBDIRPATH)
#   endif
#  else
#   define RpathLoadFlags	/**/
#  endif
# endif

# ifndef ExtraLoadFlags
#  if UseElfFormat && !defined(UseInstalled)
#   define ExtraLoadFlags	RpathLoadFlags -Wl,-rpath-link,$(BUILDLIBDIR)
#  else
#   define ExtraLoadFlags	RpathLoadFlags
#  endif
# endif

#endif

#ifndef LibraryRpathLoadFlags
# if UseRpath
#  if UseElfFormat
#   define LibraryRpathLoadFlags	-rpath $(USRLIBDIRPATH)
#  else
#   define LibraryRpathLoadFlags	-R $(USRLIBDIRPATH)
#  endif
# else
#  define LibraryRpathLoadFlags		/**/
# endif
#endif

#ifndef SharedLibraryLoadFlags
# if UseElfFormat
#  define SharedLibraryLoadFlags	-shared LibraryRpathLoadFlags
# else
#  define SharedLibraryLoadFlags	-Bshareable LibraryRpathLoadFlags
# endif
#endif

#ifndef GnuMallocLibrary
#define GnuMallocLibrary	-lgnumalloc
#endif

#if (OSMajorVersion > 2) || (OSMajorVersion == 2 && OSMinorVersion >= 2) \
	|| (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 6)
/* 2.1.6 and 2.2 have libz */
#ifndef HasZlib
#define HasZlib		YES
#endif
#endif

/* PAM appeared in FreeBSD 3.1 */
#if (OSMajorVersion > 3) || (OSMajorVersion == 3 && OSMinorVersion >=1 )
#ifndef HasPam
#define HasPam		YES
#endif
#endif

/* There are two options for building.  One is to assume that the system has
 * many of the dependencies provided by the ports tree.  The other is to just
 * build everything from this tree.
 */

#ifndef HasStandardPorts
#define HasStandardPorts	YES
#endif

#ifndef LocalBase
#define LocalBase		/usr/local
#endif
#ifndef X11Base
#define X11Base			/usr/X11R6
#endif

#if HasStandardPorts

#ifndef HasExpat
# define HasExpat		YES
# define ExpatDir		LocalBase
#endif

#ifndef HasFreetype2
# define HasFreetype2		YES
# define Freetype2Dir		LocalBase
#endif

#ifndef HasFontconfig
# define HasFontconfig		YES
# define FontconfigDir		X11Base
#endif

#ifndef HasLibpng
# define HasLibpng		YES
# define LibpngDir		LocalBase
#endif

#endif /* HasStandardPorts */

#undef  InstallCmd
#define InstallCmd		/usr/bin/install

#if UseElfFormat
# define AsmElfDefines		-D__ELF__
#else
# define AsmElfDefines /**/
#endif

#if GccUsesGas
# define GccGasOption		-DGCCUSESGAS
# define AsmDefines		-DUSE_GAS AsmElfDefines
#else
# define GccGasOption /**/
# define AsmDefines		AsmElfDefines
#endif

#ifdef i386Architecture
#define ServerExtraDefines GccGasOption XFree86ServerDefines
#endif
#if defined(AlphaArchitecture) || defined(Sparc64Architecture) || \
	defined(ia64Architecture) || defined(AMD64Architecture)
#define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64
#endif
#ifdef Sparc64Architecture
#define AsVISOption		-Av9a
#define AsOutputArchSize	64
#endif

#ifdef PpcArchitecture
#define XF86INT10_BUILD		X86INT10_STUB
#endif

#define StandardDefines	-DCSRG_BASED

#if OSMajorVersion > 1
#define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME
#define XawI18nDefines		-DUSE_XWCHAR_STRING
#define HasMakefileSafeInclude	YES
#define IncludeMakefile(file) @@# dependencies are in .depend
#define DependFileName		.depend
#ifndef DoLoadableServer
#define DoLoadableServer	YES
#endif
#ifndef ForceNormalLib
#define ForceNormalLib		YES
#endif
#define HasMkstemp		YES
#else
#define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME -DXNO_SYSCONF
#define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
#endif

/* The GCC strength-reduce bug is fixed for FreeBSD 2.1.5 and later */
#ifndef DefaultGcc2i386Opt
#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 5)
#define DefaultGcc2i386Opt -O2 GccAliasingArgs
#endif
#endif

#ifdef i386Architecture
# define OptimizedCDebugFlags DefaultGcc2i386Opt
#else
# define OptimizedCDebugFlags -O
#endif

#ifndef PreIncDir
# define PreIncDir	/usr/include
#endif

#define HasGroff	YES
#define NroffCmd	env GROFF_NO_SGR=y groff -Tascii
#define SetTtyGroup	YES

#ifndef ExtraFilesToClean
# define ExtraFilesToClean *.core
#endif

#define DefaultUserPath		/bin:/usr/bin:/sbin:/usr/sbin:$(BINDIR):/usr/gnu/bin:/usr/local/bin
#define DefaultSystemPath	/bin:/usr/bin:/sbin:/usr/sbin:$(BINDIR)
#ifndef SystemManDirectory
#define SystemManDirectory	/usr/share/man
#endif

#define InstKmemFlags	-g kmem -m 2755

/*
 * Compress manual pages
 */
#ifndef CompressManPages
# define CompressManPages	YES
#endif

#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 1)
#define HasBsdMake	YES
#endif

#ifndef StaticLibrary
#define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic
#endif

#if UseElfFormat
#define DlLibrary		-rdynamic
#else
#define DlLibrary		/**/
#endif

#ifdef AlphaArchitecture
#define IoLibrary		-lio
#else
#define IoLibrary		/**/
#endif

#define ServerExtraSysLibs	IoLibrary
 
#ifndef PamLibraries
#define PamLibraries		-lpam DlLibrary
#endif

#ifndef SharedLibXdmGreet
# define SharedLibXdmGreet		NO
#endif

/*
 * On FreeBSD, the run-time loader will use the built-in "rpath" before
 * LD_LIBRARY_PATH.  This means that utilities like mkfontdir will load
 * installed libraries (if they exist) in preference to the ones in the
 * build tree, even though LD_LIBRARY_PATH points to the build tree.
 * This can result in the build failing.  One way to avoid this is to
 * pre-load the libraries from the build tree.
 *
 * There should be a better way than this hack...
 */
#if UseElfFormat
#ifndef PreloadFontSetup
#define PreloadFontSetup	LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(XFONTPRELOADPATTERN))`"
#endif
#ifndef PreloadFreetypeSetup
#define PreloadFreetypeSetup	LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(FT2PRELOADPATTERN))`"
#endif
#ifndef PreloadXFTSetup
#define PreloadXFTSetup		LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(FT2PRELOADPATTERN) $(XFTPRELOADPATTERN) $(XRENDERPRELOADPATTERN) $(FCPRELOADPATTERN))`"
#endif
#endif

#ifndef HasCookieMaker
/* Which versions have /dev/urandom? */
#if OSMajorVersion >= 4
#define HasCookieMaker		YES
#define MkCookieCmd \
	'dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"'
#else
#define HasCookieMaker		NO
#endif
#endif

/*
 * A hack to work around an optimization problem with gcc 2.95.2 - 2.95.4
 */
#if (GccMajorVersion == 2 && GccMinorVersion == 95)
#define GccOptBug295
#endif

#include <bsdLib.rules>

#include <xorg.cf>