0001-Allow-to-customize-path-to-gdlib-config-and-net-snmp.patch 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. From 086b5fa8fe4ba74404e92b5f838263dfcf9f173d Mon Sep 17 00:00:00 2001
  2. From: Jim Klimov <jim@jimklimov.com>
  3. Date: Thu, 7 Apr 2016 03:56:51 +0200
  4. Subject: [PATCH] Allow to customize path to gdlib-config and net-snmp-config
  5. programs
  6. [yann.morin.1998@free.fr: backport]
  7. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  8. ---
  9. Backported from upstream commit 086b5fa8fe4ba74404e92b5f838263dfcf9f173d
  10. ---
  11. docs/configure.txt | 14 ++++++++++++++
  12. m4/nut_check_libgd.m4 | 29 +++++++++++++++++++++++------
  13. m4/nut_check_libnetsnmp.m4 | 25 +++++++++++++++++++++----
  14. 3 files changed, 58 insertions(+), 10 deletions(-)
  15. diff --git a/docs/configure.txt b/docs/configure.txt
  16. index aff82c1..b3b542a 100644
  17. --- a/docs/configure.txt
  18. +++ b/docs/configure.txt
  19. @@ -23,6 +23,13 @@ Note that you need to install the libusb development package or files.
  20. Build and install the SNMP drivers (default: auto-detect)
  21. Note that you need to install libsnmp development package or files.
  22. + --with-net-snmp-config
  23. +
  24. +In addition to the `--with-snmp` option above, this one allows to provide
  25. +a custom program name (in `PATH`) or complete pathname to `net-snmp-config`.
  26. +This may be needed on build systems which support multiple architectures,
  27. +or in cases where your distribution names this program differently.
  28. +
  29. --with-neon
  30. Build and install the XML drivers (default: auto-detect)
  31. @@ -335,6 +342,13 @@ NOTE: the --with-gd switches are not necessary if you have gd 2.0.8
  32. or higher installed properly. The gdlib-config script will be
  33. detected and used by default in that situation.
  34. + --with-gdlib-config
  35. +
  36. +This option allows to provide a custom program name (in `PATH`) or
  37. +a complete pathname to `gdlib-config`. This may be needed on build
  38. +systems which support multiple architectures, or in cases where your
  39. +distribution names this program differently.
  40. +
  41. --with-ssl-includes, --with-usb-includes, --with-snmp-includes,
  42. --with-neon-includes, --with-libltdl-includes,
  43. --with-powerman-includes="-I/foo/bar"
  44. diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4
  45. index 01cc882..73f4da7 100644
  46. --- a/m4/nut_check_libgd.m4
  47. +++ b/m4/nut_check_libgd.m4
  48. @@ -19,8 +19,25 @@ if test -z "${nut_have_libgd_seen}"; then
  49. LDFLAGS="-L/usr/X11R6/lib"
  50. LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11"
  51. - AC_MSG_CHECKING(for gd version via gdlib-config)
  52. - GD_VERSION=`gdlib-config --version 2>/dev/null`
  53. + dnl By default seek in PATH
  54. + GDLIB_CONFIG=gdlib-config
  55. + AC_ARG_WITH(gdlib-config,
  56. + AS_HELP_STRING([@<:@--with-gdlib-config=/path/to/gdlib-config@:>@],
  57. + [path to program that reports GDLIB configuration]),
  58. + [
  59. + case "${withval}" in
  60. + "") ;;
  61. + yes|no)
  62. + AC_MSG_ERROR(invalid option --with(out)-gdlib-config - see docs/configure.txt)
  63. + ;;
  64. + *)
  65. + GDLIB_CONFIG="${withval}"
  66. + ;;
  67. + esac
  68. + ])
  69. +
  70. + AC_MSG_CHECKING(for gd version via ${GDLIB_CONFIG})
  71. + GD_VERSION=`${GDLIB_CONFIG} --version 2>/dev/null`
  72. if test "$?" != "0" -o -z "${GD_VERSION}"; then
  73. GD_VERSION="none"
  74. fi
  75. @@ -30,13 +47,13 @@ if test -z "${nut_have_libgd_seen}"; then
  76. none)
  77. ;;
  78. 2.0.5 | 2.0.6 | 2.0.7)
  79. - AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use gdlib-config script]])
  80. + AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script]])
  81. AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]])
  82. ;;
  83. *)
  84. - CFLAGS="`gdlib-config --includes 2>/dev/null`"
  85. - LDFLAGS="`gdlib-config --ldflags 2>/dev/null`"
  86. - LIBS="`gdlib-config --libs 2>/dev/null`"
  87. + CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`"
  88. + LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`"
  89. + LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`"
  90. ;;
  91. esac
  92. diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4
  93. index e1c1426..83b2633 100644
  94. --- a/m4/nut_check_libnetsnmp.m4
  95. +++ b/m4/nut_check_libnetsnmp.m4
  96. @@ -13,9 +13,26 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
  97. CFLAGS_ORIG="${CFLAGS}"
  98. LIBS_ORIG="${LIBS}"
  99. + dnl By default seek in PATH
  100. + NET_SNMP_CONFIG=net-snmp-config
  101. + AC_ARG_WITH(net-snmp-config,
  102. + AS_HELP_STRING([@<:@--with-net-snmp-config=/path/to/net-snmp-config@:>@],
  103. + [path to program that reports Net-SNMP configuration]),
  104. + [
  105. + case "${withval}" in
  106. + "") ;;
  107. + yes|no)
  108. + AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt)
  109. + ;;
  110. + *)
  111. + NET_SNMP_CONFIG="${withval}"
  112. + ;;
  113. + esac
  114. + ])
  115. +
  116. dnl See which version of the Net-SNMP library (if any) is installed
  117. - AC_MSG_CHECKING(for Net-SNMP version via net-snmp-config)
  118. - SNMP_VERSION=`net-snmp-config --version 2>/dev/null`
  119. + AC_MSG_CHECKING(for Net-SNMP version via ${NET_SNMP_CONFIG})
  120. + SNMP_VERSION=`${NET_SNMP_CONFIG} --version 2>/dev/null`
  121. if test "$?" != "0" -o -z "${SNMP_VERSION}"; then
  122. SNMP_VERSION="none"
  123. fi
  124. @@ -33,7 +50,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
  125. CFLAGS="${withval}"
  126. ;;
  127. esac
  128. - ], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"])
  129. + ], [CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`"])
  130. AC_MSG_RESULT([${CFLAGS}])
  131. AC_MSG_CHECKING(for Net-SNMP libs)
  132. @@ -48,7 +65,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
  133. LIBS="${withval}"
  134. ;;
  135. esac
  136. - ], [LIBS="`net-snmp-config --libs 2>/dev/null`"])
  137. + ], [LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`"])
  138. AC_MSG_RESULT([${LIBS}])
  139. dnl Check if the Net-SNMP library is usable
  140. --
  141. 2.7.4