MinGW-w64 build fix (lacks ffs declaration)
authorRay Donnelly <mingw.android@gmail.com>
Tue, 6 Aug 2013 12:03:22 +0000 (6 13:03 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 6 Aug 2013 12:34:15 +0000 (6 14:34 +0200)
Define ffs as __builtin_ffs if ffs is not declared but
__builtin_ffs is declared.

This problem only happens at -O0 as one of the optimization
passes substitutes ffs for __builtin_ffs.

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
configure.ac
isl_config_post.h
isl_hash.c

index 8bfeded..437146d 100644 (file)
@@ -104,6 +104,8 @@ if test $need_normalized_gcdext = true; then
 AC_DEFINE([GMP_NORMALIZE_GCDEXT], [],
        [result of mpz_gcdext needs to be normalized])
 fi
+AC_CHECK_DECLS(ffs,[],[],[#include <strings.h>])
+AC_CHECK_DECLS(__builtin_ffs,[],[],[])
 
 AX_SUBMODULE(piplib,no|system|build,no)
 
index 86a094d..a9cdda3 100644 (file)
@@ -1,3 +1,7 @@
 #ifndef HAVE___ATTRIBUTE__
 #define __attribute__(x)
 #endif
+
+#if (HAVE_DECL_FFS==0) && (HAVE_DECL___BUILTIN_FFS==1)
+#define ffs __builtin_ffs
+#endif
index 7b96c51..bd75a0d 100644 (file)
@@ -11,6 +11,7 @@
 #include <strings.h>
 #include <isl/hash.h>
 #include <isl/ctx.h>
+#include "isl_config.h"
 
 uint32_t isl_hash_string(uint32_t hash, const char *s)
 {