--- /dev/null
+Return-Path: <felipe.contreras@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0E572431FC2\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 05:26:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id W2bDspfQdy-e for <notmuch@notmuchmail.org>;\r
+ Mon, 20 May 2013 05:26:02 -0700 (PDT)\r
+Received: from mail-ob0-f171.google.com (mail-ob0-f171.google.com\r
+ [209.85.214.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B7F86431FC0\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 05:26:02 -0700 (PDT)\r
+Received: by mail-ob0-f171.google.com with SMTP id ef5so6947731obb.2\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 05:26:00 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+ :references; bh=PeDYr2ns1fhDb+mYm0+8R2RNCyowSih5RC8fe5LC4TI=;\r
+ b=c3F3Z+WzN+y81DeeKiC1ynuVTD6D5CJT7DRhgja/qkht5qrNokcwVIWSCJI5l+NM+q\r
+ jJDXOsjlwrLD+ledSbUobcBYn3f4LoNjAyFKGjGuBT7vhkSd29XevzGrO4mYC7235zJk\r
+ CMmUTrmlKgl1sLDst22hqDSnWi9Lu2/1aVkVCKvVJTaLmb3yohPc28keSt2G/GMCl0Pp\r
+ 1bXrNAtJc2IwjFnRLH4QrDGTBTXZB40sZU56PnyOXUPTfAtYZd2tsdIHTfIm2dO80EIO\r
+ XmOSp3o+hF1vRfmpy+6PmVmjuVCOF+ESBE8UFjAvc8DFjgLRVtcSBz22+41lk1igGw43\r
+ /OLw==\r
+X-Received: by 10.60.60.10 with SMTP id d10mr28447630oer.6.1369052760396;\r
+ Mon, 20 May 2013 05:26:00 -0700 (PDT)\r
+Received: from localhost (187-163-100-70.static.axtel.net. [187.163.100.70])\r
+ by mx.google.com with ESMTPSA id\r
+ yx4sm19918411obb.11.2013.05.20.05.25.58 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Mon, 20 May 2013 05:25:59 -0700 (PDT)\r
+From: Felipe Contreras <felipe.contreras@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] ruby: use in-tree notmuch library\r
+Date: Mon, 20 May 2013 07:24:23 -0500\r
+Message-Id: <1369052664-17869-2-git-send-email-felipe.contreras@gmail.com>\r
+X-Mailer: git-send-email 1.8.3.rc3.286.g3d43083\r
+In-Reply-To: <1369052664-17869-1-git-send-email-felipe.contreras@gmail.com>\r
+References: <1369052664-17869-1-git-send-email-felipe.contreras@gmail.com>\r
+Cc: Ali Polatel <alip@exherbo.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 May 2013 12:26:10 -0000\r
+\r
+Currently it simply finds any library available, and if notmuch is\r
+installed in the system, it would give priority to that library.\r
+\r
+Let's implement our own helper functions to link directly to the local\r
+library, and give priority to the local header file.\r
+\r
+Also, add an option to properly check if there are missing symbols.\r
+\r
+Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\r
+---\r
+ bindings/ruby/extconf.rb | 23 ++++++++++++++++++++---\r
+ 1 file changed, 20 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb\r
+index 7b9750f..ddd4e48 100644\r
+--- a/bindings/ruby/extconf.rb\r
++++ b/bindings/ruby/extconf.rb\r
+@@ -5,9 +5,26 @@\r
+ \r
+ require 'mkmf'\r
+ \r
+-# Notmuch Library\r
+-find_header('notmuch.h', '../../lib')\r
+-find_library('notmuch', 'notmuch_database_create', '../../lib')\r
++dir = File.join('..', '..', 'lib')\r
++\r
++# includes\r
++$INCFLAGS = "-I#{dir} #{$INCFLAGS}"\r
++\r
++# make sure there are no undefined symbols\r
++$LDFLAGS += ' -Wl,--no-undefined'\r
++\r
++def have_local_library(lib, path, func, headers = nil)\r
++ checking_for checking_message(func.funcall_style, lib) do\r
++ lib = File.join(path, lib)\r
++ if try_func(func, lib, headers)\r
++ $LOCAL_LIBS += lib\r
++ end\r
++ end\r
++end\r
++\r
++if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')\r
++ exit 1\r
++end\r
+ \r
+ # Create Makefile\r
+ dir_config('notmuch')\r
+-- \r
+1.8.3.rc3.286.g3d43083\r
+\r