On 01/04/12 01:06, Peter Rosin wrote: > Or did you mean that configure should only #define YY_NO_UNISTD_H > when there is no unistd.h (ac_cv_header_unistd_h=no)?
Yes, that's the idea, it should define YY_NO_UNISTD_H as needed. Something like the following. Does this work for you? autoconf: don't assume unistd.h when checking lex * lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Define YY_NO_UNISTD_H if there's no unistd.h; this works around a flex bug. Problem reported by Peter Rosin in: http://lists.gnu.org/archive/html/autoconf-patches/2011-12/msg00011.html diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4 index 2013a7a..24ccc19 100644 --- a/lib/autoconf/programs.m4 +++ b/lib/autoconf/programs.m4 @@ -718,7 +718,13 @@ fi]) # Check for the Lex output root, the Lex library, and whether Lex # declares yytext as a char * by default. m4_define([_AC_PROG_LEX_YYTEXT_DECL], -[cat >conftest.l <<_ACEOF[ +[AC_CHECK_HEADERS_ONCE([unistd.h]) +cat >conftest.l <<_ACEOF[ +%{ +#ifndef HAVE_UNISTD_H +# define YY_NO_UNISTD_H 1 +#endif +%} %% a { ECHO; } b { REJECT; }