--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 394D66DE0948\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 23:00:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.196\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.196 tagged_above=-999 required=5 tests=[AWL=0.186, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id hdEzx7CV_8iv for <notmuch@notmuchmail.org>;\r
+ Sat, 13 Jun 2015 23:00:08 -0700 (PDT)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+ [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 2107D6DE0350\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 23:00:07 -0700 (PDT)\r
+Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
+ 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1Z40x3-0002Yw-UM; Sun, 14 Jun 2015 05:59:25 +0000\r
+Received: (nullmailer pid 14190 invoked by uid 1000); Sun, 14 Jun 2015\r
+ 05:59:07 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable\r
+Date: Sun, 14 Jun 2015 07:58:44 +0200\r
+Message-Id: <1434261524-14139-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1433142542-2307-3-git-send-email-david@tethera.net>\r
+References: <1433142542-2307-3-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Sun, 14 Jun 2015 06:00:10 -0000\r
+\r
+In particular this is supposed to help build on systems (presumably\r
+using a non-gnu ld) where this flag is not available.\r
+---\r
+ bindings/Makefile.local | 4 +++-\r
+ bindings/ruby/extconf.rb | 5 +++--\r
+ configure | 13 +++++++++++++\r
+ lib/Makefile.local | 2 +-\r
+ 4 files changed, 20 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/bindings/Makefile.local b/bindings/Makefile.local\r
+index 16817f5..d236f01 100644\r
+--- a/bindings/Makefile.local\r
++++ b/bindings/Makefile.local\r
+@@ -5,7 +5,9 @@ dir := bindings\r
+ # force the shared library to be built\r
+ ruby-bindings: lib/libnotmuch.so\r
+ ifeq ($(HAVE_RUBY_DEV),1)\r
+- cd $(dir)/ruby && ruby extconf.rb --vendor\r
++ cd $(dir)/ruby && \\r
++ EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \\r
++ ruby extconf.rb --vendor\r
+ $(MAKE) -C $(dir)/ruby\r
+ else\r
+ @echo Missing dependency, skipping ruby bindings\r
+diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb\r
+index 6160db2..6d5607e 100644\r
+--- a/bindings/ruby/extconf.rb\r
++++ b/bindings/ruby/extconf.rb\r
+@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')\r
+ # includes\r
+ $INCFLAGS = "-I#{dir} #{$INCFLAGS}"\r
+ \r
+-# make sure there are no undefined symbols\r
+-$LDFLAGS += ' -Wl,--no-undefined'\r
++if ENV['EXTRA_LDFLAGS']\r
++ $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']\r
++end\r
+ \r
+ def have_local_library(lib, path, func, headers = nil)\r
+ checking_for checking_message(func, lib) do\r
+diff --git a/configure b/configure\r
+index 13a8dca..b967a4e 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -751,6 +751,16 @@ else\r
+ as_needed_ldflags=""\r
+ fi\r
+ \r
++printf "Checking for -Wl,--no-undefined... "\r
++if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1\r
++then\r
++ printf "Yes.\n"\r
++ no_undefined_ldflags="-Wl,--no-undefined"\r
++else\r
++ printf "No (nothing to worry about).\n"\r
++ no_undefined_ldflags=""\r
++fi\r
++\r
+ WARN_CXXFLAGS=""\r
+ printf "Checking for available C++ compiler warning flags... "\r
+ for flag in -Wall -Wextra -Wwrite-strings; do\r
+@@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}\r
+ # Flags needed to have linker link only to necessary libraries\r
+ AS_NEEDED_LDFLAGS = ${as_needed_ldflags}\r
+ \r
++# Flags to have the linker flag undefined symbols in object files\r
++NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}\r
++\r
+ # Whether valgrind header files are available\r
+ HAVE_VALGRIND = ${have_valgrind}\r
+ \r
+diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+index f9ecd50..b58b4e8 100644\r
+--- a/lib/Makefile.local\r
++++ b/lib/Makefile.local\r
+@@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so\r
+ LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)\r
+ SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)\r
+ LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)\r
+-LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined\r
++LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)\r
+ ifeq ($(PLATFORM),OPENBSD)\r
+ LIBRARY_LINK_FLAG += -lc\r
+ endif\r
+-- \r
+2.1.4\r
+\r