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)
# 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

View File

@ -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