Skip to content

Commit 081793f

Browse files
committed
Fix build with legacy engine disabled
Instead of defining the DISABLED_LEGACY_ENGINE macro in config_auto.h (which is not included by all source files), define it as a preprocessor option for those parts of the code which require it. Signed-off-by: Stefan Weil <[email protected]>
1 parent 20e53b1 commit 081793f

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

configure.ac

-3
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ AC_ARG_ENABLE([legacy],
170170
[enable_legacy=$enableval],
171171
[enable_legacy="yes"])
172172
AC_MSG_RESULT([$enable_legacy])
173-
if test "$enable_legacy" = "no"; then
174-
AC_DEFINE([DISABLED_LEGACY_ENGINE], [], [Disable the legacy OCR engine])
175-
fi
176173
AM_CONDITIONAL([DISABLED_LEGACY_ENGINE], test "$enable_legacy" = "no")
177174

178175
# check whether to build embedded version

src/api/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\" \
1515

1616
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
1717

18+
if DISABLED_LEGACY_ENGINE
19+
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
20+
endif
21+
1822
if VISIBILITY
1923
AM_CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
2024
endif

src/ccmain/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ AM_CPPFLAGS += \
1414
AM_CPPFLAGS += $(OPENCL_CPPFLAGS)
1515
AM_CPPFLAGS += $(OPENMP_CXXFLAGS)
1616

17+
if DISABLED_LEGACY_ENGINE
18+
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
19+
endif
20+
1721
if VISIBILITY
1822
AM_CPPFLAGS += -DTESS_EXPORTS \
1923
-fvisibility=hidden -fvisibility-inlines-hidden

src/classify/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ AM_CPPFLAGS += \
55
-I$(top_srcdir)/src/dict \
66
-I$(top_srcdir)/src/viewer
77

8+
if DISABLED_LEGACY_ENGINE
9+
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
10+
endif
11+
812
if VISIBILITY
913
AM_CPPFLAGS += -DTESS_EXPORTS \
1014
-fvisibility=hidden -fvisibility-inlines-hidden

src/training/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ AM_CPPFLAGS += \
1616

1717
EXTRA_DIST = language-specific.sh tesstrain.sh tesstrain_utils.sh
1818

19+
if DISABLED_LEGACY_ENGINE
20+
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
21+
endif
22+
1923
# TODO: training programs can not be linked to shared library created
2024
# with -fvisibility
2125
if VISIBILITY

src/wordrec/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ AM_CPPFLAGS += \
66
-I$(top_srcdir)/src/dict \
77
-I$(top_srcdir)/src/viewer
88

9+
if DISABLED_LEGACY_ENGINE
10+
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
11+
endif
12+
913
if VISIBILITY
1014
AM_CPPFLAGS += -DTESS_EXPORTS \
1115
-fvisibility=hidden -fvisibility-inlines-hidden

0 commit comments

Comments
 (0)