From: Raphaƫl Droz Date: Sun, 29 Apr 2012 19:38:00 +0000 (+0200) Subject: Fix the inclusion of strcasestr() used by the vCard parser. X-Git-Tag: upstream/0.6.1~2^2~68 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=f937f7246af81dac1401685e3e3384646bdd5ccd;p=pkg%2Fabook.git Fix the inclusion of strcasestr() used by the vCard parser. --- diff --git a/config.h.in b/config.h.in index 918355f..6f1adf9 100644 --- a/config.h.in +++ b/config.h.in @@ -222,6 +222,9 @@ /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP +/* Define to 1 if you have the `strcasestr' function. */ +#undef HAVE_STRCASESTR + /* Define to 1 if you have the `strcoll' function and it is properly defined. */ #undef HAVE_STRCOLL diff --git a/configure b/configure index 8afd54f..1275ba4 100755 --- a/configure +++ b/configure @@ -11498,6 +11498,19 @@ fi done +for ac_func in strcasestr +do : + ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr" +if test "x$ac_cv_func_strcasestr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRCASESTR 1 +_ACEOF + $as_echo "#define HAVE_STRCASESTR 1" >>confdefs.h + +fi +done + + # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; case "${enableval}" in @@ -13112,4 +13125,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/configure.in b/configure.in index 069fc4b..a0c7101 100644 --- a/configure.in +++ b/configure.in @@ -135,6 +135,8 @@ AC_CHECK_FUNCS(resizeterm) AC_CHECK_FUNCS(snprintf vsnprintf) +AC_CHECK_FUNCS(strcasestr, AC_DEFINE(HAVE_STRCASESTR)) + AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [case "${enableval}" in yes) debug=true ;; no) debug=false ;; @@ -151,4 +153,3 @@ if test x$GCC = xyes; then fi AC_OUTPUT(Makefile abook.spec intl/Makefile po/Makefile.in) - diff --git a/filter.c b/filter.c index 848aab9..c5c69cf 100644 --- a/filter.c +++ b/filter.c @@ -7,6 +7,8 @@ * Copyright (C) Jaakko Heinonen */ +#define _GNU_SOURCE + #include #include #include diff --git a/misc.c b/misc.c index 308c196..0f96b7a 100644 --- a/misc.c +++ b/misc.c @@ -77,8 +77,9 @@ is_number(char *p) return 1; } +#ifndef HAVE_STRCASESTR char * -strcasestr(char *haystack, char *needle) +strcasestr(const char *haystack, const char *needle) { int i; int k; @@ -97,7 +98,7 @@ strcasestr(char *haystack, char *needle) return NULL; } - +#endif #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/misc.h b/misc.h index c5f7ac1..f7713ac 100644 --- a/misc.h +++ b/misc.h @@ -18,8 +18,6 @@ char *strtrim(char *); int is_number(char *s); -char *strcasestr(char *haystack, char *needle); - char *strdup_printf(const char *format, ... ); char *strconcat(const char *str, ...); @@ -56,8 +54,8 @@ int snprintf (char *str, size_t count, const char *fmt, ...); #ifndef HAVE_VSNPRINTF int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); #endif - +#ifndef HAVE_STRCASESTR +char *strcasestr(const char *, const char *); #endif - - +#endif