]> git.notmuchmail.org Git - notmuch/commitdiff
Add test to configure script to detect getline
authorJeffrey C. Ollie <jeff@ocjtech.us>
Mon, 23 Nov 2009 18:14:15 +0000 (12:14 -0600)
committerCarl Worth <cworth@cworth.org>
Wed, 2 Dec 2009 00:33:25 +0000 (16:33 -0800)
Add a simple test to the configure script to detect getline.  It's not
important that the test run, just that it compiles and links without
any errors.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
configure
getlinetest.c [new file with mode: 0644]

index 6b571977917f5d7fb9d557915a00a97380c09bfa..1b5f7e04eee3f584ac4c8a56d1c58d03dc221d06 100755 (executable)
--- a/configure
+++ b/configure
@@ -126,6 +126,15 @@ EOF
     exit 1
 fi
 
     exit 1
 fi
 
+if ! gcc -o getlinetest getlinetest.c > /dev/null 2>&1
+then
+    echo "Checking for getline... No."
+    getline=-Dgetline=_notmuch_getline
+else
+    echo "Checking for getline... Yes."
+fi
+rm -f getlinetest
+
 cat <<EOF
 
 All required packages were found. You may now run the following
 cat <<EOF
 
 All required packages were found. You may now run the following
@@ -139,5 +148,5 @@ EOF
 # construct the Makefile.config
 cat > Makefile.config <<EOF
 prefix = /usr/local
 # construct the Makefile.config
 cat > Makefile.config <<EOF
 prefix = /usr/local
-override CFLAGS += -DHAVE_VALGRIND=${have_valgrind} ${valgrind_flags}
+override CFLAGS += -DHAVE_VALGRIND=${have_valgrind} ${valgrind_flags} ${getline}
 EOF
 EOF
diff --git a/getlinetest.c b/getlinetest.c
new file mode 100644 (file)
index 0000000..2a21a50
--- /dev/null
@@ -0,0 +1,13 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <sys/types.h>
+
+int main()
+{
+  ssize_t count = 0;
+  size_t n = 0;
+  char **lineptr = NULL;
+  FILE *stream = NULL;
+
+  count = getline(lineptr, &n, stream);
+}