Commit c6e525af authored by Karl Wette's avatar Karl Wette

Update GSL configuration macros

- move LAL_CHECK_GSL_VERSION in lal.m4 to LALSUITE_CHECK_GSL_VERSION in lalsuite_build.m4
- use the same configure checks consistently for each LAL library that needs GSL
- refs #236
Original: 02526be48f667d9cc773976179d770312d065c68
parent 3b7ebbfd
......@@ -835,17 +835,62 @@ AC_ARG_WITH(
LALSUITE_ENABLE_MODULE([CUDA])
])
AC_DEFUN([LALSUITE_ENABLE_FAST_GSL],
[AC_ARG_ENABLE(
[fast_gsl],
AC_HELP_STRING([--enable-fast-gsl],[enable fast/inline GSL code [default=no]]),
AS_CASE(["${enableval}"],
[yes],[AC_DEFINE([HAVE_INLINE],[1],[Define to 1 to use inline code])
AC_DEFINE([GSL_C99_INLINE],[1],[Define to 1 to use GSL C99 inline code])
AC_DEFINE([GSL_RANGE_CHECK_OFF],[1],[Define to 1 to turn GSL range checking off])],
[no],,
AC_MSG_ERROR([bad value ${enableval} for --enable-fast-gsl]))
AC_DEFUN([LALSUITE_CHECK_GSL_VERSION],[
# $0: check for GSL version
lal_min_gsl_version=m4_normalize([$1])
AC_MSG_CHECKING(for GSL version >= $lal_min_gsl_version)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gsl/gsl_version.h>
int main(void)
{
int required_major, required_minor;
int major, minor;
char required_version[] = "$lal_min_gsl_version";
char version[] = GSL_VERSION;
if ( strcmp(GSL_VERSION, gsl_version) ) {
printf("error\n*** mismatch between header and library versions of GSL\n" );
printf("\n*** header has version %s\n", GSL_VERSION);
printf("\n*** library has version %s\n", gsl_version);
exit(1);
}
sscanf(required_version, "%d.%d", &required_major, &required_minor);
sscanf(version, "%d.%d", &major, &minor);
if ( major < required_major || (major == required_major && minor < required_minor) ) {
printf("no\n*** found version %s of GSL but minimum version is %d.%d\n", GSL_VERSION, required_major, required_minor );
exit(1);
}
return 0;
}
],[
AC_MSG_RESULT([yes])
],[
AC_MSG_ERROR([could not find required version of GSL])
],[
AC_MSG_WARN([cross compiling; assumed OK...])
])
# end $0
])
AC_DEFUN([LALSUITE_ENABLE_FAST_GSL],[
# $0: enable/disable fast/inline GSL code
AC_ARG_ENABLE(
[fast_gsl],
AC_HELP_STRING([--enable-fast-gsl],[enable fast/inline GSL code [default=no]]),
AS_CASE(["${enableval}"],
[yes],[
AC_DEFINE([HAVE_INLINE],[1],[Define to 1 to use inline code])
AC_DEFINE([GSL_C99_INLINE],[1],[Define to 1 to use GSL C99 inline code])
AC_DEFINE([GSL_RANGE_CHECK_OFF],[1],[Define to 1 to turn GSL range checking off])
],
[no],[:],
AC_MSG_ERROR([bad value ${enableval} for --enable-fast-gsl])
)
)
# end $0
])
AC_DEFUN([LALSUITE_ENABLE_OSX_VERSION_CHECK],
......
......@@ -235,9 +235,9 @@ LALSUITE_POP_UVARS
# check for gsl
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
LAL_CHECK_GSL_VERSION([1.9])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -85,35 +85,3 @@ AC_DEFUN([LAL_INTEL_FFT_LIBS_MSG_ERROR],
echo "**************************************************************"
AC_MSG_ERROR([Intel FFT must use either static or shared libraries])
])
AC_DEFUN([LAL_CHECK_GSL_VERSION],
[
lal_min_gsl_version=ifelse([$1], ,1.0,$1)
AC_MSG_CHECKING(for GSL version >= $lal_min_gsl_version)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gsl/gsl_version.h>
int main(void)
{
int required_major, required_minor;
int major, minor;
char required_version[] = "$lal_min_gsl_version";
char version[] = GSL_VERSION;
if ( strcmp(GSL_VERSION, gsl_version) ) {
printf("error\n*** mismatch between header and library versions of GSL\n" );
printf("\n*** header has version %s\n", GSL_VERSION);
printf("\n*** library has version %s\n", gsl_version);
exit(1);
}
sscanf(required_version, "%d.%d", &required_major, &required_minor);
sscanf(version, "%d.%d", &major, &minor);
if ( major < required_major || (major == required_major && minor < required_minor) ) {
printf("no\n*** found version %s of GSL but minimum version is %d.%d\n", GSL_VERSION, required_major, required_minor );
exit(1);
}
return 0;
}
], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(could not find required version of GSL)], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
])
......@@ -177,6 +177,7 @@ PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -108,7 +108,8 @@ AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -98,6 +98,7 @@ PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -134,7 +134,8 @@ AM_CONDITIONAL([HAVE_CHEALPIX],[test "x$HEALPIX_ENABLE_VAL" = "xENABLED"])
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -98,7 +98,8 @@ AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -100,7 +100,8 @@ AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
......@@ -101,7 +101,9 @@ AC_OPENMP
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
AC_CHECK_HEADERS([gsl/gsl_errno.h],,[AC_MSG_ERROR([could not find the gsl/gsl_errno.h header])])
......
......@@ -92,7 +92,8 @@ AC_CHECK_HEADERS([libxml/tree.h],,[AC_MSG_ERROR([could not find the libxml/tree.
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
LALSUITE_ADD_FLAGS([C],[${GSL_CFLAGS}],[${GSL_LIBS}])
AC_CHECK_LIB([gslcblas],[main],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_strerror],,[AC_MSG_ERROR([could not find the gsl library])])
AC_CHECK_LIB([gsl],[gsl_version],,[AC_MSG_ERROR([could not find the gsl library])])
LALSUITE_CHECK_GSL_VERSION([1.9])
LALSUITE_ENABLE_FAST_GSL
# check for gsl headers
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment