[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patch 3/3] AC_PROG_YACC
From: |
Tim Van Holder |
Subject: |
[Patch 3/3] AC_PROG_YACC |
Date: |
Sun, 3 Mar 2002 19:36:10 +0100 |
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,
@@ -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
+])
- [Patch 3/3] AC_PROG_YACC,
Tim Van Holder <=