r8868: add comfigure check for c99 struct initialization,
authorStefan Metzmacher <metze@samba.org>
Sun, 31 Jul 2005 22:31:53 +0000 (22:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:30:13 +0000 (13:30 -0500)
which is required for samba4

metze

source/build/m4/check_cc.m4

index 8e075b714b5a81ef1704192170b41a3a026871b4..6ab9c17eb3b966ea0cb9e37320324b99c08e0e83 100644 (file)
@@ -69,6 +69,27 @@ if test x"$samba_cv_immediate_structures" = x"yes"; then
    AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
 fi
 
+############################################
+# check if the compiler handles c99 struct initialization
+AC_CACHE_CHECK([for c99 struct initialization],samba_cv_c99_struct_initialization, [
+    AC_TRY_COMPILE([
+#include <stdio.h>],
+[
+   struct foo {
+       int x;
+       char y;
+   } ;
+   struct foo bar = {
+       .y = 'X',
+       .x = 1
+   };   
+],
+       samba_cv_c99_struct_initialization=yes,samba_cv_c99_struct_initialization=no)])
+if test x"$samba_cv_c99_struct_initialization" != x"yes"; then
+       AC_MSG_WARN([C compiler does not support c99 struct initialization!])
+       AC_MSG_ERROR([Please Install gcc from http://gcc.gnu.org/])
+fi
+
 ############################################
 # check if the compiler can handle negative enum values
 AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_CC_NEGATIVE_ENUM_VALUES, [