Werner, please take a look at the patch attached below.
I'm now using PKG_CHECK_MODULES as you requested, when freetype-config
can't be found or is set to "no" by the user.
It's also possible to skip pkg-config altogether by setting PKG_CONFIG=true
and passing FREETYPE_CFLAGS and FREETYPE_LIBS directly on the configure
command line.
Let me know if this is what you had in mind, thanks.
C.
On Tue, Jan 9, 2018 at 7:31 PM Cosimo Lupo <[email protected]> wrote:
> Makes sense, I’ll do that.
>
> Il 9 gen 2018, 19:22 +0000, Werner LEMBERG <[email protected]>, ha scritto:
>
>
> autoconf is not my cup of tea, but I've tried anyway. See the patch
> attached below.
>
>
> Thanks! However, this is not exactly what I had in mind – and sorry
> for not telling you earlier: If `freetype-config' isn't found, the
> configure script should call the `PKG_CHECK_MODULES' macro (as with
> harfbuzz), trying to find `freetype2.pc'. This should be much less
> code. As a side effect, this macro also provides the
> `FREETYPE2_CFLAGS' and `FREETYPE2_LIBS' environment variables.
>
> Please try again, if you find some time :-)
>
>
> Werner
>
>
--
Cosimo Lupo
diff --git a/configure.ac b/configure.ac
index f007118..380a83a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,19 +133,25 @@ if test "$freetype_config" = "yes"; then
AC_PATH_TOOL(ft_config,
freetype-config,
no)
- if test "$ft_config" = "no"; then
- AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
- fi
else
ft_config="$freetype_config"
fi
-FREETYPE_CPPFLAGS="`$ft_config --cflags`"
-FREETYPE_LIBS="`$ft_config --libtool`"
+if test "$ft_config" = "no"; then
+ # freetype-config tool not found or disabled; try pkg-config
+ PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 2.4.5])
+ if { test -z "$FREETYPE_CFLAGS" || test -z "$FREETYPE_LIBS"; }; then
+ AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
+ fi
+ FREETYPE_CPPFLAGS="$FREETYPE_CFLAGS"
+else
+ FREETYPE_CPPFLAGS="`$ft_config --cflags`"
+ FREETYPE_LIBS="`$ft_config --libtool`"
-# many platforms no longer install .la files for system libraries
-if test ! -f "$FREETYPE_LIBS"; then
- FREETYPE_LIBS="`$ft_config --libs`"
+ # many platforms no longer install .la files for system libraries
+ if test ! -f "$FREETYPE_LIBS"; then
+ FREETYPE_LIBS="`$ft_config --libs`"
+ fi
fi
AC_SUBST([FREETYPE_CPPFLAGS])
_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel