bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7804: Automake does not warn if AM_YFLAGS is conditionally extended


From: Stefano Lattarini
Subject: bug#7804: Automake does not warn if AM_YFLAGS is conditionally extended
Date: Fri, 7 Jan 2011 23:31:59 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]