This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Some day I might actually learn to test changes first
[perl5.git] / hints / darwin.sh
CommitLineData
f556e5b9
JH
1##
2# Darwin (Mac OS) hints
437cf188 3# Wilfredo Sanchez <wsanchez@mit.edu>
f556e5b9
JH
4##
5
6##
7# Paths
8##
9
10# BSD paths
e32f0149 11case "$prefix" in
187122cb
W
12'')
13 # Default install; use non-system directories
e32f0149
JH
14 prefix='/usr/local'; # Built-in perl uses /usr
15 siteprefix='/usr/local';
16 vendorprefix='/usr/local'; usevendorprefix='define';
17
187122cb
W
18 # Where to put modules.
19 privlib='/Library/Perl'; # Built-in perl uses /System/Library/Perl
20 sitelib='/Library/Perl';
21 vendorlib='/Network/Library/Perl';
22 ;;
23'/usr')
24 # We are building/replacing the built-in perl
25 siteprefix='/usr/local';
26 vendorprefix='/usr/local'; usevendorprefix='define';
e32f0149
JH
27
28 # Where to put modules.
187122cb 29 privlib='/System/Library/Perl';
e32f0149
JH
30 sitelib='/Library/Perl';
31 vendorlib='/Network/Library/Perl';
32 ;;
33esac
f556e5b9 34
187122cb 35# 4BSD uses ${prefix}/share/man, not ${prefix}/man.
187122cb
W
36man1dir="${prefix}/share/man/man1";
37man3dir="${prefix}/share/man/man3";
38
f556e5b9
JH
39##
40# Tool chain settings
41##
42
43# Since we can build fat, the archname doesn't need the processor type
44archname='darwin';
45
46# nm works.
47usenm='true';
48
f556e5b9 49# Optimize.
23131aa4
RH
50if [ "x$optimize" = 'x' ]; then
51 optimize='-O3'
52fi
f556e5b9 53
faf52077
JH
54# -pipe: makes compilation go faster.
55# -fno-common: we don't like commons. Common symbols are not allowed
56# in MH_DYLIB binaries, which is what libperl.dylib is. You will fail
57# to link without that option, unless you otherwise eliminate all commons
58# by, for example, initializing all globals.
59# --Fred Sánchez
0ac8ade1 60ccflags="${ccflags} -pipe -fno-common"
f556e5b9 61
4e644a1e 62# At least on Darwin 1.3.x:
ccf87481
JH
63#
64# # define INT32_MIN -2147483648
65# int main () {
66# double a = INT32_MIN;
67# printf ("INT32_MIN=%g\n", a);
68# return 0;
69# }
70# will output:
71# INT32_MIN=2.14748e+09
72# Note that the INT32_MIN has become positive.
73# INT32_MIN is set in /usr/include/stdint.h by:
74# #define INT32_MIN -2147483648
75# which seems to break the gcc. Defining INT32_MIN as (-2147483647-1)
76# seems to work. INT64_MIN seems to be similarly broken.
77# -- Nicholas Clark, Ken Williams, and Edward Moy
78#
79ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN"
80
8f4f83ba
RS
81# cppflags='-traditional-cpp';
82# avoid Apple's cpp precompiler, better for extensions
83cppflags="${cppflags} -no-cpp-precomp"
4f8ddd77
AB
84# and ccflags needs them aswell since we don't use cpp directly
85ccflags="${ccflags} -no-cpp-precomp"
86
00371ed5 87# Known optimizer problems.
f5520784 88case "`cc -v 2>&1`" in
b1eb02cd 89*"3.1 20020105"*) toke_cflags='optimize=""' ;;
00371ed5 90esac
2ece6c11 91
f556e5b9
JH
92# Shared library extension is .dylib.
93# Bundle extension is .bundle.
94ld='cc';
95so='dylib';
96dlext='bundle';
97dlsrc='dl_dyld.xs'; usedl='define';
c374061b 98cccdlflags=' '; # space, not empty, because otherwise we get -fpic
f29f446b
JH
99# ldflag: -flat_namespace is only available since OS X 10.1 (Darwin 1.4.1)
100# - but not in 10.0.x (Darwin 1.3.x)
101# -- Kay Roepke
102case "$osvers" in
1031.[0-3].*) ;;
104*) ldflags="${ldflags} -flat_namespace" ;;
105esac
f556e5b9
JH
106lddlflags="${ldflags} -bundle -undefined suppress";
107ldlibpthname='DYLD_LIBRARY_PATH';
108useshrplib='true';
109
110##
111# System libraries
112##
113
114# vfork works
115usevfork='true';
116
117# malloc works
118usemymalloc='n';
2ece6c11 119
d235852b
PP
120##
121# Build process
122##
123
124# Locales aren't feeling well.
125LC_ALL=C; export LC_ALL;
14c11978 126LANG=C; export LANG;
d235852b 127
4e644a1e
W
128# Case-insensitive filesystems don't get along with Makefile and
129# makefile in the same place. Since Darwin uses GNU make, this dodges
130# the problem.
d235852b 131firstmakefile=GNUmakefile;
2590a1d7
JH
132
133#
14c11978 134# The libraries are not threadsafe as of OS X 10.1.
2590a1d7
JH
135#
136# Fix when Apple fixes libc.
137#
138case "$usethreads$useithreads$use5005threads" in
139*define*)
140cat <<EOM >&4
141
4f8ddd77 142*** Warning, there might be problems with your libraries with
00371ed5
JH
143*** regards to threading. The test ext/threads/t/libc.t is likely
144*** to fail.
4f8ddd77 145
2590a1d7 146EOM
2590a1d7
JH
147 ;;
148esac