svn commit: samba r18859 - in branches/SAMBA_4_0/source/lib/replace: .

tridge at samba.org tridge at samba.org
Sun Sep 24 01:52:21 GMT 2006


Author: tridge
Date: 2006-09-24 01:52:20 +0000 (Sun, 24 Sep 2006)
New Revision: 18859

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18859

Log:

finally worked out what is going wrong with immediate structures. The
problem is that the AC_PROG_CC_C99 macro ends up selecting either
-std=std99 or -std=gnu99 for gcc. Ironically enough, that breaks
constant structure initialisers!

So, simplest solution is to not try that configure test if we know we
are using gcc

Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4	2006-09-23 21:41:41 UTC (rev 18858)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4	2006-09-24 01:52:20 UTC (rev 18859)
@@ -28,7 +28,13 @@
 savedCFLAGS=$CFLAGS
 AC_PROG_CC
 CFLAGS=$savedCFLAGS
+
+dnl don't try for C99 if we are using gcc, as otherwise we 
+dnl lose immediate structure constants
+if test x"$GCC" = x"no" ; then
 AC_PROG_CC_C99
+fi
+
 if test x"$GCC" = x"yes" ; then
 	AC_MSG_CHECKING([for version of gcc])
 	GCC_VERSION=`$CC -dumpversion`
@@ -122,5 +128,26 @@
 	AC_MSG_ERROR([LIBREPLACE needs sizeof(long long) >= 8])
 fi
 
+############################################
+# check if the compiler can do immediate structures
+AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
+    AC_TRY_COMPILE([
+#include <stdio.h>],
+[
+   typedef struct {unsigned x;} FOOBAR;
+   #define X_FOOBAR(x) ((FOOBAR) { x })
+   #define FOO_ONE X_FOOBAR(1)
+   FOOBAR f = FOO_ONE;   
+   static const struct {
+	FOOBAR y; 
+	} f2[] = {
+		{FOO_ONE}
+	};   
+],
+	samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
+if test x"$samba_cv_immediate_structures" = x"yes"; then
+   AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
+fi
+
 AC__LIBREPLACE_ONLY_CC_CHECKS_END
 ]) dnl end AC_LIBREPLACE_CC_CHECKS



More information about the samba-cvs mailing list