Skip to content

Commit 02a6970

Browse files
committed
autotools: test if compiler support -mavx and -msse4.1
1 parent 54611c1 commit 02a6970

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

arch/Makefile.am

+5
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ lib_LTLIBRARIES = libtesseract_avx.la libtesseract_sse.la
2020
libtesseract_avx_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
2121
libtesseract_sse_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
2222
endif
23+
24+
if AVX_OPT
2325
libtesseract_avx_la_CXXFLAGS = -mavx
26+
endif
27+
if SSE41_OPT
2428
libtesseract_sse_la_CXXFLAGS = -msse4.1
29+
endif
2530

2631
libtesseract_avx_la_SOURCES = dotproductavx.cpp
2732

configure.ac

+12
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@ case "${host_os}" in
115115
;;
116116
esac
117117

118+
## Checks for supported compiler options.
119+
AM_CONDITIONAL([AVX_OPT], false)
120+
AM_CONDITIONAL([SSE41_OPT], false)
121+
AX_CHECK_COMPILE_FLAG([-mavx], [avx=1], [avx=0])
122+
AX_CHECK_COMPILE_FLAG([-msse4.1], [sse41=1], [sse41=0])
123+
if test x$avx = x1; then
124+
AM_CONDITIONAL([AVX_OPT], true)
125+
fi
126+
if test x$sse41 = x1; then
127+
AM_CONDITIONAL([SSE41_OPT], true)
128+
fi
129+
118130
includedir="${includedir}/tesseract"
119131

120132
AC_ARG_WITH([extra-includes],

0 commit comments

Comments
 (0)