Supporting Optional Features and Packages

I've discussed the different ways to handle situations when a pthreads library exists and when it doesn't. But what if a user wants to build a single-threaded version of jupiter when the pthreads library is installed? We certainly don't want to add a note to Jupiter's README file telling the user to rename his pthreads libraries!

Autoconf provides two macros for working with optional features and external software packages: AC_ARG_ENABLE and AC_ARG_WITH. Their prototypes are as follows:

AC_ARG_WITH(package, help-string, [action-if-given], [action-if-not-given])
AC_ARG_ENABLE(feature, help-string, [action-if-given], [action-if-not-given])

As with many Autoconf macros, these two may be used simply to set some ...

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.