Skip to content

Commit 1b9d068

Browse files
committed
configure: Fix check for dependencies needed for training
The different checks had set ENABLE_TRAINING unconditionally, thus overwriting the value from the preceding checks. So if pango and cairo were available, but icu was missing, users would still be offered to build the training tools. The changes for icu and has_cpp11 are not strictly necessary, but are made here to have uniform code patterns. Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 99cceba commit 1b9d068

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

configure.ac

+6-4
Original file line numberDiff line numberDiff line change
@@ -457,34 +457,36 @@ int i = 0;
457457
[AC_MSG_RESULT(yes)],
458458
[AC_MSG_FAILURE([leptonica 1.71 or higher is required])])
459459

460+
AM_CONDITIONAL(ENABLE_TRAINING, true)
461+
460462
# Check location of icu headers
461463
have_icu=false
462464
AC_CHECK_HEADERS(unicode/uchar.h, have_icu=true, have_icu=false)
463465
if !($have_icu); then
464466
AC_MSG_WARN(Training tools WILL NOT be built because of missing icu library.)
465467
AC_MSG_WARN(Try to install libicu-devel package.)
468+
AM_CONDITIONAL(ENABLE_TRAINING, false)
466469
fi
467-
AM_CONDITIONAL(ENABLE_TRAINING, $have_icu)
468470

469471
# Check location of pango headers
470472
PKG_CHECK_MODULES(pango, pango, have_pango=true, have_pango=false)
471473
if !($have_pango); then
472474
AC_MSG_WARN(Training tools WILL NOT be built because of missing pango library.)
473475
AC_MSG_WARN(Try to install libpango1.0-dev package.)
476+
AM_CONDITIONAL(ENABLE_TRAINING, false)
474477
else
475478
CPPFLAGS="$CPPFLAGS $pango_CFLAGS"
476479
fi
477-
AM_CONDITIONAL(ENABLE_TRAINING, $have_pango)
478480

479481
# Check location of cairo headers
480482
PKG_CHECK_MODULES(cairo, cairo, have_cairo=true, have_cairo=false)
481483
if !($have_cairo); then
482484
AC_MSG_WARN(Training tools WILL NOT be built because of missing cairo library.)
483485
AC_MSG_WARN(Try to install libcairo-dev?? package.)
486+
AM_CONDITIONAL(ENABLE_TRAINING, false)
484487
else
485488
CPPFLAGS="$CPPFLAGS $cairo_CFLAGS"
486489
fi
487-
AM_CONDITIONAL(ENABLE_TRAINING, $have_cairo)
488490

489491
# set c++11 support based on platform/compiler
490492
if test "x$has_cpp11" = "xyes"; then
@@ -507,7 +509,7 @@ if test "x$has_cpp11" = "xyes"; then
507509
esac
508510
else
509511
AC_MSG_WARN(Training tools WILL NOT be built because of missing c++11 support.)
510-
AM_CONDITIONAL(ENABLE_TRAINING, [test "x$has_cpp11" = "xyes"])
512+
AM_CONDITIONAL(ENABLE_TRAINING, false)
511513
fi
512514

513515
# ----------------------------------------

0 commit comments

Comments
 (0)