Item 5: Hacking Autoconf Macros

Occasionally you need a macro that Autoconf doesn't quite provide. That's when it pays to know how to copy and modify existing Autoconf macros.[143]

For example, here's a solution to a common Autoconf mailing list issue. A user wants to use AC_CHECK_LIB to capture a desired library in the LIBS variable. The catch is that this library exports functions with C++, rather than C linkage. AC_CHECK_LIB is not very accommodating when it comes to C++, primarily because AC_CHECK_LIB makes certain assumptions about symbols exported with C linkage that just don't apply to C++ symbols.

For example, the widely known (and standardized) rules of C linkage state that an exported C-linkage symbol (also known as the cdecl calling convention ...

Get Autotools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.