2007-03-08 04:03:40 +08:00
|
|
|
# -*-Shell-script-*-
|
|
|
|
#
|
|
|
|
# Copyright (c) Luc Vincent
|
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Initialization
|
|
|
|
# ----------------------------------------
|
|
|
|
AC_PREREQ(2.50)
|
2015-07-22 04:46:52 +08:00
|
|
|
AC_INIT([tesseract], [3.05.00dev], [https://github.com/tesseract-ocr/tesseract/issues])
|
2015-11-05 05:39:24 +08:00
|
|
|
AC_PROG_CXX(g++ clang++)
|
|
|
|
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])
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_CONFIG_AUX_DIR(config)
|
2009-07-11 11:05:57 +08:00
|
|
|
AC_CONFIG_SRCDIR(api/tesseractmain.cpp)
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_PREFIX_DEFAULT(/usr/local)
|
|
|
|
|
|
|
|
# Define date of package, etc. Could be useful in auto-generated
|
|
|
|
# documentation.
|
2015-07-11 15:43:50 +08:00
|
|
|
PACKAGE_YEAR=2015
|
|
|
|
PACKAGE_DATE="07/11"
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2015-05-02 18:15:13 +08:00
|
|
|
abs_top_srcdir=`AS_DIRNAME([$0])`
|
|
|
|
gitrev="`git --git-dir=${abs_top_srcdir}/.git --work-tree=${abs_top_srcdir} describe --always --tags`"
|
|
|
|
if test -n "${gitrev}" ; then
|
|
|
|
AC_REVISION("${gitrev}")
|
|
|
|
AC_DEFINE_UNQUOTED(GIT_REV,"${gitrev}", [Define to be the git revision])
|
|
|
|
echo "Using git revision: ${gitrev}"
|
|
|
|
fi
|
|
|
|
|
2007-03-08 04:03:40 +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])
|
|
|
|
|
|
|
|
AC_SUBST(PACKAGE_NAME)
|
|
|
|
AC_SUBST(PACKAGE_VERSION)
|
|
|
|
AC_SUBST(PACKAGE_YEAR)
|
|
|
|
AC_SUBST(PACKAGE_DATE)
|
|
|
|
|
2010-05-26 22:20:20 +08:00
|
|
|
GENERIC_LIBRARY_NAME=tesseract
|
|
|
|
|
|
|
|
# Release versioning
|
|
|
|
GENERIC_MAJOR_VERSION=3
|
2014-08-17 03:02:41 +08:00
|
|
|
GENERIC_MINOR_VERSION=4
|
2013-09-23 23:26:50 +08:00
|
|
|
GENERIC_MICRO_VERSION=0
|
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
|
|
|
|
AC_SUBST(GENERIC_API_VERSION)
|
|
|
|
AC_SUBST(GENERIC_MAJOR_VERSION)
|
|
|
|
|
|
|
|
AC_SUBST(GENERIC_LIBRARY_VERSION)
|
|
|
|
PACKAGE=$GENERIC_LIBRARY_NAME
|
|
|
|
AC_SUBST(GENERIC_LIBRARY_NAME)
|
|
|
|
|
|
|
|
GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
|
|
|
|
GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
|
|
|
|
AC_SUBST(GENERIC_RELEASE)
|
|
|
|
AC_SUBST(GENERIC_VERSION)
|
|
|
|
|
2014-01-11 07:52:04 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# Automake configuration
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2015-08-20 19:58:36 +08:00
|
|
|
# Do not require README file (we use README.md)
|
|
|
|
AM_INIT_AUTOMAKE([foreign])
|
2014-01-11 07:52:04 +08:00
|
|
|
AC_CONFIG_HEADERS(config_auto.h:config/config.h.in)
|
|
|
|
AM_MAINTAINER_MODE
|
|
|
|
|
2012-03-23 04:01:33 +08:00
|
|
|
# default conditional
|
2014-09-29 05:19:52 +08:00
|
|
|
AM_CONDITIONAL(T_WIN, false)
|
2015-07-24 07:16:55 +08:00
|
|
|
AM_CONDITIONAL(MINGW, false)
|
2014-01-18 04:53:15 +08:00
|
|
|
AM_CONDITIONAL(OSX, false)
|
2012-03-23 04:01:33 +08:00
|
|
|
AM_CONDITIONAL(GRAPHICS_DISABLED, false)
|
|
|
|
|
2013-12-14 16:35:14 +08:00
|
|
|
OPENCL_INC="/opt/AMDAPP/include"
|
|
|
|
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*)
|
2012-03-23 04:01:33 +08:00
|
|
|
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
|
2014-09-29 05:19:52 +08:00
|
|
|
AM_CONDITIONAL(T_WIN, true)
|
2015-07-24 07:16:55 +08:00
|
|
|
AM_CONDITIONAL(MINGW, true)
|
2014-01-27 06:39:20 +08:00
|
|
|
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*)
|
2014-09-29 05:19:52 +08:00
|
|
|
AM_CONDITIONAL(ADD_RT, false)
|
|
|
|
AM_CONDITIONAL(T_WIN, true)
|
|
|
|
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"
|
|
|
|
AM_CONDITIONAL(ADD_RT, true)
|
|
|
|
;;
|
|
|
|
*darwin*)
|
2015-08-26 17:03:07 +08:00
|
|
|
OPENCL_LIBS=""
|
2014-01-27 06:39:20 +08:00
|
|
|
OPENCL_INC=""
|
|
|
|
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
|
2014-01-27 06:39:20 +08:00
|
|
|
AM_CONDITIONAL(ADD_RT, true)
|
2012-03-23 04:01:33 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2007-03-31 08:37:26 +08:00
|
|
|
includedir="${includedir}/tesseract"
|
2007-03-31 07:53:34 +08:00
|
|
|
|
2013-02-01 07:10:18 +08:00
|
|
|
AC_ARG_WITH(extra-includes,
|
|
|
|
AC_HELP_STRING([--with-extra-includes=DIR],
|
|
|
|
[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,
|
|
|
|
AC_HELP_STRING([--with-extra-libraries=DIR],
|
|
|
|
[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 ] )
|
|
|
|
|
2010-05-28 20:21:22 +08:00
|
|
|
AC_MSG_CHECKING(--enable-graphics argument)
|
2010-07-19 09:59:13 +08:00
|
|
|
AC_ARG_ENABLE([graphics],
|
2012-03-02 06:43:51 +08:00
|
|
|
[AC_HELP_STRING([--enable-graphics],[enable graphics (ScrollView) (default)])
|
|
|
|
AC_HELP_STRING([--disable-graphics],[disable graphics (ScrollView)])],
|
2010-05-28 20:21:22 +08:00
|
|
|
[enable_graphics=$enableval],
|
|
|
|
[enable_graphics="yes"])
|
|
|
|
AC_MSG_RESULT($enable_graphics)
|
|
|
|
if test "$enable_graphics" = "no"; then
|
2012-03-23 04:01:33 +08:00
|
|
|
AC_DEFINE([GRAPHICS_DISABLED], [], [Disable graphics])
|
|
|
|
AM_CONDITIONAL(GRAPHICS_DISABLED, true)
|
2012-03-02 06:43:51 +08:00
|
|
|
fi
|
|
|
|
|
2015-07-24 17:51:44 +08:00
|
|
|
# Check if cube should be disabled
|
|
|
|
AC_MSG_CHECKING(whether to disable cube)
|
|
|
|
AC_ARG_ENABLE([cube],
|
|
|
|
[AC_HELP_STRING([--disable-cube], [don't build cube support (experimental)])],
|
|
|
|
[disable_cube="yes"], [disable_cube="no"])
|
|
|
|
AC_MSG_RESULT($disable_cube)
|
|
|
|
AM_CONDITIONAL([NO_CUBE_BUILD], [test "$disable_cube" = "yes"])
|
|
|
|
if test "$disable_cube" = "yes"; then
|
|
|
|
AC_SUBST([AM_CPPFLAGS], [-DNO_CUBE_BUILD])
|
|
|
|
fi
|
|
|
|
|
2012-03-01 20:40:04 +08:00
|
|
|
# check whether to build embedded version
|
|
|
|
AC_MSG_CHECKING(--enable-embedded argument)
|
|
|
|
AC_ARG_ENABLE([embedded],
|
|
|
|
[ --enable-embedded enable embedded build (default=no)],
|
|
|
|
[enable_embedded=$enableval],
|
|
|
|
[enable_embedded="no"])
|
|
|
|
AC_MSG_RESULT($enable_embedded)
|
|
|
|
AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"])
|
|
|
|
if test "$enable_embedded" = "yes"; then
|
|
|
|
AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED])
|
|
|
|
fi
|
|
|
|
|
2015-08-15 03:35:18 +08:00
|
|
|
# check whether to build OpenMP support
|
2015-08-26 02:57:49 +08:00
|
|
|
AM_CONDITIONAL(OPENMP, false)
|
2015-08-15 03:35:18 +08:00
|
|
|
AC_OPENMP
|
|
|
|
AS_IF([test "x$OPENMP_CFLAGS" != "x"],
|
2015-08-26 02:57:49 +08:00
|
|
|
AM_CONDITIONAL([OPENMP], true)
|
2015-08-15 03:35:18 +08:00
|
|
|
AC_SUBST(AM_CPPFLAGS,"$OPENMP_CXXFLAGS")
|
|
|
|
AC_DEFINE([OPENMP], [], [Defined when compiled with OpenMP support])
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2013-11-12 18:40:40 +08:00
|
|
|
# check whether to build opencl version
|
|
|
|
AC_MSG_CHECKING(--enable-opencl argument)
|
|
|
|
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"])
|
|
|
|
AC_MSG_RESULT($enable_opencl)
|
2015-07-23 04:03:03 +08:00
|
|
|
# check for opencl header
|
|
|
|
have_opencl=false
|
|
|
|
AC_CHECK_HEADERS(CL/cl.h, have_opencl=true, [
|
|
|
|
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
|
|
|
|
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
|
|
|
|
AC_DEFINE(AS_TR_CPP([HAVE_FRAMEWORK_$1]),1,
|
|
|
|
[Define if you have the $1 framework])
|
|
|
|
AS_TR_CPP([FRAMEWORK_$1])="-framework $1"
|
|
|
|
AC_SUBST(AS_TR_CPP([FRAMEWORK_$1]))
|
|
|
|
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
|
|
|
|
AC_MSG_ERROR(Required OpenCL library not found!)
|
|
|
|
fi
|
|
|
|
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
|
|
|
|
OPENCL_CPPFLAGS=""
|
|
|
|
OPENCL_LDFLAGS="-framework OpenCL"
|
|
|
|
fi
|
2015-08-26 15:10:56 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# default
|
2015-08-26 02:57:49 +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
|
|
|
|
AC_MSG_ERROR(Required OpenCL headers not found!)
|
|
|
|
fi
|
|
|
|
if !($have_opencl_lib); then
|
|
|
|
AC_MSG_ERROR(Required OpenCL library not found!)
|
|
|
|
fi
|
|
|
|
if !($have_tiff); then
|
|
|
|
AC_MSG_ERROR(Required TIFF headers not found! Try to install libtiff-dev?? package.)
|
|
|
|
fi
|
|
|
|
AC_SUBST([AM_CPPFLAGS], [-DUSE_OPENCL])
|
|
|
|
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"])
|
2015-08-26 17:03:07 +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
|
|
|
|
AC_MSG_CHECKING(--enable-visibility argument)
|
|
|
|
AC_ARG_ENABLE([visibility],
|
|
|
|
[AC_HELP_STRING([--enable-visibility],[enable experimental build with fvisibility (default=no)])],
|
|
|
|
[enable_visibility=$enableval],
|
|
|
|
[enable_visibility="no"])
|
|
|
|
AC_MSG_RESULT($enable_visibility)
|
|
|
|
AM_CONDITIONAL([VISIBILITY], [test "$enable_visibility" = "yes"])
|
|
|
|
|
2011-10-17 03:39:54 +08:00
|
|
|
# check whether to build multiple libraries
|
|
|
|
AC_MSG_CHECKING(--enable-multiple-libraries argument)
|
|
|
|
AC_ARG_ENABLE([multiple-libraries],
|
2012-03-02 06:43:51 +08:00
|
|
|
[AC_HELP_STRING([--enable-multiple-libraries],[enable multiple libraries (default=no)])],
|
2011-10-17 03:39:54 +08:00
|
|
|
[enable_mlibs=$enableval],
|
|
|
|
[enable_mlibs="no"])
|
|
|
|
AC_MSG_RESULT($enable_mlibs)
|
|
|
|
AM_CONDITIONAL([USING_MULTIPLELIBS], [test "$enable_mlibs" = "yes"])
|
|
|
|
|
2012-03-23 04:01:33 +08:00
|
|
|
# Check if tessdata-prefix is disabled
|
|
|
|
AC_MSG_CHECKING(whether to use tessdata-prefix)
|
|
|
|
AC_ARG_ENABLE(tessdata-prefix,
|
2012-07-23 05:36:20 +08:00
|
|
|
[AC_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"])
|
2012-03-23 04:01:33 +08:00
|
|
|
AC_MSG_RESULT($tessdata_prefix)
|
|
|
|
AM_CONDITIONAL([NO_TESSDATA_PREFIX], [test "$tessdata_prefix" = "no"])
|
2011-10-17 03:39:54 +08:00
|
|
|
|
2012-07-23 05:36:20 +08:00
|
|
|
# Check whether enable debuging
|
|
|
|
AC_MSG_CHECKING(whether to enable debugging)
|
|
|
|
AC_ARG_ENABLE([debug],
|
|
|
|
[AC_HELP_STRING([--enable-debug],
|
|
|
|
[turn on debugging (default=no)])],
|
|
|
|
[debug=$enableval],
|
|
|
|
[debug="no"])
|
|
|
|
AC_MSG_RESULT($debug)
|
|
|
|
if test x"$debug" = x"yes"; then
|
2012-07-29 05:17:20 +08:00
|
|
|
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Wno-uninitialized -O0 -DDEBUG"
|
|
|
|
AM_CPPFLAGS="$AM_CPPFLAGS -g -Wall -Wno-uninitialized -O0 -DDEBUG"
|
2012-07-23 05:36:20 +08:00
|
|
|
else
|
2013-11-10 23:12:01 +08:00
|
|
|
AM_CXXFLAGS="$AM_CXXFLAGS -O2 -DNDEBUG"
|
|
|
|
AM_CPPFLAGS="$AM_CPPFLAGS -O2 -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
|
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Check Compiler Characteristics and
|
|
|
|
# configure automake. The two appear to
|
|
|
|
# be intimately linked...
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2010-05-26 22:20:20 +08:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
|
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
|
|
|
|
# See also at end of this file, where we define INTEL_BYTE_ORDER
|
|
|
|
# or MOTOROLA_BYTE_ORDER.
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Check for programs we need
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
# Check where all the following programs are and set
|
|
|
|
# variables accordingly:
|
2010-05-26 22:20:20 +08:00
|
|
|
LT_INIT
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# C++ related options
|
|
|
|
# ----------------------------------------
|
|
|
|
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
|
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
|
|
|
|
AC_MSG_CHECKING(whether compiler supports C++11)
|
|
|
|
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)
|
|
|
|
has_cpp11=yes
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
has_cpp11=no
|
|
|
|
])
|
2014-03-11 22:12:39 +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
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Check for libraries
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2012-09-22 04:00:01 +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
|
|
|
|
AC_CHECK_HEADERS(sys/ipc.h sys/shm.h)
|
|
|
|
AC_CHECK_HEADERS(limits.h malloc.h)
|
|
|
|
# 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
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
# ----------------------------------------
|
|
|
|
|
2015-10-05 18:20:34 +08:00
|
|
|
AC_CHECK_TYPES(wchar_t,,,[#include "wchar.h"])
|
2013-09-23 23:26:50 +08:00
|
|
|
AC_CHECK_TYPES(long long int)
|
2015-10-31 18:54:37 +08:00
|
|
|
AC_CHECK_TYPES(off_t,,,[#include "sys/types.h"])
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_CHECK_TYPES(mbstate_t,,,[#include "wchar.h"])
|
|
|
|
|
|
|
|
# ----------------------------------------
|
2013-09-27 04:23:17 +08:00
|
|
|
# Test auxiliary packages
|
2007-03-08 04:03:40 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
|
2009-07-11 11:05:57 +08:00
|
|
|
# Check location of leptonica/liblept headers.
|
2011-03-31 03:40:23 +08:00
|
|
|
AC_MSG_CHECKING(for leptonica)
|
|
|
|
AC_ARG_VAR(LIBLEPT_HEADERSDIR,[Leptonica headers directory])
|
|
|
|
|
2009-07-11 11:05:57 +08:00
|
|
|
have_lept=no
|
2011-03-31 03:40:23 +08:00
|
|
|
if test "$LIBLEPT_HEADERSDIR" = "" ; then
|
2015-08-26 02:57:49 +08:00
|
|
|
LIBLEPT_HEADERSDIR="/usr/local/include /usr/include /opt/local/include/leptonica"
|
2011-03-31 03:40:23 +08:00
|
|
|
fi
|
|
|
|
for incd in $LIBLEPT_HEADERSDIR
|
2009-07-11 11:05:57 +08:00
|
|
|
do
|
|
|
|
for lept in . leptonica liblept
|
|
|
|
do
|
|
|
|
if test -r "$incd/$lept/allheaders.h" ; then
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
|
|
|
|
have_lept=yes
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2016-03-15 21:22:24 +08:00
|
|
|
|
2009-07-11 11:05:57 +08:00
|
|
|
if test "$have_lept" = yes ; then
|
2011-03-31 03:40:23 +08:00
|
|
|
AC_MSG_RESULT(yes)
|
2016-03-15 21:22:24 +08:00
|
|
|
AC_CHECK_LIB(lept,l_generateCIDataForPdf,[], AC_MSG_ERROR([leptonica library with pdf support (>= 1.71) is missing]))
|
2011-03-31 03:40:23 +08:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([leptonica not found])
|
2009-07-11 11:05:57 +08:00
|
|
|
fi
|
|
|
|
|
2016-03-15 21:22:24 +08:00
|
|
|
AC_MSG_CHECKING([leptonica headers version >= 1.71])
|
2014-02-01 07:00:40 +08:00
|
|
|
AC_PREPROC_IFELSE(
|
2014-04-16 17:04:28 +08:00
|
|
|
[AC_LANG_PROGRAM([#include "allheaders.h"],
|
2014-08-19 05:04:08 +08:00
|
|
|
[#if (LIBLEPT_MAJOR_VERSION >= 1) && (LIBLEPT_MINOR_VERSION >= 71)
|
2014-02-01 07:00:40 +08:00
|
|
|
int i = 0;
|
|
|
|
#else
|
|
|
|
#error You need to upgrade your leptonica library!
|
|
|
|
#endif])],
|
|
|
|
[AC_MSG_RESULT(yes)],
|
2014-08-19 05:04:08 +08:00
|
|
|
[AC_MSG_FAILURE([leptonica 1.71 or higher is required])])
|
2014-02-01 07:00:40 +08:00
|
|
|
|
2013-09-27 04:23:17 +08:00
|
|
|
# Check location of icu headers
|
|
|
|
have_icu=false
|
|
|
|
AC_CHECK_HEADERS(unicode/uchar.h, have_icu=true, have_icu=false)
|
|
|
|
if !($have_icu); then
|
|
|
|
AC_MSG_WARN(Training tools WILL NOT be built because of missing icu library.)
|
|
|
|
AC_MSG_WARN(Try to install libicu-devel package.)
|
|
|
|
fi
|
|
|
|
AM_CONDITIONAL(ENABLE_TRAINING, $have_icu)
|
|
|
|
|
2014-01-10 02:08:12 +08:00
|
|
|
# Check location of pango headers
|
|
|
|
have_pango=false
|
|
|
|
AC_CHECK_HEADERS(pango-1.0/pango/pango-features.h, have_pango=true, have_pango=false)
|
|
|
|
if !($have_pango); then
|
|
|
|
AC_MSG_WARN(Training tools WILL NOT be built because of missing pango library.)
|
|
|
|
AC_MSG_WARN(Try to install libpango1.0-dev package.)
|
|
|
|
else
|
|
|
|
CPPFLAGS="$CPPFLAGS $(pkg-config --cflags pango)"
|
|
|
|
fi
|
|
|
|
AM_CONDITIONAL(ENABLE_TRAINING, $have_pango)
|
|
|
|
|
|
|
|
# Check location of cairo headers
|
|
|
|
have_cairo=false
|
|
|
|
AC_CHECK_HEADERS(cairo/cairo-version.h, have_cairo=true, have_cairo=false)
|
|
|
|
if !($have_cairo); then
|
|
|
|
AC_MSG_WARN(Training tools WILL NOT be built because of missing cairo library.)
|
|
|
|
AC_MSG_WARN(Try to install libcairo-dev?? package.)
|
|
|
|
else
|
|
|
|
CPPFLAGS="$CPPFLAGS $(pkg-config --cflags cairo)"
|
|
|
|
fi
|
|
|
|
AM_CONDITIONAL(ENABLE_TRAINING, $have_cairo)
|
|
|
|
|
2014-04-16 17:04:28 +08:00
|
|
|
# set c++11 support based on platform/compiler
|
2014-03-11 22:12:39 +08:00
|
|
|
if test "x$has_cpp11" = "xyes"; then
|
2014-09-29 05:19:52 +08:00
|
|
|
case "${host_os}" in
|
2014-04-16 17:04:28 +08:00
|
|
|
cygwin*)
|
2014-09-29 05:19:52 +08:00
|
|
|
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
2014-08-14 03:18:03 +08:00
|
|
|
;;
|
2014-04-16 17:04:28 +08:00
|
|
|
*-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
|
2014-08-14 03:18:03 +08:00
|
|
|
else
|
|
|
|
AC_MSG_WARN(Training tools WILL NOT be built because of missing c++11 support.)
|
2015-05-14 20:25:49 +08:00
|
|
|
AM_CONDITIONAL(ENABLE_TRAINING, [test "x$has_cpp11" = "xyes"])
|
2014-01-27 06:39:20 +08:00
|
|
|
fi
|
|
|
|
|
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])
|
2009-07-11 11:05:57 +08:00
|
|
|
AC_CONFIG_FILES(api/Makefile)
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_CONFIG_FILES(ccmain/Makefile)
|
2013-11-12 18:40:40 +08:00
|
|
|
AC_CONFIG_FILES(opencl/Makefile)
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_CONFIG_FILES(ccstruct/Makefile)
|
|
|
|
AC_CONFIG_FILES(ccutil/Makefile)
|
|
|
|
AC_CONFIG_FILES(classify/Makefile)
|
2010-11-24 02:34:14 +08:00
|
|
|
AC_CONFIG_FILES(cube/Makefile)
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_CONFIG_FILES(cutil/Makefile)
|
|
|
|
AC_CONFIG_FILES(dict/Makefile)
|
2010-11-24 02:34:14 +08:00
|
|
|
AC_CONFIG_FILES(neural_networks/runtime/Makefile)
|
2007-03-08 04:03:40 +08:00
|
|
|
AC_CONFIG_FILES(textord/Makefile)
|
|
|
|
AC_CONFIG_FILES(viewer/Makefile)
|
|
|
|
AC_CONFIG_FILES(wordrec/Makefile)
|
2007-03-31 07:53:34 +08:00
|
|
|
AC_CONFIG_FILES(tessdata/Makefile)
|
2007-07-18 09:04:56 +08:00
|
|
|
AC_CONFIG_FILES(tessdata/configs/Makefile)
|
|
|
|
AC_CONFIG_FILES(tessdata/tessconfigs/Makefile)
|
|
|
|
AC_CONFIG_FILES(testing/Makefile)
|
2008-02-01 08:59:01 +08:00
|
|
|
AC_CONFIG_FILES(java/Makefile)
|
2009-06-03 10:50:54 +08:00
|
|
|
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)
|
2012-03-02 07:19:35 +08:00
|
|
|
AC_CONFIG_FILES(doc/Makefile)
|
2014-08-14 03:18:03 +08:00
|
|
|
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"
|
2014-08-14 03:18:03 +08:00
|
|
|
# echo "$ sudo make install LANGS=\"eng ara deu\""
|
|
|
|
# echo " Or:"
|
|
|
|
# echo "$ sudo make install-langs"
|
2013-09-27 04:23:17 +08:00
|
|
|
|
2014-08-14 03:18:03 +08:00
|
|
|
AM_COND_IF([ENABLE_TRAINING],
|
2013-09-27 04:23:17 +08:00
|
|
|
echo ""
|
|
|
|
echo "Training tools can be build and installed (after building of $PACKAGE_NAME) with:"
|
|
|
|
echo ""
|
|
|
|
echo "$ make training"
|
2014-07-02 06:04:56 +08:00
|
|
|
echo "$ sudo make training-install"
|
2013-09-27 04:23:17 +08:00
|
|
|
echo ""
|
2014-08-14 03:18:03 +08:00
|
|
|
,
|
|
|
|
echo ""
|
|
|
|
echo "You can not build training tools because of missing dependency."
|
|
|
|
echo "Check configure output for details."
|
|
|
|
echo ""
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
])
|