--- /dev/null
+Return-Path: <andrew.burgess@embecosm.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 arlo.cworth.org (Postfix) with ESMTP id 8B5406DE1585\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Nov 2015 09:32:15 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.72\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.72 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-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 QM5mbSy8TqDp for <notmuch@notmuchmail.org>;\r
+ Wed, 25 Nov 2015 09:32:13 -0800 (PST)\r
+Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com\r
+ [74.125.82.43]) by arlo.cworth.org (Postfix) with ESMTPS id 03A866DE0274 for\r
+ <notmuch@notmuchmail.org>; Wed, 25 Nov 2015 09:32:12 -0800 (PST)\r
+Received: by wmww144 with SMTP id w144so189520634wmw.1\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Nov 2015 09:32:10 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=embecosm-com.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id;\r
+ bh=G7/4PjlVvKSOVlva/gh0vLOE2NNIWl98DrZRItZAScs=;\r
+ b=PFmhnuBjeOB6VJwtX5Eopvu5EHdR/gj/6ftNHp3US7EJrtk3NEHZe3JNtpUnhdVLva\r
+ B+h1gL/tBRSTB8HiJDNE59dEUnKE79PUtRw/PajkgRLE34zmGuUEaeukANhkNvmBIOHI\r
+ KRR9GYxWIOQySnK8zgif8k4LhBq64HOTt1ajk6CU0BW6vLVPwAw6v80QZEGyHtwJSS7p\r
+ uD/irBTQ5DTpXqSj8HfIRrEYwq//Fay15A7PB3tkZNio2lSDaDvIcyuJnouAgVmcZaL1\r
+ sVwC1avKtv99XTlXROWOoQf1blNumbDvP1uZgYvBzyjRy8D/KOfG9BZBqlZra8Mc2Vhv\r
+ 3Yfw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
+ bh=G7/4PjlVvKSOVlva/gh0vLOE2NNIWl98DrZRItZAScs=;\r
+ b=cY3oM30HWzblxMt9dPTAyRfCn4/dilAMDqK8ERzo4oiXghv2/wMO5a+57CrM8KQcAh\r
+ vekhQrurU+Xy60IIccQ48ZvZ/HstjvNZX1Xast3Cqmin4qTnZ2e3P7zKb2N6R8iNLCvz\r
+ qNtthA2xW85zr7tzJh8i1HGFLx8m/B51C/bXWOqICvuKPzEvDJV/odJ+XGz8EPXkK2Vv\r
+ Y3z9bIRb3O/QEYqQJ9cZFvNN12GcMs65OgXUd/p9vNpd2jljFL7VtFid9THPk0Kz6JKn\r
+ vwZ04j3Q2o/1Cu5kojqVDVmZHEVz8UiTlfDOGVv0T1b9hTNrGqdqEjp4A0JUYxWAu7pl\r
+ d9cw==\r
+X-Gm-Message-State:\r
+ ALoCoQloKb1peic6vlra9hn5G8baai0oruvVG7mmZUiAQvCEBp+mDWeVEZL7qEOnfM9OFl036pnc\r
+X-Received: by 10.194.243.170 with SMTP id wz10mr51066206wjc.80.1448472730446;\r
+ Wed, 25 Nov 2015 09:32:10 -0800 (PST)\r
+Received: from localhost (host86-138-95-213.range86-138.btcentralplus.com.\r
+ [86.138.95.213])\r
+ by smtp.gmail.com with ESMTPSA id hw1sm24181636wjb.6.2015.11.25.09.32.09\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Wed, 25 Nov 2015 09:32:09 -0800 (PST)\r
+From: Andrew Burgess <andrew.burgess@embecosm.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] configure: Use $prefix for emacs,\r
+ even when pkg-config is available.\r
+Date: Wed, 25 Nov 2015 17:32:05 +0000\r
+Message-Id: <1448472725-11684-1-git-send-email-andrew.burgess@embecosm.com>\r
+X-Mailer: git-send-email 2.5.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 25 Nov 2015 17:32:15 -0000\r
+\r
+Hi,\r
+\r
+I like to maintain multiple copies of notmuch installed in parallel,\r
+and so make use of the --prefix=$PREFIX argument to configure.\r
+\r
+I recently tried to configure and install from master, and ran into an\r
+issue that the location selected for installing the emacs components\r
+did not respect my chosen prefix.\r
+\r
+It turns out that if pkg-config is available (it is here) then the\r
+supplied prefix is ignored, in favour of the path returned by pkg-config.\r
+\r
+To reproduce this issue, then as a non-root user, using current master:\r
+\r
+ ./configure --prefix=$HOME/notmuch-prefix\r
+ make\r
+ make install\r
+\r
+Assumming that you have pkg-config installed, emacs installed, and the\r
+command 'pkg-config emacs --variable sitepkglispdir' returns a\r
+directory that only root can write to, then the make install above\r
+should fail.\r
+\r
+The solution I propose in the patch below is to still apply the\r
+prefix, even when pkg-config is available; pkg-config is used to\r
+select the path within the prefix directory.\r
+\r
+Would you consider this for inclusion?\r
+\r
+Thanks,\r
+Andrew\r
+\r
+---\r
+When using pkg-config to select the path for the various emacs\r
+installation directories (the lisp and etc directories), still apply\r
+the $prefix variable.\r
+---\r
+ configure | 4 ++--\r
+ 1 file changed, 2 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/configure b/configure\r
+index 440d678..4f1db82 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -473,7 +473,7 @@ fi\r
+ \r
+ if [ -z "${EMACSLISPDIR}" ]; then\r
+ if pkg-config --exists emacs; then\r
+- EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)\r
++ EMACSLISPDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)\r
+ else\r
+ EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'\r
+ fi\r
+@@ -481,7 +481,7 @@ fi\r
+ \r
+ if [ -z "${EMACSETCDIR}" ]; then\r
+ if pkg-config --exists emacs; then\r
+- EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)\r
++ EMACSETCDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)\r
+ else\r
+ EMACSETCDIR='$(prefix)/share/emacs/site-lisp'\r
+ fi\r
+-- \r
+2.5.1\r
+\r