Commit | Line | Data |
---|---|---|
f556e5b9 JH |
1 | ## |
2 | # Darwin (Mac OS) hints | |
835bc3f3 | 3 | # Wilfredo Sanchez <wsanchez@wsanchez.net> |
f556e5b9 JH |
4 | ## |
5 | ||
6 | ## | |
7 | # Paths | |
6fd18151 JH |
8 | ## |
9 | ||
10 | # Configure hasn't figured out the version number yet. Bummer. | |
11 | perl_revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $src/patchlevel.h` | |
12 | perl_version=`awk '/define[ ]+PERL_VERSION/ {print $3}' $src/patchlevel.h` | |
13 | perl_subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $src/patchlevel.h` | |
14 | version="${perl_revision}.${perl_version}.${perl_subversion}" | |
15 | ||
16 | # This was previously used in all but causes three cases | |
17 | # (no -Ddprefix=, -Dprefix=/usr, -Dprefix=/some/thing/else) | |
18 | # but that caused too much grief. | |
19 | # vendorlib="/System/Library/Perl/${version}"; # Apple-supplied modules | |
20 | ||
21 | # BSD paths | |
22 | case "$prefix" in | |
23 | '') # Default install; use non-system directories | |
24 | prefix='/usr/local'; | |
25 | siteprefix='/usr/local'; | |
26 | ;; | |
27 | '/usr') # We are building/replacing the built-in perl | |
28 | prefix='/'; | |
29 | installprefix='/'; | |
30 | bin='/usr/bin'; | |
b69885a6 JH |
31 | siteprefix='/usr/local'; |
32 | # We don't want /usr/bin/HEAD issues. | |
33 | sitebin='/usr/local/bin'; | |
34 | sitescript='/usr/local/bin'; | |
6fd18151 JH |
35 | installusrbinperl='define'; # You knew what you were doing. |
36 | privlib="/System/Library/Perl/${version}"; | |
37 | sitelib="/Library/Perl/${version}"; | |
38 | vendorprefix='/'; | |
39 | usevendorprefix='define'; | |
40 | vendorbin='/usr/bin'; | |
41 | vendorscript='/usr/bin'; | |
42 | vendorlib="/Network/Library/Perl/${version}"; | |
43 | # 4BSD uses ${prefix}/share/man, not ${prefix}/man. | |
44 | man1dir='/usr/share/man/man1'; | |
45 | man3dir='/usr/share/man/man3'; | |
b69885a6 | 46 | # But users' installs shouldn't touch the system man pages. |
8d4e7e39 | 47 | # Transient obsoleted style. |
c975d1a7 JH |
48 | siteman1='/usr/local/share/man/man1'; |
49 | siteman3='/usr/local/share/man/man3'; | |
8d4e7e39 JH |
50 | # New style. |
51 | siteman1dir='/usr/local/share/man/man1'; | |
52 | siteman3dir='/usr/local/share/man/man3'; | |
6fd18151 JH |
53 | ;; |
54 | *) # Anything else; use non-system directories, use Configure defaults | |
55 | ;; | |
56 | esac | |
f556e5b9 JH |
57 | |
58 | ## | |
59 | # Tool chain settings | |
60 | ## | |
61 | ||
62 | # Since we can build fat, the archname doesn't need the processor type | |
63 | archname='darwin'; | |
64 | ||
65 | # nm works. | |
66 | usenm='true'; | |
67 | ||
318c098a JH |
68 | case "$optimize" in |
69 | '') | |
14c26028 MS |
70 | # Optimizing for size also mean less resident memory usage on the part |
71 | # of Perl. Apple asserts that this is a more important optimization than | |
72 | # saving on CPU cycles. Given that memory speed has not increased at | |
73 | # pace with CPU speed over time (on any platform), this is probably a | |
74 | # reasonable assertion. | |
21328108 | 75 | if [ -z "${optimize}" ]; then |
c8037037 MS |
76 | case "`${cc:-gcc} -v 2>&1`" in |
77 | *"gcc version 3."*) optimize='-Os' ;; | |
78 | *) optimize='-O3' ;; | |
21328108 | 79 | esac |
c8037037 MS |
80 | else |
81 | optimize='-O3' | |
23131aa4 | 82 | fi |
318c098a JH |
83 | ;; |
84 | esac | |
f556e5b9 | 85 | |
faf52077 | 86 | # -pipe: makes compilation go faster. |
21328108 | 87 | # -fno-common because common symbols are not allowed in MH_DYLIB |
6239f2da | 88 | # -DPERL_DARWIN: apparently the __APPLE__ is not sanctioned by Apple |
f72d1791 JH |
89 | # as the way to differentiate Mac OS X. (The official line is that |
90 | # *no* cpp symbol does differentiate Mac OS X.) | |
6239f2da | 91 | ccflags="${ccflags} -pipe -fno-common -DPERL_DARWIN" |
f556e5b9 | 92 | |
4e644a1e | 93 | # At least on Darwin 1.3.x: |
ccf87481 JH |
94 | # |
95 | # # define INT32_MIN -2147483648 | |
96 | # int main () { | |
97 | # double a = INT32_MIN; | |
98 | # printf ("INT32_MIN=%g\n", a); | |
99 | # return 0; | |
100 | # } | |
101 | # will output: | |
102 | # INT32_MIN=2.14748e+09 | |
103 | # Note that the INT32_MIN has become positive. | |
104 | # INT32_MIN is set in /usr/include/stdint.h by: | |
105 | # #define INT32_MIN -2147483648 | |
106 | # which seems to break the gcc. Defining INT32_MIN as (-2147483647-1) | |
107 | # seems to work. INT64_MIN seems to be similarly broken. | |
108 | # -- Nicholas Clark, Ken Williams, and Edward Moy | |
109 | # | |
65fe0b2a JH |
110 | # This seems to have been fixed since at least Mac OS X 10.1.3, |
111 | # stdint.h defining INT32_MIN as (-INT32_MAX-1) | |
112 | # -- Edward Moy | |
113 | # | |
21328108 HS |
114 | case "$(grep '^#define INT32_MIN' /usr/include/stdint.h)" in |
115 | *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;; | |
65fe0b2a | 116 | esac |
ccf87481 | 117 | |
21328108 | 118 | # Avoid Apple's cpp precompiler, better for extensions |
8f4f83ba | 119 | cppflags="${cppflags} -no-cpp-precomp" |
835bc3f3 RGS |
120 | |
121 | # This is necessary because perl's build system doesn't | |
122 | # apply cppflags to cc compile lines as it should. | |
123 | ccflags="${ccflags} ${cppflags}" | |
4f8ddd77 | 124 | |
00371ed5 | 125 | # Known optimizer problems. |
f5520784 | 126 | case "`cc -v 2>&1`" in |
21328108 | 127 | *"3.1 20020105"*) toke_cflags='optimize=""' ;; |
00371ed5 | 128 | esac |
2ece6c11 | 129 | |
f556e5b9 JH |
130 | # Shared library extension is .dylib. |
131 | # Bundle extension is .bundle. | |
132 | ld='cc'; | |
133 | so='dylib'; | |
134 | dlext='bundle'; | |
135 | dlsrc='dl_dyld.xs'; usedl='define'; | |
c374061b | 136 | cccdlflags=' '; # space, not empty, because otherwise we get -fpic |
21328108 | 137 | # Perl bundles do not expect two-level namespace, added in Darwin 1.4. |
986530ea | 138 | # But starting from perl 5.8.1/Darwin 7 the default is the two-level. |
f29f446b | 139 | case "$osvers" in |
cb3fc426 | 140 | 1.[0-3].*) |
986530ea JH |
141 | lddlflags="${ldflags} -bundle -undefined suppress" |
142 | ;; | |
143 | 1.*) | |
144 | ldflags="${ldflags} -flat_namespace" | |
145 | lddlflags="${ldflags} -bundle -undefined suppress" | |
146 | ;; | |
147 | [2-6].*) | |
148 | ldflags="${ldflags} -flat_namespace" | |
149 | lddlflags="${ldflags} -bundle -undefined suppress" | |
150 | ;; | |
151 | *) lddlflags="${ldflags} -bundle -undefined dynamic_lookup" | |
152 | case "$ld" in | |
153 | *MACOSX_DEVELOPMENT_TARGET*) ;; | |
154 | *) ld="MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;; | |
155 | esac | |
156 | ;; | |
f29f446b | 157 | esac |
f556e5b9 | 158 | ldlibpthname='DYLD_LIBRARY_PATH'; |
39225f5c DK |
159 | |
160 | # useshrplib=true results in much slower startup times. | |
763754f3 | 161 | # 'false' is the default value. Use Configure -Duseshrplib to override. |
f556e5b9 | 162 | |
cb3fc426 JH |
163 | cat > UU/archname.cbu <<'EOCBU' |
164 | # This script UU/archname.cbu will get 'called-back' by Configure | |
165 | # after it has otherwise determined the architecture name. | |
166 | case "$ldflags" in | |
986530ea | 167 | *"-flat_namespace"*) ;; # Backward compat, be flat. |
cb3fc426 JH |
168 | # If we are using two-level namespace, we will munge the archname to show it. |
169 | *) archname="${archname}-2level" ;; | |
170 | esac | |
171 | EOCBU | |
172 | ||
f556e5b9 JH |
173 | ## |
174 | # System libraries | |
175 | ## | |
176 | ||
177 | # vfork works | |
178 | usevfork='true'; | |
179 | ||
e88d9d51 | 180 | # our malloc works (but allow users to override) |
ec5333ab | 181 | case "$usemymalloc" in |
e88d9d51 RGS |
182 | '') usemymalloc='n' ;; |
183 | esac | |
2ece6c11 | 184 | |
d235852b PP |
185 | # Locales aren't feeling well. |
186 | LC_ALL=C; export LC_ALL; | |
14c11978 | 187 | LANG=C; export LANG; |
d235852b | 188 | |
2590a1d7 | 189 | # |
14c11978 | 190 | # The libraries are not threadsafe as of OS X 10.1. |
2590a1d7 JH |
191 | # |
192 | # Fix when Apple fixes libc. | |
193 | # | |
3db8f154 | 194 | case "$usethreads$useithreads" in |
21328108 | 195 | *define*) |
9bff986a AB |
196 | case "$osvers" in |
197 | [12345].*) cat <<EOM >&4 | |
198 | ||
199 | ||
2590a1d7 | 200 | |
4f8ddd77 | 201 | *** Warning, there might be problems with your libraries with |
00371ed5 JH |
202 | *** regards to threading. The test ext/threads/t/libc.t is likely |
203 | *** to fail. | |
4f8ddd77 | 204 | |
2590a1d7 | 205 | EOM |
21328108 | 206 | ;; |
9bff986a AB |
207 | *) usereentrant='define';; |
208 | esac | |
209 | ||
2590a1d7 | 210 | esac |
835bc3f3 | 211 | |
8ba6e877 JH |
212 | # Fink can install a GDBM library that claims to have the ODBM interfaces |
213 | # but Perl dynaloader cannot for some reason use that library. We don't | |
214 | # really need ODBM_FIle, though, so let's just hint ODBM away. | |
215 | i_dbm=undef; | |
216 | ||
835bc3f3 RGS |
217 | ## |
218 | # Build process | |
219 | ## | |
220 | ||
221 | # Case-insensitive filesystems don't get along with Makefile and | |
222 | # makefile in the same place. Since Darwin uses GNU make, this dodges | |
223 | # the problem. | |
224 | firstmakefile=GNUmakefile; |