diff --git a/python/install_pytrexio.sh b/python/install_pytrexio.sh index 8542874..f90f650 100755 --- a/python/install_pytrexio.sh +++ b/python/install_pytrexio.sh @@ -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 diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index 3005aa7..39874fe 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -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) {