[notmuch] [PATCH] Add tests to configure script to detect strndup and getline
On Mon, Nov 23, 2009 at 12:14:15PM -0600, Jeffrey C. Ollie wrote: > cat > Makefile.config < prefix = /usr/local > bash_completion_dir = /etc/bash_completion.d >-CFLAGS += ${have_valgrind} >+CFLAGS += ${have_valgrind} ${strndup} ${getline} > EOF This doesn't seem to do much for me, they don't seem to end up in the args passed to g++. I'm no Makefile wizard, so I got notmuch finally compiling by simply copy/pasting the ${strndup} and ${getline} from Makefile.config to Makefile: # Now smash together user's values with our extra values override CFLAGS += $(WARN_FLAGS) $(extra_cflags) -Dstrndup=_notmuch_strndup -Dgetline=_notmuch_getline override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) -Dstrndup=_notmuch_strndup -Dgetline=_notmuch_getline -- - Marten
Re: [notmuch] [PATCH] Add tests to configure script to detect strndup and getline
On Mon, Nov 23, 2009 at 12:14:15PM -0600, Jeffrey C. Ollie wrote: cat > Makefile.config < This doesn't seem to do much for me, they don't seem to end up in the args passed to g++. I'm no Makefile wizard, so I got notmuch finally compiling by simply copy/pasting the ${strndup} and ${getline} from Makefile.config to Makefile: # Now smash together user's values with our extra values override CFLAGS += $(WARN_FLAGS) $(extra_cflags) -Dstrndup=_notmuch_strndup -Dgetline=_notmuch_getline override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) -Dstrndup=_notmuch_strndup -Dgetline=_notmuch_getline -- - Marten ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[notmuch] [PATCH] Add tests to configure script to detect strndup and getline
Add some simple tests to the configure script to detect strndup and getline. It's not important that the tests run, just that they compile and link without any errors. Signed-off-by: Jeffrey C. Ollie --- configure | 20 +++- getlinetest.c | 13 + strnduptest.c | 10 ++ 3 files changed, 42 insertions(+), 1 deletions(-) create mode 100644 getlinetest.c create mode 100644 strnduptest.c diff --git a/configure b/configure index b4770ec..44c1700 100755 --- a/configure +++ b/configure @@ -118,6 +118,24 @@ EOF exit 1 fi +if ! gcc -o strnduptest strnduptest.c > /dev/null 2>&1 +then +echo "Checking for strndup... No." +strndup=-Dstrndup=_notmuch_strndup +else +echo "Checking for strndup... Yes." +fi +rm -f strnduptest + +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 < Makefile.config < +#include + +int main() +{ + ssize_t count = 0; + size_t n = 0; + char **lineptr = NULL; + FILE *stream = NULL; + + count = getline(lineptr, &n, stream); +} diff --git a/strnduptest.c b/strnduptest.c new file mode 100644 index 000..97c7c80 --- /dev/null +++ b/strnduptest.c @@ -0,0 +1,10 @@ +#include + +int main() +{ + char *d; + const char *s = ""; + size_t n = 0; + + d = strndup(s, n); +} -- 1.6.5.2