On 09/21/2016 09:10 PM, Timothée Flutre wrote:

Moreover, does someone know how I can use conditionals with the Autotools
(via ./configure) so that, if the user has GSL <= 1.16, the compiled code
uses gsl_multifit_linear_svd whereas if the user has GSL >= 2.0 the
compiled code uses gsl_multifit_linear?

Once installed, GSL also installs an executable script called "gsl-config". If you run it with the "--version" option, this script will print the installed version of GSL:

$ gsl-config --version

You can use the output of this command, along with "AX_COMPARE_VERSION" (from the GNU Autoconf Archives) to check for the version. The link bellow shows how we do it in GNU Astronomy Utilities when we need to check the version of Ghostscript:

(See the part that starts with the "Check Ghostscript:" comment)

You don't be needing the check on existance like our Ghostscript check, since I assume you will be using `AC_SEARCH_LIBS' for GSL's existance. You just need the indented part after `AC_MSG_CHECKING(Ghostscript version)'.

You can then pass the check's result into `config.h' and use the information in your programming to decide which function to use.


Reply via email to