Test for SUPPORTS_VLA in CMake

This commit is contained in:
Pedro Lopez-Cabanillas 2010-07-15 21:02:00 +00:00
parent 38dab1e383
commit 3ec7ec22c7
4 changed files with 14 additions and 1 deletions

View file

@ -98,6 +98,7 @@ check_include_file ( limits.h HAVE_LIMITS_H )
check_include_file ( pthread.h HAVE_PTHREAD_H )
check_include_file ( signal.h HAVE_SIGNAL_H )
include ( TestInline )
include ( TestVLA )
include ( TestBigEndian )
test_big_endian ( WORDS_BIGENDIAN )

View file

@ -0,0 +1,9 @@
include ( CheckCSourceCompiles )
if ( NOT SUPPORTS_VLA )
check_c_source_compiles (
"int main(int argc, char *argv[]){int arr[argc]; return 0;}"
_have_vla )
if ( _have_vla )
set ( SUPPORTS_VLA 1 )
endif ( _have_vla )
endif ( NOT SUPPORTS_VLA )

View file

@ -193,6 +193,9 @@
/* Define to use the readline library for line editing */
#cmakedefine WITH_READLINE @WITH_READLINE@
/* Define if the compiler supports VLA */
#cmakedefine SUPPORTS_VLA @SUPPORTS_VLA@
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@

View file

@ -163,7 +163,7 @@ typedef int fluid_socket_t;
#define INVALID_SOCKET -1
#endif
#if SUPPORTS_VLA
#if defined(SUPPORTS_VLA)
# define FLUID_DECLARE_VLA(_type, _name, _len) \
_type _name[_len]
#else