695b3a2c7b94f44c7caa7326c7f2ce9954c4bcbc
diff --git a/configure.ac b/configure.ac
index 3cb2f0d..492e01b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,13 @@
 dnl Process this file with autoconf to produce a configure script.
 
+m4_define([ev_version_major],[2])
+m4_define([ev_version_minor],[25])
+m4_define([ev_version_micro],[5])
+m4_define([ev_version_extra],[])
+m4_define([ev_version],[ev_version_major.ev_version_minor.ev_version_micro()ev_version_extra])
+
 AC_PREREQ(2.57)
-AC_INIT([Evince],[2.25.5],[http://bugzilla.gnome.org/enter_bug.cgi?product=evince],[evince])
+AC_INIT([Evince],[ev_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=evince],[evince])
 AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-dist-gzip])
 
 EV_API_VERSION=2.25
@@ -413,6 +419,10 @@ AC_SUBST(EVINCE_MIME_TYPES)
 
 AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system]))
 
+AC_SUBST([EV_VERSION_MAJOR],[ev_version_major])
+AC_SUBST([EV_VERSION_MINOR],[ev_version_minor])
+AC_SUBST([EV_VERSION_MICRO],[ev_version_micro])
+
 AC_CONFIG_FILES([
 evince.pc
 backend/Makefile
@@ -456,6 +466,7 @@ help/Makefile
 help/reference/Makefile
 help/reference/version.xml
 libdocument/Makefile
+libdocument/ev-version.h
 libview/Makefile
 Makefile
 po/Makefile.in
diff --git a/libdocument/Makefile.am b/libdocument/Makefile.am
index cf11ea2..b3adea9 100644
--- a/libdocument/Makefile.am
+++ b/libdocument/Makefile.am
@@ -44,7 +44,8 @@ INST_H_FILES = 					\
 	ev-page.h				\
 	ev-render-context.h			\
 	ev-selection.h				\
-	ev-transition-effect.h
+	ev-transition-effect.h			\
+	ev-version.h
 
 headerdir = $(includedir)/evince/$(EV_API_VERSION)/ev-backend
 header_DATA = $(INST_H_FILES)
diff --git a/libdocument/ev-version.h.in b/libdocument/ev-version.h.in
new file mode 100644
index 0000000..6613559
--- /dev/null
+++ b/libdocument/ev-version.h.in
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2009 Christian Persch
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02110-1301  USA
+ */
+
+#ifndef EV_VERSION_H
+#define EV_VERSION_H
+
+#define EV_VERSION_MAJOR (@EV_VERSION_MAJOR@)
+#define EV_VERSION_MINOR (@EV_VERSION_MINOR@)
+#define EV_VERSION_MICRO (@EV_VERSION_MICRO@)
+
+#define EV_CHECK_VERSION(major,minor,micro) \
+  (EV_VERSION_MAJOR > (major) || \
+   (EV_VERSION_MAJOR == (major) && EV_VERSION_MINOR > (minor)) || \
+   (EV_VERSION_MAJOR == (major) && EV_VERSION_MINOR == (minor) && EV_VERSION_MICRO >= (micro)))
+
+#endif /* #ifndef EV_VERSION_H */
