summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-16 06:04:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:37 -0500
commitd6fed337112380695f8fabe8dc08b9b0dd05d7a6 (patch)
tree4e4021ad67c8fe9430582ca418caa32ae4942d72 /source4/build
parent4662f3a6d26f0509cbb36ea5f1658e61e961c31e (diff)
downloadsamba-d6fed337112380695f8fabe8dc08b9b0dd05d7a6.tar.gz
samba-d6fed337112380695f8fabe8dc08b9b0dd05d7a6.tar.bz2
samba-d6fed337112380695f8fabe8dc08b9b0dd05d7a6.zip
r17565: 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 (This used to be commit dc0e22a52e3488a4cb9f17138389885183e90c34)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/m4/check_cc.m421
1 files changed, 19 insertions, 2 deletions
diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4
index 4850ec5504..c15da03637 100644
--- a/source4/build/m4/check_cc.m4
+++ b/source4/build/m4/check_cc.m4
@@ -86,11 +86,28 @@ fi
############################################
# 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