Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4KB

  1. # =============================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_allocated_ctime.html
  3. # =============================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_ALLOCATED_CTIME
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check whether we need to free the memory returned by ctime.
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (c) 2008 Bruce Korb <bkorb@gnu.org>
  16. #
  17. # Copying and distribution of this file, with or without modification, are
  18. # permitted in any medium without royalty provided the copyright notice
  19. # and this notice are preserved. This file is offered as-is, without any
  20. # warranty.
  21. #serial 7
  22. AU_ALIAS([AG_CHECK_ALLOCATED_CTIME], [AX_CHECK_ALLOCATED_CTIME])
  23. AC_DEFUN([AX_CHECK_ALLOCATED_CTIME],[
  24. AC_MSG_CHECKING([whether ctime() allocates memory for its result])
  25. AC_CACHE_VAL([ax_cv_allocated_ctime],[
  26. AC_TRY_RUN([#include <time.h>
  27. int main (int argc, char** argv) {
  28. time_t timeVal = time( (time_t*)NULL );
  29. char* pzTime = ctime( &timeVal );
  30. free( pzTime );
  31. return 0; }],[ax_cv_allocated_ctime=yes],[ax_cv_allocated_ctime=no],[ax_cv_allocated_ctime=no]
  32. ) # end of TRY_RUN]) # end of CACHE_VAL
  33. AC_MSG_RESULT([$ax_cv_allocated_ctime])
  34. if test x$ax_cv_allocated_ctime = xyes
  35. then
  36. AC_DEFINE(HAVE_ALLOCATED_CTIME, 1,
  37. [Define this if ctime() allocates memory for its result])
  38. fi
  39. ]) # end of AC_DEFUN of AX_CHECK_ALLOCATED_CTIME