diff --git a/CMakeLists.txt b/CMakeLists.txt index b3c6473b..e893c548 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,9 @@ STRING (REGEX MATCH "#define MSGPACK_VERSION_MAJOR *([0-9a-zA-Z_]*)" NULL_OUT ${ SET (VERSION_MAJOR ${CMAKE_MATCH_1}) STRING (REGEX MATCH "#define MSGPACK_VERSION_MINOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) SET (VERSION_MINOR ${CMAKE_MATCH_1}) -STRING (REGEX MATCH "#define MSGPACK_VERSION_RELEASE *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) -SET (VERSION_RELEASE ${CMAKE_MATCH_1}) -SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}) +STRING (REGEX MATCH "#define MSGPACK_VERSION_REVISION *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) +SET (VERSION_REVISION ${CMAKE_MATCH_1}) +SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}) SET (prefix ${CMAKE_INSTALL_PREFIX}) SET (exec_prefix "\${prefix}") diff --git a/configure.in b/configure.in index ef5150d5..d53cf534 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(msgpack, m4_esyscmd([cat include/msgpack/version_master.h | tr -d "\n" | sed -e 's/#define MSGPACK_VERSION_MAJOR\s*\(\w*\)/\1./g' -e 's/#define MSGPACK_VERSION_MINOR\s*\(\w*\)/\1./g' -e 's/#define MSGPACK_VERSION_RELEASE\s*\(\w*\)/\1/g'])) +AC_INIT(msgpack, m4_esyscmd([cat include/msgpack/version_master.h | tr -d "\n" | sed -e 's/#define MSGPACK_VERSION_MAJOR\s*\(\w*\)/\1./g' -e 's/#define MSGPACK_VERSION_MINOR\s*\(\w*\)/\1./g' -e 's/#define MSGPACK_VERSION_REVISION\s*\(\w*\)/\1/g'])) AC_CONFIG_AUX_DIR(ac) AM_INIT_AUTOMAKE AC_CONFIG_HEADER(config.h) @@ -86,10 +86,10 @@ AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes") major=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\1/'` minor=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\2/'` -release=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\3/'` +revision=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\3/'` AC_SUBST(VERSION_MAJOR, $major) AC_SUBST(VERSION_MINOR, $minor) -AC_SUBST(VERSION_RELEASE, $release) +AC_SUBST(VERSION_REVISION, $revision) AC_OUTPUT([Makefile diff --git a/include/msgpack/version.h b/include/msgpack/version.h index 2a324e5c..233fa818 100644 --- a/include/msgpack/version.h +++ b/include/msgpack/version.h @@ -30,9 +30,9 @@ int msgpack_version_minor(void); #include "version_master.h" #define MSGPACK_STR(v) #v -#define MSGPACK_VERSION_I(maj, min, rel) MSGPACK_STR(maj) "." MSGPACK_STR(min) "." MSGPACK_STR(rel) +#define MSGPACK_VERSION_I(maj, min, rev) MSGPACK_STR(maj) "." MSGPACK_STR(min) "." MSGPACK_STR(rev) -#define MSGPACK_VERSION MSGPACK_VERSION_I(MSGPACK_VERSION_MAJOR, MSGPACK_VERSION_MINOR, MSGPACK_VERSION_RELEASE) +#define MSGPACK_VERSION MSGPACK_VERSION_I(MSGPACK_VERSION_MAJOR, MSGPACK_VERSION_MINOR, MSGPACK_VERSION_REVISION) #ifdef __cplusplus } diff --git a/include/msgpack/version.hpp b/include/msgpack/version.hpp index d9e2f371..d1ccd89e 100644 --- a/include/msgpack/version.hpp +++ b/include/msgpack/version.hpp @@ -21,9 +21,9 @@ #include "version_master.h" #define MSGPACK_STR(v) #v -#define MSGPACK_VERSION_I(maj, min, rel) MSGPACK_STR(maj) "." MSGPACK_STR(min) "." MSGPACK_STR(rel) +#define MSGPACK_VERSION_I(maj, min, rev) MSGPACK_STR(maj) "." MSGPACK_STR(min) "." MSGPACK_STR(rev) -#define MSGPACK_VERSION MSGPACK_VERSION_I(MSGPACK_VERSION_MAJOR, MSGPACK_VERSION_MINOR, MSGPACK_VERSION_RELEASE) +#define MSGPACK_VERSION MSGPACK_VERSION_I(MSGPACK_VERSION_MAJOR, MSGPACK_VERSION_MINOR, MSGPACK_VERSION_REVISION) inline const char* msgpack_version(void) { return MSGPACK_VERSION; @@ -37,4 +37,8 @@ inline int msgpack_version_minor(void) { return MSGPACK_VERSION_MINOR; } +inline int msgpack_version_revision(void) { + return MSGPACK_VERSION_REVISION; +} + #endif /* msgpack/version.hpp */ diff --git a/include/msgpack/version_master.h b/include/msgpack/version_master.h index cabb9718..c3154805 100644 --- a/include/msgpack/version_master.h +++ b/include/msgpack/version_master.h @@ -1,3 +1,3 @@ -#define MSGPACK_VERSION_MAJOR 0 -#define MSGPACK_VERSION_MINOR 6 -#define MSGPACK_VERSION_RELEASE 0 +#define MSGPACK_VERSION_MAJOR 0 +#define MSGPACK_VERSION_MINOR 6 +#define MSGPACK_VERSION_REVISION 0 diff --git a/src/version.c b/src/version.c index 78e06527..83f75108 100644 --- a/src/version.c +++ b/src/version.c @@ -15,3 +15,8 @@ int msgpack_version_minor(void) return MSGPACK_VERSION_MINOR; } +int msgpack_version_revision(void) +{ + return MSGPACK_VERSION_REVISION; +} + diff --git a/test/version.cpp b/test/version.cpp index d2809b21..6bb39018 100644 --- a/test/version.cpp +++ b/test/version.cpp @@ -3,11 +3,12 @@ TEST(version, print) { - printf("MSGPACK_VERSION : %s\n", MSGPACK_VERSION); - printf("MSGPACK_VERSION_MAJOR : %d\n", MSGPACK_VERSION_MAJOR); - printf("MSGPACK_VERSION_MINOR : %d\n", MSGPACK_VERSION_MINOR); - printf("msgpack_version() : %s\n", msgpack_version()); - printf("msgpack_version_major() : %d\n", msgpack_version_major()); - printf("msgpack_version_minor() : %d\n", msgpack_version_minor()); + printf("MSGPACK_VERSION : %s\n", MSGPACK_VERSION); + printf("MSGPACK_VERSION_MAJOR : %d\n", MSGPACK_VERSION_MAJOR); + printf("MSGPACK_VERSION_MINOR : %d\n", MSGPACK_VERSION_MINOR); + printf("MSGPACK_VERSION_REVISION : %d\n", MSGPACK_VERSION_REVISION); + printf("msgpack_version() : %s\n", msgpack_version()); + printf("msgpack_version_major() : %d\n", msgpack_version_major()); + printf("msgpack_version_minor() : %d\n", msgpack_version_minor()); + printf("msgpack_version_revision() : %d\n", msgpack_version_revision()); } -