Paul Eggert <[EMAIL PROTECTED]> writes: > > I suppose it'd be nice if Autoconf could detect underquoting > automatically, or at least the common instances....
One possibility would be to make an AC_DEFUN give an error if expanded more than once. Would that be right for all AC_DEFUNs? It'd have to be pretty close. I think it could be done by a special macro added to each definition which would go through to the output in normal circumstances, but blow up if expanded a second time. For example, changequote([,]) define(DoNtExPaNdMeTwIcE,[errprint([cannot expand twice])m4exit(1)]) define(ac_defun,[define([$1],[[[]DoNtExPaNdMeTwIcE[]]$2])]) ac_defun(ac_test_foo, [if test -n "$foo"; then $1 fi]) ac_defun(my_action,[echo hello world]) good: ac_test_foo([my_action]) bad: ac_test_foo(my_action) "[]DoNtExPaNdMeTwIcE[]" goes through to the output in the "good" case, that would be stripped by the autoconf wrapper. The name of the offending macro could no doubt be inserted there too. An alternative would be to note that a duplicate expansion only occurs when the first is in the argument list of a macro, as opposed to the top level. If m4 provided something to identify that case then define(ac_defun,[define([$1],[m4_error_if_in_arg_list[]$2])])
