### 2.7 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.

For example, after determining whether the BSD function `hypot` is available you can include the following macro definitions in a file `config.h` with your application,

    /* 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 replace each occurrence of `hypot` by `gsl_hypot` when `hypot` is not available. This substitution can be made automatically if you use `autoconf`, see Autoconf Macros.

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.