[Top][All Lists]

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

Words in that look like macros forbidden or merely discoura

From: Gavin Smith
Subject: Words in that look like macros forbidden or merely discouraged?
Date: Sun, 12 Jun 2016 11:25:38 +0100


In the Autoconf manual we read:


When you use the same text in a macro argument, you must therefore
have an extra quotation level (since one is stripped away by the macro
substitution). In general, then, it is a good idea to use double
quoting for all literal string arguments, either around just the
problematic portions, or over the entire argument:

     AC_MSG_WARN([[AC_DC] stinks  --Iron Maiden])
     AC_MSG_WARN([[AC_DC stinks  --Iron Maiden]])

However, the above example triggers a warning about a possibly
unexpanded macro when running autoconf, because it collides with the
namespace of macros reserved for the Autoconf language. To be really
safe, you can use additional escaping (either a quadrigraph, or
creative shell constructs) to silence that particular warning:

     echo "Hard rock was here!  --AC""_DC"
     AC_MSG_WARN([[AC@&address@hidden stinks  --Iron Maiden]])


Note what it says: "triggers a warning". However, it seems in some
cases, using a word that looks like it could be a macro triggers a
hard error, not just a warning:

$ autoreconf -iv
autoreconf: Entering directory `.'
autoreconf: not using Gettext
autoreconf: running: aclocal warning: macro 'AM_DC' not found in library
autoreconf: tracing
autoreconf: not using Libtool
autoreconf: running: /usr/bin/autoconf error: possibly undefined macro: AM_DC
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

Any ideas which it is: is it actually forbidden, or should it be just a warning?

I intend to put information about this here:
, which I've adapted from the test in the automake manual.

Contents of files:

$ cat
AC_INIT([helloprog], [1.0])

echo AM_DC rocks

$ cat
AUTOMAKE_OPTIONS=foreign dist-xz

reply via email to

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