Hi Eric, * Eric Blake wrote on Tue, Apr 07, 2009 at 02:23:01PM CEST: > According to Ralf Wildenhues on 4/6/2009 11:28 PM: > > > > In other occasions, it is often clear which macro introduces a variable. > > For example, here it's _AC_COMPILER_EXEEXT, but that one is define'd > > only, not defun'ed, so we cannot easily tuck an AC_PROVIDE_IFELSE onto > > its rear. And I would like to not add this AM_CONDITIONAL code after > > all of the AC_PROG_{CC,...} macros. > > Why not? A macro name can be provided without using AC_DEFUN (or > m4_defun); rather, it is AC_DEFUN that makes self-providing an automatic > event. I see nothing that would prevent automake from doing: > > m4_define([_AC_COMPILER_EXEEXT], > m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) > > m4_provide_if([_AM_COMPILER_EXEEXT], > [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])
I assume that you mean that the m4_define part should happen before AC_PROG_CC and the m4_provide_if part afterwards? How would you ensure the former? Although uncommon, the current Automake code allows the user to use AC_PROG_CC before using AM_INIT_AUTOMAKE. I don't see how the above sequence can work in that case. > which means you have effectively hooked the expansion of > _AC_COMPILER_EXEEXT to set a flag that you can later query, without having > to look inside _AC_SUBST_VARS, regardless of its implementation. If it works then yes, that sounds easier. Can Automake rely on the existence of the _AC_COMPILER_EXEEXT macro then, and that it's this macro which is called whenever EXEEXT may be needed? Thanks, Ralf 2009-04-07 Ralf Wildenhues <ralf.wildenh...@gmx.de> Automake relies on the undocumented `_AC_COMPILER_EXEEXT' macro. * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT): Document that Automake relies on this macro. diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index 8bbe494..bcd037b 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -626,6 +626,9 @@ AC_MSG_RESULT([$ac_cv_exeext]) # # Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT # checks whether the compiler works. +# +# Do not rename this macro; Automake decides whether EXEEXT is used +# by checking whether `_AC_COMPILER_EXEEXT' has been expanded. m4_define([_AC_COMPILER_EXEEXT], [AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) ac_clean_files_save=$ac_clean_files