diff --git a/configure.ac b/configure.ac
index 90ffe5aa3bcdbd2cd68987beefc277fb11d52122..7c8191f1e7a52de40b83a86fdc7c540bbe40a6f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,15 @@ AC_ARG_WITH([ssh-initscript],
   [ssh_initd_script="/etc/init.d/ssh"])
 AC_SUBST(SSH_INITD_SCRIPT, $ssh_initd_script)
 
+# --with-export-dir=...
+AC_ARG_WITH([export-dir],
+  [AS_HELP_STRING([--with-export-dir=DIR],
+    [directory to use by default for instance image exports (default is /srv/ganeti/export)]
+  )],
+  [export_dir="$withval"],
+  [export_dir="/srv/ganeti/export"])
+AC_SUBST(EXPORT_DIR, $export_dir)
+
 # Check common programs
 AC_PROG_INSTALL
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index c6b643658fc2b6ef8133b388cf21f3509b970db6..901b270db0fa6f6af7d66d1ac6c35da4ae664023 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -16,4 +16,5 @@ _autoconf.py: Makefile
 	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
 	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
 	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
+	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
 	} > $@
diff --git a/lib/constants.py b/lib/constants.py
index a495ba570dfb264eb18ff7184e6c111cf466d1b8..1594029c135715a705a27c055499e85078fab9f8 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -50,7 +50,7 @@ LOG_OS_DIR = LOG_DIR + "/os"
 LOG_NODESERVER = LOG_DIR + "/node-daemon.log"
 
 OS_DIR = "/srv/ganeti/os"
-EXPORT_DIR = "/srv/ganeti/export"
+EXPORT_DIR = _autoconf.EXPORT_DIR
 
 EXPORT_CONF_FILE = "config.ini"