improve detection of:
authorYang Tse <yangsita@gmail.com>
Mon, 15 Sep 2008 00:32:08 +0000 (00:32 +0000)
committerYang Tse <yangsita@gmail.com>
Mon, 15 Sep 2008 00:32:08 +0000 (00:32 +0000)
  strcasecmp()
  strcasestr()
  strcmpi()
  stricmp()
  strlcat()
  strncasecmp()
  strncmpi()
  strnicmp()

configure.ac
lib/strequal.c
m4/curl-functions.m4

index 264d1a4..6a88420 100644 (file)
@@ -714,6 +714,7 @@ if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
                ,
                -lnsl)
 fi
+ac_cv_func_strcasecmp="no"
 
 dnl socket lib?
 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
@@ -2038,8 +2039,16 @@ CURL_CHECK_FUNC_FDOPEN
 CURL_CHECK_FUNC_FTRUNCATE
 CURL_CHECK_FUNC_GMTIME_R
 CURL_CHECK_FUNC_SIGACTION
+CURL_CHECK_FUNC_STRCASECMP
+CURL_CHECK_FUNC_STRCASESTR
+CURL_CHECK_FUNC_STRCMPI
 CURL_CHECK_FUNC_STRDUP
 CURL_CHECK_FUNC_STRERROR_R
+CURL_CHECK_FUNC_STRICMP
+CURL_CHECK_FUNC_STRLCAT
+CURL_CHECK_FUNC_STRNCASECMP
+CURL_CHECK_FUNC_STRNCMPI
+CURL_CHECK_FUNC_STRNICMP
 CURL_CHECK_FUNC_STRTOK_R
 CURL_CHECK_FUNC_STRTOLL
 
