File: autoconf.info, Node: Obsoleting Macros, Next: Coding Style, Prev: Dependencies Between Macros, Up: Writing Autoconf Macros 10.4 Obsoleting Macros ====================== Configuration and portability technology has evolved over the years. Often better ways of solving a particular problem are developed, or ad-hoc approaches are systematized. This process has occurred in many parts of Autoconf. One result is that some of the macros are now considered “obsolete”; they still work, but are no longer considered the best thing to do, hence they should be replaced with more modern macros. Ideally, ‘autoupdate’ should replace the old macro calls with their modern implementation. Autoconf provides a simple means to obsolete a macro. -- Macro: AU_DEFUN (OLD-MACRO, IMPLEMENTATION, [MESSAGE], [SILENT]) Define OLD-MACRO as IMPLEMENTATION, just like ‘AC_DEFUN’, but also declare OLD-MACRO to be obsolete. When ‘autoupdate’ is run, occurrences of OLD-MACRO will be replaced by the text of IMPLEMENTATION in the updated ‘configure.ac’ file. If a simple textual replacement is not enough to finish the job of updating a ‘configure.ac’ to modern style, provide instructions for whatever additional manual work is required as MESSAGE. These instructions will be printed by ‘autoupdate’, and embedded in the updated ‘configure.ac’ file, next to the text of IMPLEMENTATION. Normally, ‘autoconf’ will also issue a warning (in the "obsolete" category) when it expands OLD-MACRO. This warning does not include MESSAGE; it only advises the maintainer to run ‘autoupdate’. If it is inappropriate to issue this warning, set the SILENT argument to the word ‘silent’. One might want to use a silent ‘AU_DEFUN’ when OLD-MACRO is used in a widely-distributed third-party macro. If that macro's maintainers are aware of the need to update their code, it's unnecessary to nag all of the transitive users of OLD-MACRO as well. This capability was added to ‘AU_DEFUN’ in Autoconf 2.70; older versions of autoconf will ignore the SILENT argument and issue the warning anyway. *Caution:* If IMPLEMENTATION contains M4 or M4sugar macros, they will be evaluated when ‘autoupdate’ is run, not emitted verbatim like the rest of IMPLEMENTATION. This cannot be avoided with extra quotation, because then OLD-MACRO will not work when it is called normally. See the definition of ‘AC_FOREACH’ in ‘general.m4’ for a workaround. -- Macro: AU_ALIAS (OLD-NAME, NEW-NAME, [SILENT]) A shorthand version of ‘AU_DEFUN’, to be used when a macro has simply been renamed. ‘autoupdate’ will replace calls to OLD-NAME with calls to NEW-NAME, keeping any arguments intact. No instructions for additional manual work will be printed. The SILENT argument works the same as the SILENT argument to ‘AU_DEFUN’. It was added to ‘AU_ALIAS’ in Autoconf 2.70. *Caution:* ‘AU_ALIAS’ cannot be used when NEW-NAME is an M4 or M4sugar macro. See above.