Subject: bug#26031: EXEEXT not working with "make check"

From: [email-masked] (Peter Selinger)
Date: Wed, 8 Mar 2017 15:05:44 -0400 (AST)

Summary: 
========

"make check" does not respect $(EXEEXT)

To reproduce:
=============

Please see the attached minimal package testing-0.0.tar.gz

This succeeds:

$ ./configure
$ make check

This also succeeds:

$ ./configure ac_cv_exeext=.exe
$ make check

This fails:

$ ./configure
$ make EXEEXT=.exe check

Output from failure:
====================

Making check in check
make[1]: Entering directory '/home/selinger/projects/ccrypt/automake-bug/check'
make  mytest.exe
make[2]: Entering directory '/home/selinger/projects/ccrypt/automake-bug/check'
gcc  -g -O2   -o mytest.exe mytest.o  
make[2]: Leaving directory '/home/selinger/projects/ccrypt/automake-bug/check'
make  check-TESTS
make[2]: Entering directory '/home/selinger/projects/ccrypt/automake-bug/check'
make[3]: Entering directory '/home/selinger/projects/ccrypt/automake-bug/check'
make[4]: Entering directory '/home/selinger/projects/ccrypt/automake-bug/check'
make[4]: Nothing to be done for 'mytest.exe.log'.
make[4]: Leaving directory '/home/selinger/projects/ccrypt/automake-bug/check'
fatal: making test-suite.log: failed to create mytest.exe.trs
fatal: making test-suite.log: failed to create mytest.exe.log
Makefile:580: recipe for target 'test-suite.log' failed
make[3]: *** [test-suite.log] Error 1
make[3]: Leaving directory '/home/selinger/projects/ccrypt/automake-bug/check'
Makefile:686: recipe for target 'check-TESTS' failed
make[2]: *** [check-TESTS] Error 2
make[2]: Leaving directory '/home/selinger/projects/ccrypt/automake-bug/check'
Makefile:759: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/selinger/projects/ccrypt/automake-bug/check'
Makefile:349: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

Analysis:
=========

The problem seems to be that the generated Makefile contains a rule
for building mytest.log, but actually tries to build mytest.exe.log
(for which no recipe is generated). Indeed the following succeeds
after ./configure:

$ make EXEEXT=.exe mytest.log
gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT mytest.o -MD -MP -MF .deps/mytest.Tpo -c -o mytest.o mytest.c
mv -f .deps/mytest.Tpo .deps/mytest.Po
gcc  -g -O2   -o mytest.exe mytest.o
PASS: mytest.exe

Maybe this behavior is intentional (i.e., EXEEXT should be configured
at configuration time, not make time). However, it seems that the
generated check/Makefile contains .exe hardwired in three places, of
which two are unnecessary:

TEST_EXTENSIONS = .exe .test
am__test_logs2 = $(am__test_logs1:.exe.log=.log)
EXEEXT = .exe

It would be more logical to use $(EXEEXT) instead of the
hardwired value in the first two places:

TEST_EXTENSIONS = $(EXEEXT) .test
am__test_logs2 = $(am__test_logs1:$(EXEEXT).log=.log)
EXEEXT = .exe

Indeed, with the above change to the Makefile,

$ make EXEEXT=.gaga check

now works without problems.

Automake version:
=================

automake (GNU automake) 1.15

Build host:
===========

Ubuntu 16.10

Linux puffin.mathstat.dal.ca 4.8.0-32-generic #34-Ubuntu SMP Tue Dec 13 14:30:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

test-suite.log:
===============

I cannot include this file because none is generated (the recipe for
test-suite-log did not complete).

Please let me know if there is additional info you need from me.
Thanks, -- Peter