last-svn-commit-534-g40966cc Handle Tesseract 2.x and 3.x in configuration.

* configure.ac: Call OLN_WITH_TESSERACT macro. * m4/oln-with-lib.m4: Define a new macro OLN_WITH_TESSERACT. --- ChangeLog | 8 ++++++++ configure.ac | 3 +-- m4/oln-with-lib.m4 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0beb3a3..17f0c42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-10-25 Guillaume Lazzara <z@lrde.epita.fr> + Handle Tesseract 2.x and 3.x in configuration. + + * configure.ac: Call OLN_WITH_TESSERACT macro. + + * m4/oln-with-lib.m4: Define a new macro OLN_WITH_TESSERACT. + +2010-10-25 Guillaume Lazzara <z@lrde.epita.fr> + * configure.ac: Configure scribo/src/toolchain/nepomuk directory. 2010-10-25 Guillaume Lazzara <z@lrde.epita.fr> diff --git a/configure.ac b/configure.ac index 82216e6..88c8d15 100644 --- a/configure.ac +++ b/configure.ac @@ -228,8 +228,7 @@ AM_CONDITIONAL([HAVE_QT], [test "x$oln_have_expected_qt_version" = xyes]) # Tesseract. # # ----------- # -OLN_WITH_LIB([TESSERACT], [tesseract/baseapi.h], [tesseract_full], - [tesseract], [TESSERACT]) +OLN_WITH_TESSERACT # -------------- # # TIFF library. # diff --git a/m4/oln-with-lib.m4 b/m4/oln-with-lib.m4 index b18b773..59c6e16 100644 --- a/m4/oln-with-lib.m4 +++ b/m4/oln-with-lib.m4 @@ -61,6 +61,53 @@ m4_default([$5], m4_toupper([$3])),dnl ])# OLN_WITH_LIB +# OLN_WITH_TESSERACT() +# ------------------------------------------------------------- +# Check if Tesseract 2 or 3 is available. +# +# FIXME: if version 3 is installed in a standard directory, version 2 +# is installed in a non standard directory and its path is passed with +# the --with-tesseract option, this macro may use the version 3 +# anyway... This is because, the _OLN_WITH_LIB_SHARED_IMPL will try to +# link to tesseract_api and it will be available in the standard +# lib directory... + +AC_DEFUN([OLN_WITH_TESSERACT], +[dnl + AC_REQUIRE([AC_PROG_CXX]) + AC_LANG_PUSH([C++]) + AC_ARG_WITH([tesseract], + [AC_HELP_STRING([--with-tesseract@<:@=DIR@:>@], + [use $1 (DIR = prefix for TESSERACT installation)])]) + TESSERACT_CPPFLAGS='' + TESSERACT_LDFLAGS='' + + if test "x$with_tesseract" != xno; then + # Checking for Tesseract 3.x + _OLN_WITH_LIB_SHARED_IMPL([TESSERACT], [tesseract/baseapi.h], [tesseract_api], + [tesseract], [TESSERACT_3], []) + + if test x$oln_have_tesseract != xyes; then + # Tesseract 2.x not found, checking for Tesseract 2.x + _OLN_WITH_LIB_SHARED_IMPL([TESSERACT], [tesseract/baseapi.h], [tesseract_full], + [tesseract], [TESSERACT_2], []) + TESSERACT_CPPFLAGS="$TESSERACT_2_CPPFLAGS -DHAVE_TESSERACT_2" + TESSERACT_LDFLAGS=$TESSERACT_2_LDFLAGS + else + TESSERACT_CPPFLAGS="$TESSERACT_3_CPPFLAGS -DHAVE_TESSERACT_3" + TESSERACT_LDFLAGS=$TESSERACT_3_LDFLAGS + fi + fi + + + AC_SUBST([TESSERACT_CPPFLAGS]) + AC_SUBST([TESSERACT_LDFLAGS]) + AM_CONDITIONAL([HAVE_TESSERACT], [test x$oln_have_tesseract = xyes ]) + AC_LANG_POP([C++]) +])# _OLN_WITH_LIB + + + # _OLN_WITH_LIB(PACKAGE, HEADER, LIBRARY, SHELL_NAME, CPP_NAME, # OTHER-LIBRARIES) # ------------------------------------------------------------- -- 1.5.6.5
participants (1)
-
Guillaume Lazzara