Hi,
I would like to avoid undesired macro expansion on the result of AS_TR_CPP,
and cannot get it to work. Can someone help, please?
================================ configure.ac =============================
AC_INIT([dummy], [0])
AM_INIT_AUTOMAKE
dnl m4_define([FOO_BAR], [undesired substitution])
AC_DEFUN([MYCOND],
[
AM_CONDITIONAL([LIBUNISTRING_]AS_TR_CPP([$1]), [true])
])
MYCOND([foo/bar])
AC_OUTPUT
============================================================================
After
$ aclocal
$ autoconf
everything looks fine.
Now uncomment the line 4 of configure.ac.
$ autoconf
configure.ac:11: error: AC_SUBST: `LIBUNISTRING_undesired substitution_TRUE' is not a valid shell variable name
aclocal.m4:125: AM_CONDITIONAL is expanded from...
configure.ac:6: MYCOND is expanded from...
configure.ac:11: the top level
So I guess some more quoting is needed.
Attempt #1: Use brackets. Change line 8 to
AM_CONDITIONAL([LIBUNISTRING_][AS_TR_CPP([$1])], [true])
$ autoconf
configure.ac:11: error: AC_SUBST: `LIBUNISTRING_AS_TR_CPP([foo/bar])_TRUE' is not a valid shell variable name
aclocal.m4:125: AM_CONDITIONAL is expanded from...
configure.ac:6: MYCOND is expanded from...
configure.ac:11: the top level
Attempt #2: Use m4_quote. Change line 8 to
AM_CONDITIONAL([LIBUNISTRING_]m4_quote(AS_TR_CPP([$1])), [true])
$ autoconf
configure.ac:11: error: AC_SUBST: `LIBUNISTRING_undesired substitution_TRUE' is not a valid shell variable name
aclocal.m4:125: AM_CONDITIONAL is expanded from...
configure.ac:6: MYCOND is expanded from...
configure.ac:11: the top level
Attempt #3: Use m4_dquote. Change line 8 to
AM_CONDITIONAL([LIBUNISTRING_]m4_dquote(AS_TR_CPP([$1])), [true])
$ autoconf
configure.ac:11: error: AC_SUBST: `LIBUNISTRING_[undesired substitution]_TRUE' is not a valid shell variable name
aclocal.m4:125: AM_CONDITIONAL is expanded from...
configure.ac:6: MYCOND is expanded from...
configure.ac:11: the top level
Attempt #4: Use m4_quote and brackets. Change line 8 to
AM_CONDITIONAL([LIBUNISTRING_]m4_quote([AS_TR_CPP([$1])]), [true])
$ autoconf
configure.ac:11: error: AC_SUBST: `LIBUNISTRING_AS_TR_CPP([foo/bar])_TRUE' is not a valid shell variable name
aclocal.m4:125: AM_CONDITIONAL is expanded from...
configure.ac:6: MYCOND is expanded from...
configure.ac:11: the top level
Yes, I know I could write
AM_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_$1]), [true])
but this feels like cheating, because it exploits a particular fact about the
AS_TR_CPP macro.
What am I missing?
Bruno
_______________________________________________
Autoconf mailing list
Autoconf@gnu....
http://lists.gnu.org/mailman/listinfo/autoconf
opensubscriber is not affiliated with the authors of this message nor responsible for its content.