GNU Autoconf, Automake, and Libtool
by Gary V. Vaughan, Ben Elliston, Tom Tromey, Ian Lance Taylor
22.2. Reusing Existing Macros
It goes without saying that it makes sense to reuse macros where possible—indeed, a search of the Autoconf macro archive might turn up a macro that does exactly what you want, alleviating the need to write a macro at all (see Section 22.5.1, "Autoconf Macro Archive" ).
It is more likely, however, that you can use generic, parameterized tests to help you get your job done. Autoconf's "generic" tests provide one such collection of macros. A macro that wants to test for support of a new language keyword, for example, should rely on the AC_TRY_COMPILE macro. You can use this macro to attempt to compile a small program and detect a failure resulting from, say, a syntax error.
In any case, it is good practice when reusing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access