diff --git a/Makefile.am b/Makefile.am
index ddbb4a1..4a15473 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,8 @@ NULL =
 
 SUBDIRS = data src doc po
 
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
 # introspection and docs doesn't work with src != build
 DISTCHECK_CONFIGURE_FLAGS=--disable-introspection --disable-gtk-doc
 
diff --git a/configure.ac b/configure.ac
index b571717..9fa6678 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,7 @@ AC_INIT([GNOME Online Accounts],
         [gnome-online-accounts])
 
 AM_INIT_AUTOMAKE([1.9 foreign dist-xz no-dist-gzip tar-ustar])
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([src])
 AC_CONFIG_HEADERS([config.h])
 
