diff --git a/configure.ac b/configure.ac index 20a603682b..7963b0433f 100644 --- a/configure.ac +++ b/configure.ac @@ -170,9 +170,6 @@ AC_ARG_ENABLE([legacy], [enable_legacy=$enableval], [enable_legacy="yes"]) AC_MSG_RESULT([$enable_legacy]) -if test "$enable_legacy" = "no"; then - AC_DEFINE([DISABLED_LEGACY_ENGINE], [], [Disable the legacy OCR engine]) -fi AM_CONDITIONAL([DISABLED_LEGACY_ENGINE], test "$enable_legacy" = "no") # check whether to build embedded version diff --git a/src/api/Makefile.am b/src/api/Makefile.am index 059d1818e1..8218fae567 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -15,6 +15,10 @@ AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" \ AM_CPPFLAGS += $(OPENCL_CPPFLAGS) +if DISABLED_LEGACY_ENGINE +AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE +endif + if VISIBILITY AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden endif diff --git a/src/api/capi.cpp b/src/api/capi.cpp index b2c514fe48..4d60f395d8 100644 --- a/src/api/capi.cpp +++ b/src/api/capi.cpp @@ -299,10 +299,12 @@ TESS_API char** TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector(const TessBas return arr; } +#ifndef DISABLED_LEGACY_ENGINE TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle, const char* datapath, const char* language) { return handle->InitLangMod(datapath, language); } +#endif TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI* handle) { @@ -336,10 +338,12 @@ TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle, const unsigned cha return handle->TesseractRect(imagedata, bytes_per_pixel, bytes_per_line, left, top, width, height); } +#ifndef DISABLED_LEGACY_ENGINE TESS_API void TESS_CALL TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle) { handle->ClearAdaptiveClassifier(); } +#endif TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle, const unsigned char* imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line) @@ -543,6 +547,8 @@ TESS_API BOOL TESS_CALL TessBaseAPIDetectOS(TessBaseAPI* handle, OSResults* resu return FALSE; // Unsafe ABI, return FALSE always } +#ifndef DISABLED_LEGACY_ENGINE + TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle, int* orient_deg, float* orient_conf, const char** script_name, float* script_conf) { @@ -551,8 +557,6 @@ TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle, return (BOOL)success; } -#ifndef DISABLED_LEGACY_ENGINE - TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features, int* num_features, int* FeatureOutlineIndex) { diff --git a/src/ccmain/Makefile.am b/src/ccmain/Makefile.am index 6a0986a778..7bcb175b5b 100644 --- a/src/ccmain/Makefile.am +++ b/src/ccmain/Makefile.am @@ -14,6 +14,10 @@ AM_CPPFLAGS += \ AM_CPPFLAGS += $(OPENCL_CPPFLAGS) AM_CPPFLAGS += $(OPENMP_CXXFLAGS) +if DISABLED_LEGACY_ENGINE +AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE +endif + if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ -fvisibility=hidden -fvisibility-inlines-hidden diff --git a/src/classify/Makefile.am b/src/classify/Makefile.am index fd3322836e..0c1150a794 100644 --- a/src/classify/Makefile.am +++ b/src/classify/Makefile.am @@ -5,6 +5,10 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/src/dict \ -I$(top_srcdir)/src/viewer +if DISABLED_LEGACY_ENGINE +AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE +endif + if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ -fvisibility=hidden -fvisibility-inlines-hidden diff --git a/src/training/Makefile.am b/src/training/Makefile.am index b482c0ae6d..ecbc2541c6 100644 --- a/src/training/Makefile.am +++ b/src/training/Makefile.am @@ -16,6 +16,10 @@ AM_CPPFLAGS += \ EXTRA_DIST = language-specific.sh tesstrain.sh tesstrain_utils.sh +if DISABLED_LEGACY_ENGINE +AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE +endif + # TODO: training programs can not be linked to shared library created # with -fvisibility if VISIBILITY diff --git a/src/wordrec/Makefile.am b/src/wordrec/Makefile.am index cb67968992..ef1beaf0c7 100644 --- a/src/wordrec/Makefile.am +++ b/src/wordrec/Makefile.am @@ -6,6 +6,10 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/src/dict \ -I$(top_srcdir)/src/viewer +if DISABLED_LEGACY_ENGINE +AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE +endif + if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ -fvisibility=hidden -fvisibility-inlines-hidden