diff --git a/configure.ac b/configure.ac
index a682c9a8..d78a82d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,11 @@ AC_ARG_ENABLE([documentation],
AM_CONDITIONAL(ENABLE_SCANNER, test "x$enable_scanner" = xyes)
+AC_ARG_WITH(icondir, [ --with-icondir=
Look for cursor icons here],
+ [ ICONDIR=$withval],
+ [ ICONDIR=${datadir}/icons])
+AC_SUBST([ICONDIR])
+
EXPAT_LIB=""
AC_ARG_WITH(expat, [ --with-expat= Use expat from here],
[ expat=$withval
diff --git a/cursor/Makefile.am b/cursor/Makefile.am
index 168f5dc8..3efcb17f 100644
--- a/cursor/Makefile.am
+++ b/cursor/Makefile.am
@@ -11,4 +11,8 @@ libwayland_cursor_la_LIBADD = $(top_builddir)/src/libwayland-client.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = wayland-cursor.pc
-AM_CFLAGS = $(GCC_CFLAGS) -I$(top_builddir)/src -I$(top_srcdir)/src
+AM_CFLAGS = \
+ $(GCC_CFLAGS) \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/src \
+ -DICONDIR=\"$(ICONDIR)\"