On Fri, Mar 11, 2011 at 2:12 PM, Too, Justin A. <too1@xxxxxxxx> wrote: > Thanks for the quick reply, > > ${#} solves the problem -- would this be the best practice? why are you defining a function inside of a macro? > > > Justin > > On 3/11/11 10:37 AM, "Eric Blake" <eblake@xxxxxxxxxx> wrote: > >>On 03/11/2011 11:32 AM, Eric Blake wrote: >>> On 03/11/2011 11:17 AM, Too, Justin A. wrote: >>>> Hi, >>>> >>>> I have a simple function in an m4 file that is a convenience to output >>>>information. The function takes two parameters >>>> >>>> function foo () { >>>>  If test $# != 2 ; then >>>>   exit 1 >>>>  fi >>>> } >>>> >>>> However, Autoconf expands $#. How can I escape $#, so that it will >>>>remain as-is in the configure script? I just can't figure this one out >>>>:) >>> >>> Several options, but I'd need to see more context to make sure of which >>> one is right for your scenario. >>> >>> Have you tried $][# (that is, using the proper m4 quoting to break the >>> m4 macro definition into two concatenated strings) or $[]# (that is, >>> inject an extra m4 quoted empty string)? Â(Which one to use depends on >>> what level of nesting the $# appears in your macro, and whether it is >>> likely to go through another round of m4 expansion). >>> >>> And if all else fails - use quadrigraphs: @S|@# >> >>For shell, you can also use ${#} instead of trying to get autoconf to >>output literal $#. >> >>-- >>Eric Blake  eblake@xxxxxxxxxx  Â+1-801-349-2682 >>Libvirt virtualization library http://libvirt.org >> > > > _______________________________________________ > Autoconf mailing list > Autoconf@xxxxxxx > http://lists.gnu.org/mailman/listinfo/autoconf > > _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf