autoconf
[Top][All Lists]
Advanced

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

Re: iterating over arguments


From: Eric Blake
Subject: Re: iterating over arguments
Date: Mon, 14 Sep 2009 16:02:41 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Sam Steingold <sds <at> gnu.org> writes:

> 
> Eric Blake wrote:
> > Also, if you are requiring newer autoconf
> 
> how "newer"?
> 2.59?
> 2.62?

m4_map_args_w was added in 2.64 (well, 2.63b, if you include beta releases).  
Whereas m4_foreach_w works in 2.59 (and while I still support 2.59, I tend not 
to worry about anything older, because gnulib requires 2.59).

> 
> > m4_define([_CL_CLISP_REQUIRE_FEATURE_1],
> > [_CL_CLISP_REQUIRE_FEATURE_2([$1], m4_toupper([$1]))])
> > m4_define([_CL_CLISP_REQUIRE_FEATURE_2],
> > [AC_CACHE_CHECK([for $2 in CLISP], [cl_cv_clisp_$1],
> >   [CLISP_SET([cl_cv_clisp_$1], [[#+$1 "yes" #-$1 "no"]])])
> > test $cl_cv_clisp_$1 = no && AC_MSG_ERROR([$2 is missing in CLISP])])
> > AC_DEFUN([CL_LISP_REQUIRE_FEATURE],
> > [m4_map_args_w([$1], [_CL_CLISP_REQUIRE_FEATURE_1(], [)], [
> > ])
> 
> I don't understand this code (why is there a line break in the m4_map_args_w 
> invocation?)

So that your expansion will line up nicely (if you care about that).  In other 
words:

m4_map_args_w([a b c], [pre(], [)post], [
])[]text

expands to:

pre([a])post
pre([b])post
pre([c])post[]text

while without the newline,

m4_map_args_w([a b c], [pre(], [)post])[]text

expands to:

pre([a])post[]pre([b])post[]pre([c])post[]text

> but this patch the cvs head:
> 
> Index: src/m4/clisp.m4
> ===================================================================
> RCS file: /cvsroot/clisp/clisp/src/m4/clisp.m4,v
> retrieving revision 1.13
> diff -u -w -p -F^(def -r1.13 clisp.m4
> --- src/m4/clisp.m4     13 Sep 2009 05:18:19 -0000      1.13
> +++ src/m4/clisp.m4     14 Sep 2009 15:34:17 -0000
> @@ -13,6 +13,13 @@ AC_PREREQ(2.13)
>   dnl set variable $1 to the result of evaluating in clisp of $2
>   AC_DEFUN([CLISP_SET],[$1=`$cl_cv_clisp -q -norc -x '$2' 2>/dev/null | sed -
e 
> 's/^"//' -e 's/"$//'`])
> 
> +m4_define([_CL_CLISP_REQUIRE_FEATURE_1],
> +[_CL_CLISP_REQUIRE_FEATURE_2([$1], m4_toupper([$1]))])
> +m4_define([_CL_CLISP_REQUIRE_FEATURE_2],
> +[AC_CACHE_CHECK([for $2 in CLISP], [cl_cv_clisp_$1],
> + [CLISP_SET([cl_cv_clisp_$1], [[#+$1 "yes" #-$1 "no"]])])
> +test $cl_cv_clisp_$1 = no && AC_MSG_ERROR([no $2 in CLISP])])
> +
>   dnl check for a clisp installation
>   dnl use --with-clisp=path if your clisp is not in the PATH
>   dnl if you want to link with the full linking set,
> @@ -65,7 +72,9 @@ if test "$cl_use_clisp" != "no"; then
>          cl_cv_have_clisp=yes])
>     fi
>   fi
> -m4_foreach_w([cl_feat], [$1],
> -[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])])])
> +m4_map_args_w([$1], [_CL_CLISP_REQUIRE_FEATURE_1(], [)], [
> +])])

So far, so good,


> ==========================================================
> 
> results in this error:
> ==========================================================
> $ make -f Makefile.devel check-configures AUTOCONF='autoconf --trace=CL_CLISP 
> --trace=_CL_CLISP_REQUIRE_FEATURE_2'

Ouch.  Running autoconf --trace is meant to be independent of regenerating your 
makefiles; it does NOT generate a configure file, but rather tells you about 
what is happening under the hood.  You need to run your normal:

$ make -f Makefile.devel check-configures

without any --trace lines added to AUTOCONF to see how the generated configures 
behave (I see later in your email that you did this), and if you need the 
traces, just run this in isolation:

$ autoconf path/to/configure.ac --trace=CL_CLISP --
trace=_CL_CLISP_REQUIRE_FEATURE_2

to see where those two macros are used within path/to/configure.ac (but without 
generating any configure scripts).

> Use of uninitialized value $macro in concatenation (.) or string at 
> /usr/bin/automake line 4831, <GEN0> line 40.
> automake: ####################
> automake: ## Internal Error ##
> automake: ####################
> automake: unrequested trace `'

Probably fallout from not creating actual configure files, due to the confusion 
of when to use --trace.

> 
> without the --trace arguments, I get this:
> 
> cd modules/berkeley-db && autoconf --include=/home/sds/src/clisp/current/src
> configure:1981: error: possibly undefined macro: m4_map_args_w

Then you aren't using autoconf 2.64.

So, we're back to using m4_foreach_w, and this time not overquoting the 
m4_pushdef line.

-- 
Eric Blake






reply via email to

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