Skip to content

Commit

Permalink
build: m4/ax_emptyarray.m4: cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Alon Bar-Lev <[email protected]>
Acked-by: David Sommerseth <[email protected]>
Signed-off-by: David Sommerseth <[email protected]>
  • Loading branch information
alonbl authored and David Sommerseth committed Mar 22, 2012
1 parent c5c3cef commit bdd80be
Showing 1 changed file with 31 additions and 18 deletions.
49 changes: 31 additions & 18 deletions m4/ax_emptyarray.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,34 @@ dnl
dnl @version
dnl @author James Yonan <[email protected]>
AC_DEFUN([AX_EMPTY_ARRAY], [
AC_MSG_RESULT([checking for C compiler empty array support])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
struct { int foo; int bar[[0]]; } mystruct;
])], [
AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration])
], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
struct { int foo; int bar[[]]; } mystruct;
])], [
AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration])
], [
AC_MSG_ERROR([C compiler is unable to creaty empty arrays])
])
])
]
)
AS_VAR_PUSHDEF([VAR],[ax_cv_c_empty_array])dnl
AC_CACHE_CHECK(
[for C compiler empty array size],
[VAR],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
,
[[
struct { int foo; int bar[0]; } mystruct;
]]
)],
[VAR=0],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
,
[[
struct { int foo; int bar[]; } mystruct;
]]
)],
[VAR=],
[AC_MSG_ERROR([C compiler is unable to creaty empty arrays])]
)]
)]
)dnl
AC_DEFINE_UNQUOTED(
[EMPTY_ARRAY_SIZE],
[$VAR],
[Dimension to use for empty array declaration]
)dnl
AS_VAR_POPDEF([VAR])dnl
])

0 comments on commit bdd80be

Please sign in to comment.