diff --git a/cpp/Makefile.am b/cpp/Makefile.am index 871ff8c0..7dd48910 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -12,7 +12,6 @@ EXTRA_DIST = \ $(DOC_FILES) doxygen: - ./preprocess ./preprocess clean cd src && $(MAKE) doxygen ./preprocess diff --git a/cpp/configure.in b/cpp/configure.in index 0895be4b..ffe3671e 100644 --- a/cpp/configure.in +++ b/cpp/configure.in @@ -54,5 +54,10 @@ add CFLAGS="--march=i686" and CXXFLAGS="-march=i686" options to ./configure as f ]) fi +major=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` +minor=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` +AC_SUBST(VERSION_MAJOR, $major) +AC_SUBST(VERSION_MINOR, $minor) + AC_OUTPUT([Makefile src/Makefile test/Makefile]) diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am index 6b6457e6..78d14aa3 100644 --- a/cpp/src/Makefile.am +++ b/cpp/src/Makefile.am @@ -4,6 +4,7 @@ lib_LTLIBRARIES = libmsgpack.la libmsgpack_la_SOURCES = \ unpack.c \ objectc.c \ + version.c \ vrefbuffer.c \ zone.c \ object.cpp @@ -18,15 +19,12 @@ lib_LTLIBRARIES += libmsgpackc.la libmsgpackc_la_SOURCES = \ unpack.c \ objectc.c \ + version.c \ vrefbuffer.c \ zone.c libmsgpackc_la_LDFLAGS = -version-info 2:0:0 -# work around for duplicated file name -kumo_manager_CFLAGS = $(AM_CFLAGS) -kumo_manager_CXXFLAGS = $(AM_CXXFLAGS) - nobase_include_HEADERS = \ msgpack/pack_define.h \ @@ -44,6 +42,7 @@ nobase_include_HEADERS = \ msgpack/zone.h \ msgpack.hpp \ msgpack/sbuffer.hpp \ + msgpack/version.h \ msgpack/vrefbuffer.hpp \ msgpack/zbuffer.hpp \ msgpack/pack.hpp \ @@ -69,11 +68,19 @@ nobase_include_HEADERS = \ msgpack/type/tr1/unordered_set.hpp EXTRA_DIST = \ + msgpack/version.h.in \ msgpack/zone.hpp.erb \ msgpack/type/define.hpp.erb \ msgpack/type/tuple.hpp.erb +msgpack/version.h: msgpack/version.h.in Makefile.in + sed -e s/VERSION_UNDEFINED/$(VERSION)/ \ + -e s/VERSION_MAJOR_UNDEFINED/$(VERSION_MAJOR)/ \ + -e s/VERSION_MINOR_UNDEFINED/$(VERSION_MINOR)/ \ + $< > $@ + + doxygen_c: cat ../Doxyfile > Doxyfile_c echo "FILE_PATTERNS = *.h" >> Doxyfile_c diff --git a/cpp/src/msgpack.h b/cpp/src/msgpack.h index 0cd8a199..08f27688 100644 --- a/cpp/src/msgpack.h +++ b/cpp/src/msgpack.h @@ -26,3 +26,5 @@ #include "msgpack/unpack.h" #include "msgpack/sbuffer.h" #include "msgpack/vrefbuffer.h" +#include "msgpack/version.h" + diff --git a/cpp/src/msgpack/version.h.in b/cpp/src/msgpack/version.h.in new file mode 100644 index 00000000..af292d0d --- /dev/null +++ b/cpp/src/msgpack/version.h.in @@ -0,0 +1,40 @@ +/* + * MessagePack for C version information + * + * Copyright (C) 2008-2009 FURUHASHI Sadayuki + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MSGPACK_VERSION_H__ +#define MSGPACK_VERSION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +const char* msgpack_version(void); +int msgpack_version_major(void); +int msgpack_version_minor(void); + +#define MSGPACK_VERSION "VERSION_UNDEFINED" +#define MSGPACK_VERSION_MAJOR VERSION_MAJOR_UNDEFINED +#define MSGPACK_VERSION_MINOR VERSION_MINOR_UNDEFINED + + +#ifdef __cplusplus +} +#endif + +#endif /* msgpack/version.h */ + diff --git a/cpp/src/version.c b/cpp/src/version.c new file mode 100644 index 00000000..3d956f18 --- /dev/null +++ b/cpp/src/version.c @@ -0,0 +1,17 @@ +#include "msgpack.h" + +const char* msgpack_version(void) +{ + return MSGPACK_VERSION; +} + +int msgpack_version_major(void) +{ + return MSGPACK_VERSION_MAJOR; +} + +int msgpack_version_minor(void) +{ + return MSGPACK_VERSION_MINOR; +} + diff --git a/cpp/test/Makefile.am b/cpp/test/Makefile.am index 1f522150..bb9439e3 100644 --- a/cpp/test/Makefile.am +++ b/cpp/test/Makefile.am @@ -13,6 +13,7 @@ check_PROGRAMS = \ convert \ buffer \ cases \ + version \ msgpackc_test \ msgpack_test @@ -37,6 +38,8 @@ buffer_LDADD = -lz cases_SOURCES = cases.cc +version_SOURCES = version.cc + msgpackc_test_SOURCES = msgpackc_test.cpp msgpack_test_SOURCES = msgpack_test.cpp