automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 02/11] [ng] refactor: get rid of am__EXEEXT (automa


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 02/11] [ng] refactor: get rid of am__EXEEXT (automake conditional and %transform)
Date: Wed, 9 May 2012 11:30:07 +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 <address@hidden>
---
 automake.in                |   13 +++++--------
 lib/am/check2.am           |   12 +++++++-----
 m4/init.m4                 |   15 +--------------
 t/parallel-tests-exeext.sh |    7 ++-----
 4 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/automake.in b/automake.in
index e735359..eecbb92 100644
--- a/automake.in
+++ b/automake.in
@@ -4691,7 +4691,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 '')
@@ -4704,8 +4704,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
@@ -4720,8 +4718,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)
@@ -4760,9 +4757,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')
         {
@@ -6781,6 +6776,8 @@ sub preprocess_file ($%)
 
                 'LIBTOOL'      => !! var ('LIBTOOL'),
                 'NONLIBTOOL'   => 1,
+                 'HANDLE-EXEEXT' => (exists $configure_vars{'EXEEXT'} ?
+                                     'TRUE' : 'FALSE'),
                %transform);
 
   if (! defined ($_ = $am_file_cache{$file}))
diff --git a/lib/am/check2.am b/lib/am/check2.am
index 19aef63..a9a4a47 100644
--- a/lib/am/check2.am
+++ b/lib/am/check2.am
@@ -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%
diff --git a/m4/init.m4 b/m4/init.m4
index 469a19b..21983e9 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -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.
diff --git a/t/parallel-tests-exeext.sh b/t/parallel-tests-exeext.sh
index 14cb753..1a3a788 100755
--- a/t/parallel-tests-exeext.sh
+++ b/t/parallel-tests-exeext.sh
@@ -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
 
-- 
1.7.9.5




reply via email to

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