python-numpy-0001-no-fenv-on-uclibc.patch 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Don't use <fenv.h> on uClibc
  2. The python-numpy code already has provisions to not use <fenv.h> when
  3. not available. However, it uses __GLIBC__ to know whether fenv.h is
  4. available or not, but uClibc defines __GLIBC__, so python-numpy thinks
  5. fenv.h is available.
  6. This patch fixes that by changing all defined(__GLIBC__) occurences by
  7. (defined(__GLIBC__) && !defined(__UCLIBC__)).
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. Index: b/numpy/core/include/numpy/ufuncobject.h
  10. ===================================================================
  11. --- a/numpy/core/include/numpy/ufuncobject.h
  12. +++ b/numpy/core/include/numpy/ufuncobject.h
  13. @@ -413,11 +413,11 @@
  14. (void) fpsetsticky(0); \
  15. }
  16. -#elif defined(__GLIBC__) || defined(__APPLE__) || \
  17. +#elif (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
  18. defined(__CYGWIN__) || defined(__MINGW32__) || \
  19. (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  20. -#if defined(__GLIBC__) || defined(__APPLE__) || \
  21. +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
  22. defined(__MINGW32__) || defined(__FreeBSD__)
  23. #include <fenv.h>
  24. #elif defined(__CYGWIN__)
  25. Index: b/numpy/core/src/npymath/ieee754.c.src
  26. ===================================================================
  27. --- a/numpy/core/src/npymath/ieee754.c.src
  28. +++ b/numpy/core/src/npymath/ieee754.c.src
  29. @@ -586,11 +586,11 @@
  30. }
  31. -#elif defined(__GLIBC__) || defined(__APPLE__) || \
  32. +#elif (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
  33. defined(__CYGWIN__) || defined(__MINGW32__) || \
  34. (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  35. -# if defined(__GLIBC__) || defined(__APPLE__) || \
  36. +# if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
  37. defined(__MINGW32__) || defined(__FreeBSD__)
  38. # include <fenv.h>
  39. # elif defined(__CYGWIN__)
  40. Index: b/numpy/numarray/_capi.c
  41. ===================================================================
  42. --- a/numpy/numarray/_capi.c
  43. +++ b/numpy/numarray/_capi.c
  44. @@ -10,7 +10,7 @@
  45. #include <sys/param.h>
  46. #endif
  47. -#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  48. +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  49. #include <fenv.h>
  50. #elif defined(__CYGWIN__)
  51. #include "numpy/fenv/fenv.h"
  52. @@ -258,7 +258,7 @@
  53. }
  54. /* Likewise for Integer overflows */
  55. -#if defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  56. +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  57. static int int_overflow_error(Float64 value) { /* For x86_64 */
  58. feraiseexcept(FE_OVERFLOW);
  59. return (int) value;
  60. @@ -3007,7 +3007,7 @@
  61. return retstatus;
  62. }
  63. -#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  64. +#elif (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
  65. static int
  66. NA_checkFPErrors(void)