Hello Thien-Thi, * Thien-Thi Nguyen wrote on Sat, Sep 15, 2007 at 11:12:05AM CEST: > here is a fragment from a AC_DEFUN body: > > AM_CONDITIONAL(m4_toupper([HAVE_$1]), test x$enable_$1 = xyes) > > if test x$enable_$1 = xyes ; then > m4_toupper([HAVE_$1])=1 > AC_SUBST(m4_toupper([HAVE_$1])) > fi > > i wonder if there is a better way to express: > > m4_toupper([HAVE_$1]) I'd use something like AC_DEFUN([FOO], [ m4_pushdef([COND], [AS_TR_SH([HAVE_]$1)]) m4_pushdef([ENABLE], [$enable_]$1) AM_CONDITIONAL(COND, [test x[]ENABLE = xyes]) if test x[]ENABLE = xyes; then COND=1 AC_SUBST(COND) fi m4_popdef([COND]) m4_popdef([ENABLE]) ]) If it were not for the AM_CONDITIONAL, then you could use indirection via AS_VAR_GET/AS_VAR_SET for accessing COND, which would allow calls like FOO([my_var_$func]) but AM_CONDITIONAL requires its first argument to be a shell literal. I do wonder a bit why you need both a substituted value HAVE_$1 and an automake conditional of the same name. Do you generate a header file with AC_CONFIG_FILES (rather than AC_CONFIG_HEADERS) that contains #define HAVE_... @HAVE_...@ ? > the documentation > (info "(autoconf)Programming in M4sh") > tantalizes w/ AS_TR_CPP as it warns that m4sh > "is not mature enough to be widely used". hmmm. Well, M4sh certainly isn't perfect yet, sometimes changes to it are necessary (and almost any change of it will break some usage pattern). AS_TR_CPP isn't appropriate here if you want to generate a shell variable name rather than a preprocessor define. Hope that helps. Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf