Use pkg-config for icu compiler and linker flags

The old settings are used as fallback if there is no configuration.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2016-12-13 13:26:40 +01:00
parent aec39d629d
commit b66ff1f455
2 changed files with 16 additions and 11 deletions

View File

@ -421,12 +421,17 @@ fi
AM_CONDITIONAL([ENABLE_TRAINING], true) AM_CONDITIONAL([ENABLE_TRAINING], true)
# Check location of icu headers # Check location of icu headers
have_icu=false PKG_CHECK_MODULES([ICU_UC], [icu-uc], [have_icu_uc=true], [have_icu_uc=false])
AC_CHECK_HEADERS([unicode/uchar.h], [have_icu=true], [have_icu=false]) PKG_CHECK_MODULES([ICU_I18N], [icu-i18n], [have_icu_i18n=true], [have_icu_i18n=false])
if !($have_icu); then 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([Training tools WILL NOT be built because of missing icu library.])
AC_MSG_WARN([Try to install libicu-devel package.]) AC_MSG_WARN([Try to install libicu-devel package.])
AM_CONDITIONAL([ENABLE_TRAINING], false) AM_CONDITIONAL([ENABLE_TRAINING], false)
else
ICU_UC_LIBS="-licui18n -licuuc"
fi
fi fi
# Check location of pango headers # Check location of pango headers

View File

@ -10,7 +10,6 @@ AM_CPPFLAGS += \
EXTRA_DIST = language-specific.sh tesstrain.sh tesstrain_utils.sh EXTRA_DIST = language-specific.sh tesstrain.sh tesstrain_utils.sh
libicu=-licui18n -licuuc
# TODO: training programs can not be linked to shared library created # TODO: training programs can not be linked to shared library created
# with -fvisibility # with -fvisibility
if VISIBILITY if VISIBILITY
@ -171,7 +170,7 @@ set_unicharset_properties_SOURCES = set_unicharset_properties.cpp
set_unicharset_properties_LDADD = \ set_unicharset_properties_LDADD = \
libtesseract_training.la \ libtesseract_training.la \
libtesseract_tessopt.la \ libtesseract_tessopt.la \
$(libicu) $(ICU_I18N_LIBS) $(ICU_UC_LIBS)
if USING_MULTIPLELIBS if USING_MULTIPLELIBS
set_unicharset_properties_LDADD += \ set_unicharset_properties_LDADD += \
../textord/libtesseract_textord.la \ ../textord/libtesseract_textord.la \
@ -217,7 +216,8 @@ text2image_SOURCES = text2image.cpp
#text2image_LDFLAGS = -static #text2image_LDFLAGS = -static
text2image_LDADD = \ text2image_LDADD = \
libtesseract_training.la \ libtesseract_training.la \
libtesseract_tessopt.la libtesseract_tessopt.la \
$(ICU_I18N_LIBS) $(ICU_UC_LIBS)
if USING_MULTIPLELIBS if USING_MULTIPLELIBS
text2image_LDADD += \ text2image_LDADD += \
../textord/libtesseract_textord.la \ ../textord/libtesseract_textord.la \
@ -235,7 +235,7 @@ else
text2image_LDADD += \ text2image_LDADD += \
../api/libtesseract.la ../api/libtesseract.la
endif 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 -lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0 -lfontconfig
unicharset_extractor_SOURCES = unicharset_extractor.cpp unicharset_extractor_SOURCES = unicharset_extractor.cpp