292e61d2cf96d0d89d112b2c245138ece9d3aa33
diff --git a/configure.ac b/configure.ac
index 317f141..212e0a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,6 @@
-dnl Process this file with autoconf to produce a configure script.
+# *****************************************************************************
+# Versioning
+# *****************************************************************************
 
 m4_define([ev_major_version],[2])
 m4_define([ev_minor_version],[25])
@@ -9,6 +11,31 @@ m4_define([ev_version],[ev_major_version.ev_minor_version.ev_micro_version()ev_e
 # The evince API version
 m4_define([ev_api_version], [2.25])
 
+# Libtool versioning. The backend and view libraries have separate versions.
+# Before making a release, the libtool version should be modified.
+# The string is of the form C:R:A.
+# - If interfaces have been changed or added, but binary compatibility has
+#   been preserved, change to C+1:0:A+1
+# - If binary compatibility has been broken (eg removed or changed interfaces)
+#   change to C+1:0:0
+# - If the interface is the same as the previous version, change to C:R+1:A
+
+# Libtool version of the backend library
+m4_define([ev_backend_lt_current],[1])
+m4_define([ev_backend_lt_revision],[0])
+m4_define([ev_backend_lt_age],[0])
+m4_define([ev_backend_lt_version_info],[ev_backend_lt_current:ev_backend_lt_revision:ev_backend_lt_age])
+m4_define([ev_backend_lt_current_minus_age],[m4_eval(ev_backend_lt_current - ev_backend_lt_age)])
+
+# Libtool version of the view library
+m4_define([ev_view_lt_current],[1])
+m4_define([ev_view_lt_revision],[0])
+m4_define([ev_view_lt_age],[0])
+m4_define([ev_view_lt_version_info],[ev_view_lt_current:ev_view_lt_revision:ev_view_lt_age])
+m4_define([ev_view_lt_current_minus_age],[m4_eval(ev_view_lt_current - ev_view_lt_age)])
+
+# *****************************************************************************
+
 AC_PREREQ([2.57])
 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])
@@ -427,6 +454,11 @@ AC_SUBST([EV_MICRO_VERSION],[ev_micro_version])
 
 AC_SUBST([EV_API_VERSION],[ev_api_version])
 
+AC_SUBST([EV_BACKEND_LT_VERSION_INFO],[ev_backend_lt_version_info])
+AC_SUBST([EV_BACKEND_LT_CURRENT_MINUS_AGE],[ev_backend_lt_current_minus_age])
+AC_SUBST([EV_VIEW_LT_VERSION_INFO],[ev_view_lt_version_info])
+AC_SUBST([EV_VIEW_LT_CURRENT_MINUS_AGE],[ev_view_lt_current_minus_age])
+
 # *****************************************************************************
 
 AC_CONFIG_FILES([
diff --git a/libdocument/Makefile.am b/libdocument/Makefile.am
index c08f5a8..a44ed64 100644
--- a/libdocument/Makefile.am
+++ b/libdocument/Makefile.am
@@ -1,4 +1,5 @@
 INCLUDES=						\
+	-DG_LOG_DOMAIN=\"EvDocument\"			\
 	-DEVINCE_UIDIR=\"$(pkgdatadir)\"		\
 	-DGNOMELOCALEDIR=\"$(datadir)/locale\"		\
 	-DEV_BACKENDSDIR=\"$(libdir)/evince/backends\"	\
@@ -8,7 +9,11 @@ INCLUDES=						\
 
 lib_LTLIBRARIES = libevbackend.la
 
-libevbackend_la_LDFLAGS = -export-dynamic
+libevbackend_la_LDFLAGS = \
+	-version-info $(EV_BACKEND_LT_VERSION_INFO)	\
+	-export-symbols-regex "^ev_*"	\
+	$(AM_LDFLAGS)
+
 libevbackend_la_LIBADD = $(LIBDOCUMENT_LIBS)
 
 NOINST_H_FILES =				\
diff --git a/libview/Makefile.am b/libview/Makefile.am
index 608fa85..eede6da 100644
--- a/libview/Makefile.am
+++ b/libview/Makefile.am
@@ -1,4 +1,5 @@
 INCLUDES=					\
+	-DG_LOG_DOMAIN=\"EvView\"		\
 	-DGNOMELOCALEDIR=\"$(datadir)/locale\"	\
 	-I$(top_srcdir)/libdocument		\
 	$(LIBVIEW_CFLAGS)			\
@@ -7,7 +8,11 @@ INCLUDES=					\
 
 lib_LTLIBRARIES = libevview.la
 
-libevview_la_LDFLAGS = -export-dynamic
+libevview_la_LDFLAGS = \
+	-version-info $(EV_VIEW_LT_VERSION_INFO)	\
+	-export-symbols-regex "^ev_*"	\
+	$(AM_LDFLAGS)
+
 libevview_la_LIBADD = $(LIBVIEW_LIBS)
 
 NOINST_H_FILES =			\
@@ -25,7 +30,7 @@ INST_H_FILES = 				\
 	ev-view.h			\
 	ev-view-type-builtins.h
 
-headerdir = $(prefix)/include/evince/@EV_API_VERSION@/ev-view
+headerdir = $(includedir)/evince/$(EV_API_VERSION)/ev-view
 header_DATA = $(INST_H_FILES)
 
 libevview_la_SOURCES = 			\
@@ -51,11 +56,11 @@ BUILT_SOURCES = 			\
 CLEANFILES = $(BUILT_SOURCES) stamp-ev-view-type-builtins.h
 
 ev-view-marshal.h: $(srcdir)/ev-view-marshal.list
-	$(GLIB_GENMARSHAL) --prefix=ev_view_marshal $(srcdir)/ev-view-marshal.list --header > $@
+	$(GLIB_GENMARSHAL) --prefix=ev_view_marshal $(srcdir)/ev-view-marshal.list --header --internal > $@
 
 ev-view-marshal.c: $(srcdir)/ev-view-marshal.list
-	echo '#include "ev-view-marshal.h"' > ev-view-marshal.c
-	$(GLIB_GENMARSHAL) --prefix=ev_view_marshal $(srcdir)/ev-view-marshal.list --body >> $@
+	echo '#include <config.h>' > ev-view-marshal.c
+	$(GLIB_GENMARSHAL) --prefix=ev_view_marshal $(srcdir)/ev-view-marshal.list --header --internal --body >> $@
 
 ev-view-type-builtins.h: stamp-ev-view-type-builtins.h
 	@true
