From 6d2c30e32e551ba84bb9967d6fd48e21c7ad714c Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Tue, 7 Jul 2009 18:21:00 +0200 Subject: [PATCH 4/8] [configure.in] fix test for negative enum values Signed-off-by: Marc Kleine-Budde --- source/configure.in | 28 ++++++++-------------------- 1 files changed, 8 insertions(+), 20 deletions(-) diff --git a/source/configure.in b/source/configure.in index 701622d..85b0bd7 100644 --- a/source/configure.in +++ b/source/configure.in @@ -493,6 +493,8 @@ else fi AC_SUBST(BROKEN_CC) +AC_TRY_COMPILE([],[(void)sizeof(char[-1])],AC_MSG_ERROR([configure's compilation assert doesn't work with $CC])) + dnl Check if the C compiler understands -Werror AC_CACHE_CHECK([that the C compiler understands -Werror],samba_cv_HAVE_Werror, [ AC_TRY_RUN_STRICT([ @@ -530,29 +532,15 @@ fi # and don't truncate the values to INT_MAX # a runtime test is needed here AC_SUBST(PIDL_ARGS) -AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_CC_NEGATIVE_ENUM_VALUES, [ - AC_TRY_RUN( +AC_CACHE_CHECK([that the C compiler understands negative enum values], [samba_cv_BUILD_CC_NEGATIVE_ENUM_VALUES], [ + AC_TRY_COMPILE([], [ - #include enum negative_values { NEGATIVE_VALUE = 0xFFFFFFFF }; - int main(void) { - enum negative_values v1 = NEGATIVE_VALUE; - unsigned v2 = NEGATIVE_VALUE; - - if (v1 != 0xFFFFFFFF) { - printf("%u != 0xFFFFFFFF\n", v1); - return 1; - } - if (v2 != 0xFFFFFFFF) { - printf("%u != 0xFFFFFFFF\n", v2); - return 1; - } - - return 0; - } + (void)sizeof(char[1-2*( (unsigned)NEGATIVE_VALUE != 0xFFFFFFFF)]); + (void)sizeof(char[1-2*((enum negative_values)NEGATIVE_VALUE != 0xFFFFFFFF)]); ], - SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes,SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=no)]) -if test x"$SMB_BUILD_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then + samba_cv_BUILD_CC_NEGATIVE_ENUM_VALUES=yes,samba_cv_BUILD_CC_NEGATIVE_ENUM_VALUES=no)]) +if test x"$samba_cv_BUILD_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then AC_MSG_WARN([using --unit-enums for pidl]) PIDL_ARGS="$PIDL_ARGS --uint-enums" fi -- 1.6.3.3