This is fixed in automake 1.12 and later.
The problem is that the ylwrap helper script creates a temporary directory
when running flex. Flex then correctly creates the scanner.h file inside this
temporary directory, but ylwrap does not copy it back to the build dir.
-I$(top_srcdir)/src/common \
-I$(top_builddir)/src/common
-I$(top_srcdir)/src/common \
-I$(top_builddir)/src/common
-# Option -d: produce header file scanner.h
-AM_LFLAGS = --header-file=scanner.h
+# Option --header-file: produce header file scanner.h.
+# Using abs_builddir as a workaround for automake-1.11
+# broken ylwrap script.
+AM_LFLAGS = --header-file=$(abs_builddir)/scanner.h
# Option -d: produce header file parser.h
AM_YFLAGS = -d
# Option -d: produce header file parser.h
AM_YFLAGS = -d