## Portability functions

To help in writing portable applications GSL provides some implementations of functions that are found in other libraries, such as the BSD math library. You can write your application to use the native versions of these functions, and substitute the GSL versions via a preprocessor macro if they are unavailable on another platform. The substitution can be made automatically if you use `autoconf`. For example, to test whether the BSD function `hypot` is available you can include the following line in the configure file ``configure.in'` for your application,

    AC_CHECK_FUNCS(hypot)

and place the following macro definitions in the file ``config.h.in'`,

    /* Substitute gsl_hypot for missing system hypot */

    #ifndef HAVE_HYPOT
    #define hypot gsl_hypot
    #endif

The application source files can then use the include command `#include <config.h>` to substitute `gsl_hypot` for each occurrence of `hypot` when `hypot` is not available.

In most circumstances the best strategy is to use the native versions of these functions when available, and fall back to GSL versions otherwise, since this allows your application to take advantage of any platform-specific optimizations in the system library. This is the strategy used within GSL itself.