See the manual for advice on how to refactor macros in order to avoid the bug in earlier autoconf versions and avoid increased script size in the current version.
A macro declared with AC_DEFUN_ONCE warned on a second invocation; and out-of-order expansion was still possible.