This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backporting work on AmigaOS
[metaconfig.git] / U / perl / patchlevel.U
index ae7aac1..b172ac6 100644 (file)
@@ -16,7 +16,8 @@
 ?RCS: Revision 3.0  1993/08/18  12:09:31  ram
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
-?MAKE:patchlevel revision version subversion perl_patchlevel \
+?MAKE:patchlevel revision version subversion \
+       perl_patchlevel version_patchlevel_string \
        api_revision api_version api_subversion api_versionstring: \
        package test rsrc echo awk osname
 ?MAKE: -pick add $@ %<
 ?S:    the maintenance versus development dichotomy except
 ?S:    by also being increasing.
 ?S:.
-
+?S:version_patchlevel_string:
+?S:    This is a string combining version, subversion and
+?S:    perl_patchlevel (if perl_patchlevel is non-zero).
+?S:    It is typically something like
+?S:    'version 7 subversion 1'  or
+?S:    'version 7 subversion 1 patchlevel 11224'
+?S:    It is computed here to avoid duplication of code in myconfig.SH
+?S:    and lib/Config.pm.
+?S:.
 ?LINT:extern LC_ALL
-?LINT:change LC_ALL
 ?LINT:extern LANGUAGE
-?LINT:change LANGUAGE
 : get the patchlevel
 echo " "
 echo "Getting the current patchlevel..." >&4
@@ -114,7 +121,7 @@ if $test -r $rsrc/patchlevel.h;then
        api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
        api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
        api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+       perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
 else
        revision=0
        patchlevel=0
@@ -125,29 +132,30 @@ else
        perl_patchlevel=0
        $echo "(You do not have patchlevel.h.  Eek.)"
 fi
-if $test -r $rsrc/.patch ; then  
-       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
-               perl_patchlevel=`cat $rsrc/.patch`
-       fi
-fi
+: Define a handy string here to avoid duplication in myconfig.SH and configpm.
+version_patchlevel_string="version $patchlevel subversion $subversion"
 case "$perl_patchlevel" in
-0)  ;;
-'') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
-*)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
+0|'') ;;
+*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
+    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
+    ;;
 esac
+
+$echo "(You have $package $version_patchlevel_string.)"
+
 case "$osname" in
 dos|vms)
        : XXX Should be a Configure test for double-dots in filenames.
        version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
        api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
        ;;
 *)
        version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
        api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
        ;;
 esac
 : Special case the 5.005_xx maintenance series, which used 5.005