Subject: bug#20300: Are paths containing directories allowed in AC_REQUIRE_AUX_FILE?

From: Moritz Klammler <[email-masked]>
Date: Sat, 11 Apr 2015 02:56:25 +0200

Hello everybody,

last week, I have asked this question on Stack Overflow [1] but did not
receive any answer.  I'll be happy to post a summary of the replies I'll
get on this list there.  But if you have an account and want to gain
some valuable internet points, I'll accept your answer, of course.

Please consider this directory structure

    demo/
    demo/Makefile.am
    demo/build-aux/
    demo/build-aux/bar/
    demo/build-aux/bar/baz.txt
    demo/build-aux/foo.txt
    demo/configure.ac

with the following `configure.ac`

     AC_PREREQ([2.69])
     AC_INIT([example], [1.0], [[email-masked]])
     AC_CONFIG_AUX_DIR([build-aux])
     AC_REQUIRE_AUX_FILE([foo.txt])      # this works
     AC_REQUIRE_AUX_FILE([bar/baz.txt])  # this does not work
     AM_INIT_AUTOMAKE([foreign])
     AC_OUTPUT([Makefile])

and an empty `Makefile.am`.  I have attached a tar ball with this setup
for your convenience.

As indicated by the comments, the invocation of `AC_REQUIRE_AUX_FILE`
for `bar/baz.txt` does not work as expected.  If running `autoreconf`
From the top-level directory, Automake will fail with the following
error message:

    $ test -f build-aux/bar/baz.txt && autoreconf -ivs
    autoreconf: Entering directory `.'
    autoreconf: configure.ac: not using Gettext
    autoreconf: running: aclocal
    autoreconf: configure.ac: tracing
    autoreconf: configure.ac: not using Libtool
    autoreconf: running: /usr/bin/autoconf
    autoreconf: configure.ac: not using Autoheader
    autoreconf: running: automake --add-missing --no-force
    configure.ac:5: error: required file 'build-aux/bar/baz.txt' not found
    configure.ac:6: installing 'build-aux/install-sh'
    configure.ac:6: installing 'build-aux/missing'
    autoreconf: automake failed with exit status: 1

Note that the reported error names the file name exactly as expected but
incorrectly says it does not exist.

I have checked the documentation for `AC_REQUIRE_AUX_FILE` in the
Autoconf manual [2] as well as what I consider the relevant reference in
the Automake manual [3] and none of this suggests to me that I shouldn't
be allowed to list file names in sub-directories of ${auxdir} here.

It seems to me that the error message is triggered by the function
`rewrite_inputs_into_dependencies` in `automake.in` [4] but I cannot
trace back the logic due to my limited Perl skills.

Am I missing something here?  Is this intended to work?  If naming paths
containing directory parts is not allowed, could the manual be updated
to say so?

Thank you & kind regards

Moritz Klammler

Autoconf version: 2.69
Automake version: 1.15
Platform: Parabola GNU/Linux

References:

[1] https://stackoverflow.com/q/29445704/1392132
[2] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Input.html#index-AC_005fREQUIRE_005fAUX_005fFILE-60
[3] https://www.gnu.org/software/automake/manual/html_node/Optional.html
[4] http://git.savannah.gnu.org/cgit/automake.git/tree/bin/automake.in#n3775
-- 
OpenPGP:

Public Key:   http://openpgp.klammler.eu
Fingerprint:  80C1 EC79 B554 3D84 0A35 A728 7057 B288 CE61 2235