my $archname = $Config{'archname'};
my $ver = $Config{'version'};
+my @inc_version_list = reverse split / /, $Config{'inc_version_list'};
our @ORIG_INC = @INC; # take a handy copy of 'original' value
our $VERSION = '0.5564';
Carp::carp("Parameter to use lib must be directory, not file");
}
unshift(@INC, $_);
+ # Add any previous version directories we found at configure time
+ foreach my $incver (@inc_version_list)
+ {
+ unshift(@INC, "$_/$incver") if -d "$_/$incver";
+ }
# Put a corresponding archlib directory infront of $_ if it
# looks like $_ has an archlib directory below it.
- if (-d "$_/$archname") {
- unshift(@INC, "$_/$archname") if -d "$_/$archname/auto";
- unshift(@INC, "$_/$archname/$ver") if -d "$_/$archname/$ver/auto";
- }
+ unshift(@INC, "$_/$ver") if -d "$_/$ver";
+ unshift(@INC, "$_/$ver/$archname") if -d "$_/$ver/$archname";
}
# remove trailing duplicates
incpush(PRIVLIB_EXP, FALSE);
#endif
-#ifdef SITEARCH_EXP
- incpush(SITEARCH_EXP, FALSE);
-#endif
#ifdef SITELIB_EXP
-#if defined(WIN32)
- incpush(SITELIB_EXP, TRUE);
-#else
- incpush(SITELIB_EXP, FALSE);
-#endif
+ {
+ char buf[MAXPATHLEN];
+
+ strcpy(buf,SITELIB_EXP);
+ if (strrchr(buf,'/')) /* XXX Hack, Configure var needed */
+ *strrchr(buf,'/') = '\0';
+ incpush(buf, TRUE);
+ }
#endif
#if defined(PERL_VENDORLIB_EXP)
#if defined(WIN32)
* archname-specific sub-directories.
*/
if (addsubdirs) {
+#ifdef PERL_INC_VERSION_LIST
+ const char *incverlist[] = { PERL_INC_VERSION_LIST, NULL };
+ const char **incver;
+#endif
struct stat tmpstatbuf;
#ifdef VMS
char *unix;
"Failed to unixify @INC element \"%s\"\n",
SvPV(libdir,len));
#endif
- /* .../archname/version if -d .../archname/version/auto */
- Perl_sv_setpvf(aTHX_ subdir, "%"SVf"/%s/"PERL_FS_VER_FMT"/auto", libdir,
- ARCHNAME, (int)PERL_REVISION,
- (int)PERL_VERSION, (int)PERL_SUBVERSION);
+ /* .../version/archname if -d .../version/archname */
+ Perl_sv_setpvf(aTHX_ subdir, "%"SVf"/"PERL_FS_VER_FMT"/%s", libdir,
+ (int)PERL_REVISION, (int)PERL_VERSION,
+ (int)PERL_SUBVERSION, ARCHNAME);
if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
S_ISDIR(tmpstatbuf.st_mode))
- av_push(GvAVn(PL_incgv),
- newSVpvn(SvPVX(subdir), SvCUR(subdir) - sizeof "auto"));
+ av_push(GvAVn(PL_incgv), newSVsv(subdir));
- /* .../archname if -d .../archname/auto */
- Perl_sv_setpvf(aTHX_ subdir, "%"SVf"/%s/auto", libdir, ARCHNAME);
+ /* .../version if -d .../version */
+ Perl_sv_setpvf(aTHX_ subdir, "%"SVf"/"PERL_FS_VER_FMT, libdir,
+ (int)PERL_REVISION, (int)PERL_VERSION,
+ (int)PERL_SUBVERSION);
if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
S_ISDIR(tmpstatbuf.st_mode))
- av_push(GvAVn(PL_incgv),
- newSVpvn(SvPVX(subdir), SvCUR(subdir) - sizeof "auto"));
+ av_push(GvAVn(PL_incgv), newSVsv(subdir));
+
+#ifdef PERL_INC_VERSION_LIST
+ for (incver = incverlist; *incver; incver++)
+ {
+ /* .../xxx if -d .../xxx */
+ Perl_sv_setpvf(aTHX_ subdir, "%"SVf"/%s", libdir, *incver);
+ if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
+ S_ISDIR(tmpstatbuf.st_mode))
+ av_push(GvAVn(PL_incgv), newSVsv(subdir));
+
+ }
+#endif
}
/* finally push this lib directory on the end of @INC */