[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch 3/3] AC_PROG_YACC
From: |
Akim Demaille |
Subject: |
Re: [Patch 3/3] AC_PROG_YACC |
Date: |
03 Mar 2002 21:02:59 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
| Modeled after AC_PROG_LEX; not sure if the output
| suffix check needs to be separate as with lex.
|
| 2002-03-03 Tim Van Holder <address@hidden>
|
| * lib/autoconf/programs.m4: (AC_PROG_LEX) Improve
| cleanup.
| (AC_PROG_YACC, _AC_PROG_YACC_OUTPUT_SUFFIX): New.
|
|
| Index: lib/autoconf/programs.m4
| ===================================================================
| RCS file: /cvs/autoconf/lib/autoconf/programs.m4,v
| retrieving revision 1.9
| diff -u -r1.9 programs.m4
| --- lib/autoconf/programs.m4 2 Mar 2002 15:19:48 -0000 1.9
| +++ lib/autoconf/programs.m4 3 Mar 2002 18:21:13 -0000
| @@ -369,12 +369,14 @@
| AC_TRY_EVAL(LEX conftest.l)
| if test -f lex.yy.c; then
| ac_cv_prog_lex_root=lex.yy
| + rm -f lex.yy.c
| elif test -f lexyy.c; then
| ac_cv_prog_lex_root=lexyy
| + rm -f lexyy.c
| else
| AC_MSG_ERROR([cannot find output from $LEX; giving up])
| -fi])
| -rm -f conftest.l
| +fi
| +rm -f conftest.l])
| AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
|
| AC_CACHE_CHECK(whether yytext is a pointer,
| ac_cv_prog_lex_yytext_pointer,
This is cool. Thanks.
| @@ -461,5 +521,33 @@
|
| # AC_PROG_YACC
| # ------------
| -AC_DEFUN([AC_PROG_YACC],
| -[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])
| +AC_DEFUN_ONCE([AC_PROG_YACC],
| +[AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc, :)
| +if test "x$YACC" != "x:"; then
| + _AC_PROG_YACC_OUTPUT_SUFFIX
| +fi])
| +
| +
| +# _AC_PROG_YACC_OUTPUT_SUFFIX
| +# ---------------------------
| +# Check what yacc uses as output suffix (.tab.* or _tab.*).
| +m4_define([_AC_PROG_YACC_OUTPUT_SUFFIX],
| +[AC_CACHE_CHECK($YACC output file suffix, ac_cv_prog_yacc_suffix,
| +[cat >conftest.y <<_ACEOF
| +%%
| +foo: /* dummy rule */;
| +%%
| +_ACEOF
| +AC_TRY_EVAL(YACC conftest.y)
| +if test -f y.tab.c; then
| + ac_cv_prog_yacc_suffix=.tab
| + rm -f y.tab.c
| +elif test -f y_tab.c; then
| + ac_cv_prog_yacc_suffix=_tab
| + rm -f y_tab.c
| +else
| + AC_MSG_ERROR([cannot find output from $YACC; giving up])
| +fi
| +rm -f conftest.y])
| +AC_SUBST([YACC_OUTPUT_SUFFIX], [$ac_cv_prog_yacc_suffix])dnl
| +])
I like this idea, but it lacks proper documentation, does not need to
be inside an macro (IMHO, LEX is different because of history, not for
sound reasons), and also lacks the NEWS bit. once these details
handled, commit at your convenience.
Hm... On a second tought, it is not very corret: it is backward
incompatible. With your patch, yacc or bison is now required.
Before, it was not. This is why LEX had two :( And IIRC, HPSux does
lack a proper yacc. Think of `missing' which knows how to handle this
situation: we are really regressing here.