diff options
author | Peter Simons <simons@cryp.to> | 2007-02-18 23:43:16 +0100 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2007-02-18 23:43:16 +0100 |
commit | 16aee45643e593e2833e4dff19df7b5f14267a79 (patch) | |
tree | ba40c1ee401bbbcec7dbee5e3bb51d21c70db130 /m4/ax_check_gd.m4 | |
download | autoconf-archive-16aee45643e593e2833e4dff19df7b5f14267a79.tar.gz |
Imported http://autoconf-archive.cryp.to/ release 2007-02-14.
Diffstat (limited to 'm4/ax_check_gd.m4')
-rw-r--r-- | m4/ax_check_gd.m4 | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/m4/ax_check_gd.m4 b/m4/ax_check_gd.m4 new file mode 100644 index 0000000..9381900 --- /dev/null +++ b/m4/ax_check_gd.m4 @@ -0,0 +1,82 @@ +##### http://autoconf-archive.cryp.to/ax_check_gd.html +# +# SYNOPSIS +# +# AX_CHECK_GD +# +# DESCRIPTION +# +# Check for the gd library. (See http://www.boutell.com/gd/) If gd is +# found, the output variables GD_CFLAGS, GD_LDFLAGS and GD_LIBS will +# contain the compiler flags, linker flags and libraries necessary to +# use gd; otherwise, those variables will be empty. In addition, the +# symbol HAVE_GD is defined if the library is found, and the symbols +# HAVE_GD_GIF, HAVE_GD_JPEG and HAVE_GD_PNG are defined if the +# lirbary supports creating images in gif, jpeg and png formats, +# respectively. +# +# The user may use --with-gd=no or --without-gd to skip checking for +# the library. (The default is --with-gd=yes.) If the library is +# installed in an unusual location, --with-gd=DIR will cause the +# macro to look for gdlib-config in DIR/bin or, failing that, for the +# headers and libraries in DIR/include and DIR/lib. +# +# Feedback welcome! +# +# LAST MODIFICATION +# +# 2005-09-22 +# +# COPYLEFT +# +# Copyright (c) 2005 Nick Markham <markhn@rpi.edu> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AX_CHECK_GD], [ + AC_ARG_WITH(gd, + AC_HELP_STRING([--with-gd(=DIR)], [use the gd library (in DIR)]),, + with_gd=yes) + + if test "$with_gd" != no; then + AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, , [$with_gd/bin:$PATH]) + if test -n "$GDLIB_CONFIG"; then + GD_CFLAGS=`$GDLIB_CONFIG --cflags` + GD_LDFLAGS=`$GDLIB_CONFIG --ldflags` + GD_LIBS=`$GDLIB_CONFIG --libs` + elif test -d "$with_gd"; then + GD_CFLAGS="-I$with_gd/include" + GD_LDFLAGS="-L$with_gd/lib" + AC_CHECK_LIB(z, inflateReset, GD_LIBS="-lz") + AC_CHECK_LIB(png, png_check_sig, GD_LIBS="-lpng $GD_LIBS", , $GD_LIBS) + fi + + save_CFLAGS="$CFLAGS" + CFLAGS="$GD_CFLAGS $CFLAGS" + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$GD_LDFLAGS $LDFLAGS" + + AC_CHECK_LIB(gd, gdImageCreate, [ + AC_DEFINE(HAVE_GD, 1, [ Define if you have gd library. ]) + AC_CHECK_LIB(gd, gdImageGif, AC_DEFINE(HAVE_GD_GIF, 1, [ Define if GD supports gif. ]), , "$GD_LIBS") + AC_CHECK_LIB(gd, gdImageJpeg, AC_DEFINE(HAVE_GD_JPEG, 1, [ Define if GD supports jpeg. ]), , "$GD_LIBS") + AC_CHECK_LIB(gd, gdImagePng, AC_DEFINE(HAVE_GD_PNG, 1, [ Define if GD supports png. ]), , "$GD_LIBS") + GD_LIBS="-lgd $GD_LIBS" + ], with_gd=no, $GD_LIBS) + + CFLAGS="$save_CFLAGS" + LDFLAGS="$save_LDFLAGS" + fi + + if test "$with_gd" = "no"; then + GD_CFLAGS=""; + GD_LDFLAGS=""; + GD_LIBS=""; + fi + + AC_SUBST(GD_CFLAGS) + AC_SUBST(GD_LDFLAGS) + AC_SUBST(GD_LIBS) +]) |