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
7 [yann.morin.1998@free.fr: backport]
8 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
11 Backported from upstream commit 086b5fa8fe4ba74404e92b5f838263dfcf9f173d
13 docs/configure.txt | 14 ++++++++++++++
14 m4/nut_check_libgd.m4 | 29 +++++++++++++++++++++++------
15 m4/nut_check_libnetsnmp.m4 | 25 +++++++++++++++++++++----
16 3 files changed, 58 insertions(+), 10 deletions(-)
18 diff --git a/docs/configure.txt b/docs/configure.txt
19 index aff82c1..b3b542a 100644
20 --- a/docs/configure.txt
21 +++ b/docs/configure.txt
22 @@ -23,6 +23,13 @@ Note that you need to install the libusb development package or files.
23 Build and install the SNMP drivers (default: auto-detect)
24 Note that you need to install libsnmp development package or files.
26 + --with-net-snmp-config
28 +In addition to the `--with-snmp` option above, this one allows to provide
29 +a custom program name (in `PATH`) or complete pathname to `net-snmp-config`.
30 +This may be needed on build systems which support multiple architectures,
31 +or in cases where your distribution names this program differently.
35 Build and install the XML drivers (default: auto-detect)
36 @@ -335,6 +342,13 @@ NOTE: the --with-gd switches are not necessary if you have gd 2.0.8
37 or higher installed properly. The gdlib-config script will be
38 detected and used by default in that situation.
42 +This option allows to provide a custom program name (in `PATH`) or
43 +a complete pathname to `gdlib-config`. This may be needed on build
44 +systems which support multiple architectures, or in cases where your
45 +distribution names this program differently.
47 --with-ssl-includes, --with-usb-includes, --with-snmp-includes,
48 --with-neon-includes, --with-libltdl-includes,
49 --with-powerman-includes="-I/foo/bar"
50 diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4
51 index 01cc882..73f4da7 100644
52 --- a/m4/nut_check_libgd.m4
53 +++ b/m4/nut_check_libgd.m4
54 @@ -19,8 +19,25 @@ if test -z "${nut_have_libgd_seen}"; then
55 LDFLAGS="-L/usr/X11R6/lib"
56 LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11"
58 - AC_MSG_CHECKING(for gd version via gdlib-config)
59 - GD_VERSION=`gdlib-config --version 2>/dev/null`
60 + dnl By default seek in PATH
61 + GDLIB_CONFIG=gdlib-config
62 + AC_ARG_WITH(gdlib-config,
63 + AS_HELP_STRING([@<:@--with-gdlib-config=/path/to/gdlib-config@:>@],
64 + [path to program that reports GDLIB configuration]),
66 + case "${withval}" in
69 + AC_MSG_ERROR(invalid option --with(out)-gdlib-config - see docs/configure.txt)
72 + GDLIB_CONFIG="${withval}"
77 + AC_MSG_CHECKING(for gd version via ${GDLIB_CONFIG})
78 + GD_VERSION=`${GDLIB_CONFIG} --version 2>/dev/null`
79 if test "$?" != "0" -o -z "${GD_VERSION}"; then
82 @@ -30,13 +47,13 @@ if test -z "${nut_have_libgd_seen}"; then
85 2.0.5 | 2.0.6 | 2.0.7)
86 - AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use gdlib-config script]])
87 + AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script]])
88 AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]])
91 - CFLAGS="`gdlib-config --includes 2>/dev/null`"
92 - LDFLAGS="`gdlib-config --ldflags 2>/dev/null`"
93 - LIBS="`gdlib-config --libs 2>/dev/null`"
94 + CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`"
95 + LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`"
96 + LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`"
100 diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4
101 index e1c1426..83b2633 100644
102 --- a/m4/nut_check_libnetsnmp.m4
103 +++ b/m4/nut_check_libnetsnmp.m4
104 @@ -13,9 +13,26 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
105 CFLAGS_ORIG="${CFLAGS}"
108 + dnl By default seek in PATH
109 + NET_SNMP_CONFIG=net-snmp-config
110 + AC_ARG_WITH(net-snmp-config,
111 + AS_HELP_STRING([@<:@--with-net-snmp-config=/path/to/net-snmp-config@:>@],
112 + [path to program that reports Net-SNMP configuration]),
114 + case "${withval}" in
117 + AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt)
120 + NET_SNMP_CONFIG="${withval}"
125 dnl See which version of the Net-SNMP library (if any) is installed
126 - AC_MSG_CHECKING(for Net-SNMP version via net-snmp-config)
127 - SNMP_VERSION=`net-snmp-config --version 2>/dev/null`
128 + AC_MSG_CHECKING(for Net-SNMP version via ${NET_SNMP_CONFIG})
129 + SNMP_VERSION=`${NET_SNMP_CONFIG} --version 2>/dev/null`
130 if test "$?" != "0" -o -z "${SNMP_VERSION}"; then
133 @@ -33,7 +50,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
137 - ], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"])
138 + ], [CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`"])
139 AC_MSG_RESULT([${CFLAGS}])
141 AC_MSG_CHECKING(for Net-SNMP libs)
142 @@ -48,7 +65,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
146 - ], [LIBS="`net-snmp-config --libs 2>/dev/null`"])
147 + ], [LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`"])
148 AC_MSG_RESULT([${LIBS}])
150 dnl Check if the Net-SNMP library is usable