Articles November 3, 2004 at 3:17 pm

Compiling PHP4, PHP5, or GD on Mac OS X

Updated PHP and GD install instruction

Dale Walsh has submitted updated installation info which includes PHP5 and a more informative gd_info() routine.

UPDATED 12/05/2004



    1. – Introduction and Prerequisites

    2. – (Optional) Building dlcompat
    3. – Getting the archives
    4. – Unpacking the archives
    5. – Building curl
    6. – Building expat
    7. – Building zlib
    8. – Building libpng
    9. – Building libjpeg
    10. – Building freetype2
    11. – Building GD (not required if building php)
    12. – Building PHP
        a) – PHP4

        b) – PHP5

    13. – Testing GD

    14. – Cleaning up
    15. – Better gd_info()



  1. – Introduction and Prerequisites

    This document explains (in the prescriptive, somewhat haughty tone characteristic of other HOWTOS) in a step-by-step fashion the procedure for compiling and installing GD 2.0.28. However, this HOWTO also assumes a more-than-passing acquaintance with the Mac OS X Terminal application and the UNIX command line.

    Also, and this might seem obvious, it is imperative to have installed the Mac OS X Development Tools. It is an excellent idea to keep current with the latest, as available on Apple’s ADC site.

    I can’t foresee every possible operating environment (and I’m certain to have overlooked some critical assumption or other). Some of these libraries require GNU make for building. Check your version using make –version; if it’s not GNU make, you’ll have to systematically substitute gnumake for make in what follows.

    The primary objective of this endeavor was to compile GD4O (GD for OCaml), which I did.

    Setting up the working directory.

    % mkdir /SourceCache/

    % mkdir /SourceCache/apache_mod_php/

    % mkdir /SourceCache/apache_mod_php/apache_mod_php-12/

    % cd /SourceCache/apache_mod_php/apache_mod_php-12/



  2. – (Optional-10.2.X) Building dlcompat

    Nota bene: this step is not necessary if dlcompat is already installed in your system. If you have Panther (Mac OS X 10.3), it is already included (in /usr/lib/libdl.dylib). If not, see if you have it installed somewhere. From the terminal, do:

    % gcc -ldl

    If the result is something like:

    ld: Undefined symbols:
    _main

    (slightly edited) then skip to the next section. If, on the other hand, the result is something like ld: can’t locate file for: -ldl, then continue with the following.

    Retrieve the package from http://sourceforge.net/projects/fink/, downloading to, for instance, the Desktop.

    From the Terminal, change the working directory to the download folder and uncompress the archive (the version number reflects the latest available at the moment of this writing; your particular version number may vary):

    % cd ~/Desktop

    % tar zxvf dlcompat-20030629.tar.gz

    Change to the extracted directory (you might want to review the README file found within) and configure the package; then build and install it:

    % cd dlcompat-20030629

    % ./configure; make; sudo make install

    Once finished, change back to your work directory:

    % cd /SourceCache/apache_mod_php/apache_mod_php-12/



  3. – Getting the archives

    Download php 4.x.x or 5.x..x, curl 7.12.1, zlib 1.2.1, libpng 1.2.6, libjpeg v6b, FreeType 2.1.9, expat and GD 2.0.28.

    The official URLs for these libraries are:

    php:
    http://www.php.net/downloads.php
    curl:
    http://curl.haxx.se/download/
    zlib:
    http://www.gzip.org/zlib/
    libpng:
    http://www.libpng.org/pub/png/libpng.html
    libjpeg:
    ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
    freetype2:
    http://freetype.sourceforge.net/download.html
    GD:
    http://www.boutell.com/gd/
    expat:
    http://sourceforge.net/project/showfiles.php?group_id=10127

    You can choose to download either Gzipped (.gz or .tgz extensions) or Bzipped (.bz2 extension) archives, since the latter are smaller. In any case, I advise to locally compute and compare MD5 checksums, if the distribution home lists them. You do that by executing:

    % md5



  4. – Unpacking the archives

    With all archives in the same directory, do:

    % ls *.gz | xargs -n 1 tar zxvf

    (I know, xargs is evil). If you downloaded any Bzipped archives, do:

    % ls *.bz2 | xargs -n 1 tar jxvf

    (when done it would be helpful to reduce the folder names without version numbers)

    The next two builds are fairly simple and don’t require anything complicated.



  5. – Building curl

    % cd curl

    % ./configure --prefix=/usr; make; sudo make install



  6. – Building expat

    % cd ../expat
    % ./configure --prefix=/usr --mandir=/usr/share/man; make; sudo make install



  7. – Building zlib

    % cd ../zlib

    % ./configure --prefix=/usr --shared; make; sudo make install



  8. – Building libpng

    First, copy makefile.darwin from the scripts directory in the libpng build directory:

    % cd ../libpng

    % cp scripts/makefile.darwin ./Makefile

    Now build and install:

    % make; sudo make install



  9. – Building libjpeg

    We need to build dynamic libraries for GD to work. We need a newer version of GNU libtool than the one that libjpeg includes. Fortunately, GD does provide a compatible version that we can use. To get it, we need to configure GD. The configuration won’t work, since the required JPEG library won’t be present yet, but do a dry run anyway:

    % cd ../gd

    % ./configure

    Now copy the newly created libtool to the jpeg directory:

    % cp libtool ../jpeg

    % cd ../jpeg

    % ./configure --enable-shared

    % make; sudo make install



  10. – Building freetype2

    Enter freetype2’s build directory:

    % cd ../freetype

    Let’s update the zlib reference four our build.

    % cp ../zlib/zlib.h src/gzip/zlib.h

    By default, freetype2’s support for hinting TrueType fonts is disabled. US citizens using this library for commercial purposes might be liable for patent infringement by turning it back on; those of us to which US patents don’t apply, or whomever may not care, edit the file include/freetype/config/ftoption.h and uncomment line 402 to read:

    #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER

    Furthermore, if you wish, you can comment line 414 to read:

    /* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */

    Proceed as before:

    % ./configure; make; sudo make install

    Nota bene: I don’t know whether freetype2 supports Mac OS X font lookup in system directories or not. I have tested it using full path names to the font files. If anybody lets me know about further steps that might enable it, I’ll add the relevant information.



  11. – Building GD (not required if building PHP)

    Now everything is in place. In GD’s install directory, re-run configure, then build and install:

    % cd ../gd

    % ./configure; make; sudo make install

    Presently, configure should report that GD will support PNG, JPEG and FreeType:

    ** Configuration summary for gd:

    Support for PNG library: yes
    Support for JPEG library: yes
    Support for Freetype 2.x library: yes
    Support for Xpm library: yes
    Support for pthreads: yes

    If not, something’s wrong with the installation.



  12. – Building PHP

      a) – PHP4


    Now everything is in place. In PHP’s build directory, run configure, then build and install:

    % cd ../php

    % ./configure --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-config-file-path=/etc --with-expat-dir=/usr --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr --enable-cgi --enable-cli --enable-dbx --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-wddx --enable-yp --with-apxs --with-curl --with-gd --with-iodbc --with-kerberos --with-ldap --with-mysql --with-openssl --with-xml --with-xmlrpc

    % make; make install

    Substitute ‘./configure’ with ‘/SourceCache/apache_mod_php/apache_mod_php-12/php/configure –prefix=/usr’ if you wish to replace Apple’s existing PHP with your custom PHP4.

      b) – PHP5


    Use the following configure command for PHP5.

    % ./configure --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-config-file-path=/etc --with-expat-dir=/usr --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr --enable-cgi --enable-cli --enable-dbx --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-wddx --enable-xslt --enable-yp --with-apxs --with-curl --with-gd --with-iodbc --with-kerberos --with-ldap --with-mysql --with-openssl --with-xml --with-xmlrpc

    % make; make install

    Substitute ‘./configure’ with ‘/SourceCache/apache_mod_php/apache_mod_php-12/php/configure –prefix=/usr’ if you wish to replace Apple’s existing PHP with your custom PHP5.

    You will have to edit httpd.conf and remove all references to PHP4 and delete the old PHP4 file.

    % sudo rm /usr/libexec/httpd/libphp4.so



  13. – Testing GD

    GD includes a nice utility called annotate for overlaying text on JPEG images, that we can use to test the installation. The libjpeg includes the traditional Rose JPEG for testing purposes. What’s only needed is a TrueType font that freetype2 can read (Mac OS X .dfont’s are not useable): Windows or X-Windows .TTF fonts do nicely. Get any of these and copy it to your user’s ~/Library/Fonts (or wherever).

    Then, return to the build directory:

    % cd ..

    Create a text file called annotate.cmd, containing the following lines (change the font path):

    font full path to the .TTF font

    move 113 75

    align center

    color 63 63 255

    size 40

    text Mac OS X

    Execute:

    annotate jpeg/testimg.jpg ./annotated.jpg

    It must complete without errors. Check the annotated.jpg file that resulted with your browser.



  14. – Cleaning up

    Once you’re satisfied with the results, you can proceed to clean up the build directory (this is a long line broken in pieces for better readability):

    % rm -rf annotate.cmd annotated.jpg dlcompat/ freetype/ php/ gd/ jpeg/ libpng/ zlib/

    If you want to keep the .gz archives, you may want to move them to your Public folder or wherever; otherwise, delete them:

    % cd /SourceCache/apache_mod_php/apache_mod_php-12/

    % rm -r *.gz



  15. – Better gd_info()

    In the PHP source folder edit ext/gd/gd.c

    find the following line:
     PHP_FE(gd_info,  NULL)

    add the following line after it:
     PHP_FE(gdinfo,  NULL)

    find:
    #define PHP_GD_VERSION_STRING "bundled
    add: (so we know we modified this routine)

    'modified'

    Next we need to replace ‘PHP_FUNCTION(gd_info)’ routine with our new one (see below for PHP version).

    Now edit ext/gd/php_gd.c

    find the following line:
    PHP_FUNCTION(gd_info);

    add the following line after it:
    PHP_FUNCTION(gdinfo);

    Once this has been done, you can rebuild PHP using the build instructions outlined in this file and your will have an enhanced gdinfo.

    PHP4 code:
    PHP_FUNCTION(gd_info)
    {
    if (ZEND_NUM_ARGS()!=0) {
    ZEND_WRONG_PARAM_COUNT();
    RETURN_FALSE;
    }

    array_init(return_value);

    add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING, 1);

    #ifdef ENABLE_GD_TTF
    add_assoc_bool(return_value, "FreeType Support", 1);
    #if HAVE_LIBFREETYPE
    add_assoc_string(return_value, "FreeType Linkage", "with freetype", 1);
    #elif HAVE_LIBTTF
    add_assoc_string(return_value, "FreeType Linkage", "with TTF library", 1);
    #else
    add_assoc_string(return_value, "FreeType Linkage", "with unknown library", 1);
    #endif
    #else
    add_assoc_bool(return_value, "FreeType Support", 0);
    #endif

    #ifdef HAVE_LIBT1
    add_assoc_bool(return_value, "T1Lib Support", 1);
    #else
    add_assoc_bool(return_value, "T1Lib Support", 0);
    #endif
    #ifdef HAVE_GD_GIF_READ
    add_assoc_bool(return_value, "GIF Read Support", 1);
    #else
    add_assoc_bool(return_value, "GIF Read Support", 0);
    #endif
    #ifdef HAVE_GD_GIF_CREATE
    add_assoc_bool(return_value, "GIF Create Support", 1);
    #else
    add_assoc_bool(return_value, "GIF Create Support", 0);
    #endif
    #ifdef HAVE_GD_JPG
    add_assoc_bool(return_value, "JPG Support", 1);
    #else
    add_assoc_bool(return_value, "JPG Support", 0);
    #endif
    #ifdef HAVE_GD_PNG
    add_assoc_bool(return_value, "PNG Support", 1);
    #else
    add_assoc_bool(return_value, "PNG Support", 0);
    #endif
    #ifdef HAVE_GD_WBMP
    add_assoc_bool(return_value, "WBMP Support", 1);
    #else
    add_assoc_bool(return_value, "WBMP Support", 0);
    #endif
    #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
    add_assoc_bool(return_value, "XPM Support", 1);
    #else
    add_assoc_bool(return_value, "XPM Support", 0);
    #endif
    #ifdef HAVE_GD_XBM
    add_assoc_bool(return_value, "XBM Support", 1);
    #else
    add_assoc_bool(return_value, "XBM Support", 0);
    #endif
    #if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
    add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
    #else
    add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 0);
    #endif
    }
    /* }}} */

    /* {{{ proto array gdinfo()
    */
    PHP_FUNCTION(gdinfo)
    {
    char *gd_uname;
    if (ZEND_NUM_ARGS() != 0) {
    ZEND_WRONG_PARAM_COUNT();
    RETURN_FALSE;
    }
    gd_uname = php_get_uname('a');
    PUTS("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">n");
    PUTS("<html>");
    PUTS("<head>n");
    php_info_print_style(TSRMLS_C);
    PUTS("<title>gd_info()</title>");
    PUTS("</head>n");
    PUTS("<body><div class="center">n");
    php_info_print_box_start(1);
    php_printf("<h1 class="p">GD Version %s</h1>n", PHP_GD_VERSION_STRING);
    php_info_print_box_end();
    php_info_print_table_start();
    php_info_print_table_row(2, "System", gd_uname );
    php_info_print_table_row(2, "GD Version", PHP_GD_VERSION_STRING);

    #ifdef ENABLE_GD_TTF
    php_info_print_table_row(2, "FreeType Support", "enabled");
    #if HAVE_LIBFREETYPE
    php_info_print_table_row(2, "FreeType Linkage", "with freetype");
    #elif HAVE_LIBTTF
    php_info_print_table_row(2, "FreeType Linkage", "with TTF library");
    #else
    php_info_print_table_row(2, "FreeType Linkage", "with unknown library");
    #endif
    #else
    php_info_print_table_row(2, "FreeType Support", "disabled");
    #endif

    #ifdef HAVE_LIBT1
    php_info_print_table_row(2, "T1Lib Support", "enabled");
    #else
    php_info_print_table_row(2, "T1Lib Support", "disabled");
    #endif

    /* this next part is stupid ... if I knew better, I'd put them all on one row (cmv) */

    #ifdef HAVE_GD_GIF_READ
    php_info_print_table_row(2, "GIF Read Support", "enabled");
    #else
    php_info_print_table_row(2, "GIF Read Support", "disabled");
    #endif
    #ifdef HAVE_GD_GIF_CREATE
    php_info_print_table_row(2, "GIF Create Support", "enabled");
    #else
    php_info_print_table_row(2, "GIF Create Support", "disabled");
    #endif
    #ifdef HAVE_GD_JPG
    php_info_print_table_row(2, "JPG Support", "enabled");
    #else
    php_info_print_table_row(2, "JPG Support", "disabled");
    #endif
    #ifdef HAVE_GD_PNG
    php_info_print_table_row(2, "PNG Support", "enabled");
    #else
    php_info_print_table_row(2, "PNG Support", "disabled");
    #endif
    #ifdef HAVE_GD_WBMP
    php_info_print_table_row(2, "WBMP Support", "enabled");
    #else
    php_info_print_table_row(2, "WBMP Support", "disabled");
    #endif
    #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
    php_info_print_table_row(2, "XPM Support", "enabled");
    #else
    php_info_print_table_row(2, "XPM Support", "disabled");
    #endif
    #ifdef HAVE_GD_XBM
    php_info_print_table_row(2, "XBM Support", "enabled");
    #else
    php_info_print_table_row(2, "XBM Support", "disabled");
    #endif
    #if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
    php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled");
    #else
    php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "disabled");
    #endif
    php_info_print_table_end();

    PUTS("<h2>GD Copyright</h2>n");
    php_info_print_box_start(0);
    PUTS("COPYRIGHT STATEMENT FOLLOWS THIS LINE</p>n<blockquote>n");
    PUTS("<p>Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Cold Spring Harbor Laboratory. Funded under Grant P41-RR02188 by the National Institutes of Health.</p>n");
    PUTS("<p>Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Boutell.Com, Inc.</p>n");
    PUTS("<p>Portions relating to GD2 format copyright 1999, 2000, 2001, 2002, 2003, 2004 Philip Warner.</p>n");
    PUTS("<p>Portions relating to PNG copyright 1999, 2000, 2001, 2002, 2003, 2004 Greg Roelofs.</p>n");
    PUTS("<p>Portions relating to gd.c copyright 2003, 2004 Dale Walsh ([email protected]).</p>n");
    PUTS("<p>Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002, 2003, 2004 John Ellson ([email protected]).</p>n");
    PUTS("<p>Portions relating to gdft.c copyright 2001, 2002, 2003, 2004 John Ellson ([email protected]).</p>n");
    PUTS("<p>Portions relating to JPEG and to color quantization copyright 2000, 2001, 2002, 2003, 2004, Doug Becker and copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Thomas G. Lane. ");
    PUTS("This software is based in part on the work of the Independent JPEG Group. See the file README-JPEG.TXT for more information.</p>n");
    PUTS("<p>Portions relating to GIF compression copyright 1989 by Jef Poskanzer and David Rowley, with modifications for thread safety by Thomas Boutell.</p>n");
    PUTS("<p>Portions relating to GIF decompression copyright 1990, 1991, 1993 by David Koblas, with modifications for thread safety by Thomas Boutell.</p>n");
    PUTS("<p>Portions relating to WBMP copyright 2000, 2001, 2002, 2003, 2004 Maurice Szmurlo and Johan Van den Brande.</p>n</blockquote>n");
    php_info_print_box_end();
    PUTS("<h2>GD License</h2>n");
    php_info_print_box_start(0);
    PUTS("<p><b>Permission has been granted to copy, distribute and modify gd in any context without fee, including a commercial application, provided that this notice is present in user-accessible supporting documentation. </b></p>");
    PUTS("<p>This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for the authors of gd, not to interfere with your productive use of gd. If you have questions, ask. "Derived works" ");
    PUTS("includes all programs that utilize the library. Credit must be given in user-accessible documentation.</p>n");
    PUTS("<p><b>This software is provided "AS IS."</b> The copyright holders disclaim all warranties, either express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose, ");
    PUTS("with respect to this code and accompanying documentation.</p>n");
    php_info_print_box_end();
    PUTS("</div></body></html>");
    }

    PHP5 code:
    PHP_FUNCTION(gd_info)
    {
    if (ZEND_NUM_ARGS() != 0) {
    ZEND_WRONG_PARAM_COUNT();
    RETURN_FALSE;
    }
    array_init(return_value);
    add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING, 1);
    #ifdef ENABLE_GD_TTF
    add_assoc_bool(return_value, "FreeType Support", 1);
    #if HAVE_LIBFREETYPE
    add_assoc_string(return_value, "FreeType Linkage", "with freetype", 1);
    #elif HAVE_LIBTTF
    add_assoc_string(return_value, "FreeType Linkage", "with TTF library", 1);
    #else
    add_assoc_string(return_value, "FreeType Linkage", "with unknown library", 1);
    #endif
    #else
    add_assoc_bool(return_value, "FreeType Support", 0);
    #endif

    #ifdef HAVE_LIBT1
    add_assoc_bool(return_value, "T1Lib Support", 1);
    #else
    add_assoc_bool(return_value, "T1Lib Support", 0);
    #endif
    #ifdef HAVE_GD_GIF_READ
    add_assoc_bool(return_value, "GIF Read Support", 1);
    #else
    add_assoc_bool(return_value, "GIF Read Support", 0);
    #endif
    #ifdef HAVE_GD_GIF_CREATE
    add_assoc_bool(return_value, "GIF Create Support", 1);
    #else
    add_assoc_bool(return_value, "GIF Create Support", 0);
    #endif
    #ifdef HAVE_GD_JPG
    add_assoc_bool(return_value, "JPG Support", 1);
    #else
    add_assoc_bool(return_value, "JPG Support", 0);
    #endif
    #ifdef HAVE_GD_PNG
    add_assoc_bool(return_value, "PNG Support", 1);
    #else
    add_assoc_bool(return_value, "PNG Support", 0);
    #endif
    #ifdef HAVE_GD_WBMP
    add_assoc_bool(return_value, "WBMP Support", 1);
    #else
    add_assoc_bool(return_value, "WBMP Support", 0);
    #endif
    #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
    add_assoc_bool(return_value, "XPM Support", 1);
    #else
    add_assoc_bool(return_value, "XPM Support", 0);
    #endif
    #ifdef HAVE_GD_XBM
    add_assoc_bool(return_value, "XBM Support", 1);
    #else
    add_assoc_bool(return_value, "XBM Support", 0);
    #endif
    #if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
    add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
    #else
    add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 0);
    #endif
    }
    /* }}} */

    /* {{{ proto array gdinfo()
    */
    PHP_FUNCTION(gdinfo)
    {
    char *gd_uname;
    if (ZEND_NUM_ARGS() != 0) {
    ZEND_WRONG_PARAM_COUNT();
    RETURN_FALSE;
    }
    gd_uname = php_get_uname('a');
    PUTS("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">n");
    PUTS("<html>");
    PUTS("<head>n");
    php_info_print_style(TSRMLS_C);
    PUTS("<title>gd_info()</title>");
    PUTS("</head>n");
    PUTS("<body><div class="center">n");
    php_info_print_box_start(1);
    php_printf("<h1 class="p">GD Version %s</h1>n", PHP_GD_VERSION_STRING);
    php_info_print_box_end();
    php_info_print_table_start();
    php_info_print_table_row(2, "System", gd_uname );
    php_info_print_table_row(2, "GD Version", PHP_GD_VERSION_STRING);
    #ifdef ENABLE_GD_TTF
    php_info_print_table_row(2, "FreeType Support", "enabled");
    #if HAVE_LIBFREETYPE
    php_info_print_table_row(2, "FreeType Linkage", "with freetype");
    {
    char tmp[256];
    #ifdef FREETYPE_PATCH
    snprintf(tmp, sizeof(tmp), "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
    #else
    snprintf(tmp, sizeof(tmp), "%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR);
    #endif
    php_info_print_table_row(2, "FreeType Version", tmp);
    }
    #elif HAVE_LIBTTF
    php_info_print_table_row(2, "FreeType Linkage", "with TTF library");
    {
    char tmp[256];
    snprintf(tmp, sizeof(tmp), "%d.%d", TT_FREETYPE_MAJOR, TT_FREETYPE_MINOR);
    php_info_print_table_row(2, "FreeType Version", tmp);
    }
    #else
    php_info_print_table_row(2, "FreeType Linkage", "with unknown library");
    #endif
    #else
    php_info_print_table_row(2, "FreeType Support", "disabled");
    #endif

    #ifdef HAVE_LIBT1
    php_info_print_table_row(2, "T1Lib Support", "enabled");
    #else
    php_info_print_table_row(2, "T1Lib Support", "disabled");
    #endif

    /* this next part is stupid ... if I knew better, I'd put them all on one row (cmv) */

    #ifdef HAVE_GD_GIF_READ
    php_info_print_table_row(2, "GIF Read Support", "enabled");
    #else
    php_info_print_table_row(2, "GIF Read Support", "disabled");
    #endif
    #ifdef HAVE_GD_GIF_CREATE
    php_info_print_table_row(2, "GIF Create Support", "enabled");
    #else
    php_info_print_table_row(2, "GIF Create Support", "disabled");
    #endif
    #ifdef HAVE_GD_JPG
    php_info_print_table_row(2, "JPG Support", "enabled");
    #else
    php_info_print_table_row(2, "JPG Support", "disabled");
    #endif
    #ifdef HAVE_GD_PNG
    php_info_print_table_row(2, "PNG Support", "enabled");
    #else
    php_info_print_table_row(2, "PNG Support", "disabled");
    #endif
    #ifdef HAVE_GD_WBMP
    php_info_print_table_row(2, "WBMP Support", "enabled");
    #else
    php_info_print_table_row(2, "WBMP Support", "disabled");
    #endif
    #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
    php_info_print_table_row(2, "XPM Support", "enabled");
    #else
    php_info_print_table_row(2, "XPM Support", "disabled");
    #endif
    #ifdef HAVE_GD_XBM
    php_info_print_table_row(2, "XBM Support", "enabled");
    #else
    php_info_print_table_row(2, "XBM Support", "disabled");
    #endif
    #if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
    php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled");
    #else
    php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "disabled");
    #endif
    php_info_print_table_end();

    PUTS("<h2>GD Copyright</h2>n");
    php_info_print_box_start(0);
    PUTS("COPYRIGHT STATEMENT FOLLOWS THIS LINE</p>n<blockquote>n");
    PUTS("<p>Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Cold Spring Harbor Laboratory. Funded under Grant P41-RR02188 by the National Institutes of Health.</p>n");
    PUTS("<p>Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Boutell.Com, Inc.</p>n");
    PUTS("<p>Portions relating to GD2 format copyright 1999, 2000, 2001, 2002, 2003, 2004 Philip Warner.</p>n");
    PUTS("<p>Portions relating to PNG copyright 1999, 2000, 2001, 2002, 2003, 2004 Greg Roelofs.</p>n");
    PUTS("<p>Portions relating to gd.c copyright 2003, 2004 Dale Walsh ([email protected]).</p>n");
    PUTS("<p>Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002, 2003, 2004 John Ellson ([email protected]).</p>n");
    PUTS("<p>Portions relating to gdft.c copyright 2001, 2002, 2003, 2004 John Ellson ([email protected]).</p>n");
    PUTS("<p>Portions relating to JPEG and to color quantization copyright 2000, 2001, 2002, 2003, 2004, Doug Becker and copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Thomas G. Lane. ");
    PUTS("This software is based in part on the work of the Independent JPEG Group. See the file README-JPEG.TXT for more information.</p>n");
    PUTS("<p>Portions relating to GIF compression copyright 1989 by Jef Poskanzer and David Rowley, with modifications for thread safety by Thomas Boutell.</p>n");
    PUTS("<p>Portions relating to GIF decompression copyright 1990, 1991, 1993 by David Koblas, with modifications for thread safety by Thomas Boutell.</p>n");
    PUTS("<p>Portions relating to WBMP copyright 2000, 2001, 2002, 2003, 2004 Maurice Szmurlo and Johan Van den Brande.</p>n</blockquote>n");
    php_info_print_box_end();
    PUTS("<h2>GD License</h2>n");
    php_info_print_box_start(0);
    PUTS("<p><b>Permission has been granted to copy, distribute and modify gd in any context without fee, including a commercial application, provided that this notice is present in user-accessible supporting documentation. </b></p>");
    PUTS("<p>This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for the authors of gd, not to interfere with your productive use of gd. If you have questions, ask. "Derived works" ");
    PUTS("includes all programs that utilize the library. Credit must be given in user-accessible documentation.</p>n");
    PUTS("<p><b>This software is provided "AS IS."</b> The copyright holders disclaim all warranties, either express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose, ");
    PUTS("with respect to this code and accompanying documentation.</p>n");
    php_info_print_box_end();
    PUTS("</div></body></html>");
    }

Leave a reply

You must be logged in to post a comment.