xref: /PHP-5.3/ext/gd/config.m4 (revision 224a67fb)
1dnl
2dnl $Id$
3dnl
4
5dnl
6dnl Configure options
7dnl
8
9PHP_ARG_WITH(gd, for GD support,
10[  --with-gd[=DIR]         Include GD support.  DIR is the GD library base
11                          install directory [BUNDLED]])
12
13if test -z "$PHP_JPEG_DIR"; then
14  PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
15  [  --with-jpeg-dir[=DIR]     GD: Set the path to libjpeg install prefix], no, no)
16fi
17
18if test -z "$PHP_PNG_DIR"; then
19  PHP_ARG_WITH(png-dir, for the location of libpng,
20  [  --with-png-dir[=DIR]      GD: Set the path to libpng install prefix], no, no)
21fi
22
23if test -z "$PHP_ZLIB_DIR"; then
24  PHP_ARG_WITH(zlib-dir, for the location of libz,
25  [  --with-zlib-dir[=DIR]     GD: Set the path to libz install prefix], no, no)
26fi
27
28PHP_ARG_WITH(xpm-dir, for the location of libXpm,
29[  --with-xpm-dir[=DIR]      GD: Set the path to libXpm install prefix], no, no)
30
31PHP_ARG_WITH(freetype-dir, for FreeType 2,
32[  --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix], no, no)
33
34PHP_ARG_WITH(t1lib, for T1lib support,
35[  --with-t1lib[=DIR]        GD: Include T1lib support. T1lib version >= 5.0.0 required], no, no)
36
37PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD,
38[  --enable-gd-native-ttf    GD: Enable TrueType string function], no, no)
39
40PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD,
41[  --enable-gd-jis-conv      GD: Enable JIS-mapped Japanese font support], no, no)
42
43dnl
44dnl Checks for the configure options
45dnl
46
47AC_DEFUN([PHP_GD_ZLIB],[
48	if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
49		if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
50			PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
51			PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
52		elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
53			PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
54			PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
55		else
56			AC_MSG_ERROR([Can't find zlib headers under "$PHP_ZLIB_DIR"])
57		fi
58	else
59		for i in /usr/local /usr; do
60			if test -f "$i/include/zlib/zlib.h"; then
61				PHP_ZLIB_DIR="$i"
62				PHP_ZLIB_INCDIR="$i/include/zlib"
63			elif test -f "$i/include/zlib.h"; then
64				PHP_ZLIB_DIR="$i"
65				PHP_ZLIB_INCDIR="$i/include"
66			fi
67		done
68	fi
69])
70
71AC_DEFUN([PHP_GD_JPEG],[
72  if test "$PHP_JPEG_DIR" != "no"; then
73
74    for i in $PHP_JPEG_DIR /usr/local /usr; do
75      test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break
76    done
77
78    if test -z "$GD_JPEG_DIR"; then
79      AC_MSG_ERROR([jpeglib.h not found.])
80    fi
81
82    PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
83    [
84      PHP_ADD_INCLUDE($GD_JPEG_DIR/include)
85      PHP_ADD_LIBRARY_WITH_PATH(jpeg, $GD_JPEG_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
86    ],[
87      AC_MSG_ERROR([Problem with libjpeg.(a|so). Please check config.log for more information.])
88    ],[
89      -L$GD_JPEG_DIR/$PHP_LIBDIR
90    ])
91  else
92    AC_MSG_RESULT([If configure fails try --with-jpeg-dir=<DIR>])
93  fi
94])
95
96AC_DEFUN([PHP_GD_PNG],[
97  if test "$PHP_PNG_DIR" != "no"; then
98
99    for i in $PHP_PNG_DIR /usr/local /usr; do
100      test -f $i/include/png.h && GD_PNG_DIR=$i && break
101    done
102
103    if test -z "$GD_PNG_DIR"; then
104      AC_MSG_ERROR([png.h not found.])
105    fi
106
107    if test "$PHP_ZLIB_DIR" = "no"; then
108      AC_MSG_ERROR([PNG support requires ZLIB. Use --with-zlib-dir=<DIR>])
109    fi
110
111    PHP_CHECK_LIBRARY(png,png_write_image,
112    [
113      PHP_ADD_INCLUDE($GD_PNG_DIR/include)
114      PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
115      PHP_ADD_LIBRARY_WITH_PATH(png, $GD_PNG_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
116    ],[
117      AC_MSG_ERROR([Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.])
118    ],[
119      -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz -L$GD_PNG_DIR/$PHP_LIBDIR
120    ])
121
122  else
123    AC_MSG_RESULT([If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>])
124  fi
125])
126
127AC_DEFUN([PHP_GD_XPM],[
128  if test "$PHP_XPM_DIR" != "no"; then
129
130    for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
131      test -f $i/$PHP_LIBDIR/libXpm.$SHLIB_SUFFIX_NAME || test -f $i/$PHP_LIBDIR/libXpm.a && GD_XPM_DIR=$i && break
132    done
133
134    if test -z "$GD_XPM_DIR"; then
135      AC_MSG_ERROR([libXpm.(a|so) not found.])
136    fi
137
138    for i in include include/X11; do
139      test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include
140    done
141
142    if test -z "$GD_XPM_INC"; then
143      AC_MSG_ERROR([xpm.h not found.])
144    fi
145
146    PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
147    [
148      PHP_ADD_INCLUDE($GD_XPM_INC)
149      PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
150      PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
151    ],[
152      AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
153    ],[
154      -L$GD_XPM_DIR/$PHP_LIBDIR -lX11
155    ])
156  else
157    AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>)
158  fi
159])
160
161AC_DEFUN([PHP_GD_FREETYPE2],[
162  if test "$PHP_FREETYPE_DIR" != "no"; then
163
164    for i in $PHP_FREETYPE_DIR /usr/local /usr; do
165      if test -f "$i/include/freetype2/freetype/freetype.h"; then
166        FREETYPE2_DIR=$i
167        FREETYPE2_INC_DIR=$i/include/freetype2
168        break
169      fi
170    done
171
172    if test -z "$FREETYPE2_DIR"; then
173      AC_MSG_ERROR([freetype.h not found.])
174    fi
175
176    PHP_CHECK_LIBRARY(freetype, FT_New_Face,
177    [
178      PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
179      PHP_ADD_INCLUDE($FREETYPE2_DIR/include)
180      PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
181      AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
182      AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
183      AC_DEFINE(ENABLE_GD_TTF,1,[ ])
184    ],[
185      AC_MSG_ERROR([Problem with freetype.(a|so). Please check config.log for more information.])
186    ],[
187      -L$FREETYPE2_DIR/$PHP_LIBDIR
188    ])
189  else
190    AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
191  fi
192])
193
194AC_DEFUN([PHP_GD_T1LIB],[
195  if test "$PHP_T1LIB" != "no"; then
196
197    for i in $PHP_T1LIB /usr/local /usr; do
198      test -f "$i/include/t1lib.h" && GD_T1_DIR=$i && break
199    done
200
201    if test -z "$GD_T1_DIR"; then
202      AC_MSG_ERROR([Your t1lib distribution is not installed correctly. Please reinstall it.])
203    fi
204
205    PHP_CHECK_LIBRARY(t1, T1_StrError,
206    [
207      AC_DEFINE(HAVE_LIBT1,1,[ ])
208      PHP_ADD_INCLUDE($GD_T1_DIR/include)
209      PHP_ADD_LIBRARY_WITH_PATH(t1, $GD_T1_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
210    ],[
211      AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.])
212    ],[
213      -L$GD_T1_DIR/$PHP_LIBDIR
214    ])
215  fi
216])
217
218AC_DEFUN([PHP_GD_TTSTR],[
219  if test "$PHP_GD_NATIVE_TTF" = "yes"; then
220    AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
221  fi
222])
223
224AC_DEFUN([PHP_GD_JISX0208],[
225  if test "$PHP_GD_JIS_CONV" = "yes"; then
226    USE_GD_JIS_CONV=1
227  fi
228])
229
230AC_DEFUN([PHP_GD_CHECK_VERSION],[
231  PHP_CHECK_LIBRARY(gd, gdImageString16,        [AC_DEFINE(HAVE_LIBGD13,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
232  PHP_CHECK_LIBRARY(gd, gdImagePaletteCopy,     [AC_DEFINE(HAVE_LIBGD15,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
233  PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng,   [AC_DEFINE(HAVE_GD_PNG,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
234  PHP_CHECK_LIBRARY(gd, gdImageCreateFromGif,   [AC_DEFINE(HAVE_GD_GIF_READ,         1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
235  PHP_CHECK_LIBRARY(gd, gdImageGif,             [AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
236  PHP_CHECK_LIBRARY(gd, gdImageWBMP,            [AC_DEFINE(HAVE_GD_WBMP,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
237  PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg,  [AC_DEFINE(HAVE_GD_JPG,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
238  PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm,   [AC_DEFINE(HAVE_GD_XPM,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
239  PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2,   [AC_DEFINE(HAVE_GD_GD2,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
240  PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
241  PHP_CHECK_LIBRARY(gd, gdImageSetTile,         [AC_DEFINE(HAVE_GD_IMAGESETTILE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
242  PHP_CHECK_LIBRARY(gd, gdImageEllipse,         [AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
243  PHP_CHECK_LIBRARY(gd, gdImageSetBrush,        [AC_DEFINE(HAVE_GD_IMAGESETBRUSH,    1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
244  PHP_CHECK_LIBRARY(gd, gdImageStringTTF,       [AC_DEFINE(HAVE_GD_STRINGTTF,        1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
245  PHP_CHECK_LIBRARY(gd, gdImageStringFT,        [AC_DEFINE(HAVE_GD_STRINGFT,         1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
246  PHP_CHECK_LIBRARY(gd, gdImageStringFTEx,      [AC_DEFINE(HAVE_GD_STRINGFTEX,       1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
247  PHP_CHECK_LIBRARY(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
248  PHP_CHECK_LIBRARY(gd, gdImageColorResolve,    [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
249  PHP_CHECK_LIBRARY(gd, gdImageGifCtx,          [AC_DEFINE(HAVE_GD_GIF_CTX,          1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
250  PHP_CHECK_LIBRARY(gd, gdCacheCreate,          [AC_DEFINE(HAVE_GD_CACHE_CREATE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
251  PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown,    [AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
252  PHP_CHECK_LIBRARY(gd, gdFreeFontCache,        [AC_DEFINE(HAVE_GD_FREEFONTCACHE,    1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
253  PHP_CHECK_LIBRARY(gd, gdFontCacheMutexSetup,  [AC_DEFINE(HAVE_GD_FONTMUTEX,        1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
254  PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx,      [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
255  PHP_CHECK_LIBRARY(gd, gdImageConvolution,     [AC_DEFINE(HAVE_GD_IMAGE_CONVOLUTION,      1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
256  PHP_CHECK_LIBRARY(gd, gdImagePixelate,        [AC_DEFINE(HAVE_GD_IMAGE_PIXELATE,         1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
257])
258
259dnl
260dnl Main GD configure
261dnl
262
263if test "$PHP_GD" = "yes"; then
264  GD_MODULE_TYPE=builtin
265  extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \
266                 libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_png.c libgd/gd_jpeg.c \
267                 libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
268                 libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
269                 libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \
270                 libgd/xbm.c libgd/gd_gif_out.c libgd/gd_security.c libgd/gd_filter.c \
271                 libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c"
272
273dnl check for fabsf and floorf which are available since C99
274  AC_CHECK_FUNCS(fabsf floorf)
275
276dnl PNG is required by GD library
277  test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes
278
279dnl Various checks for GD features
280  PHP_GD_ZLIB
281  PHP_GD_TTSTR
282  PHP_GD_JISX0208
283  PHP_GD_JPEG
284  PHP_GD_PNG
285  PHP_GD_XPM
286  PHP_GD_FREETYPE2
287  PHP_GD_T1LIB
288
289dnl These are always available with bundled library
290  AC_DEFINE(HAVE_LIBGD,               1, [ ])
291  AC_DEFINE(HAVE_LIBGD13,             1, [ ])
292  AC_DEFINE(HAVE_LIBGD15,             1, [ ])
293  AC_DEFINE(HAVE_LIBGD20,             1, [ ])
294  AC_DEFINE(HAVE_LIBGD204,            1, [ ])
295  AC_DEFINE(HAVE_GD_IMAGESETTILE,     1, [ ])
296  AC_DEFINE(HAVE_GD_IMAGESETBRUSH,    1, [ ])
297  AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])
298  AC_DEFINE(HAVE_COLORCLOSESTHWB,     1, [ ])
299  AC_DEFINE(HAVE_GD_WBMP,             1, [ ])
300  AC_DEFINE(HAVE_GD_GD2,              1, [ ])
301  AC_DEFINE(HAVE_GD_PNG,              1, [ ])
302  AC_DEFINE(HAVE_GD_XBM,              1, [ ])
303  AC_DEFINE(HAVE_GD_BUNDLED,          1, [ ])
304  AC_DEFINE(HAVE_GD_GIF_READ,         1, [ ])
305  AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])
306  AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])
307  AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])
308  AC_DEFINE(HAVE_GD_FONTMUTEX,        1, [ ])
309  AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])
310  AC_DEFINE(HAVE_GD_GIF_CTX,          1, [ ])
311
312dnl Make sure the libgd/ is first in the include path
313  GDLIB_CFLAGS="-DHAVE_LIBPNG"
314
315dnl Depending which libraries were included to PHP configure,
316dnl enable the support in bundled GD library
317
318  if test -n "$GD_JPEG_DIR"; then
319    AC_DEFINE(HAVE_GD_JPG, 1, [ ])
320    GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG"
321  fi
322
323  if test -n "$GD_XPM_DIR"; then
324    AC_DEFINE(HAVE_GD_XPM, 1, [ ])
325    GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM"
326  fi
327
328  if test -n "$FREETYPE2_DIR"; then
329    AC_DEFINE(HAVE_GD_STRINGFT,   1, [ ])
330    AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])
331    AC_DEFINE(ENABLE_GD_TTF, 1, [ ])
332    GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF"
333  fi
334
335  if test -n "$USE_GD_JIS_CONV"; then
336    AC_DEFINE(USE_GD_JISX0208, 1, [ ])
337    GDLIB_CFLAGS="$GDLIB_CFLAGS -DJISX0208"
338  fi
339
340else
341
342 if test "$PHP_GD" != "no"; then
343  GD_MODULE_TYPE=external
344  extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c \
345                 libgd/gd_rotate.c libgd/gd_color.c"
346
347dnl Various checks for GD features
348  PHP_GD_ZLIB
349  PHP_GD_TTSTR
350  PHP_GD_JPEG
351  PHP_GD_PNG
352  PHP_GD_XPM
353  PHP_GD_FREETYPE2
354  PHP_GD_T1LIB
355
356dnl Header path
357  for i in include/gd1.3 include/gd include gd1.3 gd ""; do
358    test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i"
359  done
360
361dnl Library path
362  for i in $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do
363    test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" || test -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
364  done
365
366  if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then
367    PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
368    AC_DEFINE(HAVE_LIBGD,1,[ ])
369    PHP_GD_CHECK_VERSION
370  elif test -z "$GD_INCLUDE"; then
371    AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD])
372  else
373    AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $PHP_GD])
374  fi
375
376  PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
377
378  dnl
379  dnl Check for gd 2.0.4 greater availability
380  dnl
381  old_CPPFLAGS=$CPPFLAGS
382  CPPFLAGS=-I$GD_INCLUDE
383  AC_TRY_COMPILE([
384#include <gd.h>
385#include <stdlib.h>
386  ], [
387gdIOCtx *ctx;
388ctx = malloc(sizeof(gdIOCtx));
389ctx->gd_free = 1;
390  ], [
391    AC_DEFINE(HAVE_LIBGD204, 1, [ ])
392  ])
393  CPPFLAGS=$old_CPPFLAGS
394
395 fi
396fi
397
398dnl
399dnl Common for both builtin and external GD
400dnl
401if test "$PHP_GD" != "no"; then
402  PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS))
403
404  PHP_ADD_BUILD_DIR($ext_builddir/libgd)
405
406  if test "$GD_MODULE_TYPE" = "builtin"; then
407    GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
408    GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/"
409
410    PHP_TEST_BUILD(foobar, [], [
411      AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
412    ], [ $GD_SHARED_LIBADD ], [char foobar () {}])
413  else
414    GD_HEADER_DIRS="ext/gd/"
415    GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS"
416    PHP_ADD_INCLUDE($GD_INCLUDE)
417    PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [
418      AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
419    ], [ -L$GD_LIB $GD_SHARED_LIBADD ])
420  fi
421
422  PHP_INSTALL_HEADERS([$GD_HEADER_DIRS])
423  PHP_SUBST(GDLIB_CFLAGS)
424  PHP_SUBST(GD_SHARED_LIBADD)
425fi
426