string_h.m4 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Configure a GNU-like replacement for <string.h>.
  2. # Copyright (C) 2007-2017 Free Software Foundation, Inc.
  3. # This file is free software; the Free Software Foundation
  4. # gives unlimited permission to copy and/or distribute it,
  5. # with or without modifications, as long as this notice is preserved.
  6. # serial 21
  7. # Written by Paul Eggert.
  8. AC_DEFUN([gl_HEADER_STRING_H],
  9. [
  10. dnl Use AC_REQUIRE here, so that the default behavior below is expanded
  11. dnl once only, before all statements that occur in other macros.
  12. AC_REQUIRE([gl_HEADER_STRING_H_BODY])
  13. ])
  14. AC_DEFUN([gl_HEADER_STRING_H_BODY],
  15. [
  16. AC_REQUIRE([AC_C_RESTRICT])
  17. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
  18. gl_NEXT_HEADERS([string.h])
  19. dnl Check for declarations of anything we want to poison if the
  20. dnl corresponding gnulib module is not in use, and which is not
  21. dnl guaranteed by C89.
  22. gl_WARN_ON_USE_PREPARE([[#include <string.h>
  23. ]],
  24. [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
  25. strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
  26. strerror_r strsignal strverscmp])
  27. ])
  28. AC_DEFUN([gl_STRING_MODULE_INDICATOR],
  29. [
  30. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  31. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
  32. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  33. dnl Define it also as a C macro, for the benefit of the unit tests.
  34. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  35. ])
  36. AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
  37. [
  38. GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL])
  39. GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL])
  40. GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
  41. GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
  42. GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
  43. GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
  44. GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
  45. GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
  46. GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
  47. GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
  48. GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
  49. GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
  50. GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
  51. GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
  52. GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
  53. GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
  54. GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
  55. GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
  56. GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
  57. GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
  58. GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
  59. GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
  60. GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
  61. GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
  62. GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
  63. GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
  64. GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
  65. GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
  66. GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
  67. GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
  68. GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
  69. GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
  70. GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
  71. GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
  72. GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
  73. GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
  74. GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
  75. HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
  76. dnl Assume proper GNU behavior unless another module says otherwise.
  77. HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
  78. HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
  79. HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
  80. HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
  81. HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
  82. HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
  83. HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
  84. HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
  85. HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
  86. HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
  87. HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
  88. HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
  89. HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
  90. HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
  91. HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
  92. HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
  93. HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
  94. HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
  95. HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
  96. HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
  97. REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
  98. REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
  99. REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY])
  100. REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
  101. REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
  102. REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
  103. REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
  104. REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
  105. REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
  106. REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
  107. REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
  108. REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
  109. REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
  110. REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
  111. UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
  112. ])