This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH @8269] Continue blocks and B::Deparse
[perl5.git] / hints / solaris_2.sh
CommitLineData
bc1ad331 1# hints/solaris_2.sh
d420ca49 2# Last modified: Thu Nov 9 14:21:02 EST 2000
bc1ad331 3# Andy Dougherty <doughera@lafayette.edu>
6e684814 4# Based on input from lots of folks, especially
bc1ad331 5# Dean Roehrich <roehrich@ironwood-fddi.cray.com>
d420ca49
AD
6#
7# See README.solaris for additional information.
8#
bc1ad331
JH
9# If perl fails tests that involve dynamic loading of extensions, and
10# you are using gcc, be sure that you are NOT using GNU as and ld. One
11# way to do that is to invoke Configure with
12#
13# sh Configure -Dcc='gcc -B/usr/ccs/bin/'
14#
15# (Note that the trailing slash is *required*.)
16# gcc will occasionally emit warnings about "unused prefix", but
17# these ought to be harmless. See below for more details.
18
19# See man vfork.
20usevfork=false
21
22d_suidsafe=define
23
24# Avoid all libraries in /usr/ucblib.
25set `echo $glibpth | sed -e 's@/usr/ucblib@@'`
26glibpth="$*"
27
6e684814
JH
28# Remove bad libraries. -lucb contains incompatible routines.
29# -lld doesn't do anything useful.
bc1ad331
JH
30# -lmalloc can cause a problem with GNU CC & Solaris. Specifically,
31# libmalloc.a may allocate memory that is only 4 byte aligned, but
32# GNU CC on the Sparc assumes that doubles are 8 byte aligned.
33# Thanks to Hallvard B. Furuseth <h.b.furuseth@usit.uio.no>
6e684814 34set `echo " $libswanted " | sed -e 's@ ld @ @' -e 's@ malloc @ @' -e 's@ ucb @ @'`
bc1ad331
JH
35libswanted="$*"
36
b1db1e90 37# Look for architecture name. We want to suggest a useful default.
a0d0e21e
LW
38case "$archname" in
39'')
40 if test -f /usr/bin/arch; then
41 archname=`/usr/bin/arch`
42 archname="${archname}-${osname}"
43 elif test -f /usr/ucb/arch; then
44 archname=`/usr/ucb/arch`
45 archname="${archname}-${osname}"
46 fi
47 ;;
48esac
a0d0e21e 49
5e4c82f0
JH
50cc=${cc:-cc}
51
52ccversion="`$cc -V 2>&1|head -1|sed 's/^cc: //'`"
6b356c8e
JH
53case "$ccversion" in
54*WorkShop*) ccname=workshop ;;
55*) ccversion='' ;;
56esac
8c38c51e 57
6e684814 58cat >UU/workshoplibpth.cbu<<'EOCBU'
da8f3004 59case "$workshoplibpth_done" in
6e684814 60'') case "$use64bitall" in
da8f3004
JH
61 "$define"|true|[yY]*)
62 loclibpth="$loclibpth /usr/lib/sparcv9"
63 if test -n "$workshoplibs"; then
64 loclibpth=`echo $loclibpth | sed -e "s% $workshoplibs%%" `
65 for lib in $workshoplibs; do
66 # Logically, it should be sparcv9.
67 # But the reality fights back, it's v9.
68 loclibpth="$loclibpth $lib/sparcv9 $lib/v9"
69 done
70 fi
71 ;;
72 *) loclibpth="$loclibpth $workshoplibs"
73 ;;
74 esac
75 workshoplibpth_done="$define"
76 ;;
77esac
78EOCBU
79
e723fc21
JH
80case "$ccname" in
81workshop)
8c38c51e
JH
82 cat >try.c <<EOF
83#include <sunmath.h>
84int main() { return(0); }
85EOF
da8f3004 86 workshoplibs=`cc -### try.c -lsunmath -o try 2>&1|grep " -Y "|sed 's%.* -Y "P,\(.*\)".*%\1%'|tr ':' '\n'|grep '/SUNWspro/'`
8e0cb907 87 . ./UU/workshoplibpth.cbu
8c38c51e
JH
88 ;;
89esac
90
da8f3004
JH
91######################################################
92# General sanity testing. See below for excerpts from the Solaris FAQ.
93#
94# From roehrich@ironwood-fddi.cray.com Wed Sep 27 12:51:46 1995
95# Date: Thu, 7 Sep 1995 16:31:40 -0500
96# From: Dean Roehrich <roehrich@ironwood-fddi.cray.com>
97# To: perl5-porters@africa.nicoh.com
98# Subject: Re: On perl5/solaris/gcc
99#
100# Here's another draft of the perl5/solaris/gcc sanity-checker.
101
bd89102f
AD
102case `type ${cc:-cc}` in
103*/usr/ucb/cc*) cat <<END >&4
8e07c86e 104
a0d0e21e 105NOTE: Some people have reported problems with /usr/ucb/cc.
bd89102f
AD
106If you have difficulties, please make sure the directory
107containing your C compiler is before /usr/ucb in your PATH.
8e07c86e
AD
108
109END
110;;
111esac
112
113
114# Check that /dev/fd is mounted. If it is not mounted, let the
115# user know that suid scripts may not work.
116/usr/bin/df /dev/fd 2>&1 > /dev/null
117case $? in
1180) ;;
119*)
68dc0745 120 cat <<END >&4
8e07c86e
AD
121
122NOTE: Your system does not have /dev/fd mounted. If you want to
123be able to use set-uid scripts you must ask your system administrator
124to mount /dev/fd.
125
126END
127 ;;
128esac
129
130
131# See if libucb can be found in /usr/lib. If it is, warn the user
132# that this may cause problems while building Perl extensions.
133/usr/bin/ls /usr/lib/libucb* >/dev/null 2>&1
134case $? in
1350)
68dc0745 136 cat <<END >&4
8e07c86e
AD
137
138NOTE: libucb has been found in /usr/lib. libucb should reside in
139/usr/ucblib. You may have trouble while building Perl extensions.
140
a0d0e21e
LW
141END
142;;
143esac
40000a8c 144
bd89102f
AD
145# Use shell built-in 'type' command instead of /usr/bin/which to
146# avoid possible csh start-up problems and also to use the same shell
147# we'll be using to Configure and make perl.
148# The path name is the last field in the output, but the type command
149# has an annoying array of possible outputs, e.g.:
150# make is hashed (/opt/gnu/bin/make)
151# cc is /usr/ucb/cc
152# foo not found
153# use a command like type make | awk '{print $NF}' | sed 's/[()]//g'
8e07c86e
AD
154
155# See if make(1) is GNU make(1).
156# If it is, make sure the setgid bit is not set.
157make -v > make.vers 2>&1
158if grep GNU make.vers > /dev/null 2>&1; then
bd89102f
AD
159 tmp=`type make | awk '{print $NF}' | sed 's/[()]//g'`
160 case "`/usr/bin/ls -lL $tmp`" in
8e07c86e 161 ??????s*)
68dc0745 162 cat <<END >&2
8e07c86e
AD
163
164NOTE: Your PATH points to GNU make, and your GNU make has the set-group-id
165bit set. You must either rearrange your PATH to put /usr/ccs/bin before the
166GNU utilities or you must ask your system administrator to disable the
167set-group-id bit on GNU make.
168
169END
170 ;;
171 esac
172fi
173rm -f make.vers
174
693762b4
AD
175# XXX EXPERIMENTAL A.D. 2/27/1998
176# XXX This script UU/cc.cbu will get 'called-back' by Configure after it
177# XXX has prompted the user for the C compiler to use.
178cat > UU/cc.cbu <<'EOSH'
8e07c86e
AD
179# If the C compiler is gcc:
180# - check the fixed-includes
181# - check as(1) and ld(1), they should not be GNU
bd89102f 182# (GNU as and ld 2.8.1 and later are reportedly ok, however.)
8e07c86e
AD
183# If the C compiler is not gcc:
184# - check as(1) and ld(1), they should not be GNU
bd89102f 185# (GNU as and ld 2.8.1 and later are reportedly ok, however.)
8e07c86e
AD
186#
187# Watch out in case they have not set $cc.
1acf53c5 188
e766ed8d
AD
189# Perl compiled with some combinations of GNU as and ld may not
190# be able to perform dynamic loading of extensions. If you have a
191# problem with dynamic loading, be sure that you are using the Solaris
192# /usr/ccs/bin/as and /usr/ccs/bin/ld. You can do that with
193# sh Configure -Dcc='gcc -B/usr/ccs/bin/'
194# (note the trailing slash is required).
195# Combinations that are known to work with the following hints:
196#
197# gcc-2.7.2, GNU as 2.7, GNU ld 2.7
198# egcs-1.0.3, GNU as 2.9.1 and GNU ld 2.9.1
199# --Andy Dougherty <doughera@lafayette.edu>
200# Tue Apr 13 17:19:43 EDT 1999
201
1acf53c5
SZ
202# Get gcc to share its secrets.
203echo 'main() { return 0; }' > try.c
bd89102f
AD
204 # Indent to avoid propagation to config.sh
205 verbose=`${cc:-cc} -v -o try try.c 2>&1`
1acf53c5
SZ
206
207if echo "$verbose" | grep '^Reading specs from' >/dev/null 2>&1; then
8e07c86e
AD
208 #
209 # Using gcc.
210 #
8e07c86e 211
8e07c86e
AD
212 tmp=`echo "$verbose" | grep '^Reading' |
213 awk '{print $NF}' | sed 's/specs$/include/'`
214
215 # Determine if the fixed-includes look like they'll work.
cee5ebb5 216 # Doesn't work anymore for gcc-2.7.2.
8e07c86e 217
e766ed8d 218 # See if as(1) is GNU as(1). GNU as(1) might not work for this job.
1acf53c5
SZ
219 if echo "$verbose" | grep ' /usr/ccs/bin/as ' >/dev/null 2>&1; then
220 :
221 else
68dc0745 222 cat <<END >&2
8e07c86e 223
e766ed8d
AD
224NOTE: You are using GNU as(1). GNU as(1) might not build Perl. If you
225have trouble, you can use /usr/ccs/bin/as by including -B/usr/ccs/bin/
bd89102f 226in your ${cc:-cc} command. (Note that the trailing "/" is required.)
8e07c86e
AD
227
228END
e766ed8d
AD
229 # Apparently not needed, at least for as 2.7 and later.
230 # cc="${cc:-cc} -B/usr/ccs/bin/"
1acf53c5 231 fi
8e07c86e 232
e766ed8d 233 # See if ld(1) is GNU ld(1). GNU ld(1) might not work for this job.
bd89102f 234 # Recompute $verbose since we may have just changed $cc.
d5fdf557 235 verbose=`${cc:-cc} -v -o try try.c 2>&1 | grep ld 2>&1`
e766ed8d 236
bd89102f 237 if echo "$verbose" | grep ' /usr/ccs/bin/ld ' >/dev/null 2>&1; then
e766ed8d
AD
238 # Ok, gcc directly calls the Solaris /usr/ccs/bin/ld.
239 :
240 elif echo "$verbose" | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
241 # Hmm. gcc doesn't call /usr/ccs/bin/ld directly, but it
242 # does appear to be using it eventually. egcs-1.0.3's ld
243 # wrapper does this.
244 # All Solaris versions of ld I've seen contain the magic
245 # string used in the grep.
1acf53c5
SZ
246 :
247 else
e766ed8d
AD
248 # No evidence yet of /usr/ccs/bin/ld. Some versions
249 # of egcs's ld wrapper call /usr/ccs/bin/ld in turn but
250 # apparently don't reveal that unless you pass in -V.
251 # (This may all depend on local configurations too.)
d5fdf557
TS
252
253 myld=`echo $verbose| grep ld | awk '/\/ld/ {print $1}'`
e766ed8d
AD
254 # This assumes that gcc's output will not change, and that
255 # /full/path/to/ld will be the first word of the output.
256 # Thus myld is something like opt/gnu/sparc-sun-solaris2.5/bin/ld
257
258 if $myld -V 2>&1 | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
259 # Ok, /usr/ccs/bin/ld eventually does get called.
260 :
261 else
262 cat <<END >&2
8e07c86e 263
e766ed8d
AD
264NOTE: You are using GNU ld(1). GNU ld(1) might not build Perl. If you
265have trouble, you can use /usr/ccs/bin/ld by including -B/usr/ccs/bin/
bd89102f 266in your ${cc:-cc} command. (Note that the trailing "/" is required.)
8e07c86e 267
e766ed8d
AD
268I will try to use GNU ld by passing in the -Wl,-E flag, but if that
269doesn't work, you should use -B/usr/ccs/bin/ instead.
270
8e07c86e 271END
e766ed8d
AD
272 ccdlflags="$ccdlflags -Wl,-E"
273 lddlflags="$lddlflags -W,l-E -G"
274 fi
1acf53c5 275 fi
8e07c86e 276
1acf53c5 277else
8e07c86e
AD
278 #
279 # Not using gcc.
280 #
8e07c86e 281
e766ed8d 282 # See if as(1) is GNU as(1). GNU might not work for this job.
8e07c86e
AD
283 case `as --version < /dev/null 2>&1` in
284 *GNU*)
68dc0745 285 cat <<END >&2
8e07c86e 286
e766ed8d 287NOTE: You are using GNU as(1). GNU as(1) might not build Perl.
bd89102f
AD
288You must arrange to use /usr/ccs/bin/as, perhaps by adding /usr/ccs/bin
289to the beginning of your PATH.
8e07c86e
AD
290
291END
292 ;;
293 esac
294
e766ed8d 295 # See if ld(1) is GNU ld(1). GNU ld(1) might not work for this job.
91d1e749 296 # ld --version doesn't properly report itself as a GNU tool,
297 # as of ld version 2.6, so we need to be more strict. TWP 9/5/96
298 gnu_ld=false
8e07c86e 299 case `ld --version < /dev/null 2>&1` in
91d1e749 300 *GNU*|ld\ version\ 2*)
301 gnu_ld=true ;;
302 *) ;;
303 esac
304 if $gnu_ld ; then :
305 else
bd89102f
AD
306 # Try to guess from path
307 case `type ld | awk '{print $NF}'` in
308 *gnu*|*GNU*|*FSF*)
91d1e749 309 gnu_ld=true ;;
310 esac
311 fi
312 if $gnu_ld ; then
68dc0745 313 cat <<END >&2
8e07c86e 314
e766ed8d
AD
315NOTE: You are apparently using GNU ld(1). GNU ld(1) might not build Perl.
316You should arrange to use /usr/ccs/bin/ld, perhaps by adding /usr/ccs/bin
bd89102f 317to the beginning of your PATH.
8e07c86e
AD
318
319END
91d1e749 320 fi
8e07c86e 321
1acf53c5 322fi
8e07c86e
AD
323
324# as --version or ld --version might dump core.
bd89102f 325rm -f try try.c
8e07c86e
AD
326rm -f core
327
693762b4
AD
328# XXX
329EOSH
330
de6124c8 331cat > UU/usethreads.cbu <<'EOCBU'
104d25b7
JH
332# This script UU/usethreads.cbu will get 'called-back' by Configure
333# after it has prompted the user for whether to use threads.
104d25b7
JH
334case "$usethreads" in
335$define|true|[yY]*)
104d25b7
JH
336 ccflags="-D_REENTRANT $ccflags"
337
7bd161a1
LC
338 # sched_yield is in -lposix4 up to Solaris 2.6, in -lrt starting with Solaris 7
339 case `uname -r` in
340 5.[0-6] | 5.5.1) sched_yield_lib="posix4" ;;
341 *) sched_yield_lib="rt";
342 esac
343 set `echo X "$libswanted "| sed -e "s/ c / $sched_yield_lib pthread c /"`
104d25b7
JH
344 shift
345 libswanted="$*"
346
347 # On Solaris 2.6 x86 there is a bug with sigsetjmp() and siglongjmp()
348 # when linked with the threads library, such that whatever positive
349 # value you pass to siglongjmp(), sigsetjmp() returns 1.
350 # Thanks to Simon Parsons <S.Parsons@ftel.co.uk> for this report.
351 # Sun BugID is 4117946, "sigsetjmp always returns 1 when called by
352 # siglongjmp in a MT program". As of 19980622, there is no patch
353 # available.
354 cat >try.c <<'EOM'
355 /* Test for sig(set|long)jmp bug. */
356 #include <setjmp.h>
357
358 main()
359 {
360 sigjmp_buf env;
361 int ret;
362
363 ret = sigsetjmp(env, 1);
364 if (ret) { return ret == 2; }
365 siglongjmp(env, 2);
366 }
367EOM
7bd161a1 368 if test "`arch`" = i86pc -a `uname -r` = 5.6 && \
104d25b7
JH
369 ${cc:-cc} try.c -lpthread >/dev/null 2>&1 && ./a.out; then
370 d_sigsetjmp=$undef
371 cat << 'EOM' >&2
372
373You will see a *** WHOA THERE!!! *** message from Configure for
374d_sigsetjmp. Keep the recommended value. See hints/solaris_2.sh
375for more information.
376
377EOM
378 fi
379 ;;
123f9af1 380esac
104d25b7
JH
381EOCBU
382
923fc586
JH
383cat > UU/uselargefiles.cbu <<'EOCBU'
384# This script UU/uselargefiles.cbu will get 'called-back' by Configure
5fce3f1f 385# after it has prompted the user for whether to use large files.
bd9b35c9 386case "$uselargefiles" in
10cc9d2a 387''|$define|true|[yY]*)
9422c00b
JH
388
389# Keep these in the left margin.
45c9e83b
JH
390ccflags_uselargefiles="`getconf LFS_CFLAGS 2>/dev/null`"
391ldflags_uselargefiles="`getconf LFS_LDFLAGS 2>/dev/null`"
392libswanted_uselargefiles="`getconf LFS_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`"
9422c00b 393
45c9e83b
JH
394 ccflags="$ccflags $ccflags_uselargefiles"
395 ldflags="$ldflags $ldflags_uselargefiles"
396 libswanted="$libswanted $libswanted_uselargefiles"
6f587e79 397 ;;
bd9b35c9 398esac
5fce3f1f 399EOCBU
6b8eaf93 400
2f4ff158
JH
401# This is truly a mess.
402case "$usemorebits" in
403"$define"|true|[yY]*)
404 use64bitint="$define"
405 uselongdouble="$define"
406 ;;
407esac
408
6e684814 409cat > UU/use64bitall.cbu <<'EOCBU'
c4eb8127
JH
410# This script UU/use64bitall.cbu will get 'called-back' by Configure
411# after it has prompted the user for whether to be maximally 64 bitty.
412case "$use64bitall-$use64bitall_done" in
413"$define-"|true-|[yY]*-)
104d25b7 414 case "`uname -r`" in
6e684814 415 5.[1-6])
104d25b7 416 cat >&4 <<EOM
6e684814
JH
417Solaris `uname -r|sed -e 's/^5\.\([789]\)$/\1/'` does not support 64-bit pointers.
418You should upgrade to at least Solaris 7.
104d25b7
JH
419EOM
420 exit 1
421 ;;
422 esac
282f2f4c
JH
423 libc='/usr/lib/sparcv9/libc.so'
424 if test ! -f $libc; then
9b119d5a 425 cat >&4 <<EOM
282f2f4c
JH
426
427I do not see the 64-bit libc, $libc.
e6f120fa 428(You are either in an old Sparc or in an x86.)
282f2f4c
JH
429Cannot continue, aborting.
430
431EOM
432 exit 1
433 fi
e6f120fa
JH
434
435 if test -f UU/workshoplibpth.cbu; then
436 . ./UU/workshoplibpth.cbu
437 else
438 if test -f workshoplibpth.cbu; then
439 . ./workshoplibpth.cbu
440 fi
441 fi
442
4c07fe1d
JH
443 case "$cc -v 2>/dev/null" in
444 *gcc*)
9b119d5a 445 echo 'main() { return 0; }' > try.c
9636b992
CT
446 case "`${cc:-cc} -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in
447 *"m64 is not supported"*)
9b119d5a
RB
448 cat >&4 <<EOM
449
e6f120fa
JH
450Full 64-bit build is not supported by this gcc configuration.
451Check http://gcc.gnu.org/ for the latest news of availability
452of gcc for 64-bit Sparc.
453
9b119d5a
RB
454Cannot continue, aborting.
455
456EOM
457 exit 1
9636b992
CT
458 ;;
459 esac
9b119d5a
RB
460 ccflags="$ccflags -mcpu=v9 -m64"
461 if test X`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null` != X; then
462 ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
463 fi
464 # no changes to ld flags, as (according to man ld):
465 #
466 # There is no specific option that tells ld to link 64-bit
467 # objects; the class of the first object that gets processed
468 # by ld determines whether it is to perform a 32-bit or a
469 # 64-bit link edit.
4c07fe1d
JH
470 ;;
471 *)
0d926123 472 ccflags="$ccflags `getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
923fc586 473 ldflags="$ldflags `getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
0d926123 474 lddlflags="$lddlflags -G `getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
4c07fe1d
JH
475 ;;
476 esac
5ae8d7b4 477
b1b472cb 478 libscheck='case "`/usr/bin/file $xxx`" in
7b65db70
JH
479*64-bit*|*SPARCV9*) ;;
480*) xxx=/no/64-bit$xxx ;;
481esac'
5ae8d7b4 482
e9a51be3 483 use64bitall_done=yes
6f587e79
JH
484 ;;
485esac
4c07fe1d 486EOCBU
6e684814
JH
487
488# Actually, we want to run this already now, if so requested,
489# because we need to fix up things right now.
490case "$use64bitall" in
491"$define"|true|[yY]*)
631e9f25
JH
492 # Need to be double smart because we can be either here or there.
493 if test -f UU/use64bitall.cbu; then
494 . ./UU/use64bitall.cbu
495 else
496 if test -f use64bitall.cbu; then
497 . ./use64bitall.cbu
498 fi
499 fi
500 ;;
6e684814 501esac
b0ca24c6 502
923fc586
JH
503cat > UU/uselongdouble.cbu <<'EOCBU'
504# This script UU/uselongdouble.cbu will get 'called-back' by Configure
505# after it has prompted the user for whether to use long doubles.
e9a51be3
JH
506case "$uselongdouble-$uselongdouble_done" in
507"$define-"|true-|[yY]*-)
e723fc21
JH
508 case "$ccname" in
509 workshop)
510 libswanted="$libswanted sunmath"
511 loclibpth="$loclibpth /opt/SUNWspro/lib"
512 ;;
513 *) cat >&4 <<EOM
923fc586 514
e723fc21 515The Sun Workshop compiler is not being used; therefore I do not see
39e14749 516the libsunmath; therefore I do not know how to do long doubles, sorry.
8e5bcf6b 517I'm disabling the use of long doubles.
923fc586 518EOM
8e5bcf6b
JH
519 uselongdouble="$undef"
520 ;;
8c38c51e 521 esac
e9a51be3 522 uselongdouble_done=yes
923fc586
JH
523 ;;
524esac
525EOCBU
526
e9a51be3
JH
527# Actually, we want to run this already now, if so requested,
528# because we need to fix up things right now.
529case "$uselongdouble" in
530"$define"|true|[yY]*)
8364ae4d
JH
531 # Need to be double smart because we can be either here or there.
532 if test -f UU/uselongdouble.cbu; then
533 . ./UU/uselongdouble.cbu
534 else
535 if test -f uselongdouble.cbu; then
536 . ./uselongdouble.cbu
537 fi
538 fi
e9a51be3
JH
539 ;;
540esac
541
8c38c51e 542rm -f try.c try.o try