automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

57-fyi-append-exeext.patch


From: Akim Demaille
Subject: 57-fyi-append-exeext.patch
Date: Sun, 28 Oct 2001 14:52:35 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * automake.in (&append_exeext): New.
        (&am_primary_prefixes): Use it.

Index: automake.in
--- automake.in Sat, 27 Oct 2001 16:09:22 +0200 akim
+++ automake.in Sat, 27 Oct 2001 17:54:37 +0200 akim
@@ -2599,7 +2599,7 @@ sub handle_libraries
     return if ! @liblist;

     my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib',
-                                    'noinst', 'check');
+                                     'noinst', 'check');
     if (! defined $configure_vars{'RANLIB'}
        && @prefix)
       {
@@ -2694,7 +2694,7 @@ sub handle_ltlibraries

     my %instdirs;
     my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib',
-                                    'noinst', 'check');
+                                     'noinst', 'check');

     foreach my $key (@prefix)
       {
@@ -4273,7 +4273,7 @@ sub handle_java
     return if ! @sourcelist;

     my @prefix = am_primary_prefixes ('JAVA', 1,
-                                    'java', 'noinst', 'check');
+                                     'java', 'noinst', 'check');

     my $dir;
     foreach my $curs (@prefix)
@@ -7263,6 +7263,52 @@ sub transform (%)
 }


+# &append_exeext ($MACRO)
+# -----------------------
+# Macro is an Automake magic macro which primary is PROGRAMS, e.g.
+# bin_PROGRAMS.  Make sure these programs have $(EXEEXT) appended.
+sub append_exeext ($)
+{
+  my ($macro) = @_;
+
+  prog_error "append_exeext ($macro)"
+    unless $macro =~ /_PROGRAMS$/;
+
+  my @conds = variable_conditions_recursive ($macro);
+
+  my @condvals;
+  foreach my $cond (@conds)
+    {
+      my @one_binlist = ();
+      my @condval = variable_value_as_list_recursive ($macro, $cond);
+      foreach my $rcurs (@condval)
+       {
+         # Skip autoconf substs.  Also skip if the user
+         # already applied $(EXEEXT).
+         if ($rcurs =~ /address@hidden@$/ || $rcurs =~ /\$\(EXEEXT\)$/)
+           {
+             push (@one_binlist, $rcurs);
+           }
+         else
+           {
+             push (@one_binlist, $rcurs . '$(EXEEXT)');
+           }
+       }
+
+      push (@condvals, $cond);
+      push (@condvals, "@one_binlist");
+    }
+
+  variable_delete ($macro);
+  while (@condvals)
+    {
+      my $cond = shift (@condvals);
+      my @val = split (' ', shift (@condvals));
+      define_pretty_variable ($macro, $cond, @val);
+    }
+ }
+
+
 # @PREFIX
 # &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
 # -----------------------------------------------------
@@ -7357,7 +7403,7 @@ sub am_install_var
        shift (@args);
     }

-    my ($file, $primary, @prefixes) = @args;
+    my ($file, $primary, @prefix) = @args;

     # Now that configure substitutions are allowed in where_HOW
     # variables, it is an error to actually define the primary.  We
@@ -7376,7 +7422,7 @@ sub am_install_var
     # instance, if the variable "zardir" is defined, then
     # "zar_PROGRAMS" becomes valid.  This is to provide a little extra
     # flexibility in those cases which need it.
-    my @prefix = am_primary_prefixes ($primary, $can_dist, @prefixes);
+    @prefix = am_primary_prefixes ($primary, $can_dist, @prefix);

     # If a primary includes a configure substitution, then the EXTRA_
     # form is required.  Otherwise we can't properly do our job.
@@ -7444,51 +7490,14 @@ sub am_install_var

        # A blatant hack: we rewrite each _PROGRAMS primary to include
        # EXEEXT.
-       if ($primary eq 'PROGRAMS')
-       {
-           my @conds = variable_conditions_recursive ($one_name);
-
-           my @condvals;
-           foreach my $cond (@conds)
-           {
-               my @one_binlist = ();
-               my @condval = &variable_value_as_list_recursive ($one_name,
-                                                      $cond);
-               foreach my $rcurs (@condval)
-               {
-                   # Skip autoconf substs.  Also skip if the user
-                   # already applied $(EXEEXT).
-                   if ($rcurs =~ /address@hidden@$/ || $rcurs =~ 
/\$\(EXEEXT\)$/)
-                   {
-                       push (@one_binlist, $rcurs);
-                   }
-                   else
-                   {
-                       push (@one_binlist, $rcurs . '$(EXEEXT)');
-                   }
-               }
-
-               push (@condvals, $cond);
-               push (@condvals, "@one_binlist");
-           }
-
-           variable_delete ($one_name);
-           while (@condvals)
-           {
-               my $cond = shift (@condvals);
-               my @val = split (' ', shift (@condvals));
-               define_pretty_variable ($one_name, $cond, @val);
-           }
-       }
+       append_exeext ($one_name)
+         if $primary eq 'PROGRAMS';

        # "EXTRA" shouldn't be used when generating clean targets,
-       # all, or install targets.
-       if ($nodir_name eq 'EXTRA')
-         {
-           # We used to warn if EXTRA_FOO was defined uselessly,
-           # but this was annoying.
-           next;
-         }
+       # all, or install targets.  We used to warn if EXTRA_FOO was
+       # defined uselessly, but this was annoying.
+       next
+         if $nodir_name eq 'EXTRA';

        if ($nodir_name eq 'check')
          {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]