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

1.1       misho       1: dnl
                      2: dnl $Id: config.m4 310964 2011-05-12 08:19:37Z rasmus $
                      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: 
                     13: if 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)
                     16: fi
                     17: 
                     18: if 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)
                     21: fi
                     22: 
                     23: if 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)
                     26: fi
                     27: 
                     28: PHP_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: 
                     31: PHP_ARG_WITH(freetype-dir, for FreeType 2,
                     32: [  --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix], no, no)
                     33: 
                     34: PHP_ARG_WITH(t1lib, for T1lib support,
                     35: [  --with-t1lib[=DIR]        GD: Include T1lib support. T1lib version >= 5.0.0 required], no, no)
                     36: 
                     37: PHP_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: 
                     40: PHP_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: 
                     43: dnl
                     44: dnl Checks for the configure options
                     45: dnl
                     46: 
                     47: AC_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: 
                     71: AC_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: 
                     96: AC_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: 
                    127: AC_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: 
                    161: AC_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: 
                    194: AC_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: 
                    218: AC_DEFUN([PHP_GD_TTSTR],[
                    219:   if test "$PHP_GD_NATIVE_TTF" = "yes"; then
                    220:     AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
                    221:   fi
                    222: ])
                    223: 
                    224: AC_DEFUN([PHP_GD_JISX0208],[
                    225:   if test "$PHP_GD_JIS_CONV" = "yes"; then
                    226:     USE_GD_JIS_CONV=1
                    227:   fi
                    228: ])
                    229: 
                    230: AC_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: ])
                    256: 
                    257: dnl
                    258: dnl Main GD configure
                    259: dnl
                    260: 
                    261: if test "$PHP_GD" = "yes"; then
                    262:   GD_MODULE_TYPE=builtin
                    263:   extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \
                    264:                  libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_png.c libgd/gd_jpeg.c \
                    265:                  libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
                    266:                  libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
                    267:                  libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \
                    268:                  libgd/xbm.c libgd/gd_gif_out.c libgd/gd_security.c libgd/gd_filter.c \
                    269:                  libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c"
                    270: 
                    271: dnl check for fabsf and floorf which are available since C99
                    272:   AC_CHECK_FUNCS(fabsf floorf)
                    273: 
                    274: dnl PNG is required by GD library
                    275:   test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes
                    276: 
                    277: dnl Various checks for GD features
                    278:   PHP_GD_ZLIB
                    279:   PHP_GD_TTSTR
                    280:   PHP_GD_JISX0208
                    281:   PHP_GD_JPEG
                    282:   PHP_GD_PNG
                    283:   PHP_GD_XPM
                    284:   PHP_GD_FREETYPE2
                    285:   PHP_GD_T1LIB
                    286: 
                    287: dnl These are always available with bundled library
                    288:   AC_DEFINE(HAVE_LIBGD,               1, [ ])
                    289:   AC_DEFINE(HAVE_LIBGD13,             1, [ ])
                    290:   AC_DEFINE(HAVE_LIBGD15,             1, [ ])
                    291:   AC_DEFINE(HAVE_LIBGD20,             1, [ ])
                    292:   AC_DEFINE(HAVE_LIBGD204,            1, [ ])
                    293:   AC_DEFINE(HAVE_GD_IMAGESETTILE,     1, [ ])
                    294:   AC_DEFINE(HAVE_GD_IMAGESETBRUSH,    1, [ ])
                    295:   AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])
                    296:   AC_DEFINE(HAVE_COLORCLOSESTHWB,     1, [ ])
                    297:   AC_DEFINE(HAVE_GD_WBMP,             1, [ ])
                    298:   AC_DEFINE(HAVE_GD_GD2,              1, [ ])
                    299:   AC_DEFINE(HAVE_GD_PNG,              1, [ ])
                    300:   AC_DEFINE(HAVE_GD_XBM,              1, [ ])
                    301:   AC_DEFINE(HAVE_GD_BUNDLED,          1, [ ])
                    302:   AC_DEFINE(HAVE_GD_GIF_READ,         1, [ ])
                    303:   AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])
                    304:   AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])
                    305:   AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])
                    306:   AC_DEFINE(HAVE_GD_FONTMUTEX,        1, [ ])
                    307:   AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])
                    308:   AC_DEFINE(HAVE_GD_GIF_CTX,          1, [ ])
                    309: 
                    310: dnl Make sure the libgd/ is first in the include path
                    311:   GDLIB_CFLAGS="-DHAVE_LIBPNG"
                    312: 
                    313: dnl Depending which libraries were included to PHP configure,
                    314: dnl enable the support in bundled GD library
                    315: 
                    316:   if test -n "$GD_JPEG_DIR"; then
                    317:     AC_DEFINE(HAVE_GD_JPG, 1, [ ])
                    318:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBJPEG"
                    319:   fi
                    320: 
                    321:   if test -n "$GD_XPM_DIR"; then
                    322:     AC_DEFINE(HAVE_GD_XPM, 1, [ ])
                    323:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_XPM"
                    324:   fi
                    325: 
                    326:   if test -n "$FREETYPE2_DIR"; then
                    327:     AC_DEFINE(HAVE_GD_STRINGFT,   1, [ ])
                    328:     AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])
                    329:     AC_DEFINE(ENABLE_GD_TTF, 1, [ ])
                    330:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DHAVE_LIBFREETYPE -DENABLE_GD_TTF"
                    331:   fi
                    332: 
                    333:   if test -n "$USE_GD_JIS_CONV"; then
                    334:     AC_DEFINE(USE_GD_JISX0208, 1, [ ])
                    335:     GDLIB_CFLAGS="$GDLIB_CFLAGS -DJISX0208"
                    336:   fi
                    337: 
                    338: else
                    339: 
                    340:  if test "$PHP_GD" != "no"; then
                    341:   GD_MODULE_TYPE=external
                    342:   extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c \
                    343:                  libgd/gd_rotate.c libgd/gd_color.c"
                    344: 
                    345: dnl Various checks for GD features
                    346:   PHP_GD_ZLIB
                    347:   PHP_GD_TTSTR
                    348:   PHP_GD_JPEG
                    349:   PHP_GD_PNG
                    350:   PHP_GD_XPM
                    351:   PHP_GD_FREETYPE2
                    352:   PHP_GD_T1LIB
                    353: 
                    354: dnl Header path
                    355:   for i in include/gd1.3 include/gd include gd1.3 gd ""; do
                    356:     test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i"
                    357:   done
                    358: 
                    359: dnl Library path
                    360:   for i in $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do
                    361:     test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" || test -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
                    362:   done
                    363: 
                    364:   if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then
                    365:     PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
                    366:     AC_DEFINE(HAVE_LIBGD,1,[ ])
                    367:     PHP_GD_CHECK_VERSION
                    368:   elif test -z "$GD_INCLUDE"; then
                    369:     AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD])
                    370:   else
                    371:     AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $PHP_GD])
                    372:   fi
                    373: 
                    374:   PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
                    375: 
                    376:   dnl
                    377:   dnl Check for gd 2.0.4 greater availability
                    378:   dnl
                    379:   old_CPPFLAGS=$CPPFLAGS
                    380:   CPPFLAGS=-I$GD_INCLUDE
                    381:   AC_TRY_COMPILE([
                    382: #include <gd.h>
                    383: #include <stdlib.h>
                    384:   ], [
                    385: gdIOCtx *ctx;
                    386: ctx = malloc(sizeof(gdIOCtx));
                    387: ctx->gd_free = 1;
                    388:   ], [
                    389:     AC_DEFINE(HAVE_LIBGD204, 1, [ ])
                    390:   ])
                    391:   CPPFLAGS=$old_CPPFLAGS
                    392: 
                    393:  fi
                    394: fi
                    395: 
                    396: dnl
                    397: dnl Common for both builtin and external GD
                    398: dnl
                    399: if test "$PHP_GD" != "no"; then
                    400:   PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS))
                    401: 
                    402:   PHP_ADD_BUILD_DIR($ext_builddir/libgd)
                    403: 
                    404:   if test "$GD_MODULE_TYPE" = "builtin"; then
                    405:     GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
                    406:     GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/"
                    407: 
                    408:     PHP_TEST_BUILD(foobar, [], [
                    409:       AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
                    410:     ], [ $GD_SHARED_LIBADD ], [char foobar () {}])
                    411:   else
                    412:     GD_HEADER_DIRS="ext/gd/"
                    413:     GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS"
                    414:     PHP_ADD_INCLUDE($GD_INCLUDE)
                    415:     PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [
                    416:       AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
                    417:     ], [ -L$GD_LIB $GD_SHARED_LIBADD ])
                    418:   fi
                    419: 
                    420:   PHP_INSTALL_HEADERS([$GD_HEADER_DIRS])
                    421:   PHP_SUBST(GDLIB_CFLAGS)
                    422:   PHP_SUBST(GD_SHARED_LIBADD)
                    423: fi

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