Commit | Line | Data |
---|---|---|
bc1ad331 | 1 | # hints/solaris_2.sh |
55954f19 JH |
2 | # Contributions by (in alphabetical order) Alan Burlison, Andy Dougherty, |
3 | # Dean Roehrich, Jarkko Hietaniemi, Lupe Christoph, Richard Soderberg and | |
4 | # many others. | |
d420ca49 AD |
5 | # |
6 | # See README.solaris for additional information. | |
7 | # | |
73ad924b LC |
8 | # For consistency with gcc, we do not adopt Sun Marketing's |
9 | # removal of the '2.' prefix from the Solaris version number. | |
10 | # (Configure tries to detect an old fixincludes and needs | |
11 | # this information.) | |
12 | ||
bc1ad331 JH |
13 | # If perl fails tests that involve dynamic loading of extensions, and |
14 | # you are using gcc, be sure that you are NOT using GNU as and ld. One | |
15 | # way to do that is to invoke Configure with | |
73ad924b | 16 | # |
bc1ad331 JH |
17 | # sh Configure -Dcc='gcc -B/usr/ccs/bin/' |
18 | # | |
19 | # (Note that the trailing slash is *required*.) | |
20 | # gcc will occasionally emit warnings about "unused prefix", but | |
21 | # these ought to be harmless. See below for more details. | |
73ad924b | 22 | |
83bd2f30 LC |
23 | # Solaris has secure SUID scripts |
24 | d_suidsafe=${d_suidsafe:-define} | |
25 | ||
5129fff4 | 26 | # Be paranoid about nm failing to find symbols |
9cad8f9e | 27 | mistrustnm=${mistrustnm:-run} |
5129fff4 | 28 | |
83bd2f30 LC |
29 | # Several people reported problems with perl's malloc, especially |
30 | # when use64bitall is defined or when using gcc. | |
31 | # http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-01/msg01318.html | |
32 | # http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-01/msg00465.html | |
33 | usemymalloc=${usemymalloc:-false} | |
bc1ad331 | 34 | |
da0b61dd NC |
35 | # malloc wrap works |
36 | case "$usemallocwrap" in | |
37 | '') usemallocwrap='define' ;; | |
38 | esac | |
39 | ||
bc1ad331 | 40 | # Avoid all libraries in /usr/ucblib. |
73ad924b LC |
41 | # /lib is just a symlink to /usr/lib |
42 | set `echo $glibpth | sed -e 's@/usr/ucblib@@' -e 's@ /lib @ @'` | |
bc1ad331 JH |
43 | glibpth="$*" |
44 | ||
6ef45c95 AD |
45 | # Starting with Solaris 10, we don't want versioned shared libraries because |
46 | # those often indicate a private use only library. Especially badly that would | |
dc987c66 JH |
47 | # break things with SUNWbdb (Berkeley DB) being installed, which brings in |
48 | # /usr/lib/libdb.so.1, but that is not really meant for public consumption. | |
6ef45c95 AD |
49 | # XXX Revisit after perl 5.10 -- should we apply this to older Solaris |
50 | # versions too? (A.D. 11/2007). | |
0d460bac | 51 | case "`$run uname -r`" in |
6ef45c95 AD |
52 | 5.[0-9]) ;; |
53 | *) ignore_versioned_solibs=y ;; | |
dc987c66 JH |
54 | esac |
55 | ||
73ad924b LC |
56 | # Remove unwanted libraries. -lucb contains incompatible routines. |
57 | # -lld and -lsec don't do anything useful. -lcrypt does not | |
58 | # really provide anything we need over -lc, so we drop it, too. | |
bc1ad331 JH |
59 | # -lmalloc can cause a problem with GNU CC & Solaris. Specifically, |
60 | # libmalloc.a may allocate memory that is only 4 byte aligned, but | |
61 | # GNU CC on the Sparc assumes that doubles are 8 byte aligned. | |
62 | # Thanks to Hallvard B. Furuseth <h.b.furuseth@usit.uio.no> | |
73ad924b | 63 | set `echo " $libswanted " | sed -e 's@ ld @ @' -e 's@ malloc @ @' -e 's@ ucb @ @' -e 's@ sec @ @' -e 's@ crypt @ @'` |
bc1ad331 JH |
64 | libswanted="$*" |
65 | ||
b1db1e90 | 66 | # Look for architecture name. We want to suggest a useful default. |
a0d0e21e LW |
67 | case "$archname" in |
68 | '') | |
69 | if test -f /usr/bin/arch; then | |
2a9d46ac GA |
70 | archname=`/usr/bin/arch` |
71 | archname="${archname}-${osname}" | |
a0d0e21e | 72 | elif test -f /usr/ucb/arch; then |
2a9d46ac GA |
73 | archname=`/usr/ucb/arch` |
74 | archname="${archname}-${osname}" | |
a0d0e21e LW |
75 | fi |
76 | ;; | |
77 | esac | |
a0d0e21e | 78 | |
55954f19 JH |
79 | # |
80 | # This extracts the library directories that will be searched by the Sun | |
81 | # Workshop compiler, given the command-line supplied in $tryworkshopcc. | |
82 | # Use thusly: loclibpth="`$getworkshoplibs` $loclibpth" | |
83 | # | |
84 | getworkshoplibs=`cat <<'END' | |
85 | eval $tryworkshopcc -### 2>&1 | \ | |
86 | sed -n '/ -Y /s!.* -Y "P,\([^"]*\)".*!\1!p' | tr ':' ' ' | \ | |
87 | sed -e 's!/usr/lib/sparcv9!!' -e 's!/usr/ccs/lib/sparcv9!!' \ | |
88 | -e 's!/usr/lib!!g' -e 's!/usr/ccs/lib!!g' | |
89 | END | |
90 | ` | |
da8f3004 | 91 | |
d503bed0 | 92 | case "$cc" in |
78ab3d1a JH |
93 | '') for i in `ls -r /opt/solstudio*/bin/cc` /opt/SUNWspro/bin/cc |
94 | do | |
95 | if test -f "$i"; then | |
96 | cc=$i | |
97 | cat <<EOF >&4 | |
d503bed0 | 98 | |
32ca13a0 JH |
99 | You specified no cc but you seem to have the Workshop compiler |
100 | ($cc) installed, using that. | |
101 | If you want something else, specify that in the command line, | |
d503bed0 JH |
102 | e.g. Configure -Dcc=gcc |
103 | ||
104 | EOF | |
78ab3d1a JH |
105 | break |
106 | fi | |
107 | done | |
d503bed0 JH |
108 | ;; |
109 | esac | |
110 | ||
da8f3004 JH |
111 | ###################################################### |
112 | # General sanity testing. See below for excerpts from the Solaris FAQ. | |
113 | # | |
114 | # From roehrich@ironwood-fddi.cray.com Wed Sep 27 12:51:46 1995 | |
115 | # Date: Thu, 7 Sep 1995 16:31:40 -0500 | |
116 | # From: Dean Roehrich <roehrich@ironwood-fddi.cray.com> | |
117 | # To: perl5-porters@africa.nicoh.com | |
118 | # Subject: Re: On perl5/solaris/gcc | |
119 | # | |
73ad924b | 120 | # Here's another draft of the perl5/solaris/gcc sanity-checker. |
da8f3004 | 121 | |
bd89102f AD |
122 | case `type ${cc:-cc}` in |
123 | */usr/ucb/cc*) cat <<END >&4 | |
8e07c86e | 124 | |
73ad924b | 125 | NOTE: Some people have reported problems with /usr/ucb/cc. |
bd89102f AD |
126 | If you have difficulties, please make sure the directory |
127 | containing your C compiler is before /usr/ucb in your PATH. | |
8e07c86e AD |
128 | |
129 | END | |
130 | ;; | |
131 | esac | |
132 | ||
133 | ||
134 | # Check that /dev/fd is mounted. If it is not mounted, let the | |
135 | # user know that suid scripts may not work. | |
0d460bac | 136 | $run mount | grep '^/dev/fd ' 2>&1 > /dev/null |
8e07c86e AD |
137 | case $? in |
138 | 0) ;; | |
139 | *) | |
68dc0745 | 140 | cat <<END >&4 |
8e07c86e AD |
141 | |
142 | NOTE: Your system does not have /dev/fd mounted. If you want to | |
143 | be able to use set-uid scripts you must ask your system administrator | |
144 | to mount /dev/fd. | |
145 | ||
146 | END | |
147 | ;; | |
148 | esac | |
149 | ||
150 | ||
151 | # See if libucb can be found in /usr/lib. If it is, warn the user | |
152 | # that this may cause problems while building Perl extensions. | |
0d460bac BF |
153 | found_libucb='' |
154 | case "$run" in | |
155 | '') /usr/bin/ls /usr/lib/libucb* >/dev/null 2>&1 | |
156 | found_libucb=$? | |
157 | ;; | |
158 | *) $run /usr/bin/ls '/usr/lib/libucb*' >/dev/null 2>&1 | |
159 | found_libucb=$? | |
160 | ;; | |
161 | esac | |
162 | ||
163 | case $found_libucb in | |
8e07c86e | 164 | 0) |
68dc0745 | 165 | cat <<END >&4 |
8e07c86e AD |
166 | |
167 | NOTE: libucb has been found in /usr/lib. libucb should reside in | |
168 | /usr/ucblib. You may have trouble while building Perl extensions. | |
169 | ||
a0d0e21e LW |
170 | END |
171 | ;; | |
172 | esac | |
40000a8c | 173 | |
bd89102f AD |
174 | # Use shell built-in 'type' command instead of /usr/bin/which to |
175 | # avoid possible csh start-up problems and also to use the same shell | |
176 | # we'll be using to Configure and make perl. | |
177 | # The path name is the last field in the output, but the type command | |
178 | # has an annoying array of possible outputs, e.g.: | |
179 | # make is hashed (/opt/gnu/bin/make) | |
6ef45c95 | 180 | # cc is /usr/ucb/cc |
bd89102f AD |
181 | # foo not found |
182 | # use a command like type make | awk '{print $NF}' | sed 's/[()]//g' | |
8e07c86e AD |
183 | |
184 | # See if make(1) is GNU make(1). | |
185 | # If it is, make sure the setgid bit is not set. | |
186 | make -v > make.vers 2>&1 | |
187 | if grep GNU make.vers > /dev/null 2>&1; then | |
bd89102f | 188 | tmp=`type make | awk '{print $NF}' | sed 's/[()]//g'` |
0d460bac | 189 | case "`${ls:-'/usr/bin/ls'} -lL $tmp`" in |
8e07c86e | 190 | ??????s*) |
68dc0745 | 191 | cat <<END >&2 |
73ad924b | 192 | |
8e07c86e AD |
193 | NOTE: Your PATH points to GNU make, and your GNU make has the set-group-id |
194 | bit set. You must either rearrange your PATH to put /usr/ccs/bin before the | |
195 | GNU utilities or you must ask your system administrator to disable the | |
196 | set-group-id bit on GNU make. | |
197 | ||
198 | END | |
199 | ;; | |
200 | esac | |
201 | fi | |
202 | rm -f make.vers | |
203 | ||
73ad924b LC |
204 | cat > UU/cc.cbu <<'EOCBU' |
205 | # This script UU/cc.cbu will get 'called-back' by Configure after it | |
206 | # has prompted the user for the C compiler to use. | |
207 | ||
8e07c86e AD |
208 | # If the C compiler is gcc: |
209 | # - check the fixed-includes | |
210 | # - check as(1) and ld(1), they should not be GNU | |
bd89102f | 211 | # (GNU as and ld 2.8.1 and later are reportedly ok, however.) |
8e07c86e | 212 | # If the C compiler is not gcc: |
73ad924b LC |
213 | # - Check if it is the Workshop/Forte compiler. |
214 | # If it is, prepare for 64 bit and long doubles. | |
8e07c86e | 215 | # - check as(1) and ld(1), they should not be GNU |
bd89102f | 216 | # (GNU as and ld 2.8.1 and later are reportedly ok, however.) |
8e07c86e AD |
217 | # |
218 | # Watch out in case they have not set $cc. | |
1acf53c5 | 219 | |
73ad924b | 220 | # Perl compiled with some combinations of GNU as and ld may not |
e766ed8d AD |
221 | # be able to perform dynamic loading of extensions. If you have a |
222 | # problem with dynamic loading, be sure that you are using the Solaris | |
223 | # /usr/ccs/bin/as and /usr/ccs/bin/ld. You can do that with | |
6ef45c95 | 224 | # sh Configure -Dcc='gcc -B/usr/ccs/bin/' |
73ad924b | 225 | # (note the trailing slash is required). |
e766ed8d AD |
226 | # Combinations that are known to work with the following hints: |
227 | # | |
228 | # gcc-2.7.2, GNU as 2.7, GNU ld 2.7 | |
229 | # egcs-1.0.3, GNU as 2.9.1 and GNU ld 2.9.1 | |
73ad924b | 230 | # --Andy Dougherty <doughera@lafayette.edu> |
e766ed8d AD |
231 | # Tue Apr 13 17:19:43 EDT 1999 |
232 | ||
1acf53c5 | 233 | # Get gcc to share its secrets. |
55954f19 | 234 | echo 'int main() { return 0; }' > try.c |
bd89102f | 235 | # Indent to avoid propagation to config.sh |
0d460bac | 236 | verbose=`${cc:-cc} $ccflags -v -o try try.c 2>&1` |
1acf53c5 | 237 | |
002c7b69 AD |
238 | # XXX TODO: 'specs' output changed from 'Reading specs from' in gcc-[23] to 'Using |
239 | # built-in specs' in gcc-4. Perhaps we should just use the same gcc test as | |
240 | # in Configure to see if we're using gcc. | |
241 | if echo "$verbose" | egrep '(Reading specs from)|(Using built-in specs)' >/dev/null 2>&1; then | |
8e07c86e AD |
242 | # |
243 | # Using gcc. | |
244 | # | |
68fed2af | 245 | cc_name='gcc' |
8e07c86e | 246 | |
e766ed8d | 247 | # See if as(1) is GNU as(1). GNU as(1) might not work for this job. |
1acf53c5 SZ |
248 | if echo "$verbose" | grep ' /usr/ccs/bin/as ' >/dev/null 2>&1; then |
249 | : | |
250 | else | |
68dc0745 | 251 | cat <<END >&2 |
8e07c86e | 252 | |
e766ed8d AD |
253 | NOTE: You are using GNU as(1). GNU as(1) might not build Perl. If you |
254 | have trouble, you can use /usr/ccs/bin/as by including -B/usr/ccs/bin/ | |
bd89102f | 255 | in your ${cc:-cc} command. (Note that the trailing "/" is required.) |
8e07c86e AD |
256 | |
257 | END | |
e766ed8d | 258 | # Apparently not needed, at least for as 2.7 and later. |
0d460bac | 259 | # cc="${cc:-cc} $ccflags -B/usr/ccs/bin/" |
1acf53c5 | 260 | fi |
8e07c86e | 261 | |
e766ed8d | 262 | # See if ld(1) is GNU ld(1). GNU ld(1) might not work for this job. |
bd89102f | 263 | # Recompute $verbose since we may have just changed $cc. |
0d460bac | 264 | verbose=`${cc:-cc} $ccflags -v -o try try.c 2>&1 | grep ld 2>&1` |
e766ed8d | 265 | |
bd89102f | 266 | if echo "$verbose" | grep ' /usr/ccs/bin/ld ' >/dev/null 2>&1; then |
e766ed8d AD |
267 | # Ok, gcc directly calls the Solaris /usr/ccs/bin/ld. |
268 | : | |
269 | elif echo "$verbose" | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then | |
270 | # Hmm. gcc doesn't call /usr/ccs/bin/ld directly, but it | |
271 | # does appear to be using it eventually. egcs-1.0.3's ld | |
272 | # wrapper does this. | |
59bcd267 | 273 | # Most Solaris versions of ld I've seen contain the magic |
e766ed8d | 274 | # string used in the grep. |
1acf53c5 | 275 | : |
59bcd267 MB |
276 | elif echo "$verbose" | grep "Solaris Link Editors" >/dev/null 2>&1; then |
277 | # However some Solaris 8 versions prior to ld 5.8-1.286 contain | |
278 | # this string instead. | |
279 | : | |
1acf53c5 | 280 | else |
e766ed8d AD |
281 | # No evidence yet of /usr/ccs/bin/ld. Some versions |
282 | # of egcs's ld wrapper call /usr/ccs/bin/ld in turn but | |
283 | # apparently don't reveal that unless you pass in -V. | |
284 | # (This may all depend on local configurations too.) | |
d5fdf557 | 285 | |
c4a5d551 | 286 | # Recompute verbose with -Wl,-v to find GNU ld if present |
0d460bac | 287 | verbose=`${cc:-cc} $ccflags -Wl,-v -o try try.c 2>&1 | grep /ld 2>&1` |
c4a5d551 | 288 | |
98bcce56 | 289 | myld=`echo $verbose | awk '/\/ld/ {print $1}'` |
e766ed8d AD |
290 | # This assumes that gcc's output will not change, and that |
291 | # /full/path/to/ld will be the first word of the output. | |
c4a5d551 | 292 | # Thus myld is something like /opt/gnu/sparc-sun-solaris2.5/bin/ld |
e766ed8d | 293 | |
6ef45c95 | 294 | # Allow that $myld may be '', due to changes in gcc's output |
c4a5d551 RB |
295 | if ${myld:-ld} -V 2>&1 | |
296 | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then | |
e766ed8d AD |
297 | # Ok, /usr/ccs/bin/ld eventually does get called. |
298 | : | |
59bcd267 MB |
299 | elif ${myld:-ld} -V 2>&1 | |
300 | grep "Solaris Link Editors" >/dev/null 2>&1; then | |
301 | # Ok, /usr/ccs/bin/ld eventually does get called. | |
302 | : | |
e766ed8d | 303 | else |
c4a5d551 | 304 | echo "Found GNU ld='$myld'" >&4 |
e766ed8d | 305 | cat <<END >&2 |
8e07c86e | 306 | |
e766ed8d AD |
307 | NOTE: You are using GNU ld(1). GNU ld(1) might not build Perl. If you |
308 | have trouble, you can use /usr/ccs/bin/ld by including -B/usr/ccs/bin/ | |
bd89102f | 309 | in your ${cc:-cc} command. (Note that the trailing "/" is required.) |
8e07c86e | 310 | |
e766ed8d AD |
311 | I will try to use GNU ld by passing in the -Wl,-E flag, but if that |
312 | doesn't work, you should use -B/usr/ccs/bin/ instead. | |
313 | ||
8e07c86e | 314 | END |
e766ed8d | 315 | ccdlflags="$ccdlflags -Wl,-E" |
767f54d7 | 316 | lddlflags="$lddlflags -Wl,-E -shared" |
e766ed8d | 317 | fi |
1acf53c5 | 318 | fi |
8e07c86e | 319 | |
1acf53c5 | 320 | else |
8e07c86e AD |
321 | # |
322 | # Not using gcc. | |
323 | # | |
55954f19 JH |
324 | cat > try.c << 'EOM' |
325 | #include <stdio.h> | |
326 | int main() { | |
ceaf555e | 327 | #if defined(__SUNPRO_C) |
55954f19 JH |
328 | printf("workshop\n"); |
329 | #else | |
ceaf555e RU |
330 | #if defined(__SUNPRO_CC) |
331 | printf("workshop CC\n"); | |
332 | #else | |
55954f19 JH |
333 | printf("\n"); |
334 | #endif | |
ceaf555e | 335 | #endif |
55954f19 JH |
336 | return(0); |
337 | } | |
73ad924b | 338 | EOM |
0d460bac | 339 | tryworkshopcc="${cc:-cc} $ccflags try.c -o try" |
55954f19 | 340 | if $tryworkshopcc >/dev/null 2>&1; then |
0d460bac | 341 | cc_name=`$run ./try` |
68fed2af | 342 | if test "$cc_name" = "workshop"; then |
8f6660ae | 343 | ccversion="`${cc:-cc} -V 2>&1|sed -n -e '1s/^[Cc][Cc9]9*: //p'`" |
ceaf555e RU |
344 | fi |
345 | if test "$cc_name" = "workshop CC"; then | |
b8cad20a | 346 | ccversion="`${cc:-CC} -V 2>&1|sed -n -e '1s/^[Cc][C]: //p'`" |
39234cea AD |
347 | fi |
348 | case "$cc_name" in | |
349 | workshop*) | |
350 | # Settings for either cc or CC | |
68fed2af JH |
351 | if test ! "$use64bitall_done"; then |
352 | loclibpth="/usr/lib /usr/ccs/lib `$getworkshoplibs` $loclibpth" | |
353 | fi | |
39234cea | 354 | # Sun CC/cc don't support gcc attributes |
2485732a RU |
355 | d_attribute_format='undef' |
356 | d_attribute_malloc='undef' | |
357 | d_attribute_nonnull='undef' | |
358 | d_attribute_noreturn='undef' | |
359 | d_attribute_pure='undef' | |
360 | d_attribute_unused='undef' | |
361 | d_attribute_warn_unused_result='undef' | |
39234cea AD |
362 | ;; |
363 | esac | |
55954f19 | 364 | fi |
73ad924b | 365 | |
e766ed8d | 366 | # See if as(1) is GNU as(1). GNU might not work for this job. |
8e07c86e AD |
367 | case `as --version < /dev/null 2>&1` in |
368 | *GNU*) | |
68dc0745 | 369 | cat <<END >&2 |
8e07c86e | 370 | |
e766ed8d | 371 | NOTE: You are using GNU as(1). GNU as(1) might not build Perl. |
bd89102f AD |
372 | You must arrange to use /usr/ccs/bin/as, perhaps by adding /usr/ccs/bin |
373 | to the beginning of your PATH. | |
8e07c86e AD |
374 | |
375 | END | |
376 | ;; | |
377 | esac | |
378 | ||
e766ed8d | 379 | # See if ld(1) is GNU ld(1). GNU ld(1) might not work for this job. |
91d1e749 | 380 | # ld --version doesn't properly report itself as a GNU tool, |
381 | # as of ld version 2.6, so we need to be more strict. TWP 9/5/96 | |
604c6cff AD |
382 | # Sun's ld always emits the "Software Generation Utilities" string. |
383 | if ld -V 2>&1 | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then | |
384 | # Ok, ld is /usr/ccs/bin/ld. | |
385 | : | |
91d1e749 | 386 | else |
604c6cff | 387 | cat <<END >&2 |
8e07c86e | 388 | |
e766ed8d AD |
389 | NOTE: You are apparently using GNU ld(1). GNU ld(1) might not build Perl. |
390 | You should arrange to use /usr/ccs/bin/ld, perhaps by adding /usr/ccs/bin | |
bd89102f | 391 | to the beginning of your PATH. |
8e07c86e AD |
392 | |
393 | END | |
91d1e749 | 394 | fi |
1acf53c5 | 395 | fi |
6bdd71ef | 396 | |
8e07c86e | 397 | # as --version or ld --version might dump core. |
55954f19 | 398 | rm -f try try.c core |
73ad924b | 399 | EOCBU |
693762b4 | 400 | |
de6124c8 | 401 | cat > UU/usethreads.cbu <<'EOCBU' |
73ad924b | 402 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
104d25b7 | 403 | # after it has prompted the user for whether to use threads. |
104d25b7 JH |
404 | case "$usethreads" in |
405 | $define|true|[yY]*) | |
2a9d46ac | 406 | ccflags="-D_REENTRANT $ccflags" |
104d25b7 | 407 | |
3bf55fe9 | 408 | # -lpthread overrides some lib C functions, so put it before c. |
2a9d46ac GA |
409 | set `echo X "$libswanted "| sed -e "s/ c / pthread c /"` |
410 | shift | |
411 | libswanted="$*" | |
104d25b7 | 412 | |
3bf55fe9 AD |
413 | # sched_yield is available in the -lrt library. However, |
414 | # we can also pick up the equivalent yield() function in the | |
415 | # normal C library. To avoid pulling in unnecessary | |
416 | # libraries, we'll normally avoid sched_yield()/-lrt and | |
417 | # just use yield(). However, we'll honor a command-line | |
418 | # override : "-Dsched_yield=sched_yield". | |
419 | # If we end up using sched_yield, we're going to need -lrt. | |
420 | sched_yield=${sched_yield:-yield} | |
421 | if test "$sched_yield" = "sched_yield"; then | |
422 | set `echo X "$libswanted "| sed -e "s/ pthread / rt pthread /"` | |
423 | shift | |
424 | libswanted="$*" | |
425 | fi | |
426 | ||
2a9d46ac GA |
427 | # On Solaris 2.6 x86 there is a bug with sigsetjmp() and siglongjmp() |
428 | # when linked with the threads library, such that whatever positive | |
429 | # value you pass to siglongjmp(), sigsetjmp() returns 1. | |
430 | # Thanks to Simon Parsons <S.Parsons@ftel.co.uk> for this report. | |
431 | # Sun BugID is 4117946, "sigsetjmp always returns 1 when called by | |
432 | # siglongjmp in a MT program". As of 19980622, there is no patch | |
433 | # available. | |
434 | cat >try.c <<'EOM' | |
104d25b7 JH |
435 | /* Test for sig(set|long)jmp bug. */ |
436 | #include <setjmp.h> | |
73ad924b | 437 | |
55954f19 | 438 | int main() |
104d25b7 JH |
439 | { |
440 | sigjmp_buf env; | |
441 | int ret; | |
73ad924b | 442 | |
104d25b7 JH |
443 | ret = sigsetjmp(env, 1); |
444 | if (ret) { return ret == 2; } | |
445 | siglongjmp(env, 2); | |
446 | } | |
447 | EOM | |
2a9d46ac GA |
448 | if test "`arch`" = i86pc -a `uname -r` = 5.6 && \ |
449 | ${cc:-cc} try.c -lpthread >/dev/null 2>&1 && ./a.out; then | |
450 | d_sigsetjmp=$undef | |
2a9d46ac | 451 | fi |
673e8799 JH |
452 | |
453 | # These prototypes should be visible since we using | |
454 | # -D_REENTRANT, but that does not seem to work. | |
34073cab JH |
455 | # It does seem to work for getnetbyaddr_r, weirdly enough, |
456 | # and other _r functions. (Solaris 8) | |
673e8799 JH |
457 | |
458 | d_ctermid_r_proto="$define" | |
459 | d_gethostbyaddr_r_proto="$define" | |
460 | d_gethostbyname_r_proto="$define" | |
461 | d_getnetbyname_r_proto="$define" | |
462 | d_getprotobyname_r_proto="$define" | |
463 | d_getprotobynumber_r_proto="$define" | |
464 | d_getservbyname_r_proto="$define" | |
465 | d_getservbyport_r_proto="$define" | |
466 | ||
34073cab JH |
467 | # Ditto. (Solaris 7) |
468 | d_readdir_r_proto="$define" | |
469 | d_readdir64_r_proto="$define" | |
d8c5b8d1 JH |
470 | d_tmpnam_r_proto="$define" |
471 | d_ttyname_r_proto="$define" | |
34073cab | 472 | |
6e4796bd | 473 | ;; |
123f9af1 | 474 | esac |
104d25b7 JH |
475 | EOCBU |
476 | ||
923fc586 | 477 | cat > UU/uselargefiles.cbu <<'EOCBU' |
73ad924b | 478 | # This script UU/uselargefiles.cbu will get 'called-back' by Configure |
5fce3f1f | 479 | # after it has prompted the user for whether to use large files. |
bd9b35c9 | 480 | case "$uselargefiles" in |
10cc9d2a | 481 | ''|$define|true|[yY]*) |
9422c00b JH |
482 | |
483 | # Keep these in the left margin. | |
0d460bac BF |
484 | ccflags_uselargefiles="`$run getconf LFS_CFLAGS 2>/dev/null`" |
485 | ldflags_uselargefiles="`$run getconf LFS_LDFLAGS 2>/dev/null`" | |
486 | libswanted_uselargefiles="`$run getconf LFS_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`" | |
9422c00b | 487 | |
45c9e83b JH |
488 | ccflags="$ccflags $ccflags_uselargefiles" |
489 | ldflags="$ldflags $ldflags_uselargefiles" | |
490 | libswanted="$libswanted $libswanted_uselargefiles" | |
6f587e79 | 491 | ;; |
bd9b35c9 | 492 | esac |
5fce3f1f | 493 | EOCBU |
6b8eaf93 | 494 | |
2f4ff158 JH |
495 | # This is truly a mess. |
496 | case "$usemorebits" in | |
497 | "$define"|true|[yY]*) | |
73ad924b LC |
498 | use64bitint="$define" |
499 | uselongdouble="$define" | |
2f4ff158 JH |
500 | ;; |
501 | esac | |
502 | ||
0d460bac | 503 | if test `$run uname -p` = i386; then |
25909821 SP |
504 | case "$use64bitint" in |
505 | "$define"|true|[yY]*) | |
506 | ccflags="$ccflags -DPTR_IS_LONG" | |
507 | ;; | |
508 | esac | |
509 | fi | |
510 | ||
0d460bac | 511 | if test `$run uname -p` = sparc -o `$run uname -p` = i386; then |
73ad924b LC |
512 | cat > UU/use64bitint.cbu <<'EOCBU' |
513 | # This script UU/use64bitint.cbu will get 'called-back' by Configure | |
514 | # after it has prompted the user for whether to use 64 bit integers. | |
515 | case "$use64bitint" in | |
516 | "$define"|true|[yY]*) | |
0d460bac | 517 | case "`$run uname -r`" in |
73ad924b LC |
518 | 5.[0-4]) |
519 | cat >&4 <<EOM | |
520 | Solaris `uname -r|sed -e 's/^5\./2./'` does not support 64-bit integers. | |
521 | You should upgrade to at least Solaris 2.5. | |
522 | EOM | |
523 | exit 1 | |
524 | ;; | |
525 | esac | |
a9d9270b | 526 | |
69b29070 AD |
527 | # gcc-2.8.1 on Solaris 8 with -Duse64bitint fails op/pat.t test 822 |
528 | # if we compile regexec.c with -O. Turn off optimization for that one | |
6ef45c95 | 529 | # file. See hints/README.hints , especially |
69b29070 AD |
530 | # =head2 Propagating variables to config.sh, method 3. |
531 | # A. Dougherty May 24, 2002 | |
69b29070 AD |
532 | case "${gccversion}-${optimize}" in |
533 | 2.8*-O*) | |
534 | # Honor a command-line override (rather unlikely) | |
535 | case "$regexec_cflags" in | |
536 | '') echo "Disabling optimization on regexec.c for gcc $gccversion" >&4 | |
537 | regexec_cflags='optimize=' | |
6ef45c95 | 538 | echo "regexec_cflags='optimize=\"\"'" >> config.sh |
69b29070 AD |
539 | ;; |
540 | esac | |
541 | ;; | |
542 | esac | |
543 | ;; | |
544 | esac | |
73ad924b LC |
545 | EOCBU |
546 | ||
547 | cat > UU/use64bitall.cbu <<'EOCBU' | |
548 | # This script UU/use64bitall.cbu will get 'called-back' by Configure | |
c4eb8127 JH |
549 | # after it has prompted the user for whether to be maximally 64 bitty. |
550 | case "$use64bitall-$use64bitall_done" in | |
551 | "$define-"|true-|[yY]*-) | |
0d460bac | 552 | case "`$run uname -r`" in |
73ad924b | 553 | 5.[0-6]) |
104d25b7 | 554 | cat >&4 <<EOM |
73ad924b LC |
555 | Solaris `uname -r|sed -e 's/^5\./2./'` does not support 64-bit pointers. |
556 | You should upgrade to at least Solaris 2.7. | |
104d25b7 JH |
557 | EOM |
558 | exit 1 | |
559 | ;; | |
560 | esac | |
0d460bac | 561 | processor=`$run uname -p`; |
2a9d46ac GA |
562 | if test "$processor" = sparc; then |
563 | libc='/usr/lib/sparcv9/libc.so' | |
564 | if test ! -f $libc; then | |
565 | cat >&4 <<EOM | |
282f2f4c JH |
566 | |
567 | I do not see the 64-bit libc, $libc. | |
568 | Cannot continue, aborting. | |
569 | ||
570 | EOM | |
2a9d46ac GA |
571 | exit 1 |
572 | fi | |
e6f120fa | 573 | fi |
6bdd71ef | 574 | case "${cc:-cc} -v 2>/dev/null" in |
4c07fe1d | 575 | *gcc*) |
55954f19 | 576 | echo 'int main() { return 0; }' > try.c |
0d460bac | 577 | case "`${cc:-cc} $ccflags -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in |
9636b992 | 578 | *"m64 is not supported"*) |
9b119d5a RB |
579 | cat >&4 <<EOM |
580 | ||
e6f120fa JH |
581 | Full 64-bit build is not supported by this gcc configuration. |
582 | Check http://gcc.gnu.org/ for the latest news of availability | |
583 | of gcc for 64-bit Sparc. | |
584 | ||
9b119d5a RB |
585 | Cannot continue, aborting. |
586 | ||
587 | EOM | |
588 | exit 1 | |
9636b992 | 589 | ;; |
73ad924b | 590 | esac |
2a9d46ac GA |
591 | if test "$processor" = sparc; then |
592 | loclibpth="/usr/lib/sparcv9 $loclibpth" | |
593 | ccflags="$ccflags -mcpu=v9" | |
6ef45c95 | 594 | fi |
2a9d46ac | 595 | ccflags="$ccflags -m64" |
86c5d995 MB |
596 | |
597 | # This adds in -Wa,-xarch=v9. I suspect that's superfluous, | |
598 | # since the -m64 above should do that already. Someone | |
599 | # with gcc-3.x.x, please test with gcc -v. A.D. 20-Nov-2003 | |
0d460bac BF |
600 | # if test $processor = sparc -a X`$run getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null` != X; then |
601 | # ccflags="$ccflags -Wa,`$run getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`" | |
86c5d995 | 602 | # fi |
0ceffaa6 | 603 | ldflags="$ldflags -m64" |
767f54d7 AD |
604 | |
605 | # See [perl #66604]: On Solaris 11, gcc -m64 on amd64 | |
606 | # appears not to understand -G. (gcc -G has not caused | |
607 | # problems on other platforms in the past.) gcc versions | |
608 | # at least as old as 3.4.3 support -shared, so just | |
609 | # use that with Solaris 11 and later, but keep | |
610 | # the old behavior for older Solaris versions. | |
611 | case "$osvers" in | |
612 | 2.?|2.10) lddlflags="$lddlflags -G -m64" ;; | |
613 | *) lddlflags="$lddlflags -shared -m64" ;; | |
614 | esac | |
4c07fe1d JH |
615 | ;; |
616 | *) | |
0d460bac BF |
617 | getconfccflags="`$run getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`" |
618 | getconfldflags="`$run getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`" | |
619 | getconflddlflags="`$run getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`" | |
b641685a A |
620 | echo "int main() { return(0); } " > try.c |
621 | case "`${cc:-cc} $getconfccflags try.c 2>&1 | grep 'deprecated'`" in | |
622 | *" -xarch=generic64 is deprecated, use -m64 "*) | |
623 | getconfccflags=`echo $getconfccflags | sed -e 's/xarch=generic64/m64/'` | |
624 | getconfldflags=`echo $getconfldflags | sed -e 's/xarch=generic64/m64/'` | |
c80bde43 | 625 | getconflddlflags=`echo $getconflddlflags | sed -e 's/xarch=generic64/m64/'` |
b641685a A |
626 | ;; |
627 | esac | |
628 | ccflags="$ccflags $getconfccflags" | |
629 | ldflags="$ldflags $getconfldflags" | |
630 | lddlflags="$lddlflags -G $getconflddlflags" | |
631 | ||
55954f19 JH |
632 | echo "int main() { return(0); } " > try.c |
633 | tryworkshopcc="${cc:-cc} try.c -o try $ccflags" | |
2a9d46ac GA |
634 | if test "$processor" = sparc; then |
635 | loclibpth="/usr/lib/sparcv9 /usr/ccs/lib/sparcv9 $loclibpth" | |
636 | fi | |
637 | loclibpth="`$getworkshoplibs` $loclibpth" | |
4c07fe1d | 638 | ;; |
73ad924b | 639 | esac |
2a9d46ac | 640 | unset processor |
e9a51be3 | 641 | use64bitall_done=yes |
5cfbcfcd | 642 | archname64=64 |
6f587e79 JH |
643 | ;; |
644 | esac | |
4c07fe1d | 645 | EOCBU |
73ad924b LC |
646 | |
647 | # Actually, we want to run this already now, if so requested, | |
648 | # because we need to fix up things right now. | |
649 | case "$use64bitall" in | |
650 | "$define"|true|[yY]*) | |
651 | # CBUs expect to be run in UU | |
652 | cd UU; . ./use64bitall.cbu; cd .. | |
631e9f25 | 653 | ;; |
73ad924b LC |
654 | esac |
655 | fi | |
b0ca24c6 | 656 | |
923fc586 | 657 | cat > UU/uselongdouble.cbu <<'EOCBU' |
73ad924b | 658 | # This script UU/uselongdouble.cbu will get 'called-back' by Configure |
923fc586 | 659 | # after it has prompted the user for whether to use long doubles. |
e9a51be3 JH |
660 | case "$uselongdouble" in |
661 | "$define"|true|[yY]*) | |
68fed2af | 662 | if test "$cc_name" = "workshop"; then |
55954f19 JH |
663 | cat > try.c << 'EOM' |
664 | #include <sunmath.h> | |
665 | int main() { (void) powl(2, 256); return(0); } | |
666 | EOM | |
6bdd71ef | 667 | if ${cc:-cc} try.c -lsunmath -o try > /dev/null 2>&1 && ./try; then |
55954f19 JH |
668 | libswanted="$libswanted sunmath" |
669 | fi | |
8364ae4d | 670 | else |
73ad924b LC |
671 | cat >&4 <<EOM |
672 | ||
55954f19 JH |
673 | The Sun Workshop math library is either not available or not working, |
674 | so I do not know how to do long doubles, sorry. | |
675 | I'm therefore disabling the use of long doubles. | |
73ad924b LC |
676 | EOM |
677 | uselongdouble="$undef" | |
8364ae4d | 678 | fi |
e9a51be3 JH |
679 | ;; |
680 | esac | |
73ad924b | 681 | EOCBU |
e9a51be3 | 682 | |
88f5bc07 AB |
683 | # |
684 | # If unsetenv is available, use it in conjunction with PERL_USE_SAFE_PUTENV to | |
685 | # work around Sun bugid 6333830. Both unsetenv and 6333830 only appear in | |
686 | # Solaris 10, so we don't need to probe explicitly for an OS version. We have | |
687 | # to append this test to the end of config.over as it needs to run after | |
688 | # Configure has probed for unsetenv, and this hints file is processed before | |
689 | # that has happened. | |
690 | # | |
691 | cat >> config.over <<'EOOVER' | |
692 | if test "$d_unsetenv" = "$define" -a \ | |
dd25c352 | 693 | `expr "$ccflags" : '.*-DPERL_USE_SAFE_PUTENV'` -eq 0; then |
88f5bc07 AB |
694 | ccflags="$ccflags -DPERL_USE_SAFE_PUTENV" |
695 | fi | |
696 | EOOVER | |
697 | ||
73ad924b | 698 | rm -f try.c try.o try a.out |
6c86a5de | 699 | |
1ccb7c8d | 700 | # If using C++, the Configure scan for dlopen() will fail in Solaris |
6c86a5de JH |
701 | # because one of the two (1) an extern "C" linkage definition is needed |
702 | # (2) #include <dlfcn.h> is needed, *and* a cast to (void*(*)()) | |
703 | # is needed for the &dlopen. Adding any of these would require changing | |
704 | # a delicate spot in Configure, so easier just to force our guess here | |
c3faea48 | 705 | # for Solaris. Much the same goes for dlerror(). |
6c86a5de | 706 | case "$cc" in |
c3faea48 JH |
707 | *g++*|*CC*) |
708 | d_dlopen='define' | |
709 | d_dlerror='define' | |
710 | ;; | |
6c86a5de JH |
711 | esac |
712 |