autoconf
[Top][All Lists]
Advanced

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

Re: help with broken autoconf/m4 macro?


From: Eric Blake
Subject: Re: help with broken autoconf/m4 macro?
Date: Thu, 29 Jul 2010 11:37:45 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1

On 07/27/2010 12:26 PM, Charlie Zender wrote:
> Here is the definition of NCO_CHECK_FUNCS in acinclude.m4:
> 
> AC_DEFUN([NCO_CHECK_FUNCS],
> [AC_FOREACH([AC_Func],[$1],

You should consider naming your variable outside of the AC namespace, in
case autoconf uses the macro AC_Func as an internal detail of
AH_TEMPLATE, AS_TR_CPP, or AC_DEFINE_UNQUOTED.

>   [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Func),dnl

This dnl is useless.  It ends up passing the leading whitespace of the
next line as the argument to AH_TEMPLATE, but AH_TEMPLATE then strips
leading whitespace.

>               [Define to 1 if compiler finds external `]AC_Func[' function])
>       AH_TEMPLATE(AS_TR_CPP(NEED_[]AC_Func),dnl
>       [Define to 1 if compiler needs external `]AC_Func[' function])  
>              ])dnl
> for ac_func in $1

Again, for namespace cleanliness, don't assume that $ac_func is a safe
variable name to use.

> do
> AC_CHECK_FUNC($ac_func,
>               [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])])],

Here's your problem - the literal string AS_TR_CPP([HAVE_$ac_func]) is
not a valid variable name; you've overquoted the AS_TR_CPP macro.  You
really want to define the variable whose name is given by the expansion
of AS_TR_CPP, as in:

[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$ac_func]))]

like you did earlier in the AH_TEMPLATE calls.

>               [AC_DEFINE_UNQUOTED([AS_TR_CPP([NEED_$ac_func])])])dnl
> done
> ])


Or, since you are already doing an m4 loop, why not do the entire thing
in m4 and skip the shell loop (yeah, your configure file will be
slightly bigger, but with 2.64 and newer, shell functions minimize that
impact).  It would avoid the need for AH_TEMPLATE and AS_TR_CPP in the
first place.  Untested, but I think this does the same end result as
your earlier definition:

AC_DEFUN([NCO_CHECK_FUNCS],
[AC_FOREACH([NCO_Func],[$1],
 [AC_CHECK_FUNC(NCO_Func,
   [AC_DEFINE_UNQUOTED([HAVE_]NCO_Func, [1],
     [Define to 1 if compiler finds external `]NCO_Func[' function])],
   [AC_DEFINE_UNQUOTED([NEED_]NCO_Func, [1],
     [Define to 1 if compiler needs external `]NCO_Func[' function])]dnl
)])])

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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