[m-rev.] for review: add MR_ prefixes to configuration macros

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 11 20:31:35 AEDT 2002


On 09-Feb-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> Add MR_ prefixes to the configuration macros. This change only
> adds prefixes to the definitions of the macros, not the uses.
...
> Index: configure.in
...
> +mercury_check_for_functions () {
> +
> +    for mercury_cv_func in "$@"
> +    do
> +	mercury_cv_func_define=MR_HAVE_`echo $mercury_cv_func | tr a-z A-Z`
> +	AC_CHECK_FUNC($mercury_cv_func, [
> +		AC_DEFINE_UNQUOTED($mercury_cv_func_define)
> +	])
> +    done
> +}

According to the autoconf manual, "you should not use shell functions",
because they are not portable.  I'm not sure how important that is
these days, but I've used at least one shell which didn't support them.
We've also taken some effort to avoid using them in scripts/*.in.

The recommend approach in autoconf scripts is to use autoconf m4
macros instead, I believe.  You can program loops using `shift',
`cond', and recursion.  E.g. something along the lines of this

	AC_DEFUN(mercury_check_for_functions,`
		mercury_cv_func=$1
		mercury_cv_func_define=MR_HAVE_[`]echo $1 | tr a-z A-Z[`]
		AC_CHECK_FUNC($mercury_cv_func, [
			AC_DEFINE_UNQUOTED($mercury_cv_func_define)
		]),
		ifelse($#,1,,mercury_check_for_functions(shift($@)))
	')

(modulo the quoting, which I have probably got wrong).

Likewise for mercury_check_for_headers.

Otherwise that change looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list