Commit | Line | Data |
f556e5b9 |
1 | ## |
2 | # Darwin (Mac OS) hints |
835bc3f3 |
3 | # Wilfredo Sanchez <wsanchez@wsanchez.net> |
f556e5b9 |
4 | ## |
5 | |
6 | ## |
7 | # Paths |
1fe2610c |
8 | # |
9 | # Since Perl 5.8.1: No more special prefix games, no special handling of /usr. |
10 | # |
f556e5b9 |
11 | |
12 | ## |
13 | # Tool chain settings |
14 | ## |
15 | |
16 | # Since we can build fat, the archname doesn't need the processor type |
17 | archname='darwin'; |
18 | |
19 | # nm works. |
20 | usenm='true'; |
21 | |
318c098a |
22 | case "$optimize" in |
23 | '') |
14c26028 |
24 | # Optimizing for size also mean less resident memory usage on the part |
25 | # of Perl. Apple asserts that this is a more important optimization than |
26 | # saving on CPU cycles. Given that memory speed has not increased at |
27 | # pace with CPU speed over time (on any platform), this is probably a |
28 | # reasonable assertion. |
21328108 |
29 | if [ -z "${optimize}" ]; then |
c8037037 |
30 | case "`${cc:-gcc} -v 2>&1`" in |
31 | *"gcc version 3."*) optimize='-Os' ;; |
32 | *) optimize='-O3' ;; |
21328108 |
33 | esac |
c8037037 |
34 | else |
35 | optimize='-O3' |
23131aa4 |
36 | fi |
318c098a |
37 | ;; |
38 | esac |
f556e5b9 |
39 | |
faf52077 |
40 | # -pipe: makes compilation go faster. |
21328108 |
41 | # -fno-common because common symbols are not allowed in MH_DYLIB |
f72d1791 |
42 | # -DDARWIN: apparently the __APPLE__ is not sanctioned by Apple |
43 | # as the way to differentiate Mac OS X. (The official line is that |
44 | # *no* cpp symbol does differentiate Mac OS X.) |
45 | ccflags="${ccflags} -pipe -fno-common -DDARWIN" |
f556e5b9 |
46 | |
4e644a1e |
47 | # At least on Darwin 1.3.x: |
ccf87481 |
48 | # |
49 | # # define INT32_MIN -2147483648 |
50 | # int main () { |
51 | # double a = INT32_MIN; |
52 | # printf ("INT32_MIN=%g\n", a); |
53 | # return 0; |
54 | # } |
55 | # will output: |
56 | # INT32_MIN=2.14748e+09 |
57 | # Note that the INT32_MIN has become positive. |
58 | # INT32_MIN is set in /usr/include/stdint.h by: |
59 | # #define INT32_MIN -2147483648 |
60 | # which seems to break the gcc. Defining INT32_MIN as (-2147483647-1) |
61 | # seems to work. INT64_MIN seems to be similarly broken. |
62 | # -- Nicholas Clark, Ken Williams, and Edward Moy |
63 | # |
65fe0b2a |
64 | # This seems to have been fixed since at least Mac OS X 10.1.3, |
65 | # stdint.h defining INT32_MIN as (-INT32_MAX-1) |
66 | # -- Edward Moy |
67 | # |
21328108 |
68 | case "$(grep '^#define INT32_MIN' /usr/include/stdint.h)" in |
69 | *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;; |
65fe0b2a |
70 | esac |
ccf87481 |
71 | |
21328108 |
72 | # Avoid Apple's cpp precompiler, better for extensions |
8f4f83ba |
73 | cppflags="${cppflags} -no-cpp-precomp" |
835bc3f3 |
74 | |
75 | # This is necessary because perl's build system doesn't |
76 | # apply cppflags to cc compile lines as it should. |
77 | ccflags="${ccflags} ${cppflags}" |
4f8ddd77 |
78 | |
00371ed5 |
79 | # Known optimizer problems. |
f5520784 |
80 | case "`cc -v 2>&1`" in |
21328108 |
81 | *"3.1 20020105"*) toke_cflags='optimize=""' ;; |
00371ed5 |
82 | esac |
2ece6c11 |
83 | |
f556e5b9 |
84 | # Shared library extension is .dylib. |
85 | # Bundle extension is .bundle. |
86 | ld='cc'; |
87 | so='dylib'; |
88 | dlext='bundle'; |
89 | dlsrc='dl_dyld.xs'; usedl='define'; |
c374061b |
90 | cccdlflags=' '; # space, not empty, because otherwise we get -fpic |
21328108 |
91 | # Perl bundles do not expect two-level namespace, added in Darwin 1.4. |
986530ea |
92 | # But starting from perl 5.8.1/Darwin 7 the default is the two-level. |
f29f446b |
93 | case "$osvers" in |
cb3fc426 |
94 | 1.[0-3].*) |
986530ea |
95 | lddlflags="${ldflags} -bundle -undefined suppress" |
96 | ;; |
97 | 1.*) |
98 | ldflags="${ldflags} -flat_namespace" |
99 | lddlflags="${ldflags} -bundle -undefined suppress" |
100 | ;; |
101 | [2-6].*) |
102 | ldflags="${ldflags} -flat_namespace" |
103 | lddlflags="${ldflags} -bundle -undefined suppress" |
104 | ;; |
105 | *) lddlflags="${ldflags} -bundle -undefined dynamic_lookup" |
106 | case "$ld" in |
107 | *MACOSX_DEVELOPMENT_TARGET*) ;; |
108 | *) ld="MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;; |
109 | esac |
110 | ;; |
f29f446b |
111 | esac |
f556e5b9 |
112 | ldlibpthname='DYLD_LIBRARY_PATH'; |
39225f5c |
113 | |
114 | # useshrplib=true results in much slower startup times. |
763754f3 |
115 | # 'false' is the default value. Use Configure -Duseshrplib to override. |
f556e5b9 |
116 | |
cb3fc426 |
117 | cat > UU/archname.cbu <<'EOCBU' |
118 | # This script UU/archname.cbu will get 'called-back' by Configure |
119 | # after it has otherwise determined the architecture name. |
120 | case "$ldflags" in |
986530ea |
121 | *"-flat_namespace"*) ;; # Backward compat, be flat. |
cb3fc426 |
122 | # If we are using two-level namespace, we will munge the archname to show it. |
123 | *) archname="${archname}-2level" ;; |
124 | esac |
125 | EOCBU |
126 | |
f556e5b9 |
127 | ## |
128 | # System libraries |
129 | ## |
130 | |
131 | # vfork works |
132 | usevfork='true'; |
133 | |
134 | # malloc works |
135 | usemymalloc='n'; |
2ece6c11 |
136 | |
d235852b |
137 | # Locales aren't feeling well. |
138 | LC_ALL=C; export LC_ALL; |
14c11978 |
139 | LANG=C; export LANG; |
d235852b |
140 | |
2590a1d7 |
141 | # |
14c11978 |
142 | # The libraries are not threadsafe as of OS X 10.1. |
2590a1d7 |
143 | # |
144 | # Fix when Apple fixes libc. |
145 | # |
3db8f154 |
146 | case "$usethreads$useithreads" in |
21328108 |
147 | *define*) |
9bff986a |
148 | case "$osvers" in |
149 | [12345].*) cat <<EOM >&4 |
150 | |
151 | |
2590a1d7 |
152 | |
4f8ddd77 |
153 | *** Warning, there might be problems with your libraries with |
00371ed5 |
154 | *** regards to threading. The test ext/threads/t/libc.t is likely |
155 | *** to fail. |
4f8ddd77 |
156 | |
2590a1d7 |
157 | EOM |
21328108 |
158 | ;; |
9bff986a |
159 | *) usereentrant='define';; |
160 | esac |
161 | |
2590a1d7 |
162 | esac |
835bc3f3 |
163 | |
164 | ## |
165 | # Build process |
166 | ## |
167 | |
168 | # Case-insensitive filesystems don't get along with Makefile and |
169 | # makefile in the same place. Since Darwin uses GNU make, this dodges |
170 | # the problem. |
171 | firstmakefile=GNUmakefile; |