| 1 |
# strcasecmp.m4 |
| 2 |
# serial 3 |
| 3 |
dnl Copyright (C) 2002-2026 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_FUNC_STRCASECMP], |
| 10 |
[ |
| 11 |
AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
| 12 |
AC_CHECK_FUNCS([strcasecmp]) |
| 13 |
if test $ac_cv_func_strcasecmp = yes; then |
| 14 |
gl_STRCASECMP_WORKS |
| 15 |
case "$gl_cv_func_strcasecmp_works" in |
| 16 |
*yes) ;; |
| 17 |
*) REPLACE_STRCASECMP=1 ;; |
| 18 |
esac |
| 19 |
else |
| 20 |
HAVE_STRCASECMP=0 |
| 21 |
fi |
| 22 |
]) |
| 23 |
|
| 24 |
AC_DEFUN([gl_STRCASECMP_WORKS], |
| 25 |
[ |
| 26 |
AC_REQUIRE([AC_CANONICAL_HOST]) |
| 27 |
AC_CACHE_CHECK([whether strcasecmp works], |
| 28 |
[gl_cv_func_strcasecmp_works], |
| 29 |
[dnl Prepare a guess, used when cross-compiling or when specific locales |
| 30 |
dnl are not available. |
| 31 |
case "$host_os" in |
| 32 |
solaris* | cygwin*) |
| 33 |
gl_cv_func_strcasecmp_works="guessing no" ;; |
| 34 |
*) |
| 35 |
gl_cv_func_strcasecmp_works="guessing yes" ;; |
| 36 |
esac |
| 37 |
AC_RUN_IFELSE( |
| 38 |
[AC_LANG_SOURCE([[ |
| 39 |
#include <stdio.h> |
| 40 |
#include <ctype.h> |
| 41 |
#include <locale.h> |
| 42 |
#include <strings.h> |
| 43 |
int main () |
| 44 |
{ |
| 45 |
if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL |
| 46 |
|| setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) |
| 47 |
{ |
| 48 |
int c1 = (unsigned char) '\311'; |
| 49 |
int c2 = (unsigned char) '\351'; |
| 50 |
if (tolower (c1) == c2 && toupper (c2) == c1) |
| 51 |
return strcasecmp ("Fej\311r", "Fej\351r") != 0; |
| 52 |
} |
| 53 |
return 2; |
| 54 |
}]])], |
| 55 |
[gl_cv_func_strcasecmp_works=yes], |
| 56 |
[if test $? = 1; then |
| 57 |
gl_cv_func_strcasecmp_works=no |
| 58 |
fi |
| 59 |
], |
| 60 |
[:]) |
| 61 |
]) |
| 62 |
]) |
| 63 |
|
| 64 |
# Prerequisites of lib/strcasecmp.c. |
| 65 |
AC_DEFUN([gl_PREREQ_STRCASECMP], [ |
| 66 |
: |
| 67 |
]) |