From 27dd260b7f52b3460211c2ebd13dc9ab2ce7f9e5 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Thu, 25 Jan 2018 11:22:05 +0100 Subject: [PATCH] Correctly detect the GSL and print its version in the greetings. --- configure.ac | 4 ++++ src/common_io.c | 3 +++ src/version.c | 23 +++++++++++++++++++++++ src/version.h | 1 + 4 files changed, 31 insertions(+) diff --git a/configure.ac b/configure.ac index 3256c0ff55..2cb08bde9b 100644 --- a/configure.ac +++ b/configure.ac @@ -404,6 +404,10 @@ AC_HEADER_STDC # Check for the libraries we will need. AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(something is wrong with the math library!)) +# Check for GSL +AC_CHECK_LIB([gslcblas],[cblas_dgemm]) +AC_CHECK_LIB([gsl],[gsl_blas_dgemm]) + # Check for pthreads. AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $LIBS"], diff --git a/src/common_io.c b/src/common_io.c index 7d0b0cb3ef..b6a4f1975a 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -395,6 +395,9 @@ void io_write_code_description(hid_t h_file) { #ifdef HAVE_FFTW io_write_attribute_s(h_grpcode, "FFTW library version", fftw3_version()); #endif +#ifdef HAVE_LIBGSL + io_write_attribute_s(h_grpcode, "GSL library version", libgsl_version()); +#endif #ifdef WITH_MPI io_write_attribute_s(h_grpcode, "MPI library", mpi_version()); #ifdef HAVE_METIS diff --git a/src/version.c b/src/version.c index f4177e5c83..0c64af87de 100644 --- a/src/version.c +++ b/src/version.c @@ -37,6 +37,10 @@ #include <fftw3.h> #endif +#ifdef HAVE_LIBGSL +#include <gsl/gsl_version.h> +#endif + /* Some standard headers. */ #include <stdio.h> #include <stdlib.h> @@ -332,6 +336,22 @@ const char *fftw3_version(void) { return version; } +/** + * @brief return the GSL version used when SWIFT was built. + * + * @result description of the GSL version. + */ +const char *libgsl_version(void) { + + static char version[256] = {0}; +#if defined(HAVE_LIBGSL) + sprintf(version, "%s", gsl_version); +#else + sprintf(version, "Unknown version"); +#endif + return version; +} + /** * @brief return the thread barrier used in SWIFT. * @@ -376,6 +396,9 @@ void greetings(void) { #ifdef HAVE_FFTW printf(" FFTW library version: %s\n", fftw3_version()); #endif +#ifdef HAVE_LIBGSL + printf(" GSL library version: %s\n", libgsl_version()); +#endif #ifdef WITH_MPI printf(" MPI library: %s\n", mpi_version()); #ifdef HAVE_METIS diff --git a/src/version.h b/src/version.h index 1af76b647b..3163f242c5 100644 --- a/src/version.h +++ b/src/version.h @@ -34,6 +34,7 @@ const char* mpi_version(void); const char* metis_version(void); const char* hdf5_version(void); const char* fftw3_version(void); +const char* libgsl_version(void); const char* thread_barrier_version(void); void greetings(void); -- GitLab