FreeBSD.cf revision 4c61c93d
1XCOMM platform: $Xorg: FreeBSD.cf,v 1.3 2000/08/17 19:41:45 cpqbld Exp $ 2XCOMM platform: $XdotOrg: xc/config/cf/FreeBSD.cf,v 1.10 2004/08/15 00:03:36 anholt Exp $ 3XCOMM 4XCOMM 5XCOMM 6XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.147 2004/01/28 01:46:21 dawes Exp $ 7 8#ifndef UseElfFormat 9#define UseElfFormat DefaultToElfFormat 10#endif 11 12#if UseElfFormat 13#define OSBinaryFormat [ELF] 14#else 15#define OSBinaryFormat [a.out] 16#endif 17 18#ifndef OSName 19#define OSName DefaultOSName OSBinaryFormat 20#endif 21#ifndef OSVendor 22#define OSVendor /**/ 23#endif 24#ifndef OSMajorVersion 25#define OSMajorVersion DefaultOSMajorVersion 26#endif 27#ifndef OSMinorVersion 28#define OSMinorVersion DefaultOSMinorVersion 29#endif 30#ifndef OSTeenyVersion 31#define OSTeenyVersion DefaultOSTeenyVersion 32#endif 33 34#ifndef OSRelVersion 35/* Include this to get finer-grained information about the OS version */ 36#include "/usr/include/osreldate.h" 37#define OSRelVersion __FreeBSD_version 38#endif 39 40XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) (OSRelVersion) 41 42 43#define HasCplusplus YES 44#define GccUsesGas YES 45#define UseGas YES 46#define GnuCpp YES 47#define HasNdbm YES 48#define HasPutenv YES 49#define HasSnprintf YES 50#if OSMajorVersion == 3 && OSMinorVersion >= 3 || OSMajorVersion > 3 51# define HasStrlcat YES 52#endif 53#if OSMajorVersion == 4 && OSMinorVersion >= 2 || OSMajorVersion > 4 54# define HasBasename YES 55#else 56# define HasBasename NO 57#endif 58#define HasBSD44Sockets YES 59#define HasDlopen YES 60#if ((OSRelVersion >= 410002) && OSRelVersion < 500000) || (OSRelVersion >= 500012) 61#define HasSetProcTitle YES 62#endif 63#ifndef HasLibCrypt 64# define HasLibCrypt YES 65#endif 66#ifndef HasShm 67# define HasShm YES 68#endif 69#define HasWChar32 YES 70#define HasUsableFileMmap YES 71#define HasNCurses YES 72#define HasVarRun YES 73#define HasVarDb YES 74#ifndef BuildPDFdocs 75# define BuildPDFdocs NO 76#endif 77#if (OSMajorVersion >= 3) 78#define HasIssetugid YES 79#define HasPoll YES 80#endif 81 82#if OSMajorVersion >= 4 83#define HasGetIfAddrs YES 84#endif 85 86/* All versions define AF_INET6. 3.x and earlier don't have IPv6 support. */ 87#if OSMajorVersion < 4 88#ifndef BuildIPv6 89#define BuildIPv6 NO 90#endif 91#endif 92 93#define IPv6SocketsAlsoIPv4 NO 94 95#if (OSMajorVersion > 1) 96#define InstallXloadSetGID NO 97#else 98#define InstallXloadSetGID YES 99#endif 100 101#define HasWeakSymbols UseElfFormat 102 103/* 104 * Multi-thread safe libs 105 */ 106/* 2.2.7 and later has libc_r (POSIX threads) */ 107#if OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7 || \ 108 OSMajorVersion >= 3 109# define HasPosixThreads YES 110# define ThreadedX YES 111# define HasThreadSafeAPI YES 112# if OSRelVersion < 501000 113# define MTSafeAPIDefines -DXUSE_MTSAFE_API -DXNO_MTSAFE_PWDAPI 114# else 115# define MTSafeAPIDefines -DXUSE_MTSAFE_API 116# endif 117# if (OSRelVersion < 500043) 118# define NeedUIThrStubs YES 119# endif 120# if (OSRelVersion >= 502102) 121# define ThreadsLibraries -lpthread 122# elif (OSRelVersion >= 500016) 123# define ThreadsLibraries -lc_r 124# else 125# define ThreadsLibraries -pthread 126# endif 127# define SystemMTDefines -D_THREAD_SAFE 128#endif 129 130/* This fixes linking C programs against libGLU on FreeBSD 3.x */ 131#if (OSMajorVersion == 3) 132#define SharedGLUReqs $(LDPRELIB) $(XLIB) $(GLXLIB) -lstdc++ -lgcc 133#endif 134 135#define AvoidNullMakeCommand YES 136#define StripInstalledPrograms YES 137#define CompressAllFonts YES 138#define Malloc0ReturnsNull YES 139#define NeedConstPrototypes YES 140#define NeedFunctionPrototypes YES 141#define NeedNestedPrototypes YES 142#define NeedVarargsPrototypes YES 143#define NeedWidePrototypes NO 144 145#define HasPlugin YES 146#define VendorHasX11R6_3libXext YES /* XC or XFree86 >= 3.3.1 */ 147 148#define MkdirHierCmd mkdir -p 149 150#ifndef LexCmd 151#define LexCmd flex -l 152#endif 153#ifndef HasFlex 154#define HasFlex YES 155#endif 156 157#ifndef HasMktemp 158#if (OSMajorVersion >= 4) || (OSMajorVersion == 3 && OSMinorVersion >= 1) || \ 159 (OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7) 160#define HasMktemp YES 161#else 162#define HasMktemp NO 163#endif 164#endif 165 166/* 167 * 2.2.x has perl 4 by default, not perl 5. 168 */ 169#if (OSMajorVersion <= 2) 170#ifndef HasPerl5 171#define HasPerl5 NO 172#endif 173#endif 174 175#ifndef CcCmd 176#define CcCmd cc 177#endif 178#ifndef CplusplusCmd 179#define CplusplusCmd c++ 180#endif 181#define CppCmd /usr/bin/cpp 182#define PreProcessCmd CppCmd 183#define StandardCppOptions -traditional 184#define StandardCppDefines /**/ 185#ifndef DefaultCCOptions 186#if defined(UseInstalled) 187#define DefaultCCOptions /**/ 188#else 189#if defined(HasGcc3) && HasGcc3 190#define NoSystemWarn -Wno-system-headers 191#else 192#define NoSystemWarn 193#endif 194#define DefaultCCOptions -ansi -pedantic NoSystemWarn -Dasm=__asm \ 195 GccWarningOptions 196#endif 197#endif 198#ifndef ExtraLibraries 199/* support for multi-byte locales is in libxpg4 rather than libc */ 200#if (OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2)) && \ 201 !(OSMajorVersion == 4 && OSRelVersion >= 400020) && \ 202 !(OSRelVersion >= 500005) 203#define ExtraLibraries -lxpg4 204#else 205#define ExtraLibraries /**/ 206#endif 207#endif 208#ifndef UseGnuMalloc 209/* 2.2 doesn't really have GnuMalloc */ 210#if OSMajorVersion < 2 || (OSMajorVersion == 2 && OSMinorVersion < 2) 211#define UseGnuMalloc YES 212#else 213#define UseGnuMalloc NO 214#endif 215#endif 216/* 2.2.2 and later has setusercontext() */ 217#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 2) || \ 218 (OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 2) 219#define HasSetUserContext YES 220#endif 221 222#if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 6) 223#define HasGetpeereid YES 224#endif 225 226/* 3.3(?) and later has support for setting MTRRs */ 227#ifndef HasMTRRSupport 228#if OSMajorVersion > 3 || (OSMajorVersion == 3 && OSMinorVersion >= 3) 229#define HasMTRRSupport YES 230#else 231#define HasMTRRSupport NO 232#endif 233#endif 234 235/* 236 * Drivers that don't need AGP can work with 4.0, but we don't have a 237 * mechanism for specifying a subset of drivers in the OS.cf files yet. 238 */ 239#ifndef BuildXF86DRI 240#if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1) 241#define BuildXF86DRI YES 242#endif 243#endif 244 245/* 246 * 4.1/i386 and 5.0/i386,alpha,ia64,amd64 have the AGP driver. 247 */ 248#ifndef HasAgpGart 249#if defined(i386Architecture) && \ 250 (OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1)) 251#define HasAgpGart YES 252#endif 253#if (defined(AlphaArchitecture) || defined(ia64Architecture) || \ 254 defined(AMD64Architecture)) && (OSMajorVersion >= 5) 255#define HasAgpGart YES 256#endif 257#endif 258 259/* 260 * SSE and 3DNow will be autodetected, so binutils is the only 261 * requirement for enabling this. By 4.2 they were all supported. 262 */ 263#if defined(AMD64Architecture) || defined(i386Architecture) && \ 264 (OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 2)) 265# define HasX86Support YES 266# define HasMMXSupport YES 267# define Has3DNowSupport YES 268# define HasSSESupport YES 269#else 270# define HasX86Support NO 271# define HasMMXSupport NO 272# define Has3DNowSupport NO 273# define HasSSESupport NO 274#endif 275 276/* 277 * This doesn't work the way it does on every other system. On FreeBSD it's 278 * only a "hint, not a demand", whatever that means. Note that this is not 279 * what it says in the ld and ld.so man pages, which are rather vague on the 280 * matter. 281 * 282 * But we do know that if a) you do what the X Project team does and set your 283 * ProjectRoot to something like "/X11", and b) you have other X libraries, 284 * e.g. in /usr/X11R6/lib, and you have added /usr/X11R6/lib to your 285 * ld.so.cache with ldconfig, then any programs linked with this "hint" will 286 * find that ld.so ignores the "hint" at runtime and loads the libraries in 287 * the ld.so.cache, i.e.the wrong ones, instead! Empirically we find that 288 * the run-path is only used as a last resort to find the libraries, after 289 * the LD_LIBRARY_PATH and ld.so.cache. 290 * 291 * N. B. to FreeBSD users who are not familiar with the semantics of the run- 292 * path on other systems. The run-path is akin to a per-program ld.so.cache. 293 * If a program is linked with a run-path, that run-path should take 294 * precedence over _everything_ else! In my opinion ldconfig and the 295 * ld.so.cache should be deprecated immediately now that FreeBSD has run- 296 * paths. Any program that needs libraries that are outside the "well known" 297 * locations should be linked with a run-path. 298 * 299 * All of which begs the question: If this option doesn't work in any useful 300 * way, why did they (FreeBSD) bother to add it? It would be nice if FreeBSD 301 * would fix ld.so so that run-paths are truly useful. 302 * 303 * Using run-paths is added with the intent that vendors who ship X for 304 * FreeBSD should use it too. Once everyone uses it then there will be no 305 * reason for FreeBSD to assume that it knows where X libraries are installed 306 * and they can remove it from the list of directories they add to ld.so.cache 307 * in their /etc/rc file. 308 */ 309 310#ifndef UseRpath 311# define UseRpath YES 312#endif 313 314#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2) 315 316# ifndef RpathLoadFlags 317# if UseRpath 318# if UseElfFormat 319# define RpathLoadFlags -Wl,-rpath,$(USRLIBDIRPATH) 320# else 321# define RpathLoadFlags -Wl,-R,$(USRLIBDIRPATH) 322# endif 323# else 324# define RpathLoadFlags /**/ 325# endif 326# endif 327 328# ifndef ExtraLoadFlags 329# if UseElfFormat && !defined(UseInstalled) 330# define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link,$(BUILDLIBDIR) 331# else 332# define ExtraLoadFlags RpathLoadFlags 333# endif 334# endif 335 336#endif 337 338#ifndef LibraryRpathLoadFlags 339# if UseRpath 340# if UseElfFormat 341# define LibraryRpathLoadFlags -rpath $(USRLIBDIRPATH) 342# else 343# define LibraryRpathLoadFlags -R $(USRLIBDIRPATH) 344# endif 345# else 346# define LibraryRpathLoadFlags /**/ 347# endif 348#endif 349 350#ifndef SharedLibraryLoadFlags 351# if UseElfFormat 352# define SharedLibraryLoadFlags -shared LibraryRpathLoadFlags 353# else 354# define SharedLibraryLoadFlags -Bshareable LibraryRpathLoadFlags 355# endif 356#endif 357 358#ifndef GnuMallocLibrary 359#define GnuMallocLibrary -lgnumalloc 360#endif 361 362#if (OSMajorVersion > 2) || (OSMajorVersion == 2 && OSMinorVersion >= 2) \ 363 || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 6) 364/* 2.1.6 and 2.2 have libz */ 365#ifndef HasZlib 366#define HasZlib YES 367#endif 368#endif 369 370/* PAM appeared in FreeBSD 3.1 */ 371#if (OSMajorVersion > 3) || (OSMajorVersion == 3 && OSMinorVersion >=1 ) 372#ifndef HasPam 373#define HasPam YES 374#endif 375#endif 376 377/* There are two options for building. One is to assume that the system has 378 * many of the dependencies provided by the ports tree. The other is to just 379 * build everything from this tree. 380 */ 381 382#ifndef HasStandardPorts 383#define HasStandardPorts YES 384#endif 385 386#ifndef LocalBase 387#define LocalBase /usr/local 388#endif 389#ifndef X11Base 390#define X11Base /usr/X11R6 391#endif 392 393#if HasStandardPorts 394 395#ifndef HasExpat 396# define HasExpat YES 397# define ExpatDir LocalBase 398#endif 399 400#ifndef HasFreetype2 401# define HasFreetype2 YES 402# define Freetype2Dir LocalBase 403#endif 404 405#ifndef HasFontconfig 406# define HasFontconfig YES 407# define FontconfigDir X11Base 408#endif 409 410#ifndef HasLibpng 411# define HasLibpng YES 412# define LibpngDir LocalBase 413#endif 414 415#endif /* HasStandardPorts */ 416 417#undef InstallCmd 418#define InstallCmd /usr/bin/install 419 420#if UseElfFormat 421# define AsmElfDefines -D__ELF__ 422#else 423# define AsmElfDefines /**/ 424#endif 425 426#if GccUsesGas 427# define GccGasOption -DGCCUSESGAS 428# define AsmDefines -DUSE_GAS AsmElfDefines 429#else 430# define GccGasOption /**/ 431# define AsmDefines AsmElfDefines 432#endif 433 434#ifdef i386Architecture 435#define ServerExtraDefines GccGasOption XFree86ServerDefines 436#endif 437#if defined(AlphaArchitecture) || defined(Sparc64Architecture) || \ 438 defined(ia64Architecture) || defined(AMD64Architecture) 439#define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64 440#endif 441#ifdef Sparc64Architecture 442#define AsVISOption -Av9a 443#define AsOutputArchSize 64 444#endif 445 446#ifdef PpcArchitecture 447#define XF86INT10_BUILD X86INT10_STUB 448#endif 449 450#define StandardDefines -DCSRG_BASED 451 452#if OSMajorVersion > 1 453#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME 454#define XawI18nDefines -DUSE_XWCHAR_STRING 455#define HasMakefileSafeInclude YES 456#define IncludeMakefile(file) @@# dependencies are in .depend 457#define DependFileName .depend 458#ifndef DoLoadableServer 459#define DoLoadableServer YES 460#endif 461#ifndef ForceNormalLib 462#define ForceNormalLib YES 463#endif 464#define HasMkstemp YES 465#else 466#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DXNO_SYSCONF 467#define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC 468#endif 469 470/* The GCC strength-reduce bug is fixed for FreeBSD 2.1.5 and later */ 471#ifndef DefaultGcc2i386Opt 472#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 5) 473#define DefaultGcc2i386Opt -O2 GccAliasingArgs 474#endif 475#endif 476 477#ifdef i386Architecture 478# define OptimizedCDebugFlags DefaultGcc2i386Opt 479#else 480# define OptimizedCDebugFlags -O 481#endif 482 483#ifndef PreIncDir 484# define PreIncDir /usr/include 485#endif 486 487#define HasGroff YES 488#define NroffCmd env GROFF_NO_SGR=y groff -Tascii 489#define SetTtyGroup YES 490 491#ifndef ExtraFilesToClean 492# define ExtraFilesToClean *.core 493#endif 494 495#define DefaultUserPath /bin:/usr/bin:/sbin:/usr/sbin:$(BINDIR):/usr/gnu/bin:/usr/local/bin 496#define DefaultSystemPath /bin:/usr/bin:/sbin:/usr/sbin:$(BINDIR) 497#ifndef SystemManDirectory 498#define SystemManDirectory /usr/share/man 499#endif 500 501#define InstKmemFlags -g kmem -m 2755 502 503/* 504 * Compress manual pages 505 */ 506#ifndef CompressManPages 507# define CompressManPages YES 508#endif 509 510#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 1) 511#define HasBsdMake YES 512#endif 513 514#ifndef StaticLibrary 515#define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic 516#endif 517 518#if UseElfFormat 519#define DlLibrary -rdynamic 520#else 521#define DlLibrary /**/ 522#endif 523 524#ifdef AlphaArchitecture 525#define IoLibrary -lio 526#else 527#define IoLibrary /**/ 528#endif 529 530#define ServerExtraSysLibs IoLibrary 531 532#ifndef PamLibraries 533#define PamLibraries -lpam DlLibrary 534#endif 535 536#ifndef SharedLibXdmGreet 537# define SharedLibXdmGreet NO 538#endif 539 540/* 541 * On FreeBSD, the run-time loader will use the built-in "rpath" before 542 * LD_LIBRARY_PATH. This means that utilities like mkfontdir will load 543 * installed libraries (if they exist) in preference to the ones in the 544 * build tree, even though LD_LIBRARY_PATH points to the build tree. 545 * This can result in the build failing. One way to avoid this is to 546 * pre-load the libraries from the build tree. 547 * 548 * There should be a better way than this hack... 549 */ 550#if UseElfFormat 551#ifndef PreloadFontSetup 552#define PreloadFontSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(XFONTPRELOADPATTERN))`" 553#endif 554#ifndef PreloadFreetypeSetup 555#define PreloadFreetypeSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(FT2PRELOADPATTERN))`" 556#endif 557#ifndef PreloadXFTSetup 558#define PreloadXFTSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(FT2PRELOADPATTERN) $(XFTPRELOADPATTERN) $(XRENDERPRELOADPATTERN) $(FCPRELOADPATTERN))`" 559#endif 560#endif 561 562#ifndef HasCookieMaker 563/* Which versions have /dev/urandom? */ 564#if OSMajorVersion >= 4 565#define HasCookieMaker YES 566#define MkCookieCmd \ 567 'dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"' 568#else 569#define HasCookieMaker NO 570#endif 571#endif 572 573/* 574 * A hack to work around an optimization problem with gcc 2.95.2 - 2.95.4 575 */ 576#if (GccMajorVersion == 2 && GccMinorVersion == 95) 577#define GccOptBug295 578#endif 579 580#include <bsdLib.rules> 581 582#include <xorg.cf> 583