| 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 License, |
| 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 License; 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: |
| 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 |
| 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 |
| 21 | ?S: search when adding directories to @INC. The elements in |
| 22 | ?S: the list are separated by spaces. This is only useful |
| 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:. |
| 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:. |
| 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:. |
| 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:. |
| 49 | ?H:#$d_inc_version_list PERL_INC_VERSION_LIST $inc_version_list_init /**/ |
| 50 | ?H:. |
| 51 | ?T:stem |
| 52 | : Determine list of previous versions to include in @INC |
| 53 | $cat > getverlist <<EOPL |
| 54 | #!$perl5 -w |
| 55 | use File::Basename; |
| 56 | \$api_versionstring = "$api_versionstring"; |
| 57 | \$version = "$version"; |
| 58 | \$stem = "$sitelib_stem"; |
| 59 | \$archname = "$archname"; |
| 60 | EOPL |
| 61 | $cat >> getverlist <<'EOPL' |
| 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 | |
| 69 | # Can't have leading @ because metaconfig interprets it as a command! |
| 70 | ;@inc_version_list=(); |
| 71 | # XXX Redo to do opendir/readdir? |
| 72 | if (-d $stem) { |
| 73 | chdir($stem); |
| 74 | ;@candidates = map { |
| 75 | [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*"); |
| 76 | ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates; |
| 77 | } |
| 78 | else { |
| 79 | ;@candidates = (); |
| 80 | } |
| 81 | |
| 82 | ($pversion, $aversion, $vsn5005) = map { |
| 83 | pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005"; |
| 84 | foreach $d (@candidates) { |
| 85 | if ($d->[1] lt $pversion) { |
| 86 | if ($d->[1] ge $aversion) { |
| 87 | unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]); |
| 88 | } |
| 89 | elsif ($d->[1] ge $vsn5005) { |
| 90 | unshift(@inc_version_list, grep { -d } $d->[0]); |
| 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) { |
| 100 | print join(' ', @inc_version_list); |
| 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 |
| 109 | '') if test -x "$perl5$exe_ext"; then |
| 110 | dflt=`$perl5 getverlist` |
| 111 | else |
| 112 | dflt='none' |
| 113 | fi |
| 114 | ;; |
| 115 | $undef) dflt='none' ;; |
| 116 | ?X: Configure -Dinc_version_list='5.6.0/$archname 5.6.0' ... |
| 117 | *) eval dflt=\"$inc_version_list\" ;; |
| 118 | esac |
| 119 | case "$dflt" in |
| 120 | ''|' ') dflt=none ;; |
| 121 | esac |
| 122 | case "$dflt" in |
| 123 | 5.005) dflt=none ;; |
| 124 | esac |
| 125 | $cat <<EOM |
| 126 | |
| 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 |
| 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 |
| 132 | $prefix, then the list will be empty. Answer 'none' to tell perl |
| 133 | to not search earlier versions. |
| 134 | |
| 135 | The default should almost always be sensible, so if you're not sure, |
| 136 | just accept the default. |
| 137 | EOM |
| 138 | |
| 139 | rp='List of earlier versions to include in @INC?' |
| 140 | . ./myread |
| 141 | case "$ans" in |
| 142 | [Nn]one|''|' '|$undef) inc_version_list=' ' ;; |
| 143 | *) inc_version_list="$ans" ;; |
| 144 | esac |
| 145 | case "$inc_version_list" in |
| 146 | ''|' ') |
| 147 | inc_version_list_init='0' |
| 148 | d_inc_version_list="$undef" |
| 149 | ;; |
| 150 | *) inc_version_list_init=`echo $inc_version_list | |
| 151 | $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'` |
| 152 | d_inc_version_list="$define" |
| 153 | ;; |
| 154 | esac |
| 155 | $rm -f getverlist |
| 156 | |