From: Carl Worth <cworth@cworth.org>
Date: Wed, 2 Dec 2009 00:00:31 +0000 (-0800)
Subject: configure: Assimilate new getlinetest into recent configure conventions.
X-Git-Tag: 0.1~260
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=650f6ac573ae6d08dbd2752fe58e670b28fee957;p=notmuch-old

configure: Assimilate new getlinetest into recent configure conventions.

We're now using printf to print what we're checking before we check. We're
also making variables such as HAVE_GETLINE available to both make and to
the C pre-processor.

With this, the local getline implementation is now only compiled if not
available on the system.
---

diff --git a/Makefile b/Makefile
index c0b1b3fa..17be8b48 100644
--- a/Makefile
+++ b/Makefile
@@ -34,16 +34,17 @@ override LDFLAGS += \
 
 all: notmuch notmuch.1.gz
 
-include lib/Makefile.local
-include compat/Makefile.local
-include Makefile.local
-
-# And get user settings from the output of configure
+# Before including any other Makefile fragments, get settings from the
+# output of configure
 Makefile.config: configure
 	./configure
 
 include Makefile.config
 
+include lib/Makefile.local
+include compat/Makefile.local
+include Makefile.local
+
 # The user has not set any verbosity, default to quiet mode and inform the
 # user how to enable verbose compiles.
 ifeq ($(V),)
diff --git a/configure b/configure
index 1b5f7e04..bb1f0dbc 100755
--- a/configure
+++ b/configure
@@ -126,12 +126,14 @@ EOF
     exit 1
 fi
 
+printf "Checking for getline... "
 if ! gcc -o getlinetest getlinetest.c > /dev/null 2>&1
 then
-    echo "Checking for getline... No."
-    getline=-Dgetline=_notmuch_getline
+    printf "No.\n"
+    have_getline=0
 else
-    echo "Checking for getline... Yes."
+    printf "Yes.\n"
+    have_getline=1
 fi
 rm -f getlinetest
 
@@ -148,5 +150,6 @@ EOF
 # construct the Makefile.config
 cat > Makefile.config <<EOF
 prefix = /usr/local
-override CFLAGS += -DHAVE_VALGRIND=${have_valgrind} ${valgrind_flags} ${getline}
+HAVE_GETLINE = ${have_getline}
+override CFLAGS += -DHAVE_VALGRIND=${have_valgrind} ${valgrind_flags} -DHAVE_GETLINE=\$(HAVE_GETLINE)
 EOF