Skip to content

Commit 5fc6974

Browse files
committed
libwebp support for linux
1 parent 3461913 commit 5fc6974

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

ext/gd/config.m4

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ dnl
99
PHP_ARG_WITH(gd, for GD support,
1010
[ --with-gd[=DIR] Include GD support. DIR is the GD library base
1111
install directory [BUNDLED]])
12-
if test -z "$PHP_VPX_DIR"; then
13-
PHP_ARG_WITH(vpx-dir, for the location of libvpx,
14-
[ --with-vpx-dir[=DIR] GD: Set the path to libvpx install prefix], no, no)
12+
if test -z "$PHP_WEBP_DIR"; then
13+
PHP_ARG_WITH(webp-dir, for the location of libwebp,
14+
[ --with-webp-dir[=DIR] GD: Set the path to libwebp install prefix], no, no)
1515
fi
1616

1717
if test -z "$PHP_JPEG_DIR"; then
@@ -69,29 +69,37 @@ AC_DEFUN([PHP_GD_ZLIB],[
6969
fi
7070
])
7171

72-
AC_DEFUN([PHP_GD_VPX],[
73-
if test "$PHP_VPX_DIR" != "no"; then
72+
AC_DEFUN([PHP_GD_WEBP],[
73+
if test "$PHP_WEBP_DIR" != "no"; then
7474
75-
for i in $PHP_VPX_DIR /usr/local /usr; do
76-
test -f $i/include/vpx_codec.h || test -f $i/include/vpx/vpx_codec.h && GD_VPX_DIR=$i && break
75+
for i in $PHP_WEBP_DIR /usr/local /usr; do
76+
test -f $i/include/webp/decode.h && GD_WEBP_DIR=$i && break
7777
done
7878
79-
if test -z "$GD_VPX_DIR"; then
80-
AC_MSG_ERROR([vpx_codec.h not found.])
79+
if test -z "$GD_WEBP_DIR"; then
80+
AC_MSG_ERROR([webp/decode.h not found.])
8181
fi
8282
83-
PHP_CHECK_LIBRARY(vpx,vpx_codec_destroy,
83+
for i in $PHP_WEBP_DIR /usr/local /usr; do
84+
test -f $i/include/webp/encode.h && GD_WEBP_DIR=$i && break
85+
done
86+
87+
if test -z "$GD_WEBP_DIR"; then
88+
AC_MSG_ERROR([webp/encode.h not found.])
89+
fi
90+
91+
PHP_CHECK_LIBRARY(webp,WebPGetInfo,
8492
[
85-
PHP_ADD_INCLUDE($GD_VPX_DIR/include)
93+
PHP_ADD_INCLUDE($GD_WEBP_DIR/include)
8694
PHP_ADD_LIBRARY(pthread)
87-
PHP_ADD_LIBRARY_WITH_PATH(vpx, $GD_VPX_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
95+
PHP_ADD_LIBRARY_WITH_PATH(webp, $GD_WEBP_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
8896
],[
89-
AC_MSG_ERROR([Problem with libvpx.(a|so). Please check config.log for more information.])
97+
AC_MSG_ERROR([Problem with libwebp.(a|so). Please check config.log for more information.])
9098
],[
91-
-L$GD_VPX_DIR/$PHP_LIBDIR
99+
-L$GD_WEBP_DIR/$PHP_LIBDIR
92100
])
93101
else
94-
AC_MSG_RESULT([If configure fails try --with-vpx-dir=<DIR>])
102+
AC_MSG_RESULT([If configure fails try --with-webp-dir=<DIR>])
95103
fi
96104
])
97105

@@ -242,7 +250,7 @@ dnl PNG is required by GD library
242250
dnl Various checks for GD features
243251
PHP_GD_ZLIB
244252
PHP_GD_TTSTR
245-
PHP_GD_VPX
253+
PHP_GD_WEBP
246254
PHP_GD_JPEG
247255
PHP_GD_PNG
248256
PHP_GD_XPM
@@ -253,7 +261,7 @@ fi
253261
if test "$PHP_GD" = "yes"; then
254262
GD_MODULE_TYPE=builtin
255263
extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \
256-
libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/webpimg.c libgd/gd_webp.c \
264+
libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_webp.c \
257265
libgd/gd_png.c libgd/gd_jpeg.c libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c \
258266
libgd/gdfontmb.c libgd/gdfontl.c libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c \
259267
libgd/gdcache.c libgd/gdkanji.c libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c \
@@ -275,9 +283,9 @@ dnl Make sure the libgd/ is first in the include path
275283
dnl Depending which libraries were included to PHP configure,
276284
dnl enable the support in bundled GD library
277285

278-
if test -n "$GD_VPX_DIR"; then
286+
if test -n "$GD_WEBP_DIR"; then
279287
AC_DEFINE(HAVE_GD_WEBP, 1, [ ])
280-
GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBVPX"
288+
GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBWEBP"
281289
fi
282290

283291
if test -n "$GD_JPEG_DIR"; then
@@ -310,7 +318,7 @@ else
310318
dnl Various checks for GD features
311319
PHP_GD_ZLIB
312320
PHP_GD_TTSTR
313-
PHP_GD_VPX
321+
PHP_GD_WEBP
314322
PHP_GD_JPEG
315323
PHP_GD_PNG
316324
PHP_GD_XPM

0 commit comments

Comments
 (0)