summaryrefslogtreecommitdiff
path: root/ext/gd/config.m4
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2018-05-14 17:25:37 -0400
committerNikita Popov <nikita.ppv@gmail.com>2018-11-07 13:05:47 +0100
commit2d03197749696ac3f8effba6b7977b0d8729fef3 (patch)
tree2c7327c6007ce3f175bb81e9ae489e6abc189132 /ext/gd/config.m4
parentf20029807560677077f3f94764caada869329e26 (diff)
downloadphp-git-2d03197749696ac3f8effba6b7977b0d8729fef3.tar.gz
ext/gd: Use pkg-config to detect the availability of freetype2
The latest version of freetype2 does not install freetype-config by default, but pkg-config support has been there for approximately 15 years. In order to reliably detect freetype2, pkg-config *must* be used. See: https://savannah.nongnu.org/bugs/?53093 https://bugs.php.net/bug.php?id=76324
Diffstat (limited to 'ext/gd/config.m4')
-rw-r--r--ext/gd/config.m425
1 files changed, 5 insertions, 20 deletions
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 498d870785..70da35facf 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -30,8 +30,8 @@ fi
PHP_ARG_WITH(xpm-dir, for the location of libXpm,
[ --with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix], no, no)
-PHP_ARG_WITH(freetype-dir, for FreeType 2,
-[ --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix], no, no)
+PHP_ARG_ENABLE(freetype, for FreeType 2,
+[ --enable-freetype GD: Enable FreeType 2 support], no, no)
PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD,
[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support], no, no)
@@ -182,29 +182,14 @@ AC_DEFUN([PHP_GD_XPM],[
])
AC_DEFUN([PHP_GD_FREETYPE2],[
- if test "$PHP_FREETYPE_DIR" != "no"; then
-
- for i in $PHP_FREETYPE_DIR /usr/local /usr; do
- if test -f "$i/bin/freetype-config"; then
- FREETYPE2_DIR=$i
- FREETYPE2_CONFIG="$i/bin/freetype-config"
- break
- fi
- done
-
- if test -z "$FREETYPE2_DIR"; then
- AC_MSG_ERROR([freetype-config not found.])
- fi
+ if test "$PHP_FREETYPE" != "no"; then
- FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`
- FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`
+ PKG_CHECK_MODULES([FREETYPE2], [freetype2], [FREETYPE2_FOUND=true])
PHP_EVAL_INCLINE($FREETYPE2_CFLAGS)
PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
AC_DEFINE(ENABLE_GD_TTF,1,[ ])
- else
- AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
fi
])
@@ -288,7 +273,7 @@ dnl enable the support in bundled GD library
GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM"
fi
- if test -n "$FREETYPE2_DIR"; then
+ if test -n "$FREETYPE2_FOUND"; then
AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])
AC_DEFINE(ENABLE_GD_TTF, 1, [ ])
GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF"