1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_c99_struct_init.html
3 # ===========================================================================
11 # This macro defines MISSING_C99_STRUCT_INIT if the C compiler does not
12 # supports the C99 tagged structure initialization.
14 # Given: struct foo_s {int i1; int i2; int i3;};
16 # #if !define(MISSING_C99_STRUCT_INIT)
17 # # define FOO_INIT(a, b, c) { .i1 = a, .i2 = b, .i3 = c }
19 # # define FOO_INIT(a, b, c) { a, b, c }
21 # static struct foo_s foo[] = {
29 # Copyright (c) 2015 Network Time Foundation
31 # Author: Harlan Stenn <stenn@nwtime.org>
33 # Copying and distribution of this file, with or without modification, are
34 # permitted in any medium without royalty provided the copyright notice
35 # and this notice are preserved. This file is offered as-is, without any
40 AC_DEFUN([AX_C99_STRUCT_INIT], [
41 AC_MSG_CHECKING([whether the compiler supports C99 structure initialization])
42 AC_REQUIRE([AC_PROG_CC_C99])
49 struct foo_s {int i1; int i2;};
50 int main() { struct foo_s foo[] = { { .i1 = 1, .i2 = 1 }, { .i1 = 2, .i2 = 2 }, { .i1 = 0, .i2 = 0 } }; }
54 AC_DEFINE([MISSING_C99_STRUCT_INIT], [1],
55 [Define to 1 if the compiler does not support C99's structure initialization.]),