diff --git a/configure.ac b/configure.ac index 223e0554..4db2da8e 100644 --- a/configure.ac +++ b/configure.ac @@ -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])