From: Stefano Lattarini Date: Mon, 7 May 2012 14:38:12 +0000 (+0200) Subject: [ng] refactor: get rid of am__EXEEXT (automake conditional and %transform) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8f56923e0adc291c0b1cdd556fda17645d3b9f1;p=thirdparty%2Fautomake.git [ng] refactor: get rid of am__EXEEXT (automake conditional and %transform) 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 --- diff --git a/automake.in b/automake.in index 1b8462ddc..3983eb8be 100644 --- a/automake.in +++ b/automake.in @@ -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})) diff --git a/lib/am/check2.am b/lib/am/check2.am index 19aef6376..a9a4a477f 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 469a19b33..21983e9d2 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 14cb753f2..1a3a788f4 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