GNU bug report logs - #7804
Automake does not warn if AM_YFLAGS is conditionally extended

Previous Next

Package: automake;

Reported by: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Date: Fri, 7 Jan 2011 22:26:01 UTC

Severity: normal

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: bug-automake <at> gnu.org
Subject: Automake does not warn if AM_YFLAGS is conditionally extended
Date: Fri, 7 Jan 2011 23:31:59 +0100
Hello automakers.

Due to current implementation details, when dealing with Yacc sources, automake
must know the contents of the `$(AM_YFLAGS)' variable (or similar `$(foo_YFLAGS)'
variables) *statically and unconditionally* in order to always generate proper
code.

This is due to the special handling of the `-d' yacc flag; on this issue, read
at <http://www.gnu.org/software/automake/manual/html_node/Yacc-and-Lex.html>:
 ``AM_YFLAGS is usually used to pass the -d option to yacc. Automake knows what
   this means and will automatically adjust its rules to update and distribute
   the header file built by 'yacc -d'. ''

And while automake correctly warns if AM_YFLAGS is conditionally *defined*:

  $ cat configure.ac
  AC_INIT(x,0)
  AM_INIT_AUTOMAKE(foreign)
  AC_PROG_CC
  AC_PROG_YACC
  AC_CONFIG_FILES(Makefile)
  AM_CONDITIONAL(COND,:)
  $ aclocal
  $ cat > Makefile.am <<'END'
  bin_PROGRAMS = foo bar
  foo_SOURCES = foo.y
  bar_SOURCES = bar.y
  if COND
  AM_YFLAGS = -d
  endif
  END
  $ automake -a -Werror; echo status=$?
  Makefile.am:5: automake does not support AM_YFLAGS being defined conditionally
  status=1

it erronously doesn't warn if AM_YFLAGS is conditionally *extended*:

  $ cat configure.ac
  AC_INIT(x,0)
  AM_INIT_AUTOMAKE(foreign)
  AC_PROG_CC
  AC_PROG_YACC
  AC_CONFIG_FILES(Makefile)
  AM_CONDITIONAL(COND,:)
  $ aclocal
  $ cat > Makefile.am <<'END'
  bin_PROGRAMS = foo bar
  foo_SOURCES = foo.y
  bar_SOURCES = bar.y
  AM_YFLAGS =
  if COND
  AM_YFLAGS += -d
  endif
  END
  $ automake -a -Werror; echo status=$?
  status=0

I think this bug shouldn't be difficult to fix, and I'll attempt a fix
soonish; but as usual, having it in the bug tracker doesn't hurt IMHO.

Regards,
  Stefano





This bug report was last modified 14 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.