This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Checking the output filename of YACC


This patch provides a macro for autoconf to check the right
output filename base for YACC. On DJGPP there is "bison -y"
used and the produced file is there y_tab.c and not y.tab.c

In the second patch, this macro is inserted in configure.in
and in the third patch it is applied to the Makefile.in.

This patch is against "a March 10th snapshot from DJ"
which I got from DJ Delorie.

Sun Mar 14 1999 Robert Hoehne <robert.hoehne@gmx.net>

	* aclocal.m4: new macro AC_YACC_OUTPUT_BASE
	* configure.in: Calling that macro after AC_PROG_YACC
	* Makefile.in: Using now @YACC_OUTPUT_BASE@ instead of y.tab

--- gdb-snap-march-10th-from-DJ/gdb/aclocal.m4.orig	Wed Feb 24 21:06:26 1999
+++ gdb-snap-march-10th-from-DJ/gdb/aclocal.m4	Sun Mar 14 18:03:06 1999
@@ -1305,3 +1305,22 @@
     fi
   fi])
 
+# Check for the default output filename of YACC which is for instance
+# y_tab.cc on DJGPP
+AC_DEFUN(AC_YACC_OUTPUT_BASE,
+  AC_CACHE_CHECK([for YACC output file base], YACC_OUTPUT_BASE,
+    [cat <<\EOF > conftest.y
+%%
+conftest:;
+%%
+EOF
+    $YACC conftest.y
+    if test -f y_tab.c
+    then
+      YACC_OUTPUT_BASE=y_tab
+    else
+      YACC_OUTPUT_BASE=y.tab
+    fi
+    rm -f conftest.y $YACC_OUTPUT_BASE.c])
+)
+
--- gdb-snap-march-10th-from-DJ/gdb/configure.in.orig	Thu Mar 11 19:56:54 1999
+++ gdb-snap-march-10th-from-DJ/gdb/configure.in	Sun Mar 14 17:11:52 1999
@@ -59,6 +59,8 @@
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 AC_PROG_YACC
+AC_YACC_OUTPUT_BASE
+AC_SUBST(YACC_OUTPUT_BASE)
 
 AC_ARG_PROGRAM
 
--- gdb-snap-march-10th-from-DJ/gdb/Makefile.in.orig	Thu Mar 11 19:56:54 1999
+++ gdb-snap-march-10th-from-DJ/gdb/Makefile.in	Sun Mar 14 22:16:18 1999
@@ -826,42 +826,42 @@
 # Makefile.in, but that was a pretty big annoyance.
 c-exp.tab.o: c-exp.tab.c
 c-exp.tab.c: c-exp.y
-	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/c-exp.y  y.tab.c c-exp.tmp -- $(YFLAGS) 
+	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/c-exp.y  @YACC_OUTPUT_BASE@.c c-exp.tmp -- $(YFLAGS)
 	-sed -e '/extern.*malloc/d' \
 	     -e '/extern.*realloc/d' \
 	     -e '/extern.*free/d' \
 	     -e '/include.*malloc.h/d' \
 	     -e 's/malloc/xmalloc/g' \
 	     -e 's/realloc/xrealloc/g' \
-	     -e '/^#line.*y.tab.c/d' \
+	     -e '/^#line.*@YACC_OUTPUT_BASE@.c/d' \
 	  < c-exp.tmp > c-exp.new
 	-rm c-exp.tmp
 	mv c-exp.new ./c-exp.tab.c
 
 jv-exp.tab.o: jv-exp.tab.c
 jv-exp.tab.c: jv-exp.y
-	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/jv-exp.y  y.tab.c jv-exp.tmp -- $(YFLAGS) 
+	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/jv-exp.y  @YACC_OUTPUT_BASE@.c jv-exp.tmp -- $(YFLAGS)
 	-sed -e '/extern.*malloc/d' \
 	     -e '/extern.*realloc/d' \
 	     -e '/extern.*free/d' \
 	     -e '/include.*malloc.h/d' \
 	     -e 's/malloc/xmalloc/g' \
 	     -e 's/realloc/xrealloc/g' \
-	     -e '/^#line.*y.tab.c/d' \
+	     -e '/^#line.*@YACC_OUTPUT_BASE@.c/d' \
 	  < jv-exp.tmp > jv-exp.new
 	-rm jv-exp.tmp
 	mv jv-exp.new ./jv-exp.tab.c
 
 f-exp.tab.o: f-exp.tab.c
 f-exp.tab.c: f-exp.y c-exp.tab.c
-	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/f-exp.y  y.tab.c f-exp.tmp -- $(YFLAGS) 
+	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/f-exp.y  @YACC_OUTPUT_BASE@.c f-exp.tmp -- $(YFLAGS)
 	-sed -e '/extern.*malloc/d' \
 	     -e '/extern.*realloc/d' \
 	     -e '/extern.*free/d' \
 	     -e '/include.*malloc.h/d' \
 	     -e 's/malloc/xmalloc/g' \
 	     -e 's/realloc/xrealloc/g' \
-	     -e '/^#line.*y.tab.c/d' \
+	     -e '/^#line.*@YACC_OUTPUT_BASE@.c/d' \
 	  < f-exp.tmp > f-exp.new
 	-rm f-exp.tmp
 	mv f-exp.new ./f-exp.tab.c
@@ -872,14 +872,14 @@
 # else.
 m2-exp.tab.o: m2-exp.tab.c
 m2-exp.tab.c: m2-exp.y
-	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/m2-exp.y  y.tab.c m2-exp.tmp -- $(YFLAGS) 
+	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/m2-exp.y  @YACC_OUTPUT_BASE@.c m2-exp.tmp -- $(YFLAGS)
 	-sed -e '/extern.*malloc/d' \
 	     -e '/extern.*realloc/d' \
 	     -e '/extern.*free/d' \
 	     -e '/include.*malloc.h/d' \
 	     -e 's/malloc/xmalloc/g' \
 	     -e 's/realloc/xrealloc/g' \
-	     -e '/^#line.*y.tab.c/d' \
+	     -e '/^#line.*@YACC_OUTPUT_BASE@.c/d' \
 	  < m2-exp.tmp > m2-exp.new
 	-rm m2-exp.tmp
 	mv m2-exp.new ./m2-exp.tab.c

******************************************************
* email:   Robert Hoehne <robert.hoehne@gmx.net>     *
* Post:    Am Berg 3, D-09573 Dittmannsdorf, Germany *
* WWW:     http://www.tu-chemnitz.de/~sho/rho        *
******************************************************