@@ -184,21 +184,29 @@ AC_DEFUN([PHP_GD_XPM],[
184
184
AC_DEFUN ( [ PHP_GD_FREETYPE2] ,[
185
185
if test "$PHP_FREETYPE_DIR" != "no"; then
186
186
187
- for i in $PHP_FREETYPE_DIR /usr/local /usr; do
188
- if test -f "$i/bin/freetype-config"; then
189
- FREETYPE2_DIR=$i
190
- FREETYPE2_CONFIG="$i/bin/freetype-config"
191
- break
187
+ if test -z "$PKG_CONFIG"; then
188
+ AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
189
+ fi
190
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists freetype2 ; then
191
+ FREETYPE2_CFLAGS=`$PKG_CONFIG --cflags freetype2`
192
+ FREETYPE2_LIBS=`$PKG_CONFIG --libs freetype2`
193
+ else
194
+ for i in $PHP_FREETYPE_DIR /usr/local /usr; do
195
+ if test -f "$i/bin/freetype-config"; then
196
+ FREETYPE2_DIR=$i
197
+ FREETYPE2_CONFIG="$i/bin/freetype-config"
198
+ break
199
+ fi
200
+ done
201
+
202
+ if test -z "$FREETYPE2_DIR"; then
203
+ AC_MSG_ERROR ( [ freetype-config not found.] )
192
204
fi
193
- done
194
205
195
- if test -z "$FREETYPE2_DIR"; then
196
- AC_MSG_ERROR ( [ freetype-config not found. ] )
206
+ FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`
207
+ FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`
197
208
fi
198
209
199
- FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`
200
- FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`
201
-
202
210
PHP_EVAL_INCLINE($FREETYPE2_CFLAGS)
203
211
PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD)
204
212
AC_DEFINE ( HAVE_LIBFREETYPE ,1 ,[ ] )
0 commit comments