From: Robert Luberda <robert@debian.org> Date: Thu, 30 Aug 2018 08:49:10 +0200 Subject: Use pkg-config to detect freetype As the next libfreetype6-dev will not ship the freetype-config script, switch to using pkg-config to detect freetype includes and libraries. Bugs-Debian: https://bugs.debian.org/887599 --- libAfterImage/Makefile.in | 2 +- libAfterImage/configure.in | 39 +++++++++++++++------------------------ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/libAfterImage/Makefile.in b/libAfterImage/Makefile.in index f558e04..2dc209f 100644 --- a/libAfterImage/Makefile.in +++ b/libAfterImage/Makefile.in @@ -104,7 +104,7 @@ INSTALL_HEADER = @INSTALL@ -m 644 INSTALL_LIB = @INSTALL@ -m 755 INSTALL_SCRIPT = @INSTALL@ -m 755 -INCS_EXTRA = @XPM_CFLAGS@ @JPEG_CFLAGS@ @PNG_CFLAGS@ @GIF_CFLAGS@ @TIFF_CFLAGS@ @SVG_CFLAGS@ @TTF_INCLUDES@ +INCS_EXTRA = @XPM_CFLAGS@ @JPEG_CFLAGS@ @PNG_CFLAGS@ @GIF_CFLAGS@ @TIFF_CFLAGS@ @SVG_CFLAGS@ @TTF_CFLAGS@ INCS_X = @X_CFLAGS@ INCS_PRIVATE = INCLUDES = $(INCS_EXTRA) $(INCS_PRIVATE) $(INCS_X) diff --git a/libAfterImage/configure.in b/libAfterImage/configure.in index 63de31e..05f5b4e 100644 --- a/libAfterImage/configure.in +++ b/libAfterImage/configure.in @@ -548,34 +548,24 @@ AFTERIMAGE_LIBS="$AFTERIMAGE_LIBS -lm" dnl# check for libfreetype -TTF_INCLUDES= +TTF_CFLAGS= if test "x$with_ttf" = "xno"; then have_ttf=disabled +elif test "$PKG_CONFIG" = "no" ; then + AC_MSG_CHECKING(if TTF support is available) + AC_MSG_RESULT(pkg-config is not found. Cannot check for TTF support) + have_ttf=disabled else if test "x$ttf_includes" = "xno"; then - AC_MSG_CHECKING(headers required by TTF support) - if freetype-config --cflags >/dev/null ;then - present_incs="$CCFLAGS $x_includes"; - for l in `freetype-config --cflags` ; do - inc_found=no - for p in `echo "$present_incs"` ; do - if test "x$l" = "x$p" ; then - inc_found=yes; - fi; - if test "x$l" = "x-I$p" ; then - inc_found=yes; - fi; - done; - if test "x$inc_found" != "xyes" ; then - TTF_INCLUDES="$TTF_INCLUDES $l" ; - fi; - done; - AC_MSG_RESULT($TTF_INCLUDES) + + PKG_CHECK_MODULES(TTF,[freetype2],[have_ttf=maybe],[have_ttf=no]) + + if test "x$have_ttf" = "xmaybe"; then saved_CPPFLAGS=$CPPFLAGS saved_CFLAGS=$CFLAGS - CPPFLAGS="$TTF_INCLUDES $CPPFLAGS" - CFLAGS="$CFLAGS $TTF_INCLUDES $XPM_CFLAGS $JPEG_CFLAGS $PNG_CFLAGS $GIF_CFLAGS $TIFF_CFLAGS $SVG_CFLAGS $X_CFLAGS" + CPPFLAGS="$TTF_CFLAGS $CPPFLAGS" + CFLAGS="$CFLAGS $TTF_CFLAGS $XPM_CFLAGS $JPEG_CFLAGS $PNG_CFLAGS $GIF_CFLAGS $TIFF_CFLAGS $SVG_CFLAGS $X_CFLAGS" have_ft2build=no AC_CHECK_HEADERS(ft2build.h,[have_ft2build=yes]) AC_MSG_CHECKING( freetype/freetype.h ) @@ -620,20 +610,21 @@ else CFLAGS=$saved_CFLAGS else enable_ttf=no ; + AC_MSG_CHECKING(if TTF support is available) AC_MSG_RESULT(none found, ttf disabled) echo "You have to install FreeType libary in order to be able to use TTF fonts." have_ttf=no fi; else - TTF_INCLUDES=$ttf_includes + TTF_CFLAGS=$ttf_includes AC_DEFINE(HAVE_FREETYPE,1,[Define if libFreeType is available]) have_ttf=yes fi if test "$have_ttf" = yes; then - AFTERIMAGE_LIBS="`freetype-config --libs` $AFTERIMAGE_LIBS" + AFTERIMAGE_LIBS="$TTF_LIBS $AFTERIMAGE_LIBS" fi fi; -AC_SUBST(TTF_INCLUDES) +AC_SUBST(TTF_CFLAGS) AC_SUBST(JPEG_OBJS) AC_SUBST(ZLIB_OBJS)