Skip to content

Commit a0955f3

Browse files
committed
Switch to using freetype-config for freetype detection.
This fixes GD compilation against libfreetype 2.5.1 and later after they made the rather interesting decision to change their include directory layout in a point release. The original suggestion in the bug was to use pkg-config, but my inclination is to use freetype-config instead: we should be able to get the same configuration information without actually needing pkg-config installed, since pkg-config is by no means guaranteed to exist on many Unices and distros, whereas freetype-config should always be present if a libfreetype build environment is installed. Let's try it out and see what happens. Fixes bug #64405 (Use freetype-config for determining freetype2 dir(s)).
1 parent ff89066 commit a0955f3

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ PHP NEWS
2020
- Filter:
2121
. Fixed bug #66229 (128.0.0.0/16 isn't reserved any longer). (Adam)
2222

23+
- GD:
24+
. Fixed bug #64405 (Use freetype-config for determining freetype2 dir(s)).
25+
(Adam)
26+
2327
- XSL
2428
. Fixed bug #49634 (Segfault throwing an exception in a XSL registered
2529
function). (Mike)

ext/gd/config.m4

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,30 +193,25 @@ AC_DEFUN([PHP_GD_FREETYPE2],[
193193
if test "$PHP_FREETYPE_DIR" != "no"; then
194194
195195
for i in $PHP_FREETYPE_DIR /usr/local /usr; do
196-
if test -f "$i/include/freetype2/freetype/freetype.h"; then
196+
if test -f "$i/bin/freetype-config"; then
197197
FREETYPE2_DIR=$i
198-
FREETYPE2_INC_DIR=$i/include/freetype2
198+
FREETYPE2_CONFIG="$i/bin/freetype-config"
199199
break
200200
fi
201201
done
202202
203203
if test -z "$FREETYPE2_DIR"; then
204-
AC_MSG_ERROR([freetype.h not found.])
204+
AC_MSG_ERROR([freetype-config not found.])
205205
fi
206206
207-
PHP_CHECK_LIBRARY(freetype, FT_New_Face,
208-
[
209-
PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
210-
PHP_ADD_INCLUDE($FREETYPE2_DIR/include)
211-
PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
212-
AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
213-
AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
214-
AC_DEFINE(ENABLE_GD_TTF,1,[ ])
215-
],[
216-
AC_MSG_ERROR([Problem with freetype.(a|so). Please check config.log for more information.])
217-
],[
218-
-L$FREETYPE2_DIR/$PHP_LIBDIR
219-
])
207+
FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`
208+
FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`
209+
210+
PHP_EVAL_INCLINE($FREETYPE2_CFLAGS)
211+
PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD)
212+
AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
213+
AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
214+
AC_DEFINE(ENABLE_GD_TTF,1,[ ])
220215
else
221216
AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
222217
fi

0 commit comments

Comments
 (0)