This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update podlators to CPAN version 4.10
[perl5.git] / hints / solaris_2.sh
1 # hints/solaris_2.sh
2 # Contributions by (in alphabetical order) Alan Burlison, Andy Dougherty,
3 # Dean Roehrich, Jarkko Hietaniemi, Lupe Christoph, Richard Soderberg and
4 # many others.
5 #
6 # See README.solaris for additional information.
7 #
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
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
16 #
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.
22
23 # Solaris has secure SUID scripts
24 d_suidsafe=${d_suidsafe:-define}
25
26 # Be paranoid about nm failing to find symbols
27 mistrustnm=${mistrustnm:-run}
28
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}
34
35 # malloc wrap works
36 case "$usemallocwrap" in
37 '') usemallocwrap='define' ;;
38 esac
39
40 # Avoid all libraries in /usr/ucblib.
41 # /lib is just a symlink to /usr/lib
42 set `echo $glibpth | sed -e 's@/usr/ucblib@@' -e 's@ /lib @ @'`
43 glibpth="$*"
44
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
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.
49 #  XXX Revisit after perl 5.10 -- should we apply this to older Solaris
50 # versions too?  (A.D. 11/2007).
51 case "`$run uname -r`" in
52 5.[0-9]) ;;
53 *) ignore_versioned_solibs=y ;;
54 esac
55
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.
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>
63 set `echo " $libswanted " | sed -e 's@ ld @ @' -e 's@ malloc @ @' -e 's@ ucb @ @' -e 's@ sec @ @' -e 's@ crypt @ @'`
64 libswanted="$*"
65
66 # Look for architecture name.  We want to suggest a useful default.
67 case "$archname" in
68 '')
69     if test -f /usr/bin/arch; then
70         archname=`/usr/bin/arch`
71         archname="${archname}-${osname}"
72     elif test -f /usr/ucb/arch; then
73         archname=`/usr/ucb/arch`
74         archname="${archname}-${osname}"
75     fi
76     ;;
77 esac
78
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 `
91
92 case "$cc" in
93 '')    for i in `ls -r /opt/sol*studio*/bin/cc` /opt/SUNWspro/bin/cc
94        do
95                if test -f "$i"; then
96                        cc=$i
97                        cat <<EOF >&4
98
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,
102 e.g. Configure -Dcc=gcc
103
104 EOF
105                         break
106                 fi
107         done
108         ;;
109 esac
110
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 #
120 # Here's another draft of the perl5/solaris/gcc sanity-checker.
121
122 case `type ${cc:-cc}` in
123 */usr/ucb/cc*) cat <<END >&4
124
125 NOTE:  Some people have reported problems with /usr/ucb/cc.
126 If you have difficulties, please make sure the directory
127 containing your C compiler is before /usr/ucb in your PATH.
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.
136 $run mount | grep '^/dev/fd ' 2>&1 > /dev/null
137 case $? in
138 0) ;;
139 *)
140         cat <<END >&4
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.
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
164 0)
165         cat <<END >&4
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
170 END
171 ;;
172 esac
173
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)
180 #       cc is /usr/ucb/cc
181 #       foo not found
182 # use a command like type make | awk '{print $NF}' | sed 's/[()]//g'
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
188     tmp=`type make | awk '{print $NF}' | sed 's/[()]//g'`
189     case "`${ls:-'/usr/bin/ls'} -lL $tmp`" in
190     ??????s*)
191             cat <<END >&2
192
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
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
208 # If the C compiler is gcc:
209 #   - check the fixed-includes
210 #   - check as(1) and ld(1), they should not be GNU
211 #       (GNU as and ld 2.8.1 and later are reportedly ok, however.)
212 # If the C compiler is not gcc:
213 #   - Check if it is the Workshop/Forte compiler.
214 #     If it is, prepare for 64 bit and long doubles.
215 #   - check as(1) and ld(1), they should not be GNU
216 #       (GNU as and ld 2.8.1 and later are reportedly ok, however.)
217 #
218 # Watch out in case they have not set $cc.
219
220 # Perl compiled with some combinations of GNU as and ld may not
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
224 #       sh Configure -Dcc='gcc -B/usr/ccs/bin/'
225 # (note the trailing slash is required).
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
230 #       --Andy Dougherty  <doughera@lafayette.edu>
231 #       Tue Apr 13 17:19:43 EDT 1999
232
233 # Get gcc to share its secrets.
234 echo 'int main() { return 0; }' > try.c
235         # Indent to avoid propagation to config.sh
236         verbose=`${cc:-cc} $ccflags -v -o try try.c 2>&1`
237
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
242         #
243         # Using gcc.
244         #
245         cc_name='gcc'
246
247         # See if as(1) is GNU as(1).  GNU as(1) might not work for this job.
248         if echo "$verbose" | grep ' /usr/ccs/bin/as ' >/dev/null 2>&1; then
249             :
250         else
251             cat <<END >&2
252
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/
255 in your ${cc:-cc} command.  (Note that the trailing "/" is required.)
256
257 END
258             # Apparently not needed, at least for as 2.7 and later.
259             # cc="${cc:-cc} $ccflags -B/usr/ccs/bin/"
260         fi
261
262         # See if ld(1) is GNU ld(1).  GNU ld(1) might not work for this job.
263         # Recompute $verbose since we may have just changed $cc.
264         verbose=`${cc:-cc} $ccflags -v -o try try.c 2>&1 | grep ld 2>&1`
265
266         if echo "$verbose" | grep ' /usr/ccs/bin/ld ' >/dev/null 2>&1; then
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.
273             # Most Solaris versions of ld I've seen contain the magic
274             # string used in the grep.
275             :
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             :
280         else
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.)
285
286             # Recompute verbose with -Wl,-v to find GNU ld if present
287             verbose=`${cc:-cc} $ccflags -Wl,-v -o try try.c 2>&1 | grep /ld 2>&1`
288
289             myld=`echo $verbose | awk '/\/ld/ {print $1}'`
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.
292             # Thus myld is something like /opt/gnu/sparc-sun-solaris2.5/bin/ld
293
294             # Allow that $myld may be '', due to changes in gcc's output
295             if ${myld:-ld} -V 2>&1 |
296                 grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
297                 # Ok, /usr/ccs/bin/ld eventually does get called.
298                 :
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                 :
303             else
304                 echo "Found GNU ld='$myld'" >&4
305                 cat <<END >&2
306
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/
309 in your ${cc:-cc} command.  (Note that the trailing "/" is required.)
310
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
314 END
315                 ccdlflags="$ccdlflags -Wl,-E"
316                 lddlflags="$lddlflags -Wl,-E -shared"
317             fi
318         fi
319
320 else
321         #
322         # Not using gcc.
323         #
324         cat > try.c << 'EOM'
325 #include <stdio.h>
326 int main() {
327 #if defined(__SUNPRO_C)
328         printf("workshop\n");
329 #else
330 #if defined(__SUNPRO_CC)
331         printf("workshop CC\n");
332 #else
333         printf("\n");
334 #endif
335 #endif
336 return(0);
337 }
338 EOM
339         tryworkshopcc="${cc:-cc} $ccflags try.c -o try"
340         if $tryworkshopcc >/dev/null 2>&1; then
341                 cc_name=`$run ./try`
342                 if test "$cc_name" = "workshop"; then
343                         ccversion="`${cc:-cc} -V 2>&1|sed -n -e '1s/^[Cc][Cc9]9*: //p'`"
344                 fi
345                 if test "$cc_name" = "workshop CC"; then
346                         ccversion="`${cc:-CC} -V 2>&1|sed -n -e '1s/^[Cc][C]: //p'`"
347                 fi
348                 case "$cc_name" in
349                 workshop*)
350                         # Settings for either cc or CC
351                         if test ! "$use64bitall_done"; then
352                                 loclibpth="/usr/lib /usr/ccs/lib `$getworkshoplibs` $loclibpth"
353                         fi
354                         # Sun CC/cc don't support gcc attributes
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'
362                         case "$cc" in
363                         *c99)   # c99 rejects bare '-O'.
364                                 case "$optimize" in
365                                 ''|-O) optimize=-O3 ;;
366                                 esac
367                                 # Without -Xa c99 doesn't see
368                                 # many OS interfaces.
369                                 case "$ccflags" in
370                                 *-Xa*)  ;;
371                                 *) ccflags="$ccflags -Xa" ;;
372                                 esac
373                                 ;;
374                         esac
375                         ;;
376                 esac
377         fi
378
379         # See if as(1) is GNU as(1).  GNU might not work for this job.
380         case `as --version < /dev/null 2>&1` in
381         *GNU*)
382                 cat <<END >&2
383
384 NOTE: You are using GNU as(1).  GNU as(1) might not build Perl.
385 You must arrange to use /usr/ccs/bin/as, perhaps by adding /usr/ccs/bin
386 to the beginning of your PATH.
387
388 END
389                 ;;
390         esac
391
392         # See if ld(1) is GNU ld(1).  GNU ld(1) might not work for this job.
393         # ld --version doesn't properly report itself as a GNU tool,
394         # as of ld version 2.6, so we need to be more strict. TWP 9/5/96
395         # Sun's ld always emits the "Software Generation Utilities" string.
396         if ld -V 2>&1 | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
397             # Ok, ld is /usr/ccs/bin/ld.
398             :
399         else
400             cat <<END >&2
401
402 NOTE: You are apparently using GNU ld(1).  GNU ld(1) might not build Perl.
403 You should arrange to use /usr/ccs/bin/ld, perhaps by adding /usr/ccs/bin
404 to the beginning of your PATH.
405
406 END
407         fi
408 fi
409
410 # as --version or ld --version might dump core.
411 rm -f try try.c core
412 EOCBU
413
414 cat > UU/usethreads.cbu <<'EOCBU'
415 # This script UU/usethreads.cbu will get 'called-back' by Configure
416 # after it has prompted the user for whether to use threads.
417 case "$usethreads" in
418 $define|true|[yY]*)
419         ccflags="-D_REENTRANT $ccflags"
420
421         # -lpthread overrides some lib C functions, so put it before c.
422         set `echo X "$libswanted "| sed -e "s/ c / pthread c /"`
423         shift
424         libswanted="$*"
425
426         # sched_yield is available in the -lrt library.  However,
427         # we can also pick up the equivalent yield() function in the
428         # normal C library.  To avoid pulling in unnecessary
429         # libraries, we'll normally avoid sched_yield()/-lrt and
430         # just use yield().  However, we'll honor a command-line
431         # override : "-Dsched_yield=sched_yield".
432         # If we end up using sched_yield, we're going to need -lrt.
433         sched_yield=${sched_yield:-yield}
434         if test "$sched_yield" = "sched_yield"; then
435             set `echo X "$libswanted "| sed -e "s/ pthread / rt pthread /"`
436             shift
437             libswanted="$*"
438         fi
439
440         # On Solaris 2.6 x86 there is a bug with sigsetjmp() and siglongjmp()
441         # when linked with the threads library, such that whatever positive
442         # value you pass to siglongjmp(), sigsetjmp() returns 1.
443         # Thanks to Simon Parsons <S.Parsons@ftel.co.uk> for this report.
444         # Sun BugID is 4117946, "sigsetjmp always returns 1 when called by
445         # siglongjmp in a MT program". As of 19980622, there is no patch
446         # available.
447         cat >try.c <<'EOM'
448         /* Test for sig(set|long)jmp bug. */
449         #include <setjmp.h>
450
451         int main()
452         {
453             sigjmp_buf env;
454             int ret;
455
456             ret = sigsetjmp(env, 1);
457             if (ret) { return ret == 2; }
458             siglongjmp(env, 2);
459         }
460 EOM
461         if test "`arch`" = i86pc -a `uname -r` = 5.6 && \
462            ${cc:-cc} try.c -lpthread >/dev/null 2>&1 && ./a.out; then
463             d_sigsetjmp=$undef
464         fi
465
466         # These prototypes should be visible since we using
467         # -D_REENTRANT, but that does not seem to work.
468         # It does seem to work for getnetbyaddr_r, weirdly enough,
469         # and other _r functions. (Solaris 8)
470
471         d_ctermid_r_proto="$define"
472         d_gethostbyaddr_r_proto="$define"
473         d_gethostbyname_r_proto="$define"
474         d_getnetbyname_r_proto="$define"
475         d_getprotobyname_r_proto="$define"
476         d_getprotobynumber_r_proto="$define"
477         d_getservbyname_r_proto="$define"
478         d_getservbyport_r_proto="$define"
479
480         # Ditto. (Solaris 7)
481         d_readdir_r_proto="$define"
482         d_readdir64_r_proto="$define"
483         d_tmpnam_r_proto="$define"
484         d_ttyname_r_proto="$define"
485
486         ;;
487 esac
488 EOCBU
489
490 cat > UU/uselargefiles.cbu <<'EOCBU'
491 # This script UU/uselargefiles.cbu will get 'called-back' by Configure
492 # after it has prompted the user for whether to use large files.
493 case "$uselargefiles" in
494 ''|$define|true|[yY]*)
495
496 # Keep these in the left margin.
497 ccflags_uselargefiles="`$run getconf LFS_CFLAGS 2>/dev/null`"
498 ldflags_uselargefiles="`$run getconf LFS_LDFLAGS 2>/dev/null`"
499 libswanted_uselargefiles="`$run getconf LFS_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g'`"
500
501     ccflags="$ccflags $ccflags_uselargefiles"
502     ldflags="$ldflags $ldflags_uselargefiles"
503     libswanted="$libswanted $libswanted_uselargefiles"
504     ;;
505 esac
506 EOCBU
507
508 # This is truly a mess.
509 case "$usemorebits" in
510 "$define"|true|[yY]*)
511         use64bitint="$define"
512         uselongdouble="$define"
513         ;;
514 esac
515
516 if test `$run uname -p` = i386; then
517     case "$use64bitint" in
518     "$define"|true|[yY]*)
519             ccflags="$ccflags -DPTR_IS_LONG"
520             ;;
521     esac
522 fi
523
524 if test `$run uname -p` = sparc -o `$run uname -p` = i386; then
525     cat > UU/use64bitint.cbu <<'EOCBU'
526 # This script UU/use64bitint.cbu will get 'called-back' by Configure
527 # after it has prompted the user for whether to use 64 bit integers.
528 case "$use64bitint" in
529 "$define"|true|[yY]*)
530             case "`$run uname -r`" in
531             5.[0-4])
532                 cat >&4 <<EOM
533 Solaris `uname -r|sed -e 's/^5\./2./'` does not support 64-bit integers.
534 You should upgrade to at least Solaris 2.5.
535 EOM
536                 exit 1
537                 ;;
538             esac
539
540 # gcc-2.8.1 on Solaris 8 with -Duse64bitint fails op/pat.t test 822
541 # if we compile regexec.c with -O.  Turn off optimization for that one
542 # file.  See hints/README.hints , especially
543 # =head2 Propagating variables to config.sh, method 3.
544 #  A. Dougherty  May 24, 2002
545     case "${gccversion}-${optimize}" in
546     2.8*-O*)
547         # Honor a command-line override (rather unlikely)
548         case "$regexec_cflags" in
549         '') echo "Disabling optimization on regexec.c for gcc $gccversion" >&4
550             regexec_cflags='optimize='
551             echo "regexec_cflags='optimize=\"\"'" >> config.sh
552             ;;
553         esac
554         ;;
555     esac
556     ;;
557 esac
558 EOCBU
559
560     cat > UU/use64bitall.cbu <<'EOCBU'
561 # This script UU/use64bitall.cbu will get 'called-back' by Configure
562 # after it has prompted the user for whether to be maximally 64 bitty.
563 case "$use64bitall-$use64bitall_done" in
564 "$define-"|true-|[yY]*-)
565             case "`$run uname -r`" in
566             5.[0-6])
567                 cat >&4 <<EOM
568 Solaris `uname -r|sed -e 's/^5\./2./'` does not support 64-bit pointers.
569 You should upgrade to at least Solaris 2.7.
570 EOM
571                 exit 1
572                 ;;
573             esac
574             processor=`$run uname -p`;
575             if test "$processor" = sparc; then
576                 libc='/usr/lib/sparcv9/libc.so'
577                 if test ! -f $libc; then
578                     cat >&4 <<EOM
579
580 I do not see the 64-bit libc, $libc.
581 Cannot continue, aborting.
582
583 EOM
584                     exit 1
585                 fi
586             fi
587             case "${cc:-cc} -v 2>/dev/null" in
588             *gcc*)
589                 echo 'int main() { return 0; }' > try.c
590                 case "`${cc:-cc} $ccflags -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in
591                 *"m64 is not supported"*)
592                     cat >&4 <<EOM
593
594 Full 64-bit build is not supported by this gcc configuration.
595 Check http://gcc.gnu.org/ for the latest news of availability
596 of gcc for 64-bit Sparc.
597
598 Cannot continue, aborting.
599
600 EOM
601                     exit 1
602                     ;;
603                 esac
604                 if test "$processor" = sparc; then
605                     loclibpth="/usr/lib/sparcv9 $loclibpth"
606                     ccflags="$ccflags -mcpu=v9"
607                 fi
608                 ccflags="$ccflags -m64"
609
610                 # This adds in -Wa,-xarch=v9.  I suspect that's superfluous,
611                 # since the -m64 above should do that already.  Someone
612                 # with gcc-3.x.x, please test with gcc -v.   A.D. 20-Nov-2003
613 #               if test $processor = sparc -a X`$run getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null` != X; then
614 #                   ccflags="$ccflags -Wa,`$run getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
615 #               fi
616                 ldflags="$ldflags -m64"
617
618                 # See [perl #66604]:  On Solaris 11, gcc -m64 on amd64
619                 # appears not to understand -G.  (gcc -G has not caused
620                 # problems on other platforms in the past.)  gcc versions
621                 # at least as old as 3.4.3 support -shared, so just
622                 # use that with Solaris 11 and later, but keep
623                 # the old behavior for older Solaris versions.
624                 case "$osvers" in
625                         2.?|2.10) lddlflags="$lddlflags -G -m64" ;;
626                         *) lddlflags="$lddlflags -shared -m64" ;;
627                 esac
628                 ;;
629             *)
630                 getconfccflags="`$run getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
631                 getconfldflags="`$run getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
632                 getconflddlflags="`$run getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
633                 echo "int main() { return(0); } " > try.c
634                 case "`${cc:-cc} $getconfccflags try.c 2>&1 | grep 'deprecated'`" in
635                 *" -xarch=generic64 is deprecated, use -m64 "*)
636                     getconfccflags=`echo $getconfccflags | sed -e 's/xarch=generic64/m64/'`
637                     getconfldflags=`echo $getconfldflags | sed -e 's/xarch=generic64/m64/'`
638                     getconflddlflags=`echo $getconflddlflags | sed -e 's/xarch=generic64/m64/'`
639                     ;;
640                 esac
641                 ccflags="$ccflags $getconfccflags"
642                 ldflags="$ldflags $getconfldflags"
643                 lddlflags="$lddlflags -G $getconflddlflags"
644
645                 echo "int main() { return(0); } " > try.c
646                 tryworkshopcc="${cc:-cc} try.c -o try $ccflags"
647                 if test "$processor" = sparc; then
648                     loclibpth="/usr/lib/sparcv9 /usr/ccs/lib/sparcv9 $loclibpth"
649                 fi
650                 loclibpth="`$getworkshoplibs` $loclibpth"
651                 ;;
652             esac
653             unset processor
654             use64bitall_done=yes
655             archname64=64
656             ;;
657 esac
658 EOCBU
659
660     # Actually, we want to run this already now, if so requested,
661     # because we need to fix up things right now.
662     case "$use64bitall" in
663     "$define"|true|[yY]*)
664         # CBUs expect to be run in UU
665         cd UU; . ./use64bitall.cbu; cd ..
666         ;;
667     esac
668 fi
669
670 cat > UU/uselongdouble.cbu <<'EOCBU'
671 # This script UU/uselongdouble.cbu will get 'called-back' by Configure
672 # after it has prompted the user for whether to use long doubles.
673 case "$uselongdouble" in
674 "$define"|true|[yY]*)
675         if test "$cc_name" = "workshop"; then
676                 cat > try.c << 'EOM'
677 #include <sunmath.h>
678 int main() { (void) powl(2, 256); return(0); }
679 EOM
680                 if ${cc:-cc} try.c -lsunmath -o try > /dev/null 2>&1 && ./try; then
681                         libswanted="$libswanted sunmath"
682                 fi
683         else
684                 cat >&4 <<EOM
685
686 The Sun Workshop math library is either not available or not working,
687 so I do not know how to do long doubles, sorry.
688 I'm therefore disabling the use of long doubles.
689 EOM
690                 uselongdouble="$undef"
691         fi
692         ;;
693 esac
694 EOCBU
695
696 #
697 # If unsetenv is available, use it in conjunction with PERL_USE_SAFE_PUTENV to
698 # work around Sun bugid 6333830.  Both unsetenv and 6333830 only appear in
699 # Solaris 10, so we don't need to probe explicitly for an OS version.  We have
700 # to append this test to the end of config.over as it needs to run after
701 # Configure has probed for unsetenv, and this hints file is processed before
702 # that has happened.
703 #
704 cat >> config.over <<'EOOVER'
705 if test "$d_unsetenv" = "$define" -a \
706     `expr "$ccflags" : '.*-DPERL_USE_SAFE_PUTENV'` -eq 0; then
707         ccflags="$ccflags -DPERL_USE_SAFE_PUTENV"
708 fi
709 EOOVER
710
711 rm -f try.c try.o try a.out
712
713 # If using C++, the Configure scan for dlopen() will fail in Solaris
714 # because one of the two (1) an extern "C" linkage definition is needed
715 # (2) #include <dlfcn.h> is needed, *and* a cast to (void*(*)())
716 # is needed for the &dlopen.  Adding any of these would require changing
717 # a delicate spot in Configure, so easier just to force our guess here
718 # for Solaris.  Much the same goes for dlerror().
719 case "$cc" in
720 *g++*|*CC*)
721   d_dlopen='define'
722   d_dlerror='define'
723   ;;
724 esac
725
726 # Oracle/Sun builds their Perl shared since 5.6.1, and they also
727 # strongly recommend using shared libraries in general.
728 #
729 # Furthermore, OpenIndiana seems to effectively require building perl
730 # shared, or otherwise perl scripts won't even find the Perl library.
731 useshrplib='true'