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) { diff --git a/tests/io_dset_sparse.c b/tests/io_dset_sparse.c index 298158e..575210f 100644 --- a/tests/io_dset_sparse.c +++ b/tests/io_dset_sparse.c @@ -46,7 +46,7 @@ static int test_write_dset_sparse (const char* file_name, const back_end_t backe uint64_t chunk_size = (uint64_t) size/N_CHUNKS; chunk_size = chunk_size > 0 ? chunk_size : (uint64_t) size; int n_chunks = size/chunk_size; - printf("chunk_size = %ld\n", chunk_size); + printf("chunk_size = %lld\n", chunk_size); printf("n_chunks = %d\n", n_chunks); uint64_t offset_f = 0UL + offset; @@ -55,7 +55,7 @@ static int test_write_dset_sparse (const char* file_name, const back_end_t backe // write n_chunks times using write_sparse while(offset_d < size) { if (offset_d+chunk_size > size) chunk_size = size-offset_d; - printf("chunk_size = %ld\n", chunk_size); + printf("chunk_size = %lld\n", chunk_size); if (chunk_size == 0L) break; rc = trexio_write_mo_2e_int_eri(file, offset_f, chunk_size, &index[4*offset_d], &value[offset_d]); printf("%5d: %s\n", __LINE__, trexio_string_of_error(rc)); @@ -163,7 +163,7 @@ static int test_read_dset_sparse (const char* file_name, const back_end_t backen printf("%5d: %s\n", __LINE__, trexio_string_of_error(rc)); /* for (int i=0 ; i dict: tmp_dict.update(get_dtype_dict(v2[0], 'num')) if v2[0] in ['int', 'dim', 'dim readonly']: tmp_dict['trex_json_int_type'] = v2[0] - tmp_dict['is_index'] = 'false' + tmp_dict['is_index'] = '(false)' elif v2[0] in ['index']: tmp_dict['trex_json_int_type'] = v2[0] tmp_dict['is_index'] = 'file->one_based' else: tmp_dict['trex_json_int_type'] = '' - tmp_dict['is_index'] = 'false' + tmp_dict['is_index'] = '(false)' num_dict[tmp_num] = tmp_dict @@ -721,7 +721,7 @@ def split_dset_dict_detailed (datasets: dict) -> tuple: if 'index' in datatype: tmp_dict['is_index'] = 'file->one_based' else: - tmp_dict['is_index'] = 'false' + tmp_dict['is_index'] = '(false)' # add the list of dimensions tmp_dict['dims'] = [dim.replace('.','_') for dim in v[1]]