From 947a8a12f8b27a64403bfd3861111a0a476a7e56 Mon Sep 17 00:00:00 2001 From: q-posev Date: Thu, 7 Oct 2021 09:54:19 +0200 Subject: [PATCH] Fix bug due to PACKAGE_VERSION definition in trexio.h --- configure.ac | 1 + src/templates_front/build.sh | 5 ++++- src/templates_front/templator_front.org | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 8929ff9..3d9564b 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,7 @@ AC_CONFIG_MACRO_DIR([m4]) VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1` VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2` VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1` +AC_DEFINE_UNQUOTED(TREXIO_PACKAGE_VERSION, ["${PACKAGE_VERSION}"], [full version]) AC_DEFINE_UNQUOTED(TREXIO_VERSION_MAJOR, [$VERSION_MAJOR], [major version]) AC_DEFINE_UNQUOTED(TREXIO_VERSION_MINOR, [$VERSION_MINOR], [minor version]) AC_DEFINE_UNQUOTED(TREXIO_VERSION_PATCH, [$VERSION_PATCH], [patch version]) diff --git a/src/templates_front/build.sh b/src/templates_front/build.sh index b0b0ddb..4e78d8f 100644 --- a/src/templates_front/build.sh +++ b/src/templates_front/build.sh @@ -5,7 +5,10 @@ cat prefix_front.c > trexio.c cat prefix_front.h > trexio.h # grep some usefull constants from the config.h echo "" >> trexio.h -grep "_VERSION" ../../include/config.h >> trexio.h +grep "TREXIO_PACKAGE_VERSION" ../../include/config.h >> trexio.h +grep "TREXIO_VERSION_MAJOR" ../../include/config.h >> trexio.h +grep "TREXIO_VERSION_MINOR" ../../include/config.h >> trexio.h +grep "TREXIO_VERSION_PATCH" ../../include/config.h >> trexio.h echo "" >> trexio.h cat prefix_s_front.h > trexio_s.h diff --git a/src/templates_front/templator_front.org b/src/templates_front/templator_front.org index b1a6d6e..dfe489a 100644 --- a/src/templates_front/templator_front.org +++ b/src/templates_front/templator_front.org @@ -761,7 +761,7 @@ trexio_open(const char* file_name, const char mode, return NULL; } - strncpy(result->version, PACKAGE_VERSION, 16); + strncpy(result->version, TREXIO_PACKAGE_VERSION, 16); if (result->version[15] != '\0') { if (rc_open != NULL) *rc_open = TREXIO_FAILURE; free(result); @@ -817,15 +817,15 @@ trexio_open(const char* file_name, const char mode, switch (back_end) { case TREXIO_TEXT: - rc = trexio_text_write_metadata_package_version(result, PACKAGE_VERSION); + rc = trexio_text_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION); break; case TREXIO_HDF5: - rc = trexio_hdf5_write_metadata_package_version(result, PACKAGE_VERSION); + rc = trexio_hdf5_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION); break; /* case TREXIO_JSON: - rc = trexio_json_write_metadata_package_version(result, PACKAGE_VERSION); + rc = trexio_json_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION); break; ,*/ }