This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backport 1034e4c80e068f8cc1c701d7936bdb84c7d74735
[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
4c42341b
MB
105?S: perl_patchlevel (if perl_patchlevel is non-zero).
106?S: It is typically something like
930100ce
JH
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
4c42341b 110?S: and lib/Config.pm.
930100ce 111?S:.
959f3c4c 112?LINT:extern LC_ALL
959f3c4c 113?LINT:extern LANGUAGE
959f3c4c
JH
114: get the patchlevel
115echo " "
116echo "Getting the current patchlevel..." >&4
117if $test -r $rsrc/patchlevel.h;then
0fdea05a 118 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
959f3c4c
JH
119 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
120 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
edd6115f
JH
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`
bcc8112f 124 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
959f3c4c 125else
0fdea05a 126 revision=0
959f3c4c
JH
127 patchlevel=0
128 subversion=0
edd6115f
JH
129 api_revision=0
130 api_version=0
131 api_subversion=0
2d9d8774
MB
132 perl_patchlevel=0
133 $echo "(You do not have patchlevel.h. Eek.)"
134fi
930100ce
JH
135: Define a handy string here to avoid duplication in myconfig.SH and configpm.
136version_patchlevel_string="version $patchlevel subversion $subversion"
2d9d8774 137case "$perl_patchlevel" in
930100ce 1380|'') ;;
fbfb996d
MB
139*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
140 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
141 ;;
2d9d8774 142esac
930100ce
JH
143
144$echo "(You have $package $version_patchlevel_string.)"
145
edd6115f 146case "$osname" in
0e496f3d 147dos|vms)
edd6115f 148 : XXX Should be a Configure test for double-dots in filenames.
0fdea05a 149 version=`echo $revision $patchlevel $subversion | \
edd6115f
JH
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*)
0fdea05a 155 version=`echo $revision $patchlevel $subversion | \
edd6115f
JH
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 ;;
160esac
161: Special case the 5.005_xx maintenance series, which used 5.005
162: without any subversion label as a subdirectory in $sitelib
163if test "${api_revision}${api_version}${api_subversion}" = "550"; then
164 api_versionstring='5.005'
959f3c4c 165fi
959f3c4c 166