mhd_check_func_gettimeofday.m4 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # SYNOPSIS
  2. #
  3. # MHD_CHECK_FUNC_GETTIMEOFDAY([ACTION-IF-AVAILABLE],
  4. # [ACTION-IF-NOT-AVAILABLE])
  5. #
  6. # DESCRIPTION
  7. #
  8. # This macro checks for presence of gettimeofday() function.
  9. # If function is available macro HAVE_GETTIMEOFDAY is defined
  10. # automatically.
  11. #
  12. # Example usage:
  13. #
  14. # MHD_CHECK_FUNC_GETTIMEOFDAY([var_use_gettimeofday='yes'])
  15. #
  16. # The cache variable used in check so if any test will not work
  17. # correctly on some platform, user may simply fix it by giving cache
  18. # variable in configure parameters, for example:
  19. #
  20. # ./configure mhd_cv_func_memmem_have=no
  21. #
  22. # This simplifies building from source on exotic platforms as patching
  23. # of configure.ac is not required to change results of tests.
  24. #
  25. # LICENSE
  26. #
  27. # Copyright (c) 2019-2023 Karlson2k (Evgeny Grin) <k2k@narod.ru>
  28. #
  29. # Copying and distribution of this file, with or without modification, are
  30. # permitted in any medium without royalty provided the copyright notice
  31. # and this notice are preserved. This file is offered as-is, without any
  32. # warranty.
  33. #serial 1
  34. AC_DEFUN([MHD_CHECK_FUNC_GETTIMEOFDAY],[dnl
  35. AC_CHECK_HEADERS([sys/time.h time.h])dnl
  36. MHD_CHECK_FUNC([[gettimeofday]],
  37. [[
  38. #ifdef HAVE_SYS_TIME_H
  39. #include <sys/time.h>
  40. #endif /* HAVE_SYS_TIME_H */
  41. #ifdef HAVE_TIME_H
  42. #include <time.h>
  43. #endif /* HAVE_TIME_H */
  44. ]],
  45. [[
  46. struct timeval tv;
  47. if (0 != gettimeofday (&tv, (void*) 0))
  48. return 1;
  49. ]],[$1],[$2]
  50. )
  51. ])dnl AC_DEFUN MHD_CHECK_FUNC_GETTIMEOFDAY