1 # Check for variable-length arrays.
7 # Copyright (C) 2001, 2009-2011 Free Software Foundation, Inc.
8 # This file is free software; the Free Software Foundation
9 # gives unlimited permission to copy and/or distribute it,
10 # with or without modifications, as long as this notice is preserved.
12 AC_DEFUN([AC_C_VARARRAYS],
14 AC_CACHE_CHECK([for variable-length arrays],
16 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
18 [[static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0];]])],
19 ac_cv_c_vararrays=yes,
20 ac_cv_c_vararrays=no)])
21 if test $ac_cv_c_vararrays = yes; then
22 AC_DEFINE([HAVE_C_VARARRAYS], [1],
23 [Define to 1 if C supports variable-length arrays.])