On 06/17/2010 04:01 AM, pellegrini wrote:
> Here is the contents of the macro:
> 
> AC_DEFUN([AX_CHECK_HEADER],[
>    header=m4_toupper(AS_TR_SH($1))

Rather than doing the translation at shell time,

>    eval HAVE_${header}="no"

and using lots of eval statements, why not just do the translation at m4
time?

>    for dir in $2; do
>        AC_CHECK_HEADER($dir/$1, [got="yes"], [got="no"])
>        if test "${got}" = "yes"; then
>            eval HAVE_${header}=$dir
>            break
>        else
>            eval HAVE_${header}="no"

And why is this line here, given that you already pre-initialized the
variable before the for loop?

>        fi
>    done
>    AC_SUBST(HAVE_${header})
> ])

How about something like this (untested)?

AC_DEFUN([AX_CHECK_HEADER], [
  HAVE_[]m4_toupper(AS_TR_SH([$1]))=no
  for dir in $2 do
    AC_CHECK_HEADER([$dir/$1], [got=yes], [got=no])
    if test "$got" = yes; then
      HAVE_[]m4_toupper(AS_TR_SH([$1]))=$dir
      break
    fi
  done
  AC_SUBST([HAVE_]m4_toupper(AS_TR_SH([$1])))
])

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to