Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.8KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_gd.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_GD
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check for the gd library. (See http://www.boutell.com/gd/) If gd is
  12. # found, the output variables GD_CFLAGS, GD_LDFLAGS and GD_LIBS will
  13. # contain the compiler flags, linker flags and libraries necessary to use
  14. # gd; otherwise, those variables will be empty. In addition, the symbol
  15. # HAVE_GD is defined if the library is found, and the symbols HAVE_GD_GIF,
  16. # HAVE_GD_JPEG and HAVE_GD_PNG are defined if the library supports
  17. # creating images in gif, jpeg and png formats, respectively.
  18. #
  19. # The user may use --with-gd=no or --without-gd to skip checking for the
  20. # library. (The default is --with-gd=yes.) If the library is installed in
  21. # an unusual location, --with-gd=DIR will cause the macro to look for
  22. # gdlib-config in DIR/bin or, failing that, for the headers and libraries
  23. # in DIR/include and DIR/lib.
  24. #
  25. # Feedback welcome!
  26. #
  27. # LICENSE
  28. #
  29. # Copyright (c) 2008 Nick Markham <markhn@rpi.edu>
  30. #
  31. # Copying and distribution of this file, with or without modification, are
  32. # permitted in any medium without royalty provided the copyright notice
  33. # and this notice are preserved. This file is offered as-is, without any
  34. # warranty.
  35. #serial 11
  36. AC_DEFUN([AX_CHECK_GD], [
  37. AC_ARG_WITH(gd,
  38. AS_HELP_STRING([--with-gd(=DIR)], [use the gd library (in DIR)]),,
  39. with_gd=yes)
  40. if test "$with_gd" != no; then
  41. AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, , [$with_gd/bin:$PATH])
  42. if test -n "$GDLIB_CONFIG"; then
  43. GD_CFLAGS=`$GDLIB_CONFIG --cflags`
  44. GD_LDFLAGS=`$GDLIB_CONFIG --ldflags`
  45. GD_LIBS=`$GDLIB_CONFIG --libs`
  46. elif test -d "$with_gd"; then
  47. GD_CFLAGS="-I$with_gd/include"
  48. GD_LDFLAGS="-L$with_gd/lib"
  49. AC_CHECK_LIB(z, inflateReset, GD_LIBS="-lz")
  50. AC_CHECK_LIB(png, png_check_sig, GD_LIBS="-lpng $GD_LIBS", , $GD_LIBS)
  51. fi
  52. save_CFLAGS="$CFLAGS"
  53. CFLAGS="$GD_CFLAGS $CFLAGS"
  54. save_LDFLAGS="$LDFLAGS"
  55. LDFLAGS="$GD_LDFLAGS $LDFLAGS"
  56. AC_CHECK_LIB(gd, gdImageCreate, [
  57. AC_DEFINE(HAVE_GD, 1, [ Define if you have gd library. ])
  58. AC_CHECK_LIB(gd, gdImageGif, AC_DEFINE(HAVE_GD_GIF, 1, [ Define if GD supports gif. ]), , "$GD_LIBS")
  59. AC_CHECK_LIB(gd, gdImageJpeg, AC_DEFINE(HAVE_GD_JPEG, 1, [ Define if GD supports jpeg. ]), , "$GD_LIBS")
  60. AC_CHECK_LIB(gd, gdImagePng, AC_DEFINE(HAVE_GD_PNG, 1, [ Define if GD supports png. ]), , "$GD_LIBS")
  61. GD_LIBS="-lgd $GD_LIBS"
  62. ], with_gd=no, $GD_LIBS)
  63. CFLAGS="$save_CFLAGS"
  64. LDFLAGS="$save_LDFLAGS"
  65. fi
  66. if test "$with_gd" = "no"; then
  67. GD_CFLAGS="";
  68. GD_LDFLAGS="";
  69. GD_LIBS="";
  70. fi
  71. AC_SUBST(GD_CFLAGS)
  72. AC_SUBST(GD_LDFLAGS)
  73. AC_SUBST(GD_LIBS)
  74. ])