Commit | Line | Data |
---|---|---|
edd6115f JH |
1 | ?RCS: $Id: inc_version_list.U,v $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 2000 Andy Dougherty | |
53524b20 | 4 | ?RCS: |
65a32477 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
edd6115f JH |
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 | |
65a32477 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
edd6115f JH |
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 | 50 | ?H:. |
41322e17 | 51 | ?T:stem |
edd6115f JH |
52 | : Determine list of previous versions to include in @INC |
53 | $cat > getverlist <<EOPL | |
0fdea05a | 54 | #!$perl5 -w |
edd6115f JH |
55 | use File::Basename; |
56 | \$api_versionstring = "$api_versionstring"; | |
57 | \$version = "$version"; | |
a1195863 | 58 | \$stem = "$sitelib_stem"; |
edd6115f JH |
59 | \$archname = "$archname"; |
60 | EOPL | |
61 | $cat >> getverlist <<'EOPL' | |
ee1104ab MB |
62 | # The list found is store twice for each entry: the original name, and |
63 | # the binary broken down version as pack "sss", so sorting is easy and | |
64 | # unambiguous. This will work for all versions that have a maximum of | |
65 | # three digit groups, separate by '.'s or '_'s. Names are extended with | |
66 | # ".0.0" to ensure at least three elements for the pack. | |
67 | # -- H.Merijn Brand (m)'06 23-10-2006 | |
68 | ||
edd6115f JH |
69 | # Can't have leading @ because metaconfig interprets it as a command! |
70 | ;@inc_version_list=(); | |
53524b20 | 71 | # XXX Redo to do opendir/readdir? |
edd6115f JH |
72 | if (-d $stem) { |
73 | chdir($stem); | |
ee1104ab MB |
74 | ;@candidates = map { |
75 | [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*"); | |
ffb2d961 | 76 | ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates; |
edd6115f JH |
77 | } |
78 | else { | |
79 | ;@candidates = (); | |
80 | } | |
81 | ||
ee1104ab MB |
82 | ($pversion, $aversion, $vsn5005) = map { |
83 | pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005"; | |
edd6115f | 84 | foreach $d (@candidates) { |
ee1104ab MB |
85 | if ($d->[1] lt $pversion) { |
86 | if ($d->[1] ge $aversion) { | |
87 | unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]); | |
edd6115f | 88 | } |
ee1104ab MB |
89 | elsif ($d->[1] ge $vsn5005) { |
90 | unshift(@inc_version_list, grep { -d } $d->[0]); | |
edd6115f JH |
91 | } |
92 | } | |
93 | else { | |
94 | # Skip newer version. I.e. don't look in | |
95 | # 5.7.0 if we're installing 5.6.1. | |
96 | } | |
97 | } | |
98 | ||
99 | if (@inc_version_list) { | |
cf7245dd | 100 | print join(' ', @inc_version_list); |
edd6115f JH |
101 | } |
102 | else { | |
103 | # Blank space to preserve value for next Configure run. | |
104 | print " "; | |
105 | } | |
106 | EOPL | |
107 | chmod +x getverlist | |
108 | case "$inc_version_list" in | |
2b49ece9 | 109 | '') if test -x "$perl5$exe_ext"; then |
0fdea05a | 110 | dflt=`$perl5 getverlist` |
edd6115f | 111 | else |
cf7245dd | 112 | dflt='none' |
edd6115f JH |
113 | fi |
114 | ;; | |
cf7245dd | 115 | $undef) dflt='none' ;; |
c29f4401 JH |
116 | ?X: Configure -Dinc_version_list='5.6.0/$archname 5.6.0' ... |
117 | *) eval dflt=\"$inc_version_list\" ;; | |
edd6115f | 118 | esac |
0fdea05a JH |
119 | case "$dflt" in |
120 | ''|' ') dflt=none ;; | |
121 | esac | |
85de7615 | 122 | case "$dflt" in |
5caab28d | 123 | 5.005) dflt=none ;; |
85de7615 | 124 | esac |
990ef7bf | 125 | $cat <<EOM |
edd6115f | 126 | |
53524b20 MB |
127 | In order to ease the process of upgrading, this version of perl |
128 | can be configured to use modules built and installed with earlier | |
edd6115f JH |
129 | versions of perl that were installed under $prefix. Specify here |
130 | the list of earlier versions that this version of perl should check. | |
131 | If Configure detected no earlier versions of perl installed under | |
cf7245dd JH |
132 | $prefix, then the list will be empty. Answer 'none' to tell perl |
133 | to not search earlier versions. | |
edd6115f JH |
134 | |
135 | The default should almost always be sensible, so if you're not sure, | |
136 | just accept the default. | |
137 | EOM | |
138 | ||
cf7245dd | 139 | rp='List of earlier versions to include in @INC?' |
edd6115f | 140 | . ./myread |
cf7245dd | 141 | case "$ans" in |
7bab8e58 | 142 | [Nn]one|''|' '|$undef) inc_version_list=' ' ;; |
cf7245dd JH |
143 | *) inc_version_list="$ans" ;; |
144 | esac | |
145 | case "$inc_version_list" in | |
53524b20 | 146 | ''|' ') |
302cc344 MB |
147 | inc_version_list_init='0' |
148 | d_inc_version_list="$undef" | |
149 | ;; | |
cf7245dd | 150 | *) inc_version_list_init=`echo $inc_version_list | |
075a0831 | 151 | $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'` |
302cc344 | 152 | d_inc_version_list="$define" |
cf7245dd JH |
153 | ;; |
154 | esac | |
edd6115f JH |
155 | $rm -f getverlist |
156 |