@@ -2079,11 +2088,6 @@ AC_CHECK_FUNCS([basename \
   signal \
   sigsetjmp \
   socket \
-  strcasecmp \
-  strcasestr \
-  strcmpi \
-  stricmp \
-  strlcat \
   strstr \
   uname \
   utime
index 639a7ff..ac9075d 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
  * $Id$
  ***************************************************************************/
 
-#ifndef _GNU_SOURCE
-/* glibc needs this to define the prototype for strcasestr */
-#define _GNU_SOURCE 1
-#endif
-
 #include "setup.h"
 
 #include <string.h>
 
 #include "strequal.h"
 
-#if defined(HAVE_STRCASECMP) && defined(__STRICT_ANSI__)
-/* this is for "-ansi -Wall -pedantic" to stop complaining! */
-extern int (strcasecmp)(const char *s1, const char *s2);
-extern int (strncasecmp)(const char *s1, const char *s2, size_t n);
-#endif
-
 int curl_strequal(const char *first, const char *second)
 {
 #if defined(HAVE_STRCASECMP)
@@ -65,11 +54,11 @@ int curl_strequal(const char *first, const char *second)
 
 int curl_strnequal(const char *first, const char *second, size_t max)
 {
-#if defined(HAVE_STRCASECMP)
+#if defined(HAVE_STRNCASECMP)
   return !strncasecmp(first, second, max);
-#elif defined(HAVE_STRCMPI)
+#elif defined(HAVE_STRNCMPI)
   return !strncmpi(first, second, max);
-#elif defined(HAVE_STRICMP)
+#elif defined(HAVE_STRNICMP)
   return !strnicmp(first, second, max);
 #else
   while(*first && *second && max) {
index 4be2dba..70307c8 100644 (file)
@@ -91,7 +91,7 @@ curl_includes_stdlib="\
 dnl CURL_INCLUDES_STRING
 dnl -------------------------------------------------
 dnl Set up variable with list of headers that must be
-dnl included when string.h is to be included.
+dnl included when string(s).h is to be included.
 
 AC_DEFUN([CURL_INCLUDES_STRING], [
 curl_includes_string="\
@@ -102,9 +102,12 @@ curl_includes_string="\
 #ifdef HAVE_STRING_H
 #  include <string.h>
 #endif
+#ifdef HAVE_STRINGS_H
+#  include <strings.h>
+#endif
 /* includes end */"
   AC_CHECK_HEADERS(
-    sys/types.h string.h,
+    sys/types.h string.h strings.h,
     [], [], [$curl_includes_string])
 ])
 
@@ -532,6 +535,261 @@ AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
 ])
 
 
+dnl CURL_CHECK_FUNC_STRCASECMP
+dnl -------------------------------------------------
+dnl Verify if strcasecmp is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strcasecmp, then
+dnl HAVE_STRCASECMP will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strcasecmp="unknown"
+  tst_proto_strcasecmp="unknown"
+  tst_compi_strcasecmp="unknown"
+  tst_allow_strcasecmp="unknown"
+  #
+  AC_MSG_CHECKING([if strcasecmp can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strcasecmp])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strcasecmp="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strcasecmp="no"
+  ])
+  #
+  if test "$tst_links_strcasecmp" = "yes"; then
+    AC_MSG_CHECKING([if strcasecmp is prototyped])
+    AC_EGREP_CPP([strcasecmp],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strcasecmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strcasecmp="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strcasecmp" = "yes"; then
+    AC_MSG_CHECKING([if strcasecmp is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strcasecmp(0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strcasecmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strcasecmp="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strcasecmp" = "yes"; then
+    AC_MSG_CHECKING([if strcasecmp usage allowed])
+    if test "x$curl_disallow_strcasecmp" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strcasecmp="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strcasecmp="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strcasecmp might be used])
+  if test "$tst_links_strcasecmp" = "yes" &&
+     test "$tst_proto_strcasecmp" = "yes" &&
+     test "$tst_compi_strcasecmp" = "yes" &&
+     test "$tst_allow_strcasecmp" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
+      [Define to 1 if you have the strcasecmp function.])
+    ac_cv_func_strcasecmp="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strcasecmp="no"
+  fi
+])
+
+
+dnl CURL_CHECK_FUNC_STRCASESTR
+dnl -------------------------------------------------
+dnl Verify if strcasestr is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strcasestr, then
+dnl HAVE_STRCASESTR will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRCASESTR], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strcasestr="unknown"
+  tst_proto_strcasestr="unknown"
+  tst_compi_strcasestr="unknown"
+  tst_allow_strcasestr="unknown"
+  #
+  AC_MSG_CHECKING([if strcasestr can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strcasestr])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strcasestr="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strcasestr="no"
+  ])
+  #
+  if test "$tst_links_strcasestr" = "yes"; then
+    AC_MSG_CHECKING([if strcasestr is prototyped])
+    AC_EGREP_CPP([strcasestr],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strcasestr="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strcasestr="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strcasestr" = "yes"; then
+    AC_MSG_CHECKING([if strcasestr is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strcasestr(0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strcasestr="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strcasestr="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strcasestr" = "yes"; then
+    AC_MSG_CHECKING([if strcasestr usage allowed])
+    if test "x$curl_disallow_strcasestr" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strcasestr="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strcasestr="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strcasestr might be used])
+  if test "$tst_links_strcasestr" = "yes" &&
+     test "$tst_proto_strcasestr" = "yes" &&
+     test "$tst_compi_strcasestr" = "yes" &&
+     test "$tst_allow_strcasestr" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRCASESTR, 1,
+      [Define to 1 if you have the strcasestr function.])
+    ac_cv_func_strcasestr="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strcasestr="no"
+  fi
+])
+
+
+dnl CURL_CHECK_FUNC_STRCMPI
+dnl -------------------------------------------------
+dnl Verify if strcmpi is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strcmpi, then
+dnl HAVE_STRCMPI will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strcmpi="unknown"
+  tst_proto_strcmpi="unknown"
+  tst_compi_strcmpi="unknown"
+  tst_allow_strcmpi="unknown"
+  #
+  AC_MSG_CHECKING([if strcmpi can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strcmpi])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strcmpi="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strcmpi="no"
+  ])
+  #
+  if test "$tst_links_strcmpi" = "yes"; then
+    AC_MSG_CHECKING([if strcmpi is prototyped])
+    AC_EGREP_CPP([strcmpi],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strcmpi="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strcmpi="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strcmpi" = "yes"; then
+    AC_MSG_CHECKING([if strcmpi is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strcmpi(0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strcmpi="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strcmpi="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strcmpi" = "yes"; then
+    AC_MSG_CHECKING([if strcmpi usage allowed])
+    if test "x$curl_disallow_strcmpi" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strcmpi="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strcmpi="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strcmpi might be used])
+  if test "$tst_links_strcmpi" = "yes" &&
+     test "$tst_proto_strcmpi" = "yes" &&
+     test "$tst_compi_strcmpi" = "yes" &&
+     test "$tst_allow_strcmpi" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
+      [Define to 1 if you have the strcmpi function.])
+    ac_cv_func_strcmpi="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strcmpi="no"
+  fi
+])
+
+
 dnl CURL_CHECK_FUNC_STRDUP
 dnl -------------------------------------------------
 dnl Verify if strdup is available, prototyped, and
