File: strcasecmp.m4

package info (click to toggle)
datamash 1.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,600 kB
  • sloc: ansic: 65,320; sh: 8,982; perl: 5,127; makefile: 250; sed: 16
file content (67 lines) | stat: -rw-r--r-- 1,777 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# strcasecmp.m4
# serial 2
dnl Copyright (C) 2002-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.

AC_DEFUN([gl_FUNC_STRCASECMP],
[
  AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
  AC_CHECK_FUNCS([strcasecmp])
  if test $ac_cv_func_strcasecmp = yes; then
    gl_STRCASECMP_WORKS
    case "$gl_cv_func_strcasecmp_works" in
      *yes) ;;
      *) REPLACE_STRCASECMP=1 ;;
    esac
  else
    HAVE_STRCASECMP=0
  fi
])

AC_DEFUN([gl_STRCASECMP_WORKS],
[
  AC_REQUIRE([AC_CANONICAL_HOST])
  AC_CACHE_CHECK([whether strcasecmp works],
    [gl_cv_func_strcasecmp_works],
    [dnl Prepare a guess, used when cross-compiling or when specific locales
     dnl are not available.
     case "$host_os" in
       solaris* | cygwin*)
         gl_cv_func_strcasecmp_works="guessing no" ;;
       *)
         gl_cv_func_strcasecmp_works="guessing yes" ;;
     esac
     AC_RUN_IFELSE(
       [AC_LANG_SOURCE([[
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
#include <strings.h>
int main ()
{
  if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
      || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
    {
      int c1 = (unsigned char) '\311';
      int c2 = (unsigned char) '\351';
      if (tolower (c1) == c2 && toupper (c2) == c1)
        return strcasecmp ("Fej\311r", "Fej\351r") != 0;
    }
  return 2;
}]])],
       [gl_cv_func_strcasecmp_works=yes],
       [if test $? = 1; then
          gl_cv_func_strcasecmp_works=no
        fi
       ],
       [])
    ])
])

# Prerequisites of lib/strcasecmp.c.
AC_DEFUN([gl_PREREQ_STRCASECMP], [
  :
])