autotools: test if compiler support -mavx and -msse4.1

This commit is contained in:
Zdenko Podobný 2016-12-23 10:20:08 +01:00
parent 54611c1cc8
commit 02a6970cf3
2 changed files with 17 additions and 0 deletions

View File

@ -20,8 +20,13 @@ lib_LTLIBRARIES = libtesseract_avx.la libtesseract_sse.la
libtesseract_avx_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
libtesseract_sse_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
endif
if AVX_OPT
libtesseract_avx_la_CXXFLAGS = -mavx
endif
if SSE41_OPT
libtesseract_sse_la_CXXFLAGS = -msse4.1
endif
libtesseract_avx_la_SOURCES = dotproductavx.cpp

View File

@ -115,6 +115,18 @@ case "${host_os}" in
;;
esac
## Checks for supported compiler options.
AM_CONDITIONAL([AVX_OPT], false)
AM_CONDITIONAL([SSE41_OPT], false)
AX_CHECK_COMPILE_FLAG([-mavx], [avx=1], [avx=0])
AX_CHECK_COMPILE_FLAG([-msse4.1], [sse41=1], [sse41=0])
if test x$avx = x1; then
AM_CONDITIONAL([AVX_OPT], true)
fi
if test x$sse41 = x1; then
AM_CONDITIONAL([SSE41_OPT], true)
fi
includedir="${includedir}/tesseract"
AC_ARG_WITH([extra-includes],