Re: [Bug-gnulib] AC_PROG_YACC

Derek Robert Price <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs,gmane.comp.version-control.cvs.bugs,gmane.comp.lib.gnulib.bugs
Organization Ximbiot <http://ximbiot.com>
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Let me start over - I missed a mistake Bruno made in his last email:

Derek Robert Price wrote:

> Bruno Haible wrote:
>
> >Derek Robert Price wrote:
>
> >>It appears that some `make's (notably some BSDs) have a default
> >>setting for YFLAGS (YFLAGS = -d) that some of my users are not happy
> >>with.  It breaks builds, notably with the GNULIB getdate package,
> >>which comes with its own getdate.h header (which gets overwritten by
> >>calls to `bison -y -d getdate.y'...).  Is this something that
> >>AC_PROG_YACC (or gl_BISON for the GNULIB folks) should be checking for
> >>and dealing with?
> >>
> >>My workaround will be to just stick a `YFLAGS=' line in my
> >>Makefile.am, but I thought you might like the bug report.
>
>
> >The automake documentation says:
> > "When `yacc' is invoked, it is passed `YFLAGS' and `AM_YFLAGS'.  The
> >  former is a user variable and the latter is intended for the
> >  `Makefile.am' author."
>
> >So this means, YFLAGS is meant as a variable through which the user can
> >influence the compilation (like CFLAGS, CPPFLAGS, LDFLAGS etc.). By
> >setting it to empty, you give the user less freedom.


Not true.  I am _defaulting_ it to empty by setting it via configure.
The user can still override it as an argument to configure or make
(`./configure YFLAGS=-d 'or `make YFLAGS=-d').

> >I'd say, since option '-d' is not appropriate in all cases, it's a
>
> mistake
>
> >to use it by default. The bug is therefore in the BSD make.
>
> I'm afraid I agree with you.  It might still make sense to have an
> autoconf workaround for the bug, when detected, however.


I still agree with you but I still think a workaround in macros is
appropriate, both GNULIB & Autoconf.  My new solution just AC_ARG_VARs
both YACC & YFLAGS, as CC, CFLAGS, CPPFLAGS, etc. are AC_ARG_VARed by
other autoconf macros and require the user override them as arguments
to configure or make.  Nobody seems to have a problem with autoconf
doing that for CC, CFLAGS, CPPFLAGS, etc.

Revision 3 of patch for GNULIB attached.  I think similar AC_ARG_VAR
statements for YACC & YFLAGS for AC_PROG_YACC would also be appropriate.

Derek
- --
                *8^)

Email: [email protected]

Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAloiILD1OTBfyMaQRAnpdAJ9gYR3HaJ3/1xQShsRonjFA125aQACgmcvK
IMI6fua+PN5LP/gQv420nvI=
=Ljfg
-----END PGP SIGNATURE-----
05.3bison-missing.diff (text/plain, 1.3 KB)
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/ChangeLog,v
retrieving revision 1.148
diff -u -p -r1.148 ChangeLog
--- ChangeLog	27 Apr 2004 22:11:37 -0000	1.148
+++ ChangeLog	3 May 2004 17:52:45 -0000
@@ -1,3 +1,8 @@
+2004-05-03  Derek Price  <[email protected]>
+
+	* m4/bison.m4: Use AM_MISSING_PROG rather than a set/subst combination.
+	AC_ARG_VAR() YACC & YFLAGS.
+
 2004-04-27  Derek Price  <[email protected]>
 
 	* m4/dos.m4 (gl_AC_DOS): Add Cygwin to list of Windows/DOS
Index: m4/bison.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/bison.m4,v
retrieving revision 1.3
diff -u -p -r1.3 bison.m4
--- m4/bison.m4	18 Apr 2004 18:12:50 -0000	1.3
+++ m4/bison.m4	3 May 2004 17:52:45 -0000
@@ -3,6 +3,12 @@
 AC_DEFUN([gl_BISON],
 [
   # getdate.y works with bison only.
-  : ${YACC='bison -y'}
-  AC_SUBST(YACC)
+  AM_MISSING_PROG(YACC, bison -y)
+  AC_ARG_VAR(YACC,
+[The `Yet Another C Compiler' implementation to use.  Defaults to `bison -y'.
+Values other than `bison -y' will most likely break on most systems.])
+  AC_ARG_VAR(YFLAGS,
+[YFLAGS contains the list arguments that will be passed by default to Bison.
+This script will default YFLAGS to the empty string to avoid a default value of
+`-d' given by some make applications.])
 ])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.