search_h.m4 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # search_h.m4 serial 9
  2. dnl Copyright (C) 2007-2017 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. ])
  41. AC_DEFUN([gl_SEARCH_MODULE_INDICATOR],
  42. [
  43. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  44. AC_REQUIRE([gl_SEARCH_H_DEFAULTS])
  45. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  46. dnl Define it also as a C macro, for the benefit of the unit tests.
  47. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  48. ])
  49. AC_DEFUN([gl_SEARCH_H_DEFAULTS],
  50. [
  51. GNULIB_TSEARCH=0; AC_SUBST([GNULIB_TSEARCH])
  52. dnl Assume proper GNU behavior unless another module says otherwise.
  53. HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH])
  54. REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH])
  55. ])