r18895: AIX need to call pidl with --uint-enums as the compiler doesn't
authorStefan Metzmacher <metze@samba.org>
Mon, 25 Sep 2006 12:59:31 +0000 (12:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:14:43 +0000 (12:14 -0500)
like negative values in the generated code.

I'm not sure how we can solve that in samba3 as the generated code is commited

Maybe we need to alsways pass --uint-enums

metze

source/Makefile.in
source/configure.in

index f33b80e0795cff6aeb808c194ce04b4bf999114f..67e5b5ab200940e7a2951f4fb25e7343457febfb 100644 (file)
@@ -30,6 +30,8 @@ DYNEXP=@DYNEXP@
 PYTHON=@PYTHON@
 PERL=@PERL@
 
+PIDL_ARGS=@PIDL_ARGS@
+
 TERMLDFLAGS=@TERMLDFLAGS@
 TERMLIBS=@TERMLIBS@
 PRINT_LIBS=@PRINT_LIBS@
index 0808729fa3230bbfe65a21601c3c5e277c3d5ccc..61a4e2e5248a02602e426db46b0e80b7b7962745 100644 (file)
@@ -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])])