aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-23 15:10:45 +0200
committerThomas White <taw@physics.org>2017-10-23 15:11:46 +0200
commit39a9ae2daeb193f99dc9b2e6b05828fc89d513bf (patch)
tree1bd7f5433ecb4877d72c86a51e7907ac4f0c5a96 /configure.ac
parent8a93f86a6c2e2e43e6a9864fd8d5f31cc26a5011 (diff)
configure.ac: Improve HDF5 detection
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac42
1 files changed, 29 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 62358b61..07add2cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,11 +23,36 @@ AC_FUNC_MALLOC
gl_INIT
+dnl Find HDF5
AC_ARG_WITH(hdf5,
-[AS_HELP_STRING([--with-hdf5], [specify location of HDF5 library])],
-[HDF5_CFLAGS="-I$withval/include"
- HDF5_LIBS="-L$withval/lib -lhdf5"],
-[HDF5_LIBS="-lhdf5"])
+[AS_HELP_STRING([--with-hdf5],
+ [specify location of HDF5 (instead of trying pkg-config)])],
+[
+ AC_MSG_NOTICE([Using your specified location for HDF5])
+ HDF5_CFLAGS="-I$withval/include"
+ HDF5_LIBS="-L$withval/lib -lhdf5"
+],
+[
+ AC_MSG_NOTICE([checking for HDF5 using pkg-config])
+ PKG_CHECK_MODULES([HDF5], [hdf5],
+ [
+ AC_MSG_NOTICE([Found HDF5 using pkg-config])
+ ],
+ [
+ AC_MSG_NOTICE([Did not find HDF5 using pkg-config. Assuming default location.])
+ HDF5_CFLAGS=""
+ HDF5_LIBS="-lhdf5"
+ ])
+])
+
+dnl Check that HDF5 *actually* works...
+LIBS_SAVE=$LIBS
+LIBS=$HDF5_LIBS
+AC_CHECK_LIB([hdf5], [H5Fcreate], [],
+[
+ AC_MSG_ERROR([HDF5 not found!])
+])
+LIBS=$LIBS_SAVE
AC_ARG_WITH(gsl,
@@ -291,15 +316,6 @@ AC_CHECK_LIB([pthread], [sched_setaffinity], [
])
-LIBS_SAVE=$LIBS
-LIBS=$HDF5_LIBS
-AC_CHECK_LIB([hdf5], [H5Fcreate], [],
-[
- AC_MSG_ERROR([HDF5 not found!])
-])
-LIBS=$LIBS_SAVE
-
-
AC_CHECK_LIB([rt], [clock_gettime],
[
AC_DEFINE([HAVE_CLOCK_GETTIME], [1],