Index: /emailtotracscript/trunk/INSTALL
===================================================================
--- /emailtotracscript/trunk/INSTALL	(revision 23)
+++ /emailtotracscript/trunk/INSTALL	(revision 24)
@@ -31,10 +31,16 @@
 First build, install email2trac :
 
-  * Edit Makefile, adjust the variables (in particular INSTALL_DIR, MTA_USER 
-    and TRAC_USER)
+  * ./configure (see --help)
+    {{{
+    default values for:
+       prefix=/usr/local        --> --prefix=<path> 
+       exec_prefix=$prefix/bin  --> --exec_prefix=<path>
+       sysconfdir=$prefix/etc   --> --sysconfdir=<path>
+       MTA_USER=nobody          --> --with-mta_user=<name>
+       TRAC_USER=www-data       --> --with-trac_user=<name>
+    }}}
   * make
   * make install
-  * Define a symlink /etc/email2trac.conf referencing 
-    $INSTALL_DIR/email2trac.conf
+  * First install copy emailtrac.conf to $sysconfdir
 
  After installation, edit email2trac.conf for your site. Most important 
Index: /emailtotracscript/trunk/Makefile.in
===================================================================
--- /emailtotracscript/trunk/Makefile.in	(revision 23)
+++ /emailtotracscript/trunk/Makefile.in	(revision 24)
@@ -6,10 +6,9 @@
 #      $Id$
 #
-# defaullt values are:
-#
 #
 PREFIX=@prefix@
-INSTALL_BIN=$(PREFIX)/bin
+EXEC_PREFIX=@exec_prefix@/bin
 PYTHON_BIN=@PYTHON@
+CONFIG=@sysconfdir@
 
 # User names 
@@ -20,5 +19,5 @@
 CC=@CC@
 DEBUG=0
-CFLAGS=-DMTA_USER=\"$(MTA_USER)\" -DTRAC_USER=\"$(TRAC_USER)\" -DTRAC_SCRIPT_NAME=\"$(TRAC_SCRIPT_NAME)\" -DTRAC_SCRIPT_PATH=\"$(INSTALL_BIN)\" -DDEBUG=$(DEBUG)
+CFLAGS=-DMTA_USER=\"$(MTA_USER)\" -DTRAC_USER=\"$(TRAC_USER)\" -DTRAC_SCRIPT_NAME=\"$(TRAC_SCRIPT_NAME)\" -DTRAC_SCRIPT_PATH=\"$(EXEC_PREFIX)\" -DDEBUG=$(DEBUG)
 
 PYTHON_FILES=delete_spam.py email2trac.py
@@ -27,15 +26,18 @@
 all: run_email2trac
 
-run_email2trac: $(WRAPPER_SRC)
+run_email2trac: $(WRAPPER_SRC) Makefile
 	$(CC) $(CFLAGS) -o $@ run_email2trac.c
 
 install: all
-	install --mode=4700 --owner=root run_email2trac $(INSTALL_BIN)
+	install --mode=4700 --owner=root run_email2trac $(EXEC_PREFIX)
 	for script in $(PYTHON_FILES) ; \
 	do \
           name=`basename $$script '.py'` ; \
-	  install --mode=755 --owner=root $$script  $(INSTALL_BIN)/$$name 
+	  install --mode=755 --owner=root $$script  $(EXEC_PREFIX)/$$name 
 	done
 
 clean:
-	rm run_email2trac email2trac.py delete_spam.py config.log config.status 
+	rm run_email2trac
+
+distclean:
+	rm run_email2trac email2trac.py delete_spam.py config.log config.status Makefile
Index: /emailtotracscript/trunk/configure
===================================================================
--- /emailtotracscript/trunk/configure	(revision 23)
+++ /emailtotracscript/trunk/configure	(revision 24)
@@ -273,5 +273,5 @@
 
 ac_unique_file="email2trac.py.in"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS pyexecdir trac_user mta_user PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pkgpyexecdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS pyexecdir trac_user mta_user email2trac_conf PYTHON PYTHON_VERSION PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_PLATFORM pythondir pkgpythondir pkgpyexecdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SYSTEM_EMAIL2TRAC_CONF LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
@@ -1268,4 +1268,7 @@
 
 
+
+
+
         # Find any Python interpreter.
     for ac_prog in python python2 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
@@ -2610,5 +2613,6 @@
 
 
-
+# Now a user can specify the TRAC user
+#
 
 # Check whether --with-trac_user or --without-trac_user was given.
@@ -2622,4 +2626,6 @@
 
 fi;
+# Now a user can specify MTA TRAC user
+#
 
 # Check whether --with-mta_user or --without-mta_user was given.
@@ -2632,5 +2638,24 @@
   mta_user="nobody"
 
-fi;                               ac_config_files="$ac_config_files Makefile email2trac.py delete_spam.py"
+fi;
+if test "$sysconfdir" = '${prefix}/etc'; then
+  if test "x$prefix" = xNONE; then
+    email2trac_conf="$ac_default_prefix/etc/email2trac.conf"
+  else
+    email2trac_conf="$prefix/etc/email2trac.conf"
+  fi
+else
+  email2trac_conf="$sysconfdir/email2trac.conf"
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define SYSTEM_EMAIL2TRAC_CONF "$email2trac_conf"
+_ACEOF
+
+
+
+
+
+                              ac_config_files="$ac_config_files Makefile email2trac.py delete_spam.py"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -3272,4 +3297,5 @@
 s,@trac_user@,$trac_user,;t t
 s,@mta_user@,$mta_user,;t t
+s,@email2trac_conf@,$email2trac_conf,;t t
 s,@PYTHON@,$PYTHON,;t t
 s,@PYTHON_VERSION@,$PYTHON_VERSION,;t t
@@ -3289,4 +3315,5 @@
 s,@CPP@,$CPP,;t t
 s,@EGREP@,$EGREP,;t t
+s,@SYSTEM_EMAIL2TRAC_CONF@,$SYSTEM_EMAIL2TRAC_CONF,;t t
 s,@LIBOBJS@,$LIBOBJS,;t t
 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
Index: /emailtotracscript/trunk/configure.in
===================================================================
--- /emailtotracscript/trunk/configure.in	(revision 23)
+++ /emailtotracscript/trunk/configure.in	(revision 24)
@@ -1,2 +1,9 @@
+#
+# Author: Bas van der Vlies <basv@sara.nl>
+# Desc. : Simple configure script for email2trac package
+# SVN INFO:
+#	$Id$
+#
+#
 AC_INIT(email2trac.py.in)
 AC_SUBST(prefix)
@@ -5,9 +12,11 @@
 AC_SUBST(trac_user)
 AC_SUBST(mta_user)
+AC_SUBST(sysconfdir)
 
 AM_PATH_PYTHON
 AC_PROG_GCC_TRADITIONAL
 
-
+# Now a user can specify the TRAC user
+#
 AC_ARG_WITH(trac_user,
 [
@@ -22,4 +31,6 @@
 )dnl            
 
+# Now a user can specify MTA TRAC user
+#
 AC_ARG_WITH(mta_user,
 [
@@ -33,4 +44,24 @@
   [mta_user="nobody"]
 )dnl            
+
+dnl ##### Path to email2trac.conf
+dnl This ugly kludge to get the sysconfdir path is needed because
+dnl autoconf doesn't actually set the prefix variable until later.
+if test "$sysconfdir" = '${prefix}/etc'; then
+  if test "x$prefix" = xNONE; then
+    email2trac_conf="$ac_default_prefix/etc/email2trac.conf"
+  else
+    email2trac_conf="$prefix/etc/email2trac.conf"
+  fi
+else
+  email2trac_conf="$sysconfdir/email2trac.conf"
+fi
+AC_DEFINE_UNQUOTED(SYSTEM_EMAIL2TRAC_CONF, "$email2trac_conf",
+                   [Full path for the system-wide email2trac.conf file.])
+
+AC_SUBST(email2trac_conf)
+AC_SUBST(SYSTEM_EMAIL2TRAC_CONF)
+
+
 AC_OUTPUT(
         Makefile
Index: /emailtotracscript/trunk/email2trac.py.in
===================================================================
--- /emailtotracscript/trunk/email2trac.py.in	(revision 23)
+++ /emailtotracscript/trunk/email2trac.py.in	(revision 24)
@@ -489,6 +489,5 @@
 	# Default config file
 	#
-	configfile = '/etc/email2trac.conf'
-	# configfile = './email2trac.conf'
+	configfile = '@email2trac_conf@'
 	project = ''
 	component = ''
Index: /emailtotracscript/trunk/run_email2trac.c
===================================================================
--- /emailtotracscript/trunk/run_email2trac.c	(revision 23)
+++ /emailtotracscript/trunk/run_email2trac.c	(revision 24)
@@ -1,5 +1,7 @@
 /*
 	run_email2trac.c
-	Authors: Bas van der Vlies and Walter de Jong
+	Authors: Bas van der Vlies, Walter de Jong and Michel Jouvin
+	SVN Info:
+		$Id$
 
 	Only nobody can become the user www-data. Postfix uses this
@@ -25,5 +27,4 @@
 #
 */
-
 #include <stdlib.h>
 #include <unistd.h>
Index: /emailtotracscript/trunk/run_email2trac.h
===================================================================
--- /emailtotracscript/trunk/run_email2trac.h	(revision 23)
+++ /emailtotracscript/trunk/run_email2trac.h	(revision 24)
@@ -1,3 +1,8 @@
 /*
+
+AUTHOR: Michel Jouvin
+SVN Info:
+	$Id$
+
 Local site configuration
 Value defined here are just default values than can be overriden at compile time