@@ -873,6 +1131,431 @@ AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
 ])
 
 
+dnl CURL_CHECK_FUNC_STRICMP
+dnl -------------------------------------------------
+dnl Verify if stricmp is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_stricmp, then
+dnl HAVE_STRICMP will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_stricmp="unknown"
+  tst_proto_stricmp="unknown"
+  tst_compi_stricmp="unknown"
+  tst_allow_stricmp="unknown"
+  #
+  AC_MSG_CHECKING([if stricmp can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([stricmp])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_stricmp="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_stricmp="no"
+  ])
+  #
+  if test "$tst_links_stricmp" = "yes"; then
+    AC_MSG_CHECKING([if stricmp is prototyped])
+    AC_EGREP_CPP([stricmp],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_stricmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_stricmp="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_stricmp" = "yes"; then
+    AC_MSG_CHECKING([if stricmp is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != stricmp(0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_stricmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_stricmp="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_stricmp" = "yes"; then
+    AC_MSG_CHECKING([if stricmp usage allowed])
+    if test "x$curl_disallow_stricmp" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_stricmp="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_stricmp="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if stricmp might be used])
+  if test "$tst_links_stricmp" = "yes" &&
+     test "$tst_proto_stricmp" = "yes" &&
+     test "$tst_compi_stricmp" = "yes" &&
+     test "$tst_allow_stricmp" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
+      [Define to 1 if you have the stricmp function.])
+    ac_cv_func_stricmp="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_stricmp="no"
+  fi
+])
+
+
+dnl CURL_CHECK_FUNC_STRLCAT
+dnl -------------------------------------------------
+dnl Verify if strlcat is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strlcat, then
+dnl HAVE_STRLCAT will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRLCAT], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strlcat="unknown"
+  tst_proto_strlcat="unknown"
+  tst_compi_strlcat="unknown"
+  tst_allow_strlcat="unknown"
+  #
+  AC_MSG_CHECKING([if strlcat can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strlcat])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strlcat="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strlcat="no"
+  ])
+  #
+  if test "$tst_links_strlcat" = "yes"; then
+    AC_MSG_CHECKING([if strlcat is prototyped])
+    AC_EGREP_CPP([strlcat],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strlcat="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strlcat="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strlcat" = "yes"; then
+    AC_MSG_CHECKING([if strlcat is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strlcat(0, 0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strlcat="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strlcat="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strlcat" = "yes"; then
+    AC_MSG_CHECKING([if strlcat usage allowed])
+    if test "x$curl_disallow_strlcat" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strlcat="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strlcat="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strlcat might be used])
+  if test "$tst_links_strlcat" = "yes" &&
+     test "$tst_proto_strlcat" = "yes" &&
+     test "$tst_compi_strlcat" = "yes" &&
+     test "$tst_allow_strlcat" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRLCAT, 1,
+      [Define to 1 if you have the strlcat function.])
+    ac_cv_func_strlcat="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strlcat="no"
+  fi
+])
+
+
+dnl CURL_CHECK_FUNC_STRNCASECMP
+dnl -------------------------------------------------
+dnl Verify if strncasecmp is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strncasecmp, then
+dnl HAVE_STRNCASECMP will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRNCASECMP], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strncasecmp="unknown"
+  tst_proto_strncasecmp="unknown"
+  tst_compi_strncasecmp="unknown"
+  tst_allow_strncasecmp="unknown"
+  #
+  AC_MSG_CHECKING([if strncasecmp can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strncasecmp])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strncasecmp="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strncasecmp="no"
+  ])
+  #
+  if test "$tst_links_strncasecmp" = "yes"; then
+    AC_MSG_CHECKING([if strncasecmp is prototyped])
+    AC_EGREP_CPP([strncasecmp],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strncasecmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strncasecmp="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strncasecmp" = "yes"; then
+    AC_MSG_CHECKING([if strncasecmp is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strncasecmp(0, 0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strncasecmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strncasecmp="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strncasecmp" = "yes"; then
+    AC_MSG_CHECKING([if strncasecmp usage allowed])
+    if test "x$curl_disallow_strncasecmp" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strncasecmp="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strncasecmp="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strncasecmp might be used])
+  if test "$tst_links_strncasecmp" = "yes" &&
+     test "$tst_proto_strncasecmp" = "yes" &&
+     test "$tst_compi_strncasecmp" = "yes" &&
+     test "$tst_allow_strncasecmp" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1,
+      [Define to 1 if you have the strncasecmp function.])
+    ac_cv_func_strncasecmp="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strncasecmp="no"
+  fi
+])
+
+
+dnl CURL_CHECK_FUNC_STRNCMPI
+dnl -------------------------------------------------
+dnl Verify if strncmpi is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strncmpi, then
+dnl HAVE_STRNCMPI will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRNCMPI], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strncmpi="unknown"
+  tst_proto_strncmpi="unknown"
+  tst_compi_strncmpi="unknown"
+  tst_allow_strncmpi="unknown"
+  #
+  AC_MSG_CHECKING([if strncmpi can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strncmpi])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strncmpi="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strncmpi="no"
+  ])
+  #
+  if test "$tst_links_strncmpi" = "yes"; then
+    AC_MSG_CHECKING([if strncmpi is prototyped])
+    AC_EGREP_CPP([strncmpi],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strncmpi="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strncmpi="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strncmpi" = "yes"; then
+    AC_MSG_CHECKING([if strncmpi is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strncmpi(0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strncmpi="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strncmpi="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strncmpi" = "yes"; then
+    AC_MSG_CHECKING([if strncmpi usage allowed])
+    if test "x$curl_disallow_strncmpi" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strncmpi="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strncmpi="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strncmpi might be used])
+  if test "$tst_links_strncmpi" = "yes" &&
+     test "$tst_proto_strncmpi" = "yes" &&
+     test "$tst_compi_strncmpi" = "yes" &&
+     test "$tst_allow_strncmpi" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1,
+      [Define to 1 if you have the strncmpi function.])
+    ac_cv_func_strncmpi="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strncmpi="no"
+  fi
+])
+
+
+dnl CURL_CHECK_FUNC_STRNICMP
+dnl -------------------------------------------------
+dnl Verify if strnicmp is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_strnicmp, then
+dnl HAVE_STRNICMP will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_STRNICMP], [
+  AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+  #
+  tst_links_strnicmp="unknown"
+  tst_proto_strnicmp="unknown"
+  tst_compi_strnicmp="unknown"
+  tst_allow_strnicmp="unknown"
+  #
+  AC_MSG_CHECKING([if strnicmp can be linked])
+  AC_LINK_IFELSE([
+    AC_LANG_FUNC_LINK_TRY([strnicmp])
+  ],[
+    AC_MSG_RESULT([yes])
+    tst_links_strnicmp="yes"
+  ],[
+    AC_MSG_RESULT([no])
+    tst_links_strnicmp="no"
+  ])
+  #
+  if test "$tst_links_strnicmp" = "yes"; then
+    AC_MSG_CHECKING([if strnicmp is prototyped])
+    AC_EGREP_CPP([strnicmp],[
+      $curl_includes_string
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_proto_strnicmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_proto_strnicmp="no"
+    ])
+  fi
+  #
+  if test "$tst_proto_strnicmp" = "yes"; then
+    AC_MSG_CHECKING([if strnicmp is compilable])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_string
+      ]],[[
+        if(0 != strnicmp(0, 0))
+          return 1;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      tst_compi_strnicmp="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_compi_strnicmp="no"
+    ])
+  fi
+  #
+  if test "$tst_compi_strnicmp" = "yes"; then
+    AC_MSG_CHECKING([if strnicmp usage allowed])
+    if test "x$curl_disallow_strnicmp" != "xyes"; then
+      AC_MSG_RESULT([yes])
+      tst_allow_strnicmp="yes"
+    else
+      AC_MSG_RESULT([no])
+      tst_allow_strnicmp="no"
+    fi
+  fi
+  #
+  AC_MSG_CHECKING([if strnicmp might be used])
+  if test "$tst_links_strnicmp" = "yes" &&
+     test "$tst_proto_strnicmp" = "yes" &&
+     test "$tst_compi_strnicmp" = "yes" &&
+     test "$tst_allow_strnicmp" = "yes"; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1,
+      [Define to 1 if you have the strnicmp function.])
+    ac_cv_func_strnicmp="yes"
+  else
+    AC_MSG_RESULT([no])
+    ac_cv_func_strnicmp="no"
+  fi
+])
+
+
 dnl CURL_CHECK_FUNC_STRTOK_R
 dnl -------------------------------------------------
 dnl Verify if strtok_r is available, prototyped, and