summaryrefslogtreecommitdiffstats
path: root/patches/samba-3.0.37/0004-configure.in-fix-test-for-negative-enum-values.patch
blob: aa599aaff057ef8619a4c56248a36cf9c257d760 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From 6d2c30e32e551ba84bb9967d6fd48e21c7ad714c Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <mkl@pengutronix.de>
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 <mkl@pengutronix.de>
---
 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 <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;
-	}
+	(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