blob: 661da17b2333dbc84d2ee8ff9e93bcc310255623 [file] [log] [blame]
Alexandre Lision7c6f4a62013-09-05 13:27:01 -04001dnl @synopsis MN_C99_FLEXIBLE_ARRAY
2dnl
3dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
4dnl @version 1.1 Mar 15 2004
5dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6dnl
7dnl Permission to use, copy, modify, distribute, and sell this file for any
8dnl purpose is hereby granted without fee, provided that the above copyright
9dnl and this permission notice appear in all copies. No representations are
10dnl made about the suitability of this software for any purpose. It is
11dnl provided "as is" without express or implied warranty.
12
13AC_DEFUN([MN_C99_FLEXIBLE_ARRAY],
14[AC_CACHE_CHECK(C99 struct flexible array support,
15 ac_cv_c99_flexible_array,
16
17# Initialize to unknown
18ac_cv_c99_flexible_array=no
19
20AC_TRY_LINK([[
21 #include <stdlib.h>
22 typedef struct {
23 int k;
24 char buffer [] ;
25 } MY_STRUCT ;
26 ]],
27 [ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
28 ac_cv_c99_flexible_array=yes,
29 ac_cv_c99_flexible_array=no
30 ))]
31) # MN_C99_FLEXIBLE_ARRAY
32