Search code examples
autotoolsautomake

How to make automake silent about missing files?


To build one project, I am using automake:

automake --foreign --add-missing --copy

The output is currently too verbose on standard error:

configure.ac:50: installing 'config/compile'
Makefile.am: installing 'config/depcomp'

These lines come on standard error output, even though they are not errors (unless I am mistaken).

So, is it possible to avoid this installing output on standard error? I do not want to redirect standard error to standard in or /dev/null, I still want errors on standard error if they are real errors, but I do not want "non-errors" on standard error.

Ideally, I would also avoid having to copy these files from automake into the repository since then I would have to maintain them.


Solution

  • The output is currently too verbose on standard error:

    configure.ac:50: installing 'config/compile'
    Makefile.am: installing 'config/depcomp'
    

    Well, ok. Yes, automake will report on files it adds to your project. And it will report each one only once, unless you remove them again or --force, so if you consider this a problem then it's one that solves itself.

    These lines come on standard error output, even though they are not errors (unless I am mistaken).

    You seem to be reading too much into the name "standard error". Although this stream is an appropriate destination for error messages, it is not restricted to such messages, neither by design nor by convention. For programs whose primary activity is something other than producing output on the standard output, there isn't any particularly strong rule for what should be written to stdout vs. what should be written to stderr.

    So, is it possible to avoid this installing output on standard error? I do not want to redirect standard error to standard in or /dev/null, I still want errors on standard error if they are real errors, but I do not want "non-errors" on standard error.

    There is no documented mechanism to suppress automake's diagnostic output about copying these files. If you want to avoid seeing that then you'll need to either hack automake or filter it out. If you are running automake from Bash then you might accomplish the latter like so:

    automake --foreign --add-missing --copy 2> >(grep -v installing 1>&2)
    

    Really, though, I don't see what the big deal is.

    Ideally, I would also avoid having to copy these files from automake into the repository since then I would have to maintain them.

    So this is not so much about you as about others who might build your project from an incomplete distribution? I really think you're worrying too much.

    Moreover, although I know that it has become fashionable to omit autotools-derived files from source control, I find that wrong-headed, at least to the extent that source-control systems are pressed into doing double duty as distribution systems. The files in question are meant to be distributed together with the rest of the project, with the result that a local copy of the autotools is not required for building the project. And that's not only a matter of convenience, but also of protecting those building your project from the problems that can arise from using a different version of one or more the Autotools than the project was developed with.

    Additionally, if you're giving build instructions intended to account for the missing files then I would strongly suggest that you recommend ...

    autoreconf --install --force
    

    ... instead of running various autotools individually or running automake alone. The --force could possibly be omitted if you're careful keep the distribution clean of any of the files that it would cause to be overwritten, but even then it is not harmful.