]> sourceware.org Git - automake.git/commitdiff
* automake.in (handle_single_transform_list): Use new global, branchpoint-real-1-5
authorRichard Boulton <richard@tartarus.org>
Sat, 11 Aug 2001 00:30:27 +0000 (00:30 +0000)
committerRichard Boulton <richard@tartarus.org>
Sat, 11 Aug 2001 00:30:27 +0000 (00:30 +0000)
`%linkers_used', to store the linkers used, rather than an internal
variable.  Enables correct linker to be calculated across a group
of calls to &handle_single_transform_list.  Return only list of
objects, since linker to be used is now externally determined.
(handle_source_transform): adapted for new calling conventions of
handle_single_transform_list.  Calls resolve_linker() on a set of
all the linkers used for any prefix, rather than for each prefix in
turn.
(linkers_used): New global.
* tests/link_dist.test: New test.
* tests/Makefile.am (TESTS): Added link_dist.test.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/link_dist.test [new file with mode: 0755]

index d192e687ba9a7650b22c85c8ce0e2c4bba783132..4572a2ad93276f20d0ad7998fad96badd300eed9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2001-08-09  Richard Boulton <richard@tartarus.org>
+
+       * automake.in (handle_single_transform_list): Use new global,
+       `%linkers_used', to store the linkers used, rather than an internal
+       variable.  Enables correct linker to be calculated across a group
+       of calls to &handle_single_transform_list.  Return only list of
+       objects, since linker to be used is now externally determined.
+       (handle_source_transform): adapted for new calling conventions of
+       handle_single_transform_list.  Calls resolve_linker() on a set of
+       all the linkers used for any prefix, rather than for each prefix in
+       turn.
+       (linkers_used): New global.
+       * tests/link_dist.test: New test.
+       * tests/Makefile.am (TESTS): Added link_dist.test.
+
 2001-08-08  Raja R Harinath  <harinath@cs.umn.edu>
 
        Dissociate testsuite 'make' invocations from outer 'make'.
index a49d9a7a0c1b0a8a44a1f0d423e10caeb46a4a1a..93f05036f5b73a0c7c1670e0e0e956f415154560 100755 (executable)
@@ -631,6 +631,10 @@ my %lang_specific_files;
 # we should no longer push on dist_common.
 my $handle_dist_run;
 
+# Used to store a set of linkers needed to generate the sources currently
+# under consideration.
+my %linkers_used;
+
 # True if we need `LINK' defined.  This is a hack.
 my $need_link;
 
@@ -1731,7 +1735,7 @@ sub check_libobjs_sources
 }
 
 
-# ($LINKER, @OBJECTS)
+# @OBJECTS
 # handle_single_transform_list ($VAR, $DERIVED, $OBJ, @FILES)
 # -----------------------------------------------------------
 # Does much of the actual work for handle_source_transform.
@@ -1739,16 +1743,14 @@ sub check_libobjs_sources
 #   $DERIVED is the name of resulting executable or library
 #   $OBJ is the object extension (e.g., `$U.lo')
 #   @FILES is the list of source files to transform
-# Result is a list
-#   $LINKER is name of linker to use (empty string for default linker)
-#   @OBJECTS are names of objects
+# Result is a list of the names of objects
+# %linkers_used will be updated with any linkers needed
 sub handle_single_transform_list ($$$@)
 {
     my ($var, $derived, $obj, @files) = @_;
     my @result = ();
     my $nonansi_obj = $obj;
     $nonansi_obj =~ s/\$U//g;
-    my %linkers_used = ();
 
     # Turn sources into objects.  We use a while loop like this
     # because we might add to @files in the loop.
@@ -2012,7 +2014,7 @@ sub handle_single_transform_list ($$$@)
         }
     }
 
-    return (&resolve_linker (%linkers_used), @result);
+    return @result;
 }
 
 
@@ -2041,6 +2043,8 @@ sub handle_source_transform
     }
 
     my %used_pfx = ();
+    my $needlinker;
+    %linkers_used = ();
     foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
                        'dist_EXTRA_', 'nodist_EXTRA_')
     {
@@ -2063,12 +2067,11 @@ sub handle_source_transform
        foreach my $cond (variable_conditions ($var))
          {
            my @files = &variable_value_as_list ($var, $cond);
-           my ($temp, @result) =
+           my (@result) =
              &handle_single_transform_list ($var, $one_file, $obj,
                                             @files);
            # If there are no files to compile, don't require a linker (yet).
-           $linker ||= $temp
-             if @files;
+           $needlinker ||= "true" if @result;
 
            # Define _OBJECTS conditionally.
            &define_pretty_variable ($xpfx . $one_file . '_OBJECTS',
@@ -2076,6 +2079,10 @@ sub handle_source_transform
              unless $prefix =~ /EXTRA_/;
          }
     }
+    if ($needlinker)
+    {
+       $linker ||= &resolve_linker (%linkers_used);
+    }
 
     my @keys = sort keys %used_pfx;
     if (scalar @keys == 0)
@@ -2084,11 +2091,12 @@ sub handle_source_transform
        push (@sources, $unxformed . '.c');
        push (@dist_sources, $unxformed . '.c');
 
-       my ($temp, @result) =
+       %linkers_used = ();
+       my (@result) =
          &handle_single_transform_list ($one_file . '_SOURCES',
                                         $one_file, $obj,
                                         "$unxformed.c");
-       $linker = $temp if $linker eq '';
+       $linker ||= &resolve_linker (%linkers_used);
        &define_pretty_variable ($one_file . "_OBJECTS", '', @result)
     }
     else
index 8590ae6fa70de80dc797422ca61bbb44e147d720..bad25a61699e88c827df3c1cf16eb9d0814c3bc4 100644 (file)
@@ -190,6 +190,7 @@ library.test \
 libtool.test \
 libtool2.test \
 link_c_cxx.test        \
+link_dist.test \
 link_f_c.test \
 link_f_c_cxx.test \
 link_f_cxx.test        \
index 215e8f3aa179a8838204cc6c5fc12a6e6d8adbed..691aef0745cc1fcca5ec016705a3748d1dc43248 100644 (file)
@@ -258,6 +258,7 @@ library.test \
 libtool.test \
 libtool2.test \
 link_c_cxx.test        \
+link_dist.test \
 link_f_c.test \
 link_f_c_cxx.test \
 link_f_cxx.test        \
diff --git a/tests/link_dist.test b/tests/link_dist.test
new file mode 100755 (executable)
index 0000000..f085c9a
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+# Test to make sure the linker for a dist_*_SOURCES can override that for
+# *_SOURCES
+# Richard Boulton <richard@tartarus.org>
+
+. $srcdir/defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = lavalamp
+lavalamp_SOURCES = lava.c
+dist_lavalamp_SOURCES = lamp.cxx
+END
+
+: > lava.c
+: > lamp.cxx
+
+$ACLOCAL || exit 1
+$AUTOMAKE || exit 1
+
+
+# We should only see the C++ linker in the rules of `Makefile.in'.
+
+# Look for this macro not at the beginning of any line; that will have
+# to be good enough for now.
+grep '.\$(CXXLINK)' Makefile.in  || exit 1
+
+# We should not see these patterns:
+grep '.\$(FLINK)' Makefile.in && exit 1
+grep '.\$(LINK)'  Makefile.in && exit 1
+
+exit 0
This page took 0.042299 seconds and 5 git commands to generate.