From 02a6970cf361ae12e2e2b5374f87bd09b3802bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Fri, 23 Dec 2016 10:20:08 +0100 Subject: [PATCH] autotools: test if compiler support -mavx and -msse4.1 --- arch/Makefile.am | 5 +++++ configure.ac | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/Makefile.am b/arch/Makefile.am index bce98e7f..ba7f1a81 100644 --- a/arch/Makefile.am +++ b/arch/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index 70da75f3..4888da04 100644 --- a/configure.ac +++ b/configure.ac @@ -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],