bug-autoconf
[Top][All Lists]
Advanced

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

Re: AS_IF and AC_ARG_VAR issue with 2.62


From: Eric Blake
Subject: Re: AS_IF and AC_ARG_VAR issue with 2.62
Date: Wed, 21 May 2008 06:27:04 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 5/20/2008 8:59 PM:
| But I don't see any mention of AS_IF or AC_ARG_VAR in your snippet (ie.
| your subject line is inconsistent with your pasted example).  Without
| knowing the definition of PKG_WITH_MODULES, which is not an autoconf
| macro, I can only guess that it too has underquoted arguments.

Apologies; I didn't see that you had attached it, since it wasn't sent
with a text MIME type.

| # PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
| #                  [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
| #                  [DESCRIPTION], [DEFAULT])
| #
| #
|
| AC_DEFUN([PKG_WITH_MODULES],
| [AC_REQUIRE([PKG_CHECK_MODULES])

It might also be interesting to see the definition of PKG_CHECK_MODULES.

|
| m4_define([with_arg], m4_tolower($1))

Use m4_pushdef, not m4_define, when defining local m4 variables, so that
you don't destroy any prior definitions.  Proper quoting would be:

m4_pushdef([with_arg], m4_tolower([$1]))

|
| dnl Default description
| m4_define([description],ifelse([$5], , [build with ]with_arg[ support],
[$5]))

I prefer seeing the m4sugar builtins, rather than raw m4.  Also, by not
quoting the ifelse, the user's description is subject to overexpansion
(once in defining description, and once more when using description),
making it much harder for the user's description to supply , or [] in the
description.  I'd write this as:

m4_pushdef([description],
~  [m4_default([$5], [build with ]with_arg[ support])])

| dnl Disabled by default
| m4_define([def_arg],ifelse([$6], , [no], [$6]))

Likewise:

m4_pushdef([def_arg], [m4_default([$6], [no])])

|
| AC_ARG_WITH(with_arg,
|     AS_HELP_STRING([--with-]with_arg, description[
@<:@default=]def_arg[@:>@]),,
|         AS_TR_SH([with_]with_arg)=def_arg)

Definitely underquoted.

AC_ARG_WITH(with_arg,
~  [AS_HELP_STRING([--with-]with_arg,
~    description[ @<:@default=]def_arg[@:>@])],,
~  [AS_TR_SH([with_]with_arg)=def_arg])

|
| AM_CONDITIONAL([WITH_][$1], [test "AS_TR_SH([with_]with_arg)" = "yes"])
|
| if test "$AS_TR_SH([with_]with_arg)" = "yes"; then
|     PKG_CHECK_MODULES([$1],[$2],[$3],[$4])
| fi

I take it this is where you tried to use AS_IF?

|
| m4_undefine([with_arg])
| m4_undefine([description])
| m4_undefine([def_arg])

m4_popdef([with_arg])
m4_popdef([description])
m4_popdef([def_arg])

|
| ]) dnl PKG_WITH_MODULES


- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkg0FRcACgkQ84KuGfSFAYAaYACgv3heg2e+0JVQGu1oTCCGoR4v
xx4AoNWdQU2kqufFH0GvR0BHxHq5UEfd
=IsDA
-----END PGP SIGNATURE-----




reply via email to

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