61940f34cca520ae9eaf8de5fc45022324f6c2db
[p5sagit/p5-mst-13.2.git] / hints / darwin.sh
1 ##
2 # Darwin (Mac OS) hints
3 # Wilfredo Sanchez <wsanchez@mit.edu>
4 ##
5
6 ##
7 # Paths
8 ##
9
10 # BSD paths
11 case "$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         ;;
33 esac
34
35 # 4BSD uses ${prefix}/share/man, not ${prefix}/man.
36 man1dir="${prefix}/share/man/man1";
37 man3dir="${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
44 archname='darwin';
45
46 # nm works.
47 usenm='true';
48
49 # Optimize.
50 if [ "x$optimize" = 'x' ]; then
51     optimize='-O3'
52 fi
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
60 ccflags="${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 ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN"
80
81 # cpp-precomp is problematic.
82 cppflags='-traditional-cpp';
83
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';
90 cccdlflags=' '; # space, not empty, because otherwise we get -fpic
91 # ldflag: -flat_namespace is only available since OS X 10.1 (Darwin 1.4.1)
92 #    - but not in 10.0.x (Darwin 1.3.x)
93 # -- Kay Roepke
94 case "$osvers" in
95 1.[0-3].*)      ;;
96 *)              ldflags="${ldflags} -flat_namespace" ;;
97 esac
98 lddlflags="${ldflags} -bundle -undefined suppress";
99 ldlibpthname='DYLD_LIBRARY_PATH';
100 useshrplib='true';
101
102 ##
103 # System libraries
104 ##
105
106 # vfork works
107 usevfork='true';
108
109 # malloc works
110 usemymalloc='n';
111
112 ##
113 # Build process
114 ##
115
116 # Locales aren't feeling well.
117 LC_ALL=C; export LC_ALL;
118 LANG=C; export LANG;
119
120 # Case-insensitive filesystems don't get along with Makefile and
121 # makefile in the same place.  Since Darwin uses GNU make, this dodges
122 # the problem.
123 firstmakefile=GNUmakefile;
124
125 #
126 # The libraries are not threadsafe as of OS X 10.1.
127 # Better stop now.
128 #
129 # Fix when Apple fixes libc.
130 #
131 case "$usethreads$useithreads$use5005threads" in
132 *define*)
133 cat <<EOM >&4
134
135 *** You do not have threadsafe libraries, I cannot use threads.
136 *** Cannot continue, aborting.
137 EOM
138         exit 1
139         ;;
140 esac