This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A is not blank
[metaconfig.git] / U / perl / patchlevel.U
1 ?RCS: $Id: patchlevel.U,v 3.0.1.1 1997/02/28 16:18:41 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4 ?RCS:
5 ?RCS: This file is included with or a derivative work of a file included
6 ?RCS: with the metaconfig program of Raphael Manfredi's "dist" distribution.
7 ?RCS: In accordance with clause 7 of dist's modified Artistic License:
8 ?RCS:
9 ?RCS:     You may distribute under the terms of either the GNU General Public
10 ?RCS:     License or the Artistic License, as specified in the README file.
11 ?RCS:
12 ?RCS: $Log: patchlevel.U,v $
13 ?RCS: Revision 3.0.1.1  1997/02/28  16:18:41  ram
14 ?RCS: patch61: added support for src.U
15 ?RCS:
16 ?RCS: Revision 3.0  1993/08/18  12:09:31  ram
17 ?RCS: Baseline for dist 3.0 netwide release.
18 ?RCS:
19 ?MAKE:patchlevel revision version subversion \
20         perl_patchlevel version_patchlevel_string \
21         api_revision api_version api_subversion api_versionstring: \
22         package test rsrc echo awk osname
23 ?MAKE:  -pick add $@ %<
24 ?S:revision:
25 ?S:     The value of revision comes from the patchlevel.h file.
26 ?S:     In a version number such as 5.6.1, this is the "5".
27 ?S:     In patchlevel.h, this is referred to as "PERL_REVISION".
28 ?S:.
29 ?S:patchlevel:
30 ?S:     The patchlevel level of this package.
31 ?S:     The value of patchlevel comes from the patchlevel.h file.
32 ?S:     In a version number such as 5.6.1, this is the "6".
33 ?S:     In patchlevel.h, this is referred to as "PERL_VERSION".
34 ?S:.
35 ?S:subversion:
36 ?S:     The subversion level of this package.
37 ?S:     The value of subversion comes from the patchlevel.h file.
38 ?S:     In a version number such as 5.6.1, this is the "1".
39 ?S:     In patchlevel.h, this is referred to as "PERL_SUBVERSION".
40 ?S:     This is unique to perl.
41 ?S:.
42 ?S:version:
43 ?S:     The full version number of this package, such as 5.6.1 (or 5_6_1).
44 ?S:     This combines revision, patchlevel, and subversion to get the
45 ?S:     full version number, including any possible subversions.
46 ?S:     This is suitable for use as a directory name, and hence is
47 ?S:     filesystem dependent.
48 ?S:.
49 ?S:api_revision:
50 ?S:     The three variables, api_revision, api_version, and
51 ?S:     api_subversion, specify the version of the oldest perl binary
52 ?S:     compatible with the present perl.  In a full version string
53 ?S:     such as '5.6.1', api_revision is the '5'.
54 ?S:     Prior to 5.5.640, the format was a floating point number,
55 ?S:     like 5.00563.
56 ?S:
57 ?S:     perl.c:incpush() and lib/lib.pm will automatically search in
58 ?S:     $sitelib/.. for older directories back to the limit specified
59 ?S:     by these api_ variables.  This is only useful if you have a
60 ?S:     perl library directory tree structured like the default one.
61 ?S:     See INSTALL for how this works.  The versioned site_perl
62 ?S:     directory was introduced in 5.005, so that is the lowest
63 ?S:     possible value.  The version list appropriate for the current
64 ?S:     system is determined in inc_version_list.U.
65 ?S:
66 ?S:     XXX To do:  Since compatibility can depend on compile time
67 ?S:     options (such as bincompat, longlong, etc.) it should
68 ?S:     (perhaps) be set by Configure, but currently it isn't.
69 ?S:     Currently, we read a hard-wired value from patchlevel.h.
70 ?S:     Perhaps what we ought to do is take the hard-wired value from
71 ?S:     patchlevel.h but then modify it if the current Configure
72 ?S:     options warrant.  patchlevel.h then would use an #ifdef guard.
73 ?S:.
74 ?S:api_version:
75 ?S:     The three variables, api_revision, api_version, and
76 ?S:     api_subversion, specify the version of the oldest perl binary
77 ?S:     compatible with the present perl.  In a full version string
78 ?S:     such as '5.6.1', api_version is the '6'.  See api_revision for
79 ?S:     full details.  As a special case, 5.5.0 is rendered in the
80 ?S:     old-style as 5.005.  (In the 5.005_0x maintenance series,
81 ?S:     this was the only versioned directory in $sitelib.)
82 ?S:.
83 ?S:api_subversion:
84 ?S:     The three variables, api_revision, api_version, and
85 ?S:     api_subversion, specify the version of the oldest perl binary
86 ?S:     compatible with the present perl.  In a full version string
87 ?S:     such as '5.6.1', api_subversion is the '1'.  See api_revision for
88 ?S:     full details.
89 ?S:.
90 ?S:api_versionstring:
91 ?S:     This variable combines api_revision, api_version, and
92 ?S:     api_subversion in a format such as 5.6.1 (or 5_6_1) suitable
93 ?S:     for use as a directory name.  This is filesystem dependent.
94 ?S:.
95 ?S:perl_patchlevel:
96 ?S:     This is the Perl patch level, a numeric change identifier,
97 ?S:     as defined by whichever source code maintenance system
98 ?S:     is used to maintain the patches; currently Perforce.
99 ?S:     It does not correlate with the Perl version numbers or
100 ?S:     the maintenance versus development dichotomy except
101 ?S:     by also being increasing.
102 ?S:.
103 ?S:version_patchlevel_string:
104 ?S:     This is a string combining version, subversion and
105 ?S:     perl_patchlevel (if perl_patchlevel is non-zero).
106 ?S:     It is typically something like
107 ?S:     'version 7 subversion 1'  or
108 ?S:     'version 7 subversion 1 patchlevel 11224'
109 ?S:     It is computed here to avoid duplication of code in myconfig.SH
110 ?S:     and lib/Config.pm.
111 ?S:.
112 ?LINT:extern LC_ALL
113 ?LINT:extern LANGUAGE
114 : get the patchlevel
115 echo " "
116 echo "Getting the current patchlevel..." >&4
117 if $test -r $rsrc/patchlevel.h;then
118         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
119         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
120         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
121         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
122         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
123         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
124         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
125 else
126         revision=0
127         patchlevel=0
128         subversion=0
129         api_revision=0
130         api_version=0
131         api_subversion=0
132         perl_patchlevel=0
133         $echo "(You do not have patchlevel.h.  Eek.)"
134 fi
135 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
136 version_patchlevel_string="version $patchlevel subversion $subversion"
137 case "$perl_patchlevel" in
138 0|'') ;;
139 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
140     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
141     ;;
142 esac
143
144 $echo "(You have $package $version_patchlevel_string.)"
145
146 case "$osname" in
147 dos|vms)
148         : XXX Should be a Configure test for double-dots in filenames.
149         version=`echo $revision $patchlevel $subversion | \
150                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
151         api_versionstring=`echo $api_revision $api_version $api_subversion | \
152                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
153         ;;
154 *)
155         version=`echo $revision $patchlevel $subversion | \
156                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
157         api_versionstring=`echo $api_revision $api_version $api_subversion | \
158                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
159         ;;
160 esac
161 : Special case the 5.005_xx maintenance series, which used 5.005
162 : without any subversion label as a subdirectory in $sitelib
163 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
164         api_versionstring='5.005'
165 fi
166