Subject: bug#74387: Cannot use Make conditionals (was: Cannot nest Make conditionals inside Automake conditionals)

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 17 Nov 2024 13:56:34 +0900

Hi,

The problem appears simpler than I first thought; it seems Automake is
hard-coded to expect 'endif' to be matched with its own 'if'; causing parsing
errors when attempting to use Make's conditional such as ifdef, ifeq,
etc. that also end with 'endif'.

This was reported 23 years ago here: https://lists.gnu.org/archive/html/bug-automake/2001-11/msg00015.html

There is workaround proposed that makes use of an output variable to hide the
'endif' behind it:

--8<---------------cut here---------------start------------->8---
ENDIF=endif
AC_SUBST(ENDIF)

and to apply this in Makefile.am:
ifdef f
        ..
@ENDIF@
--8<---------------cut here---------------end--------------->8---

I've tested the above and it appear to work, but perhaps Automake could
accommodate Make snippets better?

-- 
Thanks,
Maxim