| 1 |
# strings_h.m4 |
| 2 |
# serial 9 |
| 3 |
dnl Copyright (C) 2007, 2009-2024 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 |
# Configure a replacement for <strings.h>. |
| 10 |
|
| 11 |
AC_DEFUN_ONCE([gl_STRINGS_H], |
| 12 |
[ |
| 13 |
dnl Ensure to expand the default settings once only, before all statements |
| 14 |
dnl that occur in other macros. |
| 15 |
AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
| 16 |
|
| 17 |
gl_CHECK_NEXT_HEADERS([strings.h]) |
| 18 |
if test $ac_cv_header_strings_h = yes; then |
| 19 |
HAVE_STRINGS_H=1 |
| 20 |
else |
| 21 |
HAVE_STRINGS_H=0 |
| 22 |
fi |
| 23 |
AC_SUBST([HAVE_STRINGS_H]) |
| 24 |
|
| 25 |
dnl Check for declarations of anything we want to poison if the |
| 26 |
dnl corresponding gnulib module is not in use. |
| 27 |
gl_WARN_ON_USE_PREPARE([[ |
| 28 |
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before |
| 29 |
<strings.h>. */ |
| 30 |
#include <sys/types.h> |
| 31 |
#include <strings.h> |
| 32 |
]], [ffs strcasecmp strncasecmp]) |
| 33 |
]) |
| 34 |
|
| 35 |
# gl_STRINGS_MODULE_INDICATOR([modulename]) |
| 36 |
# sets the shell variable that indicates the presence of the given module |
| 37 |
# to a C preprocessor expression that will evaluate to 1. |
| 38 |
# This macro invocation must not occur in macros that are AC_REQUIREd. |
| 39 |
AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], |
| 40 |
[ |
| 41 |
dnl Ensure to expand the default settings once only. |
| 42 |
gl_STRINGS_H_REQUIRE_DEFAULTS |
| 43 |
gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
| 44 |
]) |
| 45 |
|
| 46 |
# Initializes the default values for AC_SUBSTed shell variables. |
| 47 |
# This macro must not be AC_REQUIREd. It must only be invoked, and only |
| 48 |
# outside of macros or in macros that are not AC_REQUIREd. |
| 49 |
AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS], |
| 50 |
[ |
| 51 |
m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ |
| 52 |
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) |
| 53 |
]) |
| 54 |
m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) |
| 55 |
AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) |
| 56 |
]) |
| 57 |
|
| 58 |
AC_DEFUN([gl_STRINGS_H_DEFAULTS], |
| 59 |
[ |
| 60 |
dnl Assume proper GNU behavior unless another module says otherwise. |
| 61 |
HAVE_FFS=1; AC_SUBST([HAVE_FFS]) |
| 62 |
HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) |
| 63 |
HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) |
| 64 |
]) |