Index: configure.ac
===================================================================
--- configure.ac	(revision 293afd2518c85a25e2ebc908251dabe09d635582)
+++ configure.ac	(revision 4900387e8dbe2570987662bf273f57b95ab6acc3)
@@ -15,6 +15,4 @@
 AC_PROG_CXX
 AC_PROG_CC
-# obselete by LT_INIT
-#AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_CHECK_PROG([LATEX],[latex],[latex],[:])
@@ -82,5 +80,5 @@
 fi
 
-# add replacement/saturation hydrogen or not 
+# use CppUnit TestRunner or not
 AC_ARG_ENABLE([ecut],AS_HELP_STRING([--enable-ecut],[Use ECut TestRunnerClient (default is no)]),
               [enable_ecut=$enableval], [enable_ecut=no])
@@ -88,4 +86,24 @@
   AC_DEFINE(HAVE_ECUT,1, ["Use ECut TestRunnerClient instead of our own."])
   AC_SUBST(HAVE_ECUT)
+fi
+
+# with valgrinding testsuite or not
+AC_ARG_WITH([valgrind],AS_HELP_STRING([--with-valgrind],[Use Valgrind on the testsuite (default is no)]),
+              [with_valgrind=$withval], [with_valgrind=no])
+if test x"$with_valgrind" = xyes; then
+  AC_CHECK_HEADER([valgrind/valgrind.h],
+    [
+      # check header
+      AC_DEFINE(HAVE_VALGRIND_TESTSUITE,1, ["Use Valgrind to check the testsuite."])
+      # check path
+      AC_PATH_PROG(VALGRIND, [valgrind], [/bin/false])
+      # set variables 
+      AC_SUBST(HAVE_VALGRIND_TESTSUITE)
+      AC_SUBST(VALGRIND)
+    ],
+    [
+      AC_MSG_ERROR(["Valgrind support requested but headers not available."])
+    ]
+  )
 fi
 
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 293afd2518c85a25e2ebc908251dabe09d635582)
+++ src/builder.cpp	(revision 4900387e8dbe2570987662bf273f57b95ab6acc3)
@@ -16,19 +16,5 @@
  *
  *  MoleCuilder - to create and alter molecular systems
- *  Copyright (C) 2010  University Bonn
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *  Copyright (C) 2010  University Bonn. All rights reserved.
  *
  */
@@ -163,8 +149,7 @@
   cout << MOLECUILDERVERSION << endl;
   cout << "MoleCuilder comes with ABSOLUTELY NO WARRANTY; for details type" << endl;
-  cout << "`" << argv[0] << " --help-warranty'." << endl;
-  cout << "This is free software, and you are welcome to redistribute it" << endl;
-  cout << "under certain conditions; type `" << argv[0] << " --help-redistribute'" << endl;
-  cout << "for details." << endl;
+  cout << "`molecuilder --help-warranty'." << endl;
+  cout << "`MoleCuilder - to create and alter molecular systems." << endl;
+  cout << "Copyright (C) 2010  University Bonn. All rights reserved." << endl;
 
   setVerbosity(0);
Index: test_all.sh
===================================================================
--- test_all.sh	(revision 293afd2518c85a25e2ebc908251dabe09d635582)
+++ test_all.sh	(revision 4900387e8dbe2570987662bf273f57b95ab6acc3)
@@ -1,5 +1,6 @@
 #!/bin/bash
 
-optimizations=("-O0"\
+optimizations=("-g3"\
+               "-O0"\
 	       "-O1"\
                "-O2"\
@@ -49,4 +50,10 @@
 }
 
+function logdate()
+{
+  echo -e "Launched on `date`.\n\n" >> $logfile 2>&1;
+}
+
+
 while getopts âho:f:j:scO:t:p:â OPTION
 do
@@ -105,5 +112,5 @@
 function configure(){
   echo "Configuring";
-  CXXFLAGS="$2" $1/configure --prefix=$PWD >> $logfile 2>&1;
+  $1/configure $3 --prefix=$PWD CXXFLAGS="-Wall $2" >> $logfile 2>&1;
 }
 
@@ -134,5 +141,5 @@
     then
       echo -n "    $test: " >> $outfile;
-      valgrind -v --error-exitcode=255 $test >> $logfile 2>&1;
+      valgrind -v --leak-check=full --leak-resolution=high --show-reachable=yes --error-exitcode=255 $test >> $logfile 2>&1;
       if [ $? ]
       then
@@ -149,12 +156,18 @@
 function test(){
 
-  echo "Testing with \"$2\"";
+  echo "Testing with \"$2 $3\"";
   echo "" >> $logfile;
   echo "" >> $logfile;
   echo "" >> $logfile;
-  echo "Testing with \"$2\"" >> $logfile;
-
-  echo -n "  Configuring: " >> $outfile;
-  if configure "$1" "$2"
+  echo "Testing with \"$2 $3\"" >> $logfile;
+
+  if [ x"$2" == x"-g3" ]
+  then
+    valgrind="--with-valgrind"
+  else
+    valgrind="--without-valgrind"
+  fi
+  echo -n "  Configuring $valgrind: " >> $outfile;
+  if configure "$1" "$2 $3" "$valgrind"
   then
     echo "OK" >> $outfile;
@@ -201,9 +214,9 @@
 
 function run(){
-  echo "Testing with \"$1\":" >> $outfile;
+  echo "Testing with \"$1 $2\":" >> $outfile;
   testdir=`mktemp -d --tmpdir=$tmpdir $tmppattern.XXXXXXXXXX`;
   basedir=$PWD;
   cd $testdir;
-  test "$basedir" "$1";
+  test "$basedir" "$1" "$2";
   cd $basedir;
   rm -rf $testdir;
@@ -220,5 +233,5 @@
   for option in "${options[@]}"
   do
-    run "$optimization $option";
+    run "$optimization" "$option";
   done
 done
Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision 293afd2518c85a25e2ebc908251dabe09d635582)
+++ tests/regression/Makefile.am	(revision 4900387e8dbe2570987662bf273f57b95ab6acc3)
@@ -1,4 +1,16 @@
 AUTOM4TE = autom4te
-EXTRA_DIST = testsuite.at $(TESTSUITE) atlocal.in regression
+EXTRA_DIST = \
+	testsuite*.at \
+	$(TESTSUITE) \
+	atlocal.in \
+	molecuider.in \
+	Analysis \
+	Domain \
+	Filling \
+	Fragmentation \
+	Graph \
+	Molecules \
+	Simple_configuration \
+	Tesselation
 TESTSUITE = $(srcdir)/testsuite
 
Index: tests/regression/atlocal.in
===================================================================
--- tests/regression/atlocal.in	(revision 293afd2518c85a25e2ebc908251dabe09d635582)
+++ tests/regression/atlocal.in	(revision 4900387e8dbe2570987662bf273f57b95ab6acc3)
@@ -1,4 +1,5 @@
 prefix='@prefix@'
 exec_prefix='@prefix@'
-topdir='@topdir@'
+topdir='@abs_top_builddir@'
 bindir='@bindir@'
+valgrind='@VALGRIND@'
Index: tests/regression/molecuilder.in
===================================================================
--- tests/regression/molecuilder.in	(revision 293afd2518c85a25e2ebc908251dabe09d635582)
+++ tests/regression/molecuilder.in	(revision 4900387e8dbe2570987662bf273f57b95ab6acc3)
@@ -3,8 +3,26 @@
 # wrapper for testing molecuilder
 
-. ../../atconfig
+. ../../atlocal
 
-"${abs_top_builddir}/src/molecuilder" \
-	${1+"$@"}
+if test ! -z ${valgrind}
+then
+G_SLICE=always-malloc G_DEBUG=gc-friendly \
+libtool --mode=execute \
+${valgrind} -v \
+--log-file=valgrind.log \
+--time-stamp=yes \
+--error-exitcode=255 \
+--leak-check=full \
+--leak-resolution=high \
+--num-callers=20 \
+--track-origins=yes \
+--show-reachable=yes \
+"${topdir}/src/molecuilder" \
+${1+"$@"}
+else
+"${topdir}/src/molecuilder" \
+${1+"$@"}
+fi
+
 status=$?
 
