summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey C. Ollie <jeff@ocjtech.us>2009-11-23 12:14:15 -0600
committerCarl Worth <cworth@cworth.org>2009-12-01 16:33:25 -0800
commit3054bc462c8f31965f342808fce48c72f2858cfc (patch)
tree4fa57e83d9baf41b5ae4e30f4fd6a6c2149019a7
parent1682633f65061247d90129b73650593261eed892 (diff)
Add test to configure script to detect getline
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>
-rwxr-xr-xconfigure11
-rw-r--r--getlinetest.c13
2 files changed, 23 insertions, 1 deletions
diff --git a/configure b/configure
index 6b57197..1b5f7e0 100755
--- a/configure
+++ b/configure
@@ -126,6 +126,15 @@ EOF
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
@@ -139,5 +148,5 @@ EOF
# 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
diff --git a/getlinetest.c b/getlinetest.c
new file mode 100644
index 0000000..2a21a50
--- /dev/null
+++ b/getlinetest.c
@@ -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);
+}