Hi Eric, Ralf, For about 15 years, writing and debugging autoconf macros has been very hard for me. I've come to partially understand how m4 internally works, thanks to Eric's new documentation in the m4 manual, and due to the ability of "seeing" what m4 does when I call it directly, on the command line. But inside autoconf, it's more complicated, because when I call 'aclocal' or 'autoconf', additional processing is done outside m4, which obstructs the view on what happens inside m4. - Before AC_INIT, I don't get any output at all. - Trying to inspect the definition of a macro, through e.g. m4_defn([AM_INIT_AUTOMAKE]) leads to tons of errors configure.ac:19: error: possibly undefined macro: AC_PREREQ configure.ac:20: error: possibly undefined macro: AC_INIT configure.ac:25: error: possibly undefined macro: AM_INIT_AUTOMAKE configure.ac:32: error: possibly undefined macro: AC_PROG_CC configure.ac:33: error: possibly undefined macro: AC_PROG_INSTALL configure.ac:45: error: possibly undefined macro: AC_SUBST configure.ac:81: error: possibly undefined macro: AM_CONDITIONAL configure:2533: error: possibly undefined macro: _m4_defun_pro and produces no configure file that I could look at. I figure that what I need is a most basic and robust 'println' device. - autoconf has a --trace option but no example how to use it. Actually what I want is to see some particular expansions, not the arguments and results of macro calls. - The output of m4_syscmd does not appear on standard output. - m4 has no primitives for creating external files. Here comes the trick: If, say, I want to see the definition of AM_INIT_AUTOMAKE at a particular point, I do: ------------------------------------------------------------------ m4_syscmd([cat 1>&2 <<\EOT Here comes the definition of AM_INIT_AUTOMAKE:] m4_defn([AM_INIT_AUTOMAKE]) [EOT]) ------------------------------------------------------------------ Benefits: - Offers an unobstructed view to the m4 state. - Any m4 expression, any number of m4 expressions can be printed. - The results appear on the screen immediately. No need to open a file to view them. Could something like this be documented in the autoconf manual? Or, alternatively, document how to use --trace for the same purpose? Bruno PS: The concrete problem for which I needed this, is to find out where to use [...], m4_quote, m4_dquote in an expression with m4_bpatsubst and m4_defn. It is fine if Eric the wizard can explain to me which of the 10 possibilities is the right one. But it's even better if the autoconf manual would give me the tools to find out about it myself. m4_syscmd([cat 1>&2 <<\EOT [Here comes the definition of _AC_INIT_PACKAGE 1:] m4_bpatsubst(m4_defn([_AC_INIT_PACKAGE]), [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 2:] m4_bpatsubst(m4_quote(m4_defn([_AC_INIT_PACKAGE])), [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 3:] m4_bpatsubst(m4_quote([m4_defn([_AC_INIT_PACKAGE])]), [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 4:] m4_bpatsubst(m4_dquote(m4_defn([_AC_INIT_PACKAGE])), [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 5:] m4_bpatsubst(m4_dquote([m4_defn([_AC_INIT_PACKAGE])]), [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 6:] m4_bpatsubst([m4_defn([_AC_INIT_PACKAGE])], [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 7:] m4_bpatsubst([m4_quote(m4_defn([_AC_INIT_PACKAGE]))], [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 8:] m4_bpatsubst([m4_quote([m4_defn([_AC_INIT_PACKAGE])])], [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 9:] m4_bpatsubst([m4_dquote(m4_defn([_AC_INIT_PACKAGE]))], [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [Here comes the definition of _AC_INIT_PACKAGE 10:] m4_bpatsubst([m4_dquote([m4_defn([_AC_INIT_PACKAGE])])], [AC_PACKAGE_NAME], [gl_INIT_DUMMY]) [EOT]) _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf