[PATCH 2/5] configure, test: Added variables for paths to true and false.

Charles Celerier cceleri at cs.stanford.edu
Tue May 6 10:02:25 PDT 2014


The path to true may not be the same on all platforms (e.g. on Mac OS X
it is /usr/bin/true), so the hard-coded path of /bin/true is not
portable. This is resolved by adding a step to the configure script to
locate the path of true and to use the TRUE variable wherever /bin/true
was needed. The same was done for false.

Signed-off-by: Charles Celerier <cceleri at cs.stanford.edu>
---
 configure           | 6 ++++++
 test/Makefile.local | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 9bde2eb..0bce0a3 100755
--- a/configure
+++ b/configure
@@ -50,6 +50,8 @@ CPPFLAGS=${CPPFLAGS:-}
 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
 LDFLAGS=${LDFLAGS:-}
 XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
+TRUE=$(which true)
+FALSE=$(which false)
 
 # We don't allow the EMACS or GZIP Makefile variables inherit values
 # from the environment as we do with CC and CXX above. The reason is
@@ -761,6 +763,10 @@ CXX = ${CXX}
 # Command to execute emacs from Makefiles
 EMACS = emacs --quick
 
+# Define the paths to true and false.
+TRUE = ${TRUE}
+FALSE = ${FALSE}
+
 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
 CFLAGS = ${CFLAGS}
 
diff --git a/test/Makefile.local b/test/Makefile.local
index d622eaf..e422c06 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o
 
 $(dir)/have-compact: Makefile.config
 ifeq ($(HAVE_XAPIAN_COMPACT),1)
-	ln -sf /bin/true $@
+	ln -sf $(TRUE) $@
 else
-	ln -sf /bin/false $@
+	ln -sf $(FALSE) $@
 endif
 
 $(dir)/have-man: Makefile.config
 ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
-	ln -sf /bin/false $@
+	ln -sf $(FALSE) $@
 else
-	ln -sf /bin/true $@
+	ln -sf $(TRUE) $@
 endif
 
 .PHONY: test check
-- 
1.8.5.2 (Apple Git-48)



More information about the notmuch mailing list