xref: /openbsd/gnu/usr.bin/perl/hints/darwin.sh (revision db3296cf)
1##
2# Darwin (Mac OS) hints
3# Wilfredo Sanchez <wsanchez@mit.edu>
4##
5
6##
7# Paths
8##
9
10# BSD paths
11case "$prefix" in
12'')
13	# Default install; use non-system directories
14	prefix='/usr/local'; # Built-in perl uses /usr
15	siteprefix='/usr/local';
16	vendorprefix='/usr/local'; usevendorprefix='define';
17
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';
27
28	# Where to put modules.
29	privlib='/System/Library/Perl';
30	sitelib='/Library/Perl';
31	vendorlib='/Network/Library/Perl';
32	;;
33esac
34
35# 4BSD uses ${prefix}/share/man, not ${prefix}/man.
36man1dir="${prefix}/share/man/man1";
37man3dir="${prefix}/share/man/man3";
38
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
49# Optimize.
50if [ "x$optimize" = 'x' ]; then
51    optimize='-O3'
52fi
53
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
60ccflags="${ccflags} -pipe -fno-common"
61
62# At least on Darwin 1.3.x:
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#
79# This seems to have been fixed since at least Mac OS X 10.1.3,
80# stdint.h defining INT32_MIN as (-INT32_MAX-1)
81# -- Edward Moy
82#
83case "`grep '^#define INT32_MIN' /usr/include/stdint.h`" in
84*-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;;
85esac
86
87# cppflags='-traditional-cpp';
88# avoid Apple's cpp precompiler, better for extensions
89cppflags="${cppflags} -no-cpp-precomp"
90# and ccflags needs them as well since we don't use cpp directly
91ccflags="${ccflags} -no-cpp-precomp"
92
93# Known optimizer problems.
94case "`cc -v 2>&1`" in
95*"3.1 20020105"*) toke_cflags='optimize=""' ;;
96esac
97
98# Shared library extension is .dylib.
99# Bundle extension is .bundle.
100ld='cc';
101so='dylib';
102dlext='bundle';
103dlsrc='dl_dyld.xs'; usedl='define';
104cccdlflags=' '; # space, not empty, because otherwise we get -fpic
105# ldflag: -flat_namespace is only available since OS X 10.1 (Darwin 1.4.1)
106#    - but not in 10.0.x (Darwin 1.3.x)
107# -- Kay Roepke
108case "$osvers" in
1091.[0-3].*)	;;
110*)		ldflags="${ldflags} -flat_namespace" ;;
111esac
112lddlflags="${ldflags} -bundle -undefined suppress";
113ldlibpthname='DYLD_LIBRARY_PATH';
114useshrplib='true';
115
116##
117# System libraries
118##
119
120# vfork works
121usevfork='true';
122
123# malloc works
124usemymalloc='n';
125
126##
127# Build process
128##
129
130# Locales aren't feeling well.
131LC_ALL=C; export LC_ALL;
132LANG=C; export LANG;
133
134# Case-insensitive filesystems don't get along with Makefile and
135# makefile in the same place.  Since Darwin uses GNU make, this dodges
136# the problem.
137firstmakefile=GNUmakefile;
138
139#
140# The libraries are not threadsafe as of OS X 10.1.
141#
142# Fix when Apple fixes libc.
143#
144case "$usethreads$useithreads$use5005threads" in
145*define*)
146cat <<EOM >&4
147
148*** Warning, there might be problems with your libraries with
149*** regards to threading.  The test ext/threads/t/libc.t is likely
150*** to fail.
151
152EOM
153	;;
154esac
155