From 13085ba07d93192fb34bc661d65901bd360d02b8 Mon Sep 17 00:00:00 2001
From: zesstra <zesstra@zesstra.de>
Date: Wed, 13 May 2009 23:31:47 +0200
Subject: [PATCH 3/3] Added check for the support of -fwrapv.

To enable a defined wrap-around behaviour for signed integers (currently
needed), we add -fwrapv to CFLAGS if supported by the compiler.

Signed-off-by: zesstra <zesstra@zesstra.de>
---
 src/autoconf/configure.in |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/autoconf/configure.in b/src/autoconf/configure.in
index e244240..a07100d 100644
--- a/src/autoconf/configure.in
+++ b/src/autoconf/configure.in
@@ -556,6 +556,20 @@ if test "${ac_cv_prog_cc_stdc}" = no; then
   AC_MSG_ERROR(You need an ANSI-C89 or ISO-C (C99) compiler! sorry..)
 fi
 
+# --- check for -fwrapv support ---
+savecflags="$CFLAGS"
+CFLAGS="${CFLAGS} -fwrapv"
+AC_MSG_CHECKING([check whether compiler supports -fwrapv...])
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+      [[]],
+      [[]])],
+    [AC_MSG_RESULT([ yes])]
+    EXTRA_CFLAGS="$EXTRA_CFLAGS -fwrapv",
+    [AC_MSG_RESULT([ no])]
+    CFLAGS="$saveflags"
+    )
+
 # does the compile have an inline keyword?
 AC_C_INLINE
 if test "x$ac_cv_c_inline" != "xno"; then
-- 
1.6.1

