netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / m4 / ax_func_posix_memalign.m4
1 # ===========================================================================
2 #  http://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
25 #serial 7
26
27 AC_DEFUN([AX_FUNC_POSIX_MEMALIGN],
28 [AC_CACHE_CHECK([for working posix_memalign],
29   [ax_cv_func_posix_memalign_works],
30   [AC_TRY_RUN([
31 #include <stdlib.h>
32
33 int
34 main ()
35 {
36   void *buffer;
37
38   /* Some versions of glibc incorrectly perform the alignment check on
39    * the size word. */
40   exit (posix_memalign (&buffer, sizeof(void *), 123) != 0);
41 }
42     ],
43     [ax_cv_func_posix_memalign_works=yes],
44     [ax_cv_func_posix_memalign_works=no],
45     [ax_cv_func_posix_memalign_works=no])])
46 if test "$ax_cv_func_posix_memalign_works" = "yes" ; then
47   AC_DEFINE([HAVE_POSIX_MEMALIGN], [1],
48     [Define to 1 if `posix_memalign' works.])
49 fi
50 ])