autoconf
[Top][All Lists]
Advanced

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

Re: AC quoting rules


From: Paul Eggert
Subject: Re: AC quoting rules
Date: Wed, 6 Feb 2002 17:08:47 -0800 (PST)

> Date: Wed, 06 Feb 2002 10:46:52 -0800
> From: Bruce Korb <address@hidden>
> 
> Adding push/pop quote to M4, to be useful in this context, would
> also require that any macros that depended upon a particular
> quoting phrases being current would need to push/pop it to what
> it needed.  It would take some work.

I was hoping for a method that didn't need that much work, in which
(say) each macro definition or nesting level is tagged by its quoting
symbols, so that when a string is expanded its quoting symbols are
handles as its author expected.  But I admit I haven't thought through
it carefully and this discussion is quite theoretical.


> Scanning the source to ensure balance and replacing unbalanced
> square brackets with quadrigraphs also has this Achilles heel,
> but is less likely to be hit.  Additionally, it is pain to write
> and I really do not see general application for it.

The problem is general to any nested-quoting scheme.
That includes Internet RFC 2822 comments (which (look (like)) this).
(Admittedly nested quoting is less popular than non-nested quoting.)


> > # AC_FUNC_ERROR_AT_LINE
> > # ---------------------
> > AC_DEFUN([AC_FUNC_ERROR_AT_LINE],
> > [AC_LIBSOURCES([error.h, error.c])dnl
> > AC_CACHE_CHECK([for error_at_line], ac_cv_lib_error_at_line,
> > [AC_LINK_IFELSE([AC_LANG_PROGRAM([],[error_at_line (0, 0, "", 0, "");])],
> >                 [ac_cv_lib_error_at_line=yes],
> >                 [ac_cv_lib_error_at_line=no])])
> > if test $ac_cv_lib_error_at_line = no; then
> >   AC_LIBOBJ(error)
> > fi
> > ])
> 
> That is very hard for the novice.

I to agree with you here.  There is way too much repetition there, and
the repetition is confusing.

But this is not primarily a quoting issue; it's primarily an issue
with the complexity of the autoconf macros, and the fact that they've
grown with time incrementally.  (A related issue is that neither
AC_LINK_IFELSE nor AC_LANG_PROGRAM are documented.  :-)

If I had some free time, I'd argue for something with less repetition,
e.g.:

AC_DEF_FUNC_CHECKER([error_at_line],
  [AC_TRY_LINK(, [error_at_line (0, 0, "", 0, "");]),
   ,
   AC_LIBOBJ(error),
   AC_LIBSOURCES([error.c, error.h])])

Something like should be doable in M4+sh and is simpler even than the
autogen input.

I'd like something even simpler, but that will take more time to think
about....



reply via email to

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