sys_times_h.m4 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Configure a replacement for <sys/times.h>.
  2. # serial 11
  3. # Copyright (C) 2008-2023 Free Software Foundation, Inc.
  4. # This file is free software; the Free Software Foundation
  5. # gives unlimited permission to copy and/or distribute it,
  6. # with or without modifications, as long as this notice is preserved.
  7. # Written by Simon Josefsson.
  8. AC_DEFUN_ONCE([gl_SYS_TIMES_H],
  9. [
  10. AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
  11. dnl <sys/times.h> is always overridden, because of GNULIB_POSIXCHECK.
  12. gl_CHECK_NEXT_HEADERS([sys/times.h])
  13. if test $ac_cv_header_sys_times_h = yes; then
  14. HAVE_SYS_TIMES_H=1
  15. AC_CHECK_TYPES([struct tms], [], [HAVE_STRUCT_TMS=0], [[
  16. #include <sys/times.h>
  17. ]])
  18. else
  19. HAVE_SYS_TIMES_H=0
  20. HAVE_STRUCT_TMS=0
  21. fi
  22. AC_SUBST([HAVE_SYS_TIMES_H])
  23. dnl Check for declarations of anything we want to poison if the
  24. dnl corresponding gnulib module is not in use.
  25. gl_WARN_ON_USE_PREPARE([[
  26. /* Some systems have incomplete headers. */
  27. #if !(defined __GLIBC__ && !defined __UCLIBC__)
  28. # include <time.h>
  29. #endif
  30. #include <sys/times.h>
  31. ]], [times])
  32. ])
  33. # gl_SYS_TIMES_MODULE_INDICATOR([modulename])
  34. # sets the shell variable that indicates the presence of the given module
  35. # to a C preprocessor expression that will evaluate to 1.
  36. # This macro invocation must not occur in macros that are AC_REQUIREd.
  37. AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
  38. [
  39. dnl Ensure to expand the default settings once only.
  40. gl_SYS_TIMES_H_REQUIRE_DEFAULTS
  41. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  42. ])
  43. # Initializes the default values for AC_SUBSTed shell variables.
  44. # This macro must not be AC_REQUIREd. It must only be invoked, and only
  45. # outside of macros or in macros that are not AC_REQUIREd.
  46. AC_DEFUN([gl_SYS_TIMES_H_REQUIRE_DEFAULTS],
  47. [
  48. m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS], [
  49. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMES])
  50. ])
  51. m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS])
  52. AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
  53. ])
  54. AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS],
  55. [
  56. HAVE_STRUCT_TMS=1; AC_SUBST([HAVE_STRUCT_TMS])
  57. HAVE_TIMES=1; AC_SUBST([HAVE_TIMES])
  58. ])