autoconf-patches
[Top][All Lists]
Advanced

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

Re: Why doesn't this quote properly?


From: Paul Eggert
Subject: Re: Why doesn't this quote properly?
Date: Mon, 22 Nov 2004 15:30:24 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Stepan Kasal <address@hidden> writes:

> http://lists.gnu.org/archive/html/autoconf-patches/2004-10/msg00018.html

Thanks; I reviewed that and installed the following slightly-different
version.

2004-11-22  Stepan Kasal  <address@hidden>

        * doc/autoconf.texi (Autoconf Language): Explain that
        ``descriptions'' may not be double quotes.
        (Quotation Rule Of Thumb): Likewise.
        (Pretty Help Strings): Likewise; remove the wrong comment;
        simplify the examples and improve their quoting.

Index: autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.839
retrieving revision 1.840
diff -p -u -r1.839 -r1.840
--- autoconf.texi       11 Nov 2004 00:13:20 -0000      1.839
+++ autoconf.texi       22 Nov 2004 23:31:56 -0000      1.840
@@ -1068,6 +1068,12 @@ AC_COMPILE_IFELSE([[char b[10];]],, [AC_
 @noindent
 address@hidden, you actually produce @samp{char b[10];} this time!
 
+On the other hand, descriptions (e.g., the last parameter of
address@hidden or @code{AS_HELP_STRING}) are not literals---they
+are subject to line breaking, for example---and should not be double quoted.
+Even if these descriptions are short and are not actually broken, double
+quoting them yields weird results.
+
 The careful reader will notice that, according to these guidelines, the
 ``properly'' quoted @code{AC_CHECK_HEADER} example above is actually
 lacking three pairs of quotes!  Nevertheless, for the sake of readability,
@@ -8114,9 +8120,11 @@ your macros.  If one or more words have 
 output, you need more quotes.  When in doubt, quote.
 
 However, it's also possible to put on too many layers of quotes.  If
-this happens, the resulting @command{configure} script will contain
+this happens, the resulting @command{configure} script may contain
 unexpanded macros.  The @command{autoconf} program checks for this problem
-by doing @samp{grep AC_ configure}.
+by looking for the string @samp{AC_} in @file{configure}.  However, this
+heuristic does not work in general: for example, it does not catch
+overquoting in @code{AC_DEFINE} descriptions.
 
 
 @c ---------------------------------------- Using autom4te
@@ -13042,22 +13050,22 @@ Expands into an help string that looks p
 Options}).  The following example will make this clearer.
 
 @example
-AC_DEFUN([TEST_MACRO],
-[AC_ARG_WITH([foo],
-             AS_HELP_STRING([--with-foo],
-                            [use foo (default is NO)]),
-             [ac_cv_use_foo=$withval], [ac_cv_use_foo=no])
-AC_CACHE_CHECK([whether to use foo],
-               [ac_cv_use_foo], [ac_cv_use_foo=no])])
+AC_ARG_WITH(foo,
+  [AS_HELP_STRING(--with-foo,
+     [use foo (default is no)])],
+  [ac_cv_use_foo=$withval],
+  [ac_cv_use_foo=no])
 @end example
 
-Please note that the call to @code{AS_HELP_STRING} is @strong{unquoted}.
+The second argument of @code{AS_HELP_STRING} is
+not a literal, and should not be double quoted. @xref{Autoconf
+Language}, for a more detailed explanation.
 Then the last few lines of @samp{configure --help} will appear like
 this:
 
 @example
 --enable and --with options recognized:
-  --with-foo              use foo (default is NO)
+  --with-foo              use foo (default is no)
 @end example
 
 The @code{AS_HELP_STRING} macro is particularly helpful when the
@@ -13065,11 +13073,11 @@ The @code{AS_HELP_STRING} macro is parti
 arguments, as shown in the following example.
 
 @example
-AC_DEFUN(MY_ARG_WITH,
-[AC_ARG_WITH([$1],
-             AS_HELP_STRING([--with-$1], [use $1 (default is $2)]),
-             ac_cv_use_$1=$withval, ac_cv_use_$1=no),
-AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)])
+AC_DEFUN([MY_ARG_WITH],
+  [AC_ARG_WITH([$1],
+     [AS_HELP_STRING([--with-$1], [use $1 (default is $2)])],
+     [ac_cv_use_$1=$withval],
+     [ac_cv_use_$1=no])])
 @end example
 @end defmac
 




reply via email to

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