Skip to content

Commit

Permalink
Use pkg-config for Leptonica compiler flags
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stweil committed Dec 13, 2016
1 parent 9ec0c4f commit 3a5446b
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions configure.ac
Expand Up @@ -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])
Expand Down

0 comments on commit 3a5446b

Please sign in to comment.