From: Brad Smith Date: Fri, 18 Oct 2013 03:22:02 +0000 (-0400) Subject: Fix pixman build with older GCC releases X-Git-Tag: pixman-0.31.2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ef7e0d18e00291da14c69d3034896235875d019;p=platform%2Fupstream%2Fpixman.git Fix pixman build with older GCC releases The following patch fixes building pixman with older GCC releases such as GCC 3.3 and older (OpenBSD; some older archs use GCC 3.3.6) by changing the method of detecting the presence of __builtin_clz to utilizing an autoconf check to determine its presence. Compilers that pretend to be GCC, implement __builtin_clz and are already utilizing the intrinsic include LLVM/Clang, Open64, EKOPath and PCC. --- diff --git a/configure.ac b/configure.ac index 8a3b622..5ccc267 100644 --- a/configure.ac +++ b/configure.ac @@ -1044,6 +1044,22 @@ fi AC_MSG_RESULT($support_for_float128) +dnl ===================================== +dnl __builtin_clz + +support_for_builtin_clz=no + +AC_MSG_CHECKING(for __builtin_clz) +AC_LINK_IFELSE([AC_LANG_SOURCE([[ +unsigned int x = 11; int main (void) { return __builtin_clz(x); } +]])], support_for_builtin_clz=yes) + +if test x$support_for_builtin_clz = xyes; then + AC_DEFINE([HAVE_BUILTIN_CLZ], [], [Whether the compiler supports __builtin_clz]) +fi + +AC_MSG_RESULT($support_for_builtin_clz) + dnl ================== dnl libpng diff --git a/pixman/pixman-matrix.c b/pixman/pixman-matrix.c index 89b9682..4032c13 100644 --- a/pixman/pixman-matrix.c +++ b/pixman/pixman-matrix.c @@ -37,7 +37,7 @@ static force_inline int count_leading_zeros (uint32_t x) { -#ifdef __GNUC__ +#ifdef HAVE_BUILTIN_CLZ return __builtin_clz (x); #else int n = 0;