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.

79 lines
2.5 KiB

  1. --- a/m4/nut_check_libgd.m4
  2. +++ b/m4/nut_check_libgd.m4
  3. @@ -9,37 +9,27 @@ if test -z "${nut_have_libgd_seen}"; then
  4. nut_have_libgd_seen=yes
  5. CFLAGS_ORIG="${CFLAGS}"
  6. - LDFLAGS_ORIG="${LDFLAGS}"
  7. LIBS_ORIG="${LIBS}"
  8. - dnl Initial defaults. These are only used if gdlib-config is
  9. - dnl unusable and the user fails to pass better values in --with
  10. - dnl arguments
  11. - CFLAGS=""
  12. - LDFLAGS="-L/usr/X11R6/lib"
  13. - LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11"
  14. -
  15. - AC_MSG_CHECKING(for gd version via gdlib-config)
  16. - GD_VERSION=`gdlib-config --version 2>/dev/null`
  17. - if test "$?" != "0" -o -z "${GD_VERSION}"; then
  18. - GD_VERSION="none"
  19. + AC_MSG_CHECKING(for gd version via pkg-config)
  20. + GD_VERSION=`pkg-config --silence-errors --modversion gdlib 2>/dev/null`
  21. + if test "$?" != "0" -a -n "${GD_VERSION}"; then
  22. + CFLAGS"`pkg-config --silence-errors --cflags gdllib 2>/dev/null`"
  23. + LIBS="`pkg-config --silence-errors --libs gdlib 2>/dev/null`"
  24. + else
  25. + AC_MSG_CHECKING(via gdlib-config)
  26. + GD_VERSION="`gdlib-config --version 2>/dev/null`"
  27. + if test "$?" = "0" -a -n "${GD_VERSION}"; then
  28. + CFLAGS="`gdlib-config --cflags 2>/dev/null`"
  29. + LIBS="`gdlib-config --libs 2>/dev/null`"
  30. + else
  31. + GD_VERSION="none"
  32. + CFLAGS=""
  33. + LIBS="-lgd"
  34. + fi
  35. fi
  36. AC_MSG_RESULT(${GD_VERSION} found)
  37. - case "${GD_VERSION}" in
  38. - none)
  39. - ;;
  40. - 2.0.5 | 2.0.6 | 2.0.7)
  41. - AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use gdlib-config script]])
  42. - AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]])
  43. - ;;
  44. - *)
  45. - CFLAGS="`gdlib-config --includes 2>/dev/null`"
  46. - LDFLAGS="`gdlib-config --ldflags 2>/dev/null`"
  47. - LIBS="`gdlib-config --libs 2>/dev/null`"
  48. - ;;
  49. - esac
  50. -
  51. dnl Now allow overriding gd settings if the user knows best
  52. AC_MSG_CHECKING(for gd include flags)
  53. AC_ARG_WITH(gd-includes,
  54. @@ -70,7 +60,7 @@ if test -z "${nut_have_libgd_seen}"; then
  55. ;;
  56. esac
  57. ], [])
  58. - AC_MSG_RESULT([${LDFLAGS} ${LIBS}])
  59. + AC_MSG_RESULT([${LIBS}])
  60. dnl check if gd is usable
  61. AC_CHECK_HEADERS(gd.h gdfontmb.h, [nut_have_libgd=yes], [nut_have_libgd=no], [AC_INCLUDES_DEFAULT])
  62. @@ -79,12 +69,11 @@ if test -z "${nut_have_libgd_seen}"; then
  63. if test "${nut_have_libgd}" = "yes"; then
  64. AC_DEFINE(HAVE_LIBGD, 1, [Define if you have Boutell's libgd installed])
  65. LIBGD_CFLAGS="${CFLAGS}"
  66. - LIBGD_LDFLAGS="${LDFLAGS} ${LIBS}"
  67. + LIBGD_LDFLAGS="${LIBS}"
  68. fi
  69. dnl put back the original versions
  70. CFLAGS="${CFLAGS_ORIG}"
  71. - LDFLAGS="${LDFLAGS_ORIG}"
  72. LIBS="${LIBS_ORIG}"
  73. fi
  74. ])