automake-patches
[Top][All Lists]
Advanced

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

Patch: (comments please) EXEEXT fix


From: Tom Tromey
Subject: Patch: (comments please) EXEEXT fix
Date: 21 Jul 2001 20:27:44 -0600

This is the fix I'm considering for the EXEEXT problems.

The `make_input_list' stuff is because I found out we were generating
certain Makefile.in's twice.  Oops.  This really slowed us down!  This
part will definitely go in.

I'm interested in comments on the EXEEXT stuff.  Does this satisfy all
the constraints?  I think it does (besides aesthetic appeal, that is).

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * automake.in (make_input_list): Removed.
        (scan_autoconf_config_files): Don't add to make_input_list.
        (scan_one_autoconf_file): Don't use make_input_list.
        (scan_autoconf_files): Use make_list, not make_input_list.
        (scan_autoconf_files): Likewise.

        * automake.in (seen_exeext): Removed.
        (generate_makefile): Don't define EXEEXT.
        (scan_one_autoconf_file): Don't check for AC_EXEEXT.
        (make_paragraphs): Always use $(EXEEXT).
        (am_install_var): Don't check $seen_exeext.
        (rule_define): Allow x to override x$(EXEEXT), for now.
        (file_contents_internal): Only define rule if rule_define allows
        us to.
        * m4/init.m4 (AM_INIT_AUTOMAKE): Define EXEEXT and OBJEXT.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1158
diff -u -r1.1158 automake.in
--- automake.in 2001/07/21 19:34:32 1.1158
+++ automake.in 2001/07/22 02:01:16
@@ -425,9 +425,6 @@
 # TRUE if we've seen AM_PATH_PYTHON.
 my $seen_pythondir = 0;
 
-# TRUE if we've seen AC_EXEEXT.
-my $seen_exeext = 0;
-
 # TRUE if we've seen AC_OBJEXT.
 my $seen_objext = 0;
 
@@ -1218,14 +1215,6 @@
     push (@sources, '$(SOURCES)')
        if &variable_defined ('SOURCES');
 
-    # If OBJEXT/EXEEXT were not set in configure.in, do it, it
-    # simplifies our task, and anyway starting with Autoconf 2.50, it
-    # will always be defined, and this code will be dead.
-    $output_vars .= "EXEEXT =\n"
-      unless $seen_exeext;
-    $output_vars .= "OBJEXT = o\n"
-      unless $seen_objext;
-
     # Must do this after reading .am file.  See read_main_am_file to
     # understand weird tricks we play there with variables.
     &define_variable ('subdir', $relative_dir);
@@ -4315,7 +4304,7 @@
 ################################################################
 
 my %make_list;
-my @make_input_list;
+
 # &scan_autoconf_config_files ($CONFIG-FILES)
 # -------------------------------------------
 # Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
@@ -4346,7 +4335,6 @@
         if (-f $input . '.am')
         {
             # We have a file that automake should generate.
-            push (@make_input_list, $input);
             $make_list{$input} = join (':', ($local, @rest));
         }
         else
@@ -4568,7 +4556,9 @@
            # Look at potential Makefile.am's.
            &scan_autoconf_config_files ($_);
 
-           if ($closing && @make_input_list == 0 && @other_input_files == 0)
+           if ($closing
+               && scalar keys %make_list == 0
+               && @other_input_files == 0)
            {
                &am_conf_line_error ($filename, $ac_output_line,
                                     "No files mentioned in `AC_OUTPUT'");
@@ -4585,13 +4575,6 @@
        # Check for ansi2knr.
        $am_c_prototypes = 1 if /AM_C_PROTOTYPES/;
 
-       # Check for exe extension stuff.
-       if (/AC_EXEEXT/)
-       {
-           $seen_exeext = 1;
-           $configure_vars{'EXEEXT'} = $filename . ':' . $.;
-       }
-
        if (/AC_OBJEXT/)
        {
            $seen_objext = 1;
@@ -4810,11 +4793,11 @@
     # Set input and output files if not specified by user.
     if (! @input_files)
     {
-       @input_files = @make_input_list;
+       @input_files = sort keys %make_list;
        %output_files = %make_list;
     }
 
-    @configure_input_files = @make_input_list;
+    @configure_input_files = sort keys %make_list;
 
     &am_conf_error ("`AM_INIT_AUTOMAKE' must be used")
        if ! $seen_init_automake;
@@ -6410,41 +6393,64 @@
 ## Handling rules.  ##
 ## ---------------- ##
 
+# $BOOL
+# rule_define ($TARGET, $IS_AM, $COND, $WHERE)
+# --------------------------------------------
+# Define a new rule.  $TARGET is the rule name.  $IS_AM is a boolean
+# which is true if the new rule is defined by the user.  $COND is the
+# condition under which the rule is defined.  $WHERE is where the rule
+# is defined (file name or line number).  Returns true if it is ok to
+# define the rule, false otherwise.
 sub rule_define ($$$$)
 {
   my ($target, $rule_is_am, $cond, $where) = @_;
 
+  # For now `foo:' will override `foo$(EXEEXT):'.  This is temporary,
+  # though, so we emit a warning.
+  (my $noexe = $target) =~ s,\$\(EXEEXT\)$,,;
+  if ($noexe ne $target && defined $targets{$noexe})
+  {
+      &am_line_warning ($noexe,
+                       "deprecated feature: `$noexe' overrides 
`$noexe\$(EXEEXT)'");
+      &am_line_warning ($noexe,
+                       "change your target to read `$noexe\$(EXEEXT)'");
+      # Don't define.
+      return 0;
+  }
+
   if (defined $targets{$target}
       && ($cond
          ? ! defined $target_conditional{$target}
          : defined $target_conditional{$target}))
-    {
+  {
       &am_line_error ($target,
                      "$target defined both conditionally and unconditionally");
-    }
+  }
 
   # Value here doesn't matter; for targets we only note existence.
   $targets{$target} = $where;
   if ($cond)
-    {
+  {
       if ($target_conditional{$target})
-       {
+      {
          &check_ambiguous_conditional ($target, $cond);
-       }
+      }
       $target_conditional{$target}{$cond} = $where;
-    }
+  }
 
 
   # Check the rule for being a suffix rule. If so, store in a hash.
 
   if ((my ($source_suffix, $object_suffix)) = ($target =~ 
$SUFFIX_RULE_PATTERN))
   {
-    $suffix_rules{$source_suffix} = $object_suffix;
-    print "Sources ending in .$source_suffix become .$object_suffix\n"
-      if $verbose;
-    # Set SUFFIXES from suffix_rules.
-    push @suffixes, ".$source_suffix", ".$object_suffix";
+      $suffix_rules{$source_suffix} = $object_suffix;
+      print "Sources ending in .$source_suffix become .$object_suffix\n"
+         if $verbose;
+      # Set SUFFIXES from suffix_rules.
+      push @suffixes, ".$source_suffix", ".$object_suffix";
   }
+
+  return 1;
 }
 
 
@@ -6815,7 +6821,7 @@
                     'HOST'     => $seen_canonical,
                     'TARGET'   => $seen_canonical == $AC_CANONICAL_SYSTEM,
 
-                    'EXEEXT'   => ($seen_exeext ? '$(EXEEXT)' : ''),
+                    'EXEEXT'   => '$(EXEEXT)',
 
                     'LIBTOOL'      => defined $configure_vars{'LIBTOOL'})
          # We don't need more than two consecutive new-lines.
@@ -6984,8 +6990,8 @@
                      && $cond ne 'FALSE')
                    {
                      $paragraph =~ s/^/make_condition (@cond_stack)/gme;
-                     $result_rules .= "$spacing$comment$paragraph\n";
-                     rule_define ($targets, $is_am, $cond, $file);
+                     $result_rules .= "$spacing$comment$paragraph\n"
+                         if rule_define ($targets, $is_am, $cond, $file);
                    }
                  $comment = $spacing = '';
                  last;
@@ -7273,11 +7279,8 @@
          }
 
        # A blatant hack: we rewrite each _PROGRAMS primary to include
-       # EXEEXT when in Cygwin32 mode.  You might think we could
-       # simply always use $(EXEEXT), since we define it as empty
-       # when it isn't available.  However, it isn't that simple.
-       # See nolink.test.
-       if ($seen_exeext && $primary eq 'PROGRAMS')
+       # EXEEXT when in Cygwin32 mode.
+       if ($primary eq 'PROGRAMS')
          {
            my @conds = &variable_conditions ($one_name);
 
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.29
diff -u -r1.29 init.m4
--- m4/init.m4 2001/07/17 05:40:56 1.29
+++ m4/init.m4 2001/07/22 02:01:17
@@ -52,6 +52,15 @@
 ifdef([m4_pattern_allow],
       [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
 
+# Autoconf 2.50 always computes EXEEXT.  However we need to be
+# compatible with 2.13, for now.  So we always define EXEEXT, but we
+# don't compute it.
+AC_SUBST(EXEEXT)
+# Similar for OBJEXT -- only we only use OBJEXT if the user actually
+# requests that it be used.  This is a bit dumb.
+: ${OBJEXT=o}
+AC_SUBST(OBJEXT)
+
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl



reply via email to

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