autoconf
[Top][All Lists]
Advanced

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

Re: Why is this "quadrigraph" necessary?


From: Bruce Korb
Subject: Re: Why is this "quadrigraph" necessary?
Date: Mon, 24 Nov 2014 06:56:37 -0800

Hi Gary,

Thanks.  Good to hear from you.

It was just so non-obvious to someone who doesn't live & breath m4. :)
It took too long to figure out.

The genesis of that fragment is that guile.m4 does not reveal the
"micro version",
so you have to extract it from the version header file, so I used awk to
pull the number from the header.  It all breaks if "--cflags-only-I" were
ever to return anything other than a single "-I".

> Because '$3' will be recognize by M4 as a parameter. It will be
> replaced by the third argument to INVOKE_AG_MACROS_LAST. Thus it needs
> quoting, be it by "@S|@" or "$[]3"
> does not matter though.

Actually, since it is enclosed in quotes, I think you might need "$][3" to
close and then re-open the quotation.  A good doc enhancement might be
to recommend the quadrigraphic thingys when you need $numbers in the
shell script result.  Maybe you did and I missed it, but I don't think it was as
clear as the discussion about subscripts in C code.

Thank you both!

Cheers - Bruce

On Sun, Nov 23, 2014 at 2:22 PM, Gary V. Vaughan <address@hidden> wrote:
> Hi Bruce,
>
>> On 23 Nov 2014, at 21:38, Bruce Korb <address@hidden> wrote:
>>
>>
>> AC_DEFUN([INVOKE_AG_MACROS_LAST],[
>> [if test X${INVOKE_AG_MACROS_LAST_done} != Xyes ; then]
>>  GUILE_FLAGS
>>  [ag_gv=$( exec 2>/dev/tty ; set -x
>>  gdir=$(pkg-config --cflags-only-I guile-${GUILE_EFFECTIVE_VERSION})
>>  gdir=$(echo ${gdir#-I})
>>  gdir=$(awk '/SCM_MICRO_VERSION/{ print @S|@3 }' ${gdir}/libguile/version.h)
>>  printf '%u%02u%03u' ${GUILE_EFFECTIVE_VERSION%\.*} 
>> ${GUILE_EFFECTIVE_VERSION#*\.} ${gdir}
>>  )]
>>
>> If I change that "@S|@" thingy to "$" it and the following "3" disappear.  
>> Why?
>> (And, yes, this fragment only works on recent POSIX shells.)
>
> I haven't tried very hard to understand the working of this particular 
> definition, and
> my apologies if I am merely stating the obvious... without the quadrigraph, 
> M4 will
> replace the literal $3 with the third argument to the unexpanded macro call at
> autoconf time (quite likely the empty string if the macro was not designed to 
> work
> with a three or more arguments). Otherwise, as quoted above, the $3 will make 
> it
> through to the Autoconf expanded script, where it is interpreted by the AWK 
> command
> it is part of.
>
> HTH,
> --
> Gary V. Vaughan (gary AT gnu DOT org)



reply via email to

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