Skip to content

Commit

Permalink
autotools: test if compiler support -mavx and -msse4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Dec 23, 2016
1 parent 54611c1 commit 02a6970
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/Makefile.am
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions configure.ac
Expand Up @@ -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],
Expand Down

0 comments on commit 02a6970

Please sign in to comment.