[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch 3/3] AC_PROG_YACC
From: |
Tim Van Holder |
Subject: |
Re: [Patch 3/3] AC_PROG_YACC |
Date: |
Sat, 9 Mar 2002 14:06:47 +0100 |
Revision 2 follows.
Index: NEWS
===================================================================
RCS file: /cvs/autoconf/NEWS,v
retrieving revision 1.220
diff -u -r1.220 NEWS
--- NEWS 25 Feb 2002 17:38:41 -0000 1.220
+++ NEWS 9 Mar 2002 12:41:02 -0000
@@ -100,6 +100,10 @@
- AC_PREFIX_PROGRAM
Works with shell variables, and non alphanumeric names.
+- AC_PROG_YACC
+ Now checks what suffix is used by yacc (.tab.* or _tab.*); this is
needed
+ for proper support for DOSish systems in makefile rules.
+
** Library macros
- AC_FUNC_STRERROR_R now sets STRERROR_R_CHAR_P, not
HAVE_WORKING_STRERROR_R,
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.587
diff -u -r1.587 autoconf.texi
--- doc/autoconf.texi 2 Mar 2002 23:22:27 -0000 1.587
+++ doc/autoconf.texi 9 Mar 2002 12:41:11 -0000
@@ -3138,6 +3138,8 @@
If @code{bison} is found, set output variable @code{YACC} to
@samp{bison
-y}. Otherwise, if @code{byacc} is found, set @code{YACC} to
@samp{byacc}. Otherwise set @code{YACC} to @samp{yacc}.
+Then check what suffix (@samp{.tab} or @samp{_tab}) is used by that
program.
+This is needed for proper support for DOSish systems in makefile rules.
@end defmac
@node Generic Programs
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 9 Mar 2002 12:41: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 +463,27 @@
# 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)
+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
+dnl For historical reasons, YACC is set to yacc even if no yacc was
+dnl found. So we have to default to .tab if we can't find the output.
+ AC_MSG_WARN([cannot find output from $YACC])
+ ac_cv_prog_yacc_suffix=.tab
+fi
+rm -f conftest.y])
+AC_SUBST([YACC_OUTPUT_SUFFIX], [$ac_cv_prog_yacc_suffix])dnl
+fi])