Alexandre Lision | 7c6f4a6 | 2013-09-05 13:27:01 -0400 | [diff] [blame] | 1 | dnl @synopsis MN_C99_FLEXIBLE_ARRAY |
| 2 | dnl |
| 3 | dnl Dose the compiler support the 1999 ISO C Standard "stuct hack". |
| 4 | dnl @version 1.1 Mar 15 2004 |
| 5 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> |
| 6 | dnl |
| 7 | dnl Permission to use, copy, modify, distribute, and sell this file for any |
| 8 | dnl purpose is hereby granted without fee, provided that the above copyright |
| 9 | dnl and this permission notice appear in all copies. No representations are |
| 10 | dnl made about the suitability of this software for any purpose. It is |
| 11 | dnl provided "as is" without express or implied warranty. |
| 12 | |
| 13 | AC_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 |
| 18 | ac_cv_c99_flexible_array=no |
| 19 | |
| 20 | AC_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 | |