2 # Last modified: Thu Nov 9 14:21:02 EST 2000
3 # Andy Dougherty <doughera@lafayette.edu>
4 # Based on input from lots of folks, especially
5 # Dean Roehrich <roehrich@ironwood-fddi.cray.com>
7 # See README.solaris for additional information.
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
13 # sh Configure -Dcc='gcc -B/usr/ccs/bin/'
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.
24 # Avoid all libraries in /usr/ucblib.
25 set `echo $glibpth | sed -e 's@/usr/ucblib@@'`
28 # Remove bad libraries. -lucb contains incompatible routines.
29 # -lld doesn't do anything useful.
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>
34 set `echo " $libswanted " | sed -e 's@ ld @ @' -e 's@ malloc @ @' -e 's@ ucb @ @'`
37 # Look for architecture name. We want to suggest a useful default.
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}"
52 ccversion="`$cc -V 2>&1|head -1|sed 's/^cc: //'`"
54 *WorkShop*) ccname=workshop ;;
58 cat >UU/workshoplibpth.cbu<<'EOCBU'
59 case "$workshoplibpth_done" in
60 '') case "$use64bitall" in
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"
72 *) loclibpth="$loclibpth $workshoplibs"
75 workshoplibpth_done="$define"
84 int main() { return(0); }
86 workshoplibs=`cc -### try.c -lsunmath -o try 2>&1|grep " -Y "|sed 's%.* -Y "P,\(.*\)".*%\1%'|tr ':' '\n'|grep '/SUNWspro/'`
87 . ./UU/workshoplibpth.cbu
91 ######################################################
92 # General sanity testing. See below for excerpts from the Solaris FAQ.
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
100 # Here's another draft of the perl5/solaris/gcc sanity-checker.
102 case `type ${cc:-cc}` in
103 */usr/ucb/cc*) cat <<END >&4
105 NOTE: Some people have reported problems with /usr/ucb/cc.
106 If you have difficulties, please make sure the directory
107 containing your C compiler is before /usr/ucb in your PATH.
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
122 NOTE: Your system does not have /dev/fd mounted. If you want to
123 be able to use set-uid scripts you must ask your system administrator
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
138 NOTE: libucb has been found in /usr/lib. libucb should reside in
139 /usr/ucblib. You may have trouble while building Perl extensions.
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)
153 # use a command like type make | awk '{print $NF}' | sed 's/[()]//g'
155 # See if make(1) is GNU make(1).
156 # If it is, make sure the setgid bit is not set.
157 make -v > make.vers 2>&1
158 if grep GNU make.vers > /dev/null 2>&1; then
159 tmp=`type make | awk '{print $NF}' | sed 's/[()]//g'`
160 case "`/usr/bin/ls -lL $tmp`" in
164 NOTE: Your PATH points to GNU make, and your GNU make has the set-group-id
165 bit set. You must either rearrange your PATH to put /usr/ccs/bin before the
166 GNU utilities or you must ask your system administrator to disable the
167 set-group-id bit on GNU make.
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.
178 cat > UU/cc.cbu <<'EOSH'
179 # If the C compiler is gcc:
180 # - check the fixed-includes
181 # - check as(1) and ld(1), they should not be GNU
182 # (GNU as and ld 2.8.1 and later are reportedly ok, however.)
183 # If the C compiler is not gcc:
184 # - check as(1) and ld(1), they should not be GNU
185 # (GNU as and ld 2.8.1 and later are reportedly ok, however.)
187 # Watch out in case they have not set $cc.
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:
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
202 # Get gcc to share its secrets.
203 echo 'main() { return 0; }' > try.c
204 # Indent to avoid propagation to config.sh
205 verbose=`${cc:-cc} -v -o try try.c 2>&1`
207 if echo "$verbose" | grep '^Reading specs from' >/dev/null 2>&1; then
212 tmp=`echo "$verbose" | grep '^Reading' |
213 awk '{print $NF}' | sed 's/specs$/include/'`
215 # Determine if the fixed-includes look like they'll work.
216 # Doesn't work anymore for gcc-2.7.2.
218 # See if as(1) is GNU as(1). GNU as(1) might not work for this job.
219 if echo "$verbose" | grep ' /usr/ccs/bin/as ' >/dev/null 2>&1; then
224 NOTE: You are using GNU as(1). GNU as(1) might not build Perl. If you
225 have trouble, you can use /usr/ccs/bin/as by including -B/usr/ccs/bin/
226 in your ${cc:-cc} command. (Note that the trailing "/" is required.)
229 # Apparently not needed, at least for as 2.7 and later.
230 # cc="${cc:-cc} -B/usr/ccs/bin/"
233 # See if ld(1) is GNU ld(1). GNU ld(1) might not work for this job.
234 # Recompute $verbose since we may have just changed $cc.
235 verbose=`${cc:-cc} -v -o try try.c 2>&1 | grep ld 2>&1`
237 if echo "$verbose" | grep ' /usr/ccs/bin/ld ' >/dev/null 2>&1; then
238 # Ok, gcc directly calls the Solaris /usr/ccs/bin/ld.
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
244 # All Solaris versions of ld I've seen contain the magic
245 # string used in the grep.
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.)
253 myld=`echo $verbose| grep ld | awk '/\/ld/ {print $1}'`
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
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.
264 NOTE: You are using GNU ld(1). GNU ld(1) might not build Perl. If you
265 have trouble, you can use /usr/ccs/bin/ld by including -B/usr/ccs/bin/
266 in your ${cc:-cc} command. (Note that the trailing "/" is required.)
268 I will try to use GNU ld by passing in the -Wl,-E flag, but if that
269 doesn't work, you should use -B/usr/ccs/bin/ instead.
272 ccdlflags="$ccdlflags -Wl,-E"
273 lddlflags="$lddlflags -W,l-E -G"
282 # See if as(1) is GNU as(1). GNU might not work for this job.
283 case `as --version < /dev/null 2>&1` in
287 NOTE: You are using GNU as(1). GNU as(1) might not build Perl.
288 You must arrange to use /usr/ccs/bin/as, perhaps by adding /usr/ccs/bin
289 to the beginning of your PATH.
295 # See if ld(1) is GNU ld(1). GNU ld(1) might not work for this job.
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
299 case `ld --version < /dev/null 2>&1` in
300 *GNU*|ld\ version\ 2*)
306 # Try to guess from path
307 case `type ld | awk '{print $NF}'` in
315 NOTE: You are apparently using GNU ld(1). GNU ld(1) might not build Perl.
316 You should arrange to use /usr/ccs/bin/ld, perhaps by adding /usr/ccs/bin
317 to the beginning of your PATH.
324 # as --version or ld --version might dump core.
331 cat > UU/usethreads.cbu <<'EOCBU'
332 # This script UU/usethreads.cbu will get 'called-back' by Configure
333 # after it has prompted the user for whether to use threads.
334 case "$usethreads" in
336 ccflags="-D_REENTRANT $ccflags"
338 # sched_yield is in -lposix4 up to Solaris 2.6, in -lrt starting with Solaris 7
340 5.[0-6] | 5.5.1) sched_yield_lib="posix4" ;;
341 *) sched_yield_lib="rt";
343 set `echo X "$libswanted "| sed -e "s/ c / $sched_yield_lib pthread c /"`
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
355 /* Test for sig(set|long)jmp bug. */
363 ret = sigsetjmp(env, 1);
364 if (ret) { return ret == 2; }
368 if test "`arch`" = i86pc -a `uname -r` = 5.6 && \
369 ${cc:-cc} try.c -lpthread >/dev/null 2>&1 && ./a.out; then
373 You will see a *** WHOA THERE!!! *** message from Configure for
374 d_sigsetjmp. Keep the recommended value. See hints/solaris_2.sh
375 for more information.
383 cat > UU/uselargefiles.cbu <<'EOCBU'
384 # This script UU/uselargefiles.cbu will get 'called-back' by Configure
385 # after it has prompted the user for whether to use large files.
386 case "$uselargefiles" in
387 ''|$define|true|[yY]*)
389 # Keep these in the left margin.
390 ccflags_uselargefiles="`getconf LFS_CFLAGS 2>/dev/null`"
391 ldflags_uselargefiles="`getconf LFS_LDFLAGS 2>/dev/null`"
392 libswanted_uselargefiles="`getconf LFS_LIBS 2>/dev/null|sed -e 's@^-l@@' -e 's@ -l@ @g`"
394 ccflags="$ccflags $ccflags_uselargefiles"
395 ldflags="$ldflags $ldflags_uselargefiles"
396 libswanted="$libswanted $libswanted_uselargefiles"
401 # This is truly a mess.
402 case "$usemorebits" in
403 "$define"|true|[yY]*)
404 use64bitint="$define"
405 uselongdouble="$define"
409 cat > UU/use64bitall.cbu <<'EOCBU'
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.
412 case "$use64bitall-$use64bitall_done" in
413 "$define-"|true-|[yY]*-)
417 Solaris `uname -r|sed -e 's/^5\.\([789]\)$/\1/'` does not support 64-bit pointers.
418 You should upgrade to at least Solaris 7.
423 libc='/usr/lib/sparcv9/libc.so'
424 if test ! -f $libc; then
427 I do not see the 64-bit libc, $libc.
428 (You are either in an old sparc or in an x86.)
429 Cannot continue, aborting.
434 . ./UU/workshoplibpth.cbu
435 case "$cc -v 2>/dev/null" in
437 echo 'main() { return 0; }' > try.c
438 case "`${cc:-cc} -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in
439 *"m64 is not supported"*)
442 Full 64-bit build not supported by this gcc configuration.
443 Cannot continue, aborting.
449 ccflags="$ccflags -mcpu=v9 -m64"
450 if test X`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null` != X; then
451 ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
453 # no changes to ld flags, as (according to man ld):
455 # There is no specific option that tells ld to link 64-bit
456 # objects; the class of the first object that gets processed
457 # by ld determines whether it is to perform a 32-bit or a
461 ccflags="$ccflags `getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
462 ldflags="$ldflags `getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
463 lddlflags="$lddlflags -G `getconf XBS5_LP64_OFF64_LDFLAGS 2>/dev/null`"
466 libscheck='case "`/usr/bin/file $xxx`" in
467 *64-bit*|*SPARCV9*) ;;
468 *) xxx=/no/64-bit$xxx ;;
475 # Actually, we want to run this already now, if so requested,
476 # because we need to fix up things right now.
477 case "$use64bitall" in
478 "$define"|true|[yY]*)
479 # Need to be double smart because we can be either here or there.
480 if test -f UU/use64bitall.cbu; then
481 . ./UU/use64bitall.cbu
483 if test -f use64bitall.cbu; then
491 cat > UU/uselongdouble.cbu <<'EOCBU'
492 # This script UU/uselongdouble.cbu will get 'called-back' by Configure
493 # after it has prompted the user for whether to use long doubles.
494 case "$uselongdouble-$uselongdouble_done" in
495 "$define-"|true-|[yY]*-)
498 libswanted="$libswanted sunmath"
499 loclibpth="$loclibpth /opt/SUNWspro/lib"
503 The Sun Workshop compiler is not being used; therefore I do not see
504 the libsunmath; therefore I do not know how to do long doubles, sorry.
505 I'm disabling the use of long doubles.
507 uselongdouble="$undef"
510 uselongdouble_done=yes
515 # Actually, we want to run this already now, if so requested,
516 # because we need to fix up things right now.
517 case "$uselongdouble" in
518 "$define"|true|[yY]*)
519 # Need to be double smart because we can be either here or there.
520 if test -f UU/uselongdouble.cbu; then
521 . ./UU/uselongdouble.cbu
523 if test -f uselongdouble.cbu; then
524 . ./uselongdouble.cbu
530 rm -f try.c try.o try