This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove -Wdeclaration-after-statement scan from Configure
[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
53524b20 4?RCS:
edd6115f
JH
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:
302cc344
MB
13?MAKE:inc_version_list inc_version_list_init d_inc_version_list: cat sed \
14 Getfile perl5 version api_versionstring rm Myread archname \
15 prefix sitelib_stem exe_ext
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.
53524b20 27?S:
edd6115f
JH
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
53524b20 35?S: each item is enclosed in double quotes and separated by commas,
cf7245dd
JH
36?S: suitable for use in the PERL_INC_VERSION_LIST initialization.
37?S:.
302cc344
MB
38?S:d_inc_version_list:
39?S: This variable conditionally defines PERL_INC_VERSION_LIST.
40?S: It is set to undef when PERL_INC_VERSION_LIST is empty.
41?S:.
edd6115f
JH
42?C:PERL_INC_VERSION_LIST:
43?C: This variable specifies the list of subdirectories in over
44?C: which perl.c:incpush() and lib/lib.pm will automatically
45?C: search when adding directories to @INC, in a format suitable
46?C: for a C initialization string. See the inc_version_list entry
47?C: in Porting/Glossary for more details.
48?C:.
53524b20 49?H:#$d_inc_version_list PERL_INC_VERSION_LIST $inc_version_list_init /**/
edd6115f
JH
50?H:.
51?T: stem d
52: Determine list of previous versions to include in @INC
53$cat > getverlist <<EOPL
0fdea05a 54#!$perl5 -w
edd6115f
JH
55use File::Basename;
56\$api_versionstring = "$api_versionstring";
57\$version = "$version";
a1195863 58\$stem = "$sitelib_stem";
edd6115f
JH
59\$archname = "$archname";
60EOPL
61 $cat >> getverlist <<'EOPL'
62# Can't have leading @ because metaconfig interprets it as a command!
63;@inc_version_list=();
53524b20 64# XXX Redo to do opendir/readdir?
edd6115f
JH
65if (-d $stem) {
66 chdir($stem);
67 ;@candidates = glob("5.*");
68}
69else {
70 ;@candidates = ();
71}
72
4b37e14a
JH
73# XXX ToDo: These comparisons must be reworked when two-digit
74# subversions come along, so that 5.7.10 compares as greater than
75# 5.7.3! By that time, hope that 5.6.x is sufficiently
76# widespread that we can use the built-in version vectors rather
77# than reinventing them here. For 5.6.0, however, we must
78# assume this script will likely be run by 5.005_0x. --AD 1/2000.
edd6115f
JH
79foreach $d (@candidates) {
80 if ($d lt $version) {
81 if ($d ge $api_versionstring) {
fcd1de66 82 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
edd6115f
JH
83 }
84 elsif ($d ge "5.005") {
fcd1de66 85 unshift(@inc_version_list, grep { -d } $d);
edd6115f
JH
86 }
87 }
88 else {
89 # Skip newer version. I.e. don't look in
90 # 5.7.0 if we're installing 5.6.1.
91 }
92}
93
94if (@inc_version_list) {
cf7245dd 95 print join(' ', @inc_version_list);
edd6115f
JH
96}
97else {
98 # Blank space to preserve value for next Configure run.
99 print " ";
100}
101EOPL
102chmod +x getverlist
103case "$inc_version_list" in
2b49ece9 104'') if test -x "$perl5$exe_ext"; then
0fdea05a 105 dflt=`$perl5 getverlist`
edd6115f 106 else
cf7245dd 107 dflt='none'
edd6115f
JH
108 fi
109 ;;
cf7245dd 110$undef) dflt='none' ;;
c29f4401
JH
111?X: Configure -Dinc_version_list='5.6.0/$archname 5.6.0' ...
112*) eval dflt=\"$inc_version_list\" ;;
edd6115f 113esac
0fdea05a
JH
114case "$dflt" in
115''|' ') dflt=none ;;
116esac
85de7615 117case "$dflt" in
5caab28d 1185.005) dflt=none ;;
85de7615 119esac
990ef7bf 120$cat <<EOM
edd6115f 121
53524b20
MB
122In order to ease the process of upgrading, this version of perl
123can be configured to use modules built and installed with earlier
edd6115f
JH
124versions of perl that were installed under $prefix. Specify here
125the list of earlier versions that this version of perl should check.
126If Configure detected no earlier versions of perl installed under
cf7245dd
JH
127$prefix, then the list will be empty. Answer 'none' to tell perl
128to not search earlier versions.
edd6115f
JH
129
130The default should almost always be sensible, so if you're not sure,
131just accept the default.
132EOM
133
cf7245dd 134rp='List of earlier versions to include in @INC?'
edd6115f 135. ./myread
cf7245dd 136case "$ans" in
7bab8e58 137[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
cf7245dd
JH
138*) inc_version_list="$ans" ;;
139esac
140case "$inc_version_list" in
53524b20 141''|' ')
302cc344
MB
142 inc_version_list_init='0'
143 d_inc_version_list="$undef"
144 ;;
cf7245dd 145*) inc_version_list_init=`echo $inc_version_list |
075a0831 146 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
302cc344 147 d_inc_version_list="$define"
cf7245dd
JH
148 ;;
149esac
edd6115f
JH
150$rm -f getverlist
151