1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-06-02 03:15:40 +02:00

Better search for hdf5 in python-install

This commit is contained in:
Anthony Scemama 2023-06-02 14:53:54 +02:00
parent 7b6de725b5
commit 5e87794180
2 changed files with 42 additions and 2 deletions

View File

@ -16,7 +16,43 @@ done
# check that both variables are set
if [[ -z ${H5_LDFLAGS_LOCAL} ]] || [[ -z ${H5_CFLAGS_LOCAL} ]]; then
if [[ -z ${H5_LDFLAGS} ]] || [[ -z ${H5_CFLAGS} ]]; then
echo "Paths to the HDF5 installation are not provided. pkgconfig will try to detect them."
which h5cc &> /dev/null
if [[ $? -eq 0 ]] ; then
HDF5_tmp_flags=$(h5cc -showconfig \
| grep 'FLAGS\|Extra libraries:' \
| awk -F: '{printf("%s "), $2}' )
echo $HDF5_tmp_flags
# Find the installation directory and append include/
HDF5_tmp_inst=$(h5cc -showconfig \
| grep 'Installation point:' \
| awk '{print $NF}' )
echo $HDF5_tmp_inst
# Add this to the CPPFLAGS
HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include"
HDF5_SHOW=$(h5cc -show)
# Now sort the flags out based upon their prefixes
for arg in $HDF5_SHOW $HDF5_tmp_flags ; do
case "$arg" in
-I*) echo $HDF5_CPPFLAGS | grep -e "$arg" 2>&1 >/dev/null \
|| HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg"
;;
-L*) echo $HDF5_LDFLAGS | grep -e "$arg" 2>&1 >/dev/null \
|| HDF5_LDFLAGS="$HDF5_LDFLAGS $arg"
;;
-l*) echo $HDF5_LIBS | grep -e "$arg" 2>&1 >/dev/null \
|| HDF5_LIBS="$HDF5_LIBS $arg"
;;
esac
done
export H5_LDFLAGS="$HDF5_LDFLAGS"
export H5_CFLAGS="$HDF5_CPPFLAGS"
else
echo "Paths to the HDF5 installation are not provided. pkgconfig will try to detect them."
fi
else
echo "Using exported H5_LDFLAGS and H5_CFLAGS environment variables."
fi

View File

@ -166,7 +166,11 @@ On non-POSIX file systems, the function ~mkdtemp~ might is not defined.
In that case, we define an alternate one, which is not as safe as the original one.
#+begin_src c :tangle basic_text.c
#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L
#if /* Since glibc 2.19: */ _DEFAULT_SOURCE \
|| /* Glibc 2.19 and earlier: */ _BSD_SOURCE \
|| /* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200809L
/* mkdtemp is defined */
#else
char* mkdtemp(char* template) {