Skip to content

Commit 8c4f019

Browse files
authored
Autotools: Sync CS in gd extension (#15364)
- Obsolete PHP_* variables checks removed (there was once the 'pdf' extension bundled in PHP that also had the same --with-*-dir configure options (3be17e3). When combined with the gd extension, options need to be executed conditionally; first one won), this is no longer relevant neither recommended practice to duplicate configure options inside the php-src context. Ideally, all configure options should be prefixed with an extension namespace --with-<extension-name>-<option> to be unique. - AS_* macros used
1 parent f5ae5ac commit 8c4f019

File tree

1 file changed

+31
-39
lines changed

1 file changed

+31
-39
lines changed

ext/gd/config.m4

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,26 @@ PHP_ARG_WITH([external-gd],
1313
[no],
1414
[no])
1515

16-
if test -z "$PHP_AVIF"; then
17-
PHP_ARG_WITH([avif],
18-
[for libavif],
19-
[AS_HELP_STRING([--with-avif],
20-
[GD: Enable AVIF support (only for bundled libgd)])],
21-
[no],
22-
[no])
23-
fi
16+
PHP_ARG_WITH([avif],
17+
[for libavif],
18+
[AS_HELP_STRING([--with-avif],
19+
[GD: Enable AVIF support (only for bundled libgd)])],
20+
[no],
21+
[no])
2422

25-
if test -z "$PHP_WEBP"; then
26-
PHP_ARG_WITH([webp],
27-
[for libwebp],
28-
[AS_HELP_STRING([--with-webp],
29-
[GD: Enable WEBP support (only for bundled libgd)])],
30-
[no],
31-
[no])
32-
fi
23+
PHP_ARG_WITH([webp],
24+
[for libwebp],
25+
[AS_HELP_STRING([--with-webp],
26+
[GD: Enable WEBP support (only for bundled libgd)])],
27+
[no],
28+
[no])
3329

34-
if test -z "$PHP_JPEG"; then
35-
PHP_ARG_WITH([jpeg],
36-
[for libjpeg],
37-
[AS_HELP_STRING([--with-jpeg],
38-
[GD: Enable JPEG support (only for bundled libgd)])],
39-
[no],
40-
[no])
41-
fi
30+
PHP_ARG_WITH([jpeg],
31+
[for libjpeg],
32+
[AS_HELP_STRING([--with-jpeg],
33+
[GD: Enable JPEG support (only for bundled libgd)])],
34+
[no],
35+
[no])
4236

4337
PHP_ARG_WITH([xpm],
4438
[for libXpm],
@@ -73,73 +67,72 @@ AC_DEFUN([PHP_GD_PNG],[
7367
AC_DEFINE([HAVE_LIBPNG], [1], [Define to 1 if you have the libpng library.])
7468
])
7569

76-
AC_DEFUN([PHP_GD_AVIF],[
77-
if test "$PHP_AVIF" != "no"; then
70+
AC_DEFUN([PHP_GD_AVIF], [
71+
AS_VAR_IF([PHP_AVIF], [no],, [
7872
PKG_CHECK_MODULES([AVIF], [libavif >= 0.8.2])
7973
PHP_EVAL_LIBLINE([$AVIF_LIBS], [GD_SHARED_LIBADD])
8074
PHP_EVAL_INCLINE([$AVIF_CFLAGS])
8175
AC_DEFINE([HAVE_LIBAVIF], [1],
8276
[Define to 1 if you have the libavif library.])
8377
AC_DEFINE([HAVE_GD_AVIF], [1],
8478
[Define to 1 if gd extension has AVIF support.])
85-
fi
79+
])
8680
])
8781

8882
AC_DEFUN([PHP_GD_WEBP],[
89-
if test "$PHP_WEBP" != "no"; then
83+
AS_VAR_IF([PHP_WEBP], [no],, [
9084
PKG_CHECK_MODULES([WEBP], [libwebp >= 0.2.0])
9185
PHP_EVAL_LIBLINE([$WEBP_LIBS], [GD_SHARED_LIBADD])
9286
PHP_EVAL_INCLINE([$WEBP_CFLAGS])
9387
AC_DEFINE([HAVE_LIBWEBP], [1],
9488
[Define to 1 if you have the libwebp library.])
9589
AC_DEFINE([HAVE_GD_WEBP], [1],
9690
[Define to 1 if gd extension has WebP support.])
97-
fi
91+
])
9892
])
9993

10094
AC_DEFUN([PHP_GD_JPEG],[
101-
if test "$PHP_JPEG" != "no"; then
95+
AS_VAR_IF([PHP_JPEG], [no],, [
10296
PKG_CHECK_MODULES([JPEG], [libjpeg])
10397
PHP_EVAL_LIBLINE([$JPEG_LIBS], [GD_SHARED_LIBADD])
10498
PHP_EVAL_INCLINE([$JPEG_CFLAGS])
10599
AC_DEFINE([HAVE_LIBJPEG], [1],
106100
[Define to 1 if you have the libjpeg library.])
107101
AC_DEFINE([HAVE_GD_JPG], [1],
108102
[Define to 1 if gd extension has JPEG support.])
109-
fi
103+
])
110104
])
111105

112106
AC_DEFUN([PHP_GD_XPM],[
113-
if test "$PHP_XPM" != "no"; then
107+
AS_VAR_IF([PHP_XPM], [no],, [
114108
PKG_CHECK_MODULES([XPM], [xpm])
115109
PHP_EVAL_LIBLINE([$XPM_LIBS], [GD_SHARED_LIBADD])
116110
PHP_EVAL_INCLINE([$XPM_CFLAGS])
117111
AC_DEFINE([HAVE_XPM], [1], [Define to 1 if you have the xpm library.])
118112
AC_DEFINE([HAVE_GD_XPM], [1],
119113
[Define to 1 if gd extension has XPM support.])
120-
fi
114+
])
121115
])
122116

123117
AC_DEFUN([PHP_GD_FREETYPE2],[
124-
if test "$PHP_FREETYPE" != "no"; then
118+
AS_VAR_IF([PHP_FREETYPE], [no],, [
125119
PKG_CHECK_MODULES([FREETYPE2], [freetype2])
126-
127120
PHP_EVAL_INCLINE([$FREETYPE2_CFLAGS])
128121
PHP_EVAL_LIBLINE([$FREETYPE2_LIBS], [GD_SHARED_LIBADD])
129122
AC_DEFINE([HAVE_LIBFREETYPE], [1],
130123
[Define to 1 if you have the FreeType library.])
131124
AC_DEFINE([HAVE_GD_FREETYPE], [1],
132125
[Define to 1 if gd extension has FreeType support.])
133-
fi
126+
])
134127
])
135128

136129
AC_DEFUN([PHP_GD_JISX0208],[
137-
if test "$PHP_GD_JIS_CONV" = "yes"; then
130+
AS_VAR_IF([PHP_GD_JIS_CONV], [yes], [
138131
AC_DEFINE([USE_GD_JISX0208], [1],
139132
[Define to 1 if gd extension has JIS-mapped Japanese font support.])
140133
AC_DEFINE([JISX0208], [1],
141134
[Define to 1 if GD library has JIS-mapped Japanese font support.])
142-
fi
135+
])
143136
])
144137

145138
dnl
@@ -222,7 +215,6 @@ dnl Main GD configure
222215
dnl
223216

224217
if test "$PHP_GD" != "no"; then
225-
226218
if test "$PHP_EXTERNAL_GD" = "no"; then
227219
extra_sources=m4_normalize(["
228220
libgd/gd_avif.c

0 commit comments

Comments
 (0)