Use pkg-config for Leptonica compiler flags

The old settings don't work for cross compilations (wrong include path)
or require setting LIBLEPT_HEADERSDIR. They are used as fallback if
there is no pkg-config configuration.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2016-12-13 15:52:29 +01:00
parent 9ec0c4fa9c
commit 3a5446bb52

View File

@ -415,10 +415,11 @@ AC_CHECK_TYPES([mbstate_t],,, [#include "wchar.h"])
# ----------------------------------------
# Check location of leptonica/liblept headers.
AC_MSG_CHECKING([for leptonica])
AC_ARG_VAR([LIBLEPT_HEADERSDIR], [Leptonica headers directory])
have_lept=no
PKG_CHECK_MODULES([LEPTONICA], [lept], [have_lept=true], [have_lept=false])
if !($have_lept); then
AC_MSG_CHECKING([for leptonica])
if test "$LIBLEPT_HEADERSDIR" = "" ; then
LIBLEPT_HEADERSDIR="/usr/local/include /usr/include /opt/local/include/leptonica"
fi
@ -428,18 +429,23 @@ do
do
if test -r "$incd/$lept/allheaders.h" ; then
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
have_lept=yes
have_lept=true
fi
done
done
if test "$have_lept" = yes ; then
if $have_lept; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB([lept], [l_generateCIDataForPdf], [],
[AC_MSG_ERROR([leptonica library with pdf support (>= 1.71) is missing])])
else
AC_MSG_ERROR([leptonica not found])
fi
else
CPPFLAGS="$CPPFLAGS $LEPTONICA_CFLAGS"
fi
if $have_lept; then
AC_CHECK_LIB([lept], [l_generateCIDataForPdf], [],
[AC_MSG_ERROR([leptonica library with pdf support (>= 1.71) is missing])])
fi
AC_MSG_CHECKING([leptonica headers version >= 1.71])
AC_PREPROC_IFELSE(