develooper Front page | perl.perl5.build | Postings from November 2003

Call back units

From:
H.Merijn Brand
Date:
November 1, 2003 07:11
Subject:
Call back units
Message ID:
20031101160942.22B3.H.M.BRAND@hccnet.nl
As announced in my plans somewhere back in september 2002, I finally found
time to check and change.

The plan was to make the call-back's safe and call them allways, even if the
option for which the call-back was cretead is unset.

To do so, two criteria should be met:

1. All currently created call-back should have code to check that they will
   only do what they are supposed to do when the option *is* set.
2. Configure should allways call them, but still be safe in how to deal with
   what it currently does.

Both are pure for backward compatibility, and shouldn't alter the current
behaviour, but open up for expansions in the call-back units to do things in
case the option is *not* set.

I was amazed to find that point 1 is already met. This means that the setting
of the variable currently is done twice, once in Configure, and when it's set
end the cbu is called, it's checked again. I expected to have a lot of work in
this area, but I have no work here at all :)

Below are the proposed patches.

a. The patch to hints/README.hints, explaining that the cbu's should take care
   of item 1.
b. The complete patch to Configure, This will have to be broken up to the
   metaunits
c. A small patch to solaris_2.sh, which I think simplifies reading

Remarks most welcome. (Currently unably to *read* mail, because I'm awaiting
ADSL, which is to arrive any day now). Monday I read my mail at work

--- hints/README.hints	2002-09-10 18:58:01.000000000 +0200
+++ hints/README.hints	2003-11-01 15:57:57.000000000 +0100
@@ -303,6 +303,13 @@
 hints/solaris_2.sh of checking to see if uselongdouble is defined is a good
 idea.
 
+=item Call status
+
+Call-backs are only called always, even if the value for the call-back is
+uset: UU/usethreads.cbu is called when Configure is about to deal with
+threads. All created call-backs from hints should thus check the status
+of the variable, and act upon it.
+
 =item Future status
 
 I hope this "call-back" scheme is simple enough to use but powerful
--- Configure	2003-09-18 08:13:46.000000000 +0200
+++ Configure	2003-11-01 15:39:42.000000000 +0100
@@ -3673,22 +3673,22 @@
 eval $setvar
 
 
-case "$usethreads" in
-"$define"|true|[yY]*)
 : Look for a hint-file generated 'call-back-unit'.  If the
 : user has specified that a threading perl is to be built,
 : we may need to set or change some other defaults.
 	if $test -f usethreads.cbu; then
-		echo "Your platform has some specific hints for threaded builds, using them..."
+    echo "Your platform has some specific hints regarding threaded builds, using them..."
 		. ./usethreads.cbu
 	else
+    case "$usethreads" in
+	"$define"|true|[yY]*)
 		$cat <<EOM
-(Your platform doesn't have any specific hints for threaded builds.
+    (Your platform does not have any specific hints for threaded builds.
  Assuming POSIX threads, then.)
 EOM
-	fi
 	;;
 esac
+    fi
 
 cat <<EOM
 
@@ -4546,21 +4546,21 @@
 true|[yY]*) uselongdouble="$define" ;;
 esac
 
-case "$uselongdouble" in
-$define)
 : Look for a hint-file generated 'call-back-unit'.  If the
 : user has specified that long doubles should be used,
 : we may need to set or change some other defaults.
 	if $test -f uselongdouble.cbu; then
-		echo "Your platform has some specific hints for long doubles, using them..."
+    echo "Your platform has some specific hints regarding long doubles, using them..."
 		. ./uselongdouble.cbu
 	else
+    case "$uselongdouble" in
+	$define)
 		$cat <<EOM
-(Your platform doesn't have any specific hints for long doubles.)
+    (Your platform does not have any specific hints for long doubles.)
 EOM
-	fi
 	;;
 esac
+    fi
 
 : Looking for optional libraries
 echo " "
@@ -5447,8 +5447,6 @@
 	;;
 esac
 
-case "$use64bitint" in
-"$define"|true|[yY]*)
 : Look for a hint-file generated 'call-back-unit'.  If the
 : user has specified that a 64-bit perl is to be built,
 : we may need to set or change some other defaults.
@@ -5456,6 +5454,8 @@
 		echo "Your platform has some specific hints for 64-bit integers, using them..."
 		. ./use64bitint.cbu
 	fi
+case "$use64bitint" in
+    "$define"|true|[yY]*)
 	case "$longsize" in
 	4) case "$archname64" in
 	   '') archname64=64int ;;
@@ -5465,15 +5465,15 @@
 	;;
 esac
 
-case "$use64bitall" in
-"$define"|true|[yY]*)
 : Look for a hint-file generated 'call-back-unit'.  If the
 : user has specified that a maximally 64-bit perl is to be built,
 : we may need to set or change some other defaults.
 	if $test -f use64bitall.cbu; then
-		echo "Your platform has some specific hints for 64-bit builds, using them..."
+    echo "Your platform has some specific hints regarding 64-bit builds, using them..."
 		. ./use64bitall.cbu
 	fi
+case "$use64bitall" in
+    "$define"|true|[yY]*)
 	case "$longsize" in
 	4) case "$archname64" in
 	   ''|64int) archname64=64all ;;
@@ -8852,14 +8852,16 @@
 esac
 set uselargefiles
 eval $setvar
-case "$uselargefiles" in
-"$define")
 : Look for a hint-file generated 'call-back-unit'.  If the
 : user has specified that a large files perl is to be built,
 : we may need to set or change some other defaults.
 	if $test -f uselargefiles.cbu; then
-		echo "Your platform has some specific hints for large file builds, using them..."
+    echo "Your platform has some specific hints regarding large file builds, using them..."
 		. ./uselargefiles.cbu
+    fi
+case "$uselargefiles" in
+    "$define")
+	if $test -f uselargefiles.cbu; then
 		echo " "
 		echo "Rechecking to see how big your file offsets are..." >&4
 		$cat >try.c <<EOCP
--- hints/solaris_2.sh	2003-10-27 18:28:33.000000000 +0100
+++ hints/solaris_2.sh	2003-11-01 15:21:43.000000000 +0100
@@ -448,15 +448,12 @@
 		exit 1
 		;;
 	    esac
-	    ;;
-esac
+
 # gcc-2.8.1 on Solaris 8 with -Duse64bitint fails op/pat.t test 822
 # if we compile regexec.c with -O.  Turn off optimization for that one
 # file.  See hints/README.hints , especially 
 # =head2 Propagating variables to config.sh, method 3.
 #  A. Dougherty  May 24, 2002
-case "$use64bitint" in
-"$define")
     case "${gccversion}-${optimize}" in
     2.8*-O*)
 	# Honor a command-line override (rather unlikely)
End-of-patch

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
  WinNT 4, Win2K pro & WinCE 2.11.  Smoking perl CORE: smokers@perl.org
http://archives.develooper.com/daily-build@perl.org/   perl-qa@perl.org
send smoke reports to: smokers-reports@perl.org, QA: http://qa.perl.org



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About