The same idiom can be used to simplify the 'monetary' module. When I had written it, I had apparently forgotten that the AC_DEFUN_ONCE macro exists.
2018-08-13 Bruno Haible <br...@clisp.org> monetary: Simplify m4 code. * m4/monetary_h.m4 (gl_MONETARY_H): Define through AC_DEFUN_ONCE. (gl_MONETARY_H_BODY): Inline into gl_MONETARY_H. Remove macro. diff --git a/m4/monetary_h.m4 b/m4/monetary_h.m4 index 887ed91..c4ac3f7 100644 --- a/m4/monetary_h.m4 +++ b/m4/monetary_h.m4 @@ -1,17 +1,10 @@ -# monetary_h.m4 serial 3 +# monetary_h.m4 serial 4 dnl Copyright (C) 2017-2018 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_MONETARY_H], -[ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_MONETARY_H_BODY]) -]) - -AC_DEFUN([gl_MONETARY_H_BODY], +AC_DEFUN_ONCE([gl_MONETARY_H], [ AC_REQUIRE([gl_MONETARY_H_DEFAULTS]) m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])