autoconf
[Top][All Lists]
Advanced

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

Re: iterating over arguments


From: Sam Steingold
Subject: Re: iterating over arguments
Date: Mon, 14 Sep 2009 13:32:21 -0400
User-agent: Thunderbird 2.0.0.22 (X11/20090625)

thanks a lot for your clear explanations!
(sorry about copying your whole message, I want to preserve it in my mail archives, it would be nice if you kept me in CC).

yes, now, with this patch:
======================================================================
@@ -66,6 +78,8 @@ if test "$cl_use_clisp" != "no"; then
   fi
 fi
 m4_foreach_w([cl_feat], [$1],
-[AC_CACHE_CHECK([for cl_feat in CLISP], [cl_cv_clisp_]cl_feat,
+[m4_pushdef([CL_FEAT], m4_toupper(cl_feat))dnl
+AC_CACHE_CHECK([for CL_FEAT in CLISP], [cl_cv_clisp_]cl_feat,
  [CLISP_SET([cl_cv_clisp_]cl_feat,[[#+]]cl_feat[[ "yes" #-]]cl_feat[[ "no"]])])
-test $cl_cv_clisp_]cl_feat[ = no && AC_MSG_ERROR([no ]cl_feat[ in CLISP])])])
+test $cl_cv_clisp_]cl_feat[ = no && AC_MSG_ERROR([no ]CL_FEAT[ in CLISP])
+m4_popdef([CL_FEAT])])])
======================================================================
I do get the right case, and do NOT get the inf loop.

HOWEVER, both with and without it, I get a HUGE bug:

the line

test $cl_cv_clisp_]cl_feat[ = no && AC_MSG_ERROR([no ]CL_FEAT[ in CLISP])

is converted to

test $cl_cv_clisp_cl_feat = no && { { $as_echo "$as_me:$LINENO: error: no FFI in CLISP" >&5

and NOT to

test $cl_cv_clisp_ffi = no && { { $as_echo "$as_me:$LINENO: error: no FFI in CLISP" >&5

as it should!

Eric Blake wrote:
Sam Steingold <sds <at> gnu.org> writes:

Eric Blake wrote:
any rate, using 'autoconf --trace=_CL_CLISP_REQUIRE_FEATURE_2' would show
what the result of m4_toupper turns out to be in this case.
running this:
autoconf --trace=CL_CLISP
hangs forever without any output.

I'm _still_ interested in the alternative m4_map_args_w and
--trace=_CL_CLISP_REQUIRE_FEATURE_2 behavior. So far, you have _only_ provided results for m4_foreach_w, using m4_pushdef, whereas my alternative suggestion of m4_map_args_w does not require the use of m4_pushdef, so I still wonder whether my alternative suggestion would better cope with m4_toupper's lack of quoting.

-[AC_CACHE_CHECK([for cl_feat in CLISP], [cl_cv_clisp_]cl_feat,
+[m4_pushdef([CL_FEAT], [m4_toupper([cl_feat])])dnl

It's obvious why this particular patch attempt infloops - because you over-
quoted m4_toupper, you are defining CL_FEAT to contain the contents:

m4_toupper([cl_feat])

Thus, when you call a raw:

CL_FEAT

you end up invoking:

m4_toupper([cl_feat])

which in turn expands to this (in autoconf 2.64, but not after I apply my patch for 2.65 to properly quote m4_toupper's result):

CL_FEAT

hence an infinite loop.  And if you had tried:

+[m4_pushdef([CL_FEAT], m4_toupper([cl_feat]))dnl

(note that the m4_toupper is intentionally NOT quoted), then you would be defining CL_FEAT as:

CL_FEAT

and still have an infinite loop.  But if you went with what I suggested:

+[m4_pushdef([CL_FEAT], m4_toupper(cl_feat))dnl

(now note that both m4_toupper and cl_feat are unquoted), you get CL_FEAT defined as the uppercase version of the contents of cl_feat; or, when cl_feat is ffi, then CL_FEAT would be

FFI

In other words, this is a case where you really DO want the macro cl_feat and m4_toupper expanded prior to calling m4_pushdef with the results.






reply via email to

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