FreeBSD.cf revision 624e3943
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#ifndef HasGnuAr 157#define HasGnuAr YES 158#endif 159 160#ifndef HasMktemp 161#if (OSMajorVersion >= 4) || (OSMajorVersion == 3 && OSMinorVersion >= 1) || \ 162 (OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7) 163#define HasMktemp YES 164#else 165#define HasMktemp NO 166#endif 167#endif 168 169/* 170 * 2.2.x has perl 4 by default, not perl 5. 171 */ 172#if (OSMajorVersion <= 2) 173#ifndef HasPerl5 174#define HasPerl5 NO 175#endif 176#endif 177 178#ifndef CcCmd 179#define CcCmd cc 180#endif 181#ifndef CplusplusCmd 182#define CplusplusCmd c++ 183#endif 184#define CppCmd /usr/bin/cpp 185#define PreProcessCmd CppCmd 186#define StandardCppOptions -traditional 187#define StandardCppDefines /**/ 188#ifndef DefaultCCOptions 189#if defined(UseInstalled) 190#define DefaultCCOptions /**/ 191#else 192#if defined(HasGcc3) && HasGcc3 193#define NoSystemWarn -Wno-system-headers 194#else 195#define NoSystemWarn 196#endif 197#define DefaultCCOptions -ansi -pedantic NoSystemWarn -Dasm=__asm \ 198 GccWarningOptions 199#endif 200#endif 201#ifndef ExtraLibraries 202/* support for multi-byte locales is in libxpg4 rather than libc */ 203#if (OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2)) && \ 204 !(OSMajorVersion == 4 && OSRelVersion >= 400020) && \ 205 !(OSRelVersion >= 500005) 206#define ExtraLibraries -lxpg4 207#else 208#define ExtraLibraries /**/ 209#endif 210#endif 211#ifndef UseGnuMalloc 212/* 2.2 doesn't really have GnuMalloc */ 213#if OSMajorVersion < 2 || (OSMajorVersion == 2 && OSMinorVersion < 2) 214#define UseGnuMalloc YES 215#else 216#define UseGnuMalloc NO 217#endif 218#endif 219/* 2.2.2 and later has setusercontext() */ 220#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 2) || \ 221 (OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 2) 222#define HasSetUserContext YES 223#endif 224 225#if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 6) 226#define HasGetpeereid YES 227#endif 228 229/* 3.3(?) and later has support for setting MTRRs */ 230#ifndef HasMTRRSupport 231#if OSMajorVersion > 3 || (OSMajorVersion == 3 && OSMinorVersion >= 3) 232#define HasMTRRSupport YES 233#else 234#define HasMTRRSupport NO 235#endif 236#endif 237 238/* 239 * Drivers that don't need AGP can work with 4.0, but we don't have a 240 * mechanism for specifying a subset of drivers in the OS.cf files yet. 241 */ 242#ifndef BuildXF86DRI 243#if OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1) 244#define BuildXF86DRI YES 245#endif 246#endif 247 248/* 249 * 4.1/i386 and 5.0/i386,alpha,ia64,amd64 have the AGP driver. 250 */ 251#ifndef HasAgpGart 252#if defined(i386Architecture) && \ 253 (OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 1)) 254#define HasAgpGart YES 255#endif 256#if (defined(AlphaArchitecture) || defined(ia64Architecture) || \ 257 defined(AMD64Architecture)) && (OSMajorVersion >= 5) 258#define HasAgpGart YES 259#endif 260#endif 261 262/* 263 * SSE and 3DNow will be autodetected, so binutils is the only 264 * requirement for enabling this. By 4.2 they were all supported. 265 */ 266#if defined(AMD64Architecture) || defined(i386Architecture) && \ 267 (OSMajorVersion >= 5 || (OSMajorVersion == 4 && OSMinorVersion >= 2)) 268# define HasX86Support YES 269# define HasMMXSupport YES 270# define Has3DNowSupport YES 271# define HasSSESupport YES 272#else 273# define HasX86Support NO 274# define HasMMXSupport NO 275# define Has3DNowSupport NO 276# define HasSSESupport NO 277#endif 278 279/* 280 * This doesn't work the way it does on every other system. On FreeBSD it's 281 * only a "hint, not a demand", whatever that means. Note that this is not 282 * what it says in the ld and ld.so man pages, which are rather vague on the 283 * matter. 284 * 285 * But we do know that if a) you do what the X Project team does and set your 286 * ProjectRoot to something like "/X11", and b) you have other X libraries, 287 * e.g. in /usr/X11R6/lib, and you have added /usr/X11R6/lib to your 288 * ld.so.cache with ldconfig, then any programs linked with this "hint" will 289 * find that ld.so ignores the "hint" at runtime and loads the libraries in 290 * the ld.so.cache, i.e.the wrong ones, instead! Empirically we find that 291 * the run-path is only used as a last resort to find the libraries, after 292 * the LD_LIBRARY_PATH and ld.so.cache. 293 * 294 * N. B. to FreeBSD users who are not familiar with the semantics of the run- 295 * path on other systems. The run-path is akin to a per-program ld.so.cache. 296 * If a program is linked with a run-path, that run-path should take 297 * precedence over _everything_ else! In my opinion ldconfig and the 298 * ld.so.cache should be deprecated immediately now that FreeBSD has run- 299 * paths. Any program that needs libraries that are outside the "well known" 300 * locations should be linked with a run-path. 301 * 302 * All of which begs the question: If this option doesn't work in any useful 303 * way, why did they (FreeBSD) bother to add it? It would be nice if FreeBSD 304 * would fix ld.so so that run-paths are truly useful. 305 * 306 * Using run-paths is added with the intent that vendors who ship X for 307 * FreeBSD should use it too. Once everyone uses it then there will be no 308 * reason for FreeBSD to assume that it knows where X libraries are installed 309 * and they can remove it from the list of directories they add to ld.so.cache 310 * in their /etc/rc file. 311 */ 312 313#ifndef UseRpath 314# define UseRpath YES 315#endif 316 317#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 2) 318 319# ifndef RpathLoadFlags 320# if UseRpath 321# if UseElfFormat 322# define RpathLoadFlags -Wl,-rpath,$(USRLIBDIRPATH) 323# else 324# define RpathLoadFlags -Wl,-R,$(USRLIBDIRPATH) 325# endif 326# else 327# define RpathLoadFlags /**/ 328# endif 329# endif 330 331# ifndef ExtraLoadFlags 332# if UseElfFormat && !defined(UseInstalled) 333# define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link,$(BUILDLIBDIR) 334# else 335# define ExtraLoadFlags RpathLoadFlags 336# endif 337# endif 338 339#endif 340 341#ifndef LibraryRpathLoadFlags 342# if UseRpath 343# if UseElfFormat 344# define LibraryRpathLoadFlags -rpath $(USRLIBDIRPATH) 345# else 346# define LibraryRpathLoadFlags -R $(USRLIBDIRPATH) 347# endif 348# else 349# define LibraryRpathLoadFlags /**/ 350# endif 351#endif 352 353#ifndef SharedLibraryLoadFlags 354# if UseElfFormat 355# define SharedLibraryLoadFlags -shared LibraryRpathLoadFlags 356# else 357# define SharedLibraryLoadFlags -Bshareable LibraryRpathLoadFlags 358# endif 359#endif 360 361#ifndef GnuMallocLibrary 362#define GnuMallocLibrary -lgnumalloc 363#endif 364 365#if (OSMajorVersion > 2) || (OSMajorVersion == 2 && OSMinorVersion >= 2) \ 366 || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 6) 367/* 2.1.6 and 2.2 have libz */ 368#ifndef HasZlib 369#define HasZlib YES 370#endif 371#endif 372 373/* PAM appeared in FreeBSD 3.1 */ 374#if (OSMajorVersion > 3) || (OSMajorVersion == 3 && OSMinorVersion >=1 ) 375#ifndef HasPam 376#define HasPam YES 377#endif 378#endif 379 380/* There are two options for building. One is to assume that the system has 381 * many of the dependencies provided by the ports tree. The other is to just 382 * build everything from this tree. 383 */ 384 385#ifndef HasStandardPorts 386#define HasStandardPorts YES 387#endif 388 389#ifndef LocalBase 390#define LocalBase /usr/local 391#endif 392#ifndef X11Base 393#define X11Base /usr/X11R6 394#endif 395 396#if HasStandardPorts 397 398#ifndef HasExpat 399# define HasExpat YES 400# define ExpatDir LocalBase 401#endif 402 403#ifndef HasFreetype2 404# define HasFreetype2 YES 405# define Freetype2Dir LocalBase 406#endif 407 408#ifndef HasFontconfig 409# define HasFontconfig YES 410# define FontconfigDir X11Base 411#endif 412 413#ifndef HasLibpng 414# define HasLibpng YES 415# define LibpngDir LocalBase 416#endif 417 418#endif /* HasStandardPorts */ 419 420#undef InstallCmd 421#define InstallCmd /usr/bin/install 422 423#if UseElfFormat 424# define AsmElfDefines -D__ELF__ 425#else 426# define AsmElfDefines /**/ 427#endif 428 429#if GccUsesGas 430# define GccGasOption -DGCCUSESGAS 431# define AsmDefines -DUSE_GAS AsmElfDefines 432#else 433# define GccGasOption /**/ 434# define AsmDefines AsmElfDefines 435#endif 436 437#ifdef i386Architecture 438#define ServerExtraDefines GccGasOption XFree86ServerDefines 439#endif 440#if defined(AlphaArchitecture) || defined(Sparc64Architecture) || \ 441 defined(ia64Architecture) || defined(AMD64Architecture) 442#define ServerExtraDefines GccGasOption XFree86ServerDefines -D_XSERVER64 443#endif 444#ifdef Sparc64Architecture 445#define AsVISOption -Av9a 446#define AsOutputArchSize 64 447#endif 448 449#ifdef PpcArchitecture 450#define XF86INT10_BUILD X86INT10_STUB 451#endif 452 453#define StandardDefines -DCSRG_BASED 454 455#if OSMajorVersion > 1 456#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME 457#define XawI18nDefines -DUSE_XWCHAR_STRING 458#define HasMakefileSafeInclude YES 459#define IncludeMakefile(file) @@# dependencies are in .depend 460#define DependFileName .depend 461#ifndef DoLoadableServer 462#define DoLoadableServer YES 463#endif 464#ifndef ForceNormalLib 465#define ForceNormalLib YES 466#endif 467#define HasMkstemp YES 468#else 469#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DXNO_SYSCONF 470#define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC 471#endif 472 473/* The GCC strength-reduce bug is fixed for FreeBSD 2.1.5 and later */ 474#ifndef DefaultGcc2i386Opt 475#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 5) 476#define DefaultGcc2i386Opt -O2 GccAliasingArgs 477#endif 478#endif 479 480#ifdef i386Architecture 481# define OptimizedCDebugFlags DefaultGcc2i386Opt 482#else 483# define OptimizedCDebugFlags -O 484#endif 485 486#ifndef PreIncDir 487# define PreIncDir /usr/include 488#endif 489 490#define HasGroff YES 491#define NroffCmd env GROFF_NO_SGR=y groff -Tascii 492#define SetTtyGroup YES 493 494#ifndef ExtraFilesToClean 495# define ExtraFilesToClean *.core 496#endif 497 498#define DefaultUserPath /bin:/usr/bin:/sbin:/usr/sbin:$(BINDIR):/usr/gnu/bin:/usr/local/bin 499#define DefaultSystemPath /bin:/usr/bin:/sbin:/usr/sbin:$(BINDIR) 500#ifndef SystemManDirectory 501#define SystemManDirectory /usr/share/man 502#endif 503 504#define InstKmemFlags -g kmem -m 2755 505 506/* 507 * Compress manual pages 508 */ 509#ifndef CompressManPages 510# define CompressManPages YES 511#endif 512 513#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 1) 514#define HasBsdMake YES 515#endif 516 517#ifndef StaticLibrary 518#define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic 519#endif 520 521#if UseElfFormat 522#define DlLibrary -rdynamic 523#else 524#define DlLibrary /**/ 525#endif 526 527#ifdef AlphaArchitecture 528#define IoLibrary -lio 529#else 530#define IoLibrary /**/ 531#endif 532 533#define ServerExtraSysLibs IoLibrary 534 535#ifndef PamLibraries 536#define PamLibraries -lpam DlLibrary 537#endif 538 539#ifndef SharedLibXdmGreet 540# define SharedLibXdmGreet NO 541#endif 542 543/* 544 * On FreeBSD, the run-time loader will use the built-in "rpath" before 545 * LD_LIBRARY_PATH. This means that utilities like mkfontdir will load 546 * installed libraries (if they exist) in preference to the ones in the 547 * build tree, even though LD_LIBRARY_PATH points to the build tree. 548 * This can result in the build failing. One way to avoid this is to 549 * pre-load the libraries from the build tree. 550 * 551 * There should be a better way than this hack... 552 */ 553#if UseElfFormat 554#ifndef PreloadFontSetup 555#define PreloadFontSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(XFONTPRELOADPATTERN))`" 556#endif 557#ifndef PreloadFreetypeSetup 558#define PreloadFreetypeSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(FT2PRELOADPATTERN))`" 559#endif 560#ifndef PreloadXFTSetup 561#define PreloadXFTSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo $(FT2PRELOADPATTERN) $(XFTPRELOADPATTERN) $(XRENDERPRELOADPATTERN) $(FCPRELOADPATTERN))`" 562#endif 563#endif 564 565#ifndef HasCookieMaker 566/* Which versions have /dev/urandom? */ 567#if OSMajorVersion >= 4 568#define HasCookieMaker YES 569#define MkCookieCmd \ 570 'dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"' 571#else 572#define HasCookieMaker NO 573#endif 574#endif 575 576/* 577 * A hack to work around an optimization problem with gcc 2.95.2 - 2.95.4 578 */ 579#if (GccMajorVersion == 2 && GccMinorVersion == 95) 580#define GccOptBug295 581#endif 582 583#include <bsdLib.rules> 584 585#include <xorg.cf> 586