]> git.ipfire.org Git - thirdparty/collectd.git/blame - configure.ac
Merge pull request #4238 from kenhys/test-lua-plugin
[thirdparty/collectd.git] / configure.ac
CommitLineData
86ca149a 1dnl Process this file with autoconf to produce a configure script.
275c43ec 2AC_PREREQ([2.60])
e9adb525 3AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
dbb211a7 4AC_CONFIG_SRCDIR(src/target_set.c)
6e765a02 5AC_CONFIG_HEADERS(src/config.h)
98153711
RK
6AC_CONFIG_AUX_DIR([build-aux])
7AC_CONFIG_MACRO_DIR([m4])
65e2acb6 8
9ab0a540
RK
9dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
10dnl we don't really need the 'u' even in older toolchains. Then there is
11dnl older libtool, which spelled it AR_FLAGS
12m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
13
2de52927 14LT_INIT([dlopen disable-static])
2a8e9257 15
62bff38f 16AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 no-dist-gzip foreign])
a2983ff8 17m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
86ca149a
FF
18AC_LANG(C)
19
20AC_PREFIX_DEFAULT("/opt/collectd")
21
9e7918de
SH
22AC_SYS_LARGEFILE
23
15996f86
FF
24#
25# Checks for programs.
26#
ae634791
RK
27AC_PROG_CC_C99([],
28 [AC_MSG_ERROR([No compiler found that supports C99])]
29)
be26f4eb
RK
30
31AX_COMPILER_VENDOR
32
408b3fc3 33AC_PROG_CXX
86ca149a 34AC_PROG_CPP
d23caf50 35AC_PROG_EGREP
86ca149a
FF
36AC_PROG_INSTALL
37AC_PROG_LN_S
38AC_PROG_MAKE_SET
30f3e7b8 39AM_PROG_CC_C_O
86ca149a 40
108c20b2
FF
41AC_PROG_LEX
42AC_PROG_YACC
b1582672 43
f4366504 44AC_PATH_PROG([VALGRIND], [valgrind])
f4366504 45
b1582672
RK
46# Warn when pkg.m4 is missing
47m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
48
249d5776 49PKG_PROG_PKG_CONFIG
86ca149a 50
865f2eb3
RK
51AC_CACHE_CHECK([if Bison is the parser generator],
52 [collectd_cv_prog_bison],
53 [
54 AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
55 [collectd_cv_prog_bison=yes],
56 [collectd_cv_prog_bison=no]
57 )
58 ]
d23caf50
RK
59)
60
865f2eb3
RK
61if test "x$collectd_cv_prog_bison" = "xno" && test ! -f "${srcdir}/src/liboconfig/parser.c"; then
62 AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison])
d23caf50
RK
63fi
64
ac295b96
RK
65if test "x$lt_cv_dlopen" = "xno"; then
66 AC_MSG_ERROR([Your system does not support dlopen])
67fi
98153711
RK
68
69AC_SUBST([DLOPEN_LIBS], [$lt_cv_dlopen_libs])
70
23a8901d 71
af18c7e0
FF
72AC_MSG_CHECKING([for kernel type ($host_os)])
73case $host_os in
865f2eb3
RK
74 *aix*)
75 AC_DEFINE([KERNEL_AIX], [1], [True if program is to be compiled for a AIX kernel])
76 ac_system="AIX"
77 ;;
78 *darwin*)
79 AC_DEFINE([KERNEL_DARWIN], [1], [True if program is to be compiled for a Darwin kernel])
80 ac_system="Darwin"
81 ;;
82 *freebsd*)
83 AC_DEFINE([KERNEL_FREEBSD], [1], [True if program is to be compiled for a FreeBSD kernel])
84 ac_system="FreeBSD"
85 ;;
86 *linux*)
87 AC_DEFINE([KERNEL_LINUX], [1], [True if program is to be compiled for a Linux kernel])
88 ac_system="Linux"
89 ;;
90 *netbsd*)
91 AC_DEFINE([KERNEL_NETBSD], [1], [True if program is to be compiled for a NetBSD kernel])
92 ac_system="NetBSD"
93 ;;
94 *openbsd*)
95 AC_DEFINE([KERNEL_OPENBSD], [1], [True if program is to be compiled for an OpenBSD kernel])
96 ac_system="OpenBSD"
97 ;;
98 *solaris*)
99 AC_DEFINE([KERNEL_SOLARIS], [1], [True if program is to be compiled for a Solaris kernel])
100 ac_system="Solaris"
101 ;;
df135922
SC
102 *mingw32*)
103 AC_DEFINE([KERNEL_WIN32], [1], [True if program is to be compiled for a Windows kernel])
104 ac_system="Windows"
105 ;;
865f2eb3
RK
106 *)
107 ac_system="unknown"
108 ;;
af18c7e0
FF
109esac
110AC_MSG_RESULT([$ac_system])
111
08fcc343
RK
112AM_CONDITIONAL([BUILD_AIX], [test "x$ac_system" = "xAIX"])
113AM_CONDITIONAL([BUILD_DARWIN], [test "x$ac_system" = "xDarwin"])
114AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"])
115AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"])
116AM_CONDITIONAL([BUILD_OPENBSD], [test "x$ac_system" = "xOpenBSD"])
7346b09e 117AM_CONDITIONAL([BUILD_NETBSD], [test "x$ac_system" = "xNetBSD"])
08fcc343 118AM_CONDITIONAL([BUILD_SOLARIS], [test "x$ac_system" = "xSolaris"])
df135922 119AM_CONDITIONAL([BUILD_WIN32], [test "x$ac_system" = "xWindows"])
15e2832f 120
865f2eb3
RK
121if test "x$ac_system" = "xSolaris"; then
122 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS], [1], [Define to enforce POSIX thread semantics under Solaris.])
123 AC_DEFINE([_REENTRANT], [1], [Define to enable reentrancy interfaces.])
9bf39535 124
865f2eb3
RK
125 AC_MSG_CHECKING([whether compiler builds 64bit binaries])
126 AC_COMPILE_IFELSE(
127 [
128 AC_LANG_PROGRAM(
129 [
130 #ifndef _LP64
131 # error "Compiler not in 64bit mode."
132 #endif
133 ]
134 )
135 ],
136 [AC_MSG_RESULT([yes])],
137 [
138 AC_MSG_RESULT([no])
139 AC_MSG_NOTICE([Solaris detected. Please consider building a 64-bit binary.])
140 ]
141 )
9bf39535
BB
142fi
143
865f2eb3
RK
144if test "x$ac_system" = "xAIX"; then
145 AC_DEFINE([_THREAD_SAFE_ERRNO], [1], [Define to use the thread-safe version of errno under AIX.])
13cbf9d4 146fi
1862f170 147
59df544d 148if test "x${prefix}" != xNONE; then
149 AC_DEFINE_UNQUOTED([PREFIX], ["${prefix}"], [Define the install prefix.])
150fi
151
9ece08de
FF
152# Where to install .pc files.
153pkgconfigdir="${libdir}/pkgconfig"
865f2eb3 154AC_SUBST([pkgconfigdir])
7bec4afe 155
15996f86
FF
156#
157# Checks for header files.
158#
86ca149a 159AC_HEADER_SYS_WAIT
6e765a02 160AC_HEADER_DIRENT
a905d397 161
865f2eb3 162AC_CHECK_HEADERS_ONCE([ \
e81567f2 163 arpa/inet.h \
e81567f2 164 endian.h \
e81567f2
FF
165 fcntl.h \
166 fnmatch.h \
167 fs_info.h \
168 fshelp.h \
169 grp.h \
170 kstat.h \
171 kvm.h \
172 libgen.h \
38fac5d5 173 locale.h \
e81567f2
FF
174 mntent.h \
175 mnttab.h \
176 netdb.h \
177 paths.h \
178 poll.h \
179 pthread_np.h \
180 pwd.h \
181 regex.h \
6e006e93 182 sys/endian.h \
e81567f2
FF
183 sys/fs_types.h \
184 sys/fstyp.h \
185 sys/ioctl.h \
186 sys/isa_defs.h \
187 sys/mntent.h \
188 sys/mnttab.h \
189 sys/param.h \
190 sys/resource.h \
191 sys/select.h \
192 sys/socket.h \
193 sys/statfs.h \
194 sys/statvfs.h \
195 sys/types.h \
196 sys/un.h \
197 sys/vfs.h \
198 sys/vfstab.h \
199 sys/vmmeter.h \
200 syslog.h \
865f2eb3 201 wordexp.h
e81567f2 202])
15996f86 203
865f2eb3
RK
204if test "x$ac_system" = "xNetBSD"; then
205 # For entropy plugin on newer NetBSD
206 AC_CHECK_HEADERS([sys/rndio.h], [], [],
207 [[
208 #if HAVE_SYS_TYPES_H
209 # include <sys/types.h>
210 #endif
211 #if HAVE_SYS_IOCTL_H
212 # include <sys/ioctl.h>
213 #endif
214 #if HAVE_SYS_PARAM_H
215 # include <sys/param.h>
216 #endif
217 ]]
218 )
219fi
f0446c10 220
c9a5b034 221# For ping library
865f2eb3
RK
222AC_CHECK_HEADERS([netinet/in_systm.h], [], [],
223 [[
224 #include <stdint.h>
225 #if HAVE_SYS_TYPES_H
226 # include <sys/types.h>
227 #endif
228 ]]
229)
21ba59f8 230
865f2eb3
RK
231AC_CHECK_HEADERS([netinet/in.h], [], [],
232 [[
233 #include <stdint.h>
234 #if HAVE_SYS_TYPES_H
235 # include <sys/types.h>
236 #endif
237 #if HAVE_NETINET_IN_SYSTM_H
238 # include <netinet/in_systm.h>
239 #endif
240 ]]
241)
a621ced2 242
865f2eb3
RK
243AC_CHECK_HEADERS([netinet/ip.h], [], [],
244 [[
245 #include <stdint.h>
246 #if HAVE_SYS_TYPES_H
247 # include <sys/types.h>
248 #endif
249 #if HAVE_NETINET_IN_SYSTM_H
250 # include <netinet/in_systm.h>
251 #endif
252 #if HAVE_NETINET_IN_H
253 # include <netinet/in.h>
254 #endif
255 ]]
256)
a621ced2 257
865f2eb3
RK
258AC_CHECK_HEADERS([netinet/ip_icmp.h], [], [],
259 [[
260 #include <stdint.h>
261 #if HAVE_SYS_TYPES_H
262 # include <sys/types.h>
263 #endif
264 #if HAVE_NETINET_IN_SYSTM_H
265 # include <netinet/in_systm.h>
266 #endif
267 #if HAVE_NETINET_IN_H
268 # include <netinet/in.h>
269 #endif
270 #if HAVE_NETINET_IP_H
271 # include <netinet/ip.h>
272 #endif
273 ]]
274)
90151473 275
865f2eb3
RK
276AC_CHECK_HEADERS([netinet/ip_var.h], [], [],
277 [[
278 #include <stdint.h>
279 #if HAVE_SYS_TYPES_H
280 # include <sys/types.h>
281 #endif
282 #if HAVE_NETINET_IN_SYSTM_H
283 # include <netinet/in_systm.h>
284 #endif
285 #if HAVE_NETINET_IN_H
286 # include <netinet/in.h>
287 #endif
288 #if HAVE_NETINET_IP_H
289 # include <netinet/ip.h>
290 #endif
291 ]]
292)
90151473 293
865f2eb3
RK
294AC_CHECK_HEADERS([netinet/ip6.h], [], [],
295 [[
296 #include <stdint.h>
297 #if HAVE_SYS_TYPES_H
298 # include <sys/types.h>
299 #endif
300 #if HAVE_NETINET_IN_SYSTM_H
301 # include <netinet/in_systm.h>
302 #endif
303 #if HAVE_NETINET_IN_H
304 # include <netinet/in.h>
305 #endif
306 ]]
307)
e1d497b7 308
865f2eb3
RK
309AC_CHECK_HEADERS([netinet/icmp6.h], [], [],
310 [[
311 #include <stdint.h>
312 #if HAVE_SYS_TYPES_H
313 # include <sys/types.h>
314 #endif
315 #if HAVE_NETINET_IN_SYSTM_H
316 # include <netinet/in_systm.h>
317 #endif
318 #if HAVE_NETINET_IN_H
319 # include <netinet/in.h>
320 #endif
321 #if HAVE_NETINET_IP6_H
322 # include <netinet/ip6.h>
323 #endif
324 ]]
325)
917d7fa8 326
865f2eb3
RK
327AC_CHECK_HEADERS([netinet/tcp.h], [], [],
328 [[
329 #include <stdint.h>
330 #if HAVE_SYS_TYPES_H
331 # include <sys/types.h>
332 #endif
333 #if HAVE_NETINET_IN_SYSTM_H
334 # include <netinet/in_systm.h>
335 #endif
336 #if HAVE_NETINET_IN_H
337 # include <netinet/in.h>
338 #endif
339 #if HAVE_NETINET_IP_H
340 # include <netinet/ip.h>
341 #endif
342 ]]
343)
f0446c10 344
865f2eb3
RK
345AC_CHECK_HEADERS([netinet/udp.h], [], [],
346 [[
347 #include <stdint.h>
348 #if HAVE_SYS_TYPES_H
349 # include <sys/types.h>
350 #endif
351 #if HAVE_NETINET_IN_SYSTM_H
352 # include <netinet/in_systm.h>
353 #endif
354 #if HAVE_NETINET_IN_H
355 # include <netinet/in.h>
356 #endif
357 #if HAVE_NETINET_IP_H
358 # include <netinet/ip.h>
359 #endif
360 ]]
361)
46ed2804 362
865f2eb3
RK
363# For cpu modules
364AC_CHECK_HEADERS([sys/dkstat.h])
b5b9a852 365if test "x$ac_system" = "xDarwin"; then
865f2eb3 366 AC_CHECK_HEADERS(
bf733a75 367 [ \
865f2eb3
RK
368 mach/mach_init.h \
369 mach/host_priv.h \
370 mach/mach_error.h \
371 mach/mach_host.h \
372 mach/mach_port.h \
373 mach/mach_types.h \
374 mach/message.h \
375 mach/processor_set.h \
376 mach/processor.h \
377 mach/processor_info.h \
378 mach/task.h \
379 mach/thread_act.h \
380 mach/vm_region.h \
381 mach/vm_map.h \
382 mach/vm_prot.h \
383 mach/vm_statistics.h \
384 mach/kern_return.h \
385 CoreFoundation/CoreFoundation.h \
386 IOKit/IOKitLib.h \
387 IOKit/IOTypes.h \
388 IOKit/ps/IOPSKeys.h \
389 IOKit/IOBSD.h \
390 IOKit/storage/IOBlockStorageDriver.h
bf733a75 391 ]
865f2eb3 392 )
9ce2a30d 393
865f2eb3
RK
394 # For the battery plugin
395 AC_CHECK_HEADERS([IOKit/ps/IOPowerSources.h], [], [],
396 [[
397 #if HAVE_IOKIT_IOKITLIB_H
398 # include <IOKit/IOKitLib.h>
399 #endif
400 #if HAVE_IOKIT_IOTYPES_H
401 # include <IOKit/IOTypes.h>
402 #endif
403 ]]
404 )
72a6ea58
FF
405fi
406
865f2eb3
RK
407AC_CHECK_HEADERS([sys/sysctl.h], [], [],
408 [[
409 #if HAVE_SYS_TYPES_H
410 # include <sys/types.h>
411 #endif
412 #if HAVE_SYS_PARAM_H
413 # include <sys/param.h>
414 #endif
415 ]]
416)
86ca149a 417
3268a333 418# For interface plugin
865f2eb3
RK
419AC_CHECK_HEADERS([ifaddrs.h])
420AC_CHECK_HEADERS([net/if.h], [], [],
421 [[
422 #if HAVE_SYS_TYPES_H
423 # include <sys/types.h>
424 #endif
425 #if HAVE_SYS_SOCKET_H
426 # include <sys/socket.h>
427 #endif
428 ]]
429)
430
b5b9a852 431if test "x$ac_system" = "xLinux"; then
865f2eb3
RK
432 # For hddtemp module
433 AC_CHECK_HEADERS([linux/major.h])
434
435 # For md module (Linux only)
436 AC_CHECK_HEADERS([linux/raid/md_u.h],
437 [have_linux_raid_md_u_h="yes"],
438 [have_linux_raid_md_u_h="no"],
439 [[
440 #include <sys/ioctl.h>
441 #include <linux/major.h>
442 #include <linux/types.h>
443 ]]
444 )
445 AC_CHECK_HEADERS([sys/sysmacros.h])
446
447 AC_CHECK_HEADERS([linux/wireless.h],
448 [have_linux_wireless_h="yes"],
449 [have_linux_wireless_h="no"],
450 [[
451 #include <dirent.h>
452 #include <sys/ioctl.h>
453 #include <sys/socket.h>
454 ]]
455 )
a05e34a0 456
865f2eb3
RK
457 AC_CHECK_HEADERS([linux/if.h], [], [],
458 [[
459 #if HAVE_SYS_TYPES_H
460 # include <sys/types.h>
461 #endif
462 #if HAVE_SYS_SOCKET_H
463 # include <sys/socket.h>
464 #endif
465 ]]
466 )
bbf0d6f3 467
865f2eb3
RK
468 AC_CHECK_HEADERS([linux/inet_diag.h], [], [],
469 [[
470 #if HAVE_SYS_TYPES_H
471 # include <sys/types.h>
472 #endif
473 #if HAVE_SYS_SOCKET_H
474 # include <sys/socket.h>
475 #endif
476 ]]
477 )
bbf0d6f3 478
865f2eb3
RK
479 AC_CHECK_HEADERS([linux/netdevice.h], [], [],
480 [[
481 #if HAVE_SYS_TYPES_H
482 # include <sys/types.h>
483 #endif
484 #if HAVE_SYS_SOCKET_H
485 # include <sys/socket.h>
486 #endif
487 #if HAVE_LINUX_IF_H
488 # include <linux/if.h>
489 #endif
490 ]]
491 )
bbf0d6f3 492
865f2eb3
RK
493 # For ethstat module
494 AC_CHECK_HEADERS([linux/sockios.h],
8ae25a97
FF
495 [have_linux_sockios_h="yes"],
496 [have_linux_sockios_h="no"],
865f2eb3
RK
497 [[
498 #if HAVE_SYS_IOCTL_H
499 # include <sys/ioctl.h>
500 #endif
501 #if HAVE_NET_IF_H
502 # include <net/if.h>
503 #endif
504 ]]
505 )
bbf0d6f3 506
865f2eb3 507 AC_CHECK_HEADERS([linux/ethtool.h],
8ae25a97
FF
508 [have_linux_ethtool_h="yes"],
509 [have_linux_ethtool_h="no"],
865f2eb3
RK
510 [[
511 #if HAVE_SYS_IOCTL_H
512 # include <sys/ioctl.h>
513 #endif
514 #if HAVE_NET_IF_H
515 # include <net/if.h>
516 #endif
517 #if HAVE_LINUX_SOCKIOS_H
518 # include <linux/sockios.h>
519 #endif
520 ]]
521 )
9bf39535 522
865f2eb3 523 # For ipvs module
3c1af627 524 AC_CHECK_HEADERS_ONCE([linux/ip_vs.h])
d87bf146 525
865f2eb3
RK
526 # For the email plugin
527 AC_CHECK_HEADERS([linux/un.h], [], [],
528 [[
529 #if HAVE_SYS_SOCKET_H
530 # include <sys/socket.h>
531 #endif
532 ]]
533 )
534 # For the turbostat plugin
865f2eb3
RK
535 AC_CHECK_HEADERS([cpuid.h],
536 [have_cpuid_h="yes"],
537 [have_cpuid_h="no (cpuid.h not found)"]
538 )
bbf0d6f3 539
865f2eb3
RK
540 AC_CHECK_HEADERS([sys/capability.h],
541 [have_capability="yes"],
542 [have_capability="no (<sys/capability.h> not found)"]
543 )
d87bf146 544
865f2eb3 545 if test "x$have_capability" = "xyes"; then
c3d354c5 546 AC_CHECK_LIB([cap], [cap_get_proc],
865f2eb3 547 [have_capability="yes"],
c3d354c5 548 [have_capability="no (cap_get_proc() not found)"]
865f2eb3
RK
549 )
550 fi
d87bf146 551
9717b1a5
RK
552 if test "x$have_capability" = "xyes"; then
553 AC_CHECK_DECL([CAP_IS_SUPPORTED],
554 [have_capability="yes"],
555 [have_capability="no (CAP_IS_SUPPORTED not found)"],
556 [[#include <sys/capability.h>]]
557 )
558 fi
d87bf146 559
865f2eb3 560 if test "x$have_capability" = "xyes"; then
c3d354c5 561 AC_DEFINE([HAVE_CAPABILITY], [1], [Define to 1 if you have cap_get_proc() (-lcap).])
865f2eb3 562 fi
d87bf146 563
81467859
KW
564 # For pcie_errors plugin
565 AC_CHECK_HEADERS([linux/pci_regs.h],
566 [have_pci_regs_h="yes"],
567 [have_pci_regs_h="no (linux/pci_regs.h not found)"]
568 )
569
865f2eb3
RK
570else
571 have_linux_raid_md_u_h="no"
572 have_linux_wireless_h="no"
fb3a07dc 573fi
865f2eb3 574
865f2eb3
RK
575AM_CONDITIONAL([BUILD_WITH_CAPABILITY], [test "x$have_capability" = "xyes"])
576
577# For the swap module
578have_sys_swap_h="yes"
579AC_CHECK_HEADERS([sys/swap.h vm/anon.h],
580 [],
581 [have_sys_swap_h="no"],
582 [[
583 #undef _FILE_OFFSET_BITS
584 #undef _LARGEFILE64_SOURCE
585 #if HAVE_SYS_TYPES_H
586 # include <sys/types.h>
587 #endif
588 #if HAVE_SYS_PARAM_H
589 # include <sys/param.h>
590 #endif
591 ]]
592)
593
594# For load module
595# For the processes plugin
596# For users module
597AC_CHECK_HEADERS([sys/loadavg.h linux/config.h utmp.h utmpx.h])
fb3a07dc 598
6e765a02 599# For quota module
865f2eb3
RK
600AC_CHECK_HEADERS([sys/ucred.h], [], [],
601 [[
602 #if HAVE_SYS_TYPES_H
603 # include <sys/types.h>
604 #endif
605 #if HAVE_SYS_PARAM_H
606 # include <sys/param.h>
607 #endif
608 ]]
609)
6e765a02
FF
610
611# For mount interface
865f2eb3
RK
612AC_CHECK_HEADERS([sys/mount.h], [], [],
613 [[
614 #if HAVE_SYS_TYPES_H
615 # include <sys/types.h>
616 #endif
617 #if HAVE_SYS_PARAM_H
618 # include <sys/param.h>
619 #endif
620 ]]
621)
fc257d86 622
e3dcabb7
RK
623# --enable-xfs {{{
624AC_ARG_ENABLE([xfs],
625 [AS_HELP_STRING([--enable-xfs], [xfs support in df plugin @<:@default=yes@:>@])],
626 [],
627 [enable_xfs="auto"]
628)
629
630if test "x$enable_xfs" != "xno"; then
631 AC_CHECK_HEADERS([xfs/xqm.h],
632 [],
633 [
634 if test "x$enable_xfs" = "xyes"; then
635 AC_MSG_ERROR([xfs/xqm.h not found])
636 fi
637 ],
638 [[#define _GNU_SOURCE]]
639 )
640fi
641
642# }}}
ec88fb0e 643
865f2eb3
RK
644AC_CHECK_HEADERS([net/if_arp.h], [], [],
645 [[
646 #if HAVE_SYS_SOCKET_H
647 # include <sys/socket.h>
648 #endif
649 ]]
650)
dd7a9bc9 651
865f2eb3
RK
652AC_CHECK_HEADERS([net/ppp_defs.h])
653AC_CHECK_HEADERS([net/if_ppp.h], [], [],
654 [[
655 #if HAVE_NET_PPP_DEFS_H
656 # include <net/ppp_defs.h>
657 #endif
658 ]]
659)
660
661AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
662 [[
663 #include <stdint.h>
664 #if HAVE_SYS_TYPES_H
665 # include <sys/types.h>
666 #endif
667 #if HAVE_SYS_SOCKET_H
668 # include <sys/socket.h>
669 #endif
670 #if HAVE_NET_IF_H
671 # include <net/if.h>
672 #endif
673 #if HAVE_NETINET_IN_H
674 # include <netinet/in.h>
675 #endif
676 ]]
677)
678
679AC_CHECK_HEADERS([net/pfvar.h],
680 [have_net_pfvar_h="yes"],
681 [have_net_pfvar_h="no"],
682 [[
683 #if HAVE_SYS_IOCTL_H
684 # include <sys/ioctl.h>
685 #endif
686 #if HAVE_SYS_SOCKET_H
687 # include <sys/socket.h>
688 #endif
689 #if HAVE_NET_IF_H
690 # include <net/if.h>
691 #endif
692 #if HAVE_NETINET_IN_H
693 # include <netinet/in.h>
694 #endif
695 ]]
696)
43bc16aa 697
51e70a99 698# For the multimeter plugin
865f2eb3
RK
699AC_CHECK_HEADERS([termios.h],
700 [have_termios_h="yes"],
701 [have_termios_h="no"]
702)
51e70a99 703
b4415dd4
R
704# For cpusleep plugin
705AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported],
865f2eb3
RK
706 [c_cv_have_clock_boottime_monotonic],
707 [
708 AC_COMPILE_IFELSE(
709 [AC_LANG_PROGRAM(
710 [[#include <time.h>]],
711 [[
712 struct timespec b, m;
713 clock_gettime(CLOCK_BOOTTIME, &b );
714 clock_gettime(CLOCK_MONOTONIC, &m );
715 ]]
716 )
717 ],
718 [c_cv_have_clock_boottime_monotonic="yes"],
719 [c_cv_have_clock_boottime_monotonic="no"]
720 )
721 ]
722)
6b9773c7 723
58acba67 724
15996f86
FF
725#
726# Checks for typedefs, structures, and compiler characteristics.
727#
86ca149a
FF
728AC_C_CONST
729AC_TYPE_PID_T
730AC_TYPE_SIZE_T
7df03651 731AC_TYPE_UID_T
86ca149a
FF
732AC_HEADER_TIME
733
865f2eb3
RK
734test_cxx_flags() {
735 AC_LANG_PUSH([C++])
736 AC_LANG_CONFTEST(
737 [AC_LANG_SOURCE([[int main(void){}]]) ]
738 )
739 $CXX -c conftest.cpp $CXXFLAGS $@ > /dev/null 2> /dev/null
740 ret=$?
741 rm -f conftest.o
742 AC_LANG_POP([C++])
743 return $ret
744}
745
15996f86
FF
746#
747# Checks for library functions.
748#
865f2eb3
RK
749AC_CHECK_FUNCS_ONCE([ \
750 asprintf \
c23a978a 751 execvpe \
df135922 752 getpwnam \
865f2eb3 753 getpwnam_r \
865f2eb3 754 if_indextoname \
865f2eb3 755 setgroups \
7d63f73b 756 setlocale
865f2eb3
RK
757 ]
758)
15996f86 759
fa7db5e9
SH
760AC_FUNC_STRERROR_R
761
9317d073
DM
762if test "x$GCC" = "xyes"; then
763 SAVE_CFLAGS="$CFLAGS"
764 CFLAGS="$CFLAGS -Wall -Werror"
765fi
b09e7fc2 766SAVE_LDFLAGS="$LDFLAGS"
9a065c51 767LDFLAGS=""
b09e7fc2 768if test "x$ac_system" = "xWindows"; then
769 # This is exported from build.sh
770 LDFLAGS="$LDFLAGS -L${GNULIB_DIR}"
771fi
c4e077cc 772
0c06f2fa 773AC_CACHE_CHECK([for strtok_r],
5f5da97b 774 [c_cv_have_strtok_r_default],
865f2eb3
RK
775 [
776 AC_LINK_IFELSE(
777 [
778 AC_LANG_PROGRAM(
779 [[
780 #include <stdlib.h>
781 #include <stdio.h>
782 #include <string.h>
783 ]],
784 [[
785 char buffer[] = "foo,bar,baz";
786 char *token;
787 char *dummy;
788 char *saveptr;
789
790 dummy = buffer;
791 saveptr = NULL;
792 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
793 {
794 dummy = NULL;
795 printf ("token = %s;\n", token);
796 }
797 ]]
798 )
799 ],
800 [c_cv_have_strtok_r_default="yes"],
801 [c_cv_have_strtok_r_default="no"]
802 )
803 ]
0c06f2fa
FF
804)
805
865f2eb3 806if test "x$c_cv_have_strtok_r_default" = "xno"; then
0c06f2fa
FF
807 CFLAGS="$CFLAGS -D_REENTRANT=1"
808
809 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
5f5da97b 810 [c_cv_have_strtok_r_reentrant],
865f2eb3
RK
811 [
812 AC_LINK_IFELSE(
813 [
814 AC_LANG_PROGRAM(
815 [[
816 #include <stdlib.h>
817 #include <stdio.h>
818 #include <string.h>
819 ]],
820 [[
821 char buffer[] = "foo,bar,baz";
822 char *token;
823 char *dummy;
824 char *saveptr;
825
826 dummy = buffer;
827 saveptr = NULL;
828 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
829 {
830 dummy = NULL;
831 printf ("token = %s;\n", token);
832 }
833 ]]
834 )
835 ],
836 [c_cv_have_strtok_r_reentrant="yes"],
837 [AC_MSG_FAILURE([strtok_r is not available. Please file a bugreport!])]
838 )
839 ]
0c06f2fa
FF
840 )
841fi
842
c4e077cc 843CFLAGS="$SAVE_CFLAGS"
9a065c51 844LDFLAGS="$SAVE_LDFLAGS"
865f2eb3
RK
845if test "x$c_cv_have_strtok_r_reentrant" = "xyes"; then
846 CFLAGS="$CFLAGS -D_REENTRANT=1"
c4e077cc
FF
847fi
848
865f2eb3
RK
849AC_CHECK_FUNCS([socket],
850 [],
851 [
852 AC_CHECK_LIB([socket], [socket],
853 [socket_needs_socket="yes"],
df135922
SC
854 [
855 AC_CHECK_LIB([gnu], [rpl_socket],
856 [socket_needs_gnulib="yes"],
857 [AC_MSG_ERROR([cannot find socket() in libsocket])]
858 )
859 ]
865f2eb3
RK
860 )
861 ]
862)
863AM_CONDITIONAL([BUILD_WITH_LIBSOCKET], [test "x$socket_needs_socket" = "xyes"])
df135922 864AM_CONDITIONAL([BUILD_WITH_GNULIB], [test "x$socket_needs_gnulib" = "xyes"])
d89f6dc3 865
1dfd4ca2
DM
866AC_CHECK_FUNCS([inet_ntop],
867 [],
868 [
869 AC_CHECK_LIB([nsl], [inet_ntop],
870 [inet_ntop_needs_nsl="yes"],
871 [AC_MSG_ERROR([cannot find inet_ntop() in libnsl])]
872 )
873 ]
874)
875AM_CONDITIONAL([BUILD_WITH_LIBNSL], [test "x$inet_ntop_needs_nsl" = "xyes"])
876
1c2e2427 877clock_gettime_needs_posix4="no"
865f2eb3
RK
878AC_CHECK_FUNCS([clock_gettime],
879 [have_clock_gettime="yes"],
880 [have_clock_gettime="no"]
881)
882
b5b9a852 883if test "x$have_clock_gettime" = "xno"; then
865f2eb3
RK
884 AC_CHECK_LIB([rt], [clock_gettime],
885 [
886 clock_gettime_needs_rt="yes"
887 have_clock_gettime="yes"
888 ]
889 )
5c4d2189 890fi
865f2eb3 891
b5b9a852 892if test "x$have_clock_gettime" = "xno"; then
865f2eb3
RK
893 AC_CHECK_LIB([posix4], [clock_gettime],
894 [
895 clock_gettime_needs_posix4="yes"
896 have_clock_gettime="yes"
897 ]
898 )
899fi
900
b5b9a852 901if test "x$have_clock_gettime" = "xyes"; then
865f2eb3 902 AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if the clock_gettime(2) function is available.])
5c4d2189 903fi
1c2e2427 904
865f2eb3
RK
905AC_CHECK_FUNCS([nanosleep], [],
906 AC_CHECK_LIB([rt], [nanosleep],
907 [nanosleep_needs_rt="yes"],
908 [
909 AC_CHECK_LIB([posix4], [nanosleep],
910 [nanosleep_needs_posix4="yes"],
911 [AC_MSG_ERROR([cannot find nanosleep])]
912 )
913 ]
914 )
915)
916
917AM_CONDITIONAL([BUILD_WITH_LIBRT], [test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes"])
918AM_CONDITIONAL([BUILD_WITH_LIBPOSIX4], [test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes"])
919
920AC_CHECK_FUNCS([getifaddrs], [have_getifaddrs="yes"], [have_getifaddrs="no"])
921AC_CHECK_FUNCS([getloadavg], [have_getloadavg="yes"], [have_getloadavg="no"])
922AC_CHECK_FUNCS([getutent], [have_getutent="yes"], [have_getutent="no"])
923AC_CHECK_FUNCS([getutxent], [have_getutxent="yes"], [have_getutxent="no"])
924AC_CHECK_FUNCS([host_statistics], [have_host_statistics="yes"], [have_host_statistics="no"])
925AC_CHECK_FUNCS([processor_info], [have_processor_info="yes"], [have_processor_info="no"])
926AC_CHECK_FUNCS([statfs], [have_statfs="yes"], [have_statfs="no"])
927AC_CHECK_FUNCS([statvfs], [have_statvfs="yes"], [have_statvfs="no"])
928AC_CHECK_FUNCS([sysctl], [have_sysctl="yes"], [have_sysctl="no"])
929AC_CHECK_FUNCS([sysctlbyname], [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
930AC_CHECK_FUNCS([syslog], [have_syslog="yes"], [have_syslog="no"])
931AC_CHECK_FUNCS([thread_info], [have_thread_info="yes"], [have_thread_info="no"])
adee81fe
FF
932
933# Check for strptime {{{
b5b9a852 934if test "x$GCC" = "xyes"; then
865f2eb3
RK
935 SAVE_CFLAGS="$CFLAGS"
936 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
adee81fe
FF
937fi
938
865f2eb3 939AC_CHECK_FUNCS([strptime], [have_strptime="yes"], [have_strptime="no"])
b5b9a852 940if test "x$have_strptime" = "xyes"; then
865f2eb3
RK
941 AC_CACHE_CHECK([whether strptime is exported by default],
942 [c_cv_have_strptime_default],
943 [
944 AC_COMPILE_IFELSE(
945 [
946 AC_LANG_PROGRAM(
947 [[#include <time.h>]],
948 [[
949 struct tm stm;
950 (void)strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
951 ]]
952 )
953 ],
954 [c_cv_have_strptime_default="yes"],
955 [c_cv_have_strptime_default="no"])
956 ]
957 )
adee81fe 958fi
865f2eb3 959
b5b9a852 960if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"; then
865f2eb3
RK
961 AC_CACHE_CHECK([whether strptime needs standards mode],
962 [c_cv_have_strptime_standards],
963 [
964 AC_COMPILE_IFELSE(
965 [
966 AC_LANG_PROGRAM(
967 [[
968 #ifndef _ISOC99_SOURCE
969 # define _ISOC99_SOURCE 1
970 #endif
971 #ifndef _POSIX_C_SOURCE
972 # define _POSIX_C_SOURCE 200112L
973 #endif
974 #ifndef _XOPEN_SOURCE
975 # define _XOPEN_SOURCE 500
976 #endif
93fbc158
FW
977 # ifndef _BSD_SOURCE
978 # define _BSD_SOURCE
979 # endif
980 # ifndef _DEFAULT_SOURCE
981 # define _DEFAULT_SOURCE
982 # endif
865f2eb3
RK
983 #include <time.h>
984 ]],
985 [[
986 struct tm stm;
987 (void)strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
988 ]]
989 )
990 ],
991 [c_cv_have_strptime_standards="yes"],
992 [c_cv_have_strptime_standards="no"]
993 )
994 ]
995 )
996
997 if test "x$c_cv_have_strptime_standards" = "xyes"; then
998 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], [1],
999 [Set to true if strptime is only exported in X/Open mode (GNU libc).]
1000 )
1001 else
1002 have_strptime="no"
1003 fi
adee81fe
FF
1004fi
1005
b5b9a852 1006if test "x$GCC" = "xyes"; then
865f2eb3 1007 CFLAGS="$SAVE_CFLAGS"
adee81fe 1008fi
adee81fe
FF
1009# }}} Check for strptime
1010
c3e2a69b
FF
1011# Check for timegm {{{
1012
1013# These checks need -Werror because implicit function declarations are only a
1014# warning ...
1015SAVE_CFLAGS="$CFLAGS"
1016CFLAGS="$CFLAGS -Werror"
1017
1018AC_CACHE_CHECK([for timegm],
1019 [c_cv_have_timegm],
1020 AC_LINK_IFELSE(
1021 [AC_LANG_PROGRAM(
1022[[[
1023#if STRPTIME_NEEDS_STANDARDS
1024# ifndef _ISOC99_SOURCE
1025# define _ISOC99_SOURCE 1
1026# endif
1027# ifndef _POSIX_C_SOURCE
1028# define _POSIX_C_SOURCE 200112L
1029# endif
1030# ifndef _XOPEN_SOURCE
1031# define _XOPEN_SOURCE 500
1032# endif
93fbc158
FW
1033# ifndef _BSD_SOURCE
1034# define _BSD_SOURCE
1035# endif
1036# ifndef _DEFAULT_SOURCE
1037# define _DEFAULT_SOURCE
1038# endif
c3e2a69b
FF
1039#endif
1040#include <time.h>
1041]]],
1042[[[
1043 time_t t = timegm(&(struct tm){0});
1044 if (t == ((time_t) -1)) {
1045 return 1;
1046 }
1047]]]
1048 )],
1049 [c_cv_have_timegm="yes"],
1050 [c_cv_have_timegm="no"]
1051 )
1052)
1053
c3e2a69b
FF
1054if test "x$c_cv_have_timegm" = "xyes"
1055then
1056 AC_DEFINE(HAVE_TIMEGM, 1, [Define if the timegm(3) function is available.])
c3e2a69b
FF
1057fi
1058
1059CFLAGS="$SAVE_CFLAGS"
1060# }}} Check for timegm
1061
865f2eb3 1062AC_MSG_CHECKING([for sysctl kern.cp_times])
b5b9a852 1063if test -x /sbin/sysctl; then
865f2eb3
RK
1064 /sbin/sysctl kern.cp_times >/dev/null 2>&1
1065 if test $? -eq 0; then
1066 AC_MSG_RESULT([yes])
1067 AC_DEFINE([HAVE_SYSCTL_KERN_CP_TIMES], [1], [Define if sysctl supports kern.cp_times])
1068 else
1069 AC_MSG_RESULT([no])
1070 fi
1071else
1072 AC_MSG_RESULT([no])
1073fi
1074
1075AC_MSG_CHECKING([for sysctl kern.cp_time])
b5b9a852 1076if test -x /sbin/sysctl; then
865f2eb3
RK
1077 /sbin/sysctl kern.cp_time >/dev/null 2>&1
1078 if test $? -eq 0
1079 then
1080 AC_MSG_RESULT([yes])
1081 AC_DEFINE([HAVE_SYSCTL_KERN_CP_TIME], [1], [Define if sysctl supports kern.cp_time])
1082 else
1083 AC_MSG_RESULT([no])
1084 fi
1085else
1086 AC_MSG_RESULT([no])
1087fi
1088
1089AC_CHECK_FUNCS([swapctl], [have_swapctl="yes"], [have_swapctl="no"])
34eb0428 1090if test "x$have_swapctl" = "xyes"; then
865f2eb3
RK
1091 AC_CACHE_CHECK([whether swapctl takes two arguments],
1092 [c_cv_have_swapctl_two_args],
1093 [
1094 AC_COMPILE_IFELSE(
1095 [
1096 AC_LANG_PROGRAM(
1097 [[
1098 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
1099 # undef _FILE_OFFSET_BITS
1100 # undef _LARGEFILE64_SOURCE
1101 #endif
1102 #include <sys/stat.h>
1103 #include <sys/param.h>
1104 #include <sys/swap.h>
1105 #include <unistd.h>
1106 ]],
1107 [[int num = swapctl(0, NULL);]]
1108 )
1109 ],
1110 [c_cv_have_swapctl_two_args="yes"],
1111 [c_cv_have_swapctl_two_args="no"]
1112 )
1113 ]
1114 )
1115
1116 AC_CACHE_CHECK([whether swapctl takes three arguments],
1117 [c_cv_have_swapctl_three_args],
1118 [
1119 AC_COMPILE_IFELSE(
1120 [
1121 AC_LANG_PROGRAM(
1122 [[
1123 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
1124 # undef _FILE_OFFSET_BITS
1125 # undef _LARGEFILE64_SOURCE
1126 #endif
1127 #include <sys/stat.h>
1128 #include <sys/param.h>
1129 #include <sys/swap.h>
1130 #include <unistd.h>
1131 ]],
1132 [[int num = swapctl(0, NULL, 0);]]
1133 )
1134 ],
1135 [c_cv_have_swapctl_three_args="yes"],
1136 [c_cv_have_swapctl_three_args="no"]
1137 )
1138 ]
1139 )
34eb0428 1140fi
865f2eb3 1141
34eb0428
AR
1142# Check for different versions of `swapctl' here..
1143if test "x$have_swapctl" = "xyes"; then
865f2eb3
RK
1144 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
1145 AC_DEFINE([HAVE_SWAPCTL_TWO_ARGS], [1], [Define if the function swapctl exists and takes two arguments.])
1146 fi
1147
1148 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
1149 AC_DEFINE([HAVE_SWAPCTL_THREE_ARGS], [1], [Define if the function swapctl exists and takes three arguments.])
1150 fi
34eb0428 1151fi
2d03e4e3 1152
e91c40b8 1153# Check for NAN
865f2eb3
RK
1154AC_ARG_WITH([nan-emulation],
1155 [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
1156 [
1157 if test "x$withval" = "xno"; then
1158 nan_type="none"
1159 else if test "x$withval" = "xyes"; then
1160 nan_type="zero"
1161 else
1162 nan_type="$withval"
1163 fi; fi
1164 ],
1165 [nan_type="none"]
1166)
1167
e91c40b8
FF
1168if test "x$nan_type" = "xnone"; then
1169 AC_CACHE_CHECK([whether NAN is defined by default],
5f5da97b 1170 [c_cv_have_nan_default],
865f2eb3
RK
1171 [
1172 AC_COMPILE_IFELSE(
1173 [
1174 AC_LANG_PROGRAM(
1175 [[
1176 #include <stdlib.h>
1177 #include <math.h>
1178 static double foo = NAN;
1179 ]],
1180 [[
1181 if (isnan (foo))
1182 return 0;
1183 return 1;
1184 ]]
1185 )
1186 ],
1187 [c_cv_have_nan_default="yes"],
1188 [c_cv_have_nan_default="no"]
1189 )
1190 ]
e91c40b8 1191 )
e91c40b8 1192fi
865f2eb3
RK
1193
1194if test "x$c_cv_have_nan_default" = "xyes"; then
1195 nan_type="default"
1196fi
1197
e91c40b8
FF
1198if test "x$nan_type" = "xnone"; then
1199 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
5f5da97b 1200 [c_cv_have_nan_isoc],
865f2eb3
RK
1201 [
1202 AC_COMPILE_IFELSE(
1203 [
1204 AC_LANG_PROGRAM(
1205 [[
1206 #include <stdlib.h>
1207 #define __USE_ISOC99 1
1208 #include <math.h>
1209 static double foo = NAN;
1210 ]],
1211 [[
1212 if (isnan (foo))
1213 return 0;
1214 return 1;
1215 ]]
1216 )
1217 ],
1218 [c_cv_have_nan_isoc="yes"],
1219 [c_cv_have_nan_isoc="no"]
1220 )
1221 ]
e91c40b8 1222 )
e91c40b8 1223fi
865f2eb3
RK
1224
1225if test "x$c_cv_have_nan_isoc" = "xyes"; then
1226 nan_type="isoc99"
1227fi
1228
e91c40b8 1229if test "x$nan_type" = "xnone"; then
865f2eb3 1230 SAVE_LDFLAGS="$LDFLAGS"
11b1e65a 1231 LDFLAGS="$LDFLAGS -lm"
e91c40b8 1232 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
5f5da97b 1233 [c_cv_have_nan_zero],
865f2eb3
RK
1234 [
1235 AC_RUN_IFELSE(
1236 [
1237 AC_LANG_PROGRAM(
1238 [[
1239 #include <stdlib.h>
1240 #include <math.h>
1241 #ifdef NAN
1242 # undef NAN
1243 #endif
1244 #define NAN (0.0 / 0.0)
1245 #ifndef isnan
1246 # define isnan(f) ((f) != (f))
1247 #endif
1248 static double foo = NAN;
1249 ]],
1250 [[
1251 if (isnan (foo))
1252 return 0;
1253 return 1;
1254 ]]
1255 )
1256 ],
1257 [c_cv_have_nan_zero="yes"],
1258 [c_cv_have_nan_zero="no"]
1259 )
1260 ]
e91c40b8 1261 )
11b1e65a 1262 LDFLAGS=$SAVE_LDFLAGS
865f2eb3
RK
1263fi
1264
1265if test "x$c_cv_have_nan_zero" = "xyes"; then
1266 nan_type="zero"
e91c40b8 1267fi
18fdfeca
FF
1268
1269if test "x$nan_type" = "xdefault"; then
865f2eb3
RK
1270 AC_DEFINE([NAN_STATIC_DEFAULT], [1],
1271 [Define if NAN is defined by default and can initialize static variables.]
1272 )
18fdfeca 1273else if test "x$nan_type" = "xisoc99"; then
865f2eb3
RK
1274 AC_DEFINE([NAN_STATIC_ISOC], [1],
1275 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.]
1276 )
18fdfeca 1277else if test "x$nan_type" = "xzero"; then
865f2eb3
RK
1278 AC_DEFINE([NAN_ZERO_ZERO], [1],
1279 [Define if NAN can be defined as (0.0 / 0.0)]
1280 )
18fdfeca 1281else
e91c40b8 1282 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
18fdfeca 1283fi; fi; fi
e91c40b8 1284
865f2eb3
RK
1285AC_ARG_WITH([fp-layout],
1286 [
1287 AS_HELP_STRING([--with-fp-layout],
1288 [set the memory layout of doubles. For crosscompiling only.]
1289 )
1290 ],
1291 [
1292 if test "x$withval" = "xnothing"; then
1293 fp_layout_type="nothing"
1294 else if test "x$withval" = "xendianflip"; then
1295 fp_layout_type="endianflip"
1296 else if test "x$withval" = "xintswap"; then
1297 fp_layout_type="intswap"
1298 else
1299 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
1300 fi; fi; fi
1301 ],
1302 [fp_layout_type="unknown"]
1303)
b365f4e3
FF
1304
1305if test "x$fp_layout_type" = "xunknown"; then
b5b9a852
RK
1306 AC_CACHE_CHECK([if doubles are stored in x86 representation],
1307 [c_cv_fp_layout_need_nothing],
1308 [
1309 AC_RUN_IFELSE(
1310 [
1311 AC_LANG_PROGRAM(
1312 [[
1313 #include <stdlib.h>
1314 #include <stdio.h>
1315 #include <string.h>
1316 #include <stdint.h>
1317 #include <inttypes.h>
1318 #include <stdbool.h>
1319 ]],
1320 [[
1321 uint64_t i0;
1322 uint64_t i1;
1323 uint8_t c[8];
1324 double d;
1325
1326 d = 8.642135e130;
1327 memcpy ((void *) &i0, (void *) &d, 8);
1328
1329 i1 = i0;
1330 memcpy ((void *) c, (void *) &i1, 8);
1331
1332 if ((c[0] == 0x2f) && (c[1] == 0x25)
1333 && (c[2] == 0xc0) && (c[3] == 0xc7)
1334 && (c[4] == 0x43) && (c[5] == 0x2b)
1335 && (c[6] == 0x1f) && (c[7] == 0x5b))
307c875e
RK
1336 return 0;
1337 return 1;
b5b9a852
RK
1338 ]]
1339 )
1340 ],
1341 [c_cv_fp_layout_need_nothing="yes"],
1342 [c_cv_fp_layout_need_nothing="no"]
1343 )
1344 ]
1345 )
865f2eb3
RK
1346fi
1347
1348if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1349 fp_layout_type="nothing"
b365f4e3 1350fi
865f2eb3 1351
b365f4e3
FF
1352if test "x$fp_layout_type" = "xunknown"; then
1353 AC_CACHE_CHECK([if endianflip converts to x86 representation],
5f5da97b 1354 [c_cv_fp_layout_need_endianflip],
865f2eb3
RK
1355 [
1356 AC_RUN_IFELSE(
1357 [
1358 AC_LANG_PROGRAM(
1359 [[
1360 #include <stdlib.h>
1361 #include <stdio.h>
1362 #include <string.h>
1363 #include <stdint.h>
1364 #include <inttypes.h>
1365 #include <stdbool.h>
1366 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1367 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1368 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1369 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1370 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1371 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1372 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1373 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1374 ]],
1375 [[
1376 uint64_t i0;
1377 uint64_t i1;
1378 uint8_t c[8];
1379 double d;
bbf0d6f3 1380
865f2eb3
RK
1381 d = 8.642135e130;
1382 memcpy ((void *) &i0, (void *) &d, 8);
bbf0d6f3 1383
865f2eb3
RK
1384 i1 = endianflip (i0);
1385 memcpy ((void *) c, (void *) &i1, 8);
bbf0d6f3 1386
865f2eb3
RK
1387 if ((c[0] == 0x2f) && (c[1] == 0x25)
1388 && (c[2] == 0xc0) && (c[3] == 0xc7)
1389 && (c[4] == 0x43) && (c[5] == 0x2b)
1390 && (c[6] == 0x1f) && (c[7] == 0x5b))
307c875e
RK
1391 return 0;
1392 return 1;
865f2eb3
RK
1393 ]]
1394 )
1395 ],
1396 [c_cv_fp_layout_need_endianflip="yes"],
1397 [c_cv_fp_layout_need_endianflip="no"]
1398 ]
b365f4e3
FF
1399 )
1400 )
b365f4e3 1401fi
865f2eb3
RK
1402
1403if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1404 fp_layout_type="endianflip"
1405fi
1406
b365f4e3
FF
1407if test "x$fp_layout_type" = "xunknown"; then
1408 AC_CACHE_CHECK([if intswap converts to x86 representation],
5f5da97b 1409 [c_cv_fp_layout_need_intswap],
865f2eb3
RK
1410 [
1411 AC_RUN_IFELSE(
1412 [
1413 AC_LANG_PROGRAM(
1414 [[
1415 #include <stdlib.h>
1416 #include <stdio.h>
1417 #include <string.h>
1418 #include <stdint.h>
1419 #include <inttypes.h>
1420 #include <stdbool.h>
1421 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1422 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1423 ]],
1424 [[
1425 uint64_t i0;
1426 uint64_t i1;
1427 uint8_t c[8];
1428 double d;
bbf0d6f3 1429
865f2eb3
RK
1430 d = 8.642135e130;
1431 memcpy ((void *) &i0, (void *) &d, 8);
bbf0d6f3 1432
865f2eb3
RK
1433 i1 = intswap (i0);
1434 memcpy ((void *) c, (void *) &i1, 8);
bbf0d6f3 1435
865f2eb3
RK
1436 if ((c[0] == 0x2f) && (c[1] == 0x25)
1437 && (c[2] == 0xc0) && (c[3] == 0xc7)
1438 && (c[4] == 0x43) && (c[5] == 0x2b)
1439 && (c[6] == 0x1f) && (c[7] == 0x5b))
307c875e
RK
1440 return 0;
1441 return 1;
865f2eb3
RK
1442 ]]
1443 )
1444 ],
1445 [c_cv_fp_layout_need_intswap="yes"],
1446 [c_cv_fp_layout_need_intswap="no"]
1447 )
1448 ]
b365f4e3 1449 )
865f2eb3
RK
1450fi
1451
1452if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1453 fp_layout_type="intswap"
b365f4e3
FF
1454fi
1455
1456if test "x$fp_layout_type" = "xnothing"; then
865f2eb3
RK
1457 AC_DEFINE([FP_LAYOUT_NEED_NOTHING], [1],
1458 [Define if doubles are stored in x86 representation.]
1459 )
b365f4e3 1460else if test "x$fp_layout_type" = "xendianflip"; then
865f2eb3
RK
1461 AC_DEFINE([FP_LAYOUT_NEED_ENDIANFLIP], [1],
1462 [Define if endianflip is needed to convert to x86 representation.]
1463 )
b365f4e3 1464else if test "x$fp_layout_type" = "xintswap"; then
865f2eb3
RK
1465 AC_DEFINE([FP_LAYOUT_NEED_INTSWAP], [1],
1466 [Define if intswap is needed to convert to x86 representation.]
1467 )
b365f4e3
FF
1468else
1469 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1470fi; fi; fi
2dc3f07b 1471
865f2eb3
RK
1472# For cpusleep plugin
1473AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported],
1474 [c_cv_have_clock_boottime_monotonic],
1475 [
1476 AC_COMPILE_IFELSE(
1477 [AC_LANG_PROGRAM(
1478 [[#include <time.h>]],
1479 [[
1480 struct timespec b, m;
1481 clock_gettime(CLOCK_BOOTTIME, &b );
1482 clock_gettime(CLOCK_MONOTONIC, &m );
1483 ]]
1484 )
1485 ],
1486 [c_cv_have_clock_boottime_monotonic="yes"],
1487 [c_cv_have_clock_boottime_monotonic="no"]
1488 )
1489 ]
1490)
1491
23a9e650 1492# --with-useragent {{{
865f2eb3
RK
1493AC_ARG_WITH([useragent],
1494 [AS_HELP_STRING([--with-useragent@<:@=AGENT@:>@], [User agent to use on http requests])],
1495 [
1496 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
1497 AC_DEFINE_UNQUOTED([COLLECTD_USERAGENT], ["$withval"], [User agent for http requests])
23a9e650 1498 fi
865f2eb3
RK
1499 ]
1500)
23a9e650
FF
1501
1502# }}}
1503
79d67c25 1504# --with-data-max-name-len {{{
865f2eb3
RK
1505AC_ARG_WITH([data-max-name-len],
1506 [AS_HELP_STRING([--with-data-max-name-len@<:@=VALUE@:>@], [Maximum length of data buffers])],
1507 [
1508 if test "x$withval" != "x" && test $withval -gt 0; then
1509 AC_DEFINE_UNQUOTED([DATA_MAX_NAME_LEN], [$withval], [Maximum length of data buffers])
79d67c25 1510 else
865f2eb3 1511 AC_MSG_ERROR([DATA_MAX_NAME_LEN must be a positive integer -- $withval given])
79d67c25 1512 fi
865f2eb3
RK
1513 ],
1514 [AC_DEFINE([DATA_MAX_NAME_LEN], [128], [Maximum length of data buffers])]
79d67c25
RB
1515)
1516# }}}
1517
865f2eb3
RK
1518AC_CHECK_FUNCS([getfsstat], [have_getfsstat="yes"], [have_getfsstat="no"])
1519AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"], [have_getvfsstat="no"])
1520AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"], [have_listmntent="no"])
1521AC_CHECK_FUNCS(getmntent_r, [have_getmntent_r="yes"], [have_getmntent_r="no"])
1522
1523AC_CHECK_FUNCS(getmntent, [have_getmntent="libc"], [have_getmntent="no"])
2dc3f07b 1524if test "x$have_getmntent" = "xno"; then
865f2eb3
RK
1525 AC_CHECK_LIB([sun], [getmntent],
1526 [have_getmntent="sun"],
1527 [have_gemntent="no"]
1528 )
c9a5b034 1529fi
865f2eb3 1530
2dc3f07b 1531if test "x$have_getmntent" = "xno"; then
865f2eb3
RK
1532 AC_CHECK_LIB([seq], [getmntent],
1533 [have_getmntent="seq"],
1534 [have_getmntent="no"]
1535 )
c9a5b034 1536fi
865f2eb3 1537
2dc3f07b 1538if test "x$have_getmntent" = "xno"; then
865f2eb3
RK
1539 AC_CHECK_LIB([gen], [getmntent],
1540 [have_getmntent="gen"],
1541 [have_getmntent="no"]
1542 )
1543fi
1544
1545if test "x$have_getmntent" = "xlibc"; then
1546 AC_CACHE_CHECK([whether getmntent takes one argument],
1547 [c_cv_have_one_getmntent],
1548 [
1549 AC_COMPILE_IFELSE(
1550 [
1551 AC_LANG_PROGRAM(
bf2215ed 1552 [[#include "$srcdir/src/utils/mount/mount.h"]],
865f2eb3
RK
1553 [[
1554 FILE *fh;
1555 struct mntent *me;
1556 fh = setmntent ("/etc/mtab", "r");
1557 me = getmntent (fh);
b6af4545 1558 return me->mnt_passno;
865f2eb3
RK
1559 ]]
1560 )
1561 ],
1562 [c_cv_have_one_getmntent="yes"],
1563 [c_cv_have_one_getmntent="no"]
1564 )
1565 ]
1566 )
1567
1568 AC_CACHE_CHECK([whether getmntent takes two arguments],
1569 [c_cv_have_two_getmntent],
1570 [
1571 AC_COMPILE_IFELSE(
1572 [
1573 AC_LANG_PROGRAM(
bf2215ed 1574 [[#include "$srcdir/src/utils/mount/mount.h"]],
865f2eb3
RK
1575 [[
1576 FILE *fh;
1577 struct mnttab mt;
1578 int status;
1579 fh = fopen ("/etc/mnttab", "r");
1580 status = getmntent (fh, &mt);
b6af4545 1581 return status;
865f2eb3
RK
1582 ]]
1583 )
1584 ],
1585 [c_cv_have_two_getmntent="yes"],
1586 [c_cv_have_two_getmntent="no"]
1587 )
1588 ]
1589 )
2dc3f07b
FF
1590fi
1591
1592# Check for different versions of `getmntent' here..
1593
865f2eb3
RK
1594if test "x$have_getmntent" = "xlibc"; then
1595 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1596 AC_DEFINE([HAVE_ONE_GETMNTENT], [1],
1597 [Define if the function getmntent exists and takes one argument.]
1598 )
1599 fi
1600
1601 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1602 AC_DEFINE([HAVE_TWO_GETMNTENT], [1],
1603 [Define if the function getmntent exists and takes two arguments.]
1604 )
1605 fi
6e765a02 1606fi
865f2eb3 1607
2dc3f07b 1608if test "x$have_getmntent" = "xsun"; then
865f2eb3
RK
1609 AC_DEFINE([HAVE_SUN_GETMNTENT], [1],
1610 [Define if the function getmntent exists. It is the version from libsun.]
1611 )
2dc3f07b 1612fi
865f2eb3 1613
2dc3f07b 1614if test "x$have_getmntent" = "xgen"; then
865f2eb3
RK
1615 AC_DEFINE([HAVE_GEN_GETMNTENT], [1],
1616 [Define if the function getmntent exists. It is the version from libgen.]
1617 )
6e765a02
FF
1618fi
1619
35602ac1 1620# Check for htonll
865f2eb3
RK
1621AC_CACHE_CHECK([whether htonll is defined],
1622 [c_cv_have_htonll],
1623 [
1624 AC_LINK_IFELSE(
1625 [
1626 AC_LANG_PROGRAM(
1627 [[
1628 #include <inttypes.h>
1629 #include <sys/types.h>
1630 #include <netinet/in.h>
1631 ]],
1632 [[return htonll(0);]]
1633 )
1634 ],
1635 [c_cv_have_htonll="yes"],
1636 [c_cv_have_htonll="no"]
1637 )
1638 ]
1a822486 1639)
865f2eb3
RK
1640
1641if test "x$c_cv_have_htonll" = "xyes"; then
1642 AC_DEFINE([HAVE_HTONLL], [1], [Define if the function htonll exists.])
1a822486 1643fi
35602ac1 1644
a05e34a0 1645# Check for structures
906bea76 1646AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
865f2eb3
RK
1647 [AC_DEFINE([HAVE_STRUCT_IF_DATA], [1], [Define if struct if_data exists and is usable.])],
1648 [],
1649 [[
1650 #include <sys/types.h>
1651 #include <sys/socket.h>
1652 #include <net/if.h>
1653 ]]
1654)
1655
906bea76 1656AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
865f2eb3
RK
1657 [AC_DEFINE([HAVE_STRUCT_NET_DEVICE_STATS], [1], [Define if struct net_device_stats exists and is usable.])],
1658 [],
1659 [[
1660 #include <sys/types.h>
1661 #include <sys/socket.h>
1662 #include <linux/if.h>
1663 #include <linux/netdevice.h>
1664 ]]
1665)
0bd83922 1666
865f2eb3
RK
1667AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1668 [AC_DEFINE([HAVE_STRUCT_LINUX_INET_DIAG_REQ], [1], [Define if struct inet_diag_req exists and is usable.])],
1669 [],
1670 [[#include <linux/inet_diag.h>]]
1671)
a05e34a0 1672
76489692 1673AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
865f2eb3
RK
1674 [],
1675 [[
1676 #include <netinet/in.h>
1677 #include <net/if.h>
1678 ]]
1679)
1680
2d3861c5 1681AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
865f2eb3
RK
1682 [
1683 AC_DEFINE([HAVE_STRUCT_KINFO_PROC_FREEBSD], [1], [Define if struct kinfo_proc exists in the FreeBSD variant.])
1684 have_struct_kinfo_proc_freebsd="yes"
1685 ],
1686 [],
1687 [[
1688 #include <kvm.h>
1689 #include <sys/param.h>
1690 #include <sys/sysctl.h>
1691 #include <sys/user.h>
1692 ]]
1693)
2d3861c5 1694
0e45add1 1695AC_CHECK_MEMBERS([struct kinfo_proc.p_pid, struct kinfo_proc.p_vm_rssize],
865f2eb3
RK
1696 [
1697 AC_DEFINE([HAVE_STRUCT_KINFO_PROC_OPENBSD], [1], [Define if struct kinfo_proc exists in the OpenBSD variant.])
1698 have_struct_kinfo_proc_openbsd="yes"
1699 ],
1700 [],
1701 [[
1702 #include <sys/param.h>
1703 #include <sys/sysctl.h>
1704 #include <kvm.h>
1705 ]]
1706)
f0446c10
HE
1707
1708AC_CHECK_MEMBERS([struct kinfo_proc2.p_pid, struct kinfo_proc2.p_uru_maxrss],
865f2eb3
RK
1709 [
1710 AC_DEFINE([HAVE_STRUCT_KINFO_PROC2_NETBSD], [1], [Define if struct kinfo_proc2 exists in the NetBSD variant.])
1711 have_struct_kinfo_proc2_netbsd="yes"
1712 ],
1713 [],
1714 [[
1715 #include <sys/param.h>
1716 #include <sys/sysctl.h>
1717 #include <kvm.h>
1718 ]]
1719)
f0446c10 1720
865f2eb3
RK
1721AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport],
1722 [],
1723 [],
1724 [[
1725 #define _BSD_SOURCE
1726 #define _DEFAULT_SOURCE
1727 #include <stdint.h>
1728 #if HAVE_SYS_TYPES_H
1729 # include <sys/types.h>
1730 #endif
1731 #if HAVE_NETINET_IN_SYSTM_H
1732 # include <netinet/in_systm.h>
1733 #endif
1734 #if HAVE_NETINET_IN_H
1735 # include <netinet/in.h>
1736 #endif
1737 #if HAVE_NETINET_IP_H
1738 # include <netinet/ip.h>
1739 #endif
1740 #if HAVE_NETINET_UDP_H
1741 # include <netinet/udp.h>
1742 #endif
1743 ]]
1744)
f0446c10 1745
865f2eb3
RK
1746AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source],
1747 [],
1748 [],
1749 [[
1750 #define _BSD_SOURCE
1751 #define _DEFAULT_SOURCE
1752 #include <stdint.h>
1753 #if HAVE_SYS_TYPES_H
1754 # include <sys/types.h>
1755 #endif
1756 #if HAVE_NETINET_IN_SYSTM_H
1757 # include <netinet/in_systm.h>
1758 #endif
1759 #if HAVE_NETINET_IN_H
1760 # include <netinet/in.h>
1761 #endif
1762 #if HAVE_NETINET_IP_H
1763 # include <netinet/ip.h>
1764 #endif
1765 #if HAVE_NETINET_UDP_H
1766 # include <netinet/udp.h>
1767 #endif
1768 ]]
1769)
2aff261d 1770
e94efcbe 1771AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
865f2eb3
RK
1772 [],
1773 [],
1774 [[# include <kstat.h>]]
1775)
e94efcbe 1776
9d9678b9 1777# check for pthread_setname_np
0dc6fd79 1778SAVE_LDFLAGS="$LDFLAGS"
9d9678b9
MLSR
1779LDFLAGS="$LDFLAGS -lpthread"
1780
e81567f2 1781AC_MSG_CHECKING([for pthread_setname_np])
b5b9a852
RK
1782have_pthread_setname_np="no"
1783AC_LINK_IFELSE(
1784 [
1785 AC_LANG_PROGRAM(
1786 [[
1787 #define _GNU_SOURCE
1788 #include <pthread.h>
1789 ]],
1790 [[pthread_setname_np((pthread_t) {0}, "conftest");]]
1791 )
1792 ],
1793 [
1794 have_pthread_setname_np="yes"
1795 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [pthread_setname_np() is available.])
1796 ]
1797)
9d9678b9 1798
0dc6fd79 1799AC_MSG_RESULT([$have_pthread_setname_np])
9d9678b9 1800
0dc6fd79 1801# check for pthread_set_name_np(3) (FreeBSD)
e81567f2 1802AC_MSG_CHECKING([for pthread_set_name_np])
b5b9a852
RK
1803have_pthread_set_name_np="no"
1804AC_LINK_IFELSE(
1805 [
1806 AC_LANG_PROGRAM(
1807 [[#include <pthread_np.h>]],
1808 [[pthread_set_name_np((pthread_t) {0}, "conftest");]]
1809 )
1810 ],
1811 [
1812 have_pthread_set_name_np="yes"
1813 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [pthread_set_name_np() is available.])
1814 ]
1815)
9d9678b9
MLSR
1816AC_MSG_RESULT([$have_pthread_set_name_np])
1817
0dc6fd79 1818LDFLAGS="$SAVE_LDFLAGS"
9d9678b9 1819
865f2eb3
RK
1820AC_CHECK_TYPES([struct ip6_ext],
1821 [have_ip6_ext="yes"],
1822 [have_ip6_ext="no"],
1823 [[
1824 #include <stdint.h>
1825 #if HAVE_SYS_TYPES_H
1826 # include <sys/types.h>
1827 #endif
1828 #if HAVE_NETINET_IN_SYSTM_H
1829 # include <netinet/in_systm.h>
1830 #endif
1831 #if HAVE_NETINET_IN_H
1832 # include <netinet/in.h>
1833 #endif
1834 #if HAVE_NETINET_IP6_H
1835 # include <netinet/ip6.h>
1836 #endif
1837 ]]
1838)
1839
1840if test "x$have_ip6_ext" = "xno"; then
1841 SAVE_CFLAGS="$CFLAGS"
1842 CFLAGS="$CFLAGS -DSOLARIS2=8"
1843 AC_CHECK_TYPES([struct ip6_ext],
1844 [have_ip6_ext="yes, with -DSOLARIS2=8"],
1845 [have_ip6_ext="no"],
1846 [[
1847 #include <stdint.h>
1848 #if HAVE_SYS_TYPES_H
1849 # include <sys/types.h>
1850 #endif
1851 #if HAVE_NETINET_IN_SYSTM_H
1852 # include <netinet/in_systm.h>
1853 #endif
1854 #if HAVE_NETINET_IN_H
1855 # include <netinet/in.h>
1856 #endif
1857 #if HAVE_NETINET_IP6_H
1858 # include <netinet/ip6.h>
1859 #endif
1860 ]]
1861 )
1862 if test "x$have_ip6_ext" = "xno"; then
1863 CFLAGS="$SAVE_CFLAGS"
1864 fi
1865fi
1866
1867# libi2c-dev
1868if test "x$ac_system" = "xLinux"; then
bd797318
PR
1869 with_libi2c_libs=""
1870 AC_CHECK_HEADERS([i2c/smbus.h],
1871 [with_libi2c_libs="-li2c"]
1872 )
865f2eb3
RK
1873 AC_CHECK_DECL([i2c_smbus_read_i2c_block_data],
1874 [with_libi2c="yes"],
1875 [with_libi2c="no (symbol i2c_smbus_read_i2c_block_data not found - have you installed libi2c-dev ?)"],
1876 [[
1877 #include <stdlib.h>
1878 #include <linux/i2c-dev.h>
bd797318
PR
1879 #if HAVE_I2C_SMBUS_H
1880 # include <i2c/smbus.h>
1881 #endif
865f2eb3
RK
1882 ]]
1883 )
bd797318
PR
1884 BUILD_WITH_LIBI2C_LIBS="$with_libi2c_libs"
1885 AC_SUBST([BUILD_WITH_LIBI2C_LIBS])
865f2eb3
RK
1886else
1887 with_libi2c="no (Linux only)"
1888fi
1889
4aed4a7a
FF
1890#
1891# Checks for libraries begin here
1892#
d896b012 1893
865f2eb3 1894# Check for libpthread
dee5e45a
RK
1895SAVE_LIBS="$LIBS"
1896AC_CHECK_LIB([pthread],
1897 [pthread_create],
1898 [],
865f2eb3 1899 [AC_MSG_ERROR([Symbol 'pthread_create' not found in libpthread])],
dee5e45a
RK
1900 []
1901)
1902PTHREAD_LIBS="$LIBS"
1903LIBS="$SAVE_LIBS"
865f2eb3 1904AC_SUBST([PTHREAD_LIBS])
b789e523 1905
dee5e45a
RK
1906AC_CHECK_HEADERS([pthread.h],
1907 [],
1908 [AC_MSG_ERROR([pthread.h not found])]
1909)
56ae1844 1910
c27cdba8 1911m4_divert_once([HELP_WITH], [
865f2eb3 1912Collectd additional packages:])
c27cdba8 1913
865f2eb3
RK
1914if test "x$ac_system" = "xAIX"; then
1915 with_perfstat="yes"
1916 with_procinfo="yes"
11b1e65a 1917else
865f2eb3
RK
1918 with_perfstat="no (AIX only)"
1919 with_procinfo="no (AIX only)"
11b1e65a
MS
1920fi
1921
865f2eb3
RK
1922if test "x$with_perfstat" = "xyes"; then
1923 AC_CHECK_LIB([perfstat], [perfstat_reset],
1924 [with_perfstat="yes"],
1925 [with_perfstat="no (perfstat not found)"]
1926 )
11b1e65a 1927fi
865f2eb3
RK
1928
1929if test "x$with_perfstat" = "xyes"; then
1930 AC_DEFINE([HAVE_PERFSTAT], [1], [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1931 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1932 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled],
1933 [],
1934 [],
1935 [[#include <libperfstat.h]]
1936 )
1937 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"; then
1938 AC_DEFINE([PERFSTAT_SUPPORTS_DONATION], [1], [Define to 1 if your version of the 'perfstat' library supports donation])
1939 fi
11b1e65a 1940fi
865f2eb3 1941AM_CONDITIONAL([BUILD_WITH_PERFSTAT], [test "x$with_perfstat" = "xyes"])
11b1e65a 1942
8dbb7bc4 1943# Processes plugin under AIX.
865f2eb3
RK
1944if test "x$with_procinfo" = "xyes"; then
1945 AC_CHECK_HEADERS([procinfo.h],
1946 [AC_DEFINE([HAVE_PROCINFO_H], [1], [Define to 1 if you have the procinfo.h])],
1947 [with_procinfo="no (procinfo.h not found)"]
1948 )
11b1e65a 1949fi
11b1e65a 1950
865f2eb3
RK
1951if test "x$ac_system" = "xSolaris"; then
1952 with_kstat="yes"
1953 with_devinfo="yes"
c044208a 1954else
865f2eb3
RK
1955 with_kstat="no (Solaris only)"
1956 with_devinfo="no (Solaris only)"
c044208a
FF
1957fi
1958
865f2eb3
RK
1959if test "x$with_kstat" = "xyes"; then
1960 AC_CHECK_LIB([kstat], [kstat_open],
1961 [with_kstat="yes"],
1962 [with_kstat="no (libkstat not found)"]
1963 )
c044208a 1964fi
865f2eb3
RK
1965
1966if test "x$with_kstat" = "xyes"; then
1967 AC_CHECK_LIB([devinfo], [di_init],
1968 [with_devinfo="yes"],
1969 [with_devinfo="no (not found)"]
1970 )
1971 AC_CHECK_HEADERS([kstat.h],
1972 [AC_DEFINE(HAVE_LIBKSTAT, [1], [Define to 1 if you have the 'kstat' library (-lkstat)])],
1973 [with_kstat="no (kstat.h not found)"]
1974 )
c044208a 1975fi
c044208a 1976
865f2eb3
RK
1977AM_CONDITIONAL([BUILD_WITH_LIBDEVINFO], [test "x$with_devinfo" = "xyes"])
1978AM_CONDITIONAL([BUILD_WITH_LIBKSTAT], [test "x$with_kstat" = "xyes"])
1979
1980if test "x$ac_system" = "xDarwin"; then
1981 with_libiokit="yes"
30aaad03 1982else
865f2eb3 1983 with_libiokit="no"
30aaad03 1984fi
865f2eb3 1985AM_CONDITIONAL([BUILD_WITH_LIBIOKIT], [test "x$with_libiokit" = "xyes"])
c044208a
FF
1986
1987with_libkvm="no"
865f2eb3
RK
1988AC_CHECK_LIB([kvm], [kvm_getprocs],
1989 [with_kvm_getprocs="yes"],
7aa48cd1 1990 [with_kvm_getprocs="no"]
865f2eb3
RK
1991)
1992
1993if test "x$with_kvm_getprocs" = "xyes"; then
1994 AC_DEFINE([HAVE_LIBKVM_GETPROCS], [1],
1995 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)]
1996 )
1997 with_libkvm="yes"
c044208a 1998fi
c044208a 1999
865f2eb3
RK
2000AM_CONDITIONAL([BUILD_WITH_LIBKVM_GETPROCS], [test "x$with_kvm_getprocs" = "xyes"])
2001
2002AC_CHECK_LIB([kvm], [kvm_getswapinfo],
2003 [with_kvm_getswapinfo="yes"],
7aa48cd1 2004 [with_kvm_getswapinfo="no"]
865f2eb3
RK
2005)
2006
2007if test "x$with_kvm_getswapinfo" = "xyes"; then
2008 AC_DEFINE([HAVE_LIBKVM_GETSWAPINFO], [1],
2009 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)]
2010 )
2011 with_libkvm="yes"
c044208a 2012fi
c044208a 2013
865f2eb3
RK
2014AM_CONDITIONAL([BUILD_WITH_LIBKVM_GETSWAPINFO], [test "x$with_kvm_getswapinfo" = "xyes"])
2015
2016AC_CHECK_LIB([kvm], [kvm_nlist],
2017 [with_kvm_nlist="yes"],
7aa48cd1 2018 [with_kvm_nlist="no"]
865f2eb3
RK
2019)
2020
2021if test "x$with_kvm_nlist" = "xyes"; then
2022 AC_CHECK_HEADERS([bsd/nlist.h nlist.h])
2023 AC_DEFINE([HAVE_LIBKVM_NLIST], [1],
2024 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)]
2025 )
2026 with_libkvm="yes"
c044208a 2027fi
c044208a 2028
865f2eb3
RK
2029AM_CONDITIONAL([BUILD_WITH_LIBKVM_NLIST], [test "x$with_kvm_nlist" = "xyes"])
2030
2031AC_CHECK_LIB([kvm], [kvm_openfiles],
2032 [with_kvm_openfiles="yes"],
7aa48cd1 2033 [with_kvm_openfiles="no"]
865f2eb3
RK
2034)
2035
2036if test "x$with_kvm_openfiles" = "xyes"; then
2037 AC_DEFINE([HAVE_LIBKVM_NLIST], [1],
2038 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)]
2039 )
2040 with_libkvm="yes"
97fe2302 2041fi
97fe2302 2042
e469c5d1
BD
2043AC_CHECK_HEADERS([libpfctl.h],,,
2044[
2045 #include <sys/queue.h>
2046 #include <sys/types.h>
2047 #include <netinet/in.h>
2048 #include <net/if.h>
2049 #include <net/pfvar.h>
2050])
2051AC_CHECK_LIB([pfctl], [pfctl_status_counter],
2052 [with_libpfctl="yes"],
2053 [with_libpfctl="no"]
2054)
2055AM_CONDITIONAL([BUILD_WITH_LIBPFCTL], [test "x$with_libpfctl" = "xyes"])
2056
654c9bef 2057# --with-cuda {{{
654c9bef
EN
2058AC_ARG_WITH([cuda],
2059 [AS_HELP_STRING([--with-cuda@<:@=PREFIX@:>@], [Path to cuda.])],
2060 [
c0419e09
RK
2061 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
2062 with_cuda_cppflags="-I$withval/include"
ce6cc80e 2063 with_cuda_ldflags="-L$withval/lib"
654c9bef 2064 with_cuda="yes"
654c9bef 2065 else
c0419e09
RK
2066 with_cuda="$withval"
2067 fi
654c9bef 2068 ],
c0419e09 2069 [with_cuda="no"]
654c9bef
EN
2070)
2071
654c9bef 2072if test "x$with_cuda" = "xyes"; then
c0419e09
RK
2073 SAVE_CPPFLAGS="$CPPFLAGS"
2074 CPPFLAGS="$CPPFLAGS $with_cuda_cppflags"
2075
654c9bef
EN
2076 AC_CHECK_HEADERS([nvml.h],
2077 [with_cuda="yes"],
c0419e09 2078 [with_cuda="no (nvml.h not found)"]
654c9bef 2079 )
654c9bef 2080
c0419e09 2081 CPPFLAGS="$SAVE_CPPFLAGS"
654c9bef
EN
2082fi
2083
2084if test "x$with_cuda" = "xyes"; then
fa718c8c
RK
2085 BUILD_WITH_CUDA_CPPFLAGS="$with_cuda_cppflags"
2086 BUILD_WITH_CUDA_LDFLAGS="$with_cuda_ldflags"
654c9bef
EN
2087 BUILD_WITH_CUDA_LIBS="-lnvidia-ml"
2088fi
2089
c0419e09 2090AC_SUBST([BUILD_WITH_CUDA_CPPFLAGS])
654c9bef
EN
2091AC_SUBST([BUILD_WITH_CUDA_LDFLAGS])
2092AC_SUBST([BUILD_WITH_CUDA_LIBS])
2093
2094# }}}
2095
75cb76e1
MK
2096# --with-epics-base {{{
2097AC_ARG_WITH([epics-base],
2098 [AS_HELP_STRING([--with-epics-base@<:@=PREFIX@:>@], [Path to epics-base.])],
2099 [
2100 with_epics_base="$withval"
2101 if test "x$withval" = "xno"; then
2102 with_epics_base="no (disabled on command line)"
2103 fi
2104 ],
2105 [with_epics_base="yes"]
2106)
2107
2108if test "x$with_epics_base" = "xyes"; then
2109PKG_CHECK_MODULES([EPICS_BASE], [epics-base],
2110 [with_epics_base="yes"],
2111 [with_epics_base="no (pkg-config could not find epics-base)"]
2112)
2113fi
2114
2115if test "x$with_epics_base" = "xyes"; then
2116 BUILD_WITH_EPICS_BASE_CFLAGS="$EPICS_BASE_CFLAGS"
2117 BUILD_WITH_EPICS_BASE_LIBS="$EPICS_BASE_LIBS -lca"
2118fi
2119
2120AC_SUBST([BUILD_WITH_EPICS_BASE_CFLAGS])
2121AC_SUBST([BUILD_WITH_EPICS_BASE_LIBS])
2122
2123# }}}
2124
d5cd30db 2125# --with-libaquaero5 {{{
865f2eb3
RK
2126AC_ARG_WITH([libaquaero5],
2127 [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [Path to aquatools-ng source code.])],
2128 [
2129 if test "x$withval" = "xyes"; then
2130 with_libaquaero5="yes"
2131 else if test "x$withval" = "xno"; then
2132 with_libaquaero5="no"
2133 else
2134 with_libaquaero5="yes"
2135 LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src"
2136 LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj"
2137 fi; fi
2138 ],
2139 [with_libaquaero5="yes"]
2140)
d5cd30db
AD
2141
2142SAVE_CPPFLAGS="$CPPFLAGS"
2143SAVE_LDFLAGS="$LDFLAGS"
d5cd30db
AD
2144CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS"
2145LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS"
2146
865f2eb3 2147if test "x$with_libaquaero5" = "xyes"; then
865f2eb3
RK
2148 AC_CHECK_HEADERS([libaquaero5.h],
2149 [with_libaquaero5="yes"],
2150 [with_libaquaero5="no (libaquaero5.h not found)"]
2151 )
d5cd30db 2152fi
865f2eb3
RK
2153
2154if test "x$with_libaquaero5" = "xyes"; then
865f2eb3
RK
2155 AC_CHECK_LIB([aquaero5], libaquaero5_poll,
2156 [with_libaquaero5="yes"],
2157 [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"]
2158 )
d5cd30db
AD
2159fi
2160
2161CPPFLAGS="$SAVE_CPPFLAGS"
2162LDFLAGS="$SAVE_LDFLAGS"
2163
865f2eb3
RK
2164if test "x$with_libaquaero5" = "xyes"; then
2165 BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS"
2166 BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS"
d5cd30db 2167fi
865f2eb3
RK
2168AC_SUBST([BUILD_WITH_LIBAQUAERO5_CFLAGS])
2169AC_SUBST([BUILD_WITH_LIBAQUAERO5_LDFLAGS])
d5cd30db
AD
2170# }}}
2171
36e8719c 2172# --with-libhiredis {{{
865f2eb3
RK
2173AC_ARG_WITH([libhiredis],
2174 [AS_HELP_STRING([--with-libhiredis@<:@=PREFIX@:>@], [Path to libhiredis.])],
2175 [
2176 if test "x$withval" = "xyes"; then
2177 with_libhiredis="yes"
2178 else if test "x$withval" = "xno"; then
2179 with_libhiredis="no"
2180 else
2181 with_libhiredis="yes"
2182 LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS -I$withval/include"
2183 LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS -L$withval/lib"
2184 fi; fi
2185 ],
2186 [with_libhiredis="yes"]
2187)
b591eca2
FF
2188
2189SAVE_CPPFLAGS="$CPPFLAGS"
2190SAVE_LDFLAGS="$LDFLAGS"
36e8719c
AD
2191CPPFLAGS="$CPPFLAGS $LIBHIREDIS_CPPFLAGS"
2192LDFLAGS="$LDFLAGS $LIBHIREDIS_LDFLAGS"
b591eca2 2193
865f2eb3 2194if test "x$with_libhiredis" = "xyes"; then
865f2eb3
RK
2195 AC_CHECK_HEADERS([hiredis/hiredis.h],
2196 [with_libhiredis="yes"],
2197 [with_libhiredis="no (hiredis.h not found)"]
2198 )
b591eca2 2199fi
b591eca2 2200
865f2eb3 2201if test "x$with_libhiredis" = "xyes"; then
865f2eb3
RK
2202 AC_CHECK_LIB([hiredis], [redisCommand],
2203 [with_libhiredis="yes"],
2204 [with_libhiredis="no (symbol 'redisCommand' not found)"]
2205 )
b591eca2
FF
2206fi
2207
2208CPPFLAGS="$SAVE_CPPFLAGS"
2209LDFLAGS="$SAVE_LDFLAGS"
2210
865f2eb3
RK
2211if test "x$with_libhiredis" = "xyes"; then
2212 BUILD_WITH_LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS"
2213 BUILD_WITH_LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS"
b591eca2 2214fi
865f2eb3
RK
2215
2216AC_SUBST([BUILD_WITH_LIBHIREDIS_CPPFLAGS])
2217AC_SUBST([BUILD_WITH_LIBHIREDIS_LDFLAGS])
b591eca2
FF
2218# }}}
2219
bca2ce37
MM
2220# --with-libredfish {{{
2221AC_ARG_WITH([libredfish],
2222 [AS_HELP_STRING([--with-libredfish@<:@=PREFIX@:>@], [Path to libredfish.])],
2223 [
2224 if test "x$withval" = "xyes"; then
2225 with_libredfish="yes"
2226 else if test "x$withval" = "xno"; then
2227 with_libredfish="no"
2228 else
2229 with_libredfish="yes"
2230 LIBREDFISH_CPPFLAGS="$LIBREDFISH_CPPFLAGS -I$withval/include"
79bb8a06 2231 LIBREDFISH_LDFLAGS="$LIBREDFISH_LDFLAGS -L$withval/lib"
bca2ce37
MM
2232 fi; fi
2233 ],
2234 [with_libredfish="yes"]
2235)
2236
2237SAVE_CPPFLAGS="$CPPFLAGS"
2238SAVE_LDFLAGS="$LDFLAGS"
2239CPPFLAGS="$CPPFLAGS $LIBREDFISH_CPPFLAGS"
79bb8a06 2240LDFLAGS="$LDFLAGS $LIBREDFISH_LDFLAGS"
bca2ce37
MM
2241
2242if test "x$with_libredfish" = "xyes"; then
2243 if test "x$LIBREDFISH_CPPFLAGS" != "x"; then
dbcd2403 2244 AC_MSG_NOTICE([libredfish CPPFLAGS: $LIBREDFISH_CPPFLAGS])
bca2ce37
MM
2245 fi
2246 AC_CHECK_HEADERS([redfish.h],
2247 [with_libredfish="yes"],
2248 [with_libredfish="no (redfish.h not found)"]
2249 )
2250fi
2251
2252if test "x$with_libredfish" = "xyes"; then
2253 if test "x$LIBREDFISH_LDFLAGS" != "x"; then
2254 AC_MSG_NOTICE([libredfish LDFLAGS: $LIBREDFISH_LDFLAGS])
2255 fi
2256 AC_CHECK_LIB([redfish], [createServiceEnumerator],
2257 [with_libredfish="yes"],
2258 [with_libredfish="no (symbol 'createServiceEnumerator' not found)"]
2259 )
2260fi
2261
2262CPPFLAGS="$SAVE_CPPFLAGS"
2263LDFLAGS="$SAVE_LDFLAGS"
2264
2265if test "x$with_libredfish" = "xyes"; then
2266 BUILD_WITH_LIBREDFISH_CPPFLAGS="$LIBREDFISH_CPPFLAGS"
2267 BUILD_WITH_LIBREDFISH_LDFLAGS="$LIBREDFISH_LDFLAGS"
2268fi
2269
2270AC_SUBST([BUILD_WITH_LIBREDFISH_CPPFLAGS])
2271AC_SUBST([BUILD_WITH_LIBREDFISH_LDFLAGS])
2272
2273# }}}
2274
df7b529e
PZ
2275# --with-sqlite3 {{{
2276AC_ARG_WITH([sqlite3],
2277 [AS_HELP_STRING([--with-sqlite3@<:@=PREFIX@:>@], [Path to sqlite3.])],
2278 [
2279 if test "x$withval" = "xyes"; then
2280 with_sqlite3="yes"
2281 else if test "x$withval" = "xno"; then
2282 with_sqlite3="no"
2283 else
2284 with_sqlite3="yes"
2285 SQLITE3_CPPFLAGS="$SQLITE3_CPPFLAGS -I$withval/include"
2286 SQLITE3_LDFLAGS="$SQLITE3_LDFLAGS -L$withval/lib"
2287 fi; fi
2288 ],
2289 [with_sqlite3="yes"]
2290)
2291
2292SAVE_CPPFLAGS="$CPPFLAGS"
2293SAVE_LDFLAGS="$LDFLAGS"
2294CPPFLAGS="$CPPFLAGS $SQLITE3_CPPFLAGS"
2295LDFLAGS="$LDFLAGS $SQLITE3_LDFLAGS"
2296
2297if test "x$with_sqlite3" = "xyes"; then
2298 if test "x$SQLITE3_CPPFLAGS" != "x"; then
2299 AC_MSG_NOTICE([sqlite3 CPPFLAGS: $SQLITE3_CPPFLAGS])
2300 fi
2301 AC_CHECK_HEADERS([sqlite3.h],
2302 [with_sqlite3="yes"],
2303 [with_sqlite3="no (sqlite3.h not found)"]
2304 )
2305fi
2306
2307CPPFLAGS="$SAVE_CPPFLAGS"
2308LDFLAGS="$SAVE_LDFLAGS"
2309
2310if test "x$with_sqlite3" = "xyes"; then
2311 BUILD_WITH_SQLITE3_CPPFLAGS="$SQLITE3_CPPFLAGS"
2312 BUILD_WITH_SQLITE3_LDFLAGS="$SQLITE3_LDFLAGS"
2313 BUILD_WITH_SQLITE3_LIBS="-lsqlite3"
2314fi
2315
2316AC_SUBST([BUILD_WITH_SQLITE3_CPPFLAGS])
2317AC_SUBST([BUILD_WITH_SQLITE3_LDFLAGS])
2318AC_SUBST([BUILD_WITH_SQLITE3_LIBS])
2319# }}}
2320
8757c918 2321# --with-libcurl {{{
1842a7a7 2322with_curl_config="curl-config"
8f6c03d5 2323with_curl_cflags=""
1842a7a7 2324with_curl_libs=""
865f2eb3
RK
2325AC_ARG_WITH(libcurl,
2326 [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
2327 [
2328 if test "x$withval" = "xno"; then
2329 with_libcurl="no"
2330 else if test "x$withval" = "xyes"; then
2331 with_libcurl="yes"
2332 else
2333 if test -f "$withval" && test -x "$withval"; then
2334 with_curl_config="$withval"
2335 with_libcurl="yes"
2336 else if test -x "$withval/bin/curl-config"; then
2337 with_curl_config="$withval/bin/curl-config"
2338 with_libcurl="yes"
2339 fi; fi
2340 with_libcurl="yes"
2341 fi; fi
2342 ],
2343 [with_libcurl="yes"]
2344)
1842a7a7 2345
865f2eb3
RK
2346if test "x$with_libcurl" = "xyes"; then
2347 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
2348 curl_config_status=$?
8f6c03d5 2349
865f2eb3
RK
2350 if test $curl_config_status -ne 0; then
2351 with_libcurl="no ($with_curl_config failed)"
2352 else
2353 SAVE_CPPFLAGS="$CPPFLAGS"
2354 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
8f6c03d5 2355
865f2eb3
RK
2356 AC_CHECK_HEADERS([curl/curl.h],
2357 [with_libcurl="yes"],
2358 [with_libcurl="no (curl/curl.h not found)"]
2359 )
2360
2361 CPPFLAGS="$SAVE_CPPFLAGS"
2362 fi
1842a7a7 2363fi
1842a7a7 2364
865f2eb3
RK
2365if test "x$with_libcurl" = "xyes"; then
2366 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
2367 curl_config_status=$?
2368
2369 if test $curl_config_status -ne 0; then
2370 with_libcurl="no ($with_curl_config failed)"
2371 else
2372 AC_CHECK_LIB([curl], [curl_easy_init],
2373 [with_libcurl="yes"],
2374 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
2375 [$with_curl_libs]
2376 )
2377
2378 AC_CHECK_DECL([CURLOPT_USERNAME],
2379 [have_curlopt_username="yes"],
2380 [have_curlopt_username="no"],
2381 [[#include <curl/curl.h>]]
2382 )
2383
2384 AC_CHECK_DECL(CURLOPT_TIMEOUT_MS,
2385 [have_curlopt_timeout="yes"],
2386 [have_curlopt_timeout="no"],
2387 [[#include <curl/curl.h>]]
2388 )
dd7e4fd3
BS
2389
2390 AC_CHECK_DECL(CURLOPT_UNIX_SOCKET_PATH,
2391 [have_curlopt_unix_socket_path="yes"],
2392 [have_curlopt_unix_socket_path="no"],
2393 [[#include <curl/curl.h>]]
2394 )
865f2eb3 2395 fi
1842a7a7 2396fi
865f2eb3
RK
2397
2398if test "x$with_libcurl" = "xyes"; then
2399 SAVE_CPPFLAGS="$CPPFLAGS"
2400 SAVE_LDFLAGS="$LDFLAGS"
2401 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
2402 LDFLAGS="$LDFLAGS $with_curl_libs"
2403 AC_CACHE_CHECK([for CURLINFO_APPCONNECT_TIME],
2404 [c_cv_have_curlinfo_appconnect_time],
2405 [
2406 AC_LINK_IFELSE(
2407 [
2408 AC_LANG_PROGRAM(
2409 [[#include <curl/curl.h>]],
2410 [[
2411 int val = CURLINFO_APPCONNECT_TIME;
2412 return val;
2413 ]]
2414 )
2415 ],
2416 [c_cv_have_curlinfo_appconnect_time="yes"],
2417 [c_cv_have_curlinfo_appconnect_time="no"]
2418 )
2419 ]
2420 )
2421 CPPFLAGS="$SAVE_CPPFLAGS"
2422 LDFLAGS="$SAVE_LDFLAGS"
d76b962d 2423fi
865f2eb3
RK
2424
2425if test "x$c_cv_have_curlinfo_appconnect_time" = "xyes"; then
2426 AC_DEFINE([HAVE_CURLINFO_APPCONNECT_TIME], [1],
2427 [Define if curl.h defines CURLINFO_APPCONNECT_TIME.]
2428 )
d76b962d
SH
2429fi
2430
865f2eb3
RK
2431if test "x$with_libcurl" = "xyes"; then
2432 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
2433 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
0af75dc1 2434
865f2eb3
RK
2435 if test "x$have_curlopt_username" = "xyes"; then
2436 AC_DEFINE([HAVE_CURLOPT_USERNAME], [1],
2437 [Define if libcurl supports CURLOPT_USERNAME option.]
2438 )
2439 fi
8a2c605b 2440
865f2eb3
RK
2441 if test "x$have_curlopt_timeout" = "xyes"; then
2442 AC_DEFINE([HAVE_CURLOPT_TIMEOUT_MS], [1],
2443 [Define if libcurl supports CURLOPT_TIMEOUT_MS option.]
2444 )
2445 fi
dd7e4fd3
BS
2446
2447 if test "x$have_curlopt_unix_socket_path" = "xyes"; then
2448 AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH], [1],
2449 [Define if libcurl supports CURLOPT_UNIX_SOCKET_PATH option.]
2450 )
2451 fi
1842a7a7 2452fi
865f2eb3
RK
2453
2454AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
2455AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
aa61b905
FF
2456
2457AM_CONDITIONAL([BUILD_WITH_LIBCURL], [test "x$with_libcurl" = "xyes"])
8757c918 2458# }}}
1842a7a7 2459
3f847b15 2460# --with-libdbi {{{
865f2eb3
RK
2461AC_ARG_WITH([libdbi],
2462 [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
2463 [
2464 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
2465 with_libdbi_cppflags="-I$withval/include"
2466 with_libdbi_ldflags="-L$withval/lib"
2467 with_libdbi="yes"
2468 else
2469 with_libdbi="$withval"
2470 fi
2471 ],
2472 [with_libdbi="yes"]
2473)
3f847b15 2474
865f2eb3
RK
2475if test "x$with_libdbi" = "xyes"; then
2476 SAVE_CPPFLAGS="$CPPFLAGS"
2477 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
3f847b15 2478
865f2eb3
RK
2479 AC_CHECK_HEADERS([dbi/dbi.h],
2480 [with_libdbi="yes"],
2481 [with_libdbi="no (dbi/dbi.h not found)"]
2482 )
2483
2484 CPPFLAGS="$SAVE_CPPFLAGS"
3f847b15 2485fi
3f847b15 2486
865f2eb3
RK
2487if test "x$with_libdbi" = "xyes"; then
2488 SAVE_LDFLAGS="$LDFLAGS"
2489 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
3f847b15 2490
865f2eb3
RK
2491 AC_CHECK_LIB([dbi], [dbi_initialize],
2492 [with_libdbi="yes"],
2493 [with_libdbi="no (Symbol 'dbi_initialize' not found)"]
2494 )
2495
2496 LDFLAGS="$SAVE_LDFLAGS"
3f847b15 2497fi
865f2eb3
RK
2498
2499BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
2500BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
2501BUILD_WITH_LIBDBI_LIBS="-ldbi"
2502AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
2503AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
2504AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
3f847b15
FF
2505# }}}
2506
5acd2e6a
RK
2507# --with-libdpdk {{{
2508AC_ARG_VAR([LIBDPDK_CPPFLAGS], [Preprocessor flags for libdpdk])
6ca79b67 2509AC_ARG_VAR([LIBDPDK_CFLAGS], [Compiler flags for libdpdk])
5acd2e6a 2510AC_ARG_VAR([LIBDPDK_LDFLAGS], [Linker flags for libdpdk])
7968c0dd 2511AC_ARG_VAR([LIBDPDK_LIBS], [Libraries to link for libdpdk])
5acd2e6a 2512
d2289be5
RK
2513AC_ARG_WITH([libdpdk],
2514 [AS_HELP_STRING([--without-libdpdk], [Disable libdpdk.])],
2515 [with_libdpdk="$withval"],
2516 [with_libdpdk="yes"]
2517)
5acd2e6a
RK
2518
2519if test "x$with_libdpdk" != "xno"; then
af406d01 2520 PKG_CHECK_MODULES([DPDK], [libdpdk], [],
3dcc903c 2521 [AC_MSG_NOTICE([no DPDK pkg-config, using defaults])])
5668f55e
CE
2522 if test "x$LIBDPDK_CPPFLAGS" = "x"; then
2523 LIBDPDK_CPPFLAGS="-I/usr/include/dpdk"
2524 fi
6ca79b67 2525 if test "x$LIBDPDK_CFLAGS" = "x"; then
61193e37
RK
2526 LIBDPDK_CFLAGS="$DPDK_CFLAGS"
2527 LIBDPDK_CPPFLAGS="$LIBDPDK_CPPFLAGS $DPDK_CFLAGS"
7968c0dd
CE
2528 fi
2529 if test "x$LIBDPDK_LIBS" = "x"; then
61193e37
RK
2530 if test "x$DPDK_LIBS" != "x"; then
2531 LIBDPDK_LIBS="$DPDK_LIBS"
2532 else
2533 LIBDPDK_LIBS="-ldpdk"
2534 fi
5acd2e6a
RK
2535 fi
2536 SAVE_CPPFLAGS="$CPPFLAGS"
2537 CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS"
6ca79b67
CE
2538 SAVE_CFLAGS="$CFLAGS"
2539 CFLAGS="$LIBDPDK_CFLAGS $CFLAGS"
5acd2e6a
RK
2540 AC_CHECK_HEADERS([rte_config.h],
2541 [
2542 with_libdpdk="yes"
2543 AC_PREPROC_IFELSE(
2544 [
2545 AC_LANG_SOURCE(
2546 [[
2547 #include <rte_version.h>
2548 #if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0)
2549 #error "required DPDK >= 16.07"
2550 #endif
2551 ]]
2552 )
2553 ],
2554 [dpdk_keepalive="yes"],
2555 [dpdk_keepalive="no (DPDK version < 16.07)"]
2556 )
2557 ],
2558 [with_libdpdk="no (rte_config.h not found)"]
2559 )
2560 CPPFLAGS="$SAVE_CPPFLAGS"
6ca79b67 2561 CFLAGS="$SAVE_CFLAGS"
5acd2e6a
RK
2562fi
2563
2564if test "x$with_libdpdk" = "xyes"; then
dcddb48f
LB
2565 SAVE_LIBS="$LIBS"
2566 LIBS="$LIBDPDK_LIBS $LIBS"
5acd2e6a
RK
2567 SAVE_LDFLAGS="$LDFLAGS"
2568 LDFLAGS="$LIBDPDK_LDFLAGS $LDFLAGS"
dcddb48f
LB
2569 SAVE_CPPFLAGS="$CPPFLAGS"
2570 CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS"
2571 SAVE_CFLAGS="$CFLAGS"
2572 CFLAGS="$LIBDPDK_CFLAGS $CFLAGS"
2573 AC_LINK_IFELSE(
2574 [
2575 AC_LANG_PROGRAM(
2576 [[
2577 #include <rte_eal.h>
2578 ]],
2579 [[return rte_eal_init(0, NULL);]]
2580 )
2581 ],
5acd2e6a
RK
2582 [with_libdpdk="yes"],
2583 [with_libdpdk="no (symbol 'rte_eal_init' not found)"]
2584 )
dcddb48f 2585 LIBS="$SAVE_LIBS"
5acd2e6a 2586 LDFLAGS="$SAVE_LDFLAGS"
dcddb48f
LB
2587 CPPFLAGS="$SAVE_CPPFLAGS"
2588 CFLAGS="$SAVE_CFLAGS"
5acd2e6a
RK
2589fi
2590
2591# }}}
2592
975e7fd6 2593# --with-libesmtp {{{
865f2eb3
RK
2594AC_ARG_WITH([libesmtp],
2595 [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
2596 [
2597 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
2598 with_libesmtp_cppflags="-I$withval/include"
2599 with_libesmtp_ldflags="-L$withval/lib"
2600 with_libesmtp="yes"
2601 else
2602 with_libesmtp="$withval"
2603 fi
2604 ],
2605 [with_libesmtp="yes"]
2606)
2607
2608if test "x$with_libesmtp" = "xyes"; then
2609 SAVE_CPPFLAGS="$CPPFLAGS"
2610 CPPFLAGS="$CPPFLAGS $with_libesmtp_cppflags"
2611
2612 AC_CHECK_HEADERS([libesmtp.h],
2613 [with_libesmtp="yes"],
2614 [with_libesmtp="no (libesmtp.h not found)"]
2615 )
2616
2617 CPPFLAGS="$SAVE_CPPFLAGS"
0aa63f0c 2618fi
865f2eb3
RK
2619
2620if test "x$with_libesmtp" = "xyes"; then
2621 SAVE_LDFLAGS="$LDFLAGS"
2622 LDFLAGS="$LDFLAGS $with_esmtp_ldflags"
2623
2624 AC_CHECK_LIB([esmtp], [smtp_create_session],
2625 [with_libesmtp="yes"],
2626 [with_libesmtp="no (Symbol 'smtp_create_session' not found)"]
2627 )
2628
2629 LDFLAGS="$SAVE_LDFLAGS"
4aed4a7a 2630fi
865f2eb3
RK
2631
2632BUILD_WITH_LIBESMTP_CPPFLAGS="$with_libesmtp_cppflags"
2633BUILD_WITH_LIBESMTP_LDFLAGS="$with_libesmtp_ldflags"
2634BUILD_WITH_LIBESMTP_LIBS="-lesmtp"
2635AC_SUBST(BUILD_WITH_LIBESMTP_CPPFLAGS)
2636AC_SUBST(BUILD_WITH_LIBESMTP_LDFLAGS)
2637AC_SUBST(BUILD_WITH_LIBESMTP_LIBS)
8757c918 2638# }}}
28c5e282 2639
2f0bd3ba 2640# --with-libganglia {{{
865f2eb3
RK
2641AC_ARG_WITH([libganglia],
2642 [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
2643 [
2644 if test -f "$withval" && test -x "$withval"; then
2645 with_libganglia_config="$withval"
2646 with_libganglia="yes"
2647 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"; then
2648 with_libganglia_config="$withval/bin/ganglia-config"
2649 with_libganglia="yes"
2650 else if test -d "$withval"; then
2651 GANGLIA_CPPFLAGS="-I$withval/include"
2652 GANGLIA_LDFLAGS="-L$withval/lib"
2653 with_libganglia="yes"
2654 else
2655 with_libganglia="$withval"
2656 fi; fi; fi
2657 ],
2658 [with_libganglia="yes"]
2659)
2f0bd3ba 2660
865f2eb3
RK
2661if test "x$with_libganglia" = "xyes"; then
2662 if test "x$with_libganglia_config" != "x"; then
2663 if test "x$GANGLIA_CPPFLAGS" = "x"; then
2664 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
2665 fi
2666
2667 if test "x$GANGLIA_LDFLAGS" = "x"; then
2668 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
2669 fi
2670
2671 if test "x$GANGLIA_LIBS" = "x"; then
2672 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
2673 fi
2674 else
2675 GANGLIA_LIBS="-lganglia"
2676 fi
2f0bd3ba
FF
2677fi
2678
859882b1
FF
2679AC_CHECK_HEADERS([rpc/types.h],
2680 [have_rpc_types_h="yes"],
2681 [have_rpc_types_h="no"]
2682)
2683AS_UNSET([ac_cv_header_rpc_types_h])
2684if test "x$have_rpc_types_h" = "xno"; then
2685 # SunRPC has been removed from glibc.
2686 # Replacement headers are in the "tirpc" subdirectory.
2687 SAVE_CPPFLAGS="$CPPFLAGS"
2688 CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"
2689
2690 AC_CHECK_HEADERS([rpc/types.h],
2691 [GANGLIA_CPPFLAGS="$GANGLIA_CPPFLAGS -I/usr/include/tirpc"],
2692 [with_libganglia="no (rpc/types.h not found)"]
2693 )
2694
2695 CPPFLAGS="$SAVE_CPPFLAGS"
2696fi
2697
2f0bd3ba
FF
2698SAVE_CPPFLAGS="$CPPFLAGS"
2699SAVE_LDFLAGS="$LDFLAGS"
2700CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
2701LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
2702
865f2eb3 2703if test "x$with_libganglia" = "xyes"; then
ffe78eb0 2704 AC_CHECK_HEADERS([ganglia.h],
865f2eb3 2705 [with_libganglia="yes"],
ffe78eb0 2706 [with_libganglia="no (ganglia.h not found)"]
865f2eb3 2707 )
2f0bd3ba
FF
2708fi
2709
865f2eb3
RK
2710if test "x$with_libganglia" = "xyes"; then
2711 AC_CHECK_LIB([ganglia], [xdr_Ganglia_value_msg],
2712 [with_libganglia="yes"],
2713 [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"]
2714 )
2f0bd3ba
FF
2715fi
2716
2717CPPFLAGS="$SAVE_CPPFLAGS"
2718LDFLAGS="$SAVE_LDFLAGS"
2719
2720AC_SUBST(GANGLIA_CPPFLAGS)
2721AC_SUBST(GANGLIA_LDFLAGS)
2722AC_SUBST(GANGLIA_LIBS)
2f0bd3ba
FF
2723# }}}
2724
6c4006c2
FF
2725# --with-libgcrypt {{{
2726GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
2727GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
2728GCRYPT_LIBS="$GCRYPT_LIBS"
865f2eb3
RK
2729AC_ARG_WITH([libgcrypt],
2730 [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
2731 [
2732 if test -f "$withval" && test -x "$withval"; then
2733 with_libgcrypt_config="$withval"
2734 with_libgcrypt="yes"
c268154b
MF
2735 else if test -f "$withval/bin/libgcrypt-config" && test -x "$withval/bin/libgcrypt-config"; then
2736 with_libgcrypt_config="$withval/bin/libgcrypt-config"
865f2eb3
RK
2737 with_libgcrypt="yes"
2738 else if test -d "$withval"; then
2739 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
2740 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
2741 with_libgcrypt="yes"
2742 else
c268154b 2743 with_libgcrypt_config="libgcrypt-config"
865f2eb3
RK
2744 with_libgcrypt="$withval"
2745 fi; fi; fi
2746 ],
2747 [
2748 with_libgcrypt_config="libgcrypt-config"
2749 with_libgcrypt="yes"
2750 ]
2751)
6c4006c2 2752
865f2eb3
RK
2753if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"; then
2754 if test "x$GCRYPT_CPPFLAGS" = "x"; then
2755 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
2756 fi
6c4006c2 2757
865f2eb3
RK
2758 if test "x$GCRYPT_LIBS" = "x"; then
2759 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
2760 fi
6c4006c2
FF
2761fi
2762
2763SAVE_CPPFLAGS="$CPPFLAGS"
2764SAVE_LDFLAGS="$LDFLAGS"
7fe3dd55 2765SAVE_LIBS="$LIBS"
6c4006c2
FF
2766CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
2767LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
7fe3dd55 2768LIBS="$LIBS $GCRYPT_LIBS"
6c4006c2 2769
865f2eb3 2770if test "x$with_libgcrypt" = "xyes"; then
865f2eb3
RK
2771 AC_CHECK_HEADERS([gcrypt.h],
2772 [with_libgcrypt="yes"],
2773 [with_libgcrypt="no (gcrypt.h not found)"]
2774 )
6c4006c2
FF
2775fi
2776
865f2eb3
RK
2777if test "x$with_libgcrypt" = "xyes"; then
2778 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
2779 [with_libgcrypt="yes"],
2780 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"]
2781 )
6c4006c2
FF
2782fi
2783
2784CPPFLAGS="$SAVE_CPPFLAGS"
2785LDFLAGS="$SAVE_LDFLAGS"
7fe3dd55 2786LIBS="$SAVE_LIBS"
6c4006c2 2787
865f2eb3
RK
2788AC_SUBST([GCRYPT_CPPFLAGS])
2789AC_SUBST([GCRYPT_LDFLAGS])
2790AC_SUBST([GCRYPT_LIBS])
2791AM_CONDITIONAL([BUILD_WITH_LIBGCRYPT], [test "x$with_libgcrypt" = "xyes"])
6c4006c2
FF
2792# }}}
2793
26314b8c 2794# --with-libgps {{{
865f2eb3
RK
2795AC_ARG_WITH([libgps],
2796 [AS_HELP_STRING([--with-libgps@<:@=PREFIX@:>@], [Path to libgps.])],
2797 [
2798 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
2799 with_libgps_cflags="-I$withval/include"
2800 with_libgps_ldflags="-L$withval/lib"
2801 with_libgps="yes"
2802 else
2803 with_libgps="$withval"
2804 fi
2805 ],
2806 [with_libgps="yes"]
2807)
2808
2809if test "x$with_libgps" = "xyes"; then
2810 SAVE_CFLAGS="$CFLAGS"
2811 CFLAGS="$CFLAGS $with_libgps_cflags"
26314b8c 2812
865f2eb3
RK
2813 AC_CHECK_HEADERS([gps.h],
2814 [with_libgps="yes"],
2815 [with_libgps="no (gps.h not found)"]
2816 )
26314b8c 2817
865f2eb3 2818 CFLAGS="$SAVE_CFLAGS"
26314b8c 2819fi
26314b8c 2820
865f2eb3
RK
2821if test "x$with_libgps" = "xyes"; then
2822 SAVE_LDFLAGS="$LDFLAGS"
2823 LDFLAGS="$LDFLAGS $with_libgps_ldflags"
26314b8c 2824
865f2eb3
RK
2825 AC_CHECK_LIB([gps], [gps_open],
2826 [with_libgps="yes"],
2827 [with_libgps="no (symbol gps_open not found)"]
2828 )
2829
2830 LDFLAGS="$SAVE_LDFLAGS"
26314b8c 2831fi
865f2eb3
RK
2832
2833if test "x$with_libgps" = "xyes"; then
2834 BUILD_WITH_LIBGPS_CFLAGS="$with_libgps_cflags"
2835 BUILD_WITH_LIBGPS_LDFLAGS="$with_libgps_ldflags"
2836 BUILD_WITH_LIBGPS_LIBS="-lgps"
2837fi
2838
2839AC_SUBST([BUILD_WITH_LIBGPS_CFLAGS])
2840AC_SUBST([BUILD_WITH_LIBGPS_LDFLAGS])
2841AC_SUBST([BUILD_WITH_LIBGPS_LIBS])
2842
26314b8c
NJ
2843# }}}
2844
aab18e7e 2845# --with-libgrpc++ {{{
865f2eb3
RK
2846AC_ARG_WITH([libgrpc++],
2847 [AS_HELP_STRING([--with-libgrpc++@<:@=PREFIX@:>@], [Path to libgrpc++.])],
aab18e7e
RK
2848 [
2849 with_grpcpp="$withval"
865f2eb3 2850 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
aab18e7e
RK
2851 with_libgrpcpp_cppflags="-I$withval/include"
2852 with_libgrpcpp_ldflags="-L$withval/lib"
dcabeb20 2853 with_libgrpcpp_bin="$withval/bin"
aab18e7e
RK
2854 with_libgrpcpp="yes"
2855 fi
865f2eb3 2856 if test "x$withval" = "xno"; then
aab18e7e
RK
2857 with_libgrpcpp="no (disabled on command line)"
2858 fi
2859 ],
2860 [withval="yes"]
2861)
865f2eb3 2862if test "x$withval" = "xyes"; then
aab18e7e
RK
2863PKG_CHECK_MODULES([GRPCPP], [grpc++],
2864 [with_libgrpcpp="yes"],
2865 [with_libgrpcpp="no (pkg-config could not find libgrpc++)"]
2866)
408b3fc3
SH
2867fi
2868
865f2eb3 2869if test "x$withval" != "xno"; then
d3556188
FF
2870 AC_MSG_CHECKING([whether $CXX accepts -std=c++14])
2871 if test_cxx_flags -std=c++14; then
aab18e7e
RK
2872 AC_MSG_RESULT([yes])
2873 else
2874 AC_MSG_RESULT([no])
d3556188
FF
2875 with_libgrpcpp="no (requires C++14 support)"
2876 with_libprotobuf="no (<absl/base/policy_checks.h> requires C++14 support)"
aab18e7e 2877 fi
408b3fc3
SH
2878fi
2879
865f2eb3 2880if test "x$with_libgrpcpp" = "xyes"; then
aab18e7e
RK
2881 AC_LANG_PUSH(C++)
2882 SAVE_CPPFLAGS="$CPPFLAGS"
d3556188 2883 CPPFLAGS="-std=c++14 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS $CPPFLAGS"
865f2eb3
RK
2884 AC_CHECK_HEADERS([grpc++/grpc++.h],
2885 [with_libgrpcpp="yes"],
aab18e7e
RK
2886 [with_libgrpcpp="no (<grpc++/grpc++.h> not found)"]
2887 )
2888 CPPFLAGS="$SAVE_CPPFLAGS"
2889 AC_LANG_POP(C++)
408b3fc3 2890fi
865f2eb3
RK
2891
2892if test "x$with_libgrpcpp" = "xyes"; then
aab18e7e 2893 AC_LANG_PUSH(C++)
7b343e56 2894 SAVE_CPPFLAGS="$CPPFLAGS"
aab18e7e
RK
2895 SAVE_LDFLAGS="$LDFLAGS"
2896 SAVE_LIBS="$LIBS"
d3556188 2897 CPPFLAGS="-std=c++14 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS $CPPFLAGS"
aab18e7e 2898 LDFLAGS="$with_libgrpcpp_ldflags"
865f2eb3 2899 if test "x$GRPCPP_LIBS" = "x"; then
aab18e7e
RK
2900 LIBS="-lgrpc++"
2901 else
2902 LIBS="$GRPCPP_LIBS"
2903 fi
2904 AC_LINK_IFELSE(
865f2eb3
RK
2905 [
2906 AC_LANG_PROGRAM(
2907 [[#include <grpc++/grpc++.h>]],
2908 [[grpc::ServerBuilder sb;]]
2909 )
2910 ],
aab18e7e
RK
2911 [
2912 with_libgrpcpp="yes"
865f2eb3 2913 if test "x$GRPCPP_LIBS" = "x"; then
aab18e7e
RK
2914 GRPCPP_LIBS="-lgrpc++"
2915 fi
2916 ],
2917 [with_libgrpcpp="no (libgrpc++ not found)"]
2918 )
7b343e56 2919 CPPFLAGS="$SAVE_CPPFLAGS"
aab18e7e
RK
2920 LDFLAGS="$SAVE_LDFLAGS"
2921 LIBS="$SAVE_LIBS"
2922 AC_LANG_POP(C++)
2923fi
865f2eb3 2924
d3556188 2925BUILD_WITH_LIBGRPCPP_CPPFLAGS="-std=c++14 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS"
aab18e7e
RK
2926BUILD_WITH_LIBGRPCPP_LDFLAGS="$with_libgrpcpp_ldflags"
2927BUILD_WITH_LIBGRPCPP_LIBS="$GRPCPP_LIBS"
2928AC_SUBST([BUILD_WITH_LIBGRPCPP_CPPFLAGS])
2929AC_SUBST([BUILD_WITH_LIBGRPCPP_LDFLAGS])
2930AC_SUBST([BUILD_WITH_LIBGRPCPP_LIBS])
408b3fc3
SH
2931# }}}
2932
865f2eb3 2933AC_ARG_VAR([GRPC_CPP_PLUGIN], [path to the grpc_cpp_plugin binary])
dcabeb20
FF
2934if test "x$with_libgrpcpp_bin" = "x"; then
2935 AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
2936else
2937 AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin], [], "$with_libgrpcpp_bin:$PATH")
2938fi
865f2eb3
RK
2939AM_CONDITIONAL([HAVE_GRPC_CPP], [test "x$GRPC_CPP_PLUGIN" != "x"])
2940
975e7fd6 2941# --with-libiptc {{{
865f2eb3
RK
2942AC_ARG_WITH([libiptc],
2943 [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
2944 [
2945 if test "x$withval" = "xyes"; then
2946 with_libiptc="pkgconfig"
2947 else if test "x$withval" = "xno"; then
2948 with_libiptc="no"
2949 else
2950 with_libiptc="yes"
2951 with_libiptc_cflags="-I$withval/include"
2952 with_libiptc_libs="-L$withval/lib"
2953 fi; fi
2954 ],
2955 [
2956 if test "x$ac_system" = "xLinux"; then
2957 with_libiptc="pkgconfig"
2958 else
2959 with_libiptc="no (Linux only)"
2960 fi
2961 ]
2962)
d1f72747 2963
865f2eb3
RK
2964if test "x$with_libiptc" = "xpkgconfig"; then
2965 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
2966 if test $? -ne 0; then
2967 with_libiptc="no (pkg-config doesn't know libiptc)"
2968 fi
d1f72747 2969fi
865f2eb3
RK
2970
2971if test "x$with_libiptc" = "xpkgconfig"; then
2972 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
2973 if test $? -ne 0; then
2974 with_libiptc="no ($PKG_CONFIG failed)"
2975 fi
2976
2977 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
2978 if test $? -ne 0; then
2979 with_libiptc="no ($PKG_CONFIG failed)"
2980 fi
d1f72747
FF
2981fi
2982
2983SAVE_CPPFLAGS="$CPPFLAGS"
2984CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
2985
2986# check whether the header file for libiptc is available.
865f2eb3
RK
2987if test "x$with_libiptc" = "xpkgconfig"; then
2988 AC_CHECK_HEADERS([libiptc/libiptc.h libiptc/libip6tc.h],
2989 [],
2990 [with_libiptc="no (header file missing)"]
2991 )
975e7fd6 2992fi
865f2eb3 2993
88998e1d
FF
2994# If the header file is available, check for the required type declaractions.
2995# They may be missing in old versions of libiptc. In that case, they will be
2996# declared in the iptables plugin.
865f2eb3
RK
2997if test "x$with_libiptc" = "xpkgconfig"; then
2998 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
af0dd163 2999fi
865f2eb3 3000
88998e1d 3001# Check for the iptc_init symbol in the library.
3835b23a 3002# This could be in iptc or ip4tc
865f2eb3
RK
3003if test "x$with_libiptc" = "xpkgconfig"; then
3004 SAVE_LIBS="$LIBS"
3005 AC_SEARCH_LIBS([iptc_init], [iptc ip4tc],
3006 [with_libiptc="pkgconfig"],
3007 [with_libiptc="no"],
3008 [$with_libiptc_libs]
3009 )
3010 LIBS="$SAVE_LIBS"
3011fi
3012
3013if test "x$with_libiptc" = "xpkgconfig"; then
3014 with_libiptc="yes"
88998e1d 3015fi
d1f72747
FF
3016
3017CPPFLAGS="$SAVE_CPPFLAGS"
3018
865f2eb3
RK
3019if test "x$with_libiptc" = "xyes"; then
3020 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
3021 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
a690e4ac 3022fi
865f2eb3
RK
3023AC_SUBST([BUILD_WITH_LIBIPTC_CPPFLAGS])
3024AC_SUBST([BUILD_WITH_LIBIPTC_LDFLAGS])
8757c918 3025# }}}
86ca149a 3026
ff1c15a6
FF
3027# --with-java {{{
3028with_java_home="$JAVA_HOME"
865f2eb3
RK
3029if test "x$with_java_home" = "x"; then
3030 with_java_home="/usr/lib/jvm"
fc6dcff7 3031fi
865f2eb3 3032
0e187c2e 3033JAVAC="$JAVAC"
c983405b 3034JAR="$JAR"
865f2eb3
RK
3035AC_ARG_WITH([java],
3036 [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
3037 [
3038 if test "x$withval" = "xno"; then
3039 with_java="no"
3040 else if test "x$withval" = "xyes"; then
3041 with_java="yes"
3042 else
3043 with_java_home="$withval"
3044 with_java="yes"
3045 fi; fi
3046 ],
3047 [with_java="yes"]
3048)
3049
ac9a4917
BA
3050AX_COMPARE_VERSION([$am__api_version],[lt],[1.12],
3051 [JAVA_TIMESTAMP_FILE="classdist_noinst.stamp"],
3052 [JAVA_TIMESTAMP_FILE="classnoinst.stamp"])
865f2eb3
RK
3053if test "x$with_java" = "xyes"; then
3054 if test -d "$with_java_home"; then
3055 AC_MSG_CHECKING([for jni.h])
3056 TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
3057 if test "x$TMPVAR" != "x"; then
3058 AC_MSG_RESULT([found in $TMPVAR])
3059 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
3060 else
3061 AC_MSG_RESULT([not found])
3062 fi
3063
3064 AC_MSG_CHECKING([for jni_md.h])
3065 TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
3066 if test "x$TMPVAR" != "x"; then
3067 AC_MSG_RESULT([found in $TMPVAR])
3068 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
3069 else
3070 AC_MSG_RESULT([not found])
3071 fi
3072
3073 AC_MSG_CHECKING([for libjvm.so])
3074 TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
3075 if test "x$TMPVAR" != "x"; then
3076 AC_MSG_RESULT([found in $TMPVAR])
3077 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
3078 else
3079 AC_MSG_RESULT([not found])
3080 fi
3081
3082 if test "x$JAVAC" = "x"; then
3083 AC_MSG_CHECKING([for javac])
3084 TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
3085 if test "x$TMPVAR" != "x"; then
3086 JAVAC="$TMPVAR"
3087 AC_MSG_RESULT([$JAVAC])
3088 else
3089 AC_MSG_RESULT([not found])
3090 fi
3091 fi
3092
3093 if test "x$JAR" = "x"; then
3094 AC_MSG_CHECKING([for jar])
3095 TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
3096 if test "x$TMPVAR" != "x"; then
3097 JAR="$TMPVAR"
3098 AC_MSG_RESULT([$JAR])
3099 else
3100 AC_MSG_RESULT([not found])
3101 fi
3102 fi
3103 else if test "x$with_java_home" != "x"; then
3104 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
3105 fi; fi
ff1c15a6
FF
3106fi
3107
865f2eb3
RK
3108if test "x$JAVAC" = "x"; then
3109 with_javac_path="$PATH"
3110 if test "x$with_java_home" != "x"; then
3111 with_javac_path="$with_java_home:with_javac_path"
3112 if test -d "$with_java_home/bin"; then
3113 with_javac_path="$with_java_home/bin:with_javac_path"
3114 fi
3115 fi
0e187c2e 3116
865f2eb3 3117 AC_PATH_PROG([JAVAC], [javac], [], "$with_javac_path")
0e187c2e 3118fi
865f2eb3
RK
3119
3120if test "x$JAVAC" = "x"; then
3121 with_java="no (javac not found)"
0e187c2e 3122fi
c983405b 3123
865f2eb3
RK
3124if test "x$JAR" = "x"; then
3125 with_jar_path="$PATH"
3126 if test "x$with_java_home" != "x"; then
3127 with_jar_path="$with_java_home:$with_jar_path"
3128 if test -d "$with_java_home/bin"; then
3129 with_jar_path="$with_java_home/bin:$with_jar_path"
3130 fi
3131 fi
3132
3133 AC_PATH_PROG([JAR], [jar], [], "$with_jar_path")
c983405b 3134fi
865f2eb3
RK
3135
3136if test "x$JAR" = "x"; then
3137 with_java="no (jar not found)"
c983405b 3138fi
ff1c15a6
FF
3139
3140SAVE_CPPFLAGS="$CPPFLAGS"
3141SAVE_CFLAGS="$CFLAGS"
3142SAVE_LDFLAGS="$LDFLAGS"
486d4f03 3143SAVE_LIBS="$LIBS"
ff1c15a6
FF
3144CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
3145CFLAGS="$CFLAGS $JAVA_CFLAGS"
3146LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
486d4f03 3147LIBS="$LIBS $JAVA_LIBS"
ff1c15a6 3148
865f2eb3
RK
3149if test "x$with_java" = "xyes"; then
3150 AC_CHECK_HEADERS([jni.h],
3151 [with_jave="yes"],
3152 [with_java="no (jni.h not found)"])
ff1c15a6 3153fi
865f2eb3
RK
3154
3155if test "x$with_java" = "xyes"; then
3156 AC_CHECK_LIB([jvm], [JNI_CreateJavaVM],
3157 [with_java="yes"],
3158 [with_java="no (Symbol 'JNI_CreateJavaVM' not found)"],
3159 [$JAVA_LIBS $PTHREAD_LIBS]
3160 )
ff1c15a6 3161fi
865f2eb3
RK
3162
3163if test "x$with_java" = "xyes"; then
3164 JAVA_LIBS="$JAVA_LIBS -ljvm"
ff1c15a6
FF
3165fi
3166
3167CPPFLAGS="$SAVE_CPPFLAGS"
3168CFLAGS="$SAVE_CFLAGS"
3169LDFLAGS="$SAVE_LDFLAGS"
486d4f03 3170LIBS="$SAVE_LIBS"
ff1c15a6 3171
865f2eb3
RK
3172AC_SUBST([JAVA_CPPFLAGS])
3173AC_SUBST([JAVA_CFLAGS])
3174AC_SUBST([JAVA_LDFLAGS])
3175AC_SUBST([JAVA_LIBS])
ac9a4917 3176AC_SUBST([JAVA_TIMESTAMP_FILE])
865f2eb3 3177AM_CONDITIONAL([BUILD_WITH_JAVA], [test "x$with_java" = "xyes"])
ff1c15a6
FF
3178# }}}
3179
6ecb1f03 3180# --with-libldap {{{
865f2eb3
RK
3181AC_ARG_WITH([libldap],
3182 [AS_HELP_STRING([--with-libldap@<:@=PREFIX@:>@], [Path to libldap.])],
3183 [
3184 if test "x$withval" = "xyes"; then
3185 with_libldap="yes"
3186 else if test "x$withval" = "xno"; then
3187 with_libldap="no"
3188 else
3189 with_libldap="yes"
3190 LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS -I$withval/include"
3191 LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS -L$withval/lib"
3192 fi; fi
3193 ],
3194 [with_libldap="yes"]
3195)
6ecb1f03
KR
3196
3197SAVE_CPPFLAGS="$CPPFLAGS"
3198SAVE_LDFLAGS="$LDFLAGS"
3199
3200CPPFLAGS="$CPPFLAGS $LIBLDAP_CPPFLAGS"
3201LDFLAGS="$LDFLAGS $LIBLDAP_LDFLAGS"
3202
865f2eb3 3203if test "x$with_libldap" = "xyes"; then
865f2eb3
RK
3204 AC_CHECK_HEADERS([ldap.h],
3205 [with_libldap="yes"],
3206 [with_libldap="no ('ldap.h' not found)"]
3207 )
6ecb1f03 3208fi
6ecb1f03 3209
865f2eb3 3210if test "x$with_libldap" = "xyes"; then
865f2eb3
RK
3211 AC_CHECK_LIB([ldap], [ldap_initialize],
3212 [with_libldap="yes"],
3213 [with_libldap="no (symbol 'ldap_initialize' not found)"]
3214 )
6ecb1f03
KR
3215fi
3216
3217CPPFLAGS="$SAVE_CPPFLAGS"
3218LDFLAGS="$SAVE_LDFLAGS"
3219
3220if test "x$with_libldap" = "xyes"
3221then
865f2eb3
RK
3222 BUILD_WITH_LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS"
3223 BUILD_WITH_LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS"
6ecb1f03 3224fi
865f2eb3
RK
3225AC_SUBST([BUILD_WITH_LIBLDAP_CPPFLAGS])
3226AC_SUBST([BUILD_WITH_LIBLDAP_LDFLAGS])
6ecb1f03
KR
3227# }}}
3228
02309232 3229# --with-liblua {{{
02309232 3230AC_ARG_VAR([LIBLUA_PKG_CONFIG_NAME], [Name of liblua used by pkg-config])
6fc6255c 3231if test "x$LIBLUA_PKG_CONFIG_NAME" != "x"
02309232 3232then
6fc6255c
RK
3233 PKG_CHECK_MODULES([LUA], [$LIBLUA_PKG_CONFIG_NAME],
3234 [with_liblua="yes"],
3235 [with_liblua="no"]
3236 )
3237else
3238 PKG_CHECK_MODULES([LUA], [lua],
3239 [with_liblua="yes"],
3240 [
3241 PKG_CHECK_MODULES([LUA], [lua-5.3],
3242 [with_liblua="yes"],
3243 [
a86a24f9 3244 PKG_CHECK_MODULES([LUA], [lua5.3],
6fc6255c
RK
3245 [with_liblua="yes"],
3246 [
ec4062fe 3247 PKG_CHECK_MODULES([LUA], [lua53],
6fc6255c
RK
3248 [with_liblua="yes"],
3249 [
ec4062fe 3250 PKG_CHECK_MODULES([LUA], [lua-5.2],
6fc6255c
RK
3251 [with_liblua="yes"],
3252 [
ec4062fe 3253 PKG_CHECK_MODULES([LUA], [lua5.2],
6fc6255c
RK
3254 [with_liblua="yes"],
3255 [
ec4062fe 3256 PKG_CHECK_MODULES([LUA], [lua52],
6fc6255c 3257 [with_liblua="yes"],
ec4062fe
RK
3258 [
3259 PKG_CHECK_MODULES([LUA], [lua-5.1],
3260 [with_liblua="yes"],
3261 [
3262 PKG_CHECK_MODULES([LUA], [lua5.1],
3263 [with_liblua="yes"],
3264 [
3265 PKG_CHECK_MODULES([LUA], [lua51],
3266 [with_liblua="yes"],
4763671c
KH
3267 [
3268 PKG_CHECK_MODULES([LUA], [luajit],
3269 [
3270 with_liblua="yes"
3271 ],
3272 [with_liblua="no (pkg-config cannot find libluajit)"]
3273 )
3274 ]
ec4062fe
RK
3275 )
3276 ]
3277 )
3278 ]
3279 )
3280 ]
6fc6255c
RK
3281 )
3282 ]
3283 )
3284 ]
3285 )
3286 ]
3287 )
3288 ]
3289 )
3290 ]
3291 )
3292 ]
3293 )
02309232
JA
3294fi
3295
3296if test "x$with_liblua" = "xyes"
3297then
3eda7836
RK
3298 SAVE_CPPFLAGS="$CPPFLAGS"
3299 CPPFLAGS="$CPPFLAGS $LUA_CFLAGS"
02309232 3300
6fc6255c
RK
3301 AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
3302 [with_liblua="yes"],
3303 [with_liblua="no (header not found)"]
3304 )
02309232 3305
3eda7836 3306 CPPFLAGS="$SAVE_CPPFLAGS"
02309232 3307fi
02309232 3308
02309232
JA
3309if test "x$with_liblua" = "xyes"
3310then
6fc6255c
RK
3311 SAVE_LIBS="$LIBS"
3312 LIBS="$LIBS $LUA_LIBS"
02309232 3313
6fc6255c
RK
3314 AC_CHECK_FUNC([lua_settop],
3315 [with_liblua="yes"],
3316 [with_liblua="no (symbol 'lua_settop' not found)"]
3317 )
02309232 3318
6fc6255c 3319 LIBS="$SAVE_LIBS"
02309232 3320fi
6fc6255c 3321
02309232
JA
3322if test "x$with_liblua" = "xyes"
3323then
6fc6255c
RK
3324 BUILD_WITH_LIBLUA_CFLAGS="$LUA_CFLAGS"
3325 BUILD_WITH_LIBLUA_LIBS="$LUA_LIBS"
02309232 3326fi
6fc6255c 3327AC_SUBST(BUILD_WITH_LIBLUA_CFLAGS)
02309232
JA
3328AC_SUBST(BUILD_WITH_LIBLUA_LIBS)
3329# }}}
3330
5e8e1fe1 3331# --with-libmemcached {{{
865f2eb3
RK
3332AC_ARG_WITH([libmemcached],
3333 [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
3334 [
3335 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
3336 with_libmemcached_cppflags="-I$withval/include"
3337 with_libmemcached_ldflags="-L$withval/lib"
3338 with_libmemcached="yes"
3339 else
3340 with_libmemcached="$withval"
3341 fi
3342 ],
3343 [with_libmemcached="yes"]
3344)
5e8e1fe1 3345
865f2eb3
RK
3346if test "x$with_libmemcached" = "xyes"; then
3347 SAVE_CPPFLAGS="$CPPFLAGS"
3348 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
5e8e1fe1 3349
865f2eb3
RK
3350 AC_CHECK_HEADERS([libmemcached/memcached.h],
3351 [with_libmemcached="yes"],
3352 [with_libmemcached="no (libmemcached/memcached.h not found)"]
3353 )
3354
3355 CPPFLAGS="$SAVE_CPPFLAGS"
5e8e1fe1 3356fi
5e8e1fe1 3357
865f2eb3
RK
3358if test "x$with_libmemcached" = "xyes"; then
3359 SAVE_CPPFLAGS="$CPPFLAGS"
3360 SAVE_LDFLAGS="$LDFLAGS"
3361 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
3362 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
5e8e1fe1 3363
865f2eb3
RK
3364 AC_CHECK_LIB([memcached], [memcached_create],
3365 [with_libmemcached="yes"],
3366 [with_libmemcached="no (Symbol 'memcached_create' not found)"]
3367 )
3368
3369 CPPFLAGS="$SAVE_CPPFLAGS"
3370 LDFLAGS="$SAVE_LDFLAGS"
5e8e1fe1 3371fi
865f2eb3
RK
3372
3373if test "x$with_libmemcached" = "xyes"; then
3374 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
3375 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
3376 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
3377fi
3378
3379AC_SUBST([BUILD_WITH_LIBMEMCACHED_CPPFLAGS])
3380AC_SUBST([BUILD_WITH_LIBMEMCACHED_LDFLAGS])
3381AC_SUBST([BUILD_WITH_LIBMEMCACHED_LIBS])
5e8e1fe1
FF
3382# }}}
3383
cc893903
FF
3384# --with-libmicrohttpd {{{
3385with_libmicrohttpd_cppflags=""
3386with_libmicrohttpd_ldflags=""
3387AC_ARG_WITH([libmicrohttpd], [AS_HELP_STRING([--with-libmicrohttpd@<:@=PREFIX@:>@], [Path to libmicrohttpd.])],
3388 [
b5b9a852 3389 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
cc893903
FF
3390 with_libmicrohttpd_cppflags="-I$withval/include"
3391 with_libmicrohttpd_ldflags="-L$withval/lib"
3392 with_libmicrohttpd="yes"
3393 fi
b5b9a852 3394 if test "x$withval" = "xno"; then
cc893903
FF
3395 with_libmicrohttpd="no (disabled on command line)"
3396 fi
3397 ],
3398 [withval="yes"]
3399)
b5b9a852
RK
3400if test "x$withval" = "xyes"; then
3401 PKG_CHECK_MODULES([MICROHTTPD], [libmicrohttpd],
3402 [with_libmicrohttpd="yes"],
3403 [with_libmicrohttpd="no (pkg-config could not find libmicrohttpd)"]
3404 )
cc893903
FF
3405fi
3406
b5b9a852 3407if test "x$MICROHTTPD_LIBS" = "x"; then
cc893903
FF
3408 MICROHTTPD_LIBS="-lmicrohttpd"
3409fi
3410
3411SAVE_CPPFLAGS="$CPPFLAGS"
3412SAVE_LDFLAGS="$LDFLAGS"
3413SAVE_LIBS="$LIBS"
3414CPPFLAGS="$with_libmicrohttpd_cppflags $MICROHTTPD_CFLAGS"
3415LDFLAGS="$with_libmicrohttpd_ldflags $LDFLAGS"
3416LIBS="$LIBS $MICROHTTPD_LIBS"
3417
b5b9a852 3418if test "x$with_libmicrohttpd" = "xyes"; then
cc893903 3419 AC_CHECK_HEADERS([microhttpd.h],
b5b9a852
RK
3420 [with_libmicrohttpd="yes"],
3421 [with_libmicrohttpd="no (<microhttpd.h> not found)"]
3422 )
cc893903
FF
3423fi
3424
b5b9a852 3425if test "x$with_libmicrohttpd" = "xyes"; then
cc893903 3426 AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
b5b9a852
RK
3427 [with_libmicrohttpd="yes"],
3428 [with_libmicrohttpd="no (libmicrohttpd not found)"]
3429 )
cc893903
FF
3430fi
3431
3432CPPFLAGS="$SAVE_CPPFLAGS"
3433LDFLAGS="$SAVE_LDFLAGS"
3434LIBS="$SAVE_LIBS"
3435
3436BUILD_WITH_LIBMICROHTTPD_CPPFLAGS="$with_libmicrohttpd_cppflags $MICROHTTPD_CFLAGS"
3437BUILD_WITH_LIBMICROHTTPD_LDFLAGS="$with_libmicrohttpd_ldflags"
3438BUILD_WITH_LIBMICROHTTPD_LIBS="$MICROHTTPD_LIBS"
3439AC_SUBST([BUILD_WITH_LIBMICROHTTPD_CPPFLAGS])
3440AC_SUBST([BUILD_WITH_LIBMICROHTTPD_LDFLAGS])
3441AC_SUBST([BUILD_WITH_LIBMICROHTTPD_LIBS])
3442# }}}
3443
367405c9 3444# --with-libmodbus {{{
865f2eb3
RK
3445AC_ARG_WITH([libmodbus],
3446 [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
3447 [
3448 if test "x$withval" = "xno"; then
3449 with_libmodbus="no"
3450 else if test "x$withval" = "xyes"; then
3451 with_libmodbus="use_pkgconfig"
3452 else if test -d "$with_libmodbus/lib"; then
3453 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
3454 with_libmodbus_cflags="-I$withval/include"
3455 with_libmodbus_libs="-L$withval/lib -lmodbus"
3456 with_libmodbus="yes"
3457 fi; fi; fi
3458 ],
3459 [with_libmodbus="use_pkgconfig"]
3460)
367405c9
FF
3461
3462# configure using pkg-config
865f2eb3 3463if test "x$with_libmodbus" = "xuse_pkgconfig"; then
865f2eb3
RK
3464 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
3465 if test $? -ne 0; then
3466 with_libmodbus="no (pkg-config doesn't know libmodbus)"
3467 fi
367405c9 3468fi
865f2eb3
RK
3469
3470if test "x$with_libmodbus" = "xuse_pkgconfig"; then
3471 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
3472 if test $? -ne 0; then
3473 with_libmodbus="no ($PKG_CONFIG failed)"
3474 fi
3475
3476 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
b5b9a852 3477 if test $? -ne 0; then
865f2eb3
RK
3478 with_libmodbus="no ($PKG_CONFIG failed)"
3479 fi
367405c9 3480fi
865f2eb3
RK
3481
3482if test "x$with_libmodbus" = "xuse_pkgconfig"; then
3483 with_libmodbus="yes"
367405c9
FF
3484fi
3485
865f2eb3
RK
3486if test "x$with_libmodbus" = "xyes"; then
3487 SAVE_CPPFLAGS="$CPPFLAGS"
3488 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
367405c9 3489
865f2eb3
RK
3490 AC_CHECK_HEADERS([modbus.h],
3491 [with_libmodbus="yes"],
3492 [with_libmodbus="no (modbus.h not found)"]
3493 )
367405c9 3494
865f2eb3 3495 CPPFLAGS="$SAVE_CPPFLAGS"
367405c9 3496fi
367405c9 3497
865f2eb3
RK
3498if test "x$with_libmodbus" = "xyes"; then
3499 SAVE_LDFLAGS="$LDFLAGS"
3500 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
367405c9 3501
865f2eb3
RK
3502 AC_CHECK_LIB([modbus], [modbus_connect],
3503 [with_libmodbus="yes"],
3504 [with_libmodbus="no (symbol modbus_connect not found)"]
3505 )
367405c9 3506
865f2eb3 3507 LDFLAGS="$SAVE_LDFLAGS"
367405c9 3508fi
865f2eb3
RK
3509
3510if test "x$with_libmodbus" = "xyes"; then
3511 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
3512 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
367405c9 3513fi
865f2eb3
RK
3514
3515AC_SUBST([BUILD_WITH_LIBMODBUS_CFLAGS])
3516AC_SUBST([BUILD_WITH_LIBMODBUS_LIBS])
367405c9
FF
3517# }}}
3518
13322bb3 3519# --with-libmongoc {{{
865f2eb3
RK
3520AC_ARG_WITH([libmongoc],
3521 [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
3522 [
3523 if test "x$withval" = "xyes"; then
3524 with_libmongoc="yes"
3525 else if test "x$withval" = "xno"; then
3526 with_libmongoc="no"
3527 else
1811b98c 3528 with_libmongoc="no"
865f2eb3
RK
3529 fi; fi
3530 ],
3531 [with_libmongoc="yes"]
3532)
13322bb3 3533
1811b98c
SA
3534if test "x$with_libmongoc" = "xyes"; then
3535 PKG_CHECK_MODULES([LIBMONGOC], [libmongoc-1.0],
3536 [with_libmongoc="yes"],
3537 [with_libmongoc="no (pkg-config could not find libmongoc)"]
3538 )
3539fi
13322bb3 3540
865f2eb3 3541if test "x$with_libmongoc" = "xyes"; then
1811b98c
SA
3542 SAVE_CPPFLAGS="$CPPFLAGS"
3543
3544 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CFLAGS"
3545
1811b98c 3546 AC_CHECK_HEADERS([mongoc.h],
865f2eb3 3547 [with_libmongoc="yes"],
1811b98c 3548 [with_libmongoc="no ('mongoc.h' not found)"]
865f2eb3 3549 )
1811b98c
SA
3550
3551 CPPFLAGS="$SAVE_CPPFLAGS"
13322bb3 3552fi
865f2eb3
RK
3553
3554if test "x$with_libmongoc" = "xyes"; then
1811b98c
SA
3555 SAVE_CPPFLAGS="$CPPFLAGS"
3556 SAVE_LDFLAGS="$LDFLAGS"
3557
3558 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CFLAGS"
3559 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
3560
1811b98c 3561 AC_CHECK_LIB([mongoc-1.0], [mongoc_init],
865f2eb3 3562 [with_libmongoc="yes"],
1811b98c 3563 [with_libmongoc="no (symbol 'mongoc_init' not found)"]
865f2eb3 3564 )
13322bb3 3565
1811b98c
SA
3566 CPPFLAGS="$SAVE_CPPFLAGS"
3567 LDFLAGS="$SAVE_LDFLAGS"
3568fi
13322bb3 3569
865f2eb3 3570if test "x$with_libmongoc" = "xyes"; then
1811b98c 3571 BUILD_WITH_LIBMONGOC_CFLAGS="$LIBMONGOC_CFLAGS"
865f2eb3 3572 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
1e1612fc 3573 BUILD_WITH_LIBMONGOC_LIBS="$LIBMONGOC_LIBS"
13322bb3 3574fi
865f2eb3 3575
1811b98c 3576AC_SUBST([BUILD_WITH_LIBMONGOC_CFLAGS])
865f2eb3 3577AC_SUBST([BUILD_WITH_LIBMONGOC_LDFLAGS])
1e1612fc 3578AC_SUBST([BUILD_WITH_LIBMONGOC_LIBS])
13322bb3
FF
3579# }}}
3580
ed93534f 3581# --with-libmosquitto {{{
865f2eb3
RK
3582AC_ARG_WITH([libmosquitto],
3583 [AS_HELP_STRING([--with-libmosquitto@<:@=PREFIX@:>@], [Path to libmosquitto.])],
3584 [
3585 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
3586 with_libmosquitto_cppflags="-I$withval/include"
3587 with_libmosquitto_ldflags="-L$withval/lib"
3588 with_libmosquitto="yes"
3589 else
3590 with_libmosquitto="$withval"
3591 fi
3592 ],
3593 [with_libmosquitto="yes"]
3594)
3595
3596if test "x$with_libmosquitto" = "xyes"; then
3597 SAVE_CPPFLAGS="$CPPFLAGS"
3598 CPPFLAGS="$CPPFLAGS $with_libmosquitto_cppflags"
ed93534f 3599
865f2eb3
RK
3600 AC_CHECK_HEADERS([mosquitto.h],
3601 [with_libmosquitto="yes"],
3602 [with_libmosquitto="no (mosquitto.h not found)"]
3603 )
ed93534f 3604
865f2eb3 3605 CPPFLAGS="$SAVE_CPPFLAGS"
ed93534f 3606fi
ed93534f 3607
865f2eb3
RK
3608if test "x$with_libmosquitto" = "xyes"; then
3609 SAVE_LDFLAGS="$LDFLAGS"
3610 LDFLAGS="$LDFLAGS $with_libmosquitto_ldflags"
3611
3612 AC_CHECK_LIB([mosquitto], [mosquitto_connect],
3613 [with_libmosquitto="yes"],
3614 [with_libmosquitto="no (libmosquitto not found)"]
3615 )
ed93534f 3616
865f2eb3 3617 LDFLAGS="$SAVE_LDFLAGS"
ed93534f 3618fi
865f2eb3
RK
3619
3620if test "x$with_libmosquitto" = "xyes"; then
3621 BUILD_WITH_LIBMOSQUITTO_CPPFLAGS="$with_libmosquitto_cppflags"
3622 BUILD_WITH_LIBMOSQUITTO_LDFLAGS="$with_libmosquitto_ldflags"
3623 BUILD_WITH_LIBMOSQUITTO_LIBS="-lmosquitto"
ed93534f 3624fi
865f2eb3
RK
3625
3626AC_SUBST([BUILD_WITH_LIBMOSQUITTO_CPPFLAGS])
3627AC_SUBST([BUILD_WITH_LIBMOSQUITTO_LDFLAGS])
3628AC_SUBST([BUILD_WITH_LIBMOSQUITTO_LIBS])
ed93534f
FF
3629# }}}
3630
8757c918 3631# --with-libmysql {{{
805c4940 3632with_mysql_config="mysql_config"
865f2eb3
RK
3633AC_ARG_WITH([libmysql],
3634 [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
3635 [
3636 if test "x$withval" = "xno"; then
3637 with_libmysql="no"
3638 else if test "x$withval" = "xyes"; then
3639 with_libmysql="yes"
3640 else
3641 if test -f "$withval" && test -x "$withval"; then
3642 with_mysql_config="$withval"
3643 else if test -x "$withval/bin/mysql_config"; then
3644 with_mysql_config="$withval/bin/mysql_config"
3645 fi; fi
3646 with_libmysql="yes"
3647 fi; fi
3648 ],
3649 [with_libmysql="yes"]
3650)
805c4940 3651
865f2eb3
RK
3652if test "x$with_libmysql" = "xyes"; then
3653 with_mysql_cflags=`$with_mysql_config --include 2>/dev/null`
3654 if test $? -ne 0; then
3655 with_libmysql="no ($with_mysql_config failed)"
3656 else
3657 SAVE_CPPFLAGS="$CPPFLAGS"
3658 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
805c4940 3659
865f2eb3
RK
3660 AC_CHECK_HEADERS([mysql.h],
3661 [have_mysql_h="yes"],
7aa48cd1 3662 [have_mysql_h="no"]
865f2eb3 3663 )
23164f56 3664
865f2eb3
RK
3665 if test "x$have_mysql_h" != "xyes"; then
3666 AC_CHECK_HEADERS([mysql/mysql.h],
3667 [have_mysql_mysql_h="yes"],
3668 [],
3669 )
3670 fi
23164f56 3671
865f2eb3
RK
3672 if test "x$have_mysql_h" != "xyes" && test "x$have_mysql_mysql_h" != "xyes"; then
3673 with_libmysql="no (mysql.h not found)"
3674 fi
805c4940 3675
865f2eb3
RK
3676 CPPFLAGS="$SAVE_CPPFLAGS"
3677 fi
e4303e15 3678fi
8f6c03d5 3679
865f2eb3
RK
3680if test "x$with_libmysql" = "xyes"; then
3681 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
3682 if test $? -ne 0; then
3683 with_libmysql="no ($with_mysql_config failed)"
3684 else
3685 SAVE_LIBS="$LIBS"
3686 LIBS="$with_mysql_libs"
3687
3688 AC_SEARCH_LIBS([mysql_get_server_version],
3689 [],
3690 [with_libmysql="yes"],
3691 [with_libmysql="no (symbol 'mysql_get_server_version' not found in ${LIBS})"],
3692 []
3693 )
3694 LIBS="$SAVE_LIBS"
3695 fi
e4303e15 3696fi
865f2eb3
RK
3697
3698if test "x$with_libmysql" = "xyes"; then
3699 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
3700 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
e4303e15 3701fi
865f2eb3
RK
3702
3703AC_SUBST([BUILD_WITH_LIBMYSQL_CFLAGS])
3704AC_SUBST([BUILD_WITH_LIBMYSQL_LIBS])
8757c918 3705# }}}
86ca149a 3706
25bf8128 3707# --with-libmnl {{{
865f2eb3
RK
3708AC_ARG_WITH([libmnl],
3709 [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])],
3710 [
3711 if test "x$withval" = "xyes"; then
3712 with_libmnl="yes"
3713 else if test "x$withval" = "xno"; then
3714 with_libmnl="no"
3715 else
3716 if test -d "$withval/include"; then
3717 with_libmnl_cflags="-I$withval/include"
3718 with_libmnl_libs="-L$withval/lib -lmnl"
3719 with_libmnl="yes"
3720 else
3721 AC_MSG_ERROR("no such directory: $withval/include")
3722 fi
3723 fi; fi
3724 ],
3725 [
3726 if test "x$ac_system" = "xLinux"; then
3727 with_libmnl="yes"
3728 else
3729 with_libmnl="no (Linux only library)"
3730 fi
3731 ]
3732)
975e7fd6 3733
865f2eb3
RK
3734if test "x$with_libmnl" = "xyes"; then
3735 if $PKG_CONFIG --exists libmnl 2>/dev/null; then
3736 with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`"
3737 with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`"
3738 fi
975e7fd6 3739
865f2eb3
RK
3740 AC_CHECK_HEADERS([libmnl.h libmnl/libmnl.h],
3741 [
3742 with_libmnl="yes"
3743 break
3744 ],
3745 [],
3746 [[
3747 #include <stdio.h>
3748 #include <sys/types.h>
3749 #include <asm/types.h>
3750 #include <sys/socket.h>
3751 #include <linux/netlink.h>
3752 #include <linux/rtnetlink.h>]]
3753 )
975e7fd6 3754
865f2eb3
RK
3755 AC_CHECK_HEADERS([linux/gen_stats.h linux/pkt_sched.h],
3756 [],
3757 [],
3758 [[
3759 #include <stdio.h>
3760 #include <sys/types.h>
3761 #include <asm/types.h>
3762 #include <sys/socket.h>
3763 ]]
3764 )
9f8962fb 3765
865f2eb3
RK
3766 AC_COMPILE_IFELSE(
3767 [
3768 AC_LANG_PROGRAM(
3769 [[
3770 #include <stdio.h>
3771 #include <sys/types.h>
3772 #include <asm/types.h>
3773 #include <sys/socket.h>
3774 #include <linux/netlink.h>
3775 #include <linux/rtnetlink.h>
3776 ]],
3777 [[
3778 int retval = TCA_STATS2;
307c875e 3779 return retval;
865f2eb3
RK
3780 ]]
3781 )
3782 ],
3783 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])]
3784 )
9f8962fb 3785
865f2eb3
RK
3786 AC_COMPILE_IFELSE(
3787 [
3788 AC_LANG_PROGRAM(
3789 [[
3790 #include <stdio.h>
3791 #include <sys/types.h>
3792 #include <asm/types.h>
3793 #include <sys/socket.h>
3794 #include <linux/netlink.h>
3795 #include <linux/rtnetlink.h>
3796 ]],
3797 [[
3798 int retval = TCA_STATS;
307c875e 3799 return retval;
865f2eb3
RK
3800 ]]
3801 )
3802 ],
3803 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
3804 )
3805
3806 AC_CHECK_MEMBERS([struct rtnl_link_stats64.tx_window_errors],
3807 [AC_DEFINE(HAVE_RTNL_LINK_STATS64, 1, [Define if struct rtnl_link_stats64 exists and is usable.])],
3808 [],
3809 [[#include <linux/if_link.h>]]
3810 )
3811
cc1e32e3
PR
3812 AC_CHECK_MEMBERS([struct rtnl_link_stats.rx_nohandler],
3813 [],
3814 [],
3815 [[#include <linux/if_link.h>]]
3816 )
3817
3818 AC_CHECK_MEMBERS([struct rtnl_link_stats64.rx_nohandler],
3819 [],
3820 [],
3821 [[#include <linux/if_link.h>]]
3822 )
3823
5c6eef04
KW
3824 AC_CHECK_DECLS([IFLA_VF_STATS_RX_DROPPED],
3825 [AC_DEFINE(HAVE_IFLA_VF_STATS_RX_DROPPED, 1, [Define if IFLA_VF_STATS_RX_DROPPED exists.])],
3826 [],
3827 [[#include <linux/if_link.h>]]
3828 )
3829
3830 AC_CHECK_DECLS([IFLA_VF_STATS_TX_DROPPED],
3831 [AC_DEFINE(HAVE_IFLA_VF_STATS_TX_DROPPED, 1, [Define if IFLA_VF_STATS_TX_DROPPED exists.])],
3832 [],
3833 [[#include <linux/if_link.h>]]
3834 )
3835
752d90b9
KW
3836 AC_CHECK_DECLS([IFLA_VF_STATS],
3837 [AC_DEFINE(HAVE_IFLA_VF_STATS, 1, [Define if IFLA_VF_STATS exists.])],
3838 [],
3839 [[#include <linux/if_link.h>]]
3840 )
3841
865f2eb3
RK
3842 AC_CHECK_LIB([mnl], [mnl_nlmsg_get_payload],
3843 [with_libmnl="yes"],
3844 [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"],
3845 [$with_libmnl_libs]
3846 )
9f8962fb
FF
3847fi
3848
865f2eb3
RK
3849if test "x$with_libmnl" = "xyes"; then
3850 BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags"
3851 BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs"
3852fi
3853AC_SUBST([BUILD_WITH_LIBMNL_CFLAGS])
3854AC_SUBST([BUILD_WITH_LIBMNL_LIBS])
4ea7a572 3855AM_CONDITIONAL([HAVE_LIBMNL], [test "x$with_libmnl" = "xyes"])
865f2eb3 3856# }}}
9f8962fb 3857
865f2eb3
RK
3858# --with-libnetapp {{{
3859AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
3860AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
3861AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
3862AC_ARG_WITH([libnetapp],
3863 [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
3864 [
3865 if test -d "$withval"; then
3866 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
3867 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
3868 with_libnetapp="yes"
3869 else
3870 with_libnetapp="$withval"
3871 fi
3872 ],
3873 [with_libnetapp="yes"]
3874)
3875
3876SAVE_CPPFLAGS="$CPPFLAGS"
3877SAVE_LDFLAGS="$LDFLAGS"
3878CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
3879LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
9f8962fb 3880
865f2eb3 3881if test "x$with_libnetapp" = "xyes"; then
865f2eb3
RK
3882 AC_CHECK_HEADERS([netapp_api.h],
3883 [with_libnetapp="yes"],
3884 [with_libnetapp="no (netapp_api.h not found)"]
3885 )
9f8962fb
FF
3886fi
3887
865f2eb3 3888if test "x$with_libnetapp" = "xyes"; then
865f2eb3
RK
3889 if test "x$LIBNETAPP_LIBS" = "x"; then
3890 LIBNETAPP_LIBS="$PTHREAD_LIBS -lxml -ladt -lssl -lm -lcrypto -lz"
3891 fi
3892
865f2eb3
RK
3893 AC_CHECK_LIB([netapp], [na_server_invoke_elem],
3894 [with_libnetapp="yes"],
3895 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
3896 [$LIBNETAPP_LIBS]
3897 )
3898
3899 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
9f8962fb
FF
3900fi
3901
865f2eb3
RK
3902CPPFLAGS="$SAVE_CPPFLAGS"
3903LDFLAGS="$SAVE_LDFLAGS"
3904
3905AC_SUBST([LIBNETAPP_CPPFLAGS])
3906AC_SUBST([LIBNETAPP_LDFLAGS])
3907AC_SUBST([LIBNETAPP_LIBS])
9f8962fb
FF
3908# }}}
3909
975e7fd6 3910# --with-libnetsnmp {{{
bd191644
RK
3911AC_ARG_WITH([libnetsnmp],
3912 [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to libnetsnmp.])],
3913 [
c1ddaf55
RK
3914 if test "x$withval" = "xno"; then
3915 with_libnetsnmp="no"
3916 else if test "x$withval" = "xyes"; then
3917 with_libnetsnmp="yes"
3918 else
3919 with_libnetsnmp_cppflags="-I$withval/include"
ce6cc80e 3920 with_libnetsnmp_ldflags="-L$withval/lib"
c1ddaf55
RK
3921 with_libnetsnmp="yes"
3922 fi; fi
bd191644
RK
3923 ],
3924 [with_libnetsnmp="yes"]
3925)
3926
3927if test "x$with_libnetsnmp" = "xyes"; then
c1ddaf55
RK
3928 SAVE_CPPFLAGS="$CPPFLAGS"
3929 CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags"
630e3bba 3930
bd191644
RK
3931 AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],
3932 [with_libnetsnmp="yes"],
3933 [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]
3934 )
3935
6466fcb4
RK
3936 AC_CHECK_HEADERS([net-snmp/net-snmp-includes.h],
3937 [with_libnetsnmp="yes"],
3938 [with_libnetsnmp="no (net-snmp/net-snmp-includes.h not found)"],
3939 [[
3940 #if HAVE_NET_SNMP_NET_SNMP_CONFIG_H
3941 # include <net-snmp/net-snmp-config.h>
3942 #endif
3943 ]]
bd191644 3944 )
975e7fd6 3945
c1ddaf55 3946 CPPFLAGS="$SAVE_CPPFLAGS"
975e7fd6 3947fi
bd191644
RK
3948
3949if test "x$with_libnetsnmp" = "xyes"; then
c1ddaf55
RK
3950 SAVE_LDFLAGS="$LDFLAGS"
3951 LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
975e7fd6 3952
c1ddaf55 3953 AC_CHECK_LIB([netsnmp], [init_snmp],
4367c421 3954 [with_libnetsnmp="yes"],
c1ddaf55 3955 [with_libnetsnmp="no (libnetsnmp not found)"]
bd191644 3956 )
8aba9d6e 3957
c1ddaf55 3958 LDFLAGS="$SAVE_LDFLAGS"
975e7fd6 3959fi
bd191644 3960
4367c421
MM
3961if test "x$with_libnetsnmp" = "xyes"; then
3962 SAVE_LDFLAGS="$LDFLAGS"
3963 LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
3964
3965 AC_CHECK_LIB([netsnmp], [netsnmp_get_version],
3966 [with_libnetsnmp="yes"],
3967 [with_libnetsnmp="no (couldn't get libnetsnmp version)"]
3968 )
3969
3970 LDFLAGS="$SAVE_LDFLAGS"
3971fi
3972
3973if test "x$with_libnetsnmp" = "xyes"; then
3974 SAVE_CPPFLAGS="$CPPFLAGS"
3975 SAVE_LDFLAGS="$LDFLAGS"
3976 SAVE_LIBS="$LIBS"
9317d073
DM
3977 CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags"
3978 if test "x$GCC" = "xyes"; then
3979 CPPFLAGS="$CPPFLAGS -Wall -Werror"
3980 fi
4367c421
MM
3981 LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
3982 LIBS="$LIBS -lnetsnmp"
3983
3984 AC_CACHE_CHECK([whether netsnmp library has old API],
3985 [c_cv_have_netsnmp_old_api],
3986 [
258e6aee 3987 AC_LINK_IFELSE(
4367c421
MM
3988 [
3989 AC_LANG_PROGRAM(
3990 [[
3991 #include <net-snmp/net-snmp-config.h>
3992 #include <net-snmp/net-snmp-includes.h>
3993 ]],
3994 [[
258e6aee 3995 netsnmp_variable_list *key = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);;
4367c421 3996 int val;
258e6aee 3997 u_char type = ASN_INTEGER;
4367c421
MM
3998 snmp_set_var_value(key, &val, sizeof(val));
3999 snmp_set_var_typed_value(key, type, &val, sizeof(val));
4000 return 0;
4001 ]]
4002 )
4003 ],
4004 [c_cv_have_netsnmp_old_api="no"],
4005 [c_cv_have_netsnmp_old_api="yes"]
4006 )
4007 ]
4008 )
4009
4010 if test "x$c_cv_have_netsnmp_old_api" = "xyes"; then
4011 AC_DEFINE([HAVE_NETSNMP_OLD_API], [1],
4012 ["Define 1 if you have old netsnmp API]")
4013 fi
4014
4015 CPPFLAGS="$SAVE_CPPFLAGS"
4016 LDFLAGS="$SAVE_LDFLAGS"
4017 LIBS="$SAVE_LIBS"
4018fi
4019
bd191644 4020if test "x$with_libnetsnmp" = "xyes"; then
c1ddaf55
RK
4021 BUILD_WITH_LIBNETSNMP_CPPFLAGS="$with_libnetsnmp_cppflags"
4022 BUILD_WITH_LIBNETSNMP_LDFLAGS="$with_libnetsnmp_ldflags"
4023 BUILD_WITH_LIBNETSNMP_LIBS="-lnetsnmp"
975e7fd6 4024fi
bd191644 4025
bd191644
RK
4026AC_SUBST([BUILD_WITH_LIBNETSNMP_CPPFLAGS])
4027AC_SUBST([BUILD_WITH_LIBNETSNMP_LDFLAGS])
4028AC_SUBST([BUILD_WITH_LIBNETSNMP_LIBS])
975e7fd6
FF
4029# }}}
4030
4367c421 4031# --with-libnetsnmpagent {{{
6466fcb4
RK
4032AC_ARG_WITH([libnetsnmpagent],
4033 [AS_HELP_STRING([--with-libnetsnmpagent@<:@=PREFIX@:>@], [Path to libnetsnmpagent.])],
4034 [
c1ddaf55
RK
4035 if test "x$withval" = "xno"; then
4036 with_libnetsnmpagent="no"
4037 else if test "x$withval" = "xyes"; then
4038 with_libnetsnmpagent="yes"
4039 else
4040 with_libnetsnmpagent_cppflags="-I$withval/include"
ce6cc80e 4041 with_libnetsnmpagent_ldflags="-L$withval/lib"
c1ddaf55
RK
4042 with_libnetsnmpagent="yes"
4043 fi; fi
6466fcb4
RK
4044 ],
4045 [with_libnetsnmpagent="yes"]
4046)
4047
4048if test "x$with_libnetsnmpagent" = "xyes"; then
c1ddaf55
RK
4049 SAVE_CPPFLAGS="$CPPFLAGS"
4050 CPPFLAGS="$CPPFLAGS $with_libnetsnmpagent_cppflags"
6466fcb4
RK
4051
4052 AC_CHECK_HEADERS([net-snmp/agent/net-snmp-agent-includes.h],
4053 [],
4054 [with_libnetsnmpagent="no (net-snmp/agent/net-snmp-agent-includes.h not found)"],
4055 [[
4056 #if HAVE_NET_SNMP_NET_SNMP_CONFIG_H
4057 # include <net-snmp/net-snmp-config.h>
4058 #endif
4059 #if HAVE_NET_SNMP_NET_SNMP_INCLUDES_H
4060 # include <net-snmp/net-snmp-includes.h>
4061 #endif
4062 ]]
4063 )
4064
c1ddaf55 4065 CPPFLAGS="$SAVE_CPPFLAGS"
6466fcb4
RK
4066fi
4067
4068if test "x$with_libnetsnmpagent" = "xyes"; then
c1ddaf55
RK
4069 SAVE_LDFLAGS="$LDFLAGS"
4070 LDFLAGS="$LDFLAGS $with_libnetsnmpagent_ldflags"
4071
4072 # older versions of libnetsnmpagent fail to link
4073 # against the helpers library, so do that explicitly
4074 AC_CHECK_LIB([netsnmphelpers], [netsnmp_init_helpers],
4075 [libnetsnmphelpers="-lnetsnmphelpers"],
4076 [libnetsnmphelpers=""]
4077 )
6466fcb4 4078
c1ddaf55 4079 AC_CHECK_LIB([netsnmpagent], [init_agent],
bfb85f18 4080 [
5c425a82 4081 # libnetsnmp can be built without mib loading support
bfb85f18
FF
4082 AC_CHECK_LIB([netsnmp], [get_tree],
4083 [with_libnetsnmpagent="yes"],
4084 [with_libnetsnmpagent="no (libnetsnmp doesn't support mib loading)"]
4085 )
4086 ],
c1ddaf55
RK
4087 [with_libnetsnmpagent="no (libnetsnmpagent not found)"],
4088 [$libnetsnmphelpers]
6466fcb4
RK
4089 )
4090
c1ddaf55 4091 LDFLAGS="$SAVE_LDFLAGS"
6466fcb4
RK
4092fi
4093
4094if test "x$with_libnetsnmpagent" = "xyes"; then
3b05d9f7
DM
4095 BUILD_WITH_LIBNETSNMPAGENT_CPPFLAGS="$with_libnetsnmpagent_cppflags"
4096 BUILD_WITH_LIBNETSNMPAGENT_LDFLAGS="$with_libnetsnmpagent_ldflags"
c1ddaf55 4097 BUILD_WITH_LIBNETSNMPAGENT_LIBS="-lnetsnmpagent $libnetsnmphelpers"
6466fcb4
RK
4098fi
4099
4100AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_CPPFLAGS])
4101AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_LDFLAGS])
4102AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_LIBS])
4103# }}}
4104
8757c918 4105# --with-liboping {{{
865f2eb3
RK
4106AC_ARG_WITH([liboping],
4107 [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
4108 [
4109 if test "x$withval" = "xyes"; then
4110 with_liboping="yes"
4111 else if test "x$withval" = "xno"; then
4112 with_liboping="no"
4113 else
4114 with_liboping="yes"
4115 LIBOPING_CPPFLAGS="-I$withval/include"
4116 LIBOPING_LDFLAGS="-L$withval/lib"
4117 fi; fi
4118 ],
4119 [with_liboping="yes"]
4120)
0f60795b
FF
4121
4122SAVE_CPPFLAGS="$CPPFLAGS"
4123SAVE_LDFLAGS="$LDFLAGS"
0f60795b
FF
4124CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
4125LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
4126
865f2eb3
RK
4127if test "x$with_liboping" = "xyes"; then
4128 AC_CHECK_HEADERS([oping.h],
4129 [with_liboping="yes"],
4130 [with_liboping="no (oping.h not found)"]
4131 )
0f60795b 4132fi
865f2eb3
RK
4133
4134if test "x$with_liboping" = "xyes"; then
4135 AC_CHECK_LIB([oping], [ping_construct],
4136 [with_liboping="yes"],
4137 [with_liboping="no (symbol 'ping_construct' not found)"]
4138 )
0f60795b
FF
4139fi
4140
4141CPPFLAGS="$SAVE_CPPFLAGS"
4142LDFLAGS="$SAVE_LDFLAGS"
6997fb33 4143
865f2eb3
RK
4144if test "x$with_liboping" = "xyes"; then
4145 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
4146 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
6997fb33 4147fi
865f2eb3
RK
4148
4149AC_SUBST([BUILD_WITH_LIBOPING_CPPFLAGS])
4150AC_SUBST([BUILD_WITH_LIBOPING_LDFLAGS])
8757c918 4151# }}}
6997fb33 4152
c87da662 4153# --with-oracle {{{
865f2eb3
RK
4154AC_ARG_WITH([oracle],
4155 [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
4156 [
4157 if test "x$withval" = "xyes"; then
4158 if test "x$ORACLE_HOME" = "x"; then
4159 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
4160 fi
4161 with_oracle="yes"
4162 else if test "x$withval" = "xno"; then
4163 with_oracle="no"
4164 else
4165 with_oracle="yes"
4166 ORACLE_HOME="$withval"
4167 fi; fi
4168 ],
4169 [
4170 if test "x$ORACLE_HOME" = "x"; then
4171 with_oracle="no (ORACLE_HOME is not set)"
4172 else
4173 with_oracle="yes"
4174 fi
4175 ]
4176)
a737ed74 4177
865f2eb3
RK
4178if test "x$ORACLE_HOME" != "x"; then
4179 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
4180 if test -e "$ORACLE_HOME/lib/ldflags"; then
4181 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
4182 fi
4183 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
a737ed74 4184fi
a737ed74 4185
865f2eb3
RK
4186if test "x$with_oracle" = "xyes"; then
4187 SAVE_CPPFLAGS="$CPPFLAGS"
4188 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
a737ed74 4189
865f2eb3
RK
4190 AC_CHECK_HEADERS([oci.h],
4191 [with_oracle="yes"],
4192 [with_oracle="no (oci.h not found)"]
4193 )
4194
4195 CPPFLAGS="$SAVE_CPPFLAGS"
a737ed74 4196fi
a737ed74 4197
865f2eb3
RK
4198if test "x$with_oracle" = "xyes"; then
4199 SAVE_CPPFLAGS="$CPPFLAGS"
4200 SAVE_LIBS="$LIBS"
4201 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
4202 LIBS="$LIBS $with_oracle_libs"
a737ed74 4203
865f2eb3
RK
4204 AC_CHECK_FUNC([OCIEnvCreate],
4205 [with_oracle="yes"],
4206 [with_oracle="no (Symbol 'OCIEnvCreate' not found)"]
4207 )
4208
4209 CPPFLAGS="$SAVE_CPPFLAGS"
4210 LIBS="$SAVE_LIBS"
a737ed74 4211fi
865f2eb3
RK
4212
4213if test "x$with_oracle" = "xyes"; then
4214 BUILD_WITH_ORACLE_CPPFLAGS="$with_oracle_cppflags"
4215 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
a737ed74 4216fi
865f2eb3
RK
4217
4218AC_SUBST([BUILD_WITH_ORACLE_CPPFLAGS])
4219AC_SUBST([BUILD_WITH_ORACLE_LIBS])
c87da662 4220# }}}
a737ed74 4221
8757c918 4222# --with-libowcapi {{{
865f2eb3
RK
4223AC_ARG_WITH([libowcapi],
4224 [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
4225 [
4226 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
4227 with_libowcapi_cppflags="-I$withval/include"
4228 with_libowcapi_ldflags="-L$withval/lib"
4229 with_libowcapi="yes"
4230 else
4231 with_libowcapi="$withval"
4232 fi
4233 ],
4234 [with_libowcapi="yes"]
4235)
630e3bba 4236
865f2eb3
RK
4237if test "x$with_libowcapi" = "xyes"; then
4238 SAVE_CPPFLAGS="$CPPFLAGS"
4239 CPPFLAGS="$CPPFLAGS $with_libowcapi_cppflags"
11ba6e7c 4240
865f2eb3
RK
4241 AC_CHECK_HEADERS([owcapi.h],
4242 [with_libowcapi="yes"],
4243 [with_libowcapi="no (owcapi.h not found)"]
4244 )
4245
4246 CPPFLAGS="$SAVE_CPPFLAGS"
11ba6e7c 4247fi
630e3bba 4248
865f2eb3
RK
4249if test "x$with_libowcapi" = "xyes"; then
4250 SAVE_LDFLAGS="$LDFLAGS"
4251 LDFLAGS="$LDFLAGS $with_libowcapi_ldflags"
11ba6e7c 4252
865f2eb3
RK
4253 AC_CHECK_LIB([owcapi], [OW_get],
4254 [with_libowcapi="yes"],
4255 [with_libowcapi="no (libowcapi not found)"]
4256 )
4257
4258 LDFLAGS="$SAVE_LDFLAGS"
11ba6e7c 4259fi
865f2eb3
RK
4260
4261if test "x$with_libowcapi" = "xyes"; then
4262 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
4263 BUILD_WITH_LIBOWCAPI_LDFLAGS="$with_libowcapi_ldflags"
4264 BUILD_WITH_LIBOWCAPI_LIBS="-lowcapi"
11ba6e7c 4265fi
865f2eb3
RK
4266
4267AC_SUBST([BUILD_WITH_LIBOWCAPI_CPPFLAGS])
4268AC_SUBST([BUILD_WITH_LIBOWCAPI_LDFLAGS])
4269AC_SUBST([BUILD_WITH_LIBOWCAPI_LIBS])
8757c918 4270# }}}
11ba6e7c 4271
8757c918 4272# --with-libpcap {{{
865f2eb3
RK
4273AC_ARG_WITH([libpcap],
4274 [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
4275 [
4276 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
4277 with_libpcap_cppflags="-I$withval/include"
4278 with_libpcap_ldflags="$LDFLAGS -L$withval/lib"
4279 with_libpcap="yes"
4280 else
4281 with_libpcap="$withval"
4282 fi
4283 ],
4284 [with_libpcap="yes"]
4285)
4286
4287if test "x$with_libpcap" = "xyes"; then
4288 SAVE_CPPFLAGS="$CPPFLAGS"
4289 CPPFLAGS="$CPPFLAGS $with_libpcap_cppflags"
4290
4291 AC_CHECK_HEADERS([pcap.h],
4292 [with_libpcap="yes"],
4293 [with_libpcap="no (pcap.h not found)"]
4294 )
4295
4296 CPPFLAGS="$SAVE_CPPFLAGS"
dd7a9bc9 4297fi
865f2eb3
RK
4298
4299if test "x$with_libpcap" = "xyes"; then
4300 SAVE_LDFLAGS="$LDFLAGS"
4301 LDFLAGS="$LDFLAGS $with_libpcap_ldflags"
4302
4303 AC_CHECK_LIB([pcap], [pcap_open_live],
4304 [with_libpcap="yes"],
4305 [with_libpcap="no (libpcap not found)"]
4306 )
4307
4308 LDFLAGS="$SAVE_LDFLAGS"
dd7a9bc9 4309fi
865f2eb3
RK
4310
4311if test "x$with_libpcap" = "xyes"; then
4312 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
4313 [c_cv_libpcap_have_pcap_error_iface_not_up],
4314 [
4315 AC_COMPILE_IFELSE(
4316 [
4317 AC_LANG_PROGRAM(
4318 [[#include <pcap.h>]],
4319 [[
4320 int val = PCAP_ERROR_IFACE_NOT_UP;
b6af4545 4321 return val;
865f2eb3
RK
4322 ]]
4323 )
4324 ],
4325 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
4326 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]
4327 )
4328 ]
4329 )
5fea70db 4330fi
865f2eb3
RK
4331
4332if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"; then
4333 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
4334fi
4335
4336if test "x$with_libpcap" = "xyes"; then
4337 BUILD_WITH_LIBPCAP_CPPFLAGS="$with_libpcap_cppflags"
4338 BUILD_WITH_LIBPCAP_LDFLAGS="$with_libpcap_ldflags"
4339 BUILD_WITH_LIBPCAP_LIBS="-lpcap"
4340fi
4341
4342AC_SUBST([BUILD_WITH_LIBPCAP_CPPFLAGS])
4343AC_SUBST([BUILD_WITH_LIBPCAP_LDFLAGS])
4344AC_SUBST([BUILD_WITH_LIBPCAP_LIBS])
8757c918 4345# }}}
dd7a9bc9 4346
975e7fd6 4347# --with-libperl {{{
865f2eb3
RK
4348AC_ARG_WITH([libperl],
4349 [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
4350 [
4351 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
4352 LDFLAGS="$LDFLAGS -L$withval/lib"
4353 CPPFLAGS="$CPPFLAGS -I$withval/include"
4354 with_libperl="yes"
4355 else
4356 with_libperl="$withval"
4357 fi
4358 ],
4359 [with_libperl="yes"]
4360)
a459afe5 4361
865f2eb3
RK
4362AC_ARG_VAR([PERL], [path to Perl interpreter])
4363AC_PATH_PROG([PERL], [perl])
f1075c22 4364
865f2eb3
RK
4365if test "x$PERL" = "x"; then
4366 with_libperl="no (no Perl interpreter found)"
4367fi
a459afe5 4368
865f2eb3 4369if test "x$with_libperl" = "xyes"; then
4519a3ef 4370 SAVE_CFLAGS="$CFLAGS"
cd15f837 4371 SAVE_LIBS="$LIBS"
865f2eb3
RK
4372 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
4373 PERL_CFLAGS=`ARCHFLAGS="" $PERL -MExtUtils::Embed -e perl_inc`
4374 PERL_LIBS=`ARCHFLAGS="" $PERL -MExtUtils::Embed -e ldopts`
3acac9b0 4375 CFLAGS="$CFLAGS $PERL_CFLAGS"
cd15f837 4376 LIBS="$LIBS $PERL_LIBS"
a432a981
FF
4377
4378 AC_CACHE_CHECK([for libperl],
5f5da97b 4379 [c_cv_have_libperl],
865f2eb3
RK
4380 [
4381 AC_LINK_IFELSE(
4382 [
4383 AC_LANG_PROGRAM(
4384 [[
4385 #define PERL_NO_GET_CONTEXT
4386 #include <EXTERN.h>
4387 #include <perl.h>
4388 #include <XSUB.h>
4389 ]],
4390 [[
4391 dTHX;
4392 load_module (PERL_LOADMOD_NOIMPORT,
4393 newSVpv ("Collectd::Plugin::FooBar", 24),
4394 Nullsv);
4395 ]]
4396 )
4397 ],
4398 [c_cv_have_libperl="yes"],
4399 [c_cv_have_libperl="no"]
4400 )
4401 ]
a432a981
FF
4402 )
4403
4519a3ef 4404 CFLAGS="$SAVE_CFLAGS"
cd15f837 4405 LIBS="$SAVE_LIBS"
28785769 4406
865f2eb3
RK
4407 if test "x$c_cv_have_libperl" = "xno"; then
4408 with_libperl="no"
4409 fi
28785769 4410fi
037645b1 4411
865f2eb3
RK
4412if test "x$with_libperl" = "xyes"; then
4413 SAVE_CFLAGS="$CFLAGS"
4414 SAVE_LIBS="$LIBS"
4415 CFLAGS="$CFLAGS $PERL_CFLAGS"
4416 LIBS="$LIBS $PERL_LIBS"
037645b1 4417
865f2eb3
RK
4418 AC_CACHE_CHECK([if Perl supports ithreads],
4419 [c_cv_have_perl_ithreads],
4420 [
4421 AC_LINK_IFELSE(
4422 [
4423 AC_LANG_PROGRAM(
4424 [[
4425 #include <EXTERN.h>
4426 #include <perl.h>
4427 #include <XSUB.h>
4428
4429 #if !defined(USE_ITHREADS)
4430 # error "Perl does not support ithreads!"
4431 #endif /* !defined(USE_ITHREADS) */
4432 ]],
4433 []
4434 )
4435 ],
4436 [c_cv_have_perl_ithreads="yes"],
4437 [c_cv_have_perl_ithreads="no"]
4438 )
4439 ]
4440 )
388dfe0e 4441
865f2eb3
RK
4442 CFLAGS="$SAVE_CFLAGS"
4443 LIBS="$SAVE_LIBS"
4444fi
4445
4446if test "x$with_libperl" = "xyes"; then
4447 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
4448 # (see issues #41 and #42)
4449 SAVE_CFLAGS="$CFLAGS"
4450 SAVE_LIBS="$LIBS"
9317d073
DM
4451 CFLAGS="$CFLAGS $PERL_CFLAGS"
4452 if test "x$GCC" = "xyes"; then
4453 CFLAGS="$CFLAGS -Wall -Werror"
4454 fi
865f2eb3
RK
4455 LIBS="$LIBS $PERL_LIBS"
4456
4457 AC_CACHE_CHECK([for broken Perl_load_module()],
4458 [c_cv_have_broken_perl_load_module],
4459 [
4460 AC_LINK_IFELSE(
4461 [
4462 AC_LANG_PROGRAM(
4463 [[
4464 #define PERL_NO_GET_CONTEXT
4465 #include <EXTERN.h>
4466 #include <perl.h>
4467 #include <XSUB.h>
4468 ]],
4469 [[
4470 dTHX;
4471 load_module (PERL_LOADMOD_NOIMPORT,
4472 newSVpv ("Collectd::Plugin::FooBar", 24),
4473 Nullsv);
4474 ]]
4475 )
4476 ],
4477 [c_cv_have_broken_perl_load_module="no"],
4478 [c_cv_have_broken_perl_load_module="yes"]
4479 )
4480 ]
4481 )
4482
4483 CFLAGS="$SAVE_CFLAGS"
4484 LIBS="$SAVE_LIBS"
4485fi
4486
4487if test "x$c_cv_have_broken_perl_load_module" = "xyes"; then
4488 PERL_CFLAGS="$PERL_CFLAGS -Wno-nonnull"
4489fi
4490
4491if test "x$with_libperl" = "xyes"; then
4492 SAVE_CFLAGS="$CFLAGS"
4493 SAVE_LIBS="$LIBS"
4494 CFLAGS="$CFLAGS $PERL_CFLAGS"
4495 LIBS="$LIBS $PERL_LIBS"
4496
4497 AC_CHECK_MEMBER(
4498 [struct mgvtbl.svt_local],
4499 [have_struct_mgvtbl_svt_local="yes"],
4500 [have_struct_mgvtbl_svt_local="no"],
4501 [[
4502 #include <EXTERN.h>
4503 #include <perl.h>
4504 #include <XSUB.h>
4505 ]]
4506 )
4507
4508 if test "x$have_struct_mgvtbl_svt_local" = "xyes"; then
4509 AC_DEFINE([HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL], [1], [Define if Perls struct mgvtbl has member svt_local.])
4510 fi
388dfe0e 4511
865f2eb3
RK
4512 CFLAGS="$SAVE_CFLAGS"
4513 LIBS="$SAVE_LIBS"
388dfe0e 4514fi
865f2eb3
RK
4515AC_SUBST([PERL_CFLAGS])
4516AC_SUBST([PERL_LIBS])
4517
8757c918 4518# }}}
28785769 4519
259628f8 4520
79348a91
TH
4521# --with-libpmwapi {{{
4522AC_ARG_WITH([libpmwapi],
4523 [AS_HELP_STRING([--with-libpmwapi@<:@=PREFIX@:>@], [Path to libpmwapi.])],
4524 [
4525 if test "x$withval" = "xyes" || test "x$withval" = "xno"; then
4526 with_libpmwapi="$withval"
4527 else
4528 with_libpmwapi_cppflags="-I$withval/include"
4529 with_libpmwapi_ldflags="-L$withval/lib64"
4530 with_libpmwapi="yes"
4531 fi
4532 ],
4533 [with_libpmwapi="yes"]
4534)
4535
4536if test "x$with_libpmwapi" = "xyes"; then
4537 SAVE_CPPFLAGS="$CPPFLAGS"
4538 CPPFLAGS="$CPPFLAGS $with_libpmwapi_cppflags"
4539
4540 AC_CHECK_HEADERS([pmw_api.h],
4541 [with_libpmwapi="yes"],
4542 [with_libpmwapi="no (pmw_api.h not found)"]
4543 )
4544
4545 CPPFLAGS="$SAVE_CPPFLAGS"
4546fi
4547
4548if test "x$with_libpmwapi" = "xyes"; then
4549 SAVE_LDFLAGS="$LDFLAGS"
4550 LDFLAGS="$LDFLAGS $with_libpmwapi_ldflags"
4551
4552 AC_CHECK_LIB([pmwapi], [PMWAPIGetDIMMCount],
4553 [with_libpmwapis="yes"],
4554 [with_libpmwapi="no (symbol 'PMWAPIGetDIMMCount' not found)"],
4555 [-lpmwcollect]
4556 )
4557
4558 AC_CHECK_LIB([pmwapi], [PMWAPIStart],
4559 [with_libpmwapi="yes"],
4560 [with_libpmwapi="no (symbol 'PMWAPIStart' not found)"],
4561 [-lpmwcollect]
4562 )
4563
4564 AC_CHECK_LIB([pmwapi], [PMWAPIStop],
4565 [with_libpmwapi="yes"],
4566 [with_libpmwapi="no (symbol 'PMWAPIStop' not found)"],
4567 [-lpmwcollect]
4568 )
4569
4570 AC_CHECK_LIB([pmwapi], [PMWAPIRead],
4571 [with_libpmwapi="yes"],
4572 [with_libpmwapi="no (symbol 'PMWAPIRead' not found)"],
4573 [-lpmwcollect]
4574 )
4575
4576 LDFLAGS="$SAVE_LDFLAGS"
4577fi
4578
4579if test "x$with_libpmwapi" = "xyes"; then
4580 BUILD_WITH_LIBPMWAPI_CPPFLAGS="$with_libpmwapi_cppflags"
4581 BUILD_WITH_LIBPMWAPI_LDFLAGS="$with_libpmwapi_ldflags"
4582fi
4583
4584AC_SUBST([BUILD_WITH_LIBPMWAPI_CPPFLAGS])
4585AC_SUBST([BUILD_WITH_LIBPMWAPI_LDFLAGS])
8757c918 4586# }}}
28785769 4587
975e7fd6
FF
4588# --with-libpq {{{
4589with_pg_config="pg_config"
865f2eb3
RK
4590AC_ARG_WITH([libpq],
4591 [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@], [Path to libpq.])],
4592 [
4593 if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
4594 with_libpq="$withval"
4595 else
4596 if test -f "$withval" && test -x "$withval"; then
4597 with_pg_config="$withval"
4598 else if test -x "$withval/bin/pg_config"; then
4599 with_pg_config="$withval/bin/pg_config"
4600 fi; fi
4601 with_libpq="yes"
4602 fi
4603 ],
4604 [with_libpq="yes"]
4605)
c39428ae 4606
865f2eb3
RK
4607if test "x$with_libpq" = "xyes"; then
4608 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
4609 pg_config_status=$?
975e7fd6 4610
865f2eb3
RK
4611 if test $pg_config_status -eq 0; then
4612 if test -n "$with_libpq_includedir"; then
4613 for dir in $with_libpq_includedir; do
4614 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
4615 done
4616 fi
4617 else
4618 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
4619 fi
975e7fd6 4620
865f2eb3
RK
4621 SAVE_CPPFLAGS="$CPPFLAGS"
4622 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
975e7fd6 4623
865f2eb3
RK
4624 AC_CHECK_HEADERS([libpq-fe.h],
4625 [with_libpq="yes"],
4626 [with_libpq="no (libpq-fe.h not found)"]
4627 )
4628
4629 CPPFLAGS="$SAVE_CPPFLAGS"
c02ba630 4630fi
c39428ae 4631
865f2eb3
RK
4632if test "x$with_libpq" = "xyes"; then
4633 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
4634 pg_config_status=$?
975e7fd6 4635
865f2eb3
RK
4636 if test $pg_config_status -eq 0
4637 then
4638 if test -n "$with_libpq_libdir"; then
4639 for dir in $with_libpq_libdir; do
4640 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
4641 done
4642 fi
4643 else
4644 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
4645 fi
975e7fd6 4646
865f2eb3
RK
4647 SAVE_LDFLAGS="$LDFLAGS"
4648 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
975e7fd6 4649
865f2eb3
RK
4650 AC_CHECK_LIB([pq], [PQserverVersion],
4651 [with_libpq="yes"],
4652 [with_libpq="no (symbol 'PQserverVersion' not found)"])
351026b0 4653
865f2eb3 4654 LDFLAGS="$SAVE_LDFLAGS"
c39428ae 4655fi
865f2eb3
RK
4656
4657if test "x$with_libpq" = "xyes"; then
4658 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
4659 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
4660 BUILD_WITH_LIBPQ_LIBS="-lpq"
c02ba630 4661fi
865f2eb3
RK
4662
4663AC_SUBST([BUILD_WITH_LIBPQ_CPPFLAGS])
4664AC_SUBST([BUILD_WITH_LIBPQ_LDFLAGS])
4665AC_SUBST([BUILD_WITH_LIBPQ_LIBS])
8757c918 4666# }}}
c02ba630 4667
b57fb475 4668# --with-libpqos {{{
9f77813b
RK
4669AC_ARG_WITH([libpqos],
4670 [AS_HELP_STRING([--with-libpqos@<:@=PREFIX@:>@], [Path to libpqos.])],
4671 [
4672 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
4673 with_libpqos_cppflags="-I$withval/include"
4674 with_libpqos_ldflags="-L$withval/lib"
4675 with_libpqos="yes"
4676 else
4677 with_libpqos="$withval"
4678 fi
4679 ],
4680 [with_libpqos="yes"]
4681)
b57fb475 4682
9f77813b
RK
4683if test "x$with_libpqos" = "xyes"; then
4684 SAVE_CPPFLAGS="$CPPFLAGS"
4685 CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
4686
4687 AC_CHECK_HEADERS([pqos.h],
4688 [with_libpqos="yes"],
4689 [with_libpqos="no (pqos.h not found)"]
4690 )
b57fb475 4691
9f77813b 4692 CPPFLAGS="$SAVE_CPPFLAGS"
b57fb475 4693fi
b57fb475 4694
9f77813b
RK
4695if test "x$with_libpqos" = "xyes"; then
4696 SAVE_LDFLAGS="$LDFLAGS"
4697 LDFLAGS="$LDFLAGS $with_libpqos_ldflags"
4698
4699 AC_CHECK_LIB([pqos], [pqos_init],
4700 [with_libpqos="yes"],
4701 [with_libpqos="no (Can't find libpqos)"]
4702 )
b57fb475 4703
9f77813b 4704 LDFLAGS="$SAVE_LDFLAGS"
b57fb475 4705fi
9f77813b
RK
4706
4707if test "x$with_libpqos" = "xyes"; then
cdb49f39
PS
4708 SAVE_CPPFLAGS="$CPPFLAGS"
4709 CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
39bc5376 4710 AC_PREPROC_IFELSE(
9f77813b 4711 [
39bc5376 4712 AC_LANG_SOURCE(
9f77813b
RK
4713 [[
4714 #include <pqos.h>
39bc5376
RK
4715 #if PQOS_VERSION < 106
4716 #error "required PQOS version >= 1.06"
4717 #endif
9f77813b
RK
4718 ]]
4719 )
4720 ],
4721 [with_libpqos="yes"],
4722 [with_libpqos="no (pqos library version 1.06 or higher is required)"]
4723 )
4724
cdb49f39
PS
4725 CPPFLAGS="$SAVE_CPPFLAGS"
4726fi
9f77813b
RK
4727
4728if test "x$with_libpqos" = "xyes"; then
4729 BUILD_WITH_LIBPQOS_CPPFLAGS="$with_libpqos_cppflags"
4730 BUILD_WITH_LIBPQOS_LDFLAGS="$with_libpqos_ldflags"
4731 BUILD_WITH_LIBPQOS_LIBS="-lpqos"
b57fb475 4732fi
9f77813b
RK
4733
4734AC_SUBST([BUILD_WITH_LIBPQOS_CPPFLAGS])
4735AC_SUBST([BUILD_WITH_LIBPQOS_LDFLAGS])
4736AC_SUBST([BUILD_WITH_LIBPQOS_LIBS])
b57fb475
PS
4737# }}}
4738
00cbd4d2
RP
4739# --with-libjansson {{{
4740AC_ARG_WITH([libjansson],
4741[AS_HELP_STRING([--with-libjansson@<:@=PREFIX@:>@], [Path to libjansson.])],
4742[
4743 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
4744 with_libjansson_cppflags="-I$withval/include"
4745 with_libjansson_ldflags="-L$withval/lib"
4746 with_libjansson="yes"
4747 else
4748 with_libjansson="$withval"
4749 fi
4750],
4751 [with_libjansson="yes"]
4752)
4753
4754if test "x$with_libjansson" = "xyes"; then
4755 SAVE_CPPFLAGS="$CPPFLAGS"
4756 CPPFLAGS="$CPPFLAGS $with_libjansson_cppflags"
4757
4758 AC_CHECK_HEADERS([jansson.h],
4759 [with_libjansson="yes"],
4760 [with_libjansson="no (jansson.h not found)"]
4761 )
4762 CPPFLAGS="$SAVE_CPPFLAGS"
4763fi
4764if test "x$with_libjansson" = "xyes"; then
4765 SAVE_LDFLAGS="$LDFLAGS"
65b3341e 4766 LDFLAGS="$LDFLAGS $with_libjansson_ldflags"
00cbd4d2 4767
1edebb4f 4768 AC_CHECK_LIB([jansson], [json_loads],
65b3341e 4769 [with_libjansson="yes"],
d7b1a7ac 4770 [with_libjansson="no (symbol 'json_loads' not found)"]
00cbd4d2
RP
4771 )
4772
4773 LDFLAGS="$SAVE_LDFLAGS"
4774fi
4775
4776BUILD_WITH_LIBJANSSON_CPPFLAGS="$with_libjansson_cppflags"
4777BUILD_WITH_LIBJANSSON_LDFLAGS="$with_libjansson_ldflags"
4778BUILD_WITH_LIBJANSSON_LIBS="-ljansson"
4779AC_SUBST(BUILD_WITH_LIBJANSSON_CPPFLAGS)
4780AC_SUBST(BUILD_WITH_LIBJANSSON_LDFLAGS)
4781AC_SUBST(BUILD_WITH_LIBJANSSON_LIBS)
4782# }}}
4783
08e419e4
PS
4784# --with-libjevents {{{
4785with_libjevents_cppflags=""
4786with_libjevents_ldflags=""
7853bfa9
PS
4787AC_ARG_WITH([libjevents],
4788 [AS_HELP_STRING([--with-libjevents@<:@=PREFIX@:>@], [Path to libjevents.])],
4789 [
7ce65d4a 4790 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
7853bfa9
PS
4791 with_libjevents_cppflags="-I$withval/include"
4792 with_libjevents_ldflags="-L$withval/lib"
4793 with_libjevents="yes"
4794 else
4795 with_libjevents="$withval"
4796 fi
4797 ],
4798 [with_libjevents="yes"]
4799)
4800
7ce65d4a 4801if test "x$with_libjevents" = "xyes"; then
08e419e4
PS
4802 SAVE_CPPFLAGS="$CPPFLAGS"
4803 CPPFLAGS="$CPPFLAGS $with_libjevents_cppflags"
4804
7ce65d4a 4805 AC_CHECK_HEADERS([jevents.h], [with_libjevents="yes"], [with_libjevents="no (jevents.h not found)"])
08e419e4
PS
4806
4807 CPPFLAGS="$SAVE_CPPFLAGS"
4808fi
7ce65d4a 4809if test "x$with_libjevents" = "xyes"; then
08e419e4 4810 SAVE_LDFLAGS="$LDFLAGS"
08e419e4
PS
4811 LDFLAGS="$LDFLAGS $with_libjevents_ldflags"
4812
7ce65d4a 4813 AC_CHECK_LIB([jevents], [json_events], [with_libjevents="yes"], [with_libjevents="no (Can't find libjevents)"])
08e419e4 4814
08e419e4 4815 LDFLAGS="$SAVE_LDFLAGS"
08e419e4 4816fi
7feb2043
KW
4817if test "x$with_libjevents" = "xyes"; then
4818 SAVE_LDFLAGS="$LDFLAGS"
4819 LDFLAGS="$LDFLAGS $with_libjevents_ldflags"
4820
4821 AC_CHECK_LIB([jevents], [event_scaled_value_sum], [with_libjevents="yes"], [with_libjevents="no (libjevents is too old)"])
4822
4823 LDFLAGS="$SAVE_LDFLAGS"
4824fi
7ce65d4a 4825if test "x$with_libjevents" = "xyes"; then
08e419e4
PS
4826 BUILD_WITH_LIBJEVENTS_CPPFLAGS="$with_libjevents_cppflags"
4827 BUILD_WITH_LIBJEVENTS_LDFLAGS="$with_libjevents_ldflags"
4828 BUILD_WITH_LIBJEVENTS_LIBS="-ljevents"
08e419e4 4829fi
7ce65d4a
PS
4830AC_SUBST([BUILD_WITH_LIBJEVENTS_CPPFLAGS])
4831AC_SUBST([BUILD_WITH_LIBJEVENTS_LDFLAGS])
4832AC_SUBST([BUILD_WITH_LIBJEVENTS_LIBS])
08e419e4
PS
4833# }}}
4834
aab18e7e
RK
4835# --with-libprotobuf {{{
4836with_libprotobuf_cppflags=""
4837with_libprotobuf_ldflags=""
865f2eb3
RK
4838AC_ARG_WITH([libprotobuf],
4839 [AS_HELP_STRING([--with-libprotobuf@<:@=PREFIX@:>@], [Path to libprotobuf.])],
aab18e7e 4840 [
865f2eb3 4841 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
aab18e7e
RK
4842 with_libprotobuf_cppflags="-I$withval/include"
4843 with_libprotobuf_ldflags="-L$withval/lib"
4844 with_libprotobuf="yes"
4845 fi
865f2eb3 4846 if test "x$withval" = "xno"; then
aab18e7e
RK
4847 with_libprotobuf="no (disabled on command line)"
4848 fi
4849 ],
4850 [withval="yes"]
4851)
865f2eb3
RK
4852
4853if test "x$withval" = "xyes"; then
4854 PKG_CHECK_MODULES([PROTOBUF], [protobuf],
4855 [with_libprotobuf="yes"],
4856 [with_libprotobuf="no (pkg-config could not find libprotobuf)"]
4857 )
aab18e7e
RK
4858fi
4859
865f2eb3 4860if test "x$withval" != "xno"; then
aab18e7e
RK
4861 SAVE_LDFLAGS="$LDFLAGS"
4862 SAVE_LIBS="$LIBS"
4863 LDFLAGS="$with_libprotobuf_ldflags"
4864 LIBS="$PROTOBUF_LIBS $LIBS"
4865 AC_LANG_PUSH([C++])
4866 AC_CHECK_LIB([protobuf], [main],
4867 [
4868 SAVE_CPPFLAGS="$CPPFLAGS"
d3556188 4869 CPPFLAGS="-std=c++14 $with_libprotobuf_cppflags $PROTOBUF_CFLAGS"
aab18e7e
RK
4870 if test "x$PROTOBUF_LIBS" = "x"
4871 then
4872 PROTOBUF_LIBS="-lprotobuf"
4873 fi
4874 AC_CHECK_HEADERS([google/protobuf/util/time_util.h],
4875 [with_libprotobuf="yes"],
4876 [with_libprotobuf="no (<google/protobuf/util/time_util.h> not found)"]
4877 )
4878 CPPFLAGS="$SAVE_CPPFLAGS"
4879 ],
4880 [with_libprotobuf="no (libprotobuf not found)"]
4881 )
4882 AC_LANG_POP([C++])
4883 LDFLAGS="$SAVE_LDFLAGS"
4884 LIBS="$SAVE_LIBS"
4885fi
865f2eb3 4886
aab18e7e
RK
4887BUILD_WITH_LIBPROTOBUF_CPPFLAGS="$with_libprotobuf_cppflags $PROTOBUF_CFLAGS"
4888BUILD_WITH_LIBPROTOBUF_LDFLAGS="$with_libprotobuf_ldflags"
4889BUILD_WITH_LIBPROTOBUF_LIBS="$PROTOBUF_LIBS"
4890AC_SUBST([BUILD_WITH_LIBPROTOBUF_CPPFLAGS])
4891AC_SUBST([BUILD_WITH_LIBPROTOBUF_LDFLAGS])
4892AC_SUBST([BUILD_WITH_LIBPROTOBUF_LIBS])
4893# }}}
4894
865f2eb3
RK
4895AC_ARG_VAR([PROTOC], [path to the protoc binary])
4896AC_PATH_PROG([PROTOC], [protoc])
4897have_protoc3="no"
4898if test "x$PROTOC" != "x"; then
4899 AC_MSG_CHECKING([for protoc 3.0.0+])
4900 if $PROTOC --version | $EGREP libprotoc.3 >/dev/null; then
4901 protoc3="yes (`$PROTOC --version`)"
4902 have_protoc3="yes"
4903 else
4904 protoc3="no (`$PROTOC --version`)"
4905 fi
4906 AC_MSG_RESULT([$protoc3])
4907fi
4908AM_CONDITIONAL([HAVE_PROTOC3], [test "x$have_protoc3" = "xyes"])
4909
aab18e7e 4910# --with-libprotobuf-c {{{
865f2eb3
RK
4911AC_ARG_WITH([libprotobuf-c],
4912 [AS_HELP_STRING([--with-libprotobuf-c@<:@=PREFIX@:>@], [Path to libprotobuf-c.])],
aab18e7e 4913 [
865f2eb3 4914 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
aab18e7e
RK
4915 with_libprotobuf_c_cppflags="-I$withval/include"
4916 with_libprotobuf_c_ldflags="-L$withval/lib"
4917 with_libprotobuf_c="yes"
4918 fi
865f2eb3
RK
4919
4920 if test "x$withval" = "xno"; then
aab18e7e
RK
4921 with_libprotobuf_c="no (disabled on command line)"
4922 fi
4923 ],
4924 [withval="yes"]
4925)
865f2eb3
RK
4926
4927if test "x$withval" = "xyes"; then
4928 PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c],
4929 [with_libprotobuf_c="yes"],
4930 [with_libprotobuf_c="no (pkg-config could not find libprotobuf-c)"]
4931 )
aab18e7e
RK
4932fi
4933
865f2eb3 4934if test "x$withval" != "xno"; then
aab18e7e
RK
4935 SAVE_LDFLAGS="$LDFLAGS"
4936 SAVE_LIBS="$LIBS"
4937 LDFLAGS="$with_libprotobuf_c_ldflags"
4938 LIBS="$PROTOBUF_C_LIBS $LIBS"
4939 AC_CHECK_LIB([protobuf-c], [protobuf_c_message_pack],
4940 [
4941 SAVE_CPPFLAGS="$CPPFLAGS"
4942 CPPFLAGS="$with_libprotobuf_c_cppflags $PROTOBUF_C_CFLAGS"
865f2eb3 4943 if test "x$PROTOBUF_C_LIBS" = "x"; then
aab18e7e
RK
4944 PROTOBUF_C_LIBS="-lprotobuf-c"
4945 fi
865f2eb3 4946
aab18e7e
RK
4947 AC_CHECK_HEADERS([protobuf-c/protobuf-c.h google/protobuf-c/protobuf-c.h],
4948 [
4949 with_libprotobuf_c="yes"
4950 break
4951 ],
4952 [with_libprotobuf_c="no (<protobuf-c.h> not found)"]
4953 )
865f2eb3 4954
aab18e7e
RK
4955 CPPFLAGS="$SAVE_CPPFLAGS"
4956 ],
4957 [with_libprotobuf_c="no (libprotobuf-c not found)"]
4958 )
4959 LDFLAGS="$SAVE_LDFLAGS"
4960 LIBS="$SAVE_LIBS"
4961fi
865f2eb3 4962
aab18e7e
RK
4963BUILD_WITH_LIBPROTOBUF_C_CPPFLAGS="$with_libprotobuf_c_cppflags $PROTOBUF_C_CFLAGS"
4964BUILD_WITH_LIBPROTOBUF_C_LDFLAGS="$with_libprotobuf_c_ldflags"
4965BUILD_WITH_LIBPROTOBUF_C_LIBS="$PROTOBUF_C_LIBS"
4966AC_SUBST([BUILD_WITH_LIBPROTOBUF_C_CPPFLAGS])
4967AC_SUBST([BUILD_WITH_LIBPROTOBUF_C_LDFLAGS])
4968AC_SUBST([BUILD_WITH_LIBPROTOBUF_C_LIBS])
4969# }}}
4970
865f2eb3
RK
4971AC_ARG_VAR([PROTOC_C], [path to the protoc-c binary])
4972AC_PATH_PROG([PROTOC_C], [protoc-c])
4973if test "x$PROTOC_C" = "x"
4974then
4975 have_protoc_c="no (protoc-c compiler not found)"
4976else
4977 have_protoc_c="yes"
4978fi
4979
4ad72002
RK
4980# --with-libpython {{{
4981AC_ARG_VAR([LIBPYTHON_CPPFLAGS], [Preprocessor flags for libpython])
4982AC_ARG_VAR([LIBPYTHON_LDFLAGS], [Linker flags for libpython])
2ec3cd50 4983AC_ARG_VAR([LIBPYTHON_LIBS], [Libraries for libpython])
b8c32e9f 4984
4ad72002 4985AC_ARG_WITH([libpython],
865f2eb3 4986 [AS_HELP_STRING([--with-libpython], [if we should build with libpython @<:@default=yes@:>@])],
4ad72002
RK
4987 [with_libpython="$withval"],
4988 [with_libpython="check"]
4989)
865f2eb3 4990
4ad72002
RK
4991if test "$with_libpython" != "no"; then
4992 if test "$LIBPYTHON_CPPFLAGS" = "" && test "$LIBPYTHON_LDFLAGS" = ""; then
4993 AC_ARG_VAR([PYTHON_CONFIG], [path to python-config])
4994 AC_PATH_PROGS([PYTHON_CONFIG],
4995 [python3-config python2-config python-config]
4996 )
4997 if test "$PYTHON_CONFIG" = ""; then
4998 if test "$with_libpython" = "yes"; then
4999 AC_MSG_ERROR([Unable to find python-config])
5000 fi
5001 with_libpython="no"
5002 fi
5003 fi
b8c32e9f
FF
5004fi
5005
4ad72002
RK
5006if test "$PYTHON_CONFIG" != ""; then
5007 LIBPYTHON_CPPFLAGS="`${PYTHON_CONFIG} --includes`"
5008 if test $? -ne 0; then
5009 with_libpython="no"
5010 fi
071af20d 5011 LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags --embed`" || LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`"
4ad72002
RK
5012 if test $? -ne 0; then
5013 with_libpython="no"
5014 fi
1d96b209 5015 LIBPYTHON_LIBS="`${PYTHON_CONFIG} --libs --embed`" || LIBPYTHON_LIBS="`${PYTHON_CONFIG} --libs`"
2ec3cd50
RK
5016 if test $? -ne 0; then
5017 with_libpython="no"
5018 fi
68362bd8
FF
5019fi
5020
4ad72002
RK
5021if test "$with_libpython" != "xno"; then
5022 SAVE_CPPFLAGS="$CPPFLAGS"
5023 SAVE_LDFLAGS="$LDFLAGS"
2ec3cd50 5024 SAVE_LIBS="$LIBS"
4ad72002
RK
5025 CPPFLAGS="$LIBPYTHON_CPPFLAGS $CPPFLAGS"
5026 LDFLAGS="$LIBPYTHON_LDFLAGS $LDFLAGS"
2ec3cd50 5027 LIBS="$LIBPYTHON_LIBS $LIBS"
865f2eb3 5028
4ad72002
RK
5029 AC_CHECK_HEADERS([Python.h],
5030 [
5031 AC_MSG_CHECKING([for libpython])
5032 AC_LINK_IFELSE([AC_LANG_PROGRAM(
5033 [[#include <Python.h>]],
5034 [[Py_Initialize();]])
5035 ],
5036 [with_libpython="yes"],
5037 [with_libpython="no"]
5038 )
5039 AC_MSG_RESULT([$with_libpython])
5040 ],
5041 [with_libpython="no"]
5042 )
865f2eb3 5043
4ad72002
RK
5044 CPPFLAGS="$SAVE_CPPFLAGS"
5045 LDFLAGS="$SAVE_LDFLAGS"
2ec3cd50 5046 LIBS="$SAVE_LIBS"
b8c32e9f 5047fi
4ad72002 5048# }}} --with-libpython
b8c32e9f 5049
7feccc9a
AS
5050# --with-libqpid_proton {{{
5051AC_ARG_WITH([libqpid_proton],
5052 [AS_HELP_STRING([--with-libqpid_proton@<:@=PREFIX@:>@], [Path to libqpid_proton.])],
5053 [
5054 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
5055 with_libqpid_proton_cppflags="-I$withval/include"
5056 with_libqpid_proton_ldflags="-L$withval/lib"
5057 with_libqpid_proton="yes"
5058 else
5059 with_libqpid_proton="$withval"
5060 fi
5061 ],
5062 [with_libqpid_proton="yes"]
5063)
5064
5065if test "x$with_libqpid_proton" = "xyes"; then
5066 SAVE_CPPFLAGS="$CPPFLAGS"
5067 CPPFLAGS="$CPPFLAGS $with_libqpid_proton_cppflags"
5068
5069 AC_CHECK_HEADERS([proton/proactor.h],
5070 [with_libqpid_proton="yes"],
5071 [with_libqpid_proton="no (proton/proactor.h not found)"]
5072 )
5073
5074 CPPFLAGS="$SAVE_CPPFLAGS"
5075fi
5076
d4cc32c4
AS
5077if test "x$with_libqpid_proton" = "xyes"; then
5078 SAVE_LDFLAGS="$LDFLAGS"
5079 LDFLAGS="$LDFLAGS $with_libqpid_proton_ldflags"
5080
5081 AC_CHECK_LIB([qpid-proton], [pn_connection],
5082 [with_libqpid_proton="yes"],
5083 [with_libqpid_proton="no (Symbol 'pn_connection' not found)"])
5084
5085 LDFLAGS="$SAVE_LDFLAGS"
5086fi
7feccc9a
AS
5087
5088if test "x$with_libqpid_proton" = "xyes"; then
5089 BUILD_WITH_LIBQPIDPROTON_CPPFLAGS="$with_libqpid_proton_cppflags"
5090 BUILD_WITH_LIBQPIDPROTON_LDFLAGS="$with_libqpid_proton_ldflags"
5091 BUILD_WITH_LIBQPIDPROTON_LIBS="-lqpid-proton"
5092fi
5093
5094AC_SUBST(BUILD_WITH_LIBQPIDPROTON_CPPFLAGS)
5095AC_SUBST(BUILD_WITH_LIBQPIDPROTON_LDFLAGS)
5096AC_SUBST(BUILD_WITH_LIBQPIDPROTON_LIBS)
5097
5098# }}}
5099
3e77c9e8 5100# --with-librabbitmq {{{
865f2eb3
RK
5101AC_ARG_WITH([librabbitmq],
5102 [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
5103 [
5104 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
5105 with_librabbitmq_cppflags="-I$withval/include"
5106 with_librabbitmq_ldflags="-L$withval/lib"
5107 with_librabbitmq="yes"
5108 else
5109 with_librabbitmq="$withval"
5110 fi
5111 ],
5112 [with_librabbitmq="yes"]
5113)
1a477ecb 5114
865f2eb3
RK
5115if test "x$with_librabbitmq" = "xyes"; then
5116 SAVE_CPPFLAGS="$CPPFLAGS"
5117 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
1a477ecb 5118
cd07fc46
FF
5119 with_librabbitmq="no (amqp.h and rabbitmq-c/amqp.h not found)"
5120 AC_CHECK_HEADERS([rabbitmq-c/amqp.h], [with_librabbitmq="yes"], [])
5121 AC_CHECK_HEADERS([amqp.h], [with_librabbitmq="yes"], [])
5122
5123 AC_CHECK_HEADERS([rabbitmq-c/framing.h rabbitmq-c/ssl_socket.h rabbitmq-c/tcp_socket.h \
5124 amqp_framing.h amqp_ssl_socket.h amqp_tcp_socket.h])
1a477ecb 5125
865f2eb3 5126 CPPFLAGS="$SAVE_CPPFLAGS"
1a477ecb 5127fi
3e77c9e8 5128
865f2eb3
RK
5129if test "x$with_librabbitmq" = "xyes"; then
5130 # librabbitmq up to version 0.9.1 provides "library_errno", later
5131 # versions use "library_error". The library does not provide a version
5132 # macro :(.
630e3bba 5133
865f2eb3
RK
5134 SAVE_CPPFLAGS="$CPPFLAGS"
5135 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
f8cecf10 5136
865f2eb3
RK
5137 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],
5138 [],
5139 [],
5140 [[
5141 #include <stdlib.h>
5142 #include <stdio.h>
5143 #include <stdint.h>
5144 #include <inttypes.h>
cd07fc46
FF
5145 #if HAVE_RABBITMQ_C_AMQP_H
5146 # include <rabbitmq-c/amqp.h>
5147 #else
5148 # include <amqp.h>
5149 #endif
865f2eb3
RK
5150 ]]
5151 )
5152 CPPFLAGS="$SAVE_CPPFLAGS"
630e3bba 5153
865f2eb3
RK
5154 SAVE_LDFLAGS="$LDFLAGS"
5155 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
630e3bba 5156
865f2eb3
RK
5157 AC_CHECK_LIB([rabbitmq], [amqp_basic_publish],
5158 [with_librabbitmq="yes"],
5159 [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"]
5160 )
630e3bba 5161
865f2eb3
RK
5162 LDFLAGS="$SAVE_LDFLAGS"
5163fi
f51548ec 5164
865f2eb3
RK
5165if test "x$with_librabbitmq" = "xyes"; then
5166 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
5167 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
5168 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
f51548ec
FF
5169fi
5170
865f2eb3
RK
5171AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
5172AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
5173AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
f51548ec 5174
f51548ec
FF
5175# }}}
5176
865f2eb3
RK
5177# --with-librdkafka {{{
5178AC_ARG_WITH([librdkafka],
5179 [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Path to librdkafka.])],
ef43260c 5180 [
865f2eb3
RK
5181 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
5182 with_librdkafka_cppflags="-I$withval/include"
5183 with_librdkafka_ldflags="-L$withval/lib"
5184 with_librdkafka_rpath="$withval/lib"
5185 with_librdkafka="yes"
ef43260c 5186 else
865f2eb3 5187 with_librdkafka="$withval"
ef43260c
RK
5188 fi
5189 ],
865f2eb3 5190 [with_librdkafka="yes"]
ef43260c
RK
5191)
5192
865f2eb3 5193if test "x$with_librdkafka" = "xyes"; then
ef43260c 5194 SAVE_CPPFLAGS="$CPPFLAGS"
865f2eb3 5195 CPPFLAGS="$CPPFLAGS $with_librdkafka_cppflags"
bcb24183 5196
865f2eb3
RK
5197 AC_CHECK_HEADERS([librdkafka/rdkafka.h],
5198 [with_librdkafka="yes"],
5199 [with_librdkafka="no (librdkafka/rdkafka.h not found)"]
5200 )
ef43260c
RK
5201
5202 CPPFLAGS="$SAVE_CPPFLAGS"
bc2d9402 5203fi
ef43260c 5204
865f2eb3
RK
5205if test "x$with_librdkafka" = "xyes"; then
5206 SAVE_LDFLAGS="$LDFLAGS"
5207 LDFLAGS="$LDFLAGS $with_librdkafka_ldflags"
5208
5209 AC_CHECK_LIB([rdkafka], [rd_kafka_new],
5210 [with_librdkafka="yes"],
5211 [with_librdkafka="no (Symbol 'rd_kafka_new' not found)"])
5212
5213 AC_CHECK_LIB([rdkafka], [rd_kafka_conf_set_log_cb],
5214 [with_librdkafka_log_cb="yes"],
5215 [with_librdkafka_log_cb="no"])
5216
5217 AC_CHECK_LIB([rdkafka], [rd_kafka_set_logger],
5218 [with_librdkafka_logger="yes"],
5219 [with_librdkafka_logger="no"]
5220 )
5221
5222 LDFLAGS="$SAVE_LDFLAGS"
5223fi
5224
5225if test "x$with_librdkafka" = "xyes"; then
5226 BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags"
5227 BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags"
5228
5229 if test "x$with_librdkafka_rpath" != "x"; then
5230 BUILD_WITH_LIBRDKAFKA_LIBS="-Wl,-rpath,$with_librdkafka_rpath -lrdkafka"
5231 else
5232 BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka"
5233 fi
5234
5235 if test "x$with_librdkafka_log_cb" = "xyes"; then
5236 AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
5237 else if test "x$with_librdkafka_logger" = "xyes"; then
5238 AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
5239 fi; fi
5240fi
5241
5242AC_SUBST([BUILD_WITH_LIBRDKAFKA_CPPFLAGS])
5243AC_SUBST([BUILD_WITH_LIBRDKAFKA_LDFLAGS])
5244AC_SUBST([BUILD_WITH_LIBRDKAFKA_LIBS])
5245# }}}
5246
5247# --with-librouteros {{{
5248AC_ARG_WITH([librouteros],
5249 [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
5250 [
5251 if test "x$withval" = "xyes" || test "x$withval" = "xno"; then
5252 with_librouteros="$witval"
5253 else
5254 with_librouteros_cppflags="-I$withval/include"
5255 with_librouteros_ldflags="-L$withval/lib"
5256 with_librouteros="yes"
5257 fi
5258 ],
5259 [with_librouteros="yes"]
5260)
5261
5262if test "x$with_librouteros" = "xyes"; then
5263 SAVE_CPPFLAGS="$CPPFLAGS"
5264 CPPFLAGS="$CPPFLAGS $with_librouteros_cppflags"
5265
5266 AC_CHECK_HEADERS([routeros_api.h],
5267 [with_librouteros="yes"],
5268 [with_librouteros="no (routeros_api.h not found)"]
5269 )
5270
5271 CPPFLAGS="$SAVE_CPPFLAGS"
5272fi
5273
5274if test "x$with_librouteros" = "xyes"; then
5275 SAVE_LDFLAGS="$LDFLAGS"
5276 LDFLAGS="$LDFLAGS $with_librouteros_ldflags"
5277
5278 AC_CHECK_LIB([routeros], [ros_interface],
5279 [with_librouteros="yes"],
5280 [with_librouteros="no (symbol 'ros_interface' not found)"]
5281 )
5282
5283 LDFLAGS="$SAVE_LDFLAGS"
5284fi
5285
5286if test "x$with_librouteros" = "xyes"; then
5287 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$with_librouteros_cppflags"
5288 BUILD_WITH_LIBROUTEROS_LDFLAGS="$with_librouteros_ldflags"
5289fi
5290
5291AC_SUBST([BUILD_WITH_LIBROUTEROS_CPPFLAGS])
5292AC_SUBST([BUILD_WITH_LIBROUTEROS_LDFLAGS])
5293# }}}
5294
5295# --with-librrd {{{
5296librrd_threadsafe="no"
5297librrd_rrdc_update="no"
5298AC_ARG_WITH([librrd],
5299 [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
5300 [
5301 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
5302 librrd_cflags="-I$withval/include"
5303 librrd_ldflags="-L$withval/lib"
5304 with_librrd="yes"
5305 else
5306 with_librrd="$withval"
5307 fi
5308 ],
5309 [with_librrd="yes"]
5310)
5311
5312if test "x$with_librrd" = "xyes"; then
5313 SAVE_LDFLAGS="$LDFLAGS"
5314 LDFLAGS="$LDFLAGS $librrd_ldflags"
5315 PKG_CHECK_MODULES([RRD], [librrd >= 1.6.0],
5316 [
5317 AC_CHECK_LIB([rrd], [rrd_update_r],
5318 [librrd_threadsafe="yes"],
5319 [:]
5320 )
5321 AC_CHECK_LIB([rrd], [rrdc_update],
5322 [librrd_rrdc_update="yes"],
5323 [:]
5324 )
5325 ],[:]
5326 )
5327 LDFLAGS="$SAVE_LDFLAGS"
5328
5329 SAVE_CPPFLAGS="$CPPFLAGS"
5330 CPPFLAGS="$CPPFLAGS $RRD_CFLAGS $librrd_cflags"
5331
5332 AC_CHECK_HEADERS([rrd.h],, [with_librrd="no (rrd.h not found)"])
5333
5334 CPPFLAGS="$SAVE_CPPFLAGS"
5335fi
5336
5337if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"; then
ef43260c
RK
5338 SAVE_LDFLAGS="$LDFLAGS"
5339 LDFLAGS="$LDFLAGS $librrd_ldflags"
975e7fd6 5340
ef43260c
RK
5341 AC_CHECK_LIB([rrd_th], [rrd_update_r],
5342 [
5343 librrd_ldflags="$librrd_ldflags -lrrd_th"
5344 librrd_threadsafe="yes"
5345 AC_CHECK_LIB([rrd_th], [rrdc_update],
5346 [librrd_rrdc_update="yes"],
5347 [:],
5348 )
5349 ],
5350 [:]
5351 )
5352 LDFLAGS="$SAVE_LDFLAGS"
5353fi
975e7fd6 5354
865f2eb3 5355if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"; then
ef43260c
RK
5356 SAVE_LDFLAGS="$LDFLAGS"
5357 LDFLAGS="$LDFLAGS $librrd_ldflags"
06c09fee 5358
ef43260c
RK
5359 AC_CHECK_LIB([rrd], [rrd_update],
5360 [
5361 librrd_ldflags="$librrd_ldflags -lrrd"
5362 AC_CHECK_LIB([rrd], [rrdc_update],
5363 [librrd_rrdc_update="yes"],
5364 [:]
5365 )
5366 ],
5367 [with_librrd="no (symbol 'rrd_update' not found)"]
5368 )
5369 LDFLAGS="$SAVE_LDFLAGS"
8f6c03d5 5370fi
ef43260c 5371
865f2eb3 5372if test "x$with_librrd" = "xyes"; then
ef43260c
RK
5373 BUILD_WITH_LIBRRD_CFLAGS="$RRD_CFLAGS $librrd_cflags"
5374 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
5375 BUILD_WITH_LIBRRD_LIBS="$RRD_LIBS"
975e7fd6 5376fi
865f2eb3
RK
5377
5378if test "x$librrd_threadsafe" = "xyes"; then
ef43260c
RK
5379 AC_DEFINE([HAVE_THREADSAFE_LIBRRD], [1],
5380 [Define to 1 if the rrd library is thread-safe]
5381 )
bcb24183 5382fi
865f2eb3
RK
5383
5384AC_SUBST([BUILD_WITH_LIBRRD_CFLAGS])
5385AC_SUBST([BUILD_WITH_LIBRRD_LDFLAGS])
5386AC_SUBST([BUILD_WITH_LIBRRD_LIBS])
8757c918 5387# }}}
bc2d9402 5388
975e7fd6 5389# --with-libsensors {{{
865f2eb3
RK
5390AC_ARG_WITH([libsensors],
5391 [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
5392 [
5393 if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
5394 with_libsensors="$withval"
5395 else
5396 with_sensors_cppflags="-I$withval/include"
5397 with_sensors_ldflags="-L$withval/lib"
5398 with_libsensors="yes"
5399 fi
5400 ],
5401 [
5402 if test "x$ac_system" = "xLinux"; then
5403 with_libsensors="yes"
5404 else
5405 with_libsensors="no (Linux only library)"
5406 fi
5407 ]
5408)
558a6a1c 5409
865f2eb3
RK
5410if test "x$with_libsensors" = "xyes"; then
5411 SAVE_CPPFLAGS="$CPPFLAGS"
5412 CPPFLAGS="$CPPFLAGS $with_sensors_cppflags"
975e7fd6 5413
865f2eb3
RK
5414 AC_CHECK_HEADERS([sensors/sensors.h],
5415 [with_libsensors="yes"],
5416 [with_libsensors="no (sensors/sensors.h not found)"]
5417 )
5418
5419 CPPFLAGS="$SAVE_CPPFLAGS"
558a6a1c 5420fi
975e7fd6 5421
865f2eb3
RK
5422if test "x$with_libsensors" = "xyes"; then
5423 SAVE_LDFLAGS="$LDFLAGS"
5424 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
975e7fd6 5425
865f2eb3
RK
5426 AC_CHECK_LIB([sensors], [sensors_init],
5427 [with_libsensors="yes"],
5428 [with_libsensors="no (libsensors not found)"]
5429 )
5430
5431 LDFLAGS="$SAVE_LDFLAGS"
558a6a1c 5432fi
865f2eb3 5433
d558fa93
PR
5434if test "x$with_libsensors" = "xyes"; then
5435 SAVE_CPPFLAGS="$CPPFLAGS"
5436 CPPFLAGS="$CPPFLAGS $with_sensors_cppflags"
5437 AC_PREPROC_IFELSE(
5438 [
5439 AC_LANG_SOURCE(
5440 [[
5441 #include <sensors/sensors.h>
5442 #if SENSORS_API_VERSION < 0x400
5443 #error "required libsensors version >= 3.0"
5444 #endif
5445 ]]
5446 )
5447 ],
5448 [with_libsensors="yes"],
5449 [with_libsensors="no (sensors library version 3.0.0 or higher is required)"]
5450 )
5451
5452 CPPFLAGS="$SAVE_CPPFLAGS"
5453fi
5454
865f2eb3
RK
5455if test "x$with_libsensors" = "xyes"; then
5456 BUILD_WITH_LIBSENSORS_CPPFLAGS="$with_sensors_cppflags"
5457 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
5458 BUILD_WITH_LIBSENSORS_LIBS="-lsensors"
558a6a1c 5459fi
865f2eb3
RK
5460
5461AC_SUBST([BUILD_WITH_LIBSENSORS_CPPFLAGS])
5462AC_SUBST([BUILD_WITH_LIBSENSORS_LDFLAGS])
5463AC_SUBST([BUILD_WITH_LIBSENSORS_LIBS])
5464
8757c918 5465# }}}
558a6a1c 5466
ca65a73c
RK
5467# libsigrok {{{
5468AC_SUBST([LIBSIGROK_CFLAGS])
5469AC_SUBST([LIBSIGROK_LIBS])
5470PKG_CHECK_MODULES([LIBSIGROK], [libsigrok < 0.4],
5471 [with_libsigrok="yes"],
5472 [with_libsigrok="no (pkg-config could not find libsigrok)"]
5bdc5d3e 5473)
5415a1c9
BV
5474# }}}
5475
aa61b905
FF
5476# --with-libssl {{{
5477with_libssl_cflags=""
5478with_libssl_ldflags=""
8f527ca5 5479AC_ARG_WITH([libssl], [AS_HELP_STRING([--with-libssl@<:@=PREFIX@:>@], [Path to libssl.])],
aa61b905 5480[
8f527ca5 5481 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
aa61b905
FF
5482 with_libssl_cppflags="-I$withval/include"
5483 with_libssl_ldflags="-L$withval/lib"
5484 with_libssl="yes"
5485 else
5486 with_libssl="$withval"
5487 fi
5488],
5489[
5490 with_libssl="yes"
5491])
8f527ca5 5492if test "x$with_libssl" = "xyes"; then
aa61b905
FF
5493 SAVE_CPPFLAGS="$CPPFLAGS"
5494 CPPFLAGS="$CPPFLAGS $with_libssl_cppflags"
5495
8f527ca5 5496 AC_CHECK_HEADERS([openssl/sha.h openssl/blowfish.h openssl/rand.h],
aa61b905
FF
5497 [with_libssl="yes"],
5498 [with_libssl="no (ssl header not found)"])
5499
5500 CPPFLAGS="$SAVE_CPPFLAGS"
5501fi
8f527ca5 5502if test "x$with_libssl" = "xyes"; then
aa61b905
FF
5503 SAVE_CPPFLAGS="$CPPFLAGS"
5504 SAVE_LDFLAGS="$LDFLAGS"
5505 CPPFLAGS="$CPPFLAGS $with_libssl_cppflags"
5506 LDFLAGS="$LDFLAGS $with_libssl_ldflags"
5507
8f527ca5 5508 AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [with_libssl="yes"], [with_libssl="no (Symbol 'SSL_library_init' not found)"])
aa61b905
FF
5509
5510 CPPFLAGS="$SAVE_CPPFLAGS"
5511 LDFLAGS="$SAVE_LDFLAGS"
5512fi
8f527ca5 5513if test "x$with_libssl" = "xyes"; then
aa61b905
FF
5514 BUILD_WITH_LIBSSL_CFLAGS="$with_libssl_cflags"
5515 BUILD_WITH_LIBSSL_LDFLAGS="$with_libssl_ldflags"
5516 BUILD_WITH_LIBSSL_LIBS="-lssl -lcrypto"
8f527ca5
FF
5517 AC_SUBST([BUILD_WITH_LIBSSL_CFLAGS])
5518 AC_SUBST([BUILD_WITH_LIBSSL_LDFLAGS])
5519 AC_SUBST([BUILD_WITH_LIBSSL_LIBS])
5520 AC_DEFINE([HAVE_LIBSSL], [1], [Define if libssl is present and usable.])
aa61b905
FF
5521fi
5522AM_CONDITIONAL(BUILD_WITH_LIBSSL, test "x$with_libssl" = "xyes")
5523# }}}
5524
975e7fd6 5525# --with-libstatgrab {{{
865f2eb3
RK
5526AC_ARG_WITH([libstatgrab],
5527 [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
5528 [
5529 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
5530 with_libstatgrab_cflags="-I$withval/include"
5531 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
5532 with_libstatgrab="yes"
5533 with_libstatgrab_pkg_config="no"
5534 else
5535 with_libstatgrab="$withval"
5536 with_libstatgrab_pkg_config="yes"
5537 fi
5538 ],
5539 [
5540 with_libstatgrab="yes"
5541 with_libstatgrab_pkg_config="yes"
5542 ])
ad44a981 5543
865f2eb3 5544if test "x$with_libstatgrab" = "xyes" && test "x$with_libstatgrab_pkg_config" = "xyes"; then
b102fa8e
RK
5545 AC_MSG_CHECKING([pkg-config for libstatgrab])
5546 temp_result="found"
5547 $PKG_CONFIG --exists libstatgrab 2>/dev/null
865f2eb3 5548 if test "$?" != "0"; then
975e7fd6 5549 with_libstatgrab_pkg_config="no"
b102fa8e
RK
5550 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
5551 temp_result="not found"
975e7fd6 5552 fi
b102fa8e 5553 AC_MSG_RESULT([$temp_result])
975e7fd6 5554fi
5d26a660 5555
865f2eb3 5556if test "x$with_libstatgrab" = "xyes" && test "x$with_libstatgrab_pkg_config" = "xyes" && test "x$with_libstatgrab_cflags" = "x"; then
975e7fd6
FF
5557 AC_MSG_CHECKING([for libstatgrab CFLAGS])
5558 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
865f2eb3 5559 if test "$?" = "0"; then
975e7fd6
FF
5560 with_libstatgrab_cflags="$temp_result"
5561 else
5562 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
5563 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
5564 fi
5565 AC_MSG_RESULT([$temp_result])
5566fi
5d26a660 5567
865f2eb3 5568if test "x$with_libstatgrab" = "xyes" && test "x$with_libstatgrab_pkg_config" = "xyes" && test "x$with_libstatgrab_ldflags" = "x"; then
975e7fd6
FF
5569 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
5570 temp_result="`$PKG_CONFIG --libs libstatgrab`"
5571 if test "$?" = "0"
5572 then
5573 with_libstatgrab_ldflags="$temp_result"
5574 else
5575 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
5576 temp_result="$PKG_CONFIG --libs libstatgrab failed"
5577 fi
5578 AC_MSG_RESULT([$temp_result])
5579fi
5d26a660 5580
865f2eb3 5581if test "x$with_libstatgrab" = "xyes"; then
975e7fd6
FF
5582 SAVE_CPPFLAGS="$CPPFLAGS"
5583 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
5d26a660 5584
865f2eb3
RK
5585 AC_CHECK_HEADERS([statgrab.h],
5586 [with_libstatgrab="yes"],
5587 [with_libstatgrab="no (statgrab.h not found)"]
5588 )
c1406acc 5589
975e7fd6 5590 CPPFLAGS="$SAVE_CPPFLAGS"
c1406acc 5591fi
975e7fd6 5592
865f2eb3 5593if test "x$with_libstatgrab" = "xyes"; then
975e7fd6 5594 SAVE_LDFLAGS="$LDFLAGS"
975e7fd6
FF
5595 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
5596
865f2eb3
RK
5597 AC_CHECK_LIB([statgrab], [sg_init],
5598 [with_libstatgrab="yes"],
5599 [with_libstatgrab="no (symbol sg_init not found)"]
5600 )
975e7fd6 5601
975e7fd6 5602 LDFLAGS="$SAVE_LDFLAGS"
c1406acc 5603fi
975e7fd6 5604
865f2eb3 5605if test "x$with_libstatgrab" = "xyes"; then
2bd9ed64 5606 SAVE_CFLAGS="$CFLAGS"
9948a35f 5607 SAVE_LDFLAGS="$LDFLAGS"
35d95175 5608 SAVE_LIBS="$LIBS"
2bd9ed64
VB
5609
5610 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
5611 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
35d95175 5612 LIBS="-lstatgrab $LIBS"
2bd9ed64 5613
36841c62 5614 AC_CACHE_CHECK([if libstatgrab >= 0.90],
865f2eb3
RK
5615 [c_cv_have_libstatgrab_0_90],
5616 [
5617 AC_LINK_IFELSE(
5618 [
5619 AC_LANG_PROGRAM(
5620 [[
5621 #include <stdio.h>
5622 #include <statgrab.h>
5623 ]],
5624 [[
5625 if (sg_init()) return 0;
5626 ]]
c963d35f 5627 )
865f2eb3
RK
5628 ],
5629 [c_cv_have_libstatgrab_0_90="no"],
5630 [c_cv_have_libstatgrab_0_90="yes"]
5631 )
5632 ]
c963d35f
VB
5633 )
5634
2bd9ed64
VB
5635 CFLAGS="$SAVE_CFLAGS"
5636 LDFLAGS="$SAVE_LDFLAGS"
35d95175 5637 LIBS="$SAVE_LIBS"
2bd9ed64
VB
5638fi
5639
865f2eb3
RK
5640AM_CONDITIONAL([BUILD_WITH_LIBSTATGRAB], [test "x$with_libstatgrab" = "xyes"])
5641
5642if test "x$with_libstatgrab" = "xyes"; then
5643 AC_DEFINE([HAVE_LIBSTATGRAB], [1],
5644 [Define to 1 if you have the 'statgrab' library (-lstatgrab)]
5645 )
5646
5647 if test "x$c_cv_have_libstatgrab_0_90" = "xyes"; then
5648 AC_DEFINE([HAVE_LIBSTATGRAB_0_90], [1],
5649 [Define to 1 if libstatgrab version >= 0.90]
5650 )
5651 fi
5652
975e7fd6
FF
5653 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
5654 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
865f2eb3 5655
c1406acc 5656fi
865f2eb3
RK
5657
5658AC_SUBST([BUILD_WITH_LIBSTATGRAB_CFLAGS])
5659AC_SUBST([BUILD_WITH_LIBSTATGRAB_LDFLAGS])
8757c918 5660# }}}
5d99fadf 5661
5395a6d4 5662# --with-libtokyotyrant {{{
865f2eb3
RK
5663AC_ARG_WITH([libtokyotyrant],
5664 [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
5665 [
5666 if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
5667 with_libtokyotyrant="$withval"
5668 else
5669 with_libtokyotyrant_cppflags="-I$withval/include"
2e14acaa 5670 with_libtokyotyrant_ldflags="-L$withval/lib"
865f2eb3
RK
5671 with_libtokyotyrant_libs="-ltokyotyrant"
5672 with_libtokyotyrant="yes"
5673 fi
5674 ],
5675 [with_libtokyotyrant="yes"]
5676)
5395a6d4 5677
865f2eb3
RK
5678if test "x$with_libtokyotyrant" = "xyes"; then
5679 if $PKG_CONFIG --exists tokyotyrant; then
5395a6d4 5680 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
c2ca2a46
LT
5681 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
5682 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
5395a6d4
FF
5683 fi
5684fi
5685
865f2eb3
RK
5686if test "x$with_libtokyotyrant" = "xyes"; then
5687 SAVE_CPPFLAGS="$CPPFLAGS"
5688 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
5395a6d4 5689
865f2eb3
RK
5690 AC_CHECK_HEADERS([tcrdb.h],
5691 [with_libtokyotyrant="yes"],
5692 [with_libtokyotyrant="no (tcrdb.h not found)"]
5693 )
5395a6d4 5694
865f2eb3 5695 CPPFLAGS="$SAVE_CPPFLAGS"
5395a6d4
FF
5696fi
5697
865f2eb3
RK
5698if test "x$with_libtokyotyrant" = "xyes"; then
5699 SAVE_LDFLAGS="$LDFLAGS"
5700 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
5395a6d4 5701
865f2eb3
RK
5702 AC_CHECK_LIB([tokyotyrant], [tcrdbrnum],
5703 [with_libtokyotyrant="yes"],
5704 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
5705 [$with_libtokyotyrant_libs]
5706 )
5707
5708 LDFLAGS="$SAVE_LDFLAGS"
5709fi
5710
5711if test "x$with_libtokyotyrant" = "xyes"; then
5395a6d4
FF
5712 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
5713 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
5714 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
5395a6d4 5715fi
865f2eb3
RK
5716AC_SUBST([BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS])
5717AC_SUBST([BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS])
5718AC_SUBST([BUILD_WITH_LIBTOKYOTYRANT_LIBS])
5395a6d4
FF
5719# }}}
5720
c8e86419 5721# --with-libudev {{{
865f2eb3
RK
5722AC_ARG_WITH([libudev],
5723 [AS_HELP_STRING([--with-libudev@<:@=PREFIX@:>@], [Path to libudev.])],
5724 [
5725 if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
5726 with_libudev="$withval"
5727 else
5728 with_libudev_cppflags="-I$withval/include"
5729 with_libudev_ldflags="-L$withval/lib"
5730 with_libudev="yes"
5731 fi
5732 ],
5733 [
5734 if test "x$ac_system" = "xLinux"; then
5735 with_libudev="yes"
5736 else
5737 with_libudev="no (Linux only library)"
5738 fi
5739 ]
5740)
5741
5742if test "x$with_libudev" = "xyes"; then
5743 SAVE_CPPFLAGS="$CPPFLAGS"
5744 CPPFLAGS="$CPPFLAGS $with_libudev_cppflags"
c8e86419 5745
865f2eb3
RK
5746 AC_CHECK_HEADERS([libudev.h],
5747 [with_libudev="yes"],
5748 [with_libudev="no (libudev.h not found)"]
5749 )
c8e86419 5750
865f2eb3 5751 CPPFLAGS="$SAVE_CPPFLAGS"
c8e86419 5752fi
c8e86419 5753
865f2eb3
RK
5754if test "x$with_libudev" = "xyes"; then
5755 SAVE_LDFLAGS="$LDFLAGS"
5756 LDFLAGS="$LDFLAGS $with_libudev_ldflags"
5757
5758 AC_CHECK_LIB([udev], [udev_new],
5759 [with_libudev="yes"],
5760 [with_libudev="no (libudev not found)"]
5761 )
c8e86419 5762
865f2eb3 5763 LDFLAGS="$SAVE_LDFLAGS"
c8e86419 5764fi
865f2eb3
RK
5765
5766if test "x$with_libudev" = "xyes"; then
5767 BUILD_WITH_LIBUDEV_CPPFLAGS="$with_libudev_cppflags"
5768 BUILD_WITH_LIBUDEV_LDFLAGS="$with_libudev_ldflags"
5769 BUILD_WITH_LIBUDEV_LIBS="-ludev"
5770fi
5771
5772AC_SUBST([BUILD_WITH_LIBUDEV_CPPFLAGS])
5773AC_SUBST([BUILD_WITH_LIBUDEV_LDFLAGS])
5774AC_SUBST([BUILD_WITH_LIBUDEV_LIBS])
5775
5776AM_CONDITIONAL([BUILD_WITH_LIBUDEV], [test "x$with_libudev" = "xyes"])
c8e86419
PM
5777# }}}
5778
6597f3a6
FF
5779# --with-libupsclient {{{
5780with_libupsclient_config=""
865f2eb3
RK
5781AC_ARG_WITH([libupsclient],
5782 [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
5783 [
5784 if test "x$withval" = "xno"; then
5785 with_libupsclient="no"
5786 else if test "x$withval" = "xyes"; then
5787 with_libupsclient="use_pkgconfig"
5788 else
6616302f 5789 if test -f "$withval" && test -x "$withval"; then
865f2eb3
RK
5790 with_libupsclient_config="$withval"
5791 with_libupsclient="use_libupsclient_config"
5792 else if test -x "$withval/bin/libupsclient-config"; then
5793 with_libupsclient_config="$withval/bin/libupsclient-config"
5794 with_libupsclient="use_libupsclient_config"
5795 else
5796 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
5797 with_libupsclient_cflags="-I$withval/include"
5798 with_libupsclient_libs="-L$withval/lib -lupsclient"
5799 with_libupsclient="yes"
5800 fi; fi
5801 fi; fi
5802 ],
5803 [with_libupsclient="use_pkgconfig"]
5804)
a0b4b6b4 5805
6597f3a6 5806# configure using libupsclient-config
865f2eb3
RK
5807if test "x$with_libupsclient" = "xuse_libupsclient_config"; then
5808 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
5809 if test $? -ne 0; then
5810 with_libupsclient="no ($with_libupsclient_config failed)"
5811 fi
5812 with_libupsclient_libs="`$with_libupsclient_config --libs`"
5813 if test $? -ne 0; then
5814 with_libupsclient="no ($with_libupsclient_config failed)"
5815 fi
a0b4b6b4 5816fi
865f2eb3
RK
5817
5818if test "x$with_libupsclient" = "xuse_libupsclient_config"; then
5819 with_libupsclient="yes"
c044208a 5820fi
249d5776 5821
6597f3a6 5822# configure using pkg-config
865f2eb3 5823if test "x$with_libupsclient" = "xuse_pkgconfig"; then
865f2eb3
RK
5824 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
5825 if test $? -ne 0; then
5826 with_libupsclient="no (pkg-config doesn't know libupsclient)"
5827 fi
c044208a 5828fi
865f2eb3
RK
5829
5830if test "x$with_libupsclient" = "xuse_pkgconfig"; then
5831 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
5832 if test $? -ne 0; then
5833 with_libupsclient="no ($PKG_CONFIG failed)"
5834 fi
5835
5836 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
5837 if test $? -ne 0; then
5838 with_libupsclient="no ($PKG_CONFIG failed)"
5839 fi
c044208a 5840fi
865f2eb3
RK
5841
5842if test "x$with_libupsclient" = "xuse_pkgconfig"; then
5843 with_libupsclient="yes"
6597f3a6
FF
5844fi
5845
865f2eb3
RK
5846if test "x$with_libupsclient" = "xyes"; then
5847 SAVE_CPPFLAGS="$CPPFLAGS"
5848 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
c044208a 5849
865f2eb3
RK
5850 AC_CHECK_HEADERS([upsclient.h],
5851 [with_libupsclient="yes"],
5852 [with_libupsclient="no (upsclient.h not found)"]
5853 )
975e7fd6 5854
865f2eb3 5855 CPPFLAGS="$SAVE_CPPFLAGS"
975e7fd6 5856fi
c044208a 5857
865f2eb3
RK
5858if test "x$with_libupsclient" = "xyes"; then
5859 SAVE_LDFLAGS="$LDFLAGS"
5860 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
975e7fd6 5861
865f2eb3
RK
5862 AC_CHECK_LIB([upsclient], [upscli_connect],
5863 [with_libupsclient="yes"],
5864 [with_libupsclient="no (symbol upscli_connect not found)"]
5865 )
c044208a 5866
1c1b3f9e 5867 AC_CHECK_LIB([upsclient], [upscli_init],
e791fa91 5868 [AC_DEFINE([HAVE_UPSCLI_INIT], [1], [Define when upscli_init() (since version 2-7) is available.])]
1c1b3f9e
SB
5869 )
5870
cb90ca86
PR
5871 AC_CHECK_LIB([upsclient], [upscli_tryconnect],
5872 [AC_DEFINE([HAVE_UPSCLI_TRYCONNECT], [1], [Define when upscli_tryconnect() (since version 2.6.2) is available.])]
5873 )
5874
865f2eb3 5875 LDFLAGS="$SAVE_LDFLAGS"
c044208a
FF
5876fi
5877
865f2eb3
RK
5878if test "x$with_libupsclient" = "xyes"; then
5879 SAVE_CPPFLAGS="$CPPFLAGS"
5880 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
ab5d14f9 5881 someUPSCONN_FOUND=false
975e7fd6 5882
865f2eb3 5883 AC_CHECK_TYPES([UPSCONN_t, UPSCONN],
ab5d14f9 5884 [someUPSCONN_FOUND=true],
865f2eb3
RK
5885 [],
5886 [[
5887 #include <stdlib.h>
5888 #include <stdio.h>
4a469251 5889 #include <time.h>
865f2eb3
RK
5890 #include <upsclient.h>
5891 ]]
5892 )
5893
ab5d14f9
JK
5894 AS_IF([test x"$someUPSCONN_FOUND" = xfalse],
5895 [AC_MSG_WARN([Can not find either UPSCONN or UPSCONN_t type definition for upsclient library])
5896 with_libupsclient="no (required data types for NUT API were not detected)"]
5897 )
5898
5899 unset someUPSCONN_FOUND
865f2eb3 5900 CPPFLAGS="$SAVE_CPPFLAGS"
975e7fd6 5901fi
865f2eb3 5902
d409ffa2
JK
5903if test "x$with_libupsclient" = "xyes"; then
5904 dnl The m4 script logic below is modelled after NUT_FUNC_GETNAMEINFO_ARGTYPES
5905 dnl further originating in curl autoconf scripts or beyond. See there for an
5906 dnl example of general-case logic to handle matching of numerous possible
5907 dnl data types for each argument in supported API variants.
5908 dnl Note: techically compiler complains here not about int types themselves,
5909 dnl but about pointers to such data. We know "out of band" that e.g. NUT
5910 dnl change to "size_t" happened at once for all arguments in the API, so
5911 dnl simplify the handling here and now with that assumption.
5912 AC_LANG_PUSH([C])
5913 SAVE_CPPFLAGS="$CPPFLAGS"
5914 SAVE_LDFLAGS="$LDFLAGS"
5915 SAVE_CFLAGS="$CFLAGS"
5916 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
5917 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
5918 CFLAGS="$CFLAGS $with_libupsclient_cflags"
5919 if test "x$GCC" = "xyes"; then
5920 CFLAGS="$CFLAGS -Wall -Werror"
5921 fi
5922
5923 dnl upscli_splitname() *is* there forever (2007 or older)
5924 dnl but int types e.g. "port" changed in NUT 2.8.0
5925 dnl Also this is the UPSCONN_t::port field type:
5926 AC_CACHE_CHECK([int type of port argument for NUT upscli_splitname],
5927 [collectd_cv_func_upscli_splitname_args], [
5928 collectd_cv_func_upscli_splitname_args="unknown"
5929 for port_arg in 'uint16_t' 'int' ; do
5930 AC_COMPILE_IFELSE([
5931 AC_LANG_PROGRAM([
4a469251 5932#include <time.h>
d409ffa2
JK
5933#include <upsclient.h>
5934/* int upscli_splitname(const char *buf, char **upsname, char **hostname, <port_arg> *port); */
5935 ],[
5936const char *origname = "ups@localhost:3493";
5937$port_arg port=0;
5938char *hostname;
5939char *upsname;
5940int res = upscli_splitname(origname, &upsname, &hostname, &port);
5941return(res);
5942 ])
5943 ],[
5944 collectd_cv_func_upscli_splitname_args="$port_arg"
5945 break
5946 ])
5947 done
5948 ])
5949
5950 AS_IF([test x"$collectd_cv_func_upscli_splitname_args" = xunknown],
5951 [AC_MSG_WARN([Can not find proper port type for upscli_splitname()])
5952 with_libupsclient="no (required data types for NUT API were not detected)"],
5953 [AC_DEFINE_UNQUOTED(NUT_PORT_TYPE, $collectd_cv_func_upscli_splitname_args,
5954 [Define to the integer type for TCP/IP ports used by NUT API we build against])
5955 ])
5956
5957
5958 AC_CACHE_CHECK([int type of length/numbering arguments for NUT upscli_list_next],
5959 [collectd_cv_func_upscli_list_next_args], [
5960 collectd_cv_func_upscli_list_next_args="unknown"
5961 for size_arg in 'size_t' 'unsigned int' 'int' ; do
5962 AC_COMPILE_IFELSE([
5963 AC_LANG_PROGRAM([
4a469251 5964#include <time.h>
d409ffa2
JK
5965#include <upsclient.h>
5966/* int upscli_list_next(UPSCONN_t *ups, <size_arg> numq, const char **query, <size_arg> *numa, char ***answer); */
5967
5968#if HAVE_UPSCONN_T
5969typedef UPSCONN_t collectd_upsconn_t;
5970#elif HAVE_UPSCONN
5971typedef UPSCONN collectd_upsconn_t;
5972#else
5973#error "Unable to determine the UPS connection type."
5974#endif
5975 ],[
5976$size_arg query_num=0;
5977$size_arg answer_num=0;
5978const char * query;
5979char** answer;
5980collectd_upsconn_t ups;
5981int res = upscli_list_next(&ups, query_num, &query, &answer_num, &answer);
5982return(res);
5983 ])
5984 ],[
5985 collectd_cv_func_upscli_list_next_args="$size_arg"
5986 break
5987 ])
5988 done
5989 ])
5990
5991 AS_IF([test x"$collectd_cv_func_upscli_list_next_args" = xunknown],
5992 [AC_MSG_WARN([Can not find proper type for array sizes and string lengths used by upscli_list_next()])
5993 with_libupsclient="no (required data types for NUT API were not detected)"],
5994 [AC_DEFINE_UNQUOTED(NUT_SIZE_TYPE, $collectd_cv_func_upscli_list_next_args,
5995 [Define to the integer type for array sizes and string lengths used by NUT API we build against])
5996 ])
5997
5998
5999 CPPFLAGS="$SAVE_CPPFLAGS"
6000 LDFLAGS="$SAVE_LDFLAGS"
6001 CFLAGS="$SAVE_CFLAGS"
6002 AC_LANG_POP([C])
6003fi
6004
865f2eb3
RK
6005if test "x$with_libupsclient" = "xyes"; then
6006 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
6007 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
c044208a 6008fi
865f2eb3
RK
6009
6010AC_SUBST([BUILD_WITH_LIBUPSCLIENT_CFLAGS])
6011AC_SUBST([BUILD_WITH_LIBUPSCLIENT_LIBS])
c044208a
FF
6012# }}}
6013
7a1a3100 6014# --with-libxenctrl {{{
865f2eb3
RK
6015AC_ARG_WITH([libxenctrl],
6016 [AS_HELP_STRING([--with-libxenctrl@<:@=PREFIX@:>@], [Path to libxenctrl.])],
6017 [
6018 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
6019 with_libxenctrl_cppflags="-I$withval/include"
6020 with_libxenctrl_ldflags="-L$withval/lib"
6021 with_libxenctrl="yes"
6022 else
6023 with_libxenctrl="$withval"
6024 fi
6025 ],
6026 [with_libxenctrl="yes"]
6027)
7a1a3100 6028
865f2eb3
RK
6029if test "x$with_libxenctrl" = "xyes"; then
6030 SAVE_CPPFLAGS="$CPPFLAGS"
6031 CPPFLAGS="$CPPFLAGS $with_libxenctrl_cppflags"
7a1a3100 6032
865f2eb3
RK
6033 AC_CHECK_HEADERS([xenctrl.h],
6034 [with_libxenctrl="yes"],
6035 [with_libxenctrl="no (xenctrl.h not found)"]
6036 )
6037
6038 CPPFLAGS="$SAVE_CPPFLAGS"
7a1a3100 6039fi
7a1a3100 6040
865f2eb3
RK
6041if test "x$with_libxenctrl" = "xyes"; then
6042 SAVE_LDFLAGS="$LDFLAGS"
6043 LDFLAGS="$LDFLAGS $with_libxenctrl_ldflags"
7a1a3100 6044
865f2eb3
RK
6045 #Xen versions older than 3.4 has no xc_getcpuinfo()
6046 AC_CHECK_LIB([xenctrl], [xc_getcpuinfo],
6047 [with_libxenctrl="yes"],
6048 [with_libxenctrl="no (symbol 'xc_getcpuinfo' not found)"]
6049 )
6050
6051 LDFLAGS="$SAVE_LDFLAGS"
7a1a3100 6052fi
865f2eb3
RK
6053
6054LIBXENCTL_CPPFLAGS="$with_libxenctl_cppflags"
6055LIBXENCTL_LDFLAGS="$with_libxenctl_ldflags"
6056AC_SUBST([LIBXENCTL_CPPFLAGS])
6057AC_SUBST([LIBXENCTL_LDFLAGS])
6019ea13 6058# }}}
7a1a3100 6059
6597f3a6
FF
6060# --with-libxmms {{{
6061with_xmms_config="xmms-config"
865f2eb3
RK
6062AC_ARG_WITH([libxmms],
6063 [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
6064 [
6065 if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
6066 with_libxmms="$withval"
6067 else
6068 if test -f "$withval" && test -x "$withval"; then
6069 with_xmms_config="$withval"
6070 else if test -x "$withval/bin/xmms-config"; then
6071 with_xmms_config="$withval/bin/xmms-config"
6072 fi; fi
6073 with_libxmms="yes"
6074 fi
6075 ],
6076 [with_libxmms="yes"]
6077)
a0b4b6b4 6078
865f2eb3
RK
6079if test "x$with_libxmms" = "xyes"; then
6080 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
6081 if test $? -ne 0; then
6082 with_libxmms="no"
6083 fi
a0b4b6b4 6084fi
a0b4b6b4 6085
865f2eb3
RK
6086if test "x$with_libxmms" = "xyes"; then
6087 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
6088 if test $? -ne 0; then
6089 with_libxmms="no"
6090 fi
a0b4b6b4 6091fi
865f2eb3
RK
6092
6093if test "x$with_libxmms" = "xyes"; then
e4c98147 6094 SAVE_CPPFLAGS="$CPPFLAGS"
8c311d6c 6095 CPPFLAGS="$with_xmms_cflags"
865f2eb3
RK
6096
6097 AC_CHECK_HEADER([xmmsctrl.h],
6098 [with_libxmms="yes"],
6099 [with_libxmms="no"],
6100 )
6101
8c311d6c 6102 CPPFLAGS="$SAVE_CPPFLAGS"
6597f3a6 6103fi
865f2eb3
RK
6104
6105if test "x$with_libxmms" = "xyes"; then
6106 SAVE_LIBS="$LIBS"
6107 LIBS="$with_xmms_libs"
6108
6109 AC_CHECK_LIB([xmms], [xmms_remote_get_info],
6110 [with_libxmss="yes"],
6111 [with_libxmms="no"],
6112 [$with_xmms_libs]
6113
6114 )
6115
6116 LIBS="$SAVE_LIBS"
6117fi
6118
6119BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
6120BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
6121
6122AC_SUBST([BUILD_WITH_LIBXMMS_CFLAGS])
6123AC_SUBST([BUILD_WITH_LIBXMMS_LIBS])
6597f3a6 6124# }}}
a0b4b6b4 6125
bc51ef21 6126# --with-libyajl {{{
865f2eb3
RK
6127AC_ARG_WITH([libyajl],
6128 [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
6129 [
6130 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
6131 with_libyajl_cppflags="-I$withval/include"
6132 with_libyajl_ldflags="-L$withval/lib"
6133 with_libyajl="yes"
6134 else
6135 with_libyajl="$withval"
6136 fi
6137 ],
6138 [with_libyajl="yes"]
6139)
bc51ef21 6140
865f2eb3
RK
6141if test "x$with_libyajl" = "xyes"; then
6142 SAVE_CPPFLAGS="$CPPFLAGS"
6143 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
bc51ef21 6144
865f2eb3
RK
6145 AC_CHECK_HEADERS([yajl/yajl_parse.h],
6146 [with_libyajl="yes"],
6147 [with_libyajl="no (yajl/yajl_parse.h not found)"]
6148 )
6149
39035180
MV
6150 AC_CHECK_HEADERS([yajl/yajl_tree.h],
6151 [with_libyajl2="yes"],
6152 [with_libyajl2="no (yajl/yajl_tree.h not found)"]
6153 )
6154
865f2eb3
RK
6155 AC_CHECK_HEADERS([yajl/yajl_version.h])
6156
6157 CPPFLAGS="$SAVE_CPPFLAGS"
bc51ef21 6158fi
bc51ef21 6159
865f2eb3
RK
6160if test "x$with_libyajl" = "xyes"; then
6161 SAVE_LDFLAGS="$LDFLAGS"
6162 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
bc51ef21 6163
865f2eb3
RK
6164 AC_CHECK_LIB([yajl], [yajl_alloc],
6165 [with_libyajl="yes"],
6166 [with_libyajl="no (Symbol 'yajl_alloc' not found)"]
6167 )
6168
39035180
MV
6169 AC_CHECK_LIB([yajl], [yajl_tree_parse],
6170 [with_libyajl2="yes"],
6171 [with_libyajl2="no (Symbol 'yajl_tree_parse' not found)"]
6172 )
6173
865f2eb3 6174 LDFLAGS="$SAVE_LDFLAGS"
bc51ef21 6175fi
865f2eb3
RK
6176
6177if test "x$with_libyajl" = "xyes"; then
6178 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
6179 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
6180 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
6181 AC_DEFINE([HAVE_LIBYAJL], [1], [Define if libyajl is present and usable.])
6182fi
6183
6184AC_SUBST([BUILD_WITH_LIBYAJL_CPPFLAGS])
6185AC_SUBST([BUILD_WITH_LIBYAJL_LDFLAGS])
6186AC_SUBST([BUILD_WITH_LIBYAJL_LIBS])
6187
6188AM_CONDITIONAL([BUILD_WITH_LIBYAJL], [test "x$with_libyajl" = "xyes"])
9d82e21a 6189AM_CONDITIONAL([BUILD_WITH_LIBYAJL2], [test "x$with_libyajl$with_libyajl2" = "xyesyes"])
bc51ef21
DM
6190# }}}
6191
573c602b 6192# --with-mic {{{
865f2eb3
RK
6193with_mic_cppflags="-I/opt/intel/mic/sysmgmt/sdk/include"
6194with_mic_ldflags="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
6195with_mic_libs="-lMicAccessSDK -scif"
6196AC_ARG_WITH([mic],
6197 [AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
6198 [
6199 if test "x$withval" = "xno" || test "x$withval" = "xyes"; then
6200 with_mic="$withval"
6201 else if test -d "$with_mic/lib"; then
6202 with_mic_cppflags="-I$withval/include"
6203 with_mic_ldflags="-L$withval/lib/Linux"
6204 with_mic="yes"
6205 fi; fi
6206 ],
6207 [with_mic="yes"]
6208)
6209
6210if test "x$with_mic" = "xyes"; then
6211 SAVE_CPPFLAGS="$CPPFLAGS"
6212 CPPFLAGS="$CPPFLAGS $with_mic_cppflags"
6213
6214 AC_CHECK_HEADERS([MicAccessApi.h],
6215 [with_mic="yes"],
6216 [with_mic="no (MicAccessApi not found)"]
6217 )
6218
6219 CPPFLAGS="$SAVE_CPPFLAGS"
573c602b 6220fi
573c602b 6221
865f2eb3
RK
6222if test "x$with_mic" = "xyes"; then
6223 SAVE_LDFLAGS="$LDFLAGS"
6224 LDFLAGS="$LDFLAGS $with_mic_ldflags"
573c602b 6225
865f2eb3
RK
6226 AC_CHECK_LIB([MicAccessSDK], [MicInitAPI],
6227 [with_mic="yes"],
6228 [with_mic="no (symbol MicInitAPI not found)"],
6229 [$PTHREAD_LIBS -lscif]
6230 )
573c602b 6231
865f2eb3 6232 LDFLAGS="$SAVE_LDFLAGS"
573c602b
EF
6233fi
6234
865f2eb3
RK
6235if test "x$with_mic" = "xyes"; then
6236 BUILD_WITH_MIC_CPPFLAGS="$with_mic_cppflags"
6237 BUILD_WITH_MIC_LDFLAGS="$with_mic_ldflags"
6238 BUILD_WITH_MIC_LIBS="$with_mic_libs"
573c602b 6239fi
865f2eb3
RK
6240AC_SUBST([BUILD_WITH_MIC_CPPFLAGS])
6241AC_SUBST([BUILD_WITH_MIC_LDFLAGS])
6242AC_SUBST([BUILD_WITH_MIC_LIBS])
573c602b
EF
6243#}}}
6244
e9a9482a 6245# --with-libvarnish {{{
865f2eb3
RK
6246AC_ARG_WITH([libvarnish],
6247 [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
6248 [
6249 if test "x$withval" = "xno"; then
6250 with_libvarnish="no"
6251 else if test "x$withval" = "xyes"; then
6252 with_libvarnish="use_pkgconfig"
6253 else if test -d "$with_libvarnish/lib"; then
6254 with_libvarnish_cflags="-I$withval/include"
6255 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
6256 with_libvarnish="yes"
6257 fi; fi; fi
6258 ],
6259 [with_libvarnish="use_pkgconfig"]
6260)
24da3d76
FF
6261
6262# configure using pkg-config
865f2eb3
RK
6263if test "x$with_libvarnish" = "xuse_pkgconfig"; then
6264 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
6265 if test $? -ne 0; then
6266 with_libvarnish="no (pkg-config doesn't know varnishapi)"
6267 fi
24da3d76 6268fi
865f2eb3
RK
6269
6270if test "x$with_libvarnish" = "xuse_pkgconfig"; then
6271 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
6272 if test $? -ne 0; then
6273 with_libvarnish="no ($PKG_CONFIG failed)"
6274 fi
6275
6276 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
6277 if test $? -ne 0; then
6278 with_libvarnish="no ($PKG_CONFIG failed)"
6279 fi
24da3d76 6280fi
865f2eb3
RK
6281if test "x$with_libvarnish" = "xuse_pkgconfig"; then
6282 with_libvarnish="yes"
24da3d76
FF
6283fi
6284
865f2eb3
RK
6285if test "x$with_libvarnish" = "xyes"; then
6286 SAVE_CPPFLAGS="$CPPFLAGS"
6287 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
e9a9482a 6288
e9bdd411 6289 $PKG_CONFIG --atleast-version=6 'varnishapi' 2>/dev/null
3c42182e 6290 if test $? -eq 0; then
e9bdd411 6291 AC_DEFINE([HAVE_VARNISH_V6], [1], [Varnish 6 API support])
3c42182e 6292 else
e9bdd411
CK
6293 $PKG_CONFIG --atleast-version=5.2 'varnishapi' 2>/dev/null
6294 if test $? -eq 0; then
6295 AC_DEFINE([HAVE_VARNISH_V5], [1], [Varnish 5 API support])
6296 else
6297 AC_CHECK_HEADERS([vapi/vsc.h],
6298 [AC_DEFINE([HAVE_VARNISH_V4], [1], [Varnish 4 API support])],
6299 [
6300 AC_CHECK_HEADERS([vsc.h],
6301 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support]) ],
6302 [
6303 AC_CHECK_HEADERS([varnishapi.h],
6304 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])],
6305 [with_libvarnish="no (found none of the varnish header files)"]
6306 )
6307 ]
6308 )
6309 ]
6310 )
6311 fi
3c42182e 6312 fi
e9a9482a 6313
865f2eb3 6314 CPPFLAGS="$SAVE_CPPFLAGS"
e9a9482a 6315fi
865f2eb3
RK
6316
6317if test "x$with_libvarnish" = "xyes"; then
6318 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
6319 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
e9a9482a 6320fi
865f2eb3
RK
6321
6322AC_SUBST([BUILD_WITH_LIBVARNISH_CFLAGS])
6323AC_SUBST([BUILD_WITH_LIBVARNISH_LIBS])
e9a9482a
JR
6324# }}}
6325
89f0b0ce
DA
6326# --with-libxml2 {{{
6327AC_ARG_WITH(libxml2,
6328 [AS_HELP_STRING([--with-libxml2@<:@=PREFIX@:>@], [Path to libxml2.])],
6329 [
6330 if test "x$withval" = "xno"; then
6331 with_libxml2="no"
6332 else if test "x$withval" = "xyes"; then
6333 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
6334 if test $? -eq 0; then
6335 with_libxml2="yes"
6336 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
6337 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
6338 else
6339 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
6340 fi
6341 else
6342 with_libxml2="yes"
6343 with_libxml2_cflags="-I$withval/include"
6344 with_libxml2_ldflags="-L$withval/lib"
6345 fi; fi
6346 ],
6347 dnl if no argument --with-libxml2 was passed, find the library locations
6348 dnl with pkg-config just like above, when --with-libxml2=yes.
6349 [
6350 with_libxml2="yes"
6351 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
6352 if test $? -eq 0; then
6353 with_libxml2="yes"
6354 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
6355 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
6356 else
6357 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
6358 fi
6359 ]
6360)
c6be63a7 6361
865f2eb3
RK
6362if test "x$with_libxml2" = "xyes"; then
6363 SAVE_CPPFLAGS="$CPPFLAGS"
6364 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
c6be63a7 6365
865f2eb3
RK
6366 AC_CHECK_HEADERS([libxml/parser.h],
6367 [with_libxml2="yes"],
6368 [with_libxml2="no (libxml/parser.h not found)"]
6369 )
6370
6371 CPPFLAGS="$SAVE_CPPFLAGS"
c6be63a7 6372fi
c6be63a7 6373
865f2eb3
RK
6374if test "x$with_libxml2" = "xyes"; then
6375 SAVE_LDFLAGS="$LDFLAGS"
6376 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
c6be63a7 6377
865f2eb3
RK
6378 AC_CHECK_LIB([xml2], [xmlXPathEval],
6379 [with_libxml2="yes"],
6380 [with_libxml2="no (symbol xmlXPathEval not found)"]
6381 )
c6be63a7 6382
865f2eb3 6383 LDFLAGS="$SAVE_LDFLAGS"
c6be63a7 6384fi
865f2eb3 6385
c6be63a7 6386if test "x$with_libxml2" = "xyes"; then
865f2eb3
RK
6387 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
6388 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
c6be63a7 6389fi
865f2eb3
RK
6390
6391AC_SUBST([BUILD_WITH_LIBXML2_CFLAGS])
6392AC_SUBST([BUILD_WITH_LIBXML2_LIBS])
553925e1
PR
6393# }}}
6394
6395# pkg-config --exists libvirt {{{
6396$PKG_CONFIG --exists libvirt 2>/dev/null
6397if test $? = 0; then
6398 with_libvirt="yes"
6399else
6400 with_libvirt="no (pkg-config doesn't know libvirt)"
6401fi
865f2eb3
RK
6402
6403if test "x$with_libvirt" = "xyes"; then
6404 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
6405 if test $? -ne 0; then
6d017360 6406 with_libvirt="no (pkg-config --cflags failed)"
865f2eb3
RK
6407 fi
6408
6409 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
6410 if test $? -ne 0; then
6d017360 6411 with_libvirt="no (pkg-config --cflags failed)"
865f2eb3 6412 fi
df26df90 6413fi
c6be63a7 6414
865f2eb3
RK
6415if test "x$with_libvirt" = "xyes"; then
6416 SAVE_CPPFLAGS="$CPPFLAGS"
6417 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
c6be63a7 6418
865f2eb3
RK
6419 AC_CHECK_HEADERS([libvirt/libvirt.h],
6420 [with_libvirt="yes"],
6421 [with_libvirt="no (libvirt/libvirt.h not found)"]
6422 )
6423
6424 CPPFLAGS="$SAVE_CPPFLAGS"
c6be63a7 6425fi
df26df90 6426
865f2eb3
RK
6427if test "x$with_libvirt" = "xyes"; then
6428 SAVE_LDFLAGS="$LDFLAGS"
6429 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
df26df90 6430
865f2eb3
RK
6431 AC_CHECK_LIB([virt], [virDomainBlockStats],
6432 [with_libvirt="yes"],
6433 [with_libvirt="no (symbol virDomainBlockStats not found)"]
6434 )
df26df90 6435
865f2eb3 6436 LDFLAGS="$SAVE_LDFLAGS"
f69ce75e 6437fi
865f2eb3 6438
f69ce75e 6439if test "x$with_libvirt" = "xyes"; then
865f2eb3
RK
6440 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
6441 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
f69ce75e 6442fi
865f2eb3
RK
6443
6444AC_SUBST([BUILD_WITH_LIBVIRT_CFLAGS])
6445AC_SUBST([BUILD_WITH_LIBVIRT_LIBS])
8757c918 6446# }}}
f69ce75e 6447
975e7fd6
FF
6448# $PKG_CONFIG --exists OpenIPMIpthread {{{
6449with_libopenipmipthread="yes"
865f2eb3
RK
6450AC_MSG_CHECKING([for libOpenIPMIpthread])
6451$PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
6452if test $? -ne 0; then
6453 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
6454fi
6455AC_MSG_RESULT([$with_libopenipmipthread])
6456
6457if test "x$with_libopenipmipthread" = "xyes"; then
6458 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
6459 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
6460 if test $? -eq 0; then
6461 with_libopenipmipthread_cflags="$temp_result"
6462 else
6463 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
6464 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
6465 fi
6466 AC_MSG_RESULT([$temp_result])
975e7fd6
FF
6467fi
6468
865f2eb3
RK
6469if test "x$with_libopenipmipthread" = "xyes"; then
6470 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
6471 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
6472 if test $? -eq 0; then
6473 with_libopenipmipthread_ldflags="$temp_result"
6474 else
6475 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
6476 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
6477 fi
6478 AC_MSG_RESULT([$temp_result])
975e7fd6
FF
6479fi
6480
865f2eb3
RK
6481if test "x$with_libopenipmipthread" = "xyes"; then
6482 SAVE_CPPFLAGS="$CPPFLAGS"
6483 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
6484
6485 AC_CHECK_HEADERS([OpenIPMI/ipmi_smi.h],
6486 [with_libopenipmipthread="yes"],
6487 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
6488 [[
6489 #include <OpenIPMI/ipmiif.h>
6490 #include <OpenIPMI/ipmi_err.h>
6491 #include <OpenIPMI/ipmi_posix.h>
6492 #include <OpenIPMI/ipmi_conn.h>
6493 ]]
6494 )
975e7fd6 6495
865f2eb3 6496 CPPFLAGS="$SAVE_CPPFLAGS"
975e7fd6
FF
6497fi
6498
865f2eb3
RK
6499if test "x$with_libopenipmipthread" = "xyes"; then
6500 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
6501 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
975e7fd6 6502fi
865f2eb3
RK
6503
6504AC_SUBST([BUILD_WITH_OPENIPMI_CFLAGS])
6505AC_SUBST([BUILD_WITH_OPENIPMI_LIBS])
975e7fd6
FF
6506# }}}
6507
5e77bd67 6508# --with-libatasmart {{{
865f2eb3
RK
6509AC_ARG_WITH([libatasmart],
6510 [AS_HELP_STRING([--with-libatasmart@<:@=PREFIX@:>@], [Path to libatasmart.])],
6511 [
6512 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
6513 with_libatasmart_cppflags="-I$withval/include"
6514 with_libatasmart_ldflags="-L$withval/lib"
6515 with_libatasmart="yes"
6516 else
6517 with_libatasmart="$withval"
6518 fi
6519 ],
6520 [
6521 if test "x$ac_system" = "xLinux"; then
6522 with_libatasmart="yes"
6523 else
6524 with_libatasmart="no (Linux only library)"
6525 fi
6526 ]
6527)
6528
6529if test "x$with_libatasmart" = "xyes"; then
6530 SAVE_CPPFLAGS="$CPPFLAGS"
6531 CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
5e77bd67 6532
865f2eb3
RK
6533 AC_CHECK_HEADERS([atasmart.h],
6534 [with_libatasmart="yes"],
6535 [with_libatasmart="no (atasmart.h not found)"])
5e77bd67 6536
865f2eb3 6537 CPPFLAGS="$SAVE_CPPFLAGS"
5e77bd67 6538fi
5e77bd67 6539
865f2eb3
RK
6540if test "x$with_libatasmart" = "xyes"; then
6541 SAVE_LDFLAGS="$LDFLAGS"
6542 LDFLAGS="$LDFLAGS $with_libatasmart_ldflags"
5e77bd67 6543
865f2eb3
RK
6544 AC_CHECK_LIB([atasmart], [sk_disk_open],
6545 [with_libatasmart="yes"],
6546 [with_libatasmart="no (Symbol 'sk_disk_open' not found)"]
6547 )
6548
6549 LDFLAGS="$SAVE_LDFLAGS"
5e77bd67 6550fi
865f2eb3
RK
6551
6552if test "x$with_libatasmart" = "xyes"; then
6553 BUILD_WITH_LIBATASMART_CPPFLAGS="$with_libatasmart_cppflags"
6554 BUILD_WITH_LIBATASMART_LDFLAGS="$with_libatasmart_ldflags"
6555 BUILD_WITH_LIBATASMART_LIBS="-latasmart"
6556fi
6557
6558AC_SUBST([BUILD_WITH_LIBATASMART_CPPFLAGS])
6559AC_SUBST([BUILD_WITH_LIBATASMART_LDFLAGS])
6560AC_SUBST([BUILD_WITH_LIBATASMART_LIBS])
5e77bd67
VB
6561# }}}
6562
c044208a 6563PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
865f2eb3
RK
6564 [with_libnotify="yes"],
6565 [with_libnotify="no (pkg-config doesn't know libnotify)"]
d0f9d8cb 6566)
c044208a 6567
5f23aa26 6568PKG_CHECK_MODULES([LIBRIEMANN_CLIENT], [riemann-client >= 1.6.0],
9189e864 6569 [with_libriemann_client="yes"],
865f2eb3
RK
6570 [with_libriemann_client="no (pkg-config doesn't know libriemann-client)"]
6571)
d5558421 6572
86ca149a
FF
6573# Check for enabled/disabled features
6574#
6e765a02 6575
3c12e8a6
NW
6576# AC_COLLECTD(name, enable/disable, info-text, feature/module)
6577# ------------------------------------------------------------
6578dnl
865f2eb3 6579m4_define([my_toupper],[m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3c12e8a6
NW
6580dnl
6581AC_DEFUN(
865f2eb3
RK
6582 [AC_COLLECTD],
6583 [
6584 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
6585 m4_if(
6586 [$2],
6587 [enable],
6588 [dnl
6589 m4_define([EnDis],[disabled])dnl
6590 m4_define([YesNo],[no])dnl
6591 ],dnl
6592 [m4_if(
6593 [$2],
6594 [disable],
6595 [dnl
6596 m4_define([EnDis],[enabled])dnl
6597 m4_define([YesNo],[yes])dnl
6598 ],
6599 [dnl
6600 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
6601 ]dnl
6602 )]dnl
6603 )dnl
6604 m4_if([$3], [feature], [],
6605 [m4_if(
6606 [$3], [module], [],
6607 [dnl
6608 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
6609 ]dnl
6610 )]dnl
6611 )dnl
6612 AC_ARG_ENABLE(
6613 [$1],
6614 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
6615 [],
6616 enable_$1='[YesNo]'dnl
6617 )# AC_ARG_ENABLE
6618 if test "x$enable_$1" = "xno"; then
6619 collectd_$1=0
6620 else
6621 if test "x$enable_$1" = "xyes"; then
6622 collectd_$1=1
6623 else
6624 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
6625 collectd_$1=1
6626 enable_$1='yes'
6627 fi
6628 fi
6629 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [whether or not to enable $3 $4])
6630 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
6631 ]dnl
3c12e8a6
NW
6632)# AC_COLLECTD(name, enable/disable, info-text, feature/module)
6633
a905d397
FF
6634# AC_PLUGIN(name, default, info)
6635# ------------------------------------------------------------
6636dnl
6637AC_DEFUN(
6638 [AC_PLUGIN],
6639 [
6640 enable_plugin="no"
cb622208 6641 force="no"
865f2eb3
RK
6642 AC_ARG_ENABLE([$1],
6643 [AS_HELP_STRING([--enable-$1],[$3])],
6644 [
6645 if test "x$enableval" = "xyes"; then
6646 enable_plugin="yes"
6647 else if test "x$enableval" = "xforce"; then
6648 enable_plugin="yes"
6649 force="yes"
6650 else
6651 enable_plugin="no (disabled on command line)"
6652 fi; fi
6653 ],
6654 [
6655 if test "x$enable_all_plugins" = "xauto"; then
6656 if test "x$2" = "xyes"; then
6657 enable_plugin="yes"
6658 else
6659 enable_plugin="$2"
6660 fi
6661 else
6662 enable_plugin="$enable_all_plugins"
6663 fi
6664 ]
6665 )
6666 if test "x$enable_plugin" = "xyes"; then
6667 if test "x$2" = "xyes" || test "x$force" = "xyes"; then
6668 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
6669 if test "x$2" != "xyes"; then
6670 dependency_warning="yes"
6671 fi
6672 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
6673 dependency_error="yes"
6674 enable_plugin="$2 (dependency error)"
6675 fi
a905d397 6676 fi
865f2eb3 6677 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), [test "x$enable_plugin" = "xyes"])
a905d397
FF
6678 enable_$1="$enable_plugin"
6679 ]
6680)# AC_PLUGIN(name, default, info)
6681
6139038f
PL
6682# --with-libslurm {{{
6683AC_ARG_WITH([libslurm],
6684 [AS_HELP_STRING([--with-libslurm@<:@=PREFIX@:>@], [Path to the libslurm library.])],
6685 [
6686 if test "x$withval" = "xno"; then
6687 with_libslurm="no"
6688 else if test "x$withval" = "xyes"; then
6689 with_libslurm="use_pkgconfig"
6690 else if test -d "$with_libslurm/lib"; then
6691 AC_MSG_NOTICE([Not checking for libslurm: Manually configured])
6692 with_libslurm_cflags="-I$withval/include"
6693 with_libslurm_libs="-L$withval/lib -llibslurm"
6694 with_libslurm="yes"
6695 fi; fi; fi
6696 ],
6697 [with_libslurm="use_pkgconfig"]
6698)
6699
6700# configure using pkg-config
6701if test "x$with_libslurm" = "xuse_pkgconfig"; then
6702 AC_MSG_NOTICE([Checking for libslurm using $PKG_CONFIG])
6703 $PKG_CONFIG --exists 'slurm' 2>/dev/null
6704 if test $? -ne 0; then
6705 with_libslurm="no (pkg-config doesn't know libslurm)"
6706 fi
6707fi
6708
6709if test "x$with_libslurm" = "xuse_pkgconfig"; then
6710 with_libslurm_cflags="`$PKG_CONFIG --cflags 'slurm'`"
6711 if test $? -ne 0; then
6712 with_libslurm="no ($PKG_CONFIG failed)"
6713 fi
6714
6715 with_libslurm_libs="`$PKG_CONFIG --libs 'slurm'`"
6716 if test $? -ne 0; then
6717 with_libslurm="no ($PKG_CONFIG failed)"
6718 fi
6719fi
6720
6721if test "x$with_libslurm" = "xuse_pkgconfig"; then
6722 with_libslurm="yes"
6723fi
6724
6725if test "x$with_libslurm" = "xyes"; then
6726 SAVE_CPPFLAGS="$CPPFLAGS"
6727 CPPFLAGS="$CPPFLAGS $with_libslurm_cflags"
6728
6729 AC_CHECK_HEADERS([slurm/slurm.h],
6730 [with_libslurm="yes"],
6731 [with_libslurm="no (slurm/slurm.h not found)"]
6732 )
6733
6734 CPPFLAGS="$SAVE_CPPFLAGS"
6735fi
6736
6737if test "x$with_libslurm" = "xyes"; then
6738 SAVE_LDFLAGS="$LDFLAGS"
6739 LDFLAGS="$LDFLAGS $with_libslurm_libs"
6740
6741 AC_CHECK_LIB([slurm], [slurm_load_jobs],
6742 [with_libslurm="yes"],
6743 [with_libslurm="no (symbol slurm_load_jobs not found)"]
6744 )
6745
6746 LDFLAGS="$SAVE_LDFLAGS"
6747fi
6748
6749if test "x$with_libslurm" = "xyes"; then
6750 BUILD_WITH_LIBSLURM_CFLAGS="$with_libslurm_cflags"
6751 BUILD_WITH_LIBSLURM_LIBS="$with_libslurm_libs"
6752fi
6753
6754AC_SUBST([BUILD_WITH_LIBSLURM_CFLAGS])
6755AC_SUBST([BUILD_WITH_LIBSLURM_LIBS])
6756# }}}
6757
6758
3c12e8a6
NW
6759m4_divert_once([HELP_ENABLE], [
6760collectd features:])
a905d397 6761# FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3c12e8a6
NW
6762AC_COLLECTD([debug], [enable], [feature], [debugging])
6763AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
14740db4 6764AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
d90a7bc7 6765AC_COLLECTD([werror], [disable], [feature], [building with -Werror])
6e765a02 6766
cb622208 6767dependency_warning="no"
9276a813 6768dependency_error="no"
cb622208 6769
99ef5283 6770plugin_ascent="no"
d0bd9cfd 6771plugin_barometer="no"
a905d397 6772plugin_battery="no"
db4f7362 6773plugin_bind="no"
cb19ecf9 6774plugin_buddyinfo="no"
b934f157 6775plugin_capabilities="no"
75291e58 6776plugin_ceph="no"
9e1b0c68 6777plugin_cgroups="no"
ba5440ec 6778plugin_connectivity="no"
2239c03f 6779plugin_conntrack="no"
11c3445e 6780plugin_contextswitch="no"
a905d397
FF
6781plugin_cpu="no"
6782plugin_cpufreq="no"
9e07a3a7 6783plugin_cpusleep="no"
a30d7659 6784plugin_curl_json="no"
1d333244 6785plugin_curl_xml="no"
a905d397
FF
6786plugin_df="no"
6787plugin_disk="no"
df570a36 6788plugin_drbd="no"
921739d3 6789plugin_dpdkevents="no"
82591686 6790plugin_dpdkstat="no"
00cbd4d2 6791plugin_dpdk_telemetry="no"
a905d397 6792plugin_entropy="no"
75cb76e1 6793plugin_epics="no"
8ae25a97 6794plugin_ethstat="no"
bae4500a 6795plugin_fhcount="no"
d61648a2 6796plugin_fscache="no"
26314b8c 6797plugin_gps="no"
504ebaee 6798plugin_gpu_nvidia="no"
aab18e7e 6799plugin_grpc="no"
f91506bb 6800plugin_hugepages="no"
2be4e190 6801plugin_infiniband="no"
08e419e4 6802plugin_intel_pmu="no"
141fd306 6803plugin_intel_rdt="no"
a905d397 6804plugin_interface="no"
865f2eb3 6805plugin_ipc="no"
249d5776 6806plugin_ipmi="no"
1f7a78f4 6807plugin_ipstats="no"
6d431b70 6808plugin_ipvs="no"
a905d397
FF
6809plugin_irq="no"
6810plugin_load="no"
ab4488bb 6811plugin_log_logstash="no"
4ebf1f93 6812plugin_mcelog="no"
ccf4cd87 6813plugin_mdevents="no"
a905d397 6814plugin_memory="no"
f76de140 6815plugin_mmc="no"
3fc0feb6 6816plugin_multimeter="no"
004d21de 6817plugin_netstat_udp="no"
a905d397 6818plugin_nfs="no"
d61648a2 6819plugin_numa="no"
39035180 6820plugin_ovs_events="no"
481983e0 6821plugin_ovs_stats="no"
81467859 6822plugin_pcie_errors="no"
28785769 6823plugin_perl="no"
aab18e7e 6824plugin_pinba="no"
a905d397 6825plugin_processes="no"
6ff769e0 6826plugin_procevent="no"
15f09880 6827plugin_protocols="no"
4ad72002 6828plugin_python="no"
df7b529e 6829plugin_ras="no"
a905d397 6830plugin_serial="no"
cc1330a1 6831plugin_smart="no"
a905d397 6832plugin_swap="no"
813cfffe 6833plugin_synproxy="no"
6021d68d 6834plugin_sysevent="no"
a905d397 6835plugin_tape="no"
03b7ec00 6836plugin_tcpconns="no"
4e8795c7 6837plugin_ted="no"
2004f542 6838plugin_thermal="no"
4f79fc14 6839plugin_turbostat="no"
475ed108 6840plugin_ubi="no"
d0da1c4e 6841plugin_uptime="no"
62f94860
FF
6842plugin_users="no"
6843plugin_virt="no"
7b6abfd0 6844plugin_vmem="no"
a905d397
FF
6845plugin_vserver="no"
6846plugin_wireless="no"
cc893903 6847plugin_write_prometheus="no"
d4b7f327 6848plugin_write_stackdriver="no"
7a1a3100 6849plugin_xencpu="no"
87a3da3a 6850plugin_zfs_arc="no"
005af449 6851plugin_zone="no"
ff8752c6 6852plugin_zookeeper="no"
a905d397
FF
6853
6854# Linux
865f2eb3
RK
6855if test "x$ac_system" = "xLinux"; then
6856 plugin_battery="yes"
cb19ecf9 6857 plugin_buddyinfo="yes"
865f2eb3
RK
6858 plugin_cgroups="yes"
6859 plugin_conntrack="yes"
6860 plugin_contextswitch="yes"
6861 plugin_cpu="yes"
6862 plugin_cpufreq="yes"
6863 plugin_disk="yes"
6864 plugin_drbd="yes"
6865 plugin_entropy="yes"
6866 plugin_fhcount="yes"
6867 plugin_fscache="yes"
6868 plugin_hugepages="yes"
2be4e190 6869 plugin_infiniband="yes"
865f2eb3
RK
6870 plugin_interface="yes"
6871 plugin_ipc="yes"
6872 plugin_irq="yes"
6873 plugin_load="yes"
4ebf1f93 6874 plugin_mcelog="yes"
ccf4cd87 6875 plugin_mdevents="yes"
865f2eb3
RK
6876 plugin_memory="yes"
6877 plugin_nfs="yes"
6878 plugin_numa="yes"
6879 plugin_processes="yes"
6880 plugin_protocols="yes"
6881 plugin_serial="yes"
6882 plugin_swap="yes"
813cfffe 6883 plugin_synproxy="yes"
865f2eb3
RK
6884 plugin_tcpconns="yes"
6885 plugin_thermal="yes"
475ed108 6886 plugin_ubi="yes"
865f2eb3
RK
6887 plugin_uptime="yes"
6888 plugin_vmem="yes"
6889 plugin_vserver="yes"
6890 plugin_wireless="yes"
6891 plugin_zfs_arc="yes"
6892
3c1af627 6893 if test "x$ac_cv_header_linux_ip_vs_h" = "xyes"; then
865f2eb3
RK
6894 plugin_ipvs="yes"
6895 fi
6896
077315ab 6897 if test "x$have_cpuid_h" = "xyes"; then
865f2eb3
RK
6898 plugin_turbostat="yes"
6899 fi
bbf0d6f3 6900
865f2eb3
RK
6901 if test "x$c_cv_have_clock_boottime_monotonic" = "xyes"; then
6902 plugin_cpusleep="yes"
6903 fi
0400307a
MV
6904
6905 if test "x$with_libyajl" = "xyes" && test "x$with_libyajl2" = "xyes"; then
6906 plugin_ovs_events="yes"
6907 plugin_ovs_stats="yes"
36b9f3d9 6908 plugin_procevent="yes"
ba5440ec
AB
6909
6910 if test "x$with_libmnl" = "xyes"; then
6911 plugin_connectivity="yes"
6912 fi
f4a66f28
AB
6913 fi
6914
6915 if test "x$have_pci_regs_h" = "xyes"; then
6916 plugin_pcie_errors="yes"
81467859 6917 fi
b934f157
KW
6918
6919 if test "x$with_libmicrohttpd" = "xyes" && test "x$with_libjansson" = "xyes"; then
6920 plugin_capabilities="yes"
6921 fi
a905d397
FF
6922fi
6923
865f2eb3
RK
6924if test "x$ac_system" = "xOpenBSD"; then
6925 plugin_tcpconns="yes"
7132090f
FF
6926fi
6927
865f2eb3
RK
6928if test "x$ac_system" = "xNetBSD"; then
6929 plugin_disk="yes"
6930 plugin_entropy="yes"
6931 plugin_irq="yes"
876e6792 6932 plugin_nfs="yes"
865f2eb3 6933 plugin_processes="yes"
004d21de 6934 plugin_netstat_udp="yes"
f0446c10
HE
6935fi
6936
a905d397 6937# Mac OS X devices
865f2eb3
RK
6938if test "x$with_libiokit" = "xyes"; then
6939 plugin_battery="yes"
6940 plugin_disk="yes"
a905d397
FF
6941fi
6942
11b1e65a 6943# AIX
95b08a82 6944
865f2eb3
RK
6945if test "x$ac_system" = "xAIX"; then
6946 plugin_ipc="yes"
6947 plugin_tcpconns="yes"
95b08a82
MLSR
6948fi
6949
95c50593
XL
6950# FreeBSD
6951
865f2eb3 6952if test "x$ac_system" = "xFreeBSD"; then
391112ca 6953 plugin_cpufreq="yes"
865f2eb3 6954 plugin_disk="yes"
1f7a78f4 6955 plugin_ipstats="yes"
865f2eb3 6956 plugin_zfs_arc="yes"
95c50593
XL
6957fi
6958
6959
865f2eb3
RK
6960if test "x$with_perfstat" = "xyes"; then
6961 plugin_contextswitch="yes"
6962 plugin_cpu="yes"
6963 plugin_disk="yes"
6964 plugin_interface="yes"
6965 plugin_load="yes"
6966 plugin_memory="yes"
6967 plugin_swap="yes"
6968 plugin_uptime="yes"
11b1e65a
MS
6969fi
6970
865f2eb3
RK
6971if test "x$with_procinfo" = "xyes"; then
6972 plugin_processes="yes"
11b1e65a
MS
6973fi
6974
a905d397 6975# Solaris
865f2eb3
RK
6976if test "x$with_kstat" = "xyes"; then
6977 plugin_nfs="yes"
6978 plugin_processes="yes"
6979 plugin_uptime="yes"
6980 plugin_zfs_arc="yes"
6981 plugin_zone="yes"
a905d397
FF
6982fi
6983
865f2eb3
RK
6984if test "x$with_devinfo" = "xyes" && test "x$with_kstat" = "xyes"; then
6985 plugin_cpu="yes"
6986 plugin_disk="yes"
6987 plugin_interface="yes"
6988 plugin_memory="yes"
6989 plugin_tape="yes"
d0bd9cfd
T
6990fi
6991
865f2eb3
RK
6992if test "x$with_libi2c" = "xyes"; then
6993 plugin_barometer="yes"
d0bd9cfd
T
6994fi
6995
6996
a905d397 6997# libstatgrab
865f2eb3
RK
6998if test "x$with_libstatgrab" = "xyes"; then
6999 plugin_cpu="yes"
7000 plugin_disk="yes"
7001 plugin_interface="yes"
7002 plugin_load="yes"
7003 plugin_memory="yes"
7004 plugin_swap="yes"
7005 plugin_users="yes"
7006fi
7007
7008if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"; then
7009 plugin_ascent="yes"
7010 if test "x$have_strptime" = "xyes"; then
7011 plugin_bind="yes"
7012 fi
a905d397
FF
7013fi
7014
865f2eb3
RK
7015if test "x$with_libopenipmipthread" = "xyes"; then
7016 plugin_ipmi="yes"
99ef5283
FF
7017fi
7018
865f2eb3
RK
7019if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"; then
7020 plugin_curl_json="yes"
9d82e21a
FF
7021fi
7022
7023if test "x$with_libcurl" = "xyes" && test "x$with_libssl" = "xyes" && test "x$with_libyajl" = "xyes" && test "x$with_libyajl2" = "xyes"; then
2f7fd156 7024 plugin_write_stackdriver="yes"
249d5776
FF
7025fi
7026
865f2eb3
RK
7027if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"; then
7028 plugin_curl_xml="yes"
bc51ef21
DM
7029fi
7030
865f2eb3
RK
7031if test "x$with_libyajl" = "xyes"; then
7032 plugin_ceph="yes"
e0869a8e 7033 plugin_sysevent="yes"
1d333244
AG
7034fi
7035
865f2eb3
RK
7036if test "x$have_processor_info" = "xyes"; then
7037 plugin_cpu="yes"
75291e58 7038fi
7039
865f2eb3
RK
7040if test "x$have_sysctl" = "xyes"; then
7041 plugin_cpu="yes"
7042 plugin_memory="yes"
7043 plugin_uptime="yes"
7044 if test "x$ac_system" = "xDarwin"; then
7045 plugin_swap="yes"
7046 fi
22188738 7047fi
39035180 7048
865f2eb3
RK
7049if test "x$have_sysctlbyname" = "xyes"; then
7050 plugin_contextswitch="yes"
7051 plugin_cpu="yes"
7052 plugin_memory="yes"
7053 plugin_tcpconns="yes"
a905d397
FF
7054fi
7055
865f2eb3
RK
7056if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"; then
7057 plugin_df="yes"
a905d397 7058fi
865f2eb3
RK
7059
7060if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"; then
7061 plugin_df="yes"
a905d397 7062fi
865f2eb3
RK
7063
7064if test "x$c_cv_have_one_getmntent" = "xyes"; then
7065 plugin_df="yes"
a905d397
FF
7066fi
7067
da11ce02 7068if test "x$have_getmntent_r" = "xyes"; then
865f2eb3 7069 plugin_df="yes"
a916ae72
RK
7070fi
7071
865f2eb3
RK
7072if test "x$plugin_df" = "xyes"; then
7073 plugin_df="no"
7074 if test "x$have_statfs" = "xyes"; then
7075 plugin_df="yes"
7076 fi
7077
7078 if test "x$have_statvfs" = "xyes"; then
7079 plugin_df="yes"
7080 fi
eafb8003 7081fi
a905d397 7082
865f2eb3
RK
7083if test "x$have_linux_sockios_h" = "xyes" && test "x$have_linux_ethtool_h" = "xyes"; then
7084 plugin_ethstat="yes"
8ae25a97
FF
7085fi
7086
865f2eb3
RK
7087if test "x$with_libgps" = "xyes"; then
7088 plugin_gps="yes"
aab18e7e
RK
7089fi
7090
6a085256
FF
7091plugin_grpc="yes"
7092if test "x$GRPC_CPP_PLUGIN" = "x"; then
7093 plugin_grpc="no (grpc_cpp_plugin not found)"
7094fi
7095if test "x$have_protoc3" != "xyes"; then
7096 plugin_grpc="no (protoc3 not found)"
7097fi
7098if test "x$with_libprotobuf" != "xyes"; then
7099 plugin_grpc="no (libprotobuf not found)"
7100fi
7101if test "x$with_libgrpcpp" != "xyes"; then
7102 plugin_grpc="no (libgrpc++ not found)"
a905d397
FF
7103fi
7104
865f2eb3
RK
7105if test "x$have_getifaddrs" = "xyes"; then
7106 plugin_interface="yes"
26314b8c
NJ
7107fi
7108
865f2eb3
RK
7109if test "x$have_getloadavg" = "xyes"; then
7110 plugin_load="yes"
a905d397
FF
7111fi
7112
865f2eb3
RK
7113if test "x$with_libyajl" = "xyes"; then
7114 plugin_log_logstash="yes"
ab4488bb
PYR
7115fi
7116
865f2eb3
RK
7117if test "x$with_libperl" = "xyes" && test "x$c_cv_have_perl_ithreads" = "xyes"; then
7118 plugin_perl="yes"
28785769
SH
7119fi
7120
865f2eb3
RK
7121if test "x$have_protoc_c" = "xyes" && test "x$with_libprotobuf_c" = "xyes"; then
7122 plugin_pinba="yes"
7123 if test "x$with_libmicrohttpd" = "xyes"; then
7124 plugin_write_prometheus="yes"
7125 fi
aab18e7e
RK
7126fi
7127
a905d397 7128# Mac OS X memory interface
865f2eb3
RK
7129if test "x$have_host_statistics" = "xyes"; then
7130 plugin_memory="yes"
a905d397
FF
7131fi
7132
865f2eb3
RK
7133if test "x$have_termios_h" = "xyes"; then
7134 if test "x$ac_system" != "xAIX"; then
7135 plugin_multimeter="yes"
7136 fi
7137 plugin_ted="yes"
3fc0feb6
FF
7138fi
7139
2f15c704
LG
7140if test "x$with_libudev" = "xyes"; then
7141 plugin_mmc="yes"
7142fi
7143
865f2eb3
RK
7144if test "x$have_thread_info" = "xyes"; then
7145 plugin_processes="yes"
a905d397
FF
7146fi
7147
865f2eb3
RK
7148if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"; then
7149 plugin_processes="yes"
d4a4b86e
FF
7150fi
7151
865f2eb3
RK
7152if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_openbsd" = "xyes"; then
7153 plugin_processes="yes"
0e45add1
LB
7154fi
7155
865f2eb3
RK
7156if test "x$with_libpython" != "xno"; then
7157 plugin_python="yes"
4ad72002
RK
7158fi
7159
df7b529e
PZ
7160if test "x$with_sqlite3" = "xyes"; then
7161 plugin_ras="yes"
7162fi
7163
865f2eb3
RK
7164if test "x$with_libatasmart" = "xyes" && test "x$with_libudev" = "xyes"; then
7165 plugin_smart="yes"
cc1330a1
PR
7166fi
7167
865f2eb3
RK
7168if test "x$with_kvm_getswapinfo" = "xyes"; then
7169 plugin_swap="yes"
a905d397
FF
7170fi
7171
865f2eb3
RK
7172if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"; then
7173 plugin_swap="yes"
b10e5d81
FF
7174fi
7175
865f2eb3
RK
7176if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_three_args" = "xyes"; then
7177 plugin_swap="yes"
f0446c10
HE
7178fi
7179
865f2eb3
RK
7180if test "x$with_kvm_openfiles = "xyes" && $with_kvm_nlist" = "xyes"; then
7181 plugin_tcpconns="yes"
043a6f45
FF
7182fi
7183
865f2eb3
RK
7184if test "x$have_getutent" = "xyes"; then
7185 plugin_users="yes"
a905d397 7186fi
865f2eb3
RK
7187
7188if test "x$have_getutxent" = "xyes"; then
7189 plugin_users="yes"
a905d397
FF
7190fi
7191
865f2eb3
RK
7192if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"; then
7193 plugin_virt="yes"
6d017360
FF
7194else
7195 plugin_virt="no"
6d017360
FF
7196 if test "x$with_libvirt" != "xyes"; then
7197 plugin_virt="$with_libvirt"
b9634e3b
FF
7198 elif test "x$with_libxml2" != "xyes"; then
7199 plugin_virt="$with_libxml2"
6d017360 7200 fi
62f94860
FF
7201fi
7202
865f2eb3 7203if test "x$with_libxenctrl" = "xyes"; then
7a1a3100
PR
7204 plugin_xencpu="yes"
7205fi
62f94860 7206
61193e37 7207if test "x$with_libdpdk" = "xyes"; then
13a93e2a 7208 plugin_dpdkevents="$dpdk_keepalive"
82591686
RK
7209 plugin_dpdkstat="yes"
7210fi
7211
00cbd4d2
RP
7212if test "x$with_libjansson" = "xyes"; then
7213 plugin_dpdk_telemetry="yes"
7214fi
7215
f9ee71b2 7216m4_divert_once([HELP_ENABLE], [
a905d397
FF
7217collectd plugins:])
7218
2fd1f725 7219AC_ARG_ENABLE([all-plugins],
865f2eb3
RK
7220 [AS_HELP_STRING([--enable-all-plugins], [enable all plugins @<:@default=yes@:>@])],
7221 [
7222 if test "x$enableval" = "xyes"; then
7223 enable_all_plugins="yes"
7224 else if test "x$enableval" = "xauto"; then
7225 enable_all_plugins="auto"
7226 else
7227 enable_all_plugins="no"
7228 fi; fi
7229 ],
7230 [enable_all_plugins="auto"]
7231)
2fd1f725
SH
7232
7233m4_divert_once([HELP_ENABLE], [])
7234
9beb0870
FF
7235AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
7236AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
7237AC_PLUGIN([amqp1], [$with_libqpid_proton], [AMQP 1.0 output plugin])
7238AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
7239AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
7240AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple hardware sensors])
7241AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero hardware sensors])
7242AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
7243AC_PLUGIN([barometer], [$plugin_barometer], [Barometer sensor on I2C])
7244AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
7245AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
cb19ecf9 7246AC_PLUGIN([buddyinfo], [$plugin_buddyinfo], [buddyinfo statistics])
b934f157 7247AC_PLUGIN([capabilities], [$plugin_capabilities], [Platform static capabilities])
9beb0870
FF
7248AC_PLUGIN([ceph], [$plugin_ceph], [Ceph daemon statistics])
7249AC_PLUGIN([cgroups], [$plugin_cgroups], [CGroups CPU usage accounting])
7250AC_PLUGIN([chrony], [yes], [Chrony statistics])
64b9342a 7251AC_PLUGIN([check_uptime], [yes], [Notify about uptime reset])
ba5440ec 7252AC_PLUGIN([connectivity], [$plugin_connectivity], [Network interface up/down events])
9beb0870
FF
7253AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
7254AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
7255AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
7256AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
7257AC_PLUGIN([cpusleep], [$plugin_cpusleep], [CPU sleep statistics])
7258AC_PLUGIN([csv], [yes], [CSV output plugin])
7259AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
7260AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
7261AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
7262AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
79348a91 7263AC_PLUGIN([dcpmm], [$with_libpmwapi], [Intel(R) Optane(TM) DC Persistent Memory performance and health statistics])
9beb0870
FF
7264AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
7265AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
7266AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
7267AC_PLUGIN([dpdkevents], [$plugin_dpdkevents], [Events from DPDK])
7268AC_PLUGIN([dpdkstat], [$plugin_dpdkstat], [Stats from DPDK])
00cbd4d2 7269AC_PLUGIN([dpdk_telemetry], [$plugin_dpdk_telemetry], [Metrics from DPDK Telemetry])
9beb0870
FF
7270AC_PLUGIN([drbd], [$plugin_drbd], [DRBD statistics])
7271AC_PLUGIN([email], [yes], [EMail statistics])
7272AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
75cb76e1 7273AC_PLUGIN([epics], [$with_epics_base], [EPICS CA plugin])
9beb0870
FF
7274AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
7275AC_PLUGIN([exec], [yes], [Execution of external programs])
7276AC_PLUGIN([fhcount], [$plugin_fhcount], [File handles statistics])
7277AC_PLUGIN([filecount], [yes], [Count files in directories])
7278AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
7279AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
7280AC_PLUGIN([gps], [$plugin_gps], [GPS plugin])
504ebaee 7281AC_PLUGIN([gpu_nvidia], [$with_cuda], [NVIDIA GPU plugin])
9beb0870
FF
7282AC_PLUGIN([grpc], [$plugin_grpc], [gRPC plugin])
7283AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
7284AC_PLUGIN([hugepages], [$plugin_hugepages], [Hugepages statistics])
2be4e190 7285AC_PLUGIN([infiniband], [$plugin_infiniband], [Infiniband statistics])
9beb0870
FF
7286AC_PLUGIN([intel_pmu], [$with_libjevents], [Intel performance monitor plugin])
7287AC_PLUGIN([intel_rdt], [$with_libpqos], [Intel RDT monitor plugin])
7288AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
7289AC_PLUGIN([ipc], [$plugin_ipc], [IPC statistics])
7290AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
7291AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
1f7a78f4 7292AC_PLUGIN([ipstats], [$plugin_ipstats], [IP packet statistics])
9beb0870
FF
7293AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
7294AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
7295AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
7296AC_PLUGIN([load], [$plugin_load], [System load])
7297AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging])
7298AC_PLUGIN([logfile], [yes], [File logging plugin])
7ca06f50 7299AC_PLUGIN([logparser], [yes], [Log parsing plugin])
9beb0870
FF
7300AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
7301AC_PLUGIN([lua], [$with_liblua], [Lua plugin])
9beb0870
FF
7302AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
7303AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
7304AC_PLUGIN([match_hashed], [yes], [The hashed match])
7305AC_PLUGIN([match_regex], [yes], [The regex match])
7306AC_PLUGIN([match_timediff], [yes], [The timediff match])
7307AC_PLUGIN([match_value], [yes], [The value match])
7308AC_PLUGIN([mbmon], [yes], [Query mbmond])
7309AC_PLUGIN([mcelog], [$plugin_mcelog], [Machine Check Exceptions notifications])
7310AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
ccf4cd87 7311AC_PLUGIN([mdevents], [$plugin_mdevents], [Events from md (Linux Software RAID) devices])
9beb0870
FF
7312AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
7313AC_PLUGIN([memcached], [yes], [memcached statistics])
7314AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
7315AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats])
7316AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
7317AC_PLUGIN([mqtt], [$with_libmosquitto], [MQTT output plugin])
f76de140 7318AC_PLUGIN([mmc], [$plugin_mmc], [MMC statistics])
9beb0870
FF
7319AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
7320AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
7321AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
7322AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics])
004d21de 7323AC_PLUGIN([netstat_udp], [$plugin_netstat_udp], [UDP network statistics])
9beb0870
FF
7324AC_PLUGIN([network], [yes], [Network communication plugin])
7325AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
7326AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
7327AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
7328AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
7329AC_PLUGIN([notify_nagios], [yes], [Nagios notification plugin])
7330AC_PLUGIN([ntpd], [yes], [NTPd statistics])
7331AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
7332AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
7333AC_PLUGIN([olsrd], [yes], [olsrd statistics])
7334AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
7335AC_PLUGIN([openldap], [$with_libldap], [OpenLDAP statistics])
7336AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
7337AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
7338AC_PLUGIN([ovs_events], [$plugin_ovs_events], [OVS events plugin])
7339AC_PLUGIN([ovs_stats], [$plugin_ovs_stats], [OVS statistics plugin])
7340AC_PLUGIN([pcie_errors], [$plugin_pcie_errors], [PCIe errors plugin])
7341AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
7342AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
23a8901d 7343# FIXME: Check for libevent, too.
9beb0870
FF
7344AC_PLUGIN([pinba], [$plugin_pinba], [Pinba statistics])
7345AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
7346AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
7347AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
7348AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
6ff769e0 7349AC_PLUGIN([procevent], [$plugin_procevent], [Process event (start, stop) statistics])
9beb0870
FF
7350AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
7351AC_PLUGIN([python], [$plugin_python], [Embed a Python interpreter])
df7b529e 7352AC_PLUGIN([ras], [$plugin_ras], [RAS plugin])
b9083ecc 7353AC_PLUGIN([redfish], [$with_libredfish], [Redfish plugin])
9beb0870
FF
7354AC_PLUGIN([redis], [$with_libhiredis], [Redis plugin])
7355AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
7356AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
7357AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
7358AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
7359AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
7360AC_PLUGIN([sigrok], [$with_libsigrok], [sigrok acquisition sources])
6139038f 7361AC_PLUGIN([slurm], [$with_libslurm], [SLURM jobs and nodes status])
9beb0870
FF
7362AC_PLUGIN([smart], [$plugin_smart], [SMART statistics])
7363AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
7364AC_PLUGIN([snmp_agent], [$with_libnetsnmpagent], [SNMP agent plugin])
7365AC_PLUGIN([statsd], [yes], [StatsD plugin])
7366AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
7367AC_PLUGIN([synproxy], [$plugin_synproxy], [Synproxy stats plugin])
28e701a0 7368AC_PLUGIN([sysevent], [$plugin_sysevent], [rsyslog events])
9beb0870
FF
7369AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
7370AC_PLUGIN([table], [yes], [Parsing of tabular data])
7371AC_PLUGIN([tail], [yes], [Parsing of logfiles])
7372AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
7373AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
7374AC_PLUGIN([target_notification], [yes], [The notification target])
7375AC_PLUGIN([target_replace], [yes], [The replace target])
7376AC_PLUGIN([target_scale], [yes], [The scale target])
7377AC_PLUGIN([target_set], [yes], [The set target])
7378AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
7379AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
7380AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
7381AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
7382AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
7383AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
7384AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
7385AC_PLUGIN([turbostat], [$plugin_turbostat], [Advanced statistic on Intel cpu states])
d453af56 7386AC_PLUGIN([ubi], [$plugin_ubi], [UBIFS statistics])
9beb0870
FF
7387AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
7388AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
7389AC_PLUGIN([users], [$plugin_users], [User statistics])
7390AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
7391AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
7392AC_PLUGIN([virt], [$plugin_virt], [Virtual machine statistics])
7393AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
7394AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
7395AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
7396AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
7397AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
605fcdcd 7398AC_PLUGIN([write_influxdb_udp], [yes], [Influxdb udp output plugin])
9beb0870
FF
7399AC_PLUGIN([write_kafka], [$with_librdkafka], [Kafka output plugin])
7400AC_PLUGIN([write_log], [yes], [Log output plugin])
7401AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
7402AC_PLUGIN([write_prometheus], [$plugin_write_prometheus], [Prometheus write plugin])
7403AC_PLUGIN([write_redis], [$with_libhiredis], [Redis output plugin])
7404AC_PLUGIN([write_riemann], [$with_libriemann_client], [Riemann output plugin])
7405AC_PLUGIN([write_sensu], [yes], [Sensu output plugin])
c927d571 7406AC_PLUGIN([write_stackdriver], [$plugin_write_stackdriver], [Google Stackdriver Monitoring output plugin])
cc0fe328 7407AC_PLUGIN([write_syslog], [yes], [Syslog output plugin])
9beb0870
FF
7408AC_PLUGIN([write_tsdb], [yes], [TSDB output plugin])
7409AC_PLUGIN([xencpu], [$plugin_xencpu], [Xen Host CPU usage])
7410AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
7411AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
7412AC_PLUGIN([zone], [$plugin_zone], [Solaris container statistics])
7413AC_PLUGIN([zookeeper], [yes], [Zookeeper statistics])
55b43947 7414
a32e822b
FF
7415dnl Default configuration file
7416# Load either syslog or logfile
7417LOAD_PLUGIN_SYSLOG=""
7418LOAD_PLUGIN_LOGFILE=""
22c1fc78 7419LOAD_PLUGIN_LOG_LOGSTASH=""
a32e822b
FF
7420
7421AC_MSG_CHECKING([which default log plugin to load])
7422default_log_plugin="none"
865f2eb3
RK
7423if test "x$enable_syslog" = "xyes"; then
7424 default_log_plugin="syslog"
a32e822b 7425else
865f2eb3 7426 LOAD_PLUGIN_SYSLOG="##"
a32e822b
FF
7427fi
7428
865f2eb3
RK
7429if test "x$enable_logfile" = "xyes"; then
7430 if test "x$default_log_plugin" = "xnone"; then
7431 default_log_plugin="logfile"
7432 else
7433 LOAD_PLUGIN_LOGFILE="#"
7434 fi
a32e822b 7435else
865f2eb3 7436 LOAD_PLUGIN_LOGFILE="##"
a32e822b 7437fi
22c1fc78 7438
865f2eb3 7439if test "x$enable_log_logstash" = "xyes"; then
22c1fc78
PYR
7440 LOAD_PLUGIN_LOG_LOGSTASH="#"
7441else
7442 LOAD_PLUGIN_LOG_LOGSTASH="##"
7443fi
7444
a32e822b
FF
7445AC_MSG_RESULT([$default_log_plugin])
7446
865f2eb3
RK
7447AC_SUBST([LOAD_PLUGIN_SYSLOG])
7448AC_SUBST([LOAD_PLUGIN_LOGFILE])
7449AC_SUBST([LOAD_PLUGIN_LOG_LOGSTASH])
a32e822b 7450
3d316c83 7451if test "x$enable_debug" = "xyes"; then
865f2eb3
RK
7452 DEFAULT_LOG_LEVEL="debug"
7453else
7454 DEFAULT_LOG_LEVEL="info"
a32e822b 7455fi
865f2eb3 7456AC_SUBST([DEFAULT_LOG_LEVEL])
a32e822b
FF
7457
7458# Load only one of rrdtool, network, csv in the default config.
7459LOAD_PLUGIN_RRDTOOL=""
7460LOAD_PLUGIN_NETWORK=""
7461LOAD_PLUGIN_CSV=""
7462
7463AC_MSG_CHECKING([which default write plugin to load])
7464default_write_plugin="none"
865f2eb3
RK
7465if test "x$enable_rrdtool" = "xyes"; then
7466 default_write_plugin="rrdtool"
a32e822b 7467else
865f2eb3 7468 LOAD_PLUGIN_RRDTOOL="##"
a32e822b
FF
7469fi
7470
865f2eb3
RK
7471if test "x$enable_network" = "xyes"; then
7472 if test "x$default_write_plugin" = "xnone"; then
7473 default_write_plugin="network"
7474 else
7475 LOAD_PLUGIN_NETWORK="#"
7476 fi
a32e822b 7477else
865f2eb3 7478 LOAD_PLUGIN_NETWORK="##"
a32e822b
FF
7479fi
7480
865f2eb3
RK
7481if test "x$enable_csv" = "xyes"; then
7482 if test "x$default_write_plugin" = "xnone"; then
7483 default_write_plugin="csv"
7484 else
7485 LOAD_PLUGIN_CSV="#"
7486 fi
a32e822b 7487else
865f2eb3 7488 LOAD_PLUGIN_CSV="##"
a32e822b
FF
7489fi
7490AC_MSG_RESULT([$default_write_plugin])
7491
865f2eb3
RK
7492AC_SUBST([LOAD_PLUGIN_RRDTOOL])
7493AC_SUBST([LOAD_PLUGIN_NETWORK])
7494AC_SUBST([LOAD_PLUGIN_CSV])
a32e822b 7495
a459afe5 7496dnl Perl bindings
6c769cf7 7497PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
a459afe5
SH
7498AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
7499[
3d316c83 7500 if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
865f2eb3
RK
7501 PERL_BINDINGS_OPTIONS="$withval"
7502 with_perl_bindings="yes"
7503 else
7504 with_perl_bindings="$withval"
7505 fi
a459afe5
SH
7506],
7507[
3d316c83 7508 if test "x$PERL" != "x"; then
865f2eb3
RK
7509 with_perl_bindings="yes"
7510 else
7511 with_perl_bindings="no (no perl interpreter found)"
7512 fi
a459afe5 7513])
20f17fde 7514
8337d673
RK
7515if test "x$with_perl_bindings" = "xyes"; then
7516 AC_MSG_CHECKING([for the ExtUtils::MakeMaker module])
7517 if $PERL -MExtUtils::MakeMaker -e '' 2>/dev/null; then
7518 AC_MSG_RESULT([yes])
7519 else
7520 AC_MSG_RESULT([no])
7521 with_perl_bindings="no (ExtUtils::MakeMaker not found)"
7522 fi
20f17fde
RK
7523fi
7524
3d316c83 7525if test "x$with_perl_bindings" = "xyes"; then
865f2eb3 7526 PERL_BINDINGS="perl"
a459afe5 7527else
865f2eb3 7528 PERL_BINDINGS=""
a459afe5 7529fi
865f2eb3
RK
7530
7531AC_SUBST([PERL_BINDINGS])
7532AC_SUBST([PERL_BINDINGS_OPTIONS])
a459afe5 7533
dc45cf5e
SH
7534dnl libcollectdclient
7535LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
7536LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
7537LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
7538
7539LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
7540
7541LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
7542
865f2eb3
RK
7543AC_SUBST([LCC_VERSION_MAJOR])
7544AC_SUBST([LCC_VERSION_MINOR])
7545AC_SUBST([LCC_VERSION_PATCH])
7546AC_SUBST([LCC_VERSION_EXTRA])
7547AC_SUBST([LCC_VERSION_STRING])
dc45cf5e 7548
865f2eb3 7549AC_CONFIG_FILES([src/libcollectdclient/collectd/lcc_features.h])
dc45cf5e 7550
9317d073
DM
7551if test "x$GCC" = "xyes"; then
7552 AM_CFLAGS="-Wall"
7553 AM_CXXFLAGS="-Wall"
7554 if test "x$enable_werror" != "xno"; then
7555 AM_CFLAGS="$AM_CFLAGS -Werror"
7556 AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
7557 fi
71e07cf6 7558fi
865f2eb3 7559
71e07cf6 7560AC_SUBST([AM_CFLAGS])
408b3fc3 7561AC_SUBST([AM_CXXFLAGS])
71e07cf6 7562
865f2eb3
RK
7563AC_CONFIG_FILES([ \
7564 Makefile \
da38e7c1 7565 src/collectd.conf \
865f2eb3 7566 src/libcollectdclient/libcollectdclient.pc \
865f2eb3
RK
7567])
7568
d4fcceb7 7569AC_OUTPUT
86ca149a 7570
865f2eb3
RK
7571if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" != "xyes"; then
7572 with_librrd="yes (warning: librrd is not thread-safe)"
83aa9c9e
SH
7573fi
7574
865f2eb3
RK
7575if test "x$with_libperl" = "xyes"; then
7576 with_libperl="yes (version `$PERL -MConfig -e 'print $Config{version};'`)"
7d32c2bc 7577else
865f2eb3 7578 enable_perl="no (needs libperl)"
a432a981
FF
7579fi
7580
865f2eb3
RK
7581if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"; then
7582 enable_perl="no (libperl doesn't support ithreads)"
7075d42e
FF
7583fi
7584
865f2eb3
RK
7585if test "x$with_perl_bindings" = "xyes" && test "x$PERL_BINDINGS_OPTIONS" != "x"; then
7586 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
a459afe5
SH
7587fi
7588
646b20c3
SH
7589AC_MSG_RESULT()
7590AC_MSG_RESULT([Configuration:])
7591AC_MSG_RESULT([ Build:])
7592AC_MSG_RESULT([ Platform . . . . . . $ac_system])
be26f4eb 7593AC_MSG_RESULT([ Compiler vendor . . . $ax_cv_c_compiler_vendor])
646b20c3
SH
7594AC_MSG_RESULT([ CC . . . . . . . . . $CC])
7595AC_MSG_RESULT([ CFLAGS . . . . . . . $AM_CFLAGS $CFLAGS])
7596AC_MSG_RESULT([ CXXFLAGS . . . . . . $AM_CXXFLAGS $CXXFLAGS])
7597AC_MSG_RESULT([ CPP . . . . . . . . . $CPP])
7598AC_MSG_RESULT([ CPPFLAGS . . . . . . $CPPFLAGS])
7599AC_MSG_RESULT([ GRPC_CPP_PLUGIN . . . $GRPC_CPP_PLUGIN])
7600AC_MSG_RESULT([ LD . . . . . . . . . $LD])
7601AC_MSG_RESULT([ LDFLAGS . . . . . . . $LDFLAGS])
7602AC_MSG_RESULT([ PROTOC . . . . . . . $PROTOC])
7603AC_MSG_RESULT([ YACC . . . . . . . . $YACC])
7604AC_MSG_RESULT([ YFLAGS . . . . . . . $YFLAGS])
7605AC_MSG_RESULT()
7606AC_MSG_RESULT([ Libraries:])
75cb76e1 7607AC_MSG_RESULT([ epics . . . . . . . . $with_epics_base])
646b20c3
SH
7608AC_MSG_RESULT([ intel mic . . . . . . $with_mic])
7609AC_MSG_RESULT([ libaquaero5 . . . . . $with_libaquaero5])
7610AC_MSG_RESULT([ libatasmart . . . . . $with_libatasmart])
7611AC_MSG_RESULT([ libcurl . . . . . . . $with_libcurl])
7612AC_MSG_RESULT([ libdbi . . . . . . . $with_libdbi])
19a9d6d1 7613AC_MSG_RESULT([ libdpdk . . . . . . . $with_libdpdk])
646b20c3
SH
7614AC_MSG_RESULT([ libesmtp . . . . . . $with_libesmtp])
7615AC_MSG_RESULT([ libganglia . . . . . $with_libganglia])
7616AC_MSG_RESULT([ libgcrypt . . . . . . $with_libgcrypt])
1bdfcf97 7617AC_MSG_RESULT([ libgps . . . . . . . $with_libgps])
aab18e7e 7618AC_MSG_RESULT([ libgrpc++ . . . . . . $with_libgrpcpp])
646b20c3
SH
7619AC_MSG_RESULT([ libhiredis . . . . . $with_libhiredis])
7620AC_MSG_RESULT([ libi2c-dev . . . . . $with_libi2c])
7621AC_MSG_RESULT([ libiokit . . . . . . $with_libiokit])
7622AC_MSG_RESULT([ libiptc . . . . . . . $with_libiptc])
00cbd4d2 7623AC_MSG_RESULT([ libjansson . . . . . $with_libjansson])
08e419e4 7624AC_MSG_RESULT([ libjevents . . . . . $with_libjevents])
646b20c3
SH
7625AC_MSG_RESULT([ libjvm . . . . . . . $with_java])
7626AC_MSG_RESULT([ libkstat . . . . . . $with_kstat])
7627AC_MSG_RESULT([ libkvm . . . . . . . $with_libkvm])
7628AC_MSG_RESULT([ libldap . . . . . . . $with_libldap])
02309232 7629AC_MSG_RESULT([ liblua . . . . . . . $with_liblua])
646b20c3 7630AC_MSG_RESULT([ libmemcached . . . . $with_libmemcached])
cc893903 7631AC_MSG_RESULT([ libmicrohttpd . . . . $with_libmicrohttpd])
646b20c3
SH
7632AC_MSG_RESULT([ libmnl . . . . . . . $with_libmnl])
7633AC_MSG_RESULT([ libmodbus . . . . . . $with_libmodbus])
7634AC_MSG_RESULT([ libmongoc . . . . . . $with_libmongoc])
7635AC_MSG_RESULT([ libmosquitto . . . . $with_libmosquitto])
7636AC_MSG_RESULT([ libmysql . . . . . . $with_libmysql])
7637AC_MSG_RESULT([ libnetapp . . . . . . $with_libnetapp])
7638AC_MSG_RESULT([ libnetsnmp . . . . . $with_libnetsnmp])
6466fcb4 7639AC_MSG_RESULT([ libnetsnmpagent . . . $with_libnetsnmpagent])
646b20c3 7640AC_MSG_RESULT([ libnotify . . . . . . $with_libnotify])
c0419e09 7641AC_MSG_RESULT([ libnvidia-ml . . . . $with_cuda])
646b20c3
SH
7642AC_MSG_RESULT([ libopenipmi . . . . . $with_libopenipmipthread])
7643AC_MSG_RESULT([ liboping . . . . . . $with_liboping])
7644AC_MSG_RESULT([ libowcapi . . . . . . $with_libowcapi])
7645AC_MSG_RESULT([ libpcap . . . . . . . $with_libpcap])
7646AC_MSG_RESULT([ libperfstat . . . . . $with_perfstat])
7647AC_MSG_RESULT([ libperl . . . . . . . $with_libperl])
79348a91 7648AC_MSG_RESULT([ libpmwapi . . . . . . $with_libpmwapi])
646b20c3 7649AC_MSG_RESULT([ libpq . . . . . . . . $with_libpq])
b57fb475 7650AC_MSG_RESULT([ libpqos . . . . . . . $with_libpqos])
aab18e7e
RK
7651AC_MSG_RESULT([ libprotobuf . . . . . $with_libprotobuf])
7652AC_MSG_RESULT([ libprotobuf-c . . . . $with_libprotobuf_c])
4ad72002 7653AC_MSG_RESULT([ libpython . . . . . . $with_libpython])
7feccc9a 7654AC_MSG_RESULT([ libqpid-proton . . . $with_libqpid_proton])
646b20c3
SH
7655AC_MSG_RESULT([ librabbitmq . . . . . $with_librabbitmq])
7656AC_MSG_RESULT([ libriemann-client . . $with_libriemann_client])
7657AC_MSG_RESULT([ librdkafka . . . . . $with_librdkafka])
7658AC_MSG_RESULT([ librouteros . . . . . $with_librouteros])
7659AC_MSG_RESULT([ librrd . . . . . . . $with_librrd])
7660AC_MSG_RESULT([ libsensors . . . . . $with_libsensors])
7661AC_MSG_RESULT([ libsigrok . . . . . $with_libsigrok])
aa61b905 7662AC_MSG_RESULT([ libssl . . . . . . . $with_libssl])
6139038f 7663AC_MSG_RESULT([ libslurm . . . . . . $with_libslurm])
646b20c3
SH
7664AC_MSG_RESULT([ libstatgrab . . . . . $with_libstatgrab])
7665AC_MSG_RESULT([ libtokyotyrant . . . $with_libtokyotyrant])
7666AC_MSG_RESULT([ libudev . . . . . . . $with_libudev])
7667AC_MSG_RESULT([ libupsclient . . . . $with_libupsclient])
7668AC_MSG_RESULT([ libvarnish . . . . . $with_libvarnish])
7669AC_MSG_RESULT([ libvirt . . . . . . . $with_libvirt])
7670AC_MSG_RESULT([ libxenctrl . . . . . $with_libxenctrl])
7671AC_MSG_RESULT([ libxml2 . . . . . . . $with_libxml2])
7672AC_MSG_RESULT([ libxmms . . . . . . . $with_libxmms])
7673AC_MSG_RESULT([ libyajl . . . . . . . $with_libyajl])
7674AC_MSG_RESULT([ oracle . . . . . . . $with_oracle])
7675AC_MSG_RESULT([ protobuf-c . . . . . $have_protoc_c])
b1c51501 7676AC_MSG_RESULT([ protoc 3 . . . . . . $have_protoc3])
646b20c3
SH
7677AC_MSG_RESULT()
7678AC_MSG_RESULT([ Features:])
7679AC_MSG_RESULT([ daemon mode . . . . . $enable_daemon])
7680AC_MSG_RESULT([ debug . . . . . . . . $enable_debug])
7681AC_MSG_RESULT()
7682AC_MSG_RESULT([ Bindings:])
7683AC_MSG_RESULT([ perl . . . . . . . . $with_perl_bindings])
7684AC_MSG_RESULT()
7685AC_MSG_RESULT([ Modules:])
7686AC_MSG_RESULT([ aggregation . . . . . $enable_aggregation])
7687AC_MSG_RESULT([ amqp . . . . . . . $enable_amqp])
7feccc9a 7688AC_MSG_RESULT([ amqp1 . . . . . . . $enable_amqp1])
646b20c3
SH
7689AC_MSG_RESULT([ apache . . . . . . . $enable_apache])
7690AC_MSG_RESULT([ apcups . . . . . . . $enable_apcups])
7691AC_MSG_RESULT([ apple_sensors . . . . $enable_apple_sensors])
7692AC_MSG_RESULT([ aquaero . . . . . . . $enable_aquaero])
7693AC_MSG_RESULT([ ascent . . . . . . . $enable_ascent])
7694AC_MSG_RESULT([ barometer . . . . . . $enable_barometer])
7695AC_MSG_RESULT([ battery . . . . . . . $enable_battery])
7696AC_MSG_RESULT([ bind . . . . . . . . $enable_bind])
cb19ecf9 7697AC_MSG_RESULT([ buddyinfo . . . . . . $enable_buddyinfo])
b934f157 7698AC_MSG_RESULT([ capabilities . . . . $enable_capabilities])
646b20c3
SH
7699AC_MSG_RESULT([ ceph . . . . . . . . $enable_ceph])
7700AC_MSG_RESULT([ cgroups . . . . . . . $enable_cgroups])
7701AC_MSG_RESULT([ chrony. . . . . . . . $enable_chrony])
64b9342a 7702AC_MSG_RESULT([ check_uptime. . . . . $enable_check_uptime])
e13ae88f 7703AC_MSG_RESULT([ connectivity. . . . . $enable_connectivity])
646b20c3
SH
7704AC_MSG_RESULT([ conntrack . . . . . . $enable_conntrack])
7705AC_MSG_RESULT([ contextswitch . . . . $enable_contextswitch])
7706AC_MSG_RESULT([ cpu . . . . . . . . . $enable_cpu])
7707AC_MSG_RESULT([ cpufreq . . . . . . . $enable_cpufreq])
73a6f82a 7708AC_MSG_RESULT([ cpusleep . . . . . . $enable_cpusleep])
646b20c3
SH
7709AC_MSG_RESULT([ csv . . . . . . . . . $enable_csv])
7710AC_MSG_RESULT([ curl . . . . . . . . $enable_curl])
7711AC_MSG_RESULT([ curl_json . . . . . . $enable_curl_json])
7712AC_MSG_RESULT([ curl_xml . . . . . . $enable_curl_xml])
7713AC_MSG_RESULT([ dbi . . . . . . . . . $enable_dbi])
79348a91 7714AC_MSG_RESULT([ dcpmm . . . . . . . $enable_dcpmm])
646b20c3
SH
7715AC_MSG_RESULT([ df . . . . . . . . . $enable_df])
7716AC_MSG_RESULT([ disk . . . . . . . . $enable_disk])
7717AC_MSG_RESULT([ dns . . . . . . . . . $enable_dns])
921739d3 7718AC_MSG_RESULT([ dpdkevents. . . . . . $enable_dpdkevents])
82591686 7719AC_MSG_RESULT([ dpdkstat . . . . . . $enable_dpdkstat])
00cbd4d2 7720AC_MSG_RESULT([ dpdk_telemetry. . . . $enable_dpdk_telemetry])
646b20c3
SH
7721AC_MSG_RESULT([ drbd . . . . . . . . $enable_drbd])
7722AC_MSG_RESULT([ email . . . . . . . . $enable_email])
7723AC_MSG_RESULT([ entropy . . . . . . . $enable_entropy])
7724AC_MSG_RESULT([ ethstat . . . . . . . $enable_ethstat])
75cb76e1 7725AC_MSG_RESULT([ epics . . . . . . . . $enable_epics])
646b20c3
SH
7726AC_MSG_RESULT([ exec . . . . . . . . $enable_exec])
7727AC_MSG_RESULT([ fhcount . . . . . . . $enable_fhcount])
7728AC_MSG_RESULT([ filecount . . . . . . $enable_filecount])
7729AC_MSG_RESULT([ fscache . . . . . . . $enable_fscache])
7730AC_MSG_RESULT([ gmond . . . . . . . . $enable_gmond])
1bdfcf97 7731AC_MSG_RESULT([ gps . . . . . . . . . $enable_gps])
504ebaee 7732AC_MSG_RESULT([ gpu_nvidia . . . . . $enable_gpu_nvidia])
646b20c3
SH
7733AC_MSG_RESULT([ grpc . . . . . . . . $enable_grpc])
7734AC_MSG_RESULT([ hddtemp . . . . . . . $enable_hddtemp])
178402a0 7735AC_MSG_RESULT([ hugepages . . . . . . $enable_hugepages])
2be4e190 7736AC_MSG_RESULT([ infiniband . . . . . $enable_infiniband])
08e419e4 7737AC_MSG_RESULT([ intel_pmu . . . . . . $enable_intel_pmu])
99223854 7738AC_MSG_RESULT([ intel_rdt . . . . . . $enable_intel_rdt])
646b20c3
SH
7739AC_MSG_RESULT([ interface . . . . . . $enable_interface])
7740AC_MSG_RESULT([ ipc . . . . . . . . . $enable_ipc])
7741AC_MSG_RESULT([ ipmi . . . . . . . . $enable_ipmi])
7742AC_MSG_RESULT([ iptables . . . . . . $enable_iptables])
1f7a78f4 7743AC_MSG_RESULT([ ipstats . . . . . . . $enable_ipstats])
646b20c3
SH
7744AC_MSG_RESULT([ ipvs . . . . . . . . $enable_ipvs])
7745AC_MSG_RESULT([ irq . . . . . . . . . $enable_irq])
7746AC_MSG_RESULT([ java . . . . . . . . $enable_java])
7747AC_MSG_RESULT([ load . . . . . . . . $enable_load])
7748AC_MSG_RESULT([ logfile . . . . . . . $enable_logfile])
e1ae6647 7749AC_MSG_RESULT([ logparser . . . . . . $enable_logparser])
646b20c3
SH
7750AC_MSG_RESULT([ log_logstash . . . . $enable_log_logstash])
7751AC_MSG_RESULT([ lpar . . . . . . . . $enable_lpar])
02309232 7752AC_MSG_RESULT([ lua . . . . . . . . . $enable_lua])
646b20c3
SH
7753AC_MSG_RESULT([ madwifi . . . . . . . $enable_madwifi])
7754AC_MSG_RESULT([ match_empty_counter . $enable_match_empty_counter])
7755AC_MSG_RESULT([ match_hashed . . . . $enable_match_hashed])
7756AC_MSG_RESULT([ match_regex . . . . . $enable_match_regex])
7757AC_MSG_RESULT([ match_timediff . . . $enable_match_timediff])
7758AC_MSG_RESULT([ match_value . . . . . $enable_match_value])
7759AC_MSG_RESULT([ mbmon . . . . . . . . $enable_mbmon])
4ebf1f93 7760AC_MSG_RESULT([ mcelog . . . . . . . $enable_mcelog])
646b20c3 7761AC_MSG_RESULT([ md . . . . . . . . . $enable_md])
ccf4cd87 7762AC_MSG_RESULT([ mdevents . . . . . . $enable_mdevents])
646b20c3
SH
7763AC_MSG_RESULT([ memcachec . . . . . . $enable_memcachec])
7764AC_MSG_RESULT([ memcached . . . . . . $enable_memcached])
7765AC_MSG_RESULT([ memory . . . . . . . $enable_memory])
7766AC_MSG_RESULT([ mic . . . . . . . . . $enable_mic])
2f15c704 7767AC_MSG_RESULT([ mmc . . . . . . . . . $enable_mmc])
646b20c3
SH
7768AC_MSG_RESULT([ modbus . . . . . . . $enable_modbus])
7769AC_MSG_RESULT([ mqtt . . . . . . . . $enable_mqtt])
7770AC_MSG_RESULT([ multimeter . . . . . $enable_multimeter])
7771AC_MSG_RESULT([ mysql . . . . . . . . $enable_mysql])
7772AC_MSG_RESULT([ netapp . . . . . . . $enable_netapp])
7773AC_MSG_RESULT([ netlink . . . . . . . $enable_netlink])
004d21de 7774AC_MSG_RESULT([ netstat_udp . . . . . $enable_netstat_udp])
646b20c3
SH
7775AC_MSG_RESULT([ network . . . . . . . $enable_network])
7776AC_MSG_RESULT([ nfs . . . . . . . . . $enable_nfs])
7777AC_MSG_RESULT([ nginx . . . . . . . . $enable_nginx])
7778AC_MSG_RESULT([ notify_desktop . . . $enable_notify_desktop])
7779AC_MSG_RESULT([ notify_email . . . . $enable_notify_email])
7780AC_MSG_RESULT([ notify_nagios . . . . $enable_notify_nagios])
7781AC_MSG_RESULT([ ntpd . . . . . . . . $enable_ntpd])
7782AC_MSG_RESULT([ numa . . . . . . . . $enable_numa])
7783AC_MSG_RESULT([ nut . . . . . . . . . $enable_nut])
7784AC_MSG_RESULT([ olsrd . . . . . . . . $enable_olsrd])
7785AC_MSG_RESULT([ onewire . . . . . . . $enable_onewire])
7786AC_MSG_RESULT([ openldap . . . . . . $enable_openldap])
7787AC_MSG_RESULT([ openvpn . . . . . . . $enable_openvpn])
7788AC_MSG_RESULT([ oracle . . . . . . . $enable_oracle])
38176b31 7789AC_MSG_RESULT([ ovs_events . . . . . $enable_ovs_events])
481983e0 7790AC_MSG_RESULT([ ovs_stats . . . . . . $enable_ovs_stats])
81467859 7791AC_MSG_RESULT([ pcie_errors . . . . . $enable_pcie_errors])
646b20c3
SH
7792AC_MSG_RESULT([ perl . . . . . . . . $enable_perl])
7793AC_MSG_RESULT([ pf . . . . . . . . . $enable_pf])
7794AC_MSG_RESULT([ pinba . . . . . . . . $enable_pinba])
7795AC_MSG_RESULT([ ping . . . . . . . . $enable_ping])
7796AC_MSG_RESULT([ postgresql . . . . . $enable_postgresql])
7797AC_MSG_RESULT([ powerdns . . . . . . $enable_powerdns])
7798AC_MSG_RESULT([ processes . . . . . . $enable_processes])
6ff769e0 7799AC_MSG_RESULT([ procevent . . . . . . $enable_procevent])
646b20c3
SH
7800AC_MSG_RESULT([ protocols . . . . . . $enable_protocols])
7801AC_MSG_RESULT([ python . . . . . . . $enable_python])
df7b529e 7802AC_MSG_RESULT([ ras . . . . . . . . . $enable_ras])
bca2ce37 7803AC_MSG_RESULT([ redfish . . . . . . . $enable_redfish])
646b20c3
SH
7804AC_MSG_RESULT([ redis . . . . . . . . $enable_redis])
7805AC_MSG_RESULT([ routeros . . . . . . $enable_routeros])
7806AC_MSG_RESULT([ rrdcached . . . . . . $enable_rrdcached])
7807AC_MSG_RESULT([ rrdtool . . . . . . . $enable_rrdtool])
7808AC_MSG_RESULT([ sensors . . . . . . . $enable_sensors])
7809AC_MSG_RESULT([ serial . . . . . . . $enable_serial])
7810AC_MSG_RESULT([ sigrok . . . . . . . $enable_sigrok])
6139038f 7811AC_MSG_RESULT([ slurm . . . . . . . . $enable_slurm])
646b20c3
SH
7812AC_MSG_RESULT([ smart . . . . . . . . $enable_smart])
7813AC_MSG_RESULT([ snmp . . . . . . . . $enable_snmp])
8aba9d6e 7814AC_MSG_RESULT([ snmp_agent . . . . . $enable_snmp_agent])
646b20c3
SH
7815AC_MSG_RESULT([ statsd . . . . . . . $enable_statsd])
7816AC_MSG_RESULT([ swap . . . . . . . . $enable_swap])
813cfffe 7817AC_MSG_RESULT([ synproxy . . . . . . $enable_synproxy])
6021d68d 7818AC_MSG_RESULT([ sysevent. . . . . . . $enable_sysevent])
646b20c3
SH
7819AC_MSG_RESULT([ syslog . . . . . . . $enable_syslog])
7820AC_MSG_RESULT([ table . . . . . . . . $enable_table])
7821AC_MSG_RESULT([ tail_csv . . . . . . $enable_tail_csv])
7822AC_MSG_RESULT([ tail . . . . . . . . $enable_tail])
7823AC_MSG_RESULT([ tape . . . . . . . . $enable_tape])
7824AC_MSG_RESULT([ target_notification . $enable_target_notification])
7825AC_MSG_RESULT([ target_replace . . . $enable_target_replace])
7826AC_MSG_RESULT([ target_scale . . . . $enable_target_scale])
7827AC_MSG_RESULT([ target_set . . . . . $enable_target_set])
7828AC_MSG_RESULT([ target_v5upgrade . . $enable_target_v5upgrade])
7829AC_MSG_RESULT([ tcpconns . . . . . . $enable_tcpconns])
7830AC_MSG_RESULT([ teamspeak2 . . . . . $enable_teamspeak2])
7831AC_MSG_RESULT([ ted . . . . . . . . . $enable_ted])
7832AC_MSG_RESULT([ thermal . . . . . . . $enable_thermal])
7833AC_MSG_RESULT([ threshold . . . . . . $enable_threshold])
7834AC_MSG_RESULT([ tokyotyrant . . . . . $enable_tokyotyrant])
7835AC_MSG_RESULT([ turbostat . . . . . . $enable_turbostat])
71144b36 7836AC_MSG_RESULT([ ubi . . . . . . . . . $enable_ubi])
646b20c3
SH
7837AC_MSG_RESULT([ unixsock . . . . . . $enable_unixsock])
7838AC_MSG_RESULT([ uptime . . . . . . . $enable_uptime])
7839AC_MSG_RESULT([ users . . . . . . . . $enable_users])
7840AC_MSG_RESULT([ uuid . . . . . . . . $enable_uuid])
7841AC_MSG_RESULT([ varnish . . . . . . . $enable_varnish])
7842AC_MSG_RESULT([ virt . . . . . . . . $enable_virt])
7843AC_MSG_RESULT([ vmem . . . . . . . . $enable_vmem])
7844AC_MSG_RESULT([ vserver . . . . . . . $enable_vserver])
7845AC_MSG_RESULT([ wireless . . . . . . $enable_wireless])
7846AC_MSG_RESULT([ write_graphite . . . $enable_write_graphite])
7847AC_MSG_RESULT([ write_http . . . . . $enable_write_http])
605fcdcd 7848AC_MSG_RESULT([ write_influxdb_udp. . $enable_write_influxdb_udp])
646b20c3
SH
7849AC_MSG_RESULT([ write_kafka . . . . . $enable_write_kafka])
7850AC_MSG_RESULT([ write_log . . . . . . $enable_write_log])
7851AC_MSG_RESULT([ write_mongodb . . . . $enable_write_mongodb])
cc893903 7852AC_MSG_RESULT([ write_prometheus. . . $enable_write_prometheus])
646b20c3
SH
7853AC_MSG_RESULT([ write_redis . . . . . $enable_write_redis])
7854AC_MSG_RESULT([ write_riemann . . . . $enable_write_riemann])
7855AC_MSG_RESULT([ write_sensu . . . . . $enable_write_sensu])
2f7fd156 7856AC_MSG_RESULT([ write_stackdriver . . $enable_write_stackdriver])
cc0fe328 7857AC_MSG_RESULT([ write_syslog . . . . $enable_write_syslog])
646b20c3
SH
7858AC_MSG_RESULT([ write_tsdb . . . . . $enable_write_tsdb])
7859AC_MSG_RESULT([ xencpu . . . . . . . $enable_xencpu])
7860AC_MSG_RESULT([ xmms . . . . . . . . $enable_xmms])
7861AC_MSG_RESULT([ zfs_arc . . . . . . . $enable_zfs_arc])
7862AC_MSG_RESULT([ zone . . . . . . . . $enable_zone])
7863AC_MSG_RESULT([ zookeeper . . . . . . $enable_zookeeper])
7864AC_MSG_RESULT()
8757c918 7865
9276a813 7866if test "x$dependency_error" = "xyes"; then
865f2eb3 7867 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
cb622208
SH
7868fi
7869
7870if test "x$dependency_warning" = "xyes"; then
865f2eb3 7871 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
9276a813 7872fi
332cf199 7873
865f2eb3 7874# vim: set fdm=marker sw=2 sts=2 ts=2 et :
df135922 7875