/* 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
 
 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
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
 
 
 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 ;;
 fi
 
 AC_OUTPUT(Makefile abook.spec intl/Makefile po/Makefile.in)
-
 
  * Copyright (C) Jaakko Heinonen
  */
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
        return 1;
 }
 
+#ifndef HAVE_STRCASESTR
 char *
-strcasestr(char *haystack, char *needle)
+strcasestr(const char *haystack, const char *needle)
 {
        int i;
        int k;
 
        return NULL;
 }
-
+#endif
 
 #ifdef HAVE_CONFIG_H
 #      include "config.h"
 
 
 int            is_number(char *s);
 
-char           *strcasestr(char *haystack, char *needle);
-
 char           *strdup_printf(const char *format, ... );
 char           *strconcat(const char *str, ...);
 
 #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