strings: Add support for Minix.
[gnulib.git] / m4 / strings_h.m4
1 # Configure a replacement for <strings.h>.
2 # serial 5
3
4 # Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 AC_DEFUN([gl_HEADER_STRINGS_H],
10 [
11   dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12   dnl once only, before all statements that occur in other macros.
13   AC_REQUIRE([gl_HEADER_STRINGS_H_BODY])
14 ])
15
16 AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
17 [
18   AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
19   gl_CHECK_NEXT_HEADERS([strings.h])
20
21   dnl Check for declarations of anything we want to poison if the
22   dnl corresponding gnulib module is not in use.
23   gl_WARN_ON_USE_PREPARE([[
24     /* Minix 3.1.8 has a bug: <sys/types.h> must be included before
25        <strings.h>.  */
26     #include <sys/types.h>
27     #include <strings.h>
28     ]], [ffs strcasecmp strncasecmp])
29 ])
30
31 AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
32 [
33   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
34   AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
35   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
36 ])
37
38 AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS],
39 [
40   GNULIB_FFS=0;            AC_SUBST([GNULIB_FFS])
41   dnl Assume proper GNU behavior unless another module says otherwise.
42   HAVE_FFS=1;              AC_SUBST([HAVE_FFS])
43   HAVE_STRCASECMP=1;       AC_SUBST([HAVE_STRCASECMP])
44   HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
45 ])