darwin.cf revision 4c61c93d
1XCOMM $XdotOrg: xc/config/cf/darwin.cf,v 1.7 2005/03/17 01:12:07 torrey Exp $
2XCOMM platform:  $XFree86: xc/config/cf/darwin.cf,v 1.50 2004/01/20 23:54:50 torrey Exp $
3
4/* Darwin / Mac OS X configuration by John Carmack <johnc@idsoftware.com> */
5
6/* imake determines the default values by parsing uname */
7#ifndef OSName
8#define OSName                  DefaultOSName
9#endif
10#ifndef OSVendor
11#define OSVendor                Apple Computer, Inc.
12#endif
13#ifndef OSMajorVersion
14#define OSMajorVersion          DefaultOSMajorVersion
15#endif
16#ifndef OSMinorVersion
17#define OSMinorVersion          DefaultOSMinorVersion
18#endif
19#ifndef OSTeenyVersion
20#define OSTeenyVersion          DefaultOSTeenyVersion
21#endif
22
23XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion)
24
25/*
26 * Define the operating system's capabilities
27 */
28#define HasSnprintf             YES
29#define HasPutenv               YES
30#define HasBSD44Sockets         YES
31#define Malloc0ReturnsNull      NO
32#define HasShadowPasswd         NO
33#define HasUsableFileMmap       YES
34#define HasZlib                 YES
35#ifndef HasShm
36# define HasShm                 YES
37#endif
38#define HasNdbm                 YES
39#if OSMajorVersion >= 6
40# define HasNCurses             YES
41# define HasArc4Random          YES
42# define HasGetIfAddrs          YES
43# define HasStrlcat             YES
44#else
45# define HasBasename            NO
46# define HasNCurses             NO
47#endif
48#ifndef HasGroff
49# define HasGroff               YES
50#endif
51#ifndef HasGcc3
52# define HasGcc3                NO
53#endif
54#ifndef HasFreetype2
55# define HasFreetype2           NO
56#endif
57#ifndef HasExpat
58# define HasExpat               NO
59#endif
60#ifndef HasLibpng
61# define HasLibpng              NO
62#endif
63
64/* Older versions don't really support IPv6, but #define AF_INET6. */
65#if OSMajorVersion < 6
66# define BuildIPv6              NO
67#endif
68
69/* Thread support */
70#define HasPosixThreads         YES
71#define SystemMTDefines         -D_REENTRANT
72#if OSMajorVersion >= 6
73# define HasThreadSafeAPI       YES
74# define MTSafeAPIDefines       -DXUSE_MTSAFE_API -DXNO_MTSAFE_UNISTDAPI
75#else
76# define HasThreadSafeAPI       NO
77# define MTSafeAPIDefines       -DXOS_USE_MTSAFE_NETDBAPI
78#endif
79
80/* Libtool on Darwin always uses minor numbers */
81#define LibtoolMinorVersions    YES
82
83/* The most common file system, HFS+, is not case sensitive. */
84#ifndef CaseSensitiveFileSystem
85# define CaseSensitiveFileSystem NO
86#endif
87
88/*
89 * This enables some settings for developers.
90 */
91#ifndef XFree86Devel
92# define XFree86Devel           NO
93#endif
94
95/*
96 * This enables Quartz compatibility.
97 * Turn off to build on raw Darwin systems.
98 */
99#ifndef DarwinQuartzSupport
100# define DarwinQuartzSupport    YES
101#endif
102
103#if DarwinQuartzSupport
104
105# if OSMajorVersion >= 7
106   PROJ_BUILD = xcodebuild
107# else
108   PROJ_BUILD = pbxbuild
109# endif
110
111# ifndef HasXplugin
112#  if OSMajorVersion >= 7
113#   define HasXplugin           YES
114#  else
115#   define HasXplugin           NO
116#  endif
117# endif
118
119# if HasXplugin
120#  ifndef XpLibDir
121#   define XpLibDir             /usr/lib
122#  endif
123#  ifndef XpIncDir
124#   define XpIncDir             $(SERVERSRC)/hw/darwin/quartz/xpr
125#  endif
126   XPLIBDIR = XpLibDir
127   XPINCDIR = XpIncDir
128#  define XpluginLibrary        Concat(-L,$(XPLIBDIR)) -lXplugin
129# else
130#  define XpluginLibrary        /**/
131# endif
132
133# ifndef BuildAppleDRI
134#  if HasXplugin
135#   define BuildAppleDRI        YES
136#  else
137#   define BuildAppleDRI        NO
138#  endif
139# endif
140
141# if BuildAppleDRI
142#  define GlxExtraDefines -DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL GlxArchDefines
143# endif
144
145# define BuildRootless          YES
146# define BuildAppleWMLibrary    YES
147
148#endif  /* DarwinQuartzSupport */
149
150/* we don't need -lm */
151#define MathLibrary             /**/
152
153#define TermcapLibrary          -lcurses
154#define SetTtyGroup             YES             /* for xterm */
155
156/* we don't have a dbm library */
157#define DBMLibrary              /**/
158
159#define MkdirHierCmd            mkdir -p
160
161/* Use flex -l for compatibility with various versions of flex. */
162#ifndef LexCmd
163# define LexCmd                 flex -l
164#endif
165#define HasFlex                 YES
166
167/*
168 * Our cpp isn't in /lib/cpp and early versions don't like -undef.
169 * The gcc 3.3 cpp that Apple ships inserts spurious #pragmas,
170 * so we use the 3.1-based version in this case.
171 */
172#if (GccMajorVersion == 3) && (GccMinorVersion == 3)
173# define CppCmd                 /usr/bin/cpp3
174#else
175# define CppCmd                 /usr/bin/cpp
176#endif
177#if (GccMajorVersion == 3) && (GccMinorVersion == 3) || (GccMajorVersion > 3)
178# define StandardCppOptions     -traditional -D__GNUC__
179#endif
180#if HasGcc3
181# define RawCppCmd              CppCmd -undef
182#else
183# define RawCppCmd              CppCmd
184#endif
185
186/* we have a gcc compatible compiler, but its not called gcc */
187#define CcCmd                   /usr/bin/cc
188#define CplusplusCmd            /usr/bin/c++
189
190/* default flags to pass to cc */
191#ifndef DefaultCCOptions
192#if XFree86Devel
193# define DefaultCCOptions       -Wall -Wpointer-arith -Wstrict-prototypes \
194                                -Wmissing-prototypes -Wmissing-declarations \
195                                -Wredundant-decls -Wnested-externs \
196                                -no-cpp-precomp
197#else
198# define DefaultCCOptions       -Wall -Wpointer-arith -no-cpp-precomp
199#endif
200#endif
201
202/* flags to pass to cc when building libraries */
203#ifndef LibraryCCOptions
204# define LibraryCCOptions       DefaultCCOptions -fno-common
205#endif
206
207/* The cr implementation does not build with NEED_SCREEN_REGIONS,
208   so play it safe. */
209#ifndef ServerCCOptions
210# define ServerCCOptions        DefaultCCOptions -UNEED_SCREEN_REGIONS
211#endif
212
213#ifdef PpcDarwinArchitecture
214# define DarwinMachineDefines   -D__powerpc__
215# if HasGcc3
216#  define OptimizedCDebugFlags  -Os
217# else
218#  define OptimizedCDebugFlags  -O2
219# endif
220# define ByteOrder              X_BIG_ENDIAN
221#endif /* PpcDarwinArchitecture */
222
223#ifdef i386DarwinArchitecture
224# define DarwinMachineDefines   -D__i386__
225# if HasGcc3
226#  define OptimizedCDebugFlags  -Os
227# else
228#  define OptimizedCDebugFlags  -O2 -fno-strength-reduce
229# endif
230# define ByteOrder              X_LITTLE_ENDIAN
231#endif /* i386DarwinArchitecture */
232
233#if OSMajorVersion < 7
234# define DarwinLocaleDefines    -DX_LOCALE
235#else
236# define DarwinLocaleDefines    /**/
237# define XawI18nDefines         -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H
238#endif
239
240/*
241 * __DARWIN__ will be used for platform specific #ifdefs that can't
242 * be handled by existing X defines.
243 *
244 * Darwin's alloca() seg faults (rather than returning NULL) on failed
245 * allocations, so we can't use it.
246 */
247#define StandardDefines         DarwinMachineDefines -D__DARWIN__ \
248                                -DNO_ALLOCA -DCSRG_BASED DarwinLocaleDefines
249
250/*
251 * Set this to NO to just build the client libs, which should work without
252 * having to write any platform specific code.
253 */
254#ifndef BuildServer
255# define BuildServer            YES
256
257/* our custom X server */
258# define XDarwinServer          YES
259#endif
260
261/* Thanks to the IOKit, the X server does not have to be SetUID. */
262#ifndef InstallXserverSetUID
263# define InstallXserverSetUID   NO
264#endif
265
266/* Allow Xtrans to work with non-SetUID server. */
267#ifndef XtransFailSoft
268# define XtransFailSoft         YES
269#endif
270
271/* disable XKB by default as it can cause problems */
272#define DfltDisableXKB          YES
273
274/* no direct graphics extension */
275#define BuildXF86DGA            NO
276
277/* Support for tablets and other non-standard input devices */
278#ifndef BuildXInputExt
279# define BuildXInputExt         YES
280#endif
281#define BuildXInputLib          YES
282
283/* no Display Power Management extension */
284#define BuildDPMS               NO
285
286/* no XFree86-Misc extension */
287#define BuildXF86MiscExt        NO
288
289/* no XFree86-VidMode extension */
290#define BuildXF86VidModeExt     NO
291
292#ifndef BuildXterm
293# define BuildXterm             BuildClients    /* Not enabled by default */
294#endif
295
296#define BuildLibPathVar         DYLD_LIBRARY_PATH
297
298/* include rules to build shared libraries */
299#include <darwinLib.rules>
300
301/*
302 * BundleProgramTarget - Generate rules for compiling, linking and
303 * installing a bundle executable. 
304 */
305#ifndef BundleProgramTarget
306#define BundleProgramTarget(program,loader,subdirs,objs,deplib,syslib,dstdir) @@\
307                                                                        @@\
308AllTarget(program)                                                      @@\
309                                                                        @@\
310program: loader subdirs objs deplib                                     @@\
311	RemoveTargetProgram($@)                                             @@\
312	LinkRule($@,-bundle $(LDOPTIONS),objs,deplib $(LDLIBS) syslib -bundle_loader loader) @@\
313                                                                        @@\
314InstallProgram(program,dstdir/program.bundle/Contents/MacOS)            @@\
315                                                                        @@\
316clean::                                                                 @@\
317	RemoveFile(program)
318#endif /* BundleProgramTarget */
319
320/*
321 * Darwin specific Imake Config files
322 */
323#ifndef LocalConfigFiles
324#define LocalConfigFiles \
325	darwinLib.rules \
326	darwinLib.tmpl
327#endif
328
329/* include all the X.Org rules */
330#include <xorg.cf>
331