diff --git a/configure.ac b/configure.ac index bbe8f8360..c6ceeccdd 100644 --- a/configure.ac +++ b/configure.ac @@ -421,12 +421,17 @@ fi AM_CONDITIONAL([ENABLE_TRAINING], true) # Check location of icu headers -have_icu=false -AC_CHECK_HEADERS([unicode/uchar.h], [have_icu=true], [have_icu=false]) -if !($have_icu); then +PKG_CHECK_MODULES([ICU_UC], [icu-uc], [have_icu_uc=true], [have_icu_uc=false]) +PKG_CHECK_MODULES([ICU_I18N], [icu-i18n], [have_icu_i18n=true], [have_icu_i18n=false]) +if !($have_icu_uc && $have_icu_i18n); then + 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.]) AM_CONDITIONAL([ENABLE_TRAINING], false) + else + ICU_UC_LIBS="-licui18n -licuuc" + fi fi # Check location of pango headers diff --git a/training/Makefile.am b/training/Makefile.am index 250622665..65dae58bc 100644 --- a/training/Makefile.am +++ b/training/Makefile.am @@ -10,9 +10,8 @@ AM_CPPFLAGS += \ EXTRA_DIST = language-specific.sh tesstrain.sh tesstrain_utils.sh -libicu=-licui18n -licuuc -# TODO: training programs can not be linked to shared library created -# with -fvisibility +# TODO: training programs can not be linked to shared library created +# with -fvisibility if VISIBILITY AM_LDFLAGS += -all-static endif @@ -26,9 +25,9 @@ noinst_HEADERS = \ noinst_LTLIBRARIES = libtesseract_training.la libtesseract_tessopt.la libtesseract_training_la_LIBADD = \ - ../cutil/libtesseract_cutil.la + ../cutil/libtesseract_cutil.la # ../api/libtesseract.la - + libtesseract_training_la_SOURCES = \ boxchar.cpp commandlineflags.cpp commontraining.cpp degradeimage.cpp \ fileio.cpp ligature_table.cpp normstrngs.cpp pango_font_info.cpp \ @@ -171,7 +170,7 @@ set_unicharset_properties_SOURCES = set_unicharset_properties.cpp set_unicharset_properties_LDADD = \ libtesseract_training.la \ libtesseract_tessopt.la \ - $(libicu) + $(ICU_I18N_LIBS) $(ICU_UC_LIBS) if USING_MULTIPLELIBS set_unicharset_properties_LDADD += \ ../textord/libtesseract_textord.la \ @@ -217,7 +216,8 @@ text2image_SOURCES = text2image.cpp #text2image_LDFLAGS = -static text2image_LDADD = \ libtesseract_training.la \ - libtesseract_tessopt.la + libtesseract_tessopt.la \ + $(ICU_I18N_LIBS) $(ICU_UC_LIBS) if USING_MULTIPLELIBS text2image_LDADD += \ ../textord/libtesseract_textord.la \ @@ -235,7 +235,7 @@ else text2image_LDADD += \ ../api/libtesseract.la endif -text2image_LDADD += $(libicu) -lpango-1.0 -lpangocairo-1.0 \ +text2image_LDADD += $(ICU_UC_LIBS) -lpango-1.0 -lpangocairo-1.0 \ -lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0 -lfontconfig unicharset_extractor_SOURCES = unicharset_extractor.cpp