7
7
PHP_ARG_WITH(gd, for GD support,
8
8
[ --with-gd[ =DIR] Include GD support. DIR is the GD library base
9
9
install directory [ BUNDLED] ] )
10
- if test -z "$PHP_WEBP_DIR "; then
11
- PHP_ARG_WITH(webp-dir , for the location of libwebp,
12
- [ --with-webp-dir [ =DIR ] GD: Set the path to libwebp install prefix ] , no, no)
10
+ if test -z "$PHP_WEBP "; then
11
+ PHP_ARG_WITH(webp, for libwebp,
12
+ [ --with-webp GD: Enable WEBP support ] , no, no)
13
13
fi
14
14
15
- if test -z "$PHP_JPEG_DIR "; then
16
- PHP_ARG_WITH(jpeg-dir , for the location of libjpeg,
17
- [ --with-jpeg-dir [ =DIR ] GD: Set the path to libjpeg install prefix ] , no, no)
15
+ if test -z "$PHP_JPEG "; then
16
+ PHP_ARG_WITH(jpeg, for libjpeg,
17
+ [ --with-jpeg GD: Enable JPEG support ] , no, no)
18
18
fi
19
19
20
- if test -z "$PHP_PNG_DIR"; then
21
- PHP_ARG_WITH(png-dir, for the location of libpng,
22
- [ --with-png-dir[ =DIR] GD: Set the path to libpng install prefix] , no, no)
23
- fi
24
-
25
- if test -z "$PHP_ZLIB_DIR"; then
26
- PHP_ARG_WITH(zlib-dir, for the location of libz,
27
- [ --with-zlib-dir[ =DIR] GD: Set the path to libz install prefix] , no, no)
28
- fi
29
-
30
- PHP_ARG_WITH(xpm-dir, for the location of libXpm,
31
- [ --with-xpm-dir[ =DIR] GD: Set the path to libXpm install prefix] , no, no)
20
+ PHP_ARG_WITH(xpm, for libXpm,
21
+ [ --with-xpm GD: Enable XPM support] , no, no)
32
22
33
23
PHP_ARG_WITH(freetype, for FreeType 2,
34
24
[ --with-freetype GD: Enable FreeType 2 support] , no, no)
40
30
dnl Checks for the configure options
41
31
dnl
42
32
33
+ dnl zlib is always required
43
34
AC_DEFUN ( [ PHP_GD_ZLIB] ,[
44
- if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
45
- if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
46
- PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
47
- PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
48
- elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
49
- PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
50
- PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
51
- else
52
- AC_MSG_ERROR ( [ Can't find zlib headers under "$PHP_ZLIB_DIR"] )
53
- fi
54
- else
55
- for i in /usr/local /usr; do
56
- if test -f "$i/include/zlib/zlib.h"; then
57
- PHP_ZLIB_DIR="$i"
58
- PHP_ZLIB_INCDIR="$i/include/zlib"
59
- elif test -f "$i/include/zlib.h"; then
60
- PHP_ZLIB_DIR="$i"
61
- PHP_ZLIB_INCDIR="$i/include"
62
- fi
63
- done
64
- fi
35
+ PKG_CHECK_MODULES([ ZLIB] , [ zlib] )
36
+ PHP_EVAL_LIBLINE($ZLIB_LIBS, GD_SHARED_LIBADD)
37
+ PHP_EVAL_INCLINE($ZLIB_CFLAGS)
65
38
] )
66
39
67
- AC_DEFUN ( [ PHP_GD_WEBP] ,[
68
- if test "$PHP_WEBP_DIR" != "no"; then
69
-
70
- for i in $PHP_WEBP_DIR /usr/local /usr; do
71
- test -f $i/include/webp/decode.h && GD_WEBP_DIR=$i && break
72
- done
73
-
74
- if test -z "$GD_WEBP_DIR"; then
75
- AC_MSG_ERROR ( [ webp/decode.h not found.] )
76
- fi
77
-
78
- for i in $PHP_WEBP_DIR /usr/local /usr; do
79
- test -f $i/include/webp/encode.h && GD_WEBP_DIR=$i && break
80
- done
81
-
82
- if test -z "$GD_WEBP_DIR"; then
83
- AC_MSG_ERROR ( [ webp/encode.h not found.] )
84
- fi
85
-
86
- PHP_CHECK_LIBRARY(webp,WebPGetInfo,
87
- [
88
- PHP_ADD_INCLUDE($GD_WEBP_DIR/include)
89
- PHP_ADD_LIBRARY(pthread)
90
- PHP_ADD_LIBRARY_WITH_PATH(webp, $GD_WEBP_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
91
- ] ,[
92
- AC_MSG_ERROR ( [ Problem with libwebp.(a|so). Please check config.log for more information.] )
93
- ] ,[
94
- -L$GD_WEBP_DIR/$PHP_LIBDIR
95
- ] )
96
- else
97
- AC_MSG_RESULT ( [ If configure fails try --with-webp-dir=<DIR>] )
98
- fi
40
+ dnl libpng is always required
41
+ AC_DEFUN ( [ PHP_GD_PNG] ,[
42
+ PKG_CHECK_MODULES([ PNG] , [ libpng] )
43
+ PHP_EVAL_LIBLINE($PNG_LIBS, GD_SHARED_LIBADD)
44
+ PHP_EVAL_INCLINE($PNG_CFLAGS)
45
+ AC_DEFINE ( HAVE_LIBPNG , 1 , [ ] )
99
46
] )
100
47
101
- AC_DEFUN ( [ PHP_GD_JPEG] ,[
102
- if test "$PHP_JPEG_DIR" != "no"; then
103
-
104
- for i in $PHP_JPEG_DIR /usr/local /usr; do
105
- test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break
106
- done
107
-
108
- if test -z "$GD_JPEG_DIR"; then
109
- AC_MSG_ERROR ( [ jpeglib.h not found.] )
110
- fi
111
-
112
- PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
113
- [
114
- PHP_ADD_INCLUDE($GD_JPEG_DIR/include)
115
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $GD_JPEG_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
116
- ] ,[
117
- AC_MSG_ERROR ( [ Problem with libjpeg.(a|so). Please check config.log for more information.] )
118
- ] ,[
119
- -L$GD_JPEG_DIR/$PHP_LIBDIR
120
- ] )
121
- else
122
- AC_MSG_RESULT ( [ If configure fails try --with-jpeg-dir=<DIR>] )
48
+ AC_DEFUN ( [ PHP_GD_WEBP] ,[
49
+ if test "$PHP_WEBP" != "no"; then
50
+ PKG_CHECK_MODULES([ WEBP] , [ libwebp] )
51
+ PHP_EVAL_LIBLINE($WEBP_LIBS, GD_SHARED_LIBADD)
52
+ PHP_EVAL_INCLINE($WEBP_CFLAGS)
53
+ AC_DEFINE ( HAVE_LIBWEBP , 1 , [ ] )
54
+ AC_DEFINE ( HAVE_GD_WEBP , 1 , [ ] )
123
55
fi
124
56
] )
125
57
126
- AC_DEFUN ( [ PHP_GD_PNG] ,[
127
- if test "$PHP_PNG_DIR" != "no"; then
128
-
129
- for i in $PHP_PNG_DIR /usr/local /usr; do
130
- test -f $i/include/png.h && GD_PNG_DIR=$i && break
131
- done
132
-
133
- if test -z "$GD_PNG_DIR"; then
134
- AC_MSG_ERROR ( [ png.h not found.] )
135
- fi
136
-
137
- if test "$PHP_ZLIB_DIR" = "no"; then
138
- AC_MSG_ERROR ( [ PNG support requires ZLIB. Use --with-zlib-dir=<DIR>] )
139
- fi
140
-
141
- PHP_CHECK_LIBRARY(png,png_write_image,
142
- [
143
- PHP_ADD_INCLUDE($GD_PNG_DIR/include)
144
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
145
- PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
146
- ] ,[
147
- AC_MSG_ERROR ( [ Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.] )
148
- ] ,[
149
- -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz -L$GD_PNG_DIR/$PHP_LIBDIR
150
- ] )
151
-
152
- else
153
- AC_MSG_RESULT ( [ If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>] )
58
+ AC_DEFUN ( [ PHP_GD_JPEG] ,[
59
+ if test "$PHP_JPEG" != "no"; then
60
+ PKG_CHECK_MODULES([ JPEG] , [ libjpeg] )
61
+ PHP_EVAL_LIBLINE($JPEG_LIBS, GD_SHARED_LIBADD)
62
+ PHP_EVAL_INCLINE($JPEG_CFLAGS)
63
+ AC_DEFINE ( HAVE_LIBJPEG , 1 , [ ] )
64
+ AC_DEFINE ( HAVE_GD_JPG , 1 , [ ] )
154
65
fi
155
66
] )
156
67
157
68
AC_DEFUN ( [ PHP_GD_XPM] ,[
158
- if test "$PHP_XPM_DIR" != "no"; then
159
-
160
- for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
161
- test -f $i/include/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i && break
162
- test -f $i/include/X11/xpm.h && GD_XPM_DIR=$i && GD_XPM_INC=$i/X11 && break
163
- done
164
-
165
- if test -z "$GD_XPM_DIR"; then
166
- AC_MSG_ERROR ( [ xpm.h not found.] )
167
- fi
168
-
169
- PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
170
- [
171
- PHP_ADD_INCLUDE($GD_XPM_INC)
172
- PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
173
- PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
174
- ] ,[
175
- AC_MSG_ERROR ( [ Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.] )
176
- ] ,[
177
- -L$GD_XPM_DIR/$PHP_LIBDIR -lX11
178
- ] )
179
- else
180
- AC_MSG_RESULT ( If configure fails try -- with-xpm-dir=<DIR> )
69
+ if test "$PHP_XPM" != "no"; then
70
+ PKG_CHECK_MODULES([ XPM] , [ xpm] )
71
+ PHP_EVAL_LIBLINE($XPM_LIBS, GD_SHARED_LIBADD)
72
+ PHP_EVAL_INCLINE($XPM_CFLAGS)
73
+ AC_DEFINE ( HAVE_XPM , 1 , [ ] )
74
+ AC_DEFINE ( HAVE_GD_XPM , 1 , [ ] )
181
75
fi
182
76
] )
183
77
184
78
AC_DEFUN ( [ PHP_GD_FREETYPE2] ,[
185
79
if test "$PHP_FREETYPE" != "no"; then
186
-
187
80
PKG_CHECK_MODULES([ FREETYPE2] , [ freetype2] , [ FREETYPE2_FOUND=true] )
188
81
189
82
PHP_EVAL_INCLINE($FREETYPE2_CFLAGS)
190
83
PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD)
191
- AC_DEFINE ( HAVE_LIBFREETYPE ,1 ,[ ] )
192
- AC_DEFINE ( ENABLE_GD_TTF ,1 ,[ ] )
84
+ AC_DEFINE ( HAVE_LIBFREETYPE , 1 , [ ] )
85
+ AC_DEFINE ( HAVE_GD_FREETYPE , 1 , [ ] )
86
+ AC_DEFINE ( ENABLE_GD_TTF , 1 , [ ] )
193
87
fi
194
88
] )
195
89
196
90
AC_DEFUN ( [ PHP_GD_JISX0208] ,[
197
91
if test "$PHP_GD_JIS_CONV" = "yes"; then
198
- USE_GD_JIS_CONV=1
92
+ AC_DEFINE ( USE_GD_JISX0208 , 1 , [ ] )
93
+ AC_DEFINE ( JISX0208 , 1 , [ ] )
199
94
fi
200
95
] )
201
96
213
108
dnl Main GD configure
214
109
dnl
215
110
216
- dnl
217
- dnl Common for both builtin and external GD
218
- dnl
219
- if test "$PHP_GD" != "no"; then
220
-
221
- dnl PNG is required by GD library
222
- test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes
223
-
224
- dnl Various checks for GD features
225
- PHP_GD_ZLIB
226
- PHP_GD_WEBP
227
- PHP_GD_JPEG
228
- PHP_GD_PNG
229
- PHP_GD_XPM
230
- PHP_GD_FREETYPE2
231
- PHP_GD_JISX0208
232
- fi
233
-
234
111
if test "$PHP_GD" = "yes"; then
235
112
GD_MODULE_TYPE=builtin
113
+ GDLIB_CFLAGS=""
236
114
extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \
237
115
libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_webp.c \
238
116
libgd/gd_png.c libgd/gd_jpeg.c libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c \
@@ -250,53 +128,21 @@ dnl These are always available with bundled library
250
128
AC_DEFINE ( HAVE_GD_BUNDLED , 1 , [ ] )
251
129
AC_DEFINE ( HAVE_GD_PNG , 1 , [ ] )
252
130
AC_DEFINE ( HAVE_GD_BMP , 1 , [ ] )
253
- AC_DEFINE ( HAVE_GD_CACHE_CREATE , 1 , [ ] )
254
-
255
- dnl Make sure the libgd/ is first in the include path
256
- GDLIB_CFLAGS="-DHAVE_LIBPNG"
257
-
258
- dnl Depending which libraries were included to PHP configure,
259
- dnl enable the support in bundled GD library
260
-
261
- if test -n "$GD_WEBP_DIR"; then
262
- AC_DEFINE ( HAVE_GD_WEBP , 1 , [ ] )
263
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBWEBP"
264
- fi
265
-
266
- if test -n "$GD_JPEG_DIR"; then
267
- AC_DEFINE ( HAVE_GD_JPG , 1 , [ ] )
268
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG"
269
- fi
270
-
271
- if test -n "$GD_XPM_DIR"; then
272
- AC_DEFINE ( HAVE_GD_XPM , 1 , [ ] )
273
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM"
274
- fi
275
-
276
- if test -n "$FREETYPE2_FOUND"; then
277
- AC_DEFINE ( HAVE_GD_FREETYPE , 1 , [ ] )
278
- AC_DEFINE ( ENABLE_GD_TTF , 1 , [ ] )
279
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF"
280
- fi
281
-
282
- if test -n "$USE_GD_JIS_CONV"; then
283
- AC_DEFINE ( USE_GD_JISX0208 , 1 , [ ] )
284
- GDLIB_CFLAGS="$GDLIB_CFLAGS -DJISX0208"
285
- fi
286
-
287
- else
288
-
289
- if test "$PHP_GD" != "no"; then
290
- GD_MODULE_TYPE=external
291
- extra_sources="gd_compat.c"
292
131
293
132
dnl Various checks for GD features
294
133
PHP_GD_ZLIB
134
+ PHP_GD_PNG
295
135
PHP_GD_WEBP
296
136
PHP_GD_JPEG
297
- PHP_GD_PNG
298
137
PHP_GD_XPM
299
138
PHP_GD_FREETYPE2
139
+ PHP_GD_JISX0208
140
+
141
+ else
142
+
143
+ if test "$PHP_GD" != "no"; then
144
+ GD_MODULE_TYPE=external
145
+ extra_sources="gd_compat.c"
300
146
301
147
dnl Header path
302
148
for i in include/gd include/gd2 include gd ""; do
0 commit comments