2007-03-08 04:03:40 +08:00
|
|
|
# -*-Shell-script-*-
|
|
|
|
#
|
|
|
|
# Copyright (c) Luc Vincent
|
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Initialization
|
|
|
|
# ----------------------------------------
|
2018-04-20 00:11:43 +08:00
|
|
|
AC_PREREQ([2.63])
|
2018-03-13 02:53:00 +08:00
|
|
|
AC_INIT([tesseract],
|
2018-03-19 03:15:14 +08:00
|
|
|
[m4_esyscmd_s([test -d .git && git describe --abbrev=4 || cat VERSION])],
|
2018-03-13 02:53:00 +08:00
|
|
|
[https://github.com/tesseract-ocr/tesseract/issues],,
|
|
|
|
[https://github.com/tesseract-ocr/tesseract/])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_PROG_CXX([g++ clang++])
|
2015-11-05 05:39:24 +08:00
|
|
|
AC_LANG([C++])
|
|
|
|
AC_LANG_COMPILER_REQUIRE
|
2014-01-22 16:10:15 +08:00
|
|
|
CXXFLAGS=${CXXFLAGS:-""}
|
2011-08-19 06:06:01 +08:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CONFIG_AUX_DIR([config])
|
|
|
|
AC_CONFIG_SRCDIR([api/tesseractmain.cpp])
|
|
|
|
AC_PREFIX_DEFAULT([/usr/local])
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2018-03-27 15:46:08 +08:00
|
|
|
# Automake configuration. Do not require README file (we use README.md).
|
|
|
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
# Define date of package, etc. Could be useful in auto-generated
|
|
|
|
# documentation.
|
2018-03-13 02:53:00 +08:00
|
|
|
PACKAGE_YEAR=2018
|
|
|
|
PACKAGE_DATE="03/12"
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2015-05-02 18:15:13 +08:00
|
|
|
abs_top_srcdir=`AS_DIRNAME([$0])`
|
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_DEFINE_UNQUOTED([PACKAGE_NAME], ["${PACKAGE_NAME}"], [Name of package])
|
|
|
|
AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["${PACKAGE_VERSION}"], [Version number])
|
|
|
|
AC_DEFINE_UNQUOTED([PACKAGE_YEAR], ["$PACKAGE_YEAR"], [Official year for this release])
|
|
|
|
AC_DEFINE_UNQUOTED([PACKAGE_DATE], ["$PACKAGE_DATE"], [Official date of release])
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SUBST([PACKAGE_NAME])
|
|
|
|
AC_SUBST([PACKAGE_VERSION])
|
|
|
|
AC_SUBST([PACKAGE_YEAR])
|
|
|
|
AC_SUBST([PACKAGE_DATE])
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2010-05-26 22:20:20 +08:00
|
|
|
GENERIC_LIBRARY_NAME=tesseract
|
|
|
|
|
2018-03-27 15:46:08 +08:00
|
|
|
# Release versioning. Get versions from PACKAGE_VERSION.
|
|
|
|
AX_SPLIT_VERSION
|
2018-04-14 22:11:27 +08:00
|
|
|
GENERIC_MAJOR_VERSION=$(echo "$AX_MAJOR_VERSION" | $SED 's/^[[^0-9]]*//')
|
2018-03-27 15:46:08 +08:00
|
|
|
GENERIC_MINOR_VERSION=$AX_MINOR_VERSION
|
|
|
|
GENERIC_MICRO_VERSION=`echo "$AX_POINT_VERSION" | $SED 's/^\([[0-9]][[0-9]]*\).*/\1/'`
|
2010-05-26 22:20:20 +08:00
|
|
|
|
|
|
|
# API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
|
|
|
|
GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
|
|
|
|
GENERIC_LIBRARY_VERSION=$GENERIC_MAJOR_VERSION:$GENERIC_MINOR_VERSION
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SUBST([GENERIC_API_VERSION])
|
|
|
|
AC_SUBST([GENERIC_MAJOR_VERSION])
|
2018-03-27 15:46:08 +08:00
|
|
|
AC_SUBST([GENERIC_MINOR_VERSION])
|
|
|
|
AC_SUBST([GENERIC_MICRO_VERSION])
|
2010-05-26 22:20:20 +08:00
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SUBST([GENERIC_LIBRARY_VERSION])
|
2010-05-26 22:20:20 +08:00
|
|
|
PACKAGE=$GENERIC_LIBRARY_NAME
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SUBST([GENERIC_LIBRARY_NAME])
|
2010-05-26 22:20:20 +08:00
|
|
|
|
|
|
|
GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
|
|
|
|
GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SUBST([GENERIC_RELEASE])
|
|
|
|
AC_SUBST([GENERIC_VERSION])
|
2010-05-26 22:20:20 +08:00
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CONFIG_HEADERS([config_auto.h:config/config.h.in])
|
2014-01-11 07:52:04 +08:00
|
|
|
|
2012-03-23 04:01:33 +08:00
|
|
|
# default conditional
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([T_WIN], false)
|
|
|
|
AM_CONDITIONAL([MINGW], false)
|
|
|
|
AM_CONDITIONAL([OSX], false)
|
|
|
|
AM_CONDITIONAL([GRAPHICS_DISABLED], false)
|
2016-11-12 05:03:16 +08:00
|
|
|
AC_SUBST([AM_CPPFLAGS])
|
2012-03-23 04:01:33 +08:00
|
|
|
|
2013-12-14 16:35:14 +08:00
|
|
|
OPENCL_INC="/opt/AMDAPP/include"
|
2017-05-12 15:36:04 +08:00
|
|
|
OPENCL_LIBS="-lOpenCL"
|
2013-01-31 06:57:49 +08:00
|
|
|
#############################
|
2012-03-23 04:01:33 +08:00
|
|
|
#
|
|
|
|
# Platform specific setup
|
|
|
|
#
|
|
|
|
#############################
|
|
|
|
AC_CANONICAL_HOST
|
2013-10-21 04:59:18 +08:00
|
|
|
case "${host_os}" in
|
2016-03-24 00:24:21 +08:00
|
|
|
mingw*)
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_DEFINE_UNQUOTED([MINGW], 1, [This is a MinGW system])
|
|
|
|
AM_CONDITIONAL([T_WIN], true)
|
|
|
|
AM_CONDITIONAL([MINGW], true)
|
|
|
|
AM_CONDITIONAL([ADD_RT], false)
|
2012-03-23 04:01:33 +08:00
|
|
|
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
|
|
|
|
;;
|
2014-03-11 22:12:39 +08:00
|
|
|
cygwin*)
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([ADD_RT], false)
|
2014-09-29 05:19:52 +08:00
|
|
|
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
|
2015-05-02 18:15:13 +08:00
|
|
|
;;
|
2013-10-21 04:59:18 +08:00
|
|
|
solaris*)
|
2014-01-27 06:39:20 +08:00
|
|
|
LIBS="-lsocket -lnsl -lrt -lxnet"
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([ADD_RT], true)
|
2014-01-27 06:39:20 +08:00
|
|
|
;;
|
|
|
|
*darwin*)
|
2015-08-26 17:03:07 +08:00
|
|
|
OPENCL_LIBS=""
|
2014-01-27 06:39:20 +08:00
|
|
|
OPENCL_INC=""
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([ADD_RT], false)
|
2014-01-18 04:53:15 +08:00
|
|
|
;;
|
|
|
|
powerpc-*-darwin*)
|
|
|
|
OPENCL_LIBS=""
|
2013-12-14 16:35:14 +08:00
|
|
|
;;
|
2014-01-22 16:10:15 +08:00
|
|
|
*)
|
2012-07-23 05:36:20 +08:00
|
|
|
# default
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([ADD_RT], true)
|
2012-03-23 04:01:33 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-12-23 17:20:08 +08:00
|
|
|
## Checks for supported compiler options.
|
|
|
|
AM_CONDITIONAL([AVX_OPT], false)
|
2017-09-08 22:06:19 +08:00
|
|
|
AM_CONDITIONAL([AVX2_OPT], false)
|
2016-12-23 17:20:08 +08:00
|
|
|
AM_CONDITIONAL([SSE41_OPT], false)
|
2017-02-03 01:20:24 +08:00
|
|
|
|
2017-02-27 18:15:28 +08:00
|
|
|
AX_CHECK_COMPILE_FLAG([-mavx], [avx=true], [avx=false])
|
|
|
|
if $avx; then
|
|
|
|
AM_CONDITIONAL([AVX_OPT], true)
|
2016-12-23 17:20:08 +08:00
|
|
|
fi
|
2017-02-03 01:20:24 +08:00
|
|
|
|
2017-09-08 22:06:19 +08:00
|
|
|
AX_CHECK_COMPILE_FLAG([-mavx2], [avx2=true], [avx2=false])
|
|
|
|
if $avx2; then
|
|
|
|
AM_CONDITIONAL([AVX2_OPT], true)
|
|
|
|
fi
|
|
|
|
|
2017-02-03 01:20:24 +08:00
|
|
|
AX_CHECK_COMPILE_FLAG([-msse4.1], [sse41=true], [sse41=false])
|
|
|
|
if $sse41; then
|
2016-12-23 17:20:08 +08:00
|
|
|
AM_CONDITIONAL([SSE41_OPT], true)
|
|
|
|
fi
|
|
|
|
|
2007-03-31 08:37:26 +08:00
|
|
|
includedir="${includedir}/tesseract"
|
2007-03-31 07:53:34 +08:00
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_ARG_WITH([extra-includes],
|
2016-12-23 16:32:51 +08:00
|
|
|
[AS_HELP_STRING([--with-extra-includes=DIR],
|
2016-05-27 21:30:17 +08:00
|
|
|
[Define an additional directory for include files])],
|
|
|
|
[if test -d "$withval" ; then
|
|
|
|
CFLAGS="$CFLAGS -I$withval"
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Cannot stat directory $withval])
|
|
|
|
fi])
|
|
|
|
|
|
|
|
AC_ARG_WITH([extra-libraries],
|
2016-12-23 16:32:51 +08:00
|
|
|
[AS_HELP_STRING([--with-extra-libraries=DIR],
|
2016-05-27 21:30:17 +08:00
|
|
|
[Define an additional directory for library files])],
|
|
|
|
[if test -d "$withval" ; then
|
|
|
|
LDFLAGS="$LDFLAGS -L$withval"
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Cannot stat directory $withval])
|
|
|
|
fi])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([--enable-graphics argument])
|
2010-07-19 09:59:13 +08:00
|
|
|
AC_ARG_ENABLE([graphics],
|
2016-12-23 16:32:51 +08:00
|
|
|
[AS_HELP_STRING([--enable-graphics],[enable graphics (ScrollView) (default)])
|
|
|
|
AS_HELP_STRING([--disable-graphics],[disable graphics (ScrollView)])],
|
2010-05-28 20:21:22 +08:00
|
|
|
[enable_graphics=$enableval],
|
|
|
|
[enable_graphics="yes"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_RESULT([$enable_graphics])
|
2010-05-28 20:21:22 +08:00
|
|
|
if test "$enable_graphics" = "no"; then
|
2012-03-23 04:01:33 +08:00
|
|
|
AC_DEFINE([GRAPHICS_DISABLED], [], [Disable graphics])
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([GRAPHICS_DISABLED], true)
|
2012-03-02 06:43:51 +08:00
|
|
|
fi
|
|
|
|
|
2012-03-01 20:40:04 +08:00
|
|
|
# check whether to build embedded version
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_CHECKING([--enable-embedded argument])
|
2012-03-01 20:40:04 +08:00
|
|
|
AC_ARG_ENABLE([embedded],
|
|
|
|
[ --enable-embedded enable embedded build (default=no)],
|
|
|
|
[enable_embedded=$enableval],
|
|
|
|
[enable_embedded="no"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_RESULT([$enable_embedded])
|
2012-03-01 20:40:04 +08:00
|
|
|
AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"])
|
|
|
|
if test "$enable_embedded" = "yes"; then
|
2016-11-12 05:03:16 +08:00
|
|
|
AM_CPPFLAGS="-DEMBEDDED $AM_CPPFLAGS"
|
2012-03-01 20:40:04 +08:00
|
|
|
fi
|
|
|
|
|
2015-08-15 03:35:18 +08:00
|
|
|
# check whether to build OpenMP support
|
|
|
|
AC_OPENMP
|
|
|
|
|
2013-11-12 18:40:40 +08:00
|
|
|
# check whether to build opencl version
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_CHECKING([--enable-opencl argument])
|
2013-11-12 18:40:40 +08:00
|
|
|
AC_ARG_ENABLE([opencl],
|
2013-12-14 16:35:14 +08:00
|
|
|
[ --enable-opencl enable opencl build (default=no)],
|
2013-11-12 18:40:40 +08:00
|
|
|
[enable_opencl=$enableval],
|
|
|
|
[enable_opencl="no"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_RESULT([$enable_opencl])
|
2015-07-23 04:03:03 +08:00
|
|
|
# check for opencl header
|
|
|
|
have_opencl=false
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CHECK_HEADERS([CL/cl.h], [have_opencl=true], [
|
2015-07-23 04:03:03 +08:00
|
|
|
AC_CHECK_HEADERS(OpenCL/cl.h, have_opencl=true, have_opencl=false)
|
|
|
|
])
|
2015-08-26 02:57:49 +08:00
|
|
|
|
2015-07-23 04:03:03 +08:00
|
|
|
have_tiff=false
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CHECK_HEADERS([tiffio.h], [have_tiff=true], [have_tiff=false])
|
2015-08-26 02:57:49 +08:00
|
|
|
|
|
|
|
# https://lists.apple.com/archives/unix-porting/2009/Jan/msg00026.html
|
|
|
|
m4_define([MY_CHECK_FRAMEWORK],
|
|
|
|
[AC_CACHE_CHECK([if -framework $1 works],[my_cv_framework_$1],
|
|
|
|
[save_LIBS="$LIBS"
|
|
|
|
LIBS="$LIBS -framework $1"
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
|
|
|
|
[my_cv_framework_$1=yes],
|
|
|
|
[my_cv_framework_$1=no])
|
|
|
|
LIBS="$save_LIBS"
|
|
|
|
])
|
|
|
|
if test "$my_cv_framework_$1"="yes"; then
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_DEFINE(AS_TR_CPP([HAVE_FRAMEWORK_$1]), 1,
|
2015-08-26 02:57:49 +08:00
|
|
|
[Define if you have the $1 framework])
|
2016-05-27 21:30:17 +08:00
|
|
|
AS_TR_CPP([FRAMEWORK_$1])="-framework $1"
|
|
|
|
AC_SUBST(AS_TR_CPP([FRAMEWORK_$1]))
|
2015-08-26 02:57:49 +08:00
|
|
|
fi]
|
|
|
|
)
|
|
|
|
|
|
|
|
have_opencl_lib=false
|
2015-08-26 17:03:07 +08:00
|
|
|
OPENCL_CPPFLAGS=''
|
|
|
|
OPENCL_LDFLAGS=''
|
2015-08-26 15:10:56 +08:00
|
|
|
case "${host_os}" in
|
|
|
|
*darwin* | *-macos10*)
|
|
|
|
echo "checking for OpenCL framework"
|
|
|
|
MY_CHECK_FRAMEWORK([OpenCL])
|
|
|
|
if test $my_cv_framework_OpenCL = yes; then
|
|
|
|
have_opencl_lib=true
|
|
|
|
fi
|
2015-08-26 17:17:10 +08:00
|
|
|
if test "$enable_opencl" = "yes"; then
|
|
|
|
if !($have_opencl_lib); then
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_ERROR([Required OpenCL library not found!])
|
2015-08-26 17:17:10 +08:00
|
|
|
fi
|
2016-11-12 05:03:16 +08:00
|
|
|
AM_CPPFLAGS="-DUSE_OPENCL $AM_CPPFLAGS"
|
2015-08-26 17:17:10 +08:00
|
|
|
OPENCL_CPPFLAGS=""
|
2017-05-12 15:36:04 +08:00
|
|
|
OPENCL_LDFLAGS="-framework OpenCL"
|
2015-08-26 17:17:10 +08:00
|
|
|
fi
|
2015-08-26 15:10:56 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# default
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CHECK_LIB([OpenCL], [clGetPlatformIDs],
|
|
|
|
[have_opencl_lib=true], [have_opencl_lib=false])
|
2015-08-26 17:03:07 +08:00
|
|
|
if test "$enable_opencl" = "yes"; then
|
|
|
|
if !($have_opencl); then
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_ERROR([Required OpenCL headers not found!])
|
2015-08-26 17:03:07 +08:00
|
|
|
fi
|
|
|
|
if !($have_opencl_lib); then
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_ERROR([Required OpenCL library not found!])
|
2015-08-26 17:03:07 +08:00
|
|
|
fi
|
2016-11-12 05:03:16 +08:00
|
|
|
AM_CPPFLAGS="-DUSE_OPENCL $AM_CPPFLAGS"
|
2015-08-26 17:03:07 +08:00
|
|
|
OPENCL_CPPFLAGS="-I${OPENCL_INC}"
|
2015-09-01 23:43:38 +08:00
|
|
|
OPENCL_LDFLAGS="${OPENCL_LIBS}"
|
2015-08-26 17:03:07 +08:00
|
|
|
fi
|
2015-08-26 15:10:56 +08:00
|
|
|
;;
|
|
|
|
esac
|
2015-07-22 20:40:07 +08:00
|
|
|
AM_CONDITIONAL([USE_OPENCL], [test "$enable_opencl" = "yes"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SUBST([OPENCL_CPPFLAGS])
|
|
|
|
AC_SUBST([OPENCL_LDFLAGS])
|
2013-11-12 18:40:40 +08:00
|
|
|
|
2012-03-03 07:51:33 +08:00
|
|
|
# check whether to build tesseract with -fvisibility=hidden -fvisibility-inlines-hidden
|
|
|
|
# http://gcc.gnu.org/wiki/Visibility
|
|
|
|
# http://groups.google.com/group/tesseract-dev/browse_thread/thread/976645ae98189127
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_CHECKING([--enable-visibility argument])
|
2012-03-03 07:51:33 +08:00
|
|
|
AC_ARG_ENABLE([visibility],
|
2016-12-23 16:32:51 +08:00
|
|
|
[AS_HELP_STRING([--enable-visibility],[enable experimental build with fvisibility (default=no)])],
|
2012-03-03 07:51:33 +08:00
|
|
|
[enable_visibility=$enableval],
|
|
|
|
[enable_visibility="no"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_RESULT([$enable_visibility])
|
2012-03-03 07:51:33 +08:00
|
|
|
AM_CONDITIONAL([VISIBILITY], [test "$enable_visibility" = "yes"])
|
|
|
|
|
2012-03-23 04:01:33 +08:00
|
|
|
# Check if tessdata-prefix is disabled
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_CHECKING([whether to use tessdata-prefix])
|
|
|
|
AC_ARG_ENABLE([tessdata-prefix],
|
2016-12-23 16:32:51 +08:00
|
|
|
[AS_HELP_STRING([--disable-tessdata-prefix],
|
2015-07-24 17:51:44 +08:00
|
|
|
[don't set TESSDATA-PREFIX during compile])],
|
2012-07-23 05:36:20 +08:00
|
|
|
[tessdata_prefix="no"], [tessdata_prefix="yes"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_RESULT([$tessdata_prefix])
|
2012-03-23 04:01:33 +08:00
|
|
|
AM_CONDITIONAL([NO_TESSDATA_PREFIX], [test "$tessdata_prefix" = "no"])
|
2011-10-17 03:39:54 +08:00
|
|
|
|
2018-02-21 15:39:07 +08:00
|
|
|
# Check whether to enable debugging
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_CHECKING([whether to enable debugging])
|
2012-07-23 05:36:20 +08:00
|
|
|
AC_ARG_ENABLE([debug],
|
2016-12-23 16:32:51 +08:00
|
|
|
[AS_HELP_STRING([--enable-debug],
|
2012-07-23 05:36:20 +08:00
|
|
|
[turn on debugging (default=no)])],
|
|
|
|
[debug=$enableval],
|
|
|
|
[debug="no"])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_RESULT([$debug])
|
2012-07-23 05:36:20 +08:00
|
|
|
if test x"$debug" = x"yes"; then
|
2016-08-16 03:28:25 +08:00
|
|
|
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -O0 -DDEBUG"
|
2018-04-15 14:23:50 +08:00
|
|
|
AM_CPPFLAGS="$AM_CPPFLAGS -g -Wall -DDEBUG"
|
2012-07-23 05:36:20 +08:00
|
|
|
else
|
2013-11-10 23:12:01 +08:00
|
|
|
AM_CXXFLAGS="$AM_CXXFLAGS -O2 -DNDEBUG"
|
2018-04-15 14:23:50 +08:00
|
|
|
AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
|
2012-07-23 05:36:20 +08:00
|
|
|
fi
|
|
|
|
|
2011-10-17 03:39:54 +08:00
|
|
|
#localedir='${prefix}/share/locale'
|
2010-07-19 09:59:13 +08:00
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
# Always look into a "gnu" directory.
|
|
|
|
curwd=`pwd`
|
|
|
|
if test -d $curwd/gnu/include ; then
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$curwd/gnu/include"
|
|
|
|
fi
|
|
|
|
if test -d $curwd/gnu/lib ; then
|
|
|
|
LDFLAGS="$LDFLAGS -L$curwd/gnu/lib"
|
|
|
|
fi
|
|
|
|
|
2013-01-31 06:57:49 +08:00
|
|
|
# ----------------------------------------
|
2007-03-08 04:03:40 +08:00
|
|
|
# Additional checking of compiler characteristics
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
# Check Endianness. If Big Endian, this will define WORDS_BIGENDIAN
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------
|
2018-04-20 08:31:08 +08:00
|
|
|
# Init libtool
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
|
2010-05-26 22:20:20 +08:00
|
|
|
LT_INIT
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# C++ related options
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2014-04-16 17:04:28 +08:00
|
|
|
AC_MSG_CHECKING([if compiling with clang])
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([], [[
|
|
|
|
#ifndef __clang__
|
|
|
|
not clang
|
|
|
|
#endif
|
|
|
|
]])],
|
|
|
|
[CLANG=yes], [CLANG=no])
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$CLANG])
|
|
|
|
|
2013-11-04 01:22:27 +08:00
|
|
|
dnl ********************
|
|
|
|
dnl turn on c++11
|
|
|
|
dnl ********************
|
|
|
|
|
|
|
|
OLD_CXXFLAGS=$CXXFLAGS
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_CHECKING([whether compiler supports C++11])
|
2013-11-04 01:22:27 +08:00
|
|
|
CXXFLAGS="$CXXFLAGS -std=c++11"
|
2014-03-11 22:12:39 +08:00
|
|
|
snprintfworks=no
|
2013-11-04 01:22:27 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[
|
|
|
|
AC_LANG_SOURCE([[
|
|
|
|
#if (__cplusplus < 201103L)
|
|
|
|
#error C++ 11 is unsupported
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(no)
|
2017-01-09 01:00:58 +08:00
|
|
|
AC_MSG_ERROR([Your compiler does not have the necessary c++11 support! Cannot proceed.])
|
2013-11-04 01:22:27 +08:00
|
|
|
])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CHECK_FUNCS([snprintf],, [snprintfworks=yes])
|
2013-11-04 01:22:27 +08:00
|
|
|
CXXFLAGS="$OLD_CXXFLAGS"
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2017-01-09 01:00:58 +08:00
|
|
|
|
|
|
|
# set c++11 support based on platform/compiler
|
|
|
|
case "${host_os}" in
|
|
|
|
cygwin*)
|
|
|
|
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
|
|
|
;;
|
|
|
|
*-darwin* | *-macos10*)
|
|
|
|
if test "x$CLANG" = "xyes"; then
|
|
|
|
CXXFLAGS="$CXXFLAGS -std=c++11 "
|
|
|
|
LDFLAGS="$LDFLAGS -stdlib=libc++"
|
|
|
|
else
|
|
|
|
CXXFLAGS="$CXXFLAGS -std=c++11"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# default
|
|
|
|
CXXFLAGS="$CXXFLAGS -std=c++11"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# Check for libraries
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_SEARCH_LIBS([sem_init], [pthread rt])
|
2013-01-31 06:57:49 +08:00
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Checks for header files.
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_HEADER_TIME
|
|
|
|
AC_HEADER_SYS_WAIT
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CHECK_HEADERS([sys/ipc.h sys/shm.h])
|
|
|
|
AC_CHECK_HEADERS([limits.h malloc.h])
|
2007-03-08 04:03:40 +08:00
|
|
|
# Enable use of system-defined bool type if available:
|
|
|
|
AC_HEADER_STDBOOL
|
|
|
|
|
|
|
|
# Misc
|
|
|
|
AC_SYS_INTERPRETER
|
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
|
2014-04-16 17:04:28 +08:00
|
|
|
AC_CHECK_FUNCS([getline])
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2018-04-10 01:06:59 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# Check for programs needed to build documentation.
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
AC_CHECK_PROG([have_asciidoc], asciidoc, true, false)
|
|
|
|
if $have_asciidoc; then
|
|
|
|
AM_CONDITIONAL([ASCIIDOC], true)
|
|
|
|
else
|
|
|
|
AM_CONDITIONAL([ASCIIDOC], false)
|
|
|
|
fi
|
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CHECK_TYPES([wchar_t],,, [#include "wchar.h"])
|
|
|
|
AC_CHECK_TYPES([long long int])
|
|
|
|
AC_CHECK_TYPES([off_t],,, [#include "sys/types.h"])
|
|
|
|
AC_CHECK_TYPES([mbstate_t],,, [#include "wchar.h"])
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
# ----------------------------------------
|
2013-09-27 04:23:17 +08:00
|
|
|
# Test auxiliary packages
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
|
2016-12-24 16:05:32 +08:00
|
|
|
PKG_CHECK_MODULES([LEPTONICA], [lept >= 1.74], [have_lept=true], [have_lept=false])
|
2016-12-13 22:52:29 +08:00
|
|
|
if $have_lept; then
|
2016-12-14 21:51:49 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS $LEPTONICA_CFLAGS"
|
|
|
|
else
|
2016-12-24 16:05:32 +08:00
|
|
|
AC_MSG_ERROR([Leptonica 1.74 or higher is required. Try to install libleptonica-dev package.])
|
2009-07-11 11:05:57 +08:00
|
|
|
fi
|
|
|
|
|
2016-05-27 21:30:17 +08:00
|
|
|
AM_CONDITIONAL([ENABLE_TRAINING], true)
|
2016-05-16 14:59:11 +08:00
|
|
|
|
2013-09-27 04:23:17 +08:00
|
|
|
# Check location of icu headers
|
2018-04-17 17:05:50 +08:00
|
|
|
PKG_CHECK_MODULES([ICU_UC], [icu-uc >= 52.1], [have_icu_uc=true], [have_icu_uc=false])
|
|
|
|
PKG_CHECK_MODULES([ICU_I18N], [icu-i18n >= 52.1], [have_icu_i18n=true], [have_icu_i18n=false])
|
2016-12-13 20:26:40 +08:00
|
|
|
if !($have_icu_uc && $have_icu_i18n); then
|
|
|
|
AC_CHECK_HEADERS([unicode/uchar.h], [have_icu=true], [have_icu=false])
|
|
|
|
if !($have_icu); then
|
2018-04-17 17:05:50 +08:00
|
|
|
AC_MSG_WARN([icu 52.1 or higher is required, but was not found.])
|
|
|
|
AC_MSG_WARN([Training tools WILL NOT be built.])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_WARN([Try to install libicu-devel package.])
|
|
|
|
AM_CONDITIONAL([ENABLE_TRAINING], false)
|
2016-12-13 20:26:40 +08:00
|
|
|
else
|
|
|
|
ICU_UC_LIBS="-licui18n -licuuc"
|
|
|
|
fi
|
2013-09-27 04:23:17 +08:00
|
|
|
fi
|
|
|
|
|
2014-01-10 02:08:12 +08:00
|
|
|
# Check location of pango headers
|
2018-04-17 19:46:16 +08:00
|
|
|
PKG_CHECK_MODULES([pango], [pango >= 1.22.0], [have_pango=true], [have_pango=false])
|
2014-01-10 02:08:12 +08:00
|
|
|
if !($have_pango); then
|
2018-04-17 19:46:16 +08:00
|
|
|
AC_MSG_WARN([pango 1.22.0 or higher is required, but was not found.])
|
|
|
|
AC_MSG_WARN([Training tools WILL NOT be built.])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_WARN([Try to install libpango1.0-dev package.])
|
|
|
|
AM_CONDITIONAL([ENABLE_TRAINING], false)
|
2014-01-10 02:08:12 +08:00
|
|
|
else
|
2016-05-16 01:05:53 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS $pango_CFLAGS"
|
2014-01-10 02:08:12 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Check location of cairo headers
|
2016-05-27 21:30:17 +08:00
|
|
|
PKG_CHECK_MODULES([cairo], [cairo], [have_cairo=true], [have_cairo=false])
|
2014-01-10 02:08:12 +08:00
|
|
|
if !($have_cairo); then
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_MSG_WARN([Training tools WILL NOT be built because of missing cairo library.])
|
|
|
|
AC_MSG_WARN([Try to install libcairo-dev?? package.])
|
|
|
|
AM_CONDITIONAL([ENABLE_TRAINING], false)
|
2014-01-10 02:08:12 +08:00
|
|
|
else
|
2016-05-16 01:05:53 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS $cairo_CFLAGS"
|
2014-01-10 02:08:12 +08:00
|
|
|
fi
|
|
|
|
|
2014-01-27 06:39:20 +08:00
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# Final Tasks and Output
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
# Output files
|
2012-07-29 05:17:20 +08:00
|
|
|
AC_CONFIG_FILES([Makefile tesseract.pc])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CONFIG_FILES([api/Makefile])
|
2018-04-03 01:09:22 +08:00
|
|
|
AC_CONFIG_FILES([api/tess_version.h])
|
2016-11-08 07:38:07 +08:00
|
|
|
AC_CONFIG_FILES([arch/Makefile])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CONFIG_FILES([ccmain/Makefile])
|
|
|
|
AC_CONFIG_FILES([opencl/Makefile])
|
|
|
|
AC_CONFIG_FILES([ccstruct/Makefile])
|
|
|
|
AC_CONFIG_FILES([ccutil/Makefile])
|
|
|
|
AC_CONFIG_FILES([classify/Makefile])
|
|
|
|
AC_CONFIG_FILES([cutil/Makefile])
|
|
|
|
AC_CONFIG_FILES([dict/Makefile])
|
2016-11-08 07:38:07 +08:00
|
|
|
AC_CONFIG_FILES([lstm/Makefile])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CONFIG_FILES([textord/Makefile])
|
|
|
|
AC_CONFIG_FILES([viewer/Makefile])
|
|
|
|
AC_CONFIG_FILES([wordrec/Makefile])
|
|
|
|
AC_CONFIG_FILES([tessdata/Makefile])
|
|
|
|
AC_CONFIG_FILES([tessdata/configs/Makefile])
|
|
|
|
AC_CONFIG_FILES([tessdata/tessconfigs/Makefile])
|
|
|
|
AC_CONFIG_FILES([testing/Makefile])
|
2017-08-19 21:31:46 +08:00
|
|
|
AC_CONFIG_FILES([unittest/Makefile])
|
2016-05-27 21:30:17 +08:00
|
|
|
AC_CONFIG_FILES([java/Makefile])
|
|
|
|
AC_CONFIG_FILES([java/com/Makefile])
|
|
|
|
AC_CONFIG_FILES([java/com/google/Makefile])
|
|
|
|
AC_CONFIG_FILES([java/com/google/scrollview/Makefile])
|
|
|
|
AC_CONFIG_FILES([java/com/google/scrollview/events/Makefile])
|
|
|
|
AC_CONFIG_FILES([java/com/google/scrollview/ui/Makefile])
|
|
|
|
AC_CONFIG_FILES([doc/Makefile])
|
|
|
|
AM_COND_IF([ENABLE_TRAINING], [AC_CONFIG_FILES(training/Makefile)])
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
|
|
|
|
# Final message
|
|
|
|
echo ""
|
|
|
|
echo "Configuration is done."
|
2013-09-27 04:23:17 +08:00
|
|
|
echo "You can now build and install $PACKAGE_NAME by running:"
|
2007-03-08 04:03:40 +08:00
|
|
|
echo ""
|
2013-09-27 04:23:17 +08:00
|
|
|
echo "$ make"
|
|
|
|
echo "$ sudo make install"
|
2018-04-10 01:06:59 +08:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
AM_COND_IF([ASCIIDOC],
|
|
|
|
[
|
|
|
|
echo "This will also build the documentation."
|
|
|
|
], [
|
|
|
|
echo "Documentation will not be built because asciidoc is missing."
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
2014-08-14 03:18:03 +08:00
|
|
|
# echo "$ sudo make install LANGS=\"eng ara deu\""
|
|
|
|
# echo " Or:"
|
|
|
|
# echo "$ sudo make install-langs"
|
2017-08-20 03:33:05 +08:00
|
|
|
echo ""
|
2013-09-27 04:23:17 +08:00
|
|
|
|
2014-08-14 03:18:03 +08:00
|
|
|
AM_COND_IF([ENABLE_TRAINING],
|
2017-08-20 03:33:05 +08:00
|
|
|
[
|
|
|
|
echo "Training tools can be built and installed with:"
|
2016-05-27 21:30:17 +08:00
|
|
|
echo ""
|
|
|
|
echo "$ make training"
|
|
|
|
echo "$ sudo make training-install"
|
|
|
|
echo ""],
|
2017-08-20 03:33:05 +08:00
|
|
|
[
|
2016-05-27 21:30:17 +08:00
|
|
|
echo "You can not build training tools because of missing dependency."
|
|
|
|
echo "Check configure output for details."
|
|
|
|
echo ""]
|
2014-08-14 03:18:03 +08:00
|
|
|
)
|
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# CONFIG Template
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
# Fence added in configuration file
|
|
|
|
AH_TOP([
|
|
|
|
#ifndef CONFIG_AUTO_H
|
|
|
|
#define CONFIG_AUTO_H
|
|
|
|
/* config_auto.h: begin */
|
|
|
|
])
|
|
|
|
|
|
|
|
# Stuff added at bottom of file
|
|
|
|
AH_BOTTOM([
|
|
|
|
|
|
|
|
/* Miscellaneous defines */
|
|
|
|
#define AUTOCONF 1
|
|
|
|
|
2010-10-01 00:27:39 +08:00
|
|
|
/* Not used yet
|
2010-09-30 23:53:40 +08:00
|
|
|
#ifndef NO_GETTEXT
|
|
|
|
#define USING_GETTEXT
|
2010-07-20 18:31:49 +08:00
|
|
|
#endif
|
2010-10-01 00:27:39 +08:00
|
|
|
*/
|
2010-07-20 18:31:49 +08:00
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
/* config_auto.h: end */
|
|
|
|
#endif
|
|
|
|
])
|