summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/Makefile.in2
-rw-r--r--source3/configure.in32
2 files changed, 34 insertions, 0 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index f33b80e079..67e5b5ab20 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -30,6 +30,8 @@ DYNEXP=@DYNEXP@
PYTHON=@PYTHON@
PERL=@PERL@
+PIDL_ARGS=@PIDL_ARGS@
+
TERMLDFLAGS=@TERMLDFLAGS@
TERMLIBS=@TERMLIBS@
PRINT_LIBS=@PRINT_LIBS@
diff --git a/source3/configure.in b/source3/configure.in
index 0808729fa3..61a4e2e524 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -535,6 +535,38 @@ if test x"$samba_cv_volatile" = x"yes"; then
AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
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_SUBST(PIDL_ARGS)
+AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_CC_NEGATIVE_ENUM_VALUES, [
+ 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
+ AC_MSG_WARN([using --unit-enums for pidl])
+ PIDL_ARGS="$PIDL_ARGS --uint-enums"
+fi
+
dnl Figure out the flags to support named structure initializers
LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_ERROR([c99 structure initializer are not supported])])