On Tue, Jul 12, 2022, at 10:06 AM, Eric Blake wrote:
> On Sun, Jul 10, 2022 at 03:08:57PM -0400, Zack Weinberg wrote:
>> +# That is, AClocal_PATH_PROG_GLOBS_FEATURE_CHECK([PERL], [perl-*]) will
>> +# test each program named something like 'perl-*' found anywhere on the
>> +# path.  Due to the syntax conflict with Autoconf string quoting,
>> +# character sets (e.g. perl-[56]*) are not supported.
>
> Will quadrigraphs help?  @<:@ and @:>@ form late expansions to [ and ]
> respectively, so that you can guarantee their presence in the
> configure script without munging during the rest of autoconf.

Are you suggesting that people should write this?

AC_PATH_PROG_GLOBS_FEATURE_CHECK([perl perl5.@<:@6-9@:>@], [...])

The problem with that (well, besides bad ergonomics) is it ultimately needs to 
expand to something like

for as_dir in $PATH; do
  for ac_prog in perl perl5.\[6-9\]; do
    for ac_exec_ext in '' $ac_executable_extensions; do
      ac_pathglob_PERL="$as_dir$ac_prog$ac_exec_ext"
      for ac_path_PERL in $ac_pathglob_PERL; do
        # feature check here
      done
    done
  done
done

where the glob has been escaped in the second for loop's arguments so that it 
is not expanded prematurely.  That's what the m4_bpatsubst([$2], [[!?*]], 
[\\\&]) does, but currently only for glob metacharacters _other than_ [ and ].  
I tried  m4_bpatsubst([$2], [[]!?*[]], [\\\&]) but then

AC_PATH_PROG_GLOBS_FEATURE_CHECK([perl perl5.[6-9]], [...])

expanded to 

...
 for ac_prog in perl perl5.\6-9\; do
...

and that's the point at which I gave up.

zw

Reply via email to