Skip to content

Commit

Permalink
Add check whether compiler supports -march=native flag
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Dec 5, 2018
1 parent ad40131 commit 2ccc581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ esac
AM_CONDITIONAL([AVX_OPT], false)
AM_CONDITIONAL([AVX2_OPT], false)
AM_CONDITIONAL([SSE41_OPT], false)
AM_CONDITIONAL([MARCH_NATIVE_OPT], false)

AX_CHECK_COMPILE_FLAG([-mavx], [avx=true], [avx=false])
if $avx; then
Expand All @@ -131,6 +132,11 @@ if $sse41; then
AM_CONDITIONAL([SSE41_OPT], true)
fi

AX_CHECK_COMPILE_FLAG([-march=native], [arch_native=true], [arch_native=false])
if $arch_native; then
AM_CONDITIONAL([MARCH_NATIVE_OPT], true)
fi

AC_ARG_WITH([extra-includes],
[AS_HELP_STRING([--with-extra-includes=DIR],
[Define an additional directory for include files])],
Expand Down
5 changes: 4 additions & 1 deletion src/arch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ if SSE41_OPT
libtesseract_sse_la_CXXFLAGS = -ffast-math -msse4.1
endif

libtesseract_native_la_CXXFLAGS = -O3 -ffast-math -march=native -mtune=native
libtesseract_native_la_CXXFLAGS = -O3 -ffast-math
if MARCH_NATIVE_OPT
libtesseract_native_la_CXXFLAGS += -march=native -mtune=native
endif
libtesseract_native_la_SOURCES = dotproduct.cpp

libtesseract_arch_la_SOURCES = intsimdmatrix.cpp simddetect.cpp
Expand Down

0 comments on commit 2ccc581

Please sign in to comment.