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

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
                    196:       if test -f "$i/include/freetype2/freetype/freetype.h"; then
                    197:         FREETYPE2_DIR=$i
                    198:         FREETYPE2_INC_DIR=$i/include/freetype2
                    199:         break
                    200:       fi
                    201:     done
                    202: 
                    203:     if test -z "$FREETYPE2_DIR"; then
                    204:       AC_MSG_ERROR([freetype.h not found.])
                    205:     fi
                    206: 
                    207:     PHP_CHECK_LIBRARY(freetype, FT_New_Face,
                    208:     [
                    209:       PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
                    210:       PHP_ADD_INCLUDE($FREETYPE2_DIR/include)
                    211:       PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
                    212:       AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
                    213:       AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
                    214:       AC_DEFINE(ENABLE_GD_TTF,1,[ ])
                    215:     ],[
                    216:       AC_MSG_ERROR([Problem with freetype.(a|so). Please check config.log for more information.])
                    217:     ],[
                    218:       -L$FREETYPE2_DIR/$PHP_LIBDIR
                    219:     ])
                    220:   else
                    221:     AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
                    222:   fi
                    223: ])
                    224: 
                    225: AC_DEFUN([PHP_GD_T1LIB],[
                    226:   if test "$PHP_T1LIB" != "no"; then
                    227: 
                    228:     for i in $PHP_T1LIB /usr/local /usr; do
                    229:       test -f "$i/include/t1lib.h" && GD_T1_DIR=$i && break
                    230:     done
                    231: 
                    232:     if test -z "$GD_T1_DIR"; then
                    233:       AC_MSG_ERROR([Your t1lib distribution is not installed correctly. Please reinstall it.])
                    234:     fi
                    235: 
                    236:     PHP_CHECK_LIBRARY(t1, T1_StrError,
                    237:     [
                    238:       AC_DEFINE(HAVE_LIBT1,1,[ ])
                    239:       PHP_ADD_INCLUDE($GD_T1_DIR/include)
                    240:       PHP_ADD_LIBRARY_WITH_PATH(t1, $GD_T1_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
                    241:     ],[
                    242:       AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.])
                    243:     ],[
                    244:       -L$GD_T1_DIR/$PHP_LIBDIR
                    245:     ])
                    246:   fi
                    247: ])
                    248: 
                    249: AC_DEFUN([PHP_GD_TTSTR],[
                    250:   if test "$PHP_GD_NATIVE_TTF" = "yes"; then
                    251:     AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
                    252:   fi
                    253: ])
                    254: 
                    255: AC_DEFUN([PHP_GD_JISX0208],[
                    256:   if test "$PHP_GD_JIS_CONV" = "yes"; then
                    257:     USE_GD_JIS_CONV=1
                    258:   fi
                    259: ])
                    260: 
                    261: AC_DEFUN([PHP_GD_CHECK_VERSION],[
                    262:   PHP_CHECK_LIBRARY(gd, gdImageString16,        [AC_DEFINE(HAVE_LIBGD13,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    263:   PHP_CHECK_LIBRARY(gd, gdImagePaletteCopy,     [AC_DEFINE(HAVE_LIBGD15,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    264:   PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng,   [AC_DEFINE(HAVE_GD_PNG,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    265:   PHP_CHECK_LIBRARY(gd, gdImageCreateFromGif,   [AC_DEFINE(HAVE_GD_GIF_READ,         1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    266:   PHP_CHECK_LIBRARY(gd, gdImageGif,             [AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    267:   PHP_CHECK_LIBRARY(gd, gdImageWBMP,            [AC_DEFINE(HAVE_GD_WBMP,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    268:   PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg,  [AC_DEFINE(HAVE_GD_JPG,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    269:   PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm,   [AC_DEFINE(HAVE_GD_XPM,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    270:   PHP_CHECK_LIBRARY(gd, gdImageCreateFromGd2,   [AC_DEFINE(HAVE_GD_GD2,              1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    271:   PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20,             1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    272:   PHP_CHECK_LIBRARY(gd, gdImageSetTile,         [AC_DEFINE(HAVE_GD_IMAGESETTILE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    273:   PHP_CHECK_LIBRARY(gd, gdImageEllipse,         [AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    274:   PHP_CHECK_LIBRARY(gd, gdImageSetBrush,        [AC_DEFINE(HAVE_GD_IMAGESETBRUSH,    1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    275:   PHP_CHECK_LIBRARY(gd, gdImageStringTTF,       [AC_DEFINE(HAVE_GD_STRINGTTF,        1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    276:   PHP_CHECK_LIBRARY(gd, gdImageStringFT,        [AC_DEFINE(HAVE_GD_STRINGFT,         1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    277:   PHP_CHECK_LIBRARY(gd, gdImageStringFTEx,      [AC_DEFINE(HAVE_GD_STRINGFTEX,       1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    278:   PHP_CHECK_LIBRARY(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    279:   PHP_CHECK_LIBRARY(gd, gdImageColorResolve,    [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    280:   PHP_CHECK_LIBRARY(gd, gdImageGifCtx,          [AC_DEFINE(HAVE_GD_GIF_CTX,          1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    281:   PHP_CHECK_LIBRARY(gd, gdCacheCreate,          [AC_DEFINE(HAVE_GD_CACHE_CREATE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    282:   PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown,    [AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    283:   PHP_CHECK_LIBRARY(gd, gdFreeFontCache,        [AC_DEFINE(HAVE_GD_FREEFONTCACHE,    1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    284:   PHP_CHECK_LIBRARY(gd, gdFontCacheMutexSetup,  [AC_DEFINE(HAVE_GD_FONTMUTEX,        1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    285:   PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx,      [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    286: ])
                    287: 
                    288: dnl
                    289: dnl Main GD configure
                    290: dnl
                    291: 
                    292: if test "$PHP_GD" = "yes"; then
                    293:   GD_MODULE_TYPE=builtin
                    294:   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     295:                  libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/webpimg.c libgd/gd_webp.c \
        !           296:                  libgd/gd_png.c libgd/gd_jpeg.c libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c \
        !           297:                  libgd/gdfontmb.c libgd/gdfontl.c libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c \
        !           298:                  libgd/gdcache.c libgd/gdkanji.c libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c \
        !           299:                  libgd/gd_topal.c libgd/gd_gif_in.c libgd/xbm.c libgd/gd_gif_out.c libgd/gd_security.c \
        !           300:                  libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c"
1.1       misho     301: 
                    302: dnl check for fabsf and floorf which are available since C99
                    303:   AC_CHECK_FUNCS(fabsf floorf)
                    304: 
                    305: dnl PNG is required by GD library
                    306:   test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes
                    307: 
                    308: dnl Various checks for GD features
                    309:   PHP_GD_ZLIB
                    310:   PHP_GD_TTSTR
                    311:   PHP_GD_JISX0208
                    312:   PHP_GD_JPEG
1.1.1.2 ! misho     313:   PHP_GD_VPX
1.1       misho     314:   PHP_GD_PNG
                    315:   PHP_GD_XPM
                    316:   PHP_GD_FREETYPE2
                    317:   PHP_GD_T1LIB
                    318: 
                    319: dnl These are always available with bundled library
                    320:   AC_DEFINE(HAVE_LIBGD,               1, [ ])
                    321:   AC_DEFINE(HAVE_LIBGD13,             1, [ ])
                    322:   AC_DEFINE(HAVE_LIBGD15,             1, [ ])
                    323:   AC_DEFINE(HAVE_LIBGD20,             1, [ ])
                    324:   AC_DEFINE(HAVE_LIBGD204,            1, [ ])
                    325:   AC_DEFINE(HAVE_GD_IMAGESETTILE,     1, [ ])
                    326:   AC_DEFINE(HAVE_GD_IMAGESETBRUSH,    1, [ ])
                    327:   AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])
                    328:   AC_DEFINE(HAVE_COLORCLOSESTHWB,     1, [ ])
                    329:   AC_DEFINE(HAVE_GD_WBMP,             1, [ ])
                    330:   AC_DEFINE(HAVE_GD_GD2,              1, [ ])
                    331:   AC_DEFINE(HAVE_GD_PNG,              1, [ ])
                    332:   AC_DEFINE(HAVE_GD_XBM,              1, [ ])
                    333:   AC_DEFINE(HAVE_GD_BUNDLED,          1, [ ])
                    334:   AC_DEFINE(HAVE_GD_GIF_READ,         1, [ ])
                    335:   AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])
                    336:   AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])
                    337:   AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])
                    338:   AC_DEFINE(HAVE_GD_FONTMUTEX,        1, [ ])
                    339:   AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])
                    340:   AC_DEFINE(HAVE_GD_GIF_CTX,          1, [ ])
                    341: 
                    342: dnl Make sure the libgd/ is first in the include path
                    343:   GDLIB_CFLAGS="-DHAVE_LIBPNG"
                    344: 
                    345: dnl Depending which libraries were included to PHP configure,
                    346: dnl enable the support in bundled GD library
                    347: 
1.1.1.2 ! misho     348:   if test -n "$GD_VPX_DIR"; then
        !           349:     AC_DEFINE(HAVE_GD_WEBP, 1, [ ])
        !           350:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBVPX"
        !           351:   fi
        !           352: 
1.1       misho     353:   if test -n "$GD_JPEG_DIR"; then
                    354:     AC_DEFINE(HAVE_GD_JPG, 1, [ ])
                    355:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG"
                    356:   fi
                    357: 
                    358:   if test -n "$GD_XPM_DIR"; then
                    359:     AC_DEFINE(HAVE_GD_XPM, 1, [ ])
                    360:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM"
                    361:   fi
                    362: 
                    363:   if test -n "$FREETYPE2_DIR"; then
                    364:     AC_DEFINE(HAVE_GD_STRINGFT,   1, [ ])
                    365:     AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])
                    366:     AC_DEFINE(ENABLE_GD_TTF, 1, [ ])
                    367:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF"
                    368:   fi
                    369: 
                    370:   if test -n "$USE_GD_JIS_CONV"; then
                    371:     AC_DEFINE(USE_GD_JISX0208, 1, [ ])
                    372:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DJISX0208"
                    373:   fi
                    374: 
                    375: else
                    376: 
                    377:  if test "$PHP_GD" != "no"; then
                    378:   GD_MODULE_TYPE=external
                    379:   extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c \
                    380:                  libgd/gd_rotate.c libgd/gd_color.c"
                    381: 
                    382: dnl Various checks for GD features
                    383:   PHP_GD_ZLIB
                    384:   PHP_GD_TTSTR
1.1.1.2 ! misho     385:   PHP_GD_VPX
1.1       misho     386:   PHP_GD_JPEG
                    387:   PHP_GD_PNG
                    388:   PHP_GD_XPM
                    389:   PHP_GD_FREETYPE2
                    390:   PHP_GD_T1LIB
                    391: 
                    392: dnl Header path
                    393:   for i in include/gd1.3 include/gd include gd1.3 gd ""; do
                    394:     test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i"
                    395:   done
                    396: 
                    397: dnl Library path
                    398:   for i in $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do
                    399:     test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" || test -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
                    400:   done
                    401: 
                    402:   if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then
                    403:     PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
                    404:     AC_DEFINE(HAVE_LIBGD,1,[ ])
                    405:     PHP_GD_CHECK_VERSION
                    406:   elif test -z "$GD_INCLUDE"; then
                    407:     AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD])
                    408:   else
                    409:     AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $PHP_GD])
                    410:   fi
                    411: 
                    412:   PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
                    413: 
                    414:   dnl
                    415:   dnl Check for gd 2.0.4 greater availability
                    416:   dnl
                    417:   old_CPPFLAGS=$CPPFLAGS
                    418:   CPPFLAGS=-I$GD_INCLUDE
                    419:   AC_TRY_COMPILE([
                    420: #include <gd.h>
                    421: #include <stdlib.h>
                    422:   ], [
                    423: gdIOCtx *ctx;
                    424: ctx = malloc(sizeof(gdIOCtx));
                    425: ctx->gd_free = 1;
                    426:   ], [
                    427:     AC_DEFINE(HAVE_LIBGD204, 1, [ ])
                    428:   ])
                    429:   CPPFLAGS=$old_CPPFLAGS
                    430: 
                    431:  fi
                    432: fi
                    433: 
                    434: dnl
                    435: dnl Common for both builtin and external GD
                    436: dnl
                    437: if test "$PHP_GD" != "no"; then
                    438:   PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS))
                    439: 
                    440:   PHP_ADD_BUILD_DIR($ext_builddir/libgd)
                    441: 
                    442:   if test "$GD_MODULE_TYPE" = "builtin"; then
                    443:     GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
                    444:     GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/"
                    445: 
                    446:     PHP_TEST_BUILD(foobar, [], [
                    447:       AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
                    448:     ], [ $GD_SHARED_LIBADD ], [char foobar () {}])
                    449:   else
                    450:     GD_HEADER_DIRS="ext/gd/"
                    451:     GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS"
                    452:     PHP_ADD_INCLUDE($GD_INCLUDE)
                    453:     PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [
                    454:       AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
                    455:     ], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    456:   fi
                    457: 
                    458:   PHP_INSTALL_HEADERS([$GD_HEADER_DIRS])
                    459:   PHP_SUBST(GDLIB_CFLAGS)
                    460:   PHP_SUBST(GD_SHARED_LIBADD)
                    461: fi

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