search_h.m4 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # search_h.m4 serial 12
  2. dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
  3. dnl This file is free software; the Free Software Foundation
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. AC_DEFUN([gl_SEARCH_H],
  7. [
  8. AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
  9. gl_CHECK_NEXT_HEADERS([search.h])
  10. if test $ac_cv_header_search_h = yes; then
  11. HAVE_SEARCH_H=1
  12. else
  13. HAVE_SEARCH_H=0
  14. fi
  15. AC_SUBST([HAVE_SEARCH_H])
  16. if test $HAVE_SEARCH_H = 1; then
  17. AC_CACHE_CHECK([for type VISIT], [gl_cv_type_VISIT],
  18. [AC_COMPILE_IFELSE(
  19. [AC_LANG_PROGRAM(
  20. [[#if HAVE_SEARCH_H
  21. #include <search.h>
  22. #endif
  23. ]],
  24. [[static VISIT x; x = postorder;]])],
  25. [gl_cv_type_VISIT=yes],
  26. [gl_cv_type_VISIT=no])])
  27. else
  28. gl_cv_type_VISIT=no
  29. fi
  30. if test $gl_cv_type_VISIT = yes; then
  31. HAVE_TYPE_VISIT=1
  32. else
  33. HAVE_TYPE_VISIT=0
  34. fi
  35. AC_SUBST([HAVE_TYPE_VISIT])
  36. dnl Check for declarations of anything we want to poison if the
  37. dnl corresponding gnulib module is not in use.
  38. gl_WARN_ON_USE_PREPARE([[#include <search.h>
  39. ]], [tdelete tfind tsearch twalk])
  40. AC_REQUIRE([AC_C_RESTRICT])
  41. ])
  42. AC_DEFUN([gl_SEARCH_MODULE_INDICATOR],
  43. [
  44. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  45. AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
  46. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  47. dnl Define it also as a C macro, for the benefit of the unit tests.
  48. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  49. ])
  50. AC_DEFUN([gl_SEARCH_H_DEFAULTS],
  51. [
  52. GNULIB_TSEARCH=0; AC_SUBST([GNULIB_TSEARCH])
  53. dnl Support Microsoft deprecated alias function names by default.
  54. GNULIB_MDA_LFIND=1; AC_SUBST([GNULIB_MDA_LFIND])
  55. GNULIB_MDA_LSEARCH=1; AC_SUBST([GNULIB_MDA_LSEARCH])
  56. dnl Assume proper GNU behavior unless another module says otherwise.
  57. HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH])
  58. HAVE_TWALK=1; AC_SUBST([HAVE_TWALK])
  59. REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH])
  60. ])