summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.dev22
-rw-r--r--configure.ac11
-rw-r--r--doc/mpc.texi3
-rw-r--r--m4/valgrind-tests.m435
4 files changed, 49 insertions, 22 deletions
diff --git a/README.dev b/README.dev
index 7a56a9c..863c5f5 100644
--- a/README.dev
+++ b/README.dev
@@ -14,26 +14,24 @@ Required versions:
Creating a new release
----------------------
- 1) Run all tests with valgrind and check no memory leak remains:
- for f in .libs/lt-t*; do valgrind $f; done
- 2) Check compilation with gmp 4.3.2 and mpfr 2.4.2.
- 3) Check the version number in configure.ac ("AC_INIT (mpc, _version_...)"),
+ 1) Check compilation with gmp 4.3.2 and mpfr 2.4.2.
+ 2) Check the version number in configure.ac ("AC_INIT (mpc, _version_...)"),
INSTALL, src/get_version.c, src/mpc.h (remove suffix "-dev" in
MPC_VERSION_STRING) and Makefile.vc.
- 4) Verify that the API version in src/Makefile.am is correct.
- 5) Check that NEWS, BUGS and TODO are up to date, and that the minimal
+ 3) Verify that the API version in src/Makefile.am is correct.
+ 4) Check that NEWS, BUGS and TODO are up to date, and that the minimal
version numbers of gmp and mpfr in configure.ac, INSTALL and
doc/mpc.texi are correct.
- 6) Execute "autoreconf; touch doc/mpc.texi; make distcheck".
+ 5) Execute "autoreconf; touch doc/mpc.texi; make distcheck".
This updates the date and version number in doc/version.texi and
creates the tarball for distribution.
- 7) Create an svn tag from inside the svn root:
+ 6) Create an svn tag from inside the svn root:
svn cp trunk tags/VERSION
- 8) Update the web page on the server.
+ 7) Update the web page on the server.
The html documentation is created with
makeinfo --html --no-split mpc.texi
and the resulting mpc.html is copied to content_html.php.
- 9) After the release, update the version number in configure.ac, INSTALL,
+ 8) After the release, update the version number in configure.ac, INSTALL,
src/get_version.c, src/mpc.h and Makefile.vc.
-10) Potentially increase the API version in src/Makefile.am.
-11) Commit the changes to svn.
+ 9) Potentially increase the API version in src/Makefile.am.
+10) Commit the changes to svn.
diff --git a/configure.ac b/configure.ac
index 31b45cb..c399974 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,16 +82,7 @@ AC_ARG_ENABLE([logging],
esac
]
)
-AC_ARG_ENABLE([valgrind],
- [AC_HELP_STRING([--enable-valgrind],
- [enable valgrind for make check (default = no)])],
- [case $enableval in
- yes) AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind -q --error-exitcode=1]) ;;
- no) ;;
- *) AC_MSG_ERROR([Bad value for --enable-valgrind: Use yes or no]) ;;
- esac
- ]
- )
+gl_VALGRIND_TESTS
# Setup CC and CFLAGS
AC_PROG_CC
diff --git a/doc/mpc.texi b/doc/mpc.texi
index 8173e5e..98b3d78 100644
--- a/doc/mpc.texi
+++ b/doc/mpc.texi
@@ -162,6 +162,9 @@ Another useful parameter is @samp{--prefix}, which can be used to
specify an alternative installation location instead of
@file{/usr/local}; see @samp{make install} below.
+To enable checking for memory leaks using @command{valgrind} during
+@code{make check}, add the parameter @code{--enable-valgrind-tests}.
+
If for debugging purposes you wish to log calls to GNU MPC functions from
within your code, add the parameter @samp{--enable-logging}.
In your code, replace the inclusion of @file{mpc.h} by @file{mpc-log.h}
diff --git a/m4/valgrind-tests.m4 b/m4/valgrind-tests.m4
new file mode 100644
index 0000000..422f402
--- /dev/null
+++ b/m4/valgrind-tests.m4
@@ -0,0 +1,35 @@
+# valgrind-tests.m4 serial 2
+dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_VALGRIND_TESTS()
+# -------------------
+# Check if valgrind is available, and set VALGRIND to it if available.
+AC_DEFUN([gl_VALGRIND_TESTS],
+[
+ AC_ARG_ENABLE(valgrind-tests,
+ AS_HELP_STRING([--enable-valgrind-tests],
+ [run self tests under valgrind]),
+ [opt_valgrind_tests=$enableval], [opt_valgrind_tests=yes])
+
+ # Run self-tests under valgrind?
+ if test "$opt_valgrind_tests" = "yes" && test "$cross_compiling" = no; then
+ AC_CHECK_PROGS(VALGRIND, valgrind)
+ fi
+
+ if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
+ opt_valgrind_tests=yes
+ VALGRIND="$VALGRIND -q --error-exitcode=1 --leak-check=full"
+ else
+ opt_valgrind_tests=no
+ VALGRIND=
+ fi
+
+ AC_MSG_CHECKING([whether self tests are run under valgrind])
+ AC_MSG_RESULT($opt_valgrind_tests)
+])
+