diff mbox

[libdrm] Add configure option --with/--without-valgrind

Message ID 20120731120916.GA32123@dmn (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Martin July 31, 2012, 12:09 p.m. UTC
Add a configure option --with/--without-valgrind to be able to compile
libdrm with or without valgrind. The latter was not possible if
pkgconfig found the valgrind package.
---
 configure.ac |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

Comments

Eric Anholt July 31, 2012, 3:39 p.m. UTC | #1
Daniel Martin <consume.noise@gmail.com> writes:

> Add a configure option --with/--without-valgrind to be able to compile
> libdrm with or without valgrind. The latter was not possible if
> pkgconfig found the valgrind package.

How would you have the valgrind .pc file but be unable to build with
valgrind?  .pc files should come with the parts necessary to build.
Daniel Martin Aug. 1, 2012, 9:13 a.m. UTC | #2
On 31 July 2012 17:39, Eric Anholt <eric@anholt.net> wrote:
> Daniel Martin <consume.noise@gmail.com> writes:
>> Add a configure option --with/--without-valgrind to be able to compile
>> libdrm with or without valgrind. The latter was not possible if
>> pkgconfig found the valgrind package.
>
> How would you have the valgrind .pc file but be unable to build with
> valgrind?  .pc files should come with the parts necessary to build.

It was a bug in our build system, which didn't exported the include path
correctly.

But, regardless of this homebrewn bug. I like to leave decissions up to
the user: If it is possible to build without valgrind - make it an option.
The same goes for the tests. Where I would like to create a patch too.
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 09fed53..0776320 100644
--- a/configure.ac
+++ b/configure.ac
@@ -292,8 +292,21 @@  fi
 AC_SUBST(PCIACCESS_CFLAGS)
 AC_SUBST(PCIACCESS_LIBS)
 
-PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
-if test "x$have_valgrind" = "xyes"; then
+AC_ARG_WITH(valgrind,
+	      AS_HELP_STRING([--with-valgrind],
+	      [Enable support for valgrind (default: auto)]),
+	      [VALGRIND=$with_valgrind], [VALGRIND=auto])
+
+if test "x$VALGRIND" = "xauto"; then
+	PKG_CHECK_MODULES(VALGRIND, [valgrind], [VALGRIND=yes], [VALGRIND=no])
+else
+	if test "x$VALGRIND" = "xyes"; then
+		VALGRIND=yes
+	else
+		VALGRIND=no
+	fi
+fi
+if test "x$VALGRIND" = "xyes"; then
 	AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
 fi
 
@@ -340,6 +353,7 @@  echo ""
 echo "$PACKAGE_STRING will be compiled with:"
 echo ""
 echo "  libkms         $LIBKMS"
+echo "  valgrind       $VALGRIND"
 echo "  Intel API      $INTEL"
 echo "  vmwgfx API     $VMWGFX"
 echo "  Radeon API     $RADEON"