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,30 +415,36 @@ 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
if test "$LIBLEPT_HEADERSDIR" = "" ; then
LIBLEPT_HEADERSDIR="/usr/local/include /usr/include /opt/local/include/leptonica"
fi
for incd in $LIBLEPT_HEADERSDIR
do
for lept in . leptonica liblept
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
for incd in $LIBLEPT_HEADERSDIR
do
if test -r "$incd/$lept/allheaders.h" ; then
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
have_lept=yes
fi
for lept in . leptonica liblept
do
if test -r "$incd/$lept/allheaders.h" ; then
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
have_lept=true
fi
done
done
done
if $have_lept; then
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([leptonica not found])
fi
else
CPPFLAGS="$CPPFLAGS $LEPTONICA_CFLAGS"
fi
if test "$have_lept" = yes ; then
AC_MSG_RESULT(yes)
if $have_lept; then
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
AC_MSG_CHECKING([leptonica headers version >= 1.71])