Skip to content
Snippets Groups Projects
Commit 795621d2 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Check for GSL in non-standard places with the --with-gsl option

When not explicitly given checks for GSL are made anyway, when explicitly given the checks must be successful
parent eba0f3db
No related branches found
No related tags found
1 merge request!515Check for GSL in non-standard places with the --with-gsl option
......@@ -407,13 +407,47 @@ 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
# Check for GSL. We test for this in the standard directories by default,
# and only disable if using --with-gsl=no or --without-gsl. When a value
# is given GSL must be found.
have_gsl="no"
AC_CHECK_LIB([gslcblas], [cblas_dgemm])
AC_CHECK_LIB([gsl], [gsl_integration_qag])
if test "x$ac_cv_lib_gslcblas_cblas_dgemm" = "xyes"; then
have_gsl="yes"
AC_ARG_WITH([gsl],
[AS_HELP_STRING([--with-gsl=PATH],
[root directory where GSL is installed @<:@yes/no@:>@]
)],
[with_gsl="$withval"],
[with_gsl="test"]
)
if test "x$with_gsl" != "xno"; then
if test "x$with_gsl" != "xyes" -a "x$with_gsl" != "xtest" -a "x$with_gsl" != "x"; then
GSL_LIBS="-L$with_gsl/lib -lgsl -lgslcblas"
GSL_INCS="-I$with_gsl/include"
else
GSL_LIBS="-lgsl -lgslcblas"
GSL_INCS=""
fi
# GSL is not specified, so just check if we have it.
if test "x$with_gsl" = "xtest"; then
AC_CHECK_LIB([gslcblas],[cblas_dgemm], [have_gsl="yes"], [have_gsl="no"], $GSL_LIBS)
if test "x$have_gsl" != "xno"; then
AC_DEFINE([HAVE_LIBGSLCBLAS],1,[The GSL CBLAS library appears to be present.]),
AC_CHECK_LIB([gsl],[gsl_integration_qag],
AC_DEFINE([HAVE_LIBGSL],1,[The GSL library appears to be present.]),
[have_gsl="no"], $GSL_LIBS)
fi
else
AC_CHECK_LIB([gslcblas],[cblas_dgemm],
AC_DEFINE([HAVE_LIBGSLCBLAS],1,[The GSL CBLAS library appears to be present.]),
AC_MSG_ERROR(something is wrong with the GSL CBLAS library!), $GSL_LIBS)
AC_CHECK_LIB([gsl],[gsl_integration_qag],
AC_DEFINE([HAVE_LIBGSL],1,[The GSL library appears to be present.]),
AC_MSG_ERROR(something is wrong with the GSL library!), $GSL_LIBS)
have_gsl="yes"
fi
fi
AC_SUBST([GSL_LIBS])
AC_SUBST([GSL_INCS])
AM_CONDITIONAL([HAVEGSL],[test -n "$GSL_LIBS"])
# Check for pthreads.
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
......@@ -445,7 +479,7 @@ AC_ARG_WITH([metis],
[AS_HELP_STRING([--with-metis=PATH],
[root directory where metis is installed @<:@yes/no@:>@]
)],
[],
[with_metis="$withval"],
[with_metis="no"]
)
if test "x$with_metis" != "xno"; then
......@@ -473,13 +507,13 @@ AH_VERBATIM([__STDC_FORMAT_MACROS],
#define __STDC_FORMAT_MACROS 1
#endif])
# Check for grackle.
# Check for grackle.
have_grackle="no"
AC_ARG_WITH([grackle],
[AS_HELP_STRING([--with-grackle=PATH],
[root directory where grackle is installed @<:@yes/no@:>@]
)],
[],
[with_grackle="$withval"],
[with_grackle="no"]
)
if test "x$with_grackle" != "xno"; then
......@@ -492,9 +526,9 @@ if test "x$with_grackle" != "xno"; then
GRACKLE_LIBS="-lgrackle"
GRACKLE_INCS=""
fi
have_grackle="yes"
AC_CHECK_LIB(
[grackle],
[initialize_chemistry_data],
......@@ -753,22 +787,22 @@ AC_ARG_WITH([hydro],
case "$with_hydro" in
gadget2)
AC_DEFINE([GADGET2_SPH], [1], [Gadget-2 SPH])
;;
;;
minimal)
AC_DEFINE([MINIMAL_SPH], [1], [Minimal SPH])
;;
;;
hopkins)
AC_DEFINE([HOPKINS_PE_SPH], [1], [Pressure-Entropy SPH])
;;
;;
default)
AC_DEFINE([DEFAULT_SPH], [1], [Default SPH])
;;
;;
gizmo)
AC_DEFINE([GIZMO_SPH], [1], [GIZMO SPH])
;;
;;
shadowfax)
AC_DEFINE([SHADOWFAX_SPH], [1], [Shadowfax SPH])
;;
;;
*)
AC_MSG_ERROR([Unknown hydrodynamics scheme: $with_hydro])
......@@ -793,7 +827,7 @@ if test "$enable_debug_interactions" != "no"; then
AC_DEFINE_UNQUOTED([MAX_NUM_OF_NEIGHBOURS], [$enableval] ,[The maximum number of particle neighbours to be logged])
[enable_debug_interactions="yes (Logging up to $enableval neighbours)"]
fi
else
else
[enable_debug_interactions="no (only available for gadget2 hydro scheme)"]
fi
fi
......@@ -809,22 +843,22 @@ AC_ARG_WITH([kernel],
case "$with_kernel" in
cubic-spline)
AC_DEFINE([CUBIC_SPLINE_KERNEL], [1], [Cubic spline kernel])
;;
;;
quartic-spline)
AC_DEFINE([QUARTIC_SPLINE_KERNEL], [1], [Quartic spline kernel])
;;
;;
quintic-spline)
AC_DEFINE([QUINTIC_SPLINE_KERNEL], [1], [Quintic spline kernel])
;;
;;
wendland-C2)
AC_DEFINE([WENDLAND_C2_KERNEL], [1], [Wendland-C2 kernel])
;;
;;
wendland-C4)
AC_DEFINE([WENDLAND_C4_KERNEL], [1], [Wendland-C4 kernel])
;;
;;
wendland-C6)
AC_DEFINE([WENDLAND_C6_KERNEL], [1], [Wendland-C6 kernel])
;;
;;
*)
AC_MSG_ERROR([Unknown kernel function: $with_kernel])
;;
......@@ -841,13 +875,13 @@ AC_ARG_WITH([hydro-dimension],
case "$with_dimension" in
1)
AC_DEFINE([HYDRO_DIMENSION_1D], [1], [1D solver])
;;
;;
2)
AC_DEFINE([HYDRO_DIMENSION_2D], [2], [2D solver])
;;
;;
3)
AC_DEFINE([HYDRO_DIMENSION_3D], [3], [3D solver])
;;
;;
*)
AC_MSG_ERROR([Dimensionality must be 1, 2 or 3])
;;
......@@ -864,10 +898,10 @@ AC_ARG_WITH([equation-of-state],
case "$with_eos" in
ideal-gas)
AC_DEFINE([EOS_IDEAL_GAS], [1], [Ideal gas equation of state])
;;
;;
isothermal-gas)
AC_DEFINE([EOS_ISOTHERMAL_GAS], [1], [Isothermal gas equation of state])
;;
;;
*)
AC_MSG_ERROR([Unknown equation of state: $with_eos])
;;
......@@ -884,16 +918,16 @@ AC_ARG_WITH([adiabatic-index],
case "$with_gamma" in
5/3)
AC_DEFINE([HYDRO_GAMMA_5_3], [5./3.], [Adiabatic index is 5/3])
;;
;;
7/5)
AC_DEFINE([HYDRO_GAMMA_7_5], [7./5.], [Adiabatic index is 7/5])
;;
;;
4/3)
AC_DEFINE([HYDRO_GAMMA_4_3], [4./3.], [Adiabatic index is 4/3])
;;
;;
2)
AC_DEFINE([HYDRO_GAMMA_2_1], [2.], [Adiabatic index is 2])
;;
;;
*)
AC_MSG_ERROR([Unknown adiabatic index: $with_gamma])
;;
......@@ -910,16 +944,16 @@ AC_ARG_WITH([riemann-solver],
case "$with_riemann" in
none)
AC_DEFINE([RIEMANN_SOLVER_NONE], [1], [No Riemann solver])
;;
;;
exact)
AC_DEFINE([RIEMANN_SOLVER_EXACT], [1], [Exact Riemann solver])
;;
;;
trrs)
AC_DEFINE([RIEMANN_SOLVER_TRRS], [1], [Two Rarefaction Riemann Solver])
;;
;;
hllc)
AC_DEFINE([RIEMANN_SOLVER_HLLC], [1], [Harten-Lax-van Leer-Contact Riemann solver])
;;
;;
*)
AC_MSG_ERROR([Unknown Riemann solver: $with_riemann])
;;
......@@ -936,19 +970,19 @@ AC_ARG_WITH([cooling],
case "$with_cooling" in
none)
AC_DEFINE([COOLING_NONE], [1], [No cooling function])
;;
;;
const-du)
AC_DEFINE([COOLING_CONST_DU], [1], [Const du/dt cooling function])
;;
;;
const-lambda)
AC_DEFINE([COOLING_CONST_LAMBDA], [1], [Const Lambda cooling function])
;;
;;
grackle)
AC_DEFINE([COOLING_GRACKLE], [1], [Cooling via the grackle library])
;;
;;
EAGLE)
AC_DEFINE([COOLING_EAGLE], [1], [Cooling following the EAGLE model])
;;
;;
*)
AC_MSG_ERROR([Unknown cooling function: $with_cooling])
;;
......@@ -965,13 +999,13 @@ AC_ARG_WITH([chemistry],
case "$with_chemistry" in
none)
AC_DEFINE([CHEMISTRY_NONE], [1], [No chemistry function])
;;
;;
gear)
AC_DEFINE([CHEMISTRY_GEAR], [1], [Chemistry taken from the GEAR model])
;;
;;
EAGLE)
AC_DEFINE([CHEMISTRY_EAGLE], [1], [Chemistry taken from the EAGLE model])
;;
;;
*)
AC_MSG_ERROR([Unknown chemistry function: $with_chemistry])
;;
......@@ -988,25 +1022,25 @@ AC_ARG_WITH([ext-potential],
case "$with_potential" in
none)
AC_DEFINE([EXTERNAL_POTENTIAL_NONE], [1], [No external potential])
;;
;;
point-mass)
AC_DEFINE([EXTERNAL_POTENTIAL_POINTMASS], [1], [Point-mass external potential])
;;
;;
isothermal)
AC_DEFINE([EXTERNAL_POTENTIAL_ISOTHERMAL], [1], [Isothermal external potential])
;;
;;
disc-patch)
AC_DEFINE([EXTERNAL_POTENTIAL_DISC_PATCH], [1], [Disc-patch external potential])
;;
;;
sine-wave)
AC_DEFINE([EXTERNAL_POTENTIAL_SINE_WAVE], [1], [Sine wave external potential in 1D])
;;
;;
point-mass-ring)
AC_DEFINE([EXTERNAL_POTENTIAL_POINTMASS_RING], [1], [Point mass potential for Keplerian Ring (Hopkins 2015).])
;;
;;
point-mass-softened)
AC_DEFINE([EXTERNAL_POTENTIAL_POINTMASS_SOFT], [1], [Softened point-mass potential with form 1/(r^2 + softening^2).])
;;
;;
*)
AC_MSG_ERROR([Unknown external potential: $with_potential])
;;
......@@ -1054,7 +1088,7 @@ touch src/version.c
AC_OUTPUT
# Report general configuration.
AC_MSG_RESULT([
AC_MSG_RESULT([
------- Summary --------
$PACKAGE_NAME v.$PACKAGE_VERSION
......@@ -1084,7 +1118,7 @@ AC_MSG_RESULT([
Riemann solver : $with_riemann
Cooling function : $with_cooling
Chemistry : $with_chemistry
External potential : $with_potential
Multipole order : $with_multipole_order
No gravity below ID : $no_gravity_below_id
......
......@@ -19,12 +19,12 @@
MYFLAGS =
# Add the source directory and debug to CFLAGS
AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS)
AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS)
AM_LDFLAGS = $(HDF5_LDFLAGS)
# Extra libraries.
EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIBS)
EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS)
# MPI libraries.
MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS)
......
......@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Add the debug flag to the whole thing
AM_CFLAGS = $(HDF5_CPPFLAGS)
AM_CFLAGS = $(HDF5_CPPFLAGS) $(GSL_INCS)
# Assign a "safe" version number
AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) -version-info 0:0:0
......@@ -25,7 +25,7 @@ AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) -version-info 0:0:0
GIT_CMD = @GIT_CMD@
# Additional dependencies for shared libraries.
EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIB)
EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIB) $(GSL_LIBS)
# MPI libraries.
MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment