sys_times_h.m4 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Configure a replacement for <sys/times.h>.
  2. # serial 8
  3. # Copyright (C) 2008-2021 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([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. AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
  34. [
  35. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  36. AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
  37. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  38. ])
  39. AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS],
  40. [
  41. GNULIB_TIMES=0; AC_SUBST([GNULIB_TIMES])
  42. HAVE_STRUCT_TMS=1; AC_SUBST([HAVE_STRUCT_TMS])
  43. HAVE_TIMES=1; AC_SUBST([HAVE_TIMES])
  44. ])