string_h.m4 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # Configure a GNU-like replacement for <string.h>.
  2. # Copyright (C) 2007-2011 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 20
  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. [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
  25. strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r
  26. 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_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
  39. GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
  40. GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
  41. GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
  42. GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
  43. GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
  44. GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
  45. GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
  46. GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
  47. GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
  48. GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
  49. GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
  50. GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
  51. GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
  52. GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
  53. GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
  54. GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
  55. GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
  56. GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
  57. GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
  58. GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
  59. GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
  60. GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
  61. GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
  62. GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
  63. GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
  64. GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
  65. GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
  66. GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
  67. GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
  68. GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
  69. GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
  70. GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
  71. GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
  72. GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
  73. HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
  74. dnl Assume proper GNU behavior unless another module says otherwise.
  75. HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
  76. HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
  77. HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
  78. HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
  79. HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
  80. HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
  81. HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
  82. HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
  83. HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
  84. HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
  85. HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
  86. HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
  87. HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
  88. HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
  89. HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
  90. HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
  91. HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
  92. HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
  93. REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
  94. REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
  95. REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY])
  96. REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
  97. REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
  98. REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
  99. REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
  100. REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
  101. REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
  102. REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
  103. REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
  104. REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
  105. REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
  106. REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
  107. UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
  108. ])