cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomidnl Our implementation of AC_C_FLEXIBLE_ARRAY_MEMBER.
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomidnl Use it until autoconf 2.61+ becomes more widely used
cca227d2929386ee11e4aa23464681ef35eb9679Aki TuomiAC_DEFUN([DOVECOT_C_FLEXIBLE_ARRAY_MEMBER], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_CACHE_CHECK([if we can use C99-like flexible array members],i_cv_c99_flex_arrays,[
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_TRY_COMPILE([
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi struct foo {
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi int x;
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi char y[];
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi };
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi struct foo foo;
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi i_cv_c99_flex_arrays=yes
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ], [
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi i_cv_c99_flex_arrays=no
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi ])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi if test $i_cv_c99_flex_arrays = yes; then
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi flexible_value=
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi else
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi flexible_value=1
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi fi
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi AC_DEFINE_UNQUOTED(FLEXIBLE_ARRAY_MEMBER, $flexible_value, [How to define flexible array members in structs])
cca227d2929386ee11e4aa23464681ef35eb9679Aki Tuomi])