This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Possible skeletal structure for searching multiple versions
[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 version subversion apiversion: \
20         package baserev test rsrc echo n c awk
21 ?MAKE:  -pick add $@ %<
22 ?S:patchlevel:
23 ?S:     The patchlevel level of this package.
24 ?S:     The value of patchlevel comes from the patchlevel.h file.
25 ?S:.
26 ?S:subversion:
27 ?S:     The subversion level of this package.
28 ?S:     The value of subversion comes from the patchlevel.h file.
29 ?S:     This is unique to perl.
30 ?S:.
31 ?S:version:
32 ?S:     The full version number of this package.  This combines
33 ?S:     baserev, patchlevel, and subversion to get the full
34 ?S:     version number, including any possible subversions.  Care
35 ?S:     is taken to use the C locale in order to get something
36 ?S:     like 5.004 instead of 5,004.  This is unique to perl.
37 ?S:.
38 ?S:apiversion:
39 ?S:     MakeMaker will install add-on modules in a directory with the
40 ?S:     PERL_APIVERSION version number.  The value is set manually in
41 ?S:     patchlevel.h.  Normally, for maintenance releases, this is
42 ?S:     just something like 5.005 or 5.6 or 5.7.  That is, it does not
43 ?S:     include the subversion number and does not change across
44 ?S:     maintenance releases.  This is so that add-on extensions can
45 ?S:     be shared across maintenance versions.  It is unclear how this
46 ?S:     ought to work for developer versions.  If a release breaks
47 ?S:     binary compatibility, this number should be increased.
48 ?S:.
49 ?LINT:extern LC_ALL
50 ?LINT:change LC_ALL
51 ?LINT:extern LANGUAGE
52 ?LINT:change LANGUAGE
53 : get the patchlevel
54 echo " "
55 echo "Getting the current patchlevel..." >&4
56 if $test -r $rsrc/patchlevel.h;then
57         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
58         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
59         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
60 else
61         patchlevel=0
62         subversion=0
63         apiversion=0
64 fi
65 $echo $n "(You have $package" $c
66 case "$package" in
67 "*$baserev")    ;;
68 *)              $echo $n " $baserev" $c ;;
69 esac
70 $echo $n " patchlevel $patchlevel" $c
71 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
72 echo ".)"
73
74 if test 0 -eq "$subversion"; then
75         version=`LC_ALL=C; export LC_ALL; \
76                  echo $baserev $patchlevel | \
77                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
78 else
79         version=`LC_ALL=C; export LC_ALL; \
80                  echo $baserev $patchlevel $subversion | \
81                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
82 fi
83