From d4d4b8aad804a5408f8919dac7ac3c8f551e965a Mon Sep 17 00:00:00 2001 From: "zdenop@gmail.com" Date: Thu, 22 Mar 2012 20:01:33 +0000 Subject: [PATCH] improve autools system (mingw+msys fix); implementation of --disable-tessdata-prefix git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@708 d0cd1f9f-072b-0410-8dd7-cf729c803f20 --- Makefile.am | 8 ++++-- api/Makefile.am | 2 +- api/baseapi.cpp | 2 +- ccmain/Makefile.am | 2 +- ccstruct/Makefile.am | 10 ++++---- ccutil/Makefile.am | 11 +++++++- classify/Makefile.am | 14 +++++------ configure.ac | 39 +++++++++++++++++++++++++---- cube/Makefile.am | 20 +++++++-------- cutil/Makefile.am | 2 +- dict/Makefile.am | 12 ++++----- image/Makefile.am | 6 ++--- neural_networks/runtime/Makefile.am | 2 +- textord/Makefile.am | 18 ++++++------- training/Makefile.am | 4 +-- wordrec/Makefile.am | 16 ++++++------ 16 files changed, 105 insertions(+), 63 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0715931c..b756d8a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,14 @@ ## run autogen.sh to create Makefile.in from this file ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = ccutil viewer cutil image ccstruct dict classify wordrec neural_networks/runtime textord cube ccmain api . java tessdata testing doc training +SUBDIRS = ccutil viewer cutil image ccstruct dict classify wordrec neural_networks/runtime textord cube ccmain api . tessdata testing doc training + +if !GRAPHICS_DISABLED +SUBDIRS += java +endif #if USING_GETTEXT #SUBDIRS += po -#AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" +#AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" #endif EXTRA_DIST = eurotext.tif phototest.tif ReleaseNotes \ diff --git a/api/Makefile.am b/api/Makefile.am index 7dc11c6a..95def356 100644 --- a/api/Makefile.am +++ b/api/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"\ +AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"\ -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct \ -I$(top_srcdir)/image -I$(top_srcdir)/viewer \ -I$(top_srcdir)/textord -I$(top_srcdir)/dict \ diff --git a/api/baseapi.cpp b/api/baseapi.cpp index b570cd45..838ee81a 100644 --- a/api/baseapi.cpp +++ b/api/baseapi.cpp @@ -57,7 +57,7 @@ #include "osdetect.h" #include "params.h" -#ifdef _WIN32 +#if defined(_WIN32) && !defined(VERSION) #include "version.h" #endif diff --git a/ccmain/Makefile.am b/ccmain/Makefile.am index bd23c26a..f6c6f05e 100644 --- a/ccmain/Makefile.am +++ b/ccmain/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct \ -I$(top_srcdir)/image -I$(top_srcdir)/viewer \ diff --git a/ccstruct/Makefile.am b/ccstruct/Makefile.am index cde2b376..ee906fa4 100644 --- a/ccstruct/Makefile.am +++ b/ccstruct/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/cutil \ -I$(top_srcdir)/image -I$(top_srcdir)/viewer @@ -24,10 +24,10 @@ else lib_LTLIBRARIES = libtesseract_ccstruct.la libtesseract_ccstruct_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_ccstruct_la_LIBADD = \ - ../ccutil/libtesseract_ccutil.la \ - ../cutil/libtesseract_cutil.la \ - ../image/libtesseract_image.la \ - ../viewer/libtesseract_viewer.la + ../ccutil/libtesseract_ccutil.la \ + ../cutil/libtesseract_cutil.la \ + ../image/libtesseract_image.la \ + ../viewer/libtesseract_viewer.la endif libtesseract_ccstruct_la_SOURCES = \ diff --git a/ccutil/Makefile.am b/ccutil/Makefile.am index 403a41d4..78cc3845 100644 --- a/ccutil/Makefile.am +++ b/ccutil/Makefile.am @@ -1,5 +1,9 @@ SUBDIRS = -AM_CXXFLAGS = -DTESSDATA_PREFIX=@datadir@/ +AM_CXXFLAGS = + +if !NO_TESSDATA_PREFIX +AM_CXXFLAGS += -DTESSDATA_PREFIX=@datadir@/ +endif if VISIBILITY AM_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden @@ -42,3 +46,8 @@ if EMBEDDED include_HEADERS += scanutils.h libtesseract_ccutil_la_SOURCES += scanutils.cpp endif + +if MINGW +AM_CPPFLAGS += -I$(top_srcdir)/vs2008/port -DWINDLLNAME=\"lib@GENERIC_LIBRARY_NAME@\" +libtesseract_ccutil_la_SOURCES += ../vs2008/port/strtok_r.cpp +endif \ No newline at end of file diff --git a/classify/Makefile.am b/classify/Makefile.am index 729bc3c3..8b352a99 100644 --- a/classify/Makefile.am +++ b/classify/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/dict \ -I$(top_srcdir)/image -I$(top_srcdir)/viewer @@ -27,12 +27,12 @@ else lib_LTLIBRARIES = libtesseract_classify.la libtesseract_classify_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_classify_la_LIBADD = \ - ../ccutil/libtesseract_ccutil.la \ - ../cutil/libtesseract_cutil.la \ - ../ccstruct/libtesseract_ccstruct.la \ - ../dict/libtesseract_dict.la \ - ../image/libtesseract_image.la \ - ../viewer/libtesseract_viewer.la + ../ccutil/libtesseract_ccutil.la \ + ../cutil/libtesseract_cutil.la \ + ../ccstruct/libtesseract_ccstruct.la \ + ../dict/libtesseract_dict.la \ + ../image/libtesseract_image.la \ + ../viewer/libtesseract_viewer.la endif libtesseract_classify_la_SOURCES = \ diff --git a/configure.ac b/configure.ac index a8d3e647..d0163db4 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,6 @@ AC_REVISION($Id: configure.ac,v 1.4 2007/02/02 22:38:17 theraysmith Exp $) AC_CONFIG_AUX_DIR(config) AC_CONFIG_SRCDIR(api/tesseractmain.cpp) AC_PREFIX_DEFAULT(/usr/local) -AC_CANONICAL_HOST # Define date of package, etc. Could be useful in auto-generated # documentation. @@ -53,6 +52,30 @@ GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION AC_SUBST(GENERIC_RELEASE) AC_SUBST(GENERIC_VERSION) +# default conditional +AM_CONDITIONAL(MINGW, false) +AM_CONDITIONAL(GRAPHICS_DISABLED, false) + +# +# Platform specific setup +# +############################# +AC_CANONICAL_HOST +case $host_os in + mingw32*) + AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) + AM_CONDITIONAL(MINGW, true) + #AC_SUBST([AM_CPPFLAGS], ["-DWINDLLNAME=\"lib$GENERIC_LIBRARY_NAME\""]) + #AC_SUBST([AM_CPPFLAGS], ["-D__BLOB_T_DEFINED -DWINDLLNAME=\"lib$GENERIC_LIBRARY_NAME\""]) + AC_SUBST([AM_CPPFLAGS], ["-D__BLOB_T_DEFINED"]) + AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed']) + #AM_LDFLAGS='-Wl,-no-undefined -Wl,--as-needed' + ;; + *) + # default + ;; +esac + includedir="${includedir}/tesseract" AC_ARG_WITH(extra-includes, @@ -81,7 +104,8 @@ AC_HELP_STRING([--disable-graphics],[disable graphics (ScrollView)])], [enable_graphics="yes"]) AC_MSG_RESULT($enable_graphics) if test "$enable_graphics" = "no"; then - AC_DEFINE([GRAPHICS_DISABLED], [], [Disable graphics]) + AC_DEFINE([GRAPHICS_DISABLED], [], [Disable graphics]) + AM_CONDITIONAL(GRAPHICS_DISABLED, true) fi # check whether to build embedded version @@ -93,8 +117,6 @@ AC_ARG_ENABLE([embedded], AC_MSG_RESULT($enable_embedded) AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"]) if test "$enable_embedded" = "yes"; then - #AC_DEFINE([EMBEDDED], [], [Embedded Mode]) - AC_SUBST([AM_CXXFLAGS], [-DEMBEDDED]) AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) fi @@ -118,6 +140,14 @@ AC_ARG_ENABLE([multiple-libraries], AC_MSG_RESULT($enable_mlibs) AM_CONDITIONAL([USING_MULTIPLELIBS], [test "$enable_mlibs" = "yes"]) +# Check if tessdata-prefix is disabled +AC_MSG_CHECKING(whether to use tessdata-prefix) +AC_ARG_ENABLE(tessdata-prefix, + [AC_HELP_STRING([--disable-tessdata-prefix], + [dont set TESSDATA-PREFIX during compile])], + [tessdata_prefix="no"], [tessdata_prefix="yes"]) +AC_MSG_RESULT($tessdata_prefix) +AM_CONDITIONAL([NO_TESSDATA_PREFIX], [test "$tessdata_prefix" = "no"]) #localedir='${prefix}/share/locale' @@ -459,4 +489,3 @@ AH_BOTTOM([ /* config_auto.h: end */ #endif ]) - diff --git a/cube/Makefile.am b/cube/Makefile.am index cf48be8a..9c8774c3 100644 --- a/cube/Makefile.am +++ b/cube/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/dict \ @@ -31,15 +31,15 @@ else lib_LTLIBRARIES = libtesseract_cube.la libtesseract_cube_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_cube_la_LIBADD = \ - ../ccstruct/libtesseract_ccstruct.la \ - ../ccutil/libtesseract_ccutil.la \ - ../neural_networks/runtime/libtesseract_neural.la \ - ../image/libtesseract_image.la \ - ../viewer/libtesseract_viewer.la \ - ../wordrec/libtesseract_wordrec.la \ - ../cutil/libtesseract_cutil.la \ - ../classify/libtesseract_classify.la \ - ../dict/libtesseract_dict.la + ../ccstruct/libtesseract_ccstruct.la \ + ../ccutil/libtesseract_ccutil.la \ + ../neural_networks/runtime/libtesseract_neural.la \ + ../image/libtesseract_image.la \ + ../viewer/libtesseract_viewer.la \ + ../wordrec/libtesseract_wordrec.la \ + ../cutil/libtesseract_cutil.la \ + ../classify/libtesseract_classify.la \ + ../dict/libtesseract_dict.la endif libtesseract_cube_la_SOURCES = \ diff --git a/cutil/Makefile.am b/cutil/Makefile.am index 2c861d97..1028d948 100644 --- a/cutil/Makefile.am +++ b/cutil/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer +AM_CPPFLAGS += -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ diff --git a/dict/Makefile.am b/dict/Makefile.am index 288d41fd..44e41a51 100644 --- a/dict/Makefile.am +++ b/dict/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ +AM_CPPFLAGS += -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/viewer -I$(top_srcdir)/image if VISIBILITY @@ -16,11 +16,11 @@ else lib_LTLIBRARIES = libtesseract_dict.la libtesseract_dict_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_dict_la_LIBADD = \ - ../ccutil/libtesseract_ccutil.la \ - ../cutil/libtesseract_cutil.la \ - ../ccstruct/libtesseract_ccstruct.la \ - ../image/libtesseract_image.la \ - ../viewer/libtesseract_viewer.la + ../ccutil/libtesseract_ccutil.la \ + ../cutil/libtesseract_cutil.la \ + ../ccstruct/libtesseract_ccstruct.la \ + ../image/libtesseract_image.la \ + ../viewer/libtesseract_viewer.la endif libtesseract_dict_la_SOURCES = \ diff --git a/image/Makefile.am b/image/Makefile.am index 9722c549..cdc171f6 100644 --- a/image/Makefile.am +++ b/image/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer +AM_CPPFLAGS += -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ @@ -15,8 +15,8 @@ else lib_LTLIBRARIES = libtesseract_image.la libtesseract_image_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_image_la_LIBADD = \ - ../ccutil/libtesseract_ccutil.la \ - ../viewer/libtesseract_viewer.la + ../ccutil/libtesseract_ccutil.la \ + ../viewer/libtesseract_viewer.la endif libtesseract_image_la_SOURCES = \ diff --git a/neural_networks/runtime/Makefile.am b/neural_networks/runtime/Makefile.am index 856bcf2a..de43768f 100644 --- a/neural_networks/runtime/Makefile.am +++ b/neural_networks/runtime/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/dict \ diff --git a/textord/Makefile.am b/textord/Makefile.am index 17cf729f..52230cc5 100644 --- a/textord/Makefile.am +++ b/textord/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/image -I$(top_srcdir)/viewer \ -I$(top_srcdir)/ccmain -I$(top_srcdir)/wordrec -I$(top_srcdir)/api \ @@ -29,14 +29,14 @@ else lib_LTLIBRARIES = libtesseract_textord.la libtesseract_textord_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_textord_la_LIBADD = \ - ../ccstruct/libtesseract_ccstruct.la \ - ../ccutil/libtesseract_ccutil.la \ - ../image/libtesseract_image.la \ - ../viewer/libtesseract_viewer.la \ - ../wordrec/libtesseract_wordrec.la \ - ../cutil/libtesseract_cutil.la \ - ../classify/libtesseract_classify.la \ - ../dict/libtesseract_dict.la + ../ccstruct/libtesseract_ccstruct.la \ + ../ccutil/libtesseract_ccutil.la \ + ../image/libtesseract_image.la \ + ../viewer/libtesseract_viewer.la \ + ../wordrec/libtesseract_wordrec.la \ + ../cutil/libtesseract_cutil.la \ + ../classify/libtesseract_classify.la \ + ../dict/libtesseract_dict.la endif libtesseract_textord_la_SOURCES = \ diff --git a/training/Makefile.am b/training/Makefile.am index a523f3f7..f72e76e1 100644 --- a/training/Makefile.am +++ b/training/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/ccmain -I$(top_srcdir)/api \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct \ @@ -10,7 +10,7 @@ AM_CPPFLAGS = \ # TODO: training programs can not be linked to shared library created # with -fvisibility if VISIBILITY -AM_LDFLAGS = -all-static +AM_LDFLAGS += -all-static endif noinst_HEADERS = \ diff --git a/wordrec/Makefile.am b/wordrec/Makefile.am index bcddcb24..34b4b494 100644 --- a/wordrec/Makefile.am +++ b/wordrec/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS += \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/cutil -I$(top_srcdir)/classify \ -I$(top_srcdir)/image -I$(top_srcdir)/dict \ @@ -23,13 +23,13 @@ else lib_LTLIBRARIES = libtesseract_wordrec.la libtesseract_wordrec_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION) libtesseract_wordrec_la_LIBADD = \ - ../ccstruct/libtesseract_ccstruct.la \ - ../ccutil/libtesseract_ccutil.la \ - ../cutil/libtesseract_cutil.la \ - ../classify/libtesseract_classify.la \ - ../image/libtesseract_image.la \ - ../dict/libtesseract_dict.la \ - ../viewer/libtesseract_viewer.la + ../ccstruct/libtesseract_ccstruct.la \ + ../ccutil/libtesseract_ccutil.la \ + ../cutil/libtesseract_cutil.la \ + ../classify/libtesseract_classify.la \ + ../image/libtesseract_image.la \ + ../dict/libtesseract_dict.la \ + ../viewer/libtesseract_viewer.la endif libtesseract_wordrec_la_SOURCES = \ -- GitLab