autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_DEFINE_UNQUOTED doc update


From: Stepan Kasal
Subject: Re: AC_DEFINE_UNQUOTED doc update
Date: Fri, 29 Apr 2005 15:37:37 +0200
User-agent: Mutt/1.4.1i

Hello.

First, I took the liberty to commit this change immediately

--- autoconf.texi:
-     AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, 1, [Define if you have libreadline])
+     AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have libreadline])

This is an obvious mistake, and I think it was I who commited that.
So it's fixed now.

/personal:
> I just don't understand the reason against telling users to quote every
> argument at least once.

You have to make it "once", not "at least once".  Overquoting is also
a popular source for problems.  Yes, we should tell them this.  The question
is, at which level we tell them that they need not to quote everything?
        AC_DEFINE([HAVE_LIBREADLINE], [1], ...
I think we should tell them at some stage, it can save them some typing.

As far as the other changes are concerned, let me comment on the example on
your mail:

1) foo='bla [[blubb]]'

I'd prefer this:
        [foo='bla [blubb]']

The explanation is that you simply are not allowed to write ``naked'' shell
code in configure.ac.  Every word you write is considered for expansion
by m4.  And the quote characters are treated specially.

So unless your shell code is simple, you should quote it by [ ].
Again, what does ``simple'' mean here?

Shall we teach the users to quote all shell code which is outside of any
macros?  I don't think so.  But perhaps we should tell them that they have
to quote to get real [ ] pairs.

2) foo='['

Yes, this cannot be done.  You have to do something like this:
m4_changequote()
foo='['
m4_changequote([,])

Citing from the m4 manual:
   There is no way in `m4' to quote a string containing an unmatched
   left quote, except using `changequote' to change the current quotes.

3)
> | AC_DEFINE_UNQUOTED([bar], ["$foo"], [bla])
> | AC_DEFINE_UNQUOTED([bar], [["$foo"]], [bla])

I don't think you are right here.  The second argument is not expanded
by m4, as foo is not a defined macro.

Just do
   AC_DEFINE_UNQUOTED(bar, "$foo", [bla])

and be well.  (The last argument is a text which might potentially
contain a comma, so it's a good habit to quote it.)

Hope this explains it,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]