On 01/14/2018 02:23 AM, Mike Frysinger wrote: > On 13 Jan 2018 21:42, Yuri wrote: >> I added this function to configure.ac: >> >> log2() { >> x=0 >> y=$(($1>>1)) >> while [ $y -gt 0 ]; do
You need to use additional [] around any literal [] that you want in your output, and you have also discovered why autoconf prefers that you use 'test' instead of '['. By the way, your function is not completely portable - not all /bin/sh implement $(()) according to POSIX rules yet, and unless you take special care to enforce that your configure script probes for and uses a new-enough shell, your configure will be broken on some older platforms. See the documentation of AS_VAR_ARITH, as well as the undocumented _AS_DETECT_REQUIRED in autoconf/lib/m4sugar/m4sh.m4, for more details about ensuring a new-enough shell can perform $(()) or other POSIX constructs not portable to ancient /bin/sh. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature