[notmuch] [PATCH 1/2] notmuch-new: Only install SIGALRM if not running under gdb

2009-11-22 Thread Carl Worth
On Sun, 22 Nov 2009 00:44:31 +, Chris Wilson  
wrote:
> I felt sorry for Carl trying to step through an exception from xapian
> and suffering from the SIGALARMs..

You're too kind, Chris. These are both pushed.

And did you notice the way I didn't push as soon as I found your patches
in my inbox, but this time I looked for the *next* set of patches. ;-)

-Carl


[notmuch] [PATCH 1/2] notmuch-new: Only install SIGALRM if not running under gdb

2009-11-22 Thread Chris Wilson
I felt sorry for Carl trying to step through an exception from xapian
and suffering from the SIGALARMs..

We can detect if the user launched notmuch under a debugger by either
checking our cmdline for the presence of the gdb string or querying if
valgrind is controlling our process. For the latter we need to add a
compile time check for the valgrind development library, and so add the
initial support to build Makefile.config from configure.

Signed-off-by: Chris Wilson 
Reviewed-by: Carl Worth 
[ickle: And do not install the timer when under the debugger]
---
 Makefile.config  |1 +
 Makefile.local   |3 ++-
 configure|   21 +
 debugger.c   |   47 +++
 notmuch-client.h |3 +++
 notmuch-new.c|   49 -
 6 files changed, 98 insertions(+), 26 deletions(-)
 create mode 100644 debugger.c

diff --git a/Makefile.config b/Makefile.config
index d72a39e..ddc7436 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -1,2 +1,3 @@
 prefix = /usr/local
 bash_completion_dir = /etc/bash_completion.d
+CFLAGS += -DHAVE_VALGRIND
diff --git a/Makefile.local b/Makefile.local
index 3c99624..efe76c8 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -3,6 +3,8 @@ all: notmuch notmuch.1.gz
 emacs: notmuch.elc

 notmuch_client_srcs =  \
+   debugger.c  \
+   gmime-filter-reply.c\
notmuch.c   \
notmuch-config.c\
notmuch-dump.c  \
@@ -14,7 +16,6 @@ notmuch_client_srcs = \
notmuch-show.c  \
notmuch-tag.c   \
notmuch-time.c  \
-   gmime-filter-reply.c\
query-string.c  \
show-message.c

diff --git a/configure b/configure
index fe46c8e..b4770ec 100755
--- a/configure
+++ b/configure
@@ -53,6 +53,14 @@ else
 errors=$((errors + 1))
 fi

+if pkg-config --modversion valgrind > /dev/null 2>&1; then
+echo "Checking for valgrind development files... Yes."
+have_valgrind=-DHAVE_VALGRIND
+else
+echo "Checking for valgrind development files... No."
+have_valgrind=
+fi
+
 if [ $errors -gt 0 ]; then
 cat < Makefile.config