diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2021-03-22 09:51:06 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2021-03-22 14:57:08 +0000 |
commit | b56601e4efbe3e3c63e8815373b63efea8936dd2 (patch) | |
tree | 7945902da25530cceb78bca6cd676d4a30902e73 /configure.ac | |
parent | 3468f8758aa58c5e8bdf881f6bb5f05717cc31d7 (diff) | |
download | ghostpdl-b56601e4efbe3e3c63e8815373b63efea8936dd2.tar.gz |
Automate tesseract build compatibility with clang++
On MacOS (at least), clang++ requires the addition of the -std=c++17 to enable
support of the features that tesseract uses.
Also, on Linux (at least) clang++ requires -stdlib=libstdc++ in order to
pickup a usable stdc++ library.
So, tweak configure to test whether the compiler accepts the options to do both
the above, and if so, add them to the CXXFLAGS used to build tesseract.
In addition, in configure, pickup CXXFLAGS so custom options can be set on the
configure command line.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 0ebe94576..1532609f3 100644 --- a/configure.ac +++ b/configure.ac @@ -855,12 +855,30 @@ if test x$with_tesseract != xno; then elif test x$SYNC = xnosync ; then AC_MSG_ERROR([Threading disabled or not available. Tesseract OCR relies on threading. Rerun configure with "--without-tesseract" to exclude OCR from the build]) else + + save_cxxflags="$CXXFLAGS" + cxxflags_to_try="-std=c++17 -stdlib=libstdc++" + CXXFLAGS_TO_USE="" + + AC_MSG_CHECKING([supported C++ compiler flags]) + for flag in $cxxflags_to_try ; do + CXXFLAGS="$CXXFLAGS $flag" + + AC_TRY_COMPILE(, [return 0;], [ + echo " $flag"; CXXFLAGS_TO_USE="$CXXFLAGS_TO_USE $flag" + ]) + + CXXFLAGS="$old_cflags" + done + + CXXFLAGS="$save_cxxflags $CXXFLAGS_TO_USE" + dnl -------------------------------------------------- dnl check for sse4.1, avx, avx2 or fma dnl -------------------------------------------------- AC_MSG_CHECKING([sse4.1 support]) save_cxxflags=$CXXFLAGS - TESS_CXXFLAGS="" + TESS_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -msse4.1" TESS_SSE4_1="" |