a3d59b
diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in
a3d59b
index fb3f4f3..7dde965 100644
a3d59b
--- a/Mailman/Defaults.py.in
a3d59b
+++ b/Mailman/Defaults.py.in
a3d59b
@@ -1431,20 +1431,22 @@ AuthListPoster = 6    # List poster (Approved: <pw> header in posts only)
a3d59b
 
a3d59b
 # Useful directories
a3d59b
 LIST_DATA_DIR   = os.path.join(VAR_PREFIX, 'lists')
a3d59b
-LOG_DIR         = os.path.join(VAR_PREFIX, 'logs')
a3d59b
-LOCK_DIR        = os.path.join(VAR_PREFIX, 'locks')
a3d59b
+LOG_DIR         = '@LOG_DIR@'
a3d59b
+LOCK_DIR        = '@LOCK_DIR@'
a3d59b
+CONFIG_DIR      = '@CONFIG_DIR@'
a3d59b
 DATA_DIR        = os.path.join(VAR_PREFIX, 'data')
a3d59b
+PID_DIR         = '@PID_DIR@'
a3d59b
 SPAM_DIR        = os.path.join(VAR_PREFIX, 'spam')
a3d59b
 WRAPPER_DIR     = os.path.join(EXEC_PREFIX, 'mail')
a3d59b
 BIN_DIR         = os.path.join(PREFIX, 'bin')
a3d59b
 SCRIPTS_DIR     = os.path.join(PREFIX, 'scripts')
a3d59b
-TEMPLATE_DIR    = os.path.join(PREFIX, 'templates')
a3d59b
+TEMPLATE_DIR    = '@TEMPLATE_DIR@'
a3d59b
 MESSAGES_DIR    = os.path.join(PREFIX, 'messages')
a3d59b
 PUBLIC_ARCHIVE_FILE_DIR  = os.path.join(VAR_PREFIX, 'archives', 'public')
a3d59b
 PRIVATE_ARCHIVE_FILE_DIR = os.path.join(VAR_PREFIX, 'archives', 'private')
a3d59b
 
a3d59b
 # Directories used by the qrunner subsystem
a3d59b
-QUEUE_DIR       = os.path.join(VAR_PREFIX, 'qfiles')
a3d59b
+QUEUE_DIR       = '@QUEUE_DIR@'
a3d59b
 INQUEUE_DIR     = os.path.join(QUEUE_DIR, 'in')
a3d59b
 OUTQUEUE_DIR    = os.path.join(QUEUE_DIR, 'out')
a3d59b
 CMDQUEUE_DIR    = os.path.join(QUEUE_DIR, 'commands')
a3d59b
@@ -1458,9 +1460,9 @@ RETRYQUEUE_DIR  = os.path.join(QUEUE_DIR, 'retry')
a3d59b
 MAILDIR_DIR     = os.path.join(QUEUE_DIR, 'maildir')
a3d59b
 
a3d59b
 # Other useful files
a3d59b
-PIDFILE = os.path.join(DATA_DIR, 'master-qrunner.pid')
a3d59b
-SITE_PW_FILE = os.path.join(DATA_DIR, 'adm.pw')
a3d59b
-LISTCREATOR_PW_FILE = os.path.join(DATA_DIR, 'creator.pw')
a3d59b
+PIDFILE = os.path.join(PID_DIR, 'master-qrunner.pid')
a3d59b
+SITE_PW_FILE = os.path.join(CONFIG_DIR, 'adm.pw')
a3d59b
+LISTCREATOR_PW_FILE = os.path.join(CONFIG_DIR, 'creator.pw')
a3d59b
 
a3d59b
 # Import a bunch of version numbers
a3d59b
 from Version import *
a3d59b
diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py
a3d59b
index 801ddc0..8506b9b 100644
a3d59b
--- a/Mailman/MTA/Postfix.py
a3d59b
+++ b/Mailman/MTA/Postfix.py
a3d59b
@@ -32,8 +32,8 @@ from Mailman.MTA.Utils import makealiases
a3d59b
 from Mailman.Logging.Syslog import syslog
a3d59b
 
a3d59b
 LOCKFILE = os.path.join(mm_cfg.LOCK_DIR, 'creator')
a3d59b
-ALIASFILE = os.path.join(mm_cfg.DATA_DIR, 'aliases')
a3d59b
-VIRTFILE = os.path.join(mm_cfg.DATA_DIR, 'virtual-mailman')
a3d59b
+ALIASFILE = os.path.join(mm_cfg.CONFIG_DIR, 'aliases')
a3d59b
+VIRTFILE = os.path.join(mm_cfg.CONFIG_DIR, 'virtual-mailman')
a3d59b
 # Desired mode for aliases(.db) and virtual-mailman(.db) for both creation
a3d59b
 # and check_perms.
a3d59b
 targetmode = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH
a3d59b
diff --git a/Makefile.in b/Makefile.in
a3d59b
index eb40844..289aeee 100644
a3d59b
--- a/Makefile.in
a3d59b
+++ b/Makefile.in
a3d59b
@@ -28,6 +28,12 @@ bindir=		@bindir@
a3d59b
 prefix=		@prefix@
a3d59b
 exec_prefix=	@exec_prefix@
a3d59b
 var_prefix=	@VAR_PREFIX@
a3d59b
+configdir=	@CONFIG_DIR@
a3d59b
+lockdir=	@LOCK_DIR@
a3d59b
+logdir=		@LOG_DIR@
a3d59b
+piddir=		@PID_DIR@
a3d59b
+queuedir=	@QUEUE_DIR@
a3d59b
+templatedir=	@TEMPLATE_DIR@
a3d59b
 DESTDIR=
a3d59b
 
a3d59b
 CC=		@CC@
a3d59b
@@ -41,8 +47,11 @@ DEFS=		@DEFS@
a3d59b
 OPT=		@OPT@
a3d59b
 CFLAGS=		@CFLAGS@ $(OPT) $(DEFS)
a3d59b
 
a3d59b
+FHS_DIRS= \
a3d59b
+	${configdir} ${lockdir} ${logdir} ${piddir} ${queuedir} ${templatedir}
a3d59b
+
a3d59b
 VAR_DIRS= \
a3d59b
-	logs archives lists locks data spam qfiles \
a3d59b
+	archives lists data spam \
a3d59b
 	archives/private archives/public
a3d59b
 
a3d59b
 ARCH_INDEP_DIRS= \
a3d59b
@@ -105,6 +114,15 @@ doinstall: $(SUBDIRS)
a3d59b
 	    else true; \
a3d59b
 	    fi; \
a3d59b
 	done
a3d59b
+	@for d in $(FHS_DIRS); \
a3d59b
+	do \
a3d59b
+	    dir=$(DESTDIR)/$$d; \
a3d59b
+	    if test ! -d $$dir; then \
a3d59b
+		echo "Creating directory $$dir"; \
a3d59b
+		$(INSTALL) -d -m $(DIRMODE) $$dir; \
a3d59b
+	    else true; \
a3d59b
+	    fi; \
a3d59b
+	done
a3d59b
 	chmod o-r $(DESTDIR)$(var_prefix)/archives/private
a3d59b
 	@for d in $(ARCH_INDEP_DIRS); \
a3d59b
 	do \
a3d59b
diff --git a/bin/check_perms b/bin/check_perms
a3d59b
index 137ebfb..1f45f84 100755
a3d59b
--- a/bin/check_perms
a3d59b
+++ b/bin/check_perms
a3d59b
@@ -183,7 +183,8 @@ def checkall():
a3d59b
         print C_('checking mode for %(prefix)s')
a3d59b
     dirs = {}
a3d59b
     for d in (mm_cfg.PREFIX, mm_cfg.EXEC_PREFIX, mm_cfg.VAR_PREFIX,
a3d59b
-              mm_cfg.LOG_DIR):
a3d59b
+              mm_cfg.CONFIG_DIR, mm_cfg.DATA_DIR, mm_cfg.LOCK_DIR,
a3d59b
+              mm_cfg.LOG_DIR, mm_cfg.QUEUE_DIR, mm_cfg.PID_DIR):
a3d59b
         dirs[d] = True
a3d59b
     for d in dirs.keys():
a3d59b
         try:
a3d59b
diff --git a/configure.in b/configure.in
a3d59b
index f2eb1c0..c01129c 100644
a3d59b
--- a/configure.in
a3d59b
+++ b/configure.in
a3d59b
@@ -305,6 +305,72 @@ else
a3d59b
     prefixcheck=$VAR_PREFIX
a3d59b
 fi
a3d59b
 
a3d59b
+# Get the configuration file directory
a3d59b
+AC_SUBST(CONFIG_DIR)
a3d59b
+AC_MSG_CHECKING(for --with-config-dir)
a3d59b
+AC_ARG_WITH(config-dir, dnl
a3d59b
+[  --with-config-dir    specify directory for configuration data other than [VAR_]PREFIX/data])
a3d59b
+case "$with_config_dir" in
a3d59b
+    yes|no|"") CONFIG_DIR="$VAR_PREFIX/data";;
a3d59b
+    *)         CONFIG_DIR=$with_config_dir;;
a3d59b
+esac
a3d59b
+AC_MSG_RESULT($CONFIG_DIR)
a3d59b
+
a3d59b
+# Get the lock directory
a3d59b
+AC_SUBST(LOCK_DIR)
a3d59b
+AC_MSG_CHECKING(for --with-lock-dir)
a3d59b
+AC_ARG_WITH(lock-dir, dnl
a3d59b
+[  --with-lock-dir    specify directory for lock files other than [VAR_]PREFIX/locks])
a3d59b
+case "$with_lock_dir" in
a3d59b
+    yes|no|"") LOCK_DIR="$VAR_PREFIX/locks";;
a3d59b
+    *)         LOCK_DIR=$with_lock_dir;;
a3d59b
+esac
a3d59b
+AC_MSG_RESULT($LOCK_DIR)
a3d59b
+
a3d59b
+# Get the log directory
a3d59b
+AC_SUBST(LOG_DIR)
a3d59b
+AC_MSG_CHECKING(for --with-log-dir)
a3d59b
+AC_ARG_WITH(log-dir, dnl
a3d59b
+[  --with-log-dir    specify directory for log files other than [VAR_]PREFIX/logs])
a3d59b
+case "$with_log_dir" in
a3d59b
+    yes|no|"") LOG_DIR="$VAR_PREFIX/logs";;
a3d59b
+    *)         LOG_DIR=$with_log_dir;;
a3d59b
+esac
a3d59b
+AC_MSG_RESULT($LOG_DIR)
a3d59b
+
a3d59b
+# Get the pid directory
a3d59b
+AC_SUBST(PID_DIR)
a3d59b
+AC_MSG_CHECKING(for --with-pid-dir)
a3d59b
+AC_ARG_WITH(pid-dir, dnl
a3d59b
+[  --with-pid-dir    specify directory for the pid file other than [VAR_]PREFIX/data])
a3d59b
+case "$with_pid_dir" in
a3d59b
+    yes|no|"") PID_DIR="$VAR_PREFIX/data";;
a3d59b
+    *)         PID_DIR=$with_pid_dir;;
a3d59b
+esac
a3d59b
+AC_MSG_RESULT($PID_DIR)
a3d59b
+
a3d59b
+# Get the queue directory
a3d59b
+AC_SUBST(QUEUE_DIR)
a3d59b
+AC_MSG_CHECKING(for --with-queue-dir)
a3d59b
+AC_ARG_WITH(queue-dir, dnl
a3d59b
+[  --with-queue-dir    specify directory for queue files other than [VAR_]PREFIX/qfiles])
a3d59b
+case "$with_queue_dir" in
a3d59b
+    yes|no|"") QUEUE_DIR="$VAR_PREFIX/qfiles";;
a3d59b
+    *)         QUEUE_DIR=$with_queue_dir;;
a3d59b
+esac
a3d59b
+AC_MSG_RESULT($QUEUE_DIR)
a3d59b
+
a3d59b
+# Get the template directory
a3d59b
+AC_SUBST(TEMPLATE_DIR)
a3d59b
+AC_MSG_CHECKING(for --with-template-dir)
a3d59b
+AC_ARG_WITH(template-dir, dnl
a3d59b
+[  --with-template-dir    specify directory for template files other than [VAR_]PREFIX/templates])
a3d59b
+case "$with_template_dir" in
a3d59b
+    yes|no|"") TEMPLATE_DIR="$VAR_PREFIX/templates";;
a3d59b
+    *)         TEMPLATE_DIR=$with_template_dir;;
a3d59b
+esac
a3d59b
+AC_MSG_RESULT($TEMPLATE_DIR)
a3d59b
+
a3d59b
 # new macro for finding group names
a3d59b
 # returns a comma separated list of quoted group names
a3d59b
 # the list is returned in the same order as specified with any duplicates removed
a3d59b
diff --git a/misc/Makefile.in b/misc/Makefile.in
a3d59b
index af99c04..df50a06 100644
a3d59b
--- a/misc/Makefile.in
a3d59b
+++ b/misc/Makefile.in
a3d59b
@@ -27,6 +27,12 @@ bindir= 	@bindir@
a3d59b
 prefix=   	@prefix@
a3d59b
 exec_prefix=	@exec_prefix@
a3d59b
 var_prefix=	@VAR_PREFIX@
a3d59b
+configdir=	@CONFIG_DIR@
a3d59b
+lockdir=	@LOCK_DIR@
a3d59b
+logdir=		@LOG_DIR@
a3d59b
+piddir=		@PID_DIR@
a3d59b
+queuedir=	@QUEUE_DIR@
a3d59b
+MAILMAN_GROUP=  @MAILMAN_GROUP@
a3d59b
 DESTDIR=
a3d59b
 
a3d59b
 CC=		@CC@
a3d59b
@@ -87,7 +93,7 @@ install-other:
a3d59b
 	    $(INSTALL) -m $(FILEMODE) paths.py $$dir; \
a3d59b
 	done
a3d59b
 	$(INSTALL) -m $(EXEMODE) mailman $(DESTDIR)$(SCRIPTSDIR)
a3d59b
-	$(INSTALL) -m $(FILEMODE) sitelist.cfg $(DESTDIR)$(DATADIR)
a3d59b
+	$(INSTALL) -m $(FILEMODE) sitelist.cfg $(DESTDIR)$(configdir)
a3d59b
 
a3d59b
 install-packages:
a3d59b
 	if [ -z "$(EMAILPKG)" -a -d $(DESTDIR)$(PYTHONLIBDIR)/email ] ; \
a3d59b
diff --git a/templates/Makefile.in b/templates/Makefile.in
a3d59b
index b23d7c1..16930a2 100644
a3d59b
--- a/templates/Makefile.in
a3d59b
+++ b/templates/Makefile.in
a3d59b
@@ -25,6 +25,7 @@ srcdir= 	@srcdir@
a3d59b
 bindir= 	@bindir@
a3d59b
 prefix=   	@prefix@
a3d59b
 exec_prefix=	@exec_prefix@
a3d59b
+template_dir=   @TEMPLATE_DIR@
a3d59b
 DESTDIR=
a3d59b
 
a3d59b
 CC=		@CC@
a3d59b
@@ -37,7 +38,7 @@ DEFS=   	@DEFS@
a3d59b
 
a3d59b
 OPT=		@OPT@
a3d59b
 CFLAGS=		$(OPT) $(DEFS)
a3d59b
-TEMPLATEDIR= 	$(prefix)/templates
a3d59b
+TEMPLATEDIR= 	$(template_dir)
a3d59b
 
a3d59b
 SHELL=		/bin/sh
a3d59b