Subject: bug#53780: Automake failing with conditional AC_CONFIG_FILES

From: Valio Valtokari <[email-masked]>
Date: Fri, 4 Feb 2022 17:12:04 +0200

Hello,

I have a project that supports multiple platforms (windows and linux as of
right now). To implement testing functionality I use a library that I
haven't configured for windows in my project yet. As such, my configure.ac
has these lines:

AC_CONFIG_FILES([Makefile:src/Makefile])
AM_COND_IF([OS_LINUX], [
    PKG_CHECK_MODULES([CHECK], [check>=0.9])
    AC_CONFIG_FILES([tests/Makefile])
], [])

This seemingly causes automake to crash with:

automake-1.16: error: Makefile:src/Makefile in @other_input_files
automake-1.16: @other_input_files = (Makefile:src/Makefile)
automake-1.16: Please contact <[email-masked]>.
 at /usr/share/automake-1.16/Automake/Channels.pm line 655.
        Automake::Channels::msg("automake", "", "Makefile:src/Makefile in
\@other_input_files\x{a}\@other_input_file"...) called at
/usr/share/automake-1.16/Automake/ChannelDefs.pm line 226
        Automake::ChannelDefs::prog_error("Makefile:src/Makefile in
\@other_input_files\x{a}\@other_input_file"...) called at
/usr/bin/automake-1.16 line 4311
        Automake::handle_configure("tests/Makefile.am",
"tests/Makefile.in", "tests/Makefile", "tests/Makefile.in") called at
/usr/bin/automake-1.16 line 7950
        Automake::generate_makefile("tests/Makefile.am",
"tests/Makefile.in") called at /usr/bin/automake-1.16 line 8257
        Automake::handle_makefile("tests/Makefile.in") called at
/usr/bin/automake-1.16 line 8269
        Automake::handle_makefiles_serial() called at
/usr/bin/automake-1.16 line 8401
autoreconf: error: automake failed with exit status: 255

I'm running on msys2. Any help would be appreciated.