2 # Darwin (Mac OS) hints
3 # Wilfredo Sanchez <wsanchez@wsanchez.net>
9 # Since Perl 5.8.1: No more special prefix games, no special handling of /usr.
16 # Since we can build fat, the archname doesn't need the processor type
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.
29 if [ -z "${optimize}" ]; then
30 case "`${cc:-gcc} -v 2>&1`" in
31 *"gcc version 3."*) optimize='-Os' ;;
40 # -pipe: makes compilation go faster.
41 # -fno-common because common symbols are not allowed in MH_DYLIB
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"
47 # At least on Darwin 1.3.x:
49 # # define INT32_MIN -2147483648
51 # double a = INT32_MIN;
52 # printf ("INT32_MIN=%g\n", a);
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
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)
68 case "$(grep '^#define INT32_MIN' /usr/include/stdint.h)" in
69 *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;;
72 # Avoid Apple's cpp precompiler, better for extensions
73 cppflags="${cppflags} -no-cpp-precomp"
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}"
79 # Known optimizer problems.
80 case "`cc -v 2>&1`" in
81 *"3.1 20020105"*) toke_cflags='optimize=""' ;;
84 # Shared library extension is .dylib.
85 # Bundle extension is .bundle.
89 dlsrc='dl_dyld.xs'; usedl='define';
90 cccdlflags=' '; # space, not empty, because otherwise we get -fpic
91 # Perl bundles do not expect two-level namespace, added in Darwin 1.4.
92 # But starting from perl 5.8.1/Darwin 7 the default is the two-level.
95 lddlflags="${ldflags} -bundle -undefined suppress"
98 ldflags="${ldflags} -flat_namespace"
99 lddlflags="${ldflags} -bundle -undefined suppress"
102 ldflags="${ldflags} -flat_namespace"
103 lddlflags="${ldflags} -bundle -undefined suppress"
105 *) lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
107 *MACOSX_DEVELOPMENT_TARGET*) ;;
108 *) ld="MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
112 ldlibpthname='DYLD_LIBRARY_PATH';
114 # useshrplib=true results in much slower startup times.
115 # 'false' is the default value. Use Configure -Duseshrplib to override.
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.
121 *"-flat_namespace"*) ;; # Backward compat, be flat.
122 # If we are using two-level namespace, we will munge the archname to show it.
123 *) archname="${archname}-2level" ;;
137 # Locales aren't feeling well.
138 LC_ALL=C; export LC_ALL;
142 # The libraries are not threadsafe as of OS X 10.1.
144 # Fix when Apple fixes libc.
146 case "$usethreads$useithreads" in
149 [12345].*) cat <<EOM >&4
153 *** Warning, there might be problems with your libraries with
154 *** regards to threading. The test ext/threads/t/libc.t is likely
159 *) usereentrant='define';;
168 # Case-insensitive filesystems don't get along with Makefile and
169 # makefile in the same place. Since Darwin uses GNU make, this dodges
171 firstmakefile=GNUmakefile;