]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] refactor: get rid of am__EXEEXT (automake conditional and %transform)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 7 May 2012 14:38:12 +0000 (16:38 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 16 May 2012 08:04:57 +0000 (10:04 +0200)
We can substitute that with a static automake conditional %HANDLE-EXEEXT%
and a make runtime check on the non-emptiness of $(EXEEXT).

* automake.in (preprocess_file): New transform '%HANDLE-EXEEXT%', TRUE
if 'EXEEXT' has been AC_SUBST'd, FALSE otherwise.
(handle_tests): Don't define the transform '%HANDLE-EXEEXT%' anymore
when processing 'check.am': that is now done transparently by the
'preprocess_file' function.
(handle_per_suffix_test): Don't process the transform '%am__EXEEXT%'
anymore when reading 'check2.am'.  It's superseded by '%HANDLE-EXEEXT%'
and ...
* lib/am/check2.am [%HANDLE-EXEEXT%]: ... by a make-runtime check that
$(EXEEXT) is not empty.
* m4/init.m4 (AM_INIT_AUTOMAKE): Simplify, taking advantage of the fact
that we don't need the Automake conditional "am__EXEEXT" anymore.
* t/parallel-tests-exeext.sh: Tiny simplification.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
automake.in
lib/am/check2.am
m4/init.m4
t/parallel-tests-exeext.sh

index 1b8462ddc5dda081ca8724674d3e78bf2a9e6d88..3983eb8bea492e553bf5640591f3d7e1a5567686 100644 (file)
@@ -4642,7 +4642,7 @@ sub handle_tests_dejagnu
 sub handle_per_suffix_test($)
 {
   my $test_suffix = shift;
-  my ($pfx, $parallel_tests_option, $am_exeext);
+  my ($pfx, $parallel_tests_option);
   prog_error ("called with 'parallel-tests' option not set")
     unless $parallel_tests_option = option 'parallel-tests';
   if ($test_suffix eq '')
@@ -4655,8 +4655,6 @@ sub handle_per_suffix_test($)
         unless $test_suffix =~ m/^\.(.*)/;
       $pfx = uc ($1) . '_';
     }
-  $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
-                                                  : 'FALSE';
   # The "test driver" program, deputed to handle tests protocol used by
   # test scripts.  By default, it's assumed that no protocol is used,
   # so we fall back to the old "parallel-tests" behaviour, implemented
@@ -4671,8 +4669,7 @@ sub handle_per_suffix_test($)
     }
   $output_rules .= file_contents ('check2', new Automake::Location,
                                    PFX => $pfx,
-                                   EXT => $test_suffix,
-                                   am__EXEEXT => $am_exeext);
+                                   EXT => $test_suffix);
 }
 
 # is_valid_test_extension ($EXT)
@@ -4711,9 +4708,7 @@ sub handle_tests
       $output_rules .= &file_contents ('check', new Automake::Location,
                                       COLOR => !! option 'color-tests',
                                       PARALLEL_TESTS => !! option 'parallel-tests',
-                                       CHECK_DEPS => "@check",
-                                       'HANDLE-EXEEXT' => (exists $configure_vars{'EXEEXT'} ?
-                                                           'TRUE' : 'FALSE'));
+                                       CHECK_DEPS => "@check");
 
       if (my $parallel_tests = option 'parallel-tests')
         {
@@ -6736,6 +6731,8 @@ sub preprocess_file ($%)
 
                 'LIBTOOL'      => !! var ('LIBTOOL'),
                 'NONLIBTOOL'   => 1,
+                 'HANDLE-EXEEXT' => (exists $configure_vars{'EXEEXT'} ?
+                                     'TRUE' : 'FALSE'),
                %transform);
 
   if (! defined ($_ = $am_file_cache{$file}))
index 19aef6376ff9a84ae9405ab35fb2e3971c1ee122..a9a4a477f42775343700ad3ca770e57300b56050 100644 (file)
@@ -37,10 +37,12 @@ endif %?FIRST%
        @$(call am__runtest,%PFX%)
 
 ## If no programs are built in this package, then this rule is removed
-## at automake time.  Otherwise, %am__EXEEXT% expands to a configure time
-## conditional, true if $(EXEEXT) is nonempty, thus this rule does not
-## conflict with the previous one.
-if %am__EXEEXT%
+## at automake time.
+if %HANDLE-EXEEXT%
+## FIXME: spurious indentnation to avoid Automake thinking this is an
+##        automake conditional.
+  ifdef EXEEXT
 %.log %.trs: %%EXT%$(EXEEXT)
        @$(call am__runtest,%PFX%)
-endif %am__EXEEXT%
+  endif
+endif %HANDLE-EXEEXT%
index 469a19b337ee1cd4a185efd2df51bb3c1d4a9768..21983e9d2fbe510c32e5108f1efa339a2fc8b529 100644 (file)
@@ -107,20 +107,7 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
                  [m4_define([AC_PROG_OBJCXX],
                             m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
-AC_REQUIRE([AM_SILENT_RULES])dnl
-dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
-dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
-AC_CONFIG_COMMANDS_PRE(dnl
-[m4_provide_if([_AM_COMPILER_EXEEXT],
-  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
-
-dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
-dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
-dnl mangled by Autoconf and run in a shell conditional statement.
-m4_define([_AC_COMPILER_EXEEXT],
-m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+AC_REQUIRE([AM_SILENT_RULES])])
 
 
 # When config.status generates a header, we must update the stamp-h file.
index 14cb753f283aa374e4b19497ec9717b026dcb6d1..1a3a788f4cf82373453fd85f9bc784870abeb77e 100755 (executable)
@@ -22,11 +22,8 @@ am_parallel_tests=yes
 
 cat >> configure.ac << 'END'
 dnl We need to fool the init.m4 internals a little.
-AC_DEFUN([_AM_FOO],
-  [m4_provide([_AM_COMPILER_EXEEXT])
-  AC_SUBST([CC], [false])
-  AC_SUBST([EXEEXT])])
-_AM_FOO
+AC_SUBST([CC], [false])
+AC_SUBST([EXEEXT])
 AC_OUTPUT
 END