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.

51 lines
1.5KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_func_posix_memalign.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_FUNC_POSIX_MEMALIGN
  8. #
  9. # DESCRIPTION
  10. #
  11. # Some versions of posix_memalign (notably glibc 2.2.5) incorrectly apply
  12. # their power-of-two check to the size argument, not the alignment
  13. # argument. AX_FUNC_POSIX_MEMALIGN defines HAVE_POSIX_MEMALIGN if the
  14. # power-of-two check is correctly applied to the alignment argument.
  15. #
  16. # LICENSE
  17. #
  18. # Copyright (c) 2008 Scott Pakin <pakin@uiuc.edu>
  19. #
  20. # Copying and distribution of this file, with or without modification, are
  21. # permitted in any medium without royalty provided the copyright notice
  22. # and this notice are preserved. This file is offered as-is, without any
  23. # warranty.
  24. #serial 8
  25. AC_DEFUN([AX_FUNC_POSIX_MEMALIGN],
  26. [AC_CACHE_CHECK([for working posix_memalign],
  27. [ax_cv_func_posix_memalign_works],
  28. [AC_TRY_RUN([
  29. #include <stdlib.h>
  30. int
  31. main ()
  32. {
  33. void *buffer;
  34. /* Some versions of glibc incorrectly perform the alignment check on
  35. * the size word. */
  36. exit (posix_memalign (&buffer, sizeof(void *), 123) != 0);
  37. }
  38. ],
  39. [ax_cv_func_posix_memalign_works=yes],
  40. [ax_cv_func_posix_memalign_works=no],
  41. [ax_cv_func_posix_memalign_works=no])])
  42. if test "$ax_cv_func_posix_memalign_works" = "yes" ; then
  43. AC_DEFINE([HAVE_POSIX_MEMALIGN], [1],
  44. [Define to 1 if `posix_memalign' works.])
  45. fi
  46. ])