BEGIN
{
- @Automake::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@')
- unless @Automake::perl_libdirs;
- unshift @INC, @Automake::perl_libdirs;
+ unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@')
+ unless $ENV{AUTOMAKE_UNINSTALLED};
-
- # Override SHELL. This is required on DJGPP so that system() uses
- # bash, not COMMAND.COM which doesn't quote arguments properly.
- # Other systems aren't expected to use $SHELL when Automake
- # runs, but it should be safe to drop the "if DJGPP" guard if
- # it turns up other systems need the same thing. After all,
- # if SHELL is used, ./configure's SHELL is always better than
- # the user's SHELL (which may be something like tcsh).
- $ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
}
use Automake::Config;
# object. In this case we rewrite the object's
# name to ensure it is unique.
- # We choose the name 'DERIVED_OBJECT' to ensure
- # (1) uniqueness, and (2) continuity between
- # invocations. However, this will result in a
- # name that is too long for losing systems, in
- # some situations. So we provide _SHORTNAME to
- # override.
-
- my $dname = $derived;
+ # We choose the name 'DERIVED_OBJECT' to ensure (1) uniqueness,
+ # and (2) continuity between invocations. However, this will
+ # result in a name that is too long for losing systems, in some
- # situations. So we attempt to shorten automatically under
- # subdir-objects, and provide _SHORTNAME to override as a last
- # resort. If subdir-object is in effect, it's usually
- # unnecessary to use the complete 'DERIVED_OBJECT' (that is
- # often the result from %canon_reldir%/%C% usage) since objects
- # are placed next to their source file. Generally, this means
- # it is already unique within that directory (see below for an
- # exception). Thus, we try to avoid unnecessarily long file
- # names by stripping the directory components of
- # 'DERIVED_OBJECT'. This allows avoiding explicit _SHORTNAME
- # usage in many cases. EXCEPTION: If two (or more) targets in
- # different directories but with the same base name (after
- # canonicalization), using target-specific FLAGS, link the same
- # object, then this logic clashes. Thus, we don't strip if
- # this is detected.
++ # situations. So we attempt to shorten automatically, and
++ # provide _SHORTNAME to override as a last resort. If
++ # subdir-object is in effect, it's usually unnecessary to use
++ # the complete 'DERIVED_OBJECT' (that is often the result from
++ # %canon_reldir%/%C% usage) since objects are placed next to
++ # their source file. Generally, this means it is already
++ # unique within that directory (see below for an exception).
++ # Thus, we try to avoid unnecessarily long file names by
++ # stripping the directory components of 'DERIVED_OBJECT'.
++ # This allows avoiding explicit _SHORTNAME usage in many
++ # cases. EXCEPTION: If two (or more) targets in different
++ # directories but with the same base name (after
++ # canonicalization), using target-specific FLAGS, link the
++ # same object, then this logic clashes. Thus, we don't strip
++ # if this is detected.
+ my $dname = $derived;
+ if ($directory ne ''
- && option 'subdir-objects'
- && none { $dname =~ /$_$/ } @dup_shortnames)
++ && none { $dname =~ /$_$/ } @dup_shortnames)
+ {
+ # At this point, we don't clear information about what
+ # parts of $derived are truly file name components. We can
+ # determine that by comparing against the canonicalization
+ # of $directory.
+ my $dir = $directory . "/";
+ my $cdir = canonicalize ($dir);
+ my $dir_len = length ($dir);
+ # Make sure we only strip full file name components. This
+ # is done by repeatedly trying to find cdir at the
+ # beginning. Each iteration removes one file name
+ # component from the end of cdir.
+ while ($dir_len > 0 && index ($derived, $cdir) != 0)
+ {
+ # Eventually $dir_len becomes 0.
+ $dir_len = rindex ($dir, "/", $dir_len - 2) + 1;
+ $cdir = substr ($cdir, 0, $dir_len);
+ }
+ $dname = substr ($derived, $dir_len);
+ }
my $var = var ($derived . '_SHORTNAME');
if ($var)
{
# to define LIBOBJDIR and ensure the files get cleaned.
# Otherwise LIBOBJDIR can be left undefined, and the cleaning
# is achieved by 'rm -f *.$(OBJEXT)' in compile.am.
- if ($config_libobj_dir
- && $relative_dir ne $config_libobj_dir)
- {
- if (option 'subdir-objects')
- {
- # In the top-level Makefile we do not use $(top_builddir), because
- # we are already there, and since the targets are built without
- # a $(top_builddir), it helps BSD Make to match them with
- # dependencies.
- $dir = "$config_libobj_dir/"
- if $config_libobj_dir ne '.';
- $dir = backname ($relative_dir) . "/$dir"
- if $relative_dir ne '.';
- define_variable ('LIBOBJDIR', "$dir", INTERNAL);
- $clean_files{"\$($var)"} = MOSTLY_CLEAN;
- # libtool might create LIBOBJS as a side-effect of using LTLIBOBJS.
- $clean_files{"\$(LIBOBJS)"} = MOSTLY_CLEAN if $var eq "LTLIBOBJS";
- }
- else
- {
- error ("'\$($var)' cannot be used outside '$config_libobj_dir' if"
- . " 'subdir-objects' is not set");
- }
+ if ($config_libobj_dir && $relative_dir ne $config_libobj_dir)
+ {
+ # In the top-level Makefile we do not use $(top_builddir), because
+ # we are already there, and since the targets are built without
+ # a $(top_builddir), it helps BSD Make to match them with
+ # dependencies.
+ $dir = "$config_libobj_dir/"
+ if $config_libobj_dir ne '.';
+ $dir = backname ($relative_dir) . "/$dir"
+ if $relative_dir ne '.';
+ define_variable ('LIBOBJDIR', "$dir", INTERNAL);
+ $clean_files{"\$($var)"} = MOSTLY_CLEAN;
- # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
- # be created by libtool as a side-effect of creating LTLIBOBJS).
- $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
++ # libtool might create LIBOBJS as a side-effect of using LTLIBOBJS.
++ $clean_files{"\$(LIBOBJS)"} = MOSTLY_CLEAN if $var eq "LTLIBOBJS";
}
return $dir;