This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't propose using modules built for 5.005 if no binary
[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:
0fdea05a 13?MAKE:inc_version_list inc_version_list_init: cat sed Getfile perl5 \
85de7615
JO
14 version api_versionstring rm Myread archname prefix sitelib_stem \
15 bincompat5005
edd6115f
JH
16?MAKE: -pick add $@ %<
17?Y:TOP
18?S:inc_version_list:
19?S: This variable specifies the list of subdirectories in over
20?S: which perl.c:incpush() and lib/lib.pm will automatically
cf7245dd
JH
21?S: search when adding directories to @INC. The elements in
22?S: the list are separated by spaces. This is only useful
edd6115f
JH
23?S: if you have a perl library directory tree structured like the
24?S: default one. See INSTALL for how this works. The versioned
25?S: site_perl directory was introduced in 5.005, so that is the
26?S: lowest possible value.
27?S:
28?S: This list includes architecture-dependent directories back to
29?S: version $api_versionstring (e.g. 5.5.640) and
30?S: architecture-independent directories all the way back to
31?S: 5.005.
32?S:.
cf7245dd
JH
33?S:inc_version_list_init:
34?S: This variable holds the same list as inc_version_list, but
35?S: each item is enclosed in double quotes and separated by commas,
36?S: suitable for use in the PERL_INC_VERSION_LIST initialization.
37?S:.
edd6115f
JH
38?C:PERL_INC_VERSION_LIST:
39?C: This variable specifies the list of subdirectories in over
40?C: which perl.c:incpush() and lib/lib.pm will automatically
41?C: search when adding directories to @INC, in a format suitable
42?C: for a C initialization string. See the inc_version_list entry
43?C: in Porting/Glossary for more details.
44?C:.
cf7245dd 45?H:#define PERL_INC_VERSION_LIST $inc_version_list_init /**/
edd6115f
JH
46?H:.
47?T: stem d
48: Determine list of previous versions to include in @INC
49$cat > getverlist <<EOPL
0fdea05a 50#!$perl5 -w
edd6115f
JH
51use File::Basename;
52\$api_versionstring = "$api_versionstring";
53\$version = "$version";
a1195863 54\$stem = "$sitelib_stem";
edd6115f
JH
55\$archname = "$archname";
56EOPL
57 $cat >> getverlist <<'EOPL'
58# Can't have leading @ because metaconfig interprets it as a command!
59;@inc_version_list=();
0fdea05a 60# XXX Redo to do opendir/readdir?
edd6115f
JH
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) {
fcd1de66 78 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
edd6115f
JH
79 }
80 elsif ($d ge "5.005") {
fcd1de66 81 unshift(@inc_version_list, grep { -d } $d);
edd6115f
JH
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
0fdea05a
JH
100'') if test -x "$perl5"; then
101 dflt=`$perl5 getverlist`
edd6115f 102 else
cf7245dd 103 dflt='none'
edd6115f
JH
104 fi
105 ;;
cf7245dd 106$undef) dflt='none' ;;
edd6115f
JH
107*) dflt="$inc_version_list" ;;
108esac
0fdea05a
JH
109case "$dflt" in
110''|' ') dflt=none ;;
111esac
85de7615
JO
112case "$dflt" in
1135.005) case "$bincompat5005" in
114 $define|true|[yY]*) ;;
115 *) dflt=none ;;
116 esac
117 ;;
118esac
edd6115f
JH
119$cat <<'EOM'
120
121In order to ease the process of upgrading, this version of perl
122can be configured to use modules built and installed with earlier
123versions of perl that were installed under $prefix. Specify here
124the list of earlier versions that this version of perl should check.
125If Configure detected no earlier versions of perl installed under
cf7245dd
JH
126$prefix, then the list will be empty. Answer 'none' to tell perl
127to not search earlier versions.
edd6115f
JH
128
129The default should almost always be sensible, so if you're not sure,
130just accept the default.
131EOM
132
cf7245dd 133rp='List of earlier versions to include in @INC?'
edd6115f 134. ./myread
cf7245dd 135case "$ans" in
0fdea05a 136[Nn]one|''|' ') inc_version_list=' ' ;;
cf7245dd
JH
137*) inc_version_list="$ans" ;;
138esac
139case "$inc_version_list" in
140''|' ')
075a0831 141 inc_version_list_init='0';;
cf7245dd 142*) inc_version_list_init=`echo $inc_version_list |
075a0831 143 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
cf7245dd
JH
144 ;;
145esac
edd6115f
JH
146$rm -f getverlist
147