0001-configure.ac-add-option-to-disable-image-output.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 8a4a9b82d4f8fd39db8417fd06d969505fde9d0a Mon Sep 17 00:00:00 2001
  2. From: Rodrigo Rebello <rprebello@gmail.com>
  3. Date: Tue, 22 Dec 2015 18:02:22 -0200
  4. Subject: [PATCH 1/1] configure.ac: add option to disable image output
  5. Even when the gd library is present, it may be desirable to not build
  6. 'vnstati' as image output is an optional feature.
  7. Also, when testing for the gd library, use gdImagePng() instead of
  8. gdImageLine() since it's possible that the installed gd library doesn't
  9. have PNG support. In such cases, the test in the configure script passed
  10. (because gdImageLine() is always present), but the build failed with:
  11. src/vnstati.o: In function `writeoutput':
  12. vnstati.c:(.text+0x3fc): undefined reference to `gdImagePng'
  13. collect2: error: ld returned 1 exit status
  14. Upstream status: accepted, not yet released.
  15. https://github.com/vergoh/vnstat/pull/35
  16. Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
  17. ---
  18. configure.ac | 10 ++++++++--
  19. 1 file changed, 8 insertions(+), 2 deletions(-)
  20. diff --git a/configure.ac b/configure.ac
  21. index be3d449..89f71ef 100644
  22. --- a/configure.ac
  23. +++ b/configure.ac
  24. @@ -13,10 +13,16 @@ AM_PROG_CC_C_O
  25. AC_PROG_MAKE_SET
  26. AC_PROG_MKDIR_P
  27. +AC_ARG_ENABLE([image-output], [
  28. +AS_HELP_STRING([--disable-image-output], [disable PNG image output])])
  29. +
  30. # Checks for libraries.
  31. AC_CHECK_LIB([m], [pow])
  32. -AC_CHECK_LIB([gd], [gdImageLine], [IMAGELIBS=-lgd])
  33. -AC_SUBST([IMAGELIBS])
  34. +
  35. +AS_IF([test "x$enable_image_output" != "xno"], [
  36. +AC_CHECK_LIB([gd], [gdImagePng], [IMAGELIBS=-lgd])
  37. +AC_SUBST([IMAGELIBS])])
  38. +
  39. AM_CONDITIONAL([HAVE_LIBGD], [test "$IMAGELIBS" = "-lgd"])
  40. PKG_CHECK_MODULES([CHECK], [check >= 0.9.6], [], [AC_MSG_NOTICE([testcases can not be execute without check installed])])
  41. AM_CONDITIONAL([HAVE_CHECK], [test "$CHECK_LIBS"])
  42. --
  43. 2.1.4