Author: metze Date: 2006-08-16 06:04:36 +0000 (Wed, 16 Aug 2006) New Revision: 17565
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17565 Log: expand the test for negative enum values, systems like Tru64 truncate the value to INT_MAX... So a AC_TRY_RUN test is needed here metze Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4 Changeset: Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4 =================================================================== --- branches/SAMBA_4_0/source/build/m4/check_cc.m4 2006-08-16 05:59:24 UTC (rev 17564) +++ branches/SAMBA_4_0/source/build/m4/check_cc.m4 2006-08-16 06:04:36 UTC (rev 17565) @@ -86,11 +86,28 @@ ############################################ # check if the compiler can handle negative enum values +# and don't truncate the values to INT_MAX +# a runtime test is needed here AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_CC_NEGATIVE_ENUM_VALUES, [ - AC_TRY_COMPILE([ -#include <stdio.h>], + AC_TRY_RUN( [ + #include <stdio.h> 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; + } ], 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