This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reintroduce #5019 via metaconfig.
[metaconfig.git] / U / installdirs / inc_version_list.U
CommitLineData
edd6115f
JH
1?RCS: $Id: inc_version_list.U,v $
2?RCS:
3?RCS: Copyright (c) 2000 Andy Dougherty
4?RCS:
5?RCS: You may redistribute only under the terms of the Artistic Licence,
6?RCS: as specified in the README file that comes with the distribution.
7?RCS: You may reuse parts of this distribution only within the terms of
8?RCS: that same Artistic Licence; a copy of which may be found at the root
9?RCS: of the source tree for dist 3.0.
10?RCS:
11?RCS: $Log: inc_version_list.U,v $
12?RCS:
cf7245dd
JH
13?MAKE:inc_version_list inc_version_list_init: cat sed Getfile perl \
14 version api_versionstring rm Myread archname prefix sitelib
edd6115f
JH
15?MAKE: -pick add $@ %<
16?Y:TOP
17?S:inc_version_list:
18?S: This variable specifies the list of subdirectories in over
19?S: which perl.c:incpush() and lib/lib.pm will automatically
cf7245dd
JH
20?S: search when adding directories to @INC. The elements in
21?S: the list are separated by spaces. This is only useful
edd6115f
JH
22?S: if you have a perl library directory tree structured like the
23?S: default one. See INSTALL for how this works. The versioned
24?S: site_perl directory was introduced in 5.005, so that is the
25?S: lowest possible value.
26?S:
27?S: This list includes architecture-dependent directories back to
28?S: version $api_versionstring (e.g. 5.5.640) and
29?S: architecture-independent directories all the way back to
30?S: 5.005.
31?S:.
cf7245dd
JH
32?S:inc_version_list_init:
33?S: This variable holds the same list as inc_version_list, but
34?S: each item is enclosed in double quotes and separated by commas,
35?S: suitable for use in the PERL_INC_VERSION_LIST initialization.
36?S:.
edd6115f
JH
37?C:PERL_INC_VERSION_LIST:
38?C: This variable specifies the list of subdirectories in over
39?C: which perl.c:incpush() and lib/lib.pm will automatically
40?C: search when adding directories to @INC, in a format suitable
41?C: for a C initialization string. See the inc_version_list entry
42?C: in Porting/Glossary for more details.
43?C:.
cf7245dd 44?H:#define PERL_INC_VERSION_LIST $inc_version_list_init /**/
edd6115f
JH
45?H:.
46?T: stem d
47: Determine list of previous versions to include in @INC
48$cat > getverlist <<EOPL
49#!$perl -w
50use File::Basename;
51\$api_versionstring = "$api_versionstring";
52\$version = "$version";
53\$sitelib = "$sitelib";
54\$archname = "$archname";
55EOPL
56 $cat >> getverlist <<'EOPL'
57# Can't have leading @ because metaconfig interprets it as a command!
58;@inc_version_list=();
59$stem=dirname($sitelib);
60# Redo to do opendir/readdir?
61if (-d $stem) {
62 chdir($stem);
63 ;@candidates = glob("5.*");
64}
65else {
66 ;@candidates = ();
67}
68
4b37e14a
JH
69# XXX ToDo: These comparisons must be reworked when two-digit
70# subversions come along, so that 5.7.10 compares as greater than
71# 5.7.3! By that time, hope that 5.6.x is sufficiently
72# widespread that we can use the built-in version vectors rather
73# than reinventing them here. For 5.6.0, however, we must
74# assume this script will likely be run by 5.005_0x. --AD 1/2000.
edd6115f
JH
75foreach $d (@candidates) {
76 if ($d lt $version) {
77 if ($d ge $api_versionstring) {
78 unshift(@inc_version_list, "$d/$archname", $d);
79 }
80 elsif ($d ge "5.005") {
81 unshift(@inc_version_list, $d);
82 }
83 }
84 else {
85 # Skip newer version. I.e. don't look in
86 # 5.7.0 if we're installing 5.6.1.
87 }
88}
89
90if (@inc_version_list) {
cf7245dd 91 print join(' ', @inc_version_list);
edd6115f
JH
92}
93else {
94 # Blank space to preserve value for next Configure run.
95 print " ";
96}
97EOPL
98chmod +x getverlist
99case "$inc_version_list" in
100'') if test -x $perl; then
101 dflt=`$perl getverlist`
102 else
cf7245dd 103 dflt='none'
edd6115f
JH
104 fi
105 ;;
cf7245dd 106$undef) dflt='none' ;;
edd6115f
JH
107*) dflt="$inc_version_list" ;;
108esac
109$cat <<'EOM'
110
111In order to ease the process of upgrading, this version of perl
112can be configured to use modules built and installed with earlier
113versions of perl that were installed under $prefix. Specify here
114the list of earlier versions that this version of perl should check.
115If Configure detected no earlier versions of perl installed under
cf7245dd
JH
116$prefix, then the list will be empty. Answer 'none' to tell perl
117to not search earlier versions.
edd6115f
JH
118
119The default should almost always be sensible, so if you're not sure,
120just accept the default.
121EOM
122
cf7245dd 123rp='List of earlier versions to include in @INC?'
edd6115f 124. ./myread
cf7245dd
JH
125case "$ans" in
126[Nn]one) inc_version_list=' ' ;;
127*) inc_version_list="$ans" ;;
128esac
129case "$inc_version_list" in
130''|' ')
075a0831 131 inc_version_list_init='0';;
cf7245dd 132*) inc_version_list_init=`echo $inc_version_list |
075a0831 133 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
cf7245dd
JH
134 ;;
135esac
edd6115f
JH
136$rm -f getverlist
137