This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Part 2 of a big cleanup action based on the upcoming dist-4.0
[metaconfig.git] / U / perl / patchlevel.U
CommitLineData
959f3c4c
JH
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
edd6115f 4?RCS:
959f3c4c
JH
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:
930100ce
JH
19?MAKE:patchlevel revision version subversion \
20 perl_patchlevel version_patchlevel_string \
0fdea05a 21 api_revision api_version api_subversion api_versionstring: \
5a8892ea 22 package test rsrc echo awk osname
959f3c4c 23?MAKE: -pick add $@ %<
0fdea05a
JH
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:.
959f3c4c
JH
29?S:patchlevel:
30?S: The patchlevel level of this package.
31?S: The value of patchlevel comes from the patchlevel.h file.
edd6115f 32?S: In a version number such as 5.6.1, this is the "6".
0fdea05a 33?S: In patchlevel.h, this is referred to as "PERL_VERSION".
959f3c4c
JH
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.
edd6115f 38?S: In a version number such as 5.6.1, this is the "1".
0fdea05a 39?S: In patchlevel.h, this is referred to as "PERL_SUBVERSION".
959f3c4c
JH
40?S: This is unique to perl.
41?S:.
42?S:version:
edd6115f 43?S: The full version number of this package, such as 5.6.1 (or 5_6_1).
0fdea05a 44?S: This combines revision, patchlevel, and subversion to get the
edd6115f
JH
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.
959f3c4c 89?S:.
edd6115f
JH
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.
959f3c4c 94?S:.
2d9d8774
MB
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:.
930100ce
JH
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:.
959f3c4c
JH
112?LINT:extern LC_ALL
113?LINT:change LC_ALL
114?LINT:extern LANGUAGE
115?LINT:change LANGUAGE
116: get the patchlevel
117echo " "
118echo "Getting the current patchlevel..." >&4
119if $test -r $rsrc/patchlevel.h;then
0fdea05a 120 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
959f3c4c
JH
121 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
122 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
edd6115f
JH
123 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
124 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
125 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bcc8112f 126 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
959f3c4c 127else
0fdea05a 128 revision=0
959f3c4c
JH
129 patchlevel=0
130 subversion=0
edd6115f
JH
131 api_revision=0
132 api_version=0
133 api_subversion=0
2d9d8774
MB
134 perl_patchlevel=0
135 $echo "(You do not have patchlevel.h. Eek.)"
136fi
316cbd6f
YST
137if $test -r $rsrc/.patch ; then
138 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
2d9d8774
MB
139 perl_patchlevel=`cat $rsrc/.patch`
140 fi
959f3c4c 141fi
930100ce
JH
142: Define a handy string here to avoid duplication in myconfig.SH and configpm.
143version_patchlevel_string="version $patchlevel subversion $subversion"
2d9d8774 144case "$perl_patchlevel" in
930100ce
JH
1450|'') ;;
146*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
2d9d8774 147esac
930100ce
JH
148
149$echo "(You have $package $version_patchlevel_string.)"
150
edd6115f 151case "$osname" in
0e496f3d 152dos|vms)
edd6115f 153 : XXX Should be a Configure test for double-dots in filenames.
0fdea05a 154 version=`echo $revision $patchlevel $subversion | \
edd6115f
JH
155 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
156 api_versionstring=`echo $api_revision $api_version $api_subversion | \
157 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
158 ;;
159*)
0fdea05a 160 version=`echo $revision $patchlevel $subversion | \
edd6115f
JH
161 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
162 api_versionstring=`echo $api_revision $api_version $api_subversion | \
163 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
164 ;;
165esac
166: Special case the 5.005_xx maintenance series, which used 5.005
167: without any subversion label as a subdirectory in $sitelib
168if test "${api_revision}${api_version}${api_subversion}" = "550"; then
169 api_versionstring='5.005'
959f3c4c 170fi
959f3c4c 171