AC_PROG_LEX: Be compatible with Solaris 10 lex’s handling of C++.
Solaris 10 lex (Software Generation Utilities (SGU) Solaris-ELF (4.0))
provides its own declaration of yywrap. When the generated scanner is
compiled as C++, that declaration will *not* be tagged with `extern "C"`
unless the preprocessor macro __EXTERN_C__ is defined using -D.
The %{ %} block of the .l file is too late.
Our test .l file also declares yywrap, and it unconditionally tags it
with `extern "C"` when compiling as C++. Thus, we need to define
__EXTERN_C__ or we’ll get a spurious compile error with this
implementation of lex. This macro should be harmless with other
implementations.
sr #111381
* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Add -D__EXTERN_C__=1
to CPPFLAGS while compiling test programs, for improved compatibility
with Solaris 10 lex.
1 file changed