Annotation of embedaddon/php/ext/gd/config.m4, revision 1.1.1.4

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>