0001-Check-if-platform-supports-feenableexcept.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 52484af83a58664c3cc91b8af07aeeea271f67ef Mon Sep 17 00:00:00 2001
  2. From: Gilles Talis <gilles.talis@gmail.com>
  3. Date: Sun, 9 Jan 2022 10:58:36 +0100
  4. Subject: [PATCH] Check if platform supports feenableexcept
  5. Signed-off-by: Gilles Talis <gilles.talis@gmail.com>
  6. ---
  7. configure.ac | 4 ++++
  8. src/tesseract.cpp | 2 +-
  9. 2 files changed, 5 insertions(+), 1 deletion(-)
  10. diff --git a/configure.ac b/configure.ac
  11. index 9177d64..80cd735 100644
  12. --- a/configure.ac
  13. +++ b/configure.ac
  14. @@ -188,6 +188,10 @@ case "${host_cpu}" in
  15. esac
  16. +# check whether feenableexcept is supported. some C libraries (e.g. uclibc) don't.
  17. +AC_CHECK_FUNC(feenableexcept, [feenableexcept=true], [feenableexcept=false])
  18. +AM_CONDITIONAL([HAVE_FEENABLEEXCEPT], $feenableexcept)
  19. +
  20. AX_CHECK_COMPILE_FLAG([-fopenmp-simd], [openmp_simd=true], [openmp_simd=false], [$WERROR])
  21. AM_CONDITIONAL([OPENMP_SIMD], $openmp_simd)
  22. diff --git a/src/tesseract.cpp b/src/tesseract.cpp
  23. index 933116e..9154db8 100644
  24. --- a/src/tesseract.cpp
  25. +++ b/src/tesseract.cpp
  26. @@ -629,7 +629,7 @@ static void PreloadRenderers(tesseract::TessBaseAPI &api,
  27. **********************************************************************/
  28. int main(int argc, char **argv) {
  29. -#if defined(__USE_GNU)
  30. +#if defined(__USE_GNU) && defined(HAVE_FEENABLEEXCEPT)
  31. // Raise SIGFPE.
  32. # if defined(__clang__)
  33. // clang creates code which causes some FP exceptions, so don't enable those.
  34. --
  35. 2.32.0