diff --git a/configure.ac b/configure.ac
index 8ef3bcfd..7cf48ee9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([Raqm],
- [0.6.0],
+ [0.7.0],
[https://github.com/HOST-Oman/libraqm/issues],
[raqm],
[https://github.com/HOST-Oman/libraqm/])
@@ -18,11 +18,21 @@ AX_COMPILER_FLAGS
LT_INIT
-# Libtool version
+# Version
m4_define([_triplet], m4_split(AC_PACKAGE_VERSION, [[.]]))
m4_define([_major], m4_argn(1, _triplet))
m4_define([_minor], m4_argn(2, _triplet))
m4_define([_micro], m4_argn(3, _triplet))
+RAQM_VERSION_MAJOR=_major
+RAQM_VERSION_MINOR=_minor
+RAQM_VERSION_MICRO=_micro
+RAQM_VERSION=AC_PACKAGE_VERSION
+AC_SUBST(RAQM_VERSION_MAJOR)
+AC_SUBST(RAQM_VERSION_MINOR)
+AC_SUBST(RAQM_VERSION_MICRO)
+AC_SUBST(RAQM_VERSION)
+
+# Libtool version
m4_define([_age], m4_eval(_major*10000 + _minor*100))
m4_define([_current], m4_eval(_major + _age))
RAQM_LIBTOOL_VERSION=_current:_micro:_age
@@ -56,6 +66,7 @@ AC_CONFIG_FILES([
Makefile
raqm.pc
src/Makefile
+ src/raqm-version.h
tests/Makefile
docs/Makefile
docs/version.xml
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 8ab9d732..b567b4e4 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -57,7 +57,7 @@ CFILE_GLOB=$(top_srcdir)/src/raqm.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
-EXTRA_HFILES=
+EXTRA_HFILES=$(top_builddir)/src/raqm-version.h
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
diff --git a/docs/raqm-docs.xml b/docs/raqm-docs.xml
index 2184e866..4cf5b31a 100644
--- a/docs/raqm-docs.xml
+++ b/docs/raqm-docs.xml
@@ -42,6 +42,10 @@
Index of new symbols in 0.6.x
+
+ Index of new symbols in 0.7.x
+
+
Index of deprecated API
diff --git a/docs/raqm-sections.txt b/docs/raqm-sections.txt
index b9195599..25d791cf 100644
--- a/docs/raqm-sections.txt
+++ b/docs/raqm-sections.txt
@@ -16,6 +16,14 @@ raqm_layout
raqm_get_glyphs
raqm_index_to_position
raqm_position_to_index
+raqm_version
+raqm_version_atleast
+raqm_version_string
+RAQM_VERSION_ATLEAST
+RAQM_VERSION_MAJOR
+RAQM_VERSION_MICRO
+RAQM_VERSION_MINOR
+RAQM_VERSION_STRING
raqm_t
raqm_direction_t
raqm_glyph_t
diff --git a/src/Makefile.am b/src/Makefile.am
index c8b33945..e2b1b5eb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,10 +6,12 @@ check_LTLIBRARIES = libraqm-test.la
libraqm_la_SOURCES = \
raqm.c \
raqm.h \
+ raqm-version.h \
$(NULL)
include_HEADERS = \
raqm.h \
+ raqm-version.h \
$(NULL)
libraqm_la_LIBADD = \
diff --git a/src/raqm-version.h.in b/src/raqm-version.h.in
new file mode 100644
index 00000000..93b20d23
--- /dev/null
+++ b/src/raqm-version.h.in
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2011 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef _RAQM_H_IN_
+#error "Include instead."
+#endif
+
+#ifndef _RAQM_VERSION_H_
+#define _RAQM_VERSION_H_
+
+#define RAQM_VERSION_MAJOR @RAQM_VERSION_MAJOR@
+#define RAQM_VERSION_MINOR @RAQM_VERSION_MINOR@
+#define RAQM_VERSION_MICRO @RAQM_VERSION_MICRO@
+
+#define RAQM_VERSION_STRING "@RAQM_VERSION@"
+
+#define RAQM_VERSION_ATLEAST(major,minor,micro) \
+ ((major)*10000+(minor)*100+(micro) <= \
+ RAQM_VERSION_MAJOR*10000+RAQM_VERSION_MINOR*100+RAQM_VERSION_MICRO)
+
+#endif /* _RAQM_VERSION_H_ */
diff --git a/src/raqm.c b/src/raqm.c
index f974b0b0..fccf4f0b 100644
--- a/src/raqm.c
+++ b/src/raqm.c
@@ -1974,3 +1974,107 @@ _raqm_in_hangul_syllable (hb_codepoint_t ch)
(void)ch;
return false;
}
+
+/**
+ * raqm_version:
+ * @major: (out): Library major version component.
+ * @minor: (out): Library minor version component.
+ * @micro: (out): Library micro version component.
+ *
+ * Returns library version as three integer components.
+ *
+ * Since: 0.7
+ **/
+void
+raqm_version (unsigned int *major,
+ unsigned int *minor,
+ unsigned int *micro)
+{
+ *major = RAQM_VERSION_MAJOR;
+ *minor = RAQM_VERSION_MINOR;
+ *micro = RAQM_VERSION_MICRO;
+}
+
+/**
+ * raqm_version_string:
+ *
+ * Returns library version as a string with three components.
+ *
+ * Return value: library version string.
+ *
+ * Since: 0.7
+ **/
+const char *
+raqm_version_string (void)
+{
+ return RAQM_VERSION_STRING;
+}
+
+/**
+ * raqm_version_atleast:
+ * @major: Library major version component.
+ * @minor: Library minor version component.
+ * @micro: Library micro version component.
+ *
+ * Checks if library version is less than or equal the specified version.
+ *
+ * Return value:
+ * %true if library version is less than or equal the specfied version, %false
+ * otherwise.
+ *
+ * Since: 0.7
+ **/
+bool
+raqm_version_atleast (unsigned int major,
+ unsigned int minor,
+ unsigned int micro)
+{
+ return RAQM_VERSION_ATLEAST (major, minor, micro);
+}
+
+/**
+ * RAQM_VERSION_ATLEAST:
+ * @major: Library major version component.
+ * @minor: Library minor version component.
+ * @micro: Library micro version component.
+ *
+ * Checks if library version is less than or equal the specified version.
+ *
+ * Return value:
+ * %true if library version is less than or equal the specfied version, %false
+ * otherwise.
+ *
+ * Since: 0.7
+ **/
+
+/**
+ * RAQM_VERSION_STRING:
+ *
+ * Library version as a string with three components.
+ *
+ * Since: 0.7
+ **/
+
+/**
+ * RAQM_VERSION_MAJOR:
+ *
+ * Library major version component.
+ *
+ * Since: 0.7
+ **/
+
+/**
+ * RAQM_VERSION_MINOR:
+ *
+ * Library minor version component.
+ *
+ * Since: 0.7
+ **/
+
+/**
+ * RAQM_VERSION_MICRO:
+ *
+ * Library micro version component.
+ *
+ * Since: 0.7
+ **/
diff --git a/src/raqm.h b/src/raqm.h
index 09c28e73..1a33fe8b 100644
--- a/src/raqm.h
+++ b/src/raqm.h
@@ -24,6 +24,7 @@
#ifndef _RAQM_H_
#define _RAQM_H_
+#define _RAQM_H_IN_
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -38,6 +39,8 @@
extern "C" {
#endif
+#include "raqm-version.h"
+
/**
* raqm_t:
*
@@ -161,7 +164,22 @@ raqm_position_to_index (raqm_t *rq,
int y,
size_t *index);
+void
+raqm_version (unsigned int *major,
+ unsigned int *minor,
+ unsigned int *micro);
+
+const char *
+raqm_version_string (void);
+
+bool
+raqm_version_atleast (unsigned int major,
+ unsigned int minor,
+ unsigned int micro);
+
+
#ifdef __cplusplus
}
#endif
+#undef _RAQM_H_IN_
#endif /* _RAQM_H_ */
diff --git a/tests/raqm-test.c b/tests/raqm-test.c
index 7d5d25fa..676e6512 100644
--- a/tests/raqm-test.c
+++ b/tests/raqm-test.c
@@ -116,8 +116,20 @@ main (int argc, char **argv)
raqm_direction_t dir;
int x = 0, y = 0;
+ unsigned int major, minor, micro;
+
setlocale (LC_ALL, "");
+ fprintf (stderr, "Raqm " RAQM_VERSION_STRING "\n");
+
+ raqm_version (&major, &minor, µ);
+
+ assert (major == RAQM_VERSION_MAJOR);
+ assert (minor == RAQM_VERSION_MINOR);
+ assert (micro == RAQM_VERSION_MICRO);
+
+ assert (raqm_version_atleast (major, minor, micro));
+
if (!parse_args(argc, argv))
return 1;