1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
3 AC_CONFIG_SRCDIR(src/)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
8 # libtool >= 2.2
9 [
10 LT_CONFIG_LTDL_DIR([libltdl])
11 LT_INIT([dlopen])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
14 ]
15 ,
16 # libtool <= 1.5
17 [
18 AC_LIBLTDL_CONVENIENCE
19 AC_SUBST(LTDLINCL)
20 AC_SUBST(LIBLTDL)
21 AC_LIBTOOL_DLOPEN
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
24 ]
25 )
27 AM_INIT_AUTOMAKE([tar-pax dist-bzip2 foreign])
28 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
29 AC_LANG(C)
31 AC_PREFIX_DEFAULT("/opt/collectd")
33 AC_SYS_LARGEFILE
35 #
36 # Checks for programs.
37 #
38 AC_PROG_CC
39 AC_PROG_CPP
40 AC_PROG_INSTALL
41 AC_PROG_LN_S
42 AC_PROG_MAKE_SET
43 AM_PROG_CC_C_O
44 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
46 AC_DISABLE_STATIC
47 AC_PROG_LIBTOOL
48 AC_PROG_LEX
49 AC_PROG_YACC
50 PKG_PROG_PKG_CONFIG
52 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
53 AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h],
54 [have_protobuf_c_h="yes"],
55 [have_protobuf_c_h="no"])
56 if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes"
57 then
58 have_protoc_c="no (unable to find <google/protobuf-c/protobuf-c.h>)"
59 fi
60 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
62 AC_MSG_CHECKING([for kernel type ($host_os)])
63 case $host_os in
64 *linux*)
65 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
66 ac_system="Linux"
67 ;;
68 *solaris*)
69 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
70 ac_system="Solaris"
71 ;;
72 *darwin*)
73 AC_DEFINE([KERNEL_DARWIN], 1, [True if program is to be compiled for a Darwin kernel])
74 ac_system="Darwin"
75 ;;
76 *openbsd*)
77 AC_DEFINE([KERNEL_OPENBSD], 1, [True if program is to be compiled for an OpenBSD kernel])
78 ac_system="OpenBSD"
79 ;;
80 *aix*)
81 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
82 ac_system="AIX"
83 ;;
84 *freebsd*)
85 AC_DEFINE([KERNEL_FREEBSD], 1, [True if program is to be compiled for a FreeBSD kernel])
86 ac_system="FreeBSD"
87 ;;
88 *)
89 ac_system="unknown"
90 esac
91 AC_MSG_RESULT([$ac_system])
93 AM_CONDITIONAL([BUILD_LINUX],[test "x$x$ac_system" = "xLinux"])
94 AM_CONDITIONAL([BUILD_SOLARIS],[test "x$x$ac_system" = "xSolaris"])
95 AM_CONDITIONAL([BUILD_DARWIN],[test "x$x$ac_system" = "xDarwin"])
96 AM_CONDITIONAL([BUILD_OPENBSD],[test "x$x$ac_system" = "xOpenBSD"])
97 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
98 AM_CONDITIONAL([BUILD_FREEBSD],[test "x$x$ac_system" = "xFreeBSD"])
100 if test "x$ac_system" = "xLinux"
101 then
102 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
103 if test -z "$KERNEL_DIR"
104 then
105 KERNEL_DIR="/lib/modules/`uname -r`/source"
106 fi
108 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
109 AC_SUBST(KERNEL_CFLAGS)
110 fi
112 if test "x$ac_system" = "xSolaris"
113 then
114 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
115 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
117 AC_MSG_CHECKING([whether compiler builds 64bit binaries])
118 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
119 #ifndef _LP64
120 # error "Compiler not in 64bit mode."
121 #endif
122 ])],
123 [AC_MSG_RESULT([yes])],
124 [
125 AC_MSG_RESULT([no])
126 AC_MSG_NOTICE([Solaris detected. Please consider building a 64-bit binary.])
127 ])
128 fi
130 if test "x$ac_system" = "xAIX"
131 then
132 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
133 fi
135 # Where to install .pc files.
136 pkgconfigdir="${libdir}/pkgconfig"
137 AC_SUBST(pkgconfigdir)
139 # Check for standards compliance mode
140 AC_ARG_ENABLE(standards,
141 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
142 [enable_standards="$enableval"],
143 [enable_standards="no"])
144 if test "x$enable_standards" = "xyes"
145 then
146 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
147 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
148 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
149 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
150 if test "x$GCC" = "xyes"
151 then
152 CFLAGS="$CFLAGS -std=c99"
153 fi
154 fi
155 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
157 #
158 # Checks for header files.
159 #
160 AC_HEADER_STDC
161 AC_HEADER_SYS_WAIT
162 AC_HEADER_DIRENT
163 AC_HEADER_STDBOOL
165 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.h)
167 # For ping library
168 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
169 [#if HAVE_STDINT_H
170 # include <stdint.h>
171 #endif
172 #if HAVE_SYS_TYPES_H
173 # include <sys/types.h>
174 #endif
175 ])
176 AC_CHECK_HEADERS(netinet/in.h, [], [],
177 [#if HAVE_STDINT_H
178 # include <stdint.h>
179 #endif
180 #if HAVE_SYS_TYPES_H
181 # include <sys/types.h>
182 #endif
183 #if HAVE_NETINET_IN_SYSTM_H
184 # include <netinet/in_systm.h>
185 #endif
186 ])
187 AC_CHECK_HEADERS(netinet/ip.h, [], [],
188 [#if HAVE_STDINT_H
189 # include <stdint.h>
190 #endif
191 #if HAVE_SYS_TYPES_H
192 # include <sys/types.h>
193 #endif
194 #if HAVE_NETINET_IN_SYSTM_H
195 # include <netinet/in_systm.h>
196 #endif
197 #if HAVE_NETINET_IN_H
198 # include <netinet/in.h>
199 #endif
200 ])
201 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
202 [#if HAVE_STDINT_H
203 # include <stdint.h>
204 #endif
205 #if HAVE_SYS_TYPES_H
206 # include <sys/types.h>
207 #endif
208 #if HAVE_NETINET_IN_SYSTM_H
209 # include <netinet/in_systm.h>
210 #endif
211 #if HAVE_NETINET_IN_H
212 # include <netinet/in.h>
213 #endif
214 #if HAVE_NETINET_IP_H
215 # include <netinet/ip.h>
216 #endif
217 ])
218 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
219 [#if HAVE_STDINT_H
220 # include <stdint.h>
221 #endif
222 #if HAVE_SYS_TYPES_H
223 # include <sys/types.h>
224 #endif
225 #if HAVE_NETINET_IN_SYSTM_H
226 # include <netinet/in_systm.h>
227 #endif
228 #if HAVE_NETINET_IN_H
229 # include <netinet/in.h>
230 #endif
231 #if HAVE_NETINET_IP_H
232 # include <netinet/ip.h>
233 #endif
234 ])
235 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
236 [#if HAVE_STDINT_H
237 # include <stdint.h>
238 #endif
239 #if HAVE_SYS_TYPES_H
240 # include <sys/types.h>
241 #endif
242 #if HAVE_NETINET_IN_SYSTM_H
243 # include <netinet/in_systm.h>
244 #endif
245 #if HAVE_NETINET_IN_H
246 # include <netinet/in.h>
247 #endif
248 ])
249 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
250 [#if HAVE_STDINT_H
251 # include <stdint.h>
252 #endif
253 #if HAVE_SYS_TYPES_H
254 # include <sys/types.h>
255 #endif
256 #if HAVE_NETINET_IN_SYSTM_H
257 # include <netinet/in_systm.h>
258 #endif
259 #if HAVE_NETINET_IN_H
260 # include <netinet/in.h>
261 #endif
262 #if HAVE_NETINET_IP6_H
263 # include <netinet/ip6.h>
264 #endif
265 ])
266 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
267 [#if HAVE_STDINT_H
268 # include <stdint.h>
269 #endif
270 #if HAVE_SYS_TYPES_H
271 # include <sys/types.h>
272 #endif
273 #if HAVE_NETINET_IN_SYSTM_H
274 # include <netinet/in_systm.h>
275 #endif
276 #if HAVE_NETINET_IN_H
277 # include <netinet/in.h>
278 #endif
279 #if HAVE_NETINET_IP_H
280 # include <netinet/ip.h>
281 #endif
282 ])
283 AC_CHECK_HEADERS(netinet/udp.h, [], [],
284 [#if HAVE_STDINT_H
285 # include <stdint.h>
286 #endif
287 #if HAVE_SYS_TYPES_H
288 # include <sys/types.h>
289 #endif
290 #if HAVE_NETINET_IN_SYSTM_H
291 # include <netinet/in_systm.h>
292 #endif
293 #if HAVE_NETINET_IN_H
294 # include <netinet/in.h>
295 #endif
296 #if HAVE_NETINET_IP_H
297 # include <netinet/ip.h>
298 #endif
299 ])
301 have_ip6_ext="no"
302 AC_CHECK_TYPES([struct ip6_ext], [have_ip6_ext="yes"], [have_ip6_ext="no"],
303 [#if HAVE_STDINT_H
304 # include <stdint.h>
305 #endif
306 #if HAVE_SYS_TYPES_H
307 # include <sys/types.h>
308 #endif
309 #if HAVE_NETINET_IN_SYSTM_H
310 # include <netinet/in_systm.h>
311 #endif
312 #if HAVE_NETINET_IN_H
313 # include <netinet/in.h>
314 #endif
315 #if HAVE_NETINET_IP6_H
316 # include <netinet/ip6.h>
317 #endif
318 ])
320 if test "x$have_ip6_ext" = "xno"; then
321 SAVE_CFLAGS="$CFLAGS"
322 CFLAGS="$CFLAGS -DSOLARIS2=8"
324 AC_CHECK_TYPES([struct ip6_ext],
325 [have_ip6_ext="yes, with -DSOLARIS2=8"],
326 [have_ip6_ext="no"],
327 [#if HAVE_STDINT_H
328 # include <stdint.h>
329 #endif
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_IP6_H
340 # include <netinet/ip6.h>
341 #endif
342 ])
344 if test "x$have_ip6_ext" = "xno"; then
345 CFLAGS="$SAVE_CFLAGS"
346 fi
347 fi
349 # For cpu modules
350 AC_CHECK_HEADERS(sys/dkstat.h)
351 if test "x$ac_system" = "xDarwin"
352 then
353 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
354 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
355 # For the battery plugin
356 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
357 [
358 #if HAVE_IOKIT_IOKITLIB_H
359 # include <IOKit/IOKitLib.h>
360 #endif
361 #if HAVE_IOKIT_IOTYPES_H
362 # include <IOKit/IOTypes.h>
363 #endif
364 ])
366 fi
368 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
369 [
370 #if HAVE_SYS_TYPES_H
371 # include <sys/types.h>
372 #endif
373 #if HAVE_SYS_PARAM_H
374 # include <sys/param.h>
375 #endif
376 ])
378 AC_MSG_CHECKING([for sysctl kern.cp_times])
379 if test -x /sbin/sysctl
380 then
381 /sbin/sysctl kern.cp_times 2>/dev/null
382 if test $? -eq 0
383 then
384 AC_MSG_RESULT([yes])
385 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
386 [Define if sysctl supports kern.cp_times])
387 else
388 AC_MSG_RESULT([no])
389 fi
390 else
391 AC_MSG_RESULT([no])
392 fi
394 # For hddtemp module
395 AC_CHECK_HEADERS(linux/major.h)
397 # For md module (Linux only)
398 if test "x$ac_system" = "xLinux"
399 then
400 AC_CHECK_HEADERS(linux/raid/md_u.h,
401 [have_linux_raid_md_u_h="yes"],
402 [have_linux_raid_md_u_h="no"],
403 [
404 #include <sys/ioctl.h>
405 #include <linux/major.h>
406 #include <linux/types.h>
407 ])
408 else
409 have_linux_raid_md_u_h="no"
410 fi
412 # For the swap module
413 have_linux_wireless_h="no"
414 if test "x$ac_system" = "xLinux"
415 then
416 AC_CHECK_HEADERS(linux/wireless.h,
417 [have_linux_wireless_h="yes"],
418 [have_linux_wireless_h="no"],
419 [
420 #include <dirent.h>
421 #include <sys/ioctl.h>
422 #include <sys/socket.h>
423 ])
424 fi
426 # For the swap module
427 have_sys_swap_h="yes"
428 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
429 [
430 #undef _FILE_OFFSET_BITS
431 #undef _LARGEFILE64_SOURCE
432 #if HAVE_SYS_TYPES_H
433 # include <sys/types.h>
434 #endif
435 #if HAVE_SYS_PARAM_H
436 # include <sys/param.h>
437 #endif
438 ])
440 # For load module
441 # For the processes plugin
442 # For users module
443 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
445 # For interface plugin
446 AC_CHECK_HEADERS(ifaddrs.h)
447 AC_CHECK_HEADERS(net/if.h, [], [],
448 [
449 #if HAVE_SYS_TYPES_H
450 # include <sys/types.h>
451 #endif
452 #if HAVE_SYS_SOCKET_H
453 # include <sys/socket.h>
454 #endif
455 ])
456 AC_CHECK_HEADERS(linux/if.h, [], [],
457 [
458 #if HAVE_SYS_TYPES_H
459 # include <sys/types.h>
460 #endif
461 #if HAVE_SYS_SOCKET_H
462 # include <sys/socket.h>
463 #endif
464 ])
465 AC_CHECK_HEADERS(linux/inet_diag.h, [], [],
466 [
467 #if HAVE_SYS_TYPES_H
468 # include <sys/types.h>
469 #endif
470 #if HAVE_SYS_SOCKET_H
471 # include <sys/socket.h>
472 #endif
473 #if HAVE_LINUX_INET_DIAG_H
474 # include <linux/inet_diag.h>
475 #endif
476 ])
477 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
478 [
479 #if HAVE_SYS_TYPES_H
480 # include <sys/types.h>
481 #endif
482 #if HAVE_SYS_SOCKET_H
483 # include <sys/socket.h>
484 #endif
485 #if HAVE_LINUX_IF_H
486 # include <linux/if.h>
487 #endif
488 ])
490 # For ethstat module
491 AC_CHECK_HEADERS(linux/sockios.h,
492 [have_linux_sockios_h="yes"],
493 [have_linux_sockios_h="no"],
494 [
495 #if HAVE_SYS_IOCTL_H
496 # include <sys/ioctl.h>
497 #endif
498 #if HAVE_NET_IF_H
499 # include <net/if.h>
500 #endif
501 ])
502 AC_CHECK_HEADERS(linux/ethtool.h,
503 [have_linux_ethtool_h="yes"],
504 [have_linux_ethtool_h="no"],
505 [
506 #if HAVE_SYS_IOCTL_H
507 # include <sys/ioctl.h>
508 #endif
509 #if HAVE_NET_IF_H
510 # include <net/if.h>
511 #endif
512 #if HAVE_LINUX_SOCKIOS_H
513 # include <linux/sockios.h>
514 #endif
515 ])
517 # For ipvs module
518 have_linux_ip_vs_h="no"
519 have_net_ip_vs_h="no"
520 have_ip_vs_h="no"
521 ip_vs_h_needs_kernel_cflags="no"
522 if test "x$ac_system" = "xLinux"
523 then
524 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
525 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
526 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
528 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
529 then
530 SAVE_CFLAGS="$CFLAGS"
531 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
533 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
535 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
536 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
537 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
539 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
540 then
541 ip_vs_h_needs_kernel_cflags="yes"
542 fi
544 CFLAGS="$SAVE_CFLAGS"
545 fi
546 fi
547 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
549 # For quota module
550 AC_CHECK_HEADERS(sys/ucred.h, [], [],
551 [
552 #if HAVE_SYS_TYPES_H
553 # include <sys/types.h>
554 #endif
555 #if HAVE_SYS_PARAM_H
556 # include <sys/param.h>
557 #endif
558 ])
560 # For mount interface
561 AC_CHECK_HEADERS(sys/mount.h, [], [],
562 [
563 #if HAVE_SYS_TYPES_H
564 # include <sys/types.h>
565 #endif
566 #if HAVE_SYS_PARAM_H
567 # include <sys/param.h>
568 #endif
569 ])
571 # For the email plugin
572 AC_CHECK_HEADERS(linux/un.h, [], [],
573 [
574 #if HAVE_SYS_SOCKET_H
575 # include <sys/socket.h>
576 #endif
577 ])
579 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h sys/vmmeter.h kvm.h wordexp.h locale.h)
581 # For the dns plugin
582 AC_CHECK_HEADERS(arpa/nameser.h)
583 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
584 [
585 #if HAVE_ARPA_NAMESER_H
586 # include <arpa/nameser.h>
587 #endif
588 ])
590 AC_CHECK_HEADERS(net/if_arp.h, [], [],
591 [#if HAVE_SYS_SOCKET_H
592 # include <sys/socket.h>
593 #endif
594 ])
595 AC_CHECK_HEADERS(net/ppp_defs.h)
596 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
597 [#if HAVE_NET_PPP_DEFS_H
598 # include <net/ppp_defs.h>
599 #endif
600 ])
601 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
602 [#if HAVE_STDINT_H
603 # include <stdint.h>
604 #endif
605 #if HAVE_SYS_TYPES_H
606 # include <sys/types.h>
607 #endif
608 #if HAVE_SYS_SOCKET_H
609 # include <sys/socket.h>
610 #endif
611 #if HAVE_NET_IF_H
612 # include <net/if.h>
613 #endif
614 #if HAVE_NETINET_IN_H
615 # include <netinet/in.h>
616 #endif
617 ])
619 AC_CHECK_HEADERS(netinet/ip_compat.h)
621 have_net_pfvar_h="no"
622 AC_CHECK_HEADERS(net/pfvar.h,
623 [have_net_pfvar_h="yes"],
624 [have_net_pfvar_h="no"],
625 [
626 #if HAVE_SYS_IOCTL_H
627 # include <sys/ioctl.h>
628 #endif
629 #if HAVE_SYS_SOCKET_H
630 # include <sys/socket.h>
631 #endif
632 #if HAVE_NET_IF_H
633 # include <net/if.h>
634 #endif
635 ])
637 # For the multimeter plugin
638 have_termios_h="no"
639 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
641 # For the turbostat plugin
642 have_asm_msrindex_h="no"
643 AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"])
645 if test "x$have_asm_msrindex_h" = "xyes"
646 then
647 AC_CACHE_CHECK([whether asm/msr-index.h has MSR_PKG_C10_RESIDENCY],
648 [c_cv_have_usable_asm_msrindex_h],
649 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
650 [[[
651 #include<asm/msr-index.h>
652 ]]],
653 [[[
654 int y = MSR_PKG_C10_RESIDENCY;
655 return(y);
656 ]]]
657 )],
658 [c_cv_have_usable_asm_msrindex_h="yes"],
659 [c_cv_have_usable_asm_msrindex_h="no"],
660 )
661 )
662 fi
664 have_cpuid_h="no"
665 AC_CHECK_HEADERS(cpuid.h, [have_cpuid_h="yes"])
667 AC_CHECK_HEADERS(sys/capability.h)
668 #
669 # Checks for typedefs, structures, and compiler characteristics.
670 #
671 AC_C_CONST
672 AC_C_INLINE
673 AC_TYPE_OFF_T
674 AC_TYPE_PID_T
675 AC_TYPE_SIZE_T
676 AC_TYPE_SSIZE_T
677 AC_TYPE_UID_T
678 AC_TYPE_UINT32_T
679 AC_HEADER_TIME
681 #
682 # Checks for library functions.
683 #
684 AC_PROG_GCC_TRADITIONAL
685 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname setlocale)
687 AC_FUNC_STRERROR_R
689 SAVE_CFLAGS="$CFLAGS"
690 # Emulate behavior of src/Makefile.am
691 if test "x$GCC" = "xyes"
692 then
693 CFLAGS="$CFLAGS -Wall -Werror"
694 fi
696 AC_CACHE_CHECK([for strtok_r],
697 [c_cv_have_strtok_r_default],
698 AC_LINK_IFELSE(
699 [AC_LANG_PROGRAM(
700 [[[
701 #include <stdlib.h>
702 #include <stdio.h>
703 #include <string.h>
704 ]]],
705 [[[
706 char buffer[] = "foo,bar,baz";
707 char *token;
708 char *dummy;
709 char *saveptr;
711 dummy = buffer;
712 saveptr = NULL;
713 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
714 {
715 dummy = NULL;
716 printf ("token = %s;\n", token);
717 }
718 ]]]
719 )],
720 [c_cv_have_strtok_r_default="yes"],
721 [c_cv_have_strtok_r_default="no"]
722 )
723 )
725 if test "x$c_cv_have_strtok_r_default" = "xno"
726 then
727 CFLAGS="$CFLAGS -D_REENTRANT=1"
729 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
730 [c_cv_have_strtok_r_reentrant],
731 AC_LINK_IFELSE(
732 [AC_LANG_PROGRAM(
733 [[[
734 #include <stdlib.h>
735 #include <stdio.h>
736 #include <string.h>
737 ]]],
738 [[[
739 char buffer[] = "foo,bar,baz";
740 char *token;
741 char *dummy;
742 char *saveptr;
744 dummy = buffer;
745 saveptr = NULL;
746 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
747 {
748 dummy = NULL;
749 printf ("token = %s;\n", token);
750 }
751 ]]]
752 )],
753 [c_cv_have_strtok_r_reentrant="yes"],
754 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
755 )
756 )
757 fi
759 CFLAGS="$SAVE_CFLAGS"
760 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
761 then
762 CFLAGS="$CFLAGS -D_REENTRANT=1"
763 fi
765 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
767 socket_needs_socket="no"
768 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
769 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
771 clock_gettime_needs_rt="no"
772 clock_gettime_needs_posix4="no"
773 have_clock_gettime="no"
774 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
775 if test "x$have_clock_gettime" = "xno"
776 then
777 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
778 have_clock_gettime="yes"])
779 fi
780 if test "x$have_clock_gettime" = "xno"
781 then
782 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
783 have_clock_gettime="yes"])
784 fi
785 if test "x$have_clock_gettime" = "xyes"
786 then
787 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
788 else
789 AC_MSG_WARN(cannot find clock_gettime)
790 fi
792 nanosleep_needs_rt="no"
793 nanosleep_needs_posix4="no"
794 AC_CHECK_FUNCS(nanosleep,
795 [],
796 AC_CHECK_LIB(rt, nanosleep,
797 [nanosleep_needs_rt="yes"],
798 AC_CHECK_LIB(posix4, nanosleep,
799 [nanosleep_needs_posix4="yes"],
800 AC_MSG_ERROR(cannot find nanosleep))))
802 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
803 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
805 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
806 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
807 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
808 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
809 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
810 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
811 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
812 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
813 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
814 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
815 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
816 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
818 # Check for strptime {{{
819 if test "x$GCC" = "xyes"
820 then
821 SAVE_CFLAGS="$CFLAGS"
822 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
823 fi
825 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
826 if test "x$have_strptime" = "xyes"
827 then
828 AC_CACHE_CHECK([whether strptime is exported by default],
829 [c_cv_have_strptime_default],
830 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
831 [[[
832 #include <time.h>
833 ]]],
834 [[[
835 struct tm stm;
836 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
837 ]]]
838 )],
839 [c_cv_have_strptime_default="yes"],
840 [c_cv_have_strptime_default="no"]))
841 fi
842 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
843 then
844 AC_CACHE_CHECK([whether strptime needs standards mode],
845 [c_cv_have_strptime_standards],
846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
847 [[[
848 #ifndef _ISOC99_SOURCE
849 # define _ISOC99_SOURCE 1
850 #endif
851 #ifndef _POSIX_C_SOURCE
852 # define _POSIX_C_SOURCE 200112L
853 #endif
854 #ifndef _XOPEN_SOURCE
855 # define _XOPEN_SOURCE 500
856 #endif
857 #include <time.h>
858 ]]],
859 [[[
860 struct tm stm;
861 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
862 ]]]
863 )],
864 [c_cv_have_strptime_standards="yes"],
865 [c_cv_have_strptime_standards="no"]))
867 if test "x$c_cv_have_strptime_standards" = "xyes"
868 then
869 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
870 else
871 have_strptime="no"
872 fi
873 fi
875 if test "x$GCC" = "xyes"
876 then
877 CFLAGS="$SAVE_CFLAGS"
878 fi
879 # }}} Check for strptime
881 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
882 if test "x$have_swapctl" = "xyes"; then
883 AC_CACHE_CHECK([whether swapctl takes two arguments],
884 [c_cv_have_swapctl_two_args],
885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
886 [[[
887 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
888 # undef _FILE_OFFSET_BITS
889 # undef _LARGEFILE64_SOURCE
890 #endif
891 #include <sys/stat.h>
892 #include <sys/param.h>
893 #include <sys/swap.h>
894 #include <unistd.h>
895 ]]],
896 [[[
897 int num = swapctl(0, NULL);
898 ]]]
899 )],
900 [c_cv_have_swapctl_two_args="yes"],
901 [c_cv_have_swapctl_two_args="no"]
902 )
903 )
904 AC_CACHE_CHECK([whether swapctl takes three arguments],
905 [c_cv_have_swapctl_three_args],
906 AC_COMPILE_IFELSE(
907 [AC_LANG_PROGRAM(
908 [[[
909 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
910 # undef _FILE_OFFSET_BITS
911 # undef _LARGEFILE64_SOURCE
912 #endif
913 #include <sys/stat.h>
914 #include <sys/param.h>
915 #include <sys/swap.h>
916 #include <unistd.h>
917 ]]],
918 [[[
919 int num = swapctl(0, NULL, 0);
920 ]]]
921 )],
922 [c_cv_have_swapctl_three_args="yes"],
923 [c_cv_have_swapctl_three_args="no"]
924 )
925 )
926 fi
927 # Check for different versions of `swapctl' here..
928 if test "x$have_swapctl" = "xyes"; then
929 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
930 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
931 [Define if the function swapctl exists and takes two arguments.])
932 fi
933 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
934 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
935 [Define if the function swapctl exists and takes three arguments.])
936 fi
937 fi
939 # Check for NAN
940 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
941 [
942 if test "x$withval" = "xno"; then
943 nan_type="none"
944 else if test "x$withval" = "xyes"; then
945 nan_type="zero"
946 else
947 nan_type="$withval"
948 fi; fi
949 ],
950 [nan_type="none"])
951 if test "x$nan_type" = "xnone"; then
952 AC_CACHE_CHECK([whether NAN is defined by default],
953 [c_cv_have_nan_default],
954 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
955 [[[
956 #include <stdlib.h>
957 #include <math.h>
958 static double foo = NAN;
959 ]]],
960 [[[
961 if (isnan (foo))
962 return 0;
963 else
964 return 1;
965 ]]]
966 )],
967 [c_cv_have_nan_default="yes"],
968 [c_cv_have_nan_default="no"]
969 )
970 )
971 if test "x$c_cv_have_nan_default" = "xyes"
972 then
973 nan_type="default"
974 fi
975 fi
976 if test "x$nan_type" = "xnone"; then
977 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
978 [c_cv_have_nan_isoc],
979 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
980 [[[
981 #include <stdlib.h>
982 #define __USE_ISOC99 1
983 #include <math.h>
984 static double foo = NAN;
985 ]]],
986 [[[
987 if (isnan (foo))
988 return 0;
989 else
990 return 1;
991 ]]]
992 )],
993 [c_cv_have_nan_isoc="yes"],
994 [c_cv_have_nan_isoc="no"]
995 )
996 )
997 if test "x$c_cv_have_nan_isoc" = "xyes"
998 then
999 nan_type="isoc99"
1000 fi
1001 fi
1002 if test "x$nan_type" = "xnone"; then
1003 SAVE_LDFLAGS=$LDFLAGS
1004 LDFLAGS="$LDFLAGS -lm"
1005 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
1006 [c_cv_have_nan_zero],
1007 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1008 [[[
1009 #include <stdlib.h>
1010 #include <math.h>
1011 #ifdef NAN
1012 # undef NAN
1013 #endif
1014 #define NAN (0.0 / 0.0)
1015 #ifndef isnan
1016 # define isnan(f) ((f) != (f))
1017 #endif
1018 static double foo = NAN;
1019 ]]],
1020 [[[
1021 if (isnan (foo))
1022 return 0;
1023 else
1024 return 1;
1025 ]]]
1026 )],
1027 [c_cv_have_nan_zero="yes"],
1028 [c_cv_have_nan_zero="no"]
1029 )
1030 )
1031 LDFLAGS=$SAVE_LDFLAGS
1032 if test "x$c_cv_have_nan_zero" = "xyes"
1033 then
1034 nan_type="zero"
1035 fi
1036 fi
1038 if test "x$nan_type" = "xdefault"; then
1039 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
1040 [Define if NAN is defined by default and can initialize static variables.])
1041 else if test "x$nan_type" = "xisoc99"; then
1042 AC_DEFINE(NAN_STATIC_ISOC, 1,
1043 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
1044 else if test "x$nan_type" = "xzero"; then
1045 AC_DEFINE(NAN_ZERO_ZERO, 1,
1046 [Define if NAN can be defined as (0.0 / 0.0)])
1047 else
1048 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
1049 fi; fi; fi
1051 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
1052 [
1053 if test "x$withval" = "xnothing"; then
1054 fp_layout_type="nothing"
1055 else if test "x$withval" = "xendianflip"; then
1056 fp_layout_type="endianflip"
1057 else if test "x$withval" = "xintswap"; then
1058 fp_layout_type="intswap"
1059 else
1060 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
1061 fi; fi; fi
1062 ],
1063 [fp_layout_type="unknown"])
1065 if test "x$fp_layout_type" = "xunknown"; then
1066 AC_CACHE_CHECK([if doubles are stored in x86 representation],
1067 [c_cv_fp_layout_need_nothing],
1068 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1069 [[[
1070 #include <stdlib.h>
1071 #include <stdio.h>
1072 #include <string.h>
1073 #if HAVE_STDINT_H
1074 # include <stdint.h>
1075 #endif
1076 #if HAVE_INTTYPES_H
1077 # include <inttypes.h>
1078 #endif
1079 #if HAVE_STDBOOL_H
1080 # include <stdbool.h>
1081 #endif
1082 ]]],
1083 [[[
1084 uint64_t i0;
1085 uint64_t i1;
1086 uint8_t c[8];
1087 double d;
1089 d = 8.642135e130;
1090 memcpy ((void *) &i0, (void *) &d, 8);
1092 i1 = i0;
1093 memcpy ((void *) c, (void *) &i1, 8);
1095 if ((c[0] == 0x2f) && (c[1] == 0x25)
1096 && (c[2] == 0xc0) && (c[3] == 0xc7)
1097 && (c[4] == 0x43) && (c[5] == 0x2b)
1098 && (c[6] == 0x1f) && (c[7] == 0x5b))
1099 return (0);
1100 else
1101 return (1);
1102 ]]]
1103 )],
1104 [c_cv_fp_layout_need_nothing="yes"],
1105 [c_cv_fp_layout_need_nothing="no"]
1106 )
1107 )
1108 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1109 fp_layout_type="nothing"
1110 fi
1111 fi
1112 if test "x$fp_layout_type" = "xunknown"; then
1113 AC_CACHE_CHECK([if endianflip converts to x86 representation],
1114 [c_cv_fp_layout_need_endianflip],
1115 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1116 [[[
1117 #include <stdlib.h>
1118 #include <stdio.h>
1119 #include <string.h>
1120 #if HAVE_STDINT_H
1121 # include <stdint.h>
1122 #endif
1123 #if HAVE_INTTYPES_H
1124 # include <inttypes.h>
1125 #endif
1126 #if HAVE_STDBOOL_H
1127 # include <stdbool.h>
1128 #endif
1129 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1130 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1131 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1132 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1133 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1134 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1135 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1136 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1137 ]]],
1138 [[[
1139 uint64_t i0;
1140 uint64_t i1;
1141 uint8_t c[8];
1142 double d;
1144 d = 8.642135e130;
1145 memcpy ((void *) &i0, (void *) &d, 8);
1147 i1 = endianflip (i0);
1148 memcpy ((void *) c, (void *) &i1, 8);
1150 if ((c[0] == 0x2f) && (c[1] == 0x25)
1151 && (c[2] == 0xc0) && (c[3] == 0xc7)
1152 && (c[4] == 0x43) && (c[5] == 0x2b)
1153 && (c[6] == 0x1f) && (c[7] == 0x5b))
1154 return (0);
1155 else
1156 return (1);
1157 ]]]
1158 )],
1159 [c_cv_fp_layout_need_endianflip="yes"],
1160 [c_cv_fp_layout_need_endianflip="no"]
1161 )
1162 )
1163 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1164 fp_layout_type="endianflip"
1165 fi
1166 fi
1167 if test "x$fp_layout_type" = "xunknown"; then
1168 AC_CACHE_CHECK([if intswap converts to x86 representation],
1169 [c_cv_fp_layout_need_intswap],
1170 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1171 [[[
1172 #include <stdlib.h>
1173 #include <stdio.h>
1174 #include <string.h>
1175 #if HAVE_STDINT_H
1176 # include <stdint.h>
1177 #endif
1178 #if HAVE_INTTYPES_H
1179 # include <inttypes.h>
1180 #endif
1181 #if HAVE_STDBOOL_H
1182 # include <stdbool.h>
1183 #endif
1184 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1185 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1186 ]]],
1187 [[[
1188 uint64_t i0;
1189 uint64_t i1;
1190 uint8_t c[8];
1191 double d;
1193 d = 8.642135e130;
1194 memcpy ((void *) &i0, (void *) &d, 8);
1196 i1 = intswap (i0);
1197 memcpy ((void *) c, (void *) &i1, 8);
1199 if ((c[0] == 0x2f) && (c[1] == 0x25)
1200 && (c[2] == 0xc0) && (c[3] == 0xc7)
1201 && (c[4] == 0x43) && (c[5] == 0x2b)
1202 && (c[6] == 0x1f) && (c[7] == 0x5b))
1203 return (0);
1204 else
1205 return (1);
1206 ]]]
1207 )],
1208 [c_cv_fp_layout_need_intswap="yes"],
1209 [c_cv_fp_layout_need_intswap="no"]
1210 )
1211 )
1212 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1213 fp_layout_type="intswap"
1214 fi
1215 fi
1217 if test "x$fp_layout_type" = "xnothing"; then
1218 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1219 [Define if doubles are stored in x86 representation.])
1220 else if test "x$fp_layout_type" = "xendianflip"; then
1221 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1222 [Define if endianflip is needed to convert to x86 representation.])
1223 else if test "x$fp_layout_type" = "xintswap"; then
1224 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1225 [Define if intswap is needed to convert to x86 representation.])
1226 else
1227 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1228 fi; fi; fi
1230 # --with-useragent {{{
1231 AC_ARG_WITH(useragent, [AS_HELP_STRING([--with-useragent@<:@=AGENT@:>@], [User agent to use on http requests])],
1232 [
1233 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1234 then
1235 AC_DEFINE_UNQUOTED(COLLECTD_USERAGENT, ["$withval"], [User agent for http requests])
1236 fi
1237 ])
1239 # }}}
1241 have_getfsstat="no"
1242 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1243 have_getvfsstat="no"
1244 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1245 have_listmntent="no"
1246 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1247 have_getmntent_r="no"
1248 AC_CHECK_FUNCS(getmntent_r, [have_getmntent_r="yes"])
1250 have_getmntent="no"
1251 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1252 if test "x$have_getmntent" = "xno"; then
1253 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1254 fi
1255 if test "x$have_getmntent" = "xno"; then
1256 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1257 fi
1258 if test "x$have_getmntent" = "xno"; then
1259 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1260 fi
1262 if test "x$have_getmntent" = "xc"; then
1263 AC_CACHE_CHECK([whether getmntent takes one argument],
1264 [c_cv_have_one_getmntent],
1265 AC_COMPILE_IFELSE(
1266 [AC_LANG_PROGRAM(
1267 [[[
1268 #include "$srcdir/src/utils_mount.h"
1269 ]]],
1270 [[[
1271 FILE *fh;
1272 struct mntent *me;
1273 fh = setmntent ("/etc/mtab", "r");
1274 me = getmntent (fh);
1275 return(me->mnt_passno);
1276 ]]]
1277 )],
1278 [c_cv_have_one_getmntent="yes"],
1279 [c_cv_have_one_getmntent="no"]
1280 )
1281 )
1282 AC_CACHE_CHECK([whether getmntent takes two arguments],
1283 [c_cv_have_two_getmntent],
1284 AC_COMPILE_IFELSE(
1285 [AC_LANG_PROGRAM(
1286 [[[
1287 #include "$srcdir/src/utils_mount.h"
1288 ]]],
1289 [[[
1290 FILE *fh;
1291 struct mnttab mt;
1292 int status;
1293 fh = fopen ("/etc/mnttab", "r");
1294 status = getmntent (fh, &mt);
1295 return(status);
1296 ]]]
1297 )],
1298 [c_cv_have_two_getmntent="yes"],
1299 [c_cv_have_two_getmntent="no"]
1300 )
1301 )
1302 fi
1304 # Check for different versions of `getmntent' here..
1306 if test "x$have_getmntent" = "xc"; then
1307 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1308 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1309 [Define if the function getmntent exists and takes one argument.])
1310 fi
1311 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1312 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1313 [Define if the function getmntent exists and takes two arguments.])
1314 fi
1315 fi
1316 if test "x$have_getmntent" = "xsun"; then
1317 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1318 [Define if the function getmntent exists. It's the version from libsun.])
1319 fi
1320 if test "x$have_getmntent" = "xseq"; then
1321 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1322 [Define if the function getmntent exists. It's the version from libseq.])
1323 fi
1324 if test "x$have_getmntent" = "xgen"; then
1325 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1326 [Define if the function getmntent exists. It's the version from libgen.])
1327 fi
1329 # Check for htonll
1330 AC_CACHE_CHECK([if have htonll defined],
1331 [c_cv_have_htonll],
1332 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1333 [[[
1334 #include <sys/types.h>
1335 #include <netinet/in.h>
1336 #if HAVE_INTTYPES_H
1337 # include <inttypes.h>
1338 #endif
1339 ]]],
1340 [[[
1341 return htonll(0);
1342 ]]]
1343 )],
1344 [c_cv_have_htonll="yes"],
1345 [c_cv_have_htonll="no"]
1346 )
1347 )
1348 if test "x$c_cv_have_htonll" = "xyes"
1349 then
1350 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1351 fi
1353 # Check for structures
1354 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1355 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1356 [],
1357 [
1358 #include <sys/types.h>
1359 #include <sys/socket.h>
1360 #include <net/if.h>
1361 ])
1362 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1363 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1364 [],
1365 [
1366 #include <sys/types.h>
1367 #include <sys/socket.h>
1368 #include <linux/if.h>
1369 #include <linux/netdevice.h>
1370 ])
1371 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1372 [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1373 [],
1374 [
1375 #include <linux/inet_diag.h>
1376 ])
1379 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1380 [],
1381 [
1382 #include <netinet/in.h>
1383 #include <net/if.h>
1384 ])
1386 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1387 [
1388 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1389 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1390 have_struct_kinfo_proc_freebsd="yes"
1391 ],
1392 [
1393 have_struct_kinfo_proc_freebsd="no"
1394 ],
1395 [
1396 #include <kvm.h>
1397 #include <sys/param.h>
1398 #include <sys/sysctl.h>
1399 #include <sys/user.h>
1400 ])
1402 AC_CHECK_MEMBERS([struct kinfo_proc.p_pid, struct kinfo_proc.p_vm_rssize],
1403 [
1404 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1405 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1406 have_struct_kinfo_proc_openbsd="yes"
1407 ],
1408 [
1409 have_struct_kinfo_proc_openbsd="no"
1410 ],
1411 [
1412 #include <sys/param.h>
1413 #include <sys/sysctl.h>
1414 #include <kvm.h>
1415 ])
1417 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1418 [#define _BSD_SOURCE
1419 #define _DEFAULT_SOURCE
1420 #if HAVE_STDINT_H
1421 # include <stdint.h>
1422 #endif
1423 #if HAVE_SYS_TYPES_H
1424 # include <sys/types.h>
1425 #endif
1426 #if HAVE_NETINET_IN_SYSTM_H
1427 # include <netinet/in_systm.h>
1428 #endif
1429 #if HAVE_NETINET_IN_H
1430 # include <netinet/in.h>
1431 #endif
1432 #if HAVE_NETINET_IP_H
1433 # include <netinet/ip.h>
1434 #endif
1435 #if HAVE_NETINET_UDP_H
1436 # include <netinet/udp.h>
1437 #endif
1438 ])
1439 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1440 [#define _BSD_SOURCE
1441 #define _DEFAULT_SOURCE
1442 #if HAVE_STDINT_H
1443 # include <stdint.h>
1444 #endif
1445 #if HAVE_SYS_TYPES_H
1446 # include <sys/types.h>
1447 #endif
1448 #if HAVE_NETINET_IN_SYSTM_H
1449 # include <netinet/in_systm.h>
1450 #endif
1451 #if HAVE_NETINET_IN_H
1452 # include <netinet/in.h>
1453 #endif
1454 #if HAVE_NETINET_IP_H
1455 # include <netinet/ip.h>
1456 #endif
1457 #if HAVE_NETINET_UDP_H
1458 # include <netinet/udp.h>
1459 #endif
1460 ])
1462 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1463 [],
1464 [],
1465 [
1466 #if HAVE_KSTAT_H
1467 # include <kstat.h>
1468 #endif
1469 ])
1471 #
1472 # Checks for libraries begin here
1473 #
1475 with_libresolv="yes"
1476 AC_CHECK_LIB(resolv, res_search,
1477 [
1478 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1479 ],
1480 [with_libresolv="no"])
1481 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1483 dnl Check for HAL (hardware abstraction library)
1484 with_libhal="yes"
1485 AC_CHECK_LIB(hal,libhal_device_property_exists,
1486 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1487 [with_libhal="no"])
1488 if test "x$with_libhal" = "xyes"; then
1489 if test "x$PKG_CONFIG" != "x"; then
1490 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1491 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1492 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1493 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1494 fi
1495 fi
1497 m4_divert_once([HELP_WITH], [
1498 collectd additional packages:])
1500 if test "x$ac_system" = "xAIX"
1501 then
1502 with_perfstat="yes"
1503 with_procinfo="yes"
1504 else
1505 with_perfstat="no (AIX only)"
1506 with_procinfo="no (AIX only)"
1507 fi
1509 if test "x$with_perfstat" = "xyes"
1510 then
1511 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1512 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1513 fi
1514 if test "x$with_perfstat" = "xyes"
1515 then
1516 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1517 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1518 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1519 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1520 then
1521 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1522 fi
1523 fi
1524 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1526 # Processes plugin under AIX.
1527 if test "x$with_procinfo" = "xyes"
1528 then
1529 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1530 fi
1531 if test "x$with_procinfo" = "xyes"
1532 then
1533 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1534 fi
1536 if test "x$ac_system" = "xSolaris"
1537 then
1538 with_kstat="yes"
1539 with_devinfo="yes"
1540 else
1541 with_kstat="no (Solaris only)"
1542 with_devinfo="no (Solaris only)"
1543 fi
1545 if test "x$with_kstat" = "xyes"
1546 then
1547 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1548 fi
1549 if test "x$with_kstat" = "xyes"
1550 then
1551 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1552 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1553 fi
1554 if test "x$with_kstat" = "xyes"
1555 then
1556 AC_DEFINE(HAVE_LIBKSTAT, 1,
1557 [Define to 1 if you have the 'kstat' library (-lkstat)])
1558 fi
1559 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1560 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1562 with_libiokit="no"
1563 if test "x$ac_system" = "xDarwin"
1564 then
1565 with_libiokit="yes"
1566 else
1567 with_libiokit="no"
1568 fi
1569 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1571 with_libkvm="no"
1572 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1573 if test "x$with_kvm_getprocs" = "xyes"
1574 then
1575 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1576 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1577 with_libkvm="yes"
1578 fi
1579 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1581 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1582 if test "x$with_kvm_getswapinfo" = "xyes"
1583 then
1584 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1585 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1586 with_libkvm="yes"
1587 fi
1588 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1590 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1591 if test "x$with_kvm_nlist" = "xyes"
1592 then
1593 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1594 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1595 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1596 with_libkvm="yes"
1597 fi
1598 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1600 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1601 if test "x$with_kvm_openfiles" = "xyes"
1602 then
1603 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1604 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1605 with_libkvm="yes"
1606 fi
1607 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1609 # --with-libaquaero5 {{{
1610 AC_ARG_WITH(libaquaero5, [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [Path to aquatools-ng source code.])],
1611 [
1612 if test "x$withval" = "xyes"
1613 then
1614 with_libaquaero5="yes"
1615 else if test "x$withval" = "xno"
1616 then
1617 with_libaquaero5="no"
1618 else
1619 with_libaquaero5="yes"
1620 LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src"
1621 LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj"
1622 fi; fi
1623 ],
1624 [with_libaquaero5="yes"])
1626 SAVE_CPPFLAGS="$CPPFLAGS"
1627 SAVE_LDFLAGS="$LDFLAGS"
1629 CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS"
1630 LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS"
1632 if test "x$with_libaquaero5" = "xyes"
1633 then
1634 if test "x$LIBAQUAERO5_CFLAGS" != "x"
1635 then
1636 AC_MSG_NOTICE([libaquaero5 CPPFLAGS: $LIBAQUAERO5_CFLAGS])
1637 fi
1638 AC_CHECK_HEADERS(libaquaero5.h,
1639 [with_libaquaero5="yes"],
1640 [with_libaquaero5="no (libaquaero5.h not found)"])
1641 fi
1642 if test "x$with_libaquaero5" = "xyes"
1643 then
1644 if test "x$LIBAQUAERO5_LDFLAGS" != "x"
1645 then
1646 AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS])
1647 fi
1648 AC_CHECK_LIB(aquaero5, libaquaero5_poll,
1649 [with_libaquaero5="yes"],
1650 [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"])
1651 fi
1653 CPPFLAGS="$SAVE_CPPFLAGS"
1654 LDFLAGS="$SAVE_LDFLAGS"
1656 if test "x$with_libaquaero5" = "xyes"
1657 then
1658 BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS"
1659 BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS"
1660 AC_SUBST(BUILD_WITH_LIBAQUAERO5_CFLAGS)
1661 AC_SUBST(BUILD_WITH_LIBAQUAERO5_LDFLAGS)
1662 fi
1663 AM_CONDITIONAL(BUILD_WITH_LIBAQUAERO5, test "x$with_libaquaero5" = "xyes")
1664 # }}}
1666 # --with-libhiredis {{{
1667 AC_ARG_WITH(libhiredis, [AS_HELP_STRING([--with-libhiredis@<:@=PREFIX@:>@],
1668 [Path to libhiredis.])],
1669 [
1670 if test "x$withval" = "xyes"
1671 then
1672 with_libhiredis="yes"
1673 else if test "x$withval" = "xno"
1674 then
1675 with_libhiredis="no"
1676 else
1677 with_libhiredis="yes"
1678 LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS -I$withval/include"
1679 LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS -L$withval/lib"
1680 fi; fi
1681 ],
1682 [with_libhiredis="yes"])
1684 SAVE_CPPFLAGS="$CPPFLAGS"
1685 SAVE_LDFLAGS="$LDFLAGS"
1687 CPPFLAGS="$CPPFLAGS $LIBHIREDIS_CPPFLAGS"
1688 LDFLAGS="$LDFLAGS $LIBHIREDIS_LDFLAGS"
1690 if test "x$with_libhiredis" = "xyes"
1691 then
1692 if test "x$LIBHIREDIS_CPPFLAGS" != "x"
1693 then
1694 AC_MSG_NOTICE([libhiredis CPPFLAGS: $LIBHIREDIS_CPPFLAGS])
1695 fi
1696 AC_CHECK_HEADERS(hiredis/hiredis.h,
1697 [with_libhiredis="yes"],
1698 [with_libhiredis="no (hiredis.h not found)"])
1699 fi
1700 if test "x$with_libhiredis" = "xyes"
1701 then
1702 if test "x$LIBHIREDIS_LDFLAGS" != "x"
1703 then
1704 AC_MSG_NOTICE([libhiredis LDFLAGS: $LIBHIREDIS_LDFLAGS])
1705 fi
1706 AC_CHECK_LIB(hiredis, redisCommand,
1707 [with_libhiredis="yes"],
1708 [with_libhiredis="no (symbol 'redisCommand' not found)"])
1710 fi
1712 CPPFLAGS="$SAVE_CPPFLAGS"
1713 LDFLAGS="$SAVE_LDFLAGS"
1715 if test "x$with_libhiredis" = "xyes"
1716 then
1717 BUILD_WITH_LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS"
1718 BUILD_WITH_LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS"
1719 AC_SUBST(BUILD_WITH_LIBHIREDIS_CPPFLAGS)
1720 AC_SUBST(BUILD_WITH_LIBHIREDIS_LDFLAGS)
1721 fi
1722 AM_CONDITIONAL(BUILD_WITH_LIBHIREDIS, test "x$with_libhiredis" = "xyes")
1723 # }}}
1725 # --with-libcurl {{{
1726 with_curl_config="curl-config"
1727 with_curl_cflags=""
1728 with_curl_libs=""
1729 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1730 [
1731 if test "x$withval" = "xno"
1732 then
1733 with_libcurl="no"
1734 else if test "x$withval" = "xyes"
1735 then
1736 with_libcurl="yes"
1737 else
1738 if test -f "$withval" && test -x "$withval"
1739 then
1740 with_curl_config="$withval"
1741 with_libcurl="yes"
1742 else if test -x "$withval/bin/curl-config"
1743 then
1744 with_curl_config="$withval/bin/curl-config"
1745 with_libcurl="yes"
1746 fi; fi
1747 with_libcurl="yes"
1748 fi; fi
1749 ],
1750 [
1751 with_libcurl="yes"
1752 ])
1753 if test "x$with_libcurl" = "xyes"
1754 then
1755 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1756 curl_config_status=$?
1758 if test $curl_config_status -ne 0
1759 then
1760 with_libcurl="no ($with_curl_config failed)"
1761 else
1762 SAVE_CPPFLAGS="$CPPFLAGS"
1763 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1765 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1767 CPPFLAGS="$SAVE_CPPFLAGS"
1768 fi
1769 fi
1770 if test "x$with_libcurl" = "xyes"
1771 then
1772 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1773 curl_config_status=$?
1775 if test $curl_config_status -ne 0
1776 then
1777 with_libcurl="no ($with_curl_config failed)"
1778 else
1779 AC_CHECK_LIB(curl, curl_easy_init,
1780 [with_libcurl="yes"],
1781 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1782 [$with_curl_libs])
1783 AC_CHECK_DECL(CURLOPT_USERNAME,
1784 [have_curlopt_username="yes"],
1785 [have_curlopt_username="no"],
1786 [[#include <curl/curl.h>]])
1787 AC_CHECK_DECL(CURLOPT_TIMEOUT_MS,
1788 [have_curlopt_timeout="yes"],
1789 [have_curlopt_timeout="no"],
1790 [[#include <curl/curl.h>]])
1791 fi
1792 fi
1793 if test "x$with_libcurl" = "xyes"
1794 then
1795 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1796 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1797 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1798 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1800 if test "x$have_curlopt_username" = "xyes"
1801 then
1802 AC_DEFINE(HAVE_CURLOPT_USERNAME, 1, [Define if libcurl supports CURLOPT_USERNAME option.])
1803 fi
1805 if test "x$have_curlopt_timeout" = "xyes"
1806 then
1807 AC_DEFINE(HAVE_CURLOPT_TIMEOUT_MS, 1, [Define if libcurl supports CURLOPT_TIMEOUT_MS option.])
1808 fi
1809 fi
1810 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1811 # }}}
1813 # --with-libdbi {{{
1814 with_libdbi_cppflags=""
1815 with_libdbi_ldflags=""
1816 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1817 [
1818 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1819 then
1820 with_libdbi_cppflags="-I$withval/include"
1821 with_libdbi_ldflags="-L$withval/lib"
1822 with_libdbi="yes"
1823 else
1824 with_libdbi="$withval"
1825 fi
1826 ],
1827 [
1828 with_libdbi="yes"
1829 ])
1830 if test "x$with_libdbi" = "xyes"
1831 then
1832 SAVE_CPPFLAGS="$CPPFLAGS"
1833 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1835 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1837 CPPFLAGS="$SAVE_CPPFLAGS"
1838 fi
1839 if test "x$with_libdbi" = "xyes"
1840 then
1841 SAVE_CPPFLAGS="$CPPFLAGS"
1842 SAVE_LDFLAGS="$LDFLAGS"
1843 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1844 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1846 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1848 CPPFLAGS="$SAVE_CPPFLAGS"
1849 LDFLAGS="$SAVE_LDFLAGS"
1850 fi
1851 if test "x$with_libdbi" = "xyes"
1852 then
1853 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1854 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1855 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1856 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1857 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1858 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1859 fi
1860 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1861 # }}}
1863 # --with-libesmtp {{{
1864 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1865 [
1866 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1867 then
1868 LDFLAGS="$LDFLAGS -L$withval/lib"
1869 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1870 with_libesmtp="yes"
1871 else
1872 with_libesmtp="$withval"
1873 fi
1874 ],
1875 [
1876 with_libesmtp="yes"
1877 ])
1878 if test "x$with_libesmtp" = "xyes"
1879 then
1880 AC_CHECK_LIB(esmtp, smtp_create_session,
1881 [
1882 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1883 ], [with_libesmtp="no (libesmtp not found)"])
1884 fi
1885 if test "x$with_libesmtp" = "xyes"
1886 then
1887 AC_CHECK_HEADERS(libesmtp.h,
1888 [
1889 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1890 ], [with_libesmtp="no (libesmtp.h not found)"])
1891 fi
1892 if test "x$with_libesmtp" = "xyes"
1893 then
1894 collect_libesmtp=1
1895 else
1896 collect_libesmtp=0
1897 fi
1898 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1899 [Wether or not to use the esmtp library])
1900 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1901 # }}}
1903 # --with-libganglia {{{
1904 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1905 [
1906 if test -f "$withval" && test -x "$withval"
1907 then
1908 with_libganglia_config="$withval"
1909 with_libganglia="yes"
1910 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1911 then
1912 with_libganglia_config="$withval/bin/ganglia-config"
1913 with_libganglia="yes"
1914 else if test -d "$withval"
1915 then
1916 GANGLIA_CPPFLAGS="-I$withval/include"
1917 GANGLIA_LDFLAGS="-L$withval/lib"
1918 with_libganglia="yes"
1919 else
1920 with_libganglia_config="ganglia-config"
1921 with_libganglia="$withval"
1922 fi; fi; fi
1923 ],
1924 [
1925 with_libganglia_config="ganglia-config"
1926 with_libganglia="yes"
1927 ])
1929 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1930 then
1931 if test "x$GANGLIA_CPPFLAGS" = "x"
1932 then
1933 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1934 fi
1936 if test "x$GANGLIA_LDFLAGS" = "x"
1937 then
1938 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1939 fi
1941 if test "x$GANGLIA_LIBS" = "x"
1942 then
1943 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1944 fi
1945 fi
1947 SAVE_CPPFLAGS="$CPPFLAGS"
1948 SAVE_LDFLAGS="$LDFLAGS"
1949 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1950 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1952 if test "x$with_libganglia" = "xyes"
1953 then
1954 AC_CHECK_HEADERS(gm_protocol.h,
1955 [
1956 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1957 [Define to 1 if you have the <gm_protocol.h> header file.])
1958 ], [with_libganglia="no (gm_protocol.h not found)"])
1959 fi
1961 if test "x$with_libganglia" = "xyes"
1962 then
1963 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1964 [
1965 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1966 [Define to 1 if you have the ganglia library (-lganglia).])
1967 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1968 fi
1970 CPPFLAGS="$SAVE_CPPFLAGS"
1971 LDFLAGS="$SAVE_LDFLAGS"
1973 AC_SUBST(GANGLIA_CPPFLAGS)
1974 AC_SUBST(GANGLIA_LDFLAGS)
1975 AC_SUBST(GANGLIA_LIBS)
1976 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1977 # }}}
1979 # --with-libgcrypt {{{
1980 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1981 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1982 GCRYPT_LIBS="$GCRYPT_LIBS"
1983 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1984 [
1985 if test -f "$withval" && test -x "$withval"
1986 then
1987 with_libgcrypt_config="$withval"
1988 with_libgcrypt="yes"
1989 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1990 then
1991 with_libgcrypt_config="$withval/bin/gcrypt-config"
1992 with_libgcrypt="yes"
1993 else if test -d "$withval"
1994 then
1995 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1996 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1997 with_libgcrypt="yes"
1998 else
1999 with_libgcrypt_config="gcrypt-config"
2000 with_libgcrypt="$withval"
2001 fi; fi; fi
2002 ],
2003 [
2004 with_libgcrypt_config="libgcrypt-config"
2005 with_libgcrypt="yes"
2006 ])
2008 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
2009 then
2010 if test "x$GCRYPT_CPPFLAGS" = "x"
2011 then
2012 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
2013 fi
2015 if test "x$GCRYPT_LDFLAGS" = "x"
2016 then
2017 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
2018 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
2019 fi
2021 if test "x$GCRYPT_LIBS" = "x"
2022 then
2023 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
2024 fi
2025 fi
2027 SAVE_CPPFLAGS="$CPPFLAGS"
2028 SAVE_LDFLAGS="$LDFLAGS"
2029 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
2030 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
2032 if test "x$with_libgcrypt" = "xyes"
2033 then
2034 if test "x$GCRYPT_CPPFLAGS" != "x"
2035 then
2036 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
2037 fi
2038 AC_CHECK_HEADERS(gcrypt.h,
2039 [with_libgcrypt="yes"],
2040 [with_libgcrypt="no (gcrypt.h not found)"])
2041 fi
2043 if test "x$with_libgcrypt" = "xyes"
2044 then
2045 if test "x$GCRYPT_LDFLAGS" != "x"
2046 then
2047 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
2048 fi
2049 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
2050 [with_libgcrypt="yes"],
2051 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
2053 if test "$with_libgcrypt" != "no"; then
2054 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
2055 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
2056 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
2057 fi
2058 fi
2060 CPPFLAGS="$SAVE_CPPFLAGS"
2061 LDFLAGS="$SAVE_LDFLAGS"
2063 if test "x$with_libgcrypt" = "xyes"
2064 then
2065 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
2066 fi
2068 AC_SUBST(GCRYPT_CPPFLAGS)
2069 AC_SUBST(GCRYPT_LDFLAGS)
2070 AC_SUBST(GCRYPT_LIBS)
2071 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
2072 # }}}
2074 # --with-libiptc {{{
2075 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
2076 [
2077 if test "x$withval" = "xyes"
2078 then
2079 with_libiptc="pkgconfig"
2080 else if test "x$withval" = "xno"
2081 then
2082 with_libiptc="no"
2083 else
2084 with_libiptc="yes"
2085 with_libiptc_cflags="-I$withval/include"
2086 with_libiptc_libs="-L$withval/lib"
2087 fi; fi
2088 ],
2089 [
2090 if test "x$ac_system" = "xLinux"
2091 then
2092 with_libiptc="pkgconfig"
2093 else
2094 with_libiptc="no (Linux only)"
2095 fi
2096 ])
2098 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
2099 then
2100 with_libiptc="no (Don't have pkg-config)"
2101 fi
2103 if test "x$with_libiptc" = "xpkgconfig"
2104 then
2105 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
2106 if test $? -ne 0
2107 then
2108 with_libiptc="no (pkg-config doesn't know libiptc)"
2109 fi
2110 fi
2111 if test "x$with_libiptc" = "xpkgconfig"
2112 then
2113 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
2114 if test $? -ne 0
2115 then
2116 with_libiptc="no ($PKG_CONFIG failed)"
2117 fi
2118 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
2119 if test $? -ne 0
2120 then
2121 with_libiptc="no ($PKG_CONFIG failed)"
2122 fi
2123 fi
2125 SAVE_CPPFLAGS="$CPPFLAGS"
2126 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
2128 # check whether the header file for libiptc is available.
2129 if test "x$with_libiptc" = "xpkgconfig"
2130 then
2131 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
2132 [with_libiptc="no (header file missing)"])
2133 fi
2134 # If the header file is available, check for the required type declaractions.
2135 # They may be missing in old versions of libiptc. In that case, they will be
2136 # declared in the iptables plugin.
2137 if test "x$with_libiptc" = "xpkgconfig"
2138 then
2139 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
2140 fi
2141 # Check for the iptc_init symbol in the library.
2142 # This could be in iptc or ip4tc
2143 if test "x$with_libiptc" = "xpkgconfig"
2144 then
2145 SAVE_LIBS="$LIBS"
2146 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
2147 [with_libiptc="pkgconfig"],
2148 [with_libiptc="no"],
2149 [$with_libiptc_libs])
2150 LIBS="$SAVE_LIBS"
2151 fi
2152 if test "x$with_libiptc" = "xpkgconfig"
2153 then
2154 with_libiptc="yes"
2155 fi
2157 CPPFLAGS="$SAVE_CPPFLAGS"
2159 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
2160 if test "x$with_libiptc" = "xyes"
2161 then
2162 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
2163 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2164 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2165 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2166 fi
2167 # }}}
2169 # --with-java {{{
2170 with_java_home="$JAVA_HOME"
2171 if test "x$with_java_home" = "x"
2172 then
2173 with_java_home="/usr/lib/jvm"
2174 fi
2175 with_java_vmtype="client"
2176 with_java_cflags=""
2177 with_java_libs=""
2178 JAVAC="$JAVAC"
2179 JAR="$JAR"
2180 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2181 [
2182 if test "x$withval" = "xno"
2183 then
2184 with_java="no"
2185 else if test "x$withval" = "xyes"
2186 then
2187 with_java="yes"
2188 else
2189 with_java_home="$withval"
2190 with_java="yes"
2191 fi; fi
2192 ],
2193 [with_java="yes"])
2194 if test "x$with_java" = "xyes"
2195 then
2196 if test -d "$with_java_home"
2197 then
2198 AC_MSG_CHECKING([for jni.h])
2199 TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2200 if test "x$TMPVAR" != "x"
2201 then
2202 AC_MSG_RESULT([found in $TMPVAR])
2203 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2204 else
2205 AC_MSG_RESULT([not found])
2206 fi
2208 AC_MSG_CHECKING([for jni_md.h])
2209 TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2210 if test "x$TMPVAR" != "x"
2211 then
2212 AC_MSG_RESULT([found in $TMPVAR])
2213 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2214 else
2215 AC_MSG_RESULT([not found])
2216 fi
2218 AC_MSG_CHECKING([for libjvm.so])
2219 TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2220 if test "x$TMPVAR" != "x"
2221 then
2222 AC_MSG_RESULT([found in $TMPVAR])
2223 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2224 else
2225 AC_MSG_RESULT([not found])
2226 fi
2228 if test "x$JAVAC" = "x"
2229 then
2230 AC_MSG_CHECKING([for javac])
2231 TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2232 if test "x$TMPVAR" != "x"
2233 then
2234 JAVAC="$TMPVAR"
2235 AC_MSG_RESULT([$JAVAC])
2236 else
2237 AC_MSG_RESULT([not found])
2238 fi
2239 fi
2240 if test "x$JAR" = "x"
2241 then
2242 AC_MSG_CHECKING([for jar])
2243 TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2244 if test "x$TMPVAR" != "x"
2245 then
2246 JAR="$TMPVAR"
2247 AC_MSG_RESULT([$JAR])
2248 else
2249 AC_MSG_RESULT([not found])
2250 fi
2251 fi
2252 else if test "x$with_java_home" != "x"
2253 then
2254 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2255 fi; fi
2256 fi
2258 if test "x$JAVA_CPPFLAGS" != "x"
2259 then
2260 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2261 fi
2262 if test "x$JAVA_CFLAGS" != "x"
2263 then
2264 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2265 fi
2266 if test "x$JAVA_LDFLAGS" != "x"
2267 then
2268 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2269 fi
2270 if test "x$JAVAC" = "x"
2271 then
2272 with_javac_path="$PATH"
2273 if test "x$with_java_home" != "x"
2274 then
2275 with_javac_path="$with_java_home:with_javac_path"
2276 if test -d "$with_java_home/bin"
2277 then
2278 with_javac_path="$with_java_home/bin:with_javac_path"
2279 fi
2280 fi
2282 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2283 fi
2284 if test "x$JAVAC" = "x"
2285 then
2286 with_java="no (javac not found)"
2287 fi
2288 if test "x$JAR" = "x"
2289 then
2290 with_jar_path="$PATH"
2291 if test "x$with_java_home" != "x"
2292 then
2293 with_jar_path="$with_java_home:$with_jar_path"
2294 if test -d "$with_java_home/bin"
2295 then
2296 with_jar_path="$with_java_home/bin:$with_jar_path"
2297 fi
2298 fi
2300 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2301 fi
2302 if test "x$JAR" = "x"
2303 then
2304 with_java="no (jar not found)"
2305 fi
2307 SAVE_CPPFLAGS="$CPPFLAGS"
2308 SAVE_CFLAGS="$CFLAGS"
2309 SAVE_LDFLAGS="$LDFLAGS"
2310 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2311 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2312 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2314 if test "x$with_java" = "xyes"
2315 then
2316 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2317 fi
2318 if test "x$with_java" = "xyes"
2319 then
2320 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2321 [with_java="yes"],
2322 [with_java="no (libjvm not found)"],
2323 [$JAVA_LIBS])
2324 fi
2325 if test "x$with_java" = "xyes"
2326 then
2327 JAVA_LIBS="$JAVA_LIBS -ljvm"
2328 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2329 fi
2331 CPPFLAGS="$SAVE_CPPFLAGS"
2332 CFLAGS="$SAVE_CFLAGS"
2333 LDFLAGS="$SAVE_LDFLAGS"
2335 AC_SUBST(JAVA_CPPFLAGS)
2336 AC_SUBST(JAVA_CFLAGS)
2337 AC_SUBST(JAVA_LDFLAGS)
2338 AC_SUBST(JAVA_LIBS)
2339 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2340 # }}}
2342 # --with-libldap {{{
2343 AC_ARG_WITH(libldap, [AS_HELP_STRING([--with-libldap@<:@=PREFIX@:>@], [Path to libldap.])],
2344 [
2345 if test "x$withval" = "xyes"
2346 then
2347 with_libldap="yes"
2348 else if test "x$withval" = "xno"
2349 then
2350 with_libldap="no"
2351 else
2352 with_libldap="yes"
2353 LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS -I$withval/include"
2354 LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS -L$withval/lib"
2355 fi; fi
2356 ],
2357 [with_libldap="yes"])
2359 SAVE_CPPFLAGS="$CPPFLAGS"
2360 SAVE_LDFLAGS="$LDFLAGS"
2362 CPPFLAGS="$CPPFLAGS $LIBLDAP_CPPFLAGS"
2363 LDFLAGS="$LDFLAGS $LIBLDAP_LDFLAGS"
2365 if test "x$with_libldap" = "xyes"
2366 then
2367 if test "x$LIBLDAP_CPPFLAGS" != "x"
2368 then
2369 AC_MSG_NOTICE([libldap CPPFLAGS: $LIBLDAP_CPPFLAGS])
2370 fi
2371 AC_CHECK_HEADERS(ldap.h,
2372 [with_libldap="yes"],
2373 [with_libldap="no ('ldap.h' not found)"])
2374 fi
2375 if test "x$with_libldap" = "xyes"
2376 then
2377 if test "x$LIBLDAP_LDFLAGS" != "x"
2378 then
2379 AC_MSG_NOTICE([libldap LDFLAGS: $LIBLDAP_LDFLAGS])
2380 fi
2381 AC_CHECK_LIB(ldap, ldap_initialize,
2382 [with_libldap="yes"],
2383 [with_libldap="no (symbol 'ldap_initialize' not found)"])
2385 fi
2387 CPPFLAGS="$SAVE_CPPFLAGS"
2388 LDFLAGS="$SAVE_LDFLAGS"
2390 if test "x$with_libldap" = "xyes"
2391 then
2392 BUILD_WITH_LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS"
2393 BUILD_WITH_LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS"
2394 AC_SUBST(BUILD_WITH_LIBLDAP_CPPFLAGS)
2395 AC_SUBST(BUILD_WITH_LIBLDAP_LDFLAGS)
2396 fi
2397 AM_CONDITIONAL(BUILD_WITH_LIBLDAP, test "x$with_libldap" = "xyes")
2398 # }}}
2400 # --with-liblvm2app {{{
2401 with_liblvm2app_cppflags=""
2402 with_liblvm2app_ldflags=""
2403 AC_ARG_WITH(liblvm2app, [AS_HELP_STRING([--with-liblvm2app@<:@=PREFIX@:>@], [Path to liblvm2app.])],
2404 [
2405 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2406 then
2407 with_liblvm2app_cppflags="-I$withval/include"
2408 with_liblvm2app_ldflags="-L$withval/lib"
2409 with_liblvm2app="yes"
2410 else
2411 with_liblvm2app="$withval"
2412 fi
2413 ],
2414 [
2415 with_liblvm2app="yes"
2416 ])
2417 if test "x$with_liblvm2app" = "xyes"
2418 then
2419 SAVE_CPPFLAGS="$CPPFLAGS"
2420 CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
2422 AC_CHECK_HEADERS(lvm2app.h, [with_liblvm2app="yes"], [with_liblvm2app="no (lvm2app.h not found)"])
2424 CPPFLAGS="$SAVE_CPPFLAGS"
2425 fi
2427 if test "x$with_liblvm2app" = "xyes"
2428 then
2429 SAVE_CPPFLAGS="$CPPFLAGS"
2430 SAVE_LDFLAGS="$LDFLAGS"
2431 CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
2432 LDFLAGS="$LDFLAGS $with_liblvm2app_ldflags"
2434 AC_CHECK_LIB(lvm2app, lvm_lv_get_property, [with_liblvm2app="yes"], [with_liblvm2app="no (Symbol 'lvm_lv_get_property' not found)"])
2436 CPPFLAGS="$SAVE_CPPFLAGS"
2437 LDFLAGS="$SAVE_LDFLAGS"
2438 fi
2439 if test "x$with_liblvm2app" = "xyes"
2440 then
2441 BUILD_WITH_LIBLVM2APP_CPPFLAGS="$with_liblvm2app_cppflags"
2442 BUILD_WITH_LIBLVM2APP_LDFLAGS="$with_liblvm2app_ldflags"
2443 BUILD_WITH_LIBLVM2APP_LIBS="-llvm2app"
2444 AC_SUBST(BUILD_WITH_LIBLVM2APP_CPPFLAGS)
2445 AC_SUBST(BUILD_WITH_LIBLVM2APP_LDFLAGS)
2446 AC_SUBST(BUILD_WITH_LIBLVM2APP_LIBS)
2447 AC_DEFINE(HAVE_LIBLVM2APP, 1, [Define if liblvm2app is present and usable.])
2448 fi
2449 AM_CONDITIONAL(BUILD_WITH_LIBLVM2APP, test "x$with_liblvm2app" = "xyes")
2450 # }}}
2452 # --with-libmemcached {{{
2453 with_libmemcached_cppflags=""
2454 with_libmemcached_ldflags=""
2455 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2456 [
2457 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2458 then
2459 with_libmemcached_cppflags="-I$withval/include"
2460 with_libmemcached_ldflags="-L$withval/lib"
2461 with_libmemcached="yes"
2462 else
2463 with_libmemcached="$withval"
2464 fi
2465 ],
2466 [
2467 with_libmemcached="yes"
2468 ])
2469 if test "x$with_libmemcached" = "xyes"
2470 then
2471 SAVE_CPPFLAGS="$CPPFLAGS"
2472 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2474 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2476 CPPFLAGS="$SAVE_CPPFLAGS"
2477 fi
2478 if test "x$with_libmemcached" = "xyes"
2479 then
2480 SAVE_CPPFLAGS="$CPPFLAGS"
2481 SAVE_LDFLAGS="$LDFLAGS"
2482 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2483 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2485 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2487 CPPFLAGS="$SAVE_CPPFLAGS"
2488 LDFLAGS="$SAVE_LDFLAGS"
2489 fi
2490 if test "x$with_libmemcached" = "xyes"
2491 then
2492 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2493 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2494 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2495 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2496 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2497 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2498 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2499 fi
2500 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2501 # }}}
2503 # --with-libmodbus {{{
2504 with_libmodbus_config=""
2505 with_libmodbus_cflags=""
2506 with_libmodbus_libs=""
2507 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2508 [
2509 if test "x$withval" = "xno"
2510 then
2511 with_libmodbus="no"
2512 else if test "x$withval" = "xyes"
2513 then
2514 with_libmodbus="use_pkgconfig"
2515 else if test -d "$with_libmodbus/lib"
2516 then
2517 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2518 with_libmodbus_cflags="-I$withval/include"
2519 with_libmodbus_libs="-L$withval/lib -lmodbus"
2520 with_libmodbus="yes"
2521 fi; fi; fi
2522 ],
2523 [with_libmodbus="use_pkgconfig"])
2525 # configure using pkg-config
2526 if test "x$with_libmodbus" = "xuse_pkgconfig"
2527 then
2528 if test "x$PKG_CONFIG" = "x"
2529 then
2530 with_libmodbus="no (Don't have pkg-config)"
2531 fi
2532 fi
2533 if test "x$with_libmodbus" = "xuse_pkgconfig"
2534 then
2535 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2536 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2537 if test $? -ne 0
2538 then
2539 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2540 fi
2541 fi
2542 if test "x$with_libmodbus" = "xuse_pkgconfig"
2543 then
2544 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2545 if test $? -ne 0
2546 then
2547 with_libmodbus="no ($PKG_CONFIG failed)"
2548 fi
2549 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2550 if test $? -ne 0
2551 then
2552 with_libmodbus="no ($PKG_CONFIG failed)"
2553 fi
2554 fi
2555 if test "x$with_libmodbus" = "xuse_pkgconfig"
2556 then
2557 with_libmodbus="yes"
2558 fi
2560 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2561 # the actual checks.
2562 if test "x$with_libmodbus" = "xyes"
2563 then
2564 SAVE_CPPFLAGS="$CPPFLAGS"
2565 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2567 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2569 CPPFLAGS="$SAVE_CPPFLAGS"
2570 fi
2571 if test "x$with_libmodbus" = "xyes"
2572 then
2573 SAVE_CPPFLAGS="$CPPFLAGS"
2574 SAVE_LDFLAGS="$LDFLAGS"
2576 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2577 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2579 AC_CHECK_LIB(modbus, modbus_connect,
2580 [with_libmodbus="yes"],
2581 [with_libmodbus="no (symbol modbus_connect not found)"])
2583 CPPFLAGS="$SAVE_CPPFLAGS"
2584 LDFLAGS="$SAVE_LDFLAGS"
2585 fi
2586 if test "x$with_libmodbus" = "xyes"
2587 then
2588 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2589 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2590 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2591 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2592 fi
2593 # }}}
2595 # --with-libmongoc {{{
2596 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2597 [
2598 if test "x$withval" = "xyes"
2599 then
2600 with_libmongoc="yes"
2601 else if test "x$withval" = "xno"
2602 then
2603 with_libmongoc="no"
2604 else
2605 with_libmongoc="yes"
2606 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2607 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2608 fi; fi
2609 ],
2610 [with_libmongoc="yes"])
2612 SAVE_CPPFLAGS="$CPPFLAGS"
2613 SAVE_LDFLAGS="$LDFLAGS"
2615 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2616 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2618 if test "x$with_libmongoc" = "xyes"
2619 then
2620 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2621 then
2622 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2623 fi
2624 AC_CHECK_HEADERS(mongo.h,
2625 [with_libmongoc="yes"],
2626 [with_libmongoc="no ('mongo.h' not found)"],
2627 [#if HAVE_STDINT_H
2628 # define MONGO_HAVE_STDINT 1
2629 #else
2630 # define MONGO_USE_LONG_LONG_INT 1
2631 #endif
2632 ])
2633 fi
2634 if test "x$with_libmongoc" = "xyes"
2635 then
2636 if test "x$LIBMONGOC_LDFLAGS" != "x"
2637 then
2638 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2639 fi
2640 AC_CHECK_LIB(mongoc, mongo_run_command,
2641 [with_libmongoc="yes"],
2642 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2643 fi
2645 CPPFLAGS="$SAVE_CPPFLAGS"
2646 LDFLAGS="$SAVE_LDFLAGS"
2648 if test "x$with_libmongoc" = "xyes"
2649 then
2650 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2651 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2652 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2653 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2654 fi
2655 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2656 # }}}
2658 # --with-libmosquitto {{{
2659 with_libmosquitto_cppflags=""
2660 with_libmosquitto_libs="-lmosquitto"
2661 AC_ARG_WITH(libmosquitto, [AS_HELP_STRING([--with-libmosquitto@<:@=PREFIX@:>@], [Path to libmosquitto.])],
2662 [
2663 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2664 then
2665 with_libmosquitto_cppflags="-I$withval/include"
2666 with_libmosquitto_libs="-L$withval/lib -lmosquitto"
2667 with_libmosquitto="yes"
2668 else
2669 with_libmosquitto="$withval"
2670 fi
2671 ],
2672 [
2673 with_libmosquitto="yes"
2674 ])
2675 if test "x$with_libmosquitto" = "xyes"
2676 then
2677 SAVE_CPPFLAGS="$CPPFLAGS"
2678 CPPFLAGS="$with_libmosquitto_cppflags"
2680 AC_CHECK_HEADERS(mosquitto.h, [with_libmosquitto="yes"], [with_libmosquitto="no (mosquitto.h not found)"])
2682 CPPFLAGS="$SAVE_CPPFLAGS"
2683 fi
2684 if test "x$with_libmosquitto" = "xyes"
2685 then
2686 SAVE_LDFLAGS="$LDFLAGS"
2687 SAVE_CPPFLAGS="$CPPFLAGS"
2688 LDFLAGS="$with_libmosquitto_libs"
2689 CPPFLAGS="$with_libmosquitto_cppflags"
2691 AC_CHECK_LIB(mosquitto, mosquitto_connect, [with_libmosquitto="yes"], [with_libmosquitto="no (libmosquitto not found)"])
2693 LDFLAGS="$SAVE_LDFLAGS"
2694 CPPFLAGS="$SAVE_CPPFLAGS"
2695 fi
2696 if test "x$with_libmosquitto" = "xyes"
2697 then
2698 BUILD_WITH_LIBMOSQUITTO_CPPFLAGS="$with_libmosquitto_cppflags"
2699 BUILD_WITH_LIBMOSQUITTO_LIBS="$with_libmosquitto_libs"
2700 AC_SUBST(BUILD_WITH_LIBMOSQUITTO_CPPFLAGS)
2701 AC_SUBST(BUILD_WITH_LIBMOSQUITTO_LIBS)
2702 fi
2703 # }}}
2705 # --with-libmysql {{{
2706 with_mysql_config="mysql_config"
2707 with_mysql_cflags=""
2708 with_mysql_libs=""
2709 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2710 [
2711 if test "x$withval" = "xno"
2712 then
2713 with_libmysql="no"
2714 else if test "x$withval" = "xyes"
2715 then
2716 with_libmysql="yes"
2717 else
2718 if test -f "$withval" && test -x "$withval";
2719 then
2720 with_mysql_config="$withval"
2721 else if test -x "$withval/bin/mysql_config"
2722 then
2723 with_mysql_config="$withval/bin/mysql_config"
2724 fi; fi
2725 with_libmysql="yes"
2726 fi; fi
2727 ],
2728 [
2729 with_libmysql="yes"
2730 ])
2731 if test "x$with_libmysql" = "xyes"
2732 then
2733 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2734 mysql_config_status=$?
2736 if test $mysql_config_status -ne 0
2737 then
2738 with_libmysql="no ($with_mysql_config failed)"
2739 else
2740 SAVE_CPPFLAGS="$CPPFLAGS"
2741 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2743 have_mysql_h="no"
2744 have_mysql_mysql_h="no"
2745 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2747 if test "x$have_mysql_h" = "xno"
2748 then
2749 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2750 fi
2752 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2753 then
2754 with_libmysql="no (mysql.h not found)"
2755 fi
2757 CPPFLAGS="$SAVE_CPPFLAGS"
2758 fi
2759 fi
2760 if test "x$with_libmysql" = "xyes"
2761 then
2762 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2763 mysql_config_status=$?
2765 if test $mysql_config_status -ne 0
2766 then
2767 with_libmysql="no ($with_mysql_config failed)"
2768 else
2769 AC_CHECK_LIB(mysqlclient, mysql_init,
2770 [with_libmysql="yes"],
2771 [with_libmysql="no (symbol 'mysql_init' not found)"],
2772 [$with_mysql_libs])
2774 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2775 [with_libmysql="yes"],
2776 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2777 [$with_mysql_libs])
2778 fi
2779 fi
2780 if test "x$with_libmysql" = "xyes"
2781 then
2782 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2783 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2784 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2785 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2786 fi
2787 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2788 # }}}
2790 # --with-libmnl {{{
2791 with_libmnl_cflags=""
2792 with_libmnl_libs=""
2793 AC_ARG_WITH(libmnl, [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])],
2794 [
2795 echo "libmnl: withval = $withval"
2796 if test "x$withval" = "xyes"
2797 then
2798 with_libmnl="yes"
2799 else if test "x$withval" = "xno"
2800 then
2801 with_libmnl="no"
2802 else
2803 if test -d "$withval/include"
2804 then
2805 with_libmnl_cflags="-I$withval/include"
2806 with_libmnl_libs="-L$withval/lib -lmnl"
2807 with_libmnl="yes"
2808 else
2809 AC_MSG_ERROR("no such directory: $withval/include")
2810 fi
2811 fi; fi
2812 ],
2813 [
2814 if test "x$ac_system" = "xLinux"
2815 then
2816 with_libmnl="yes"
2817 else
2818 with_libmnl="no (Linux only library)"
2819 fi
2820 ])
2821 if test "x$PKG_CONFIG" = "x"
2822 then
2823 with_libmnl="no (Don't have pkg-config)"
2824 fi
2825 if test "x$with_libmnl" = "xyes"
2826 then
2827 if $PKG_CONFIG --exists libmnl 2>/dev/null; then
2828 with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`"
2829 with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`"
2830 fi
2832 AC_CHECK_HEADERS(libmnl.h libmnl/libmnl.h,
2833 [
2834 with_libmnl="yes"
2835 break
2836 ], [],
2837 [#include <stdio.h>
2838 #include <sys/types.h>
2839 #include <asm/types.h>
2840 #include <sys/socket.h>
2841 #include <linux/netlink.h>
2842 #include <linux/rtnetlink.h>])
2843 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2844 [#include <stdio.h>
2845 #include <sys/types.h>
2846 #include <asm/types.h>
2847 #include <sys/socket.h>])
2849 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2850 [[
2851 #include <stdio.h>
2852 #include <sys/types.h>
2853 #include <asm/types.h>
2854 #include <sys/socket.h>
2855 #include <linux/netlink.h>
2856 #include <linux/rtnetlink.h>
2857 ]],
2858 [[
2859 int retval = TCA_STATS2;
2860 return (retval);
2861 ]]
2862 )],
2863 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2865 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2866 [[
2867 #include <stdio.h>
2868 #include <sys/types.h>
2869 #include <asm/types.h>
2870 #include <sys/socket.h>
2871 #include <linux/netlink.h>
2872 #include <linux/rtnetlink.h>
2873 ]],
2874 [[
2875 int retval = TCA_STATS;
2876 return (retval);
2877 ]]
2878 )],
2879 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2880 fi
2881 if test "x$with_libmnl" = "xyes"
2882 then
2883 AC_CHECK_MEMBERS([struct rtnl_link_stats64.tx_window_errors],
2884 [AC_DEFINE(HAVE_RTNL_LINK_STATS64, 1, [Define if struct rtnl_link_stats64 exists and is usable.])],
2885 [],
2886 [
2887 #include <linux/if_link.h>
2888 ])
2889 fi
2890 if test "x$with_libmnl" = "xyes"
2891 then
2892 AC_CHECK_LIB(mnl, mnl_nlmsg_get_payload,
2893 [with_libmnl="yes"],
2894 [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"],
2895 [$with_libmnl_libs])
2896 fi
2897 if test "x$with_libmnl" = "xyes"
2898 then
2899 AC_DEFINE(HAVE_LIBMNL, 1, [Define if libmnl is present and usable.])
2900 BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags"
2901 BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs"
2902 AC_SUBST(BUILD_WITH_LIBMNL_CFLAGS)
2903 AC_SUBST(BUILD_WITH_LIBMNL_LIBS)
2904 fi
2905 AM_CONDITIONAL(BUILD_WITH_LIBMNL, test "x$with_libmnl" = "xyes")
2906 # }}}
2908 # --with-libnetapp {{{
2909 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2910 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2911 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2912 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2913 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2914 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2915 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2916 [
2917 if test -d "$withval"
2918 then
2919 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2920 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2921 with_libnetapp="yes"
2922 else
2923 with_libnetapp="$withval"
2924 fi
2925 ],
2926 [
2927 with_libnetapp="yes"
2928 ])
2930 SAVE_CPPFLAGS="$CPPFLAGS"
2931 SAVE_LDFLAGS="$LDFLAGS"
2932 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2933 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2935 if test "x$with_libnetapp" = "xyes"
2936 then
2937 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2938 then
2939 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2940 fi
2941 AC_CHECK_HEADERS(netapp_api.h,
2942 [with_libnetapp="yes"],
2943 [with_libnetapp="no (netapp_api.h not found)"])
2944 fi
2946 if test "x$with_libnetapp" = "xyes"
2947 then
2948 if test "x$LIBNETAPP_LDFLAGS" != "x"
2949 then
2950 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2951 fi
2953 if test "x$LIBNETAPP_LIBS" = "x"
2954 then
2955 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2956 fi
2957 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2959 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2960 [with_libnetapp="yes"],
2961 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2962 [$LIBNETAPP_LIBS])
2963 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2964 fi
2966 CPPFLAGS="$SAVE_CPPFLAGS"
2967 LDFLAGS="$SAVE_LDFLAGS"
2969 if test "x$with_libnetapp" = "xyes"
2970 then
2971 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2972 fi
2974 AC_SUBST(LIBNETAPP_CPPFLAGS)
2975 AC_SUBST(LIBNETAPP_LDFLAGS)
2976 AC_SUBST(LIBNETAPP_LIBS)
2977 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2978 # }}}
2980 # --with-libnetsnmp {{{
2981 with_snmp_config="net-snmp-config"
2982 with_snmp_cflags=""
2983 with_snmp_libs=""
2984 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2985 [
2986 if test "x$withval" = "xno"
2987 then
2988 with_libnetsnmp="no"
2989 else if test "x$withval" = "xyes"
2990 then
2991 with_libnetsnmp="yes"
2992 else
2993 if test -x "$withval"
2994 then
2995 with_snmp_config="$withval"
2996 with_libnetsnmp="yes"
2997 else
2998 with_snmp_config="$withval/bin/net-snmp-config"
2999 with_libnetsnmp="yes"
3000 fi
3001 fi; fi
3002 ],
3003 [with_libnetsnmp="yes"])
3004 if test "x$with_libnetsnmp" = "xyes"
3005 then
3006 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
3007 snmp_config_status=$?
3009 if test $snmp_config_status -ne 0
3010 then
3011 with_libnetsnmp="no ($with_snmp_config failed)"
3012 else
3013 SAVE_CPPFLAGS="$CPPFLAGS"
3014 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
3016 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
3018 CPPFLAGS="$SAVE_CPPFLAGS"
3019 fi
3020 fi
3021 if test "x$with_libnetsnmp" = "xyes"
3022 then
3023 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
3024 snmp_config_status=$?
3026 if test $snmp_config_status -ne 0
3027 then
3028 with_libnetsnmp="no ($with_snmp_config failed)"
3029 else
3030 AC_CHECK_LIB(netsnmp, init_snmp,
3031 [with_libnetsnmp="yes"],
3032 [with_libnetsnmp="no (libnetsnmp not found)"],
3033 [$with_snmp_libs])
3034 fi
3035 fi
3036 if test "x$with_libnetsnmp" = "xyes"
3037 then
3038 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
3039 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
3040 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
3041 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
3042 fi
3043 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
3044 # }}}
3046 # --with-liboconfig {{{
3047 with_own_liboconfig="no"
3048 liboconfig_LDFLAGS="$LDFLAGS"
3049 liboconfig_CPPFLAGS="$CPPFLAGS"
3050 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
3051 [
3052 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3053 then
3054 if test -d "$withval/lib"
3055 then
3056 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
3057 fi
3058 if test -d "$withval/include"
3059 then
3060 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
3061 fi
3062 fi
3063 if test "x$withval" = "xno"
3064 then
3065 AC_MSG_ERROR("liboconfig is required")
3066 fi
3067 ],
3068 [
3069 with_liboconfig="yes"
3070 ])
3072 save_LDFLAGS="$LDFLAGS"
3073 save_CPPFLAGS="$CPPFLAGS"
3074 LDFLAGS="$liboconfig_LDFLAGS"
3075 CPPFLAGS="$liboconfig_CPPFLAGS"
3076 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
3077 [
3078 with_liboconfig="yes"
3079 with_own_liboconfig="no"
3080 ],
3081 [
3082 with_liboconfig="yes"
3083 with_own_liboconfig="yes"
3084 LDFLAGS="$save_LDFLAGS"
3085 CPPFLAGS="$save_CPPFLAGS"
3086 ])
3088 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
3089 if test "x$with_own_liboconfig" = "xyes"
3090 then
3091 with_liboconfig="yes (shipped version)"
3092 fi
3093 # }}}
3095 # --with-liboping {{{
3096 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
3097 [
3098 if test "x$withval" = "xyes"
3099 then
3100 with_liboping="yes"
3101 else if test "x$withval" = "xno"
3102 then
3103 with_liboping="no"
3104 else
3105 with_liboping="yes"
3106 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
3107 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
3108 fi; fi
3109 ],
3110 [with_liboping="yes"])
3112 SAVE_CPPFLAGS="$CPPFLAGS"
3113 SAVE_LDFLAGS="$LDFLAGS"
3115 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
3116 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
3118 if test "x$with_liboping" = "xyes"
3119 then
3120 if test "x$LIBOPING_CPPFLAGS" != "x"
3121 then
3122 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
3123 fi
3124 AC_CHECK_HEADERS(oping.h,
3125 [with_liboping="yes"],
3126 [with_liboping="no (oping.h not found)"])
3127 fi
3128 if test "x$with_liboping" = "xyes"
3129 then
3130 if test "x$LIBOPING_LDFLAGS" != "x"
3131 then
3132 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
3133 fi
3134 AC_CHECK_LIB(oping, ping_construct,
3135 [with_liboping="yes"],
3136 [with_liboping="no (symbol 'ping_construct' not found)"])
3137 fi
3139 CPPFLAGS="$SAVE_CPPFLAGS"
3140 LDFLAGS="$SAVE_LDFLAGS"
3142 if test "x$with_liboping" = "xyes"
3143 then
3144 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
3145 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
3146 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
3147 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
3148 fi
3149 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
3150 # }}}
3152 # --with-oracle {{{
3153 with_oracle_cppflags=""
3154 with_oracle_libs=""
3155 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
3156 [
3157 if test "x$withval" = "xyes"
3158 then
3159 if test "x$ORACLE_HOME" = "x"
3160 then
3161 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
3162 fi
3163 with_oracle="yes"
3164 else if test "x$withval" = "xno"
3165 then
3166 with_oracle="no"
3167 else
3168 with_oracle="yes"
3169 ORACLE_HOME="$withval"
3170 fi; fi
3171 ],
3172 [
3173 if test "x$ORACLE_HOME" = "x"
3174 then
3175 with_oracle="no (ORACLE_HOME is not set)"
3176 else
3177 with_oracle="yes"
3178 fi
3179 ])
3180 if test "x$ORACLE_HOME" != "x"
3181 then
3182 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
3184 if test -e "$ORACLE_HOME/lib/ldflags"
3185 then
3186 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
3187 fi
3188 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
3189 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
3190 fi
3191 if test "x$with_oracle" = "xyes"
3192 then
3193 SAVE_CPPFLAGS="$CPPFLAGS"
3194 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3196 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
3198 CPPFLAGS="$SAVE_CPPFLAGS"
3199 fi
3200 if test "x$with_oracle" = "xyes"
3201 then
3202 SAVE_CPPFLAGS="$CPPFLAGS"
3203 SAVE_LIBS="$LIBS"
3204 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3205 LIBS="$LIBS $with_oracle_libs"
3207 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
3209 CPPFLAGS="$SAVE_CPPFLAGS"
3210 LIBS="$SAVE_LIBS"
3211 fi
3212 if test "x$with_oracle" = "xyes"
3213 then
3214 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
3215 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
3216 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
3217 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
3218 fi
3219 # }}}
3221 # --with-libowcapi {{{
3222 with_libowcapi_cppflags=""
3223 with_libowcapi_libs="-lowcapi"
3224 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
3225 [
3226 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3227 then
3228 with_libowcapi_cppflags="-I$withval/include"
3229 with_libowcapi_libs="-L$withval/lib -lowcapi"
3230 with_libowcapi="yes"
3231 else
3232 with_libowcapi="$withval"
3233 fi
3234 ],
3235 [
3236 with_libowcapi="yes"
3237 ])
3238 if test "x$with_libowcapi" = "xyes"
3239 then
3240 SAVE_CPPFLAGS="$CPPFLAGS"
3241 CPPFLAGS="$with_libowcapi_cppflags"
3243 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
3245 CPPFLAGS="$SAVE_CPPFLAGS"
3246 fi
3247 if test "x$with_libowcapi" = "xyes"
3248 then
3249 SAVE_LDFLAGS="$LDFLAGS"
3250 SAVE_CPPFLAGS="$CPPFLAGS"
3251 LDFLAGS="$with_libowcapi_libs"
3252 CPPFLAGS="$with_libowcapi_cppflags"
3254 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
3256 LDFLAGS="$SAVE_LDFLAGS"
3257 CPPFLAGS="$SAVE_CPPFLAGS"
3258 fi
3259 if test "x$with_libowcapi" = "xyes"
3260 then
3261 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3262 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3263 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3264 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3265 fi
3266 # }}}
3268 # --with-libpcap {{{
3269 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3270 [
3271 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3272 then
3273 LDFLAGS="$LDFLAGS -L$withval/lib"
3274 CPPFLAGS="$CPPFLAGS -I$withval/include"
3275 with_libpcap="yes"
3276 else
3277 with_libpcap="$withval"
3278 fi
3279 ],
3280 [
3281 with_libpcap="yes"
3282 ])
3283 if test "x$with_libpcap" = "xyes"
3284 then
3285 AC_CHECK_LIB(pcap, pcap_open_live,
3286 [
3287 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3288 ], [with_libpcap="no (libpcap not found)"])
3289 fi
3290 if test "x$with_libpcap" = "xyes"
3291 then
3292 AC_CHECK_HEADERS(pcap.h,,
3293 [with_libpcap="no (pcap.h not found)"])
3294 fi
3295 if test "x$with_libpcap" = "xyes"
3296 then
3297 AC_CHECK_HEADERS(pcap-bpf.h,,
3298 [with_libpcap="no (pcap-bpf.h not found)"])
3299 fi
3300 if test "x$with_libpcap" = "xyes"
3301 then
3302 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3303 [c_cv_libpcap_have_pcap_error_iface_not_up],
3304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3305 [[[
3306 #include <pcap.h>
3307 ]]],
3308 [[[
3309 int val = PCAP_ERROR_IFACE_NOT_UP;
3310 return(val);
3311 ]]]
3312 )],
3313 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3314 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3315 fi
3316 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3317 then
3318 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3319 fi
3320 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3321 # }}}
3323 # --with-libperl {{{
3324 perl_interpreter="perl"
3325 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3326 [
3327 if test -f "$withval" && test -x "$withval"
3328 then
3329 perl_interpreter="$withval"
3330 with_libperl="yes"
3331 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3332 then
3333 LDFLAGS="$LDFLAGS -L$withval/lib"
3334 CPPFLAGS="$CPPFLAGS -I$withval/include"
3335 perl_interpreter="$withval/bin/perl"
3336 with_libperl="yes"
3337 else
3338 with_libperl="$withval"
3339 fi; fi
3340 ],
3341 [
3342 with_libperl="yes"
3343 ])
3345 AC_MSG_CHECKING([for perl])
3346 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3347 if test -x "$perl_interpreter"
3348 then
3349 AC_MSG_RESULT([yes ($perl_interpreter)])
3350 else
3351 perl_interpreter=""
3352 AC_MSG_RESULT([no])
3353 fi
3355 AC_SUBST(PERL, "$perl_interpreter")
3357 if test "x$with_libperl" = "xyes" \
3358 && test -n "$perl_interpreter"
3359 then
3360 SAVE_CFLAGS="$CFLAGS"
3361 SAVE_LIBS="$LIBS"
3362 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3363 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3364 PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3365 CFLAGS="$CFLAGS $PERL_CFLAGS"
3366 LIBS="$LIBS $PERL_LIBS"
3368 AC_CACHE_CHECK([for libperl],
3369 [c_cv_have_libperl],
3370 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3371 [[[
3372 #define PERL_NO_GET_CONTEXT
3373 #include <EXTERN.h>
3374 #include <perl.h>
3375 #include <XSUB.h>
3376 ]]],
3377 [[[
3378 dTHX;
3379 load_module (PERL_LOADMOD_NOIMPORT,
3380 newSVpv ("Collectd::Plugin::FooBar", 24),
3381 Nullsv);
3382 ]]]
3383 )],
3384 [c_cv_have_libperl="yes"],
3385 [c_cv_have_libperl="no"]
3386 )
3387 )
3389 if test "x$c_cv_have_libperl" = "xyes"
3390 then
3391 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3392 AC_SUBST(PERL_CFLAGS)
3393 AC_SUBST(PERL_LIBS)
3394 else
3395 with_libperl="no"
3396 fi
3398 CFLAGS="$SAVE_CFLAGS"
3399 LIBS="$SAVE_LIBS"
3400 else if test -z "$perl_interpreter"; then
3401 with_libperl="no (no perl interpreter found)"
3402 c_cv_have_libperl="no"
3403 fi; fi
3404 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3406 if test "x$with_libperl" = "xyes"
3407 then
3408 SAVE_CFLAGS="$CFLAGS"
3409 SAVE_LIBS="$LIBS"
3410 CFLAGS="$CFLAGS $PERL_CFLAGS"
3411 LIBS="$LIBS $PERL_LIBS"
3413 AC_CACHE_CHECK([if perl supports ithreads],
3414 [c_cv_have_perl_ithreads],
3415 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3416 [[[
3417 #include <EXTERN.h>
3418 #include <perl.h>
3419 #include <XSUB.h>
3421 #if !defined(USE_ITHREADS)
3422 # error "Perl does not support ithreads!"
3423 #endif /* !defined(USE_ITHREADS) */
3424 ]]],
3425 [[[ ]]]
3426 )],
3427 [c_cv_have_perl_ithreads="yes"],
3428 [c_cv_have_perl_ithreads="no"]
3429 )
3430 )
3432 if test "x$c_cv_have_perl_ithreads" = "xyes"
3433 then
3434 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3435 fi
3437 CFLAGS="$SAVE_CFLAGS"
3438 LIBS="$SAVE_LIBS"
3439 fi
3441 if test "x$with_libperl" = "xyes"
3442 then
3443 SAVE_CFLAGS="$CFLAGS"
3444 SAVE_LIBS="$LIBS"
3445 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3446 # (see issues #41 and #42)
3447 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3448 LIBS="$LIBS $PERL_LIBS"
3450 AC_CACHE_CHECK([for broken Perl_load_module()],
3451 [c_cv_have_broken_perl_load_module],
3452 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3453 [[[
3454 #define PERL_NO_GET_CONTEXT
3455 #include <EXTERN.h>
3456 #include <perl.h>
3457 #include <XSUB.h>
3458 ]]],
3459 [[[
3460 dTHX;
3461 load_module (PERL_LOADMOD_NOIMPORT,
3462 newSVpv ("Collectd::Plugin::FooBar", 24),
3463 Nullsv);
3464 ]]]
3465 )],
3466 [c_cv_have_broken_perl_load_module="no"],
3467 [c_cv_have_broken_perl_load_module="yes"]
3468 )
3469 )
3471 CFLAGS="$SAVE_CFLAGS"
3472 LIBS="$SAVE_LIBS"
3473 fi
3474 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3475 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3477 if test "x$with_libperl" = "xyes"
3478 then
3479 SAVE_CFLAGS="$CFLAGS"
3480 SAVE_LIBS="$LIBS"
3481 CFLAGS="$CFLAGS $PERL_CFLAGS"
3482 LIBS="$LIBS $PERL_LIBS"
3484 AC_CHECK_MEMBER(
3485 [struct mgvtbl.svt_local],
3486 [have_struct_mgvtbl_svt_local="yes"],
3487 [have_struct_mgvtbl_svt_local="no"],
3488 [
3489 #include <EXTERN.h>
3490 #include <perl.h>
3491 #include <XSUB.h>
3492 ])
3494 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3495 then
3496 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3497 [Define if Perl's struct mgvtbl has member svt_local.])
3498 fi
3500 CFLAGS="$SAVE_CFLAGS"
3501 LIBS="$SAVE_LIBS"
3502 fi
3503 # }}}
3505 # --with-libpq {{{
3506 with_pg_config="pg_config"
3507 with_libpq_includedir=""
3508 with_libpq_libdir=""
3509 with_libpq_cppflags=""
3510 with_libpq_ldflags=""
3511 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3512 [Path to libpq.])],
3513 [
3514 if test "x$withval" = "xno"
3515 then
3516 with_libpq="no"
3517 else if test "x$withval" = "xyes"
3518 then
3519 with_libpq="yes"
3520 else
3521 if test -f "$withval" && test -x "$withval";
3522 then
3523 with_pg_config="$withval"
3524 else if test -x "$withval/bin/pg_config"
3525 then
3526 with_pg_config="$withval/bin/pg_config"
3527 fi; fi
3528 with_libpq="yes"
3529 fi; fi
3530 ],
3531 [
3532 with_libpq="yes"
3533 ])
3534 if test "x$with_libpq" = "xyes"
3535 then
3536 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3537 pg_config_status=$?
3539 if test $pg_config_status -eq 0
3540 then
3541 if test -n "$with_libpq_includedir"; then
3542 for dir in $with_libpq_includedir; do
3543 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3544 done
3545 fi
3546 else
3547 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3548 fi
3550 SAVE_CPPFLAGS="$CPPFLAGS"
3551 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3553 AC_CHECK_HEADERS(libpq-fe.h, [],
3554 [with_libpq="no (libpq-fe.h not found)"], [])
3556 CPPFLAGS="$SAVE_CPPFLAGS"
3557 fi
3558 if test "x$with_libpq" = "xyes"
3559 then
3560 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3561 pg_config_status=$?
3563 if test $pg_config_status -eq 0
3564 then
3565 if test -n "$with_libpq_libdir"; then
3566 for dir in $with_libpq_libdir; do
3567 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3568 done
3569 fi
3570 else
3571 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3572 fi
3574 SAVE_LDFLAGS="$LDFLAGS"
3575 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3577 AC_CHECK_LIB(pq, PQconnectdb,
3578 [with_libpq="yes"],
3579 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3581 AC_CHECK_LIB(pq, PQserverVersion,
3582 [with_libpq="yes"],
3583 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3585 LDFLAGS="$SAVE_LDFLAGS"
3586 fi
3587 if test "x$with_libpq" = "xyes"
3588 then
3589 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3590 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3591 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3592 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3593 fi
3594 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3595 # }}}
3597 # --with-libpthread {{{
3598 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3599 [ if test "x$withval" != "xno" \
3600 && test "x$withval" != "xyes"
3601 then
3602 LDFLAGS="$LDFLAGS -L$withval/lib"
3603 CPPFLAGS="$CPPFLAGS -I$withval/include"
3604 with_libpthread="yes"
3605 else
3606 if test "x$withval" = "xno"
3607 then
3608 with_libpthread="no (disabled)"
3609 fi
3610 fi
3611 ], [with_libpthread="yes"])
3612 if test "x$with_libpthread" = "xyes"
3613 then
3614 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3615 fi
3617 if test "x$with_libpthread" = "xyes"
3618 then
3619 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3620 fi
3621 if test "x$with_libpthread" = "xyes"
3622 then
3623 collect_pthread=1
3624 else
3625 collect_pthread=0
3626 fi
3627 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3628 [Wether or not to use pthread (POSIX threads) library])
3629 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3630 # }}}
3632 # --with-python {{{
3633 with_python_prog=""
3634 with_python_path="$PATH"
3635 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3636 [
3637 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3638 then
3639 with_python="$withval"
3640 else if test -x "$withval"
3641 then
3642 with_python_prog="$withval"
3643 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3644 with_python="yes"
3645 else if test -d "$withval"
3646 then
3647 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3648 with_python="yes"
3649 else
3650 AC_MSG_WARN([Argument not recognized: $withval])
3651 fi; fi; fi
3652 ], [with_python="yes"])
3654 SAVE_PATH="$PATH"
3655 SAVE_CPPFLAGS="$CPPFLAGS"
3656 SAVE_LDFLAGS="$LDFLAGS"
3657 SAVE_LIBS="$LIBS"
3659 PATH="$with_python_path"
3661 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3662 then
3663 AC_MSG_CHECKING([for python])
3664 with_python_prog="`which python 2>/dev/null`"
3665 if test "x$with_python_prog" = "x"
3666 then
3667 AC_MSG_RESULT([not found])
3668 with_python="no (interpreter not found)"
3669 else
3670 AC_MSG_RESULT([$with_python_prog])
3671 fi
3672 fi
3674 if test "x$with_python" = "xyes"
3675 then
3676 AC_MSG_CHECKING([for Python CPPFLAGS])
3677 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3678 python_config_status=$?
3680 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3681 then
3682 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3683 with_python="no"
3684 else
3685 AC_MSG_RESULT([$python_include_path])
3686 fi
3687 fi
3689 if test "x$with_python" = "xyes"
3690 then
3691 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3692 AC_CHECK_HEADERS(Python.h,
3693 [with_python="yes"],
3694 [with_python="no ('Python.h' not found)"])
3695 fi
3697 if test "x$with_python" = "xyes"
3698 then
3699 AC_MSG_CHECKING([for Python LDFLAGS])
3700 python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
3701 python_config_status=$?
3703 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3704 then
3705 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3706 with_python="no"
3707 else
3708 AC_MSG_RESULT([$python_library_path])
3709 fi
3710 fi
3712 if test "x$with_python" = "xyes"
3713 then
3714 AC_MSG_CHECKING([for Python LIBS])
3715 python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
3716 python_config_status=$?
3718 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3719 then
3720 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3721 with_python="no"
3722 else
3723 AC_MSG_RESULT([$python_library_flags])
3724 fi
3725 fi
3727 if test "x$with_python" = "xyes"
3728 then
3729 LDFLAGS="-L$python_library_path $LDFLAGS"
3730 LIBS="$python_library_flags $LIBS"
3732 AC_CHECK_FUNC(PyObject_CallFunction,
3733 [with_python="yes"],
3734 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3735 fi
3737 PATH="$SAVE_PATH"
3738 CPPFLAGS="$SAVE_CPPFLAGS"
3739 LDFLAGS="$SAVE_LDFLAGS"
3740 LIBS="$SAVE_LIBS"
3742 if test "x$with_python" = "xyes"
3743 then
3744 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3745 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3746 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3747 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3748 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3749 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3750 fi
3751 # }}} --with-python
3753 # --with-librabbitmq {{{
3754 with_librabbitmq_cppflags=""
3755 with_librabbitmq_ldflags=""
3756 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3757 [
3758 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3759 then
3760 with_librabbitmq_cppflags="-I$withval/include"
3761 with_librabbitmq_ldflags="-L$withval/lib"
3762 with_librabbitmq="yes"
3763 else
3764 with_librabbitmq="$withval"
3765 fi
3766 ],
3767 [
3768 with_librabbitmq="yes"
3769 ])
3770 SAVE_CPPFLAGS="$CPPFLAGS"
3771 SAVE_LDFLAGS="$LDFLAGS"
3772 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3773 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3774 if test "x$with_librabbitmq" = "xyes"
3775 then
3776 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3777 fi
3778 if test "x$with_librabbitmq" = "xyes"
3779 then
3780 # librabbitmq up to version 0.9.1 provides "library_errno", later
3781 # versions use "library_error". The library does not provide a version
3782 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3783 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3784 [
3785 #if HAVE_STDLIB_H
3786 # include <stdlib.h>
3787 #endif
3788 #if HAVE_STDIO_H
3789 # include <stdio.h>
3790 #endif
3791 #if HAVE_STDINT_H
3792 # include <stdint.h>
3793 #endif
3794 #if HAVE_INTTYPES_H
3795 # include <inttypes.h>
3796 #endif
3797 #include <amqp.h>
3798 ])
3799 fi
3800 if test "x$with_librabbitmq" = "xyes"
3801 then
3802 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3803 fi
3804 if test "x$with_librabbitmq" = "xyes"
3805 then
3806 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3807 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3808 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3809 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3810 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3811 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3812 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3813 fi
3814 CPPFLAGS="$SAVE_CPPFLAGS"
3815 LDFLAGS="$SAVE_LDFLAGS"
3816 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3818 with_amqp_tcp_socket="no"
3819 if test "x$with_librabbitmq" = "xyes"
3820 then
3821 SAVE_CPPFLAGS="$CPPFLAGS"
3822 SAVE_LDFLAGS="$LDFLAGS"
3823 SAVE_LIBS="$LIBS"
3824 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3825 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3826 LIBS="-lrabbitmq"
3828 AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3829 AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3830 if test "x$with_amqp_tcp_socket" = "xyes"
3831 then
3832 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3833 [Define if librabbitmq provides the new TCP socket interface.])
3834 fi
3836 AC_CHECK_DECLS(amqp_socket_close,
3837 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3838 [[
3839 #include <amqp.h>
3840 #ifdef HAVE_AMQP_TCP_SOCKET_H
3841 # include <amqp_tcp_socket.h>
3842 #endif
3843 #ifdef HAVE_AMQP_SOCKET_H
3844 # include <amqp_socket.h>
3845 #endif
3846 ]])
3848 CPPFLAGS="$SAVE_CPPFLAGS"
3849 LDFLAGS="$SAVE_LDFLAGS"
3850 LIBS="$SAVE_LIBS"
3851 fi
3852 # }}}
3854 # --with-librdkafka {{{
3855 AC_ARG_WITH(librdkafka, [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Path to librdkafka.])],
3856 [
3857 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3858 then
3859 with_librdkafka_cppflags="-I$withval/include"
3860 with_librdkafka_ldflags="-L$withval/lib"
3861 with_librdkafka_rpath="$withval/lib"
3862 with_librdkafka="yes"
3863 else
3864 with_librdkafka="$withval"
3865 fi
3866 ],
3867 [
3868 with_librdkafka="yes"
3869 ])
3870 SAVE_CPPFLAGS="$CPPFLAGS"
3871 SAVE_LDFLAGS="$LDFLAGS"
3873 CPPFLAGS="$CPPFLAGS $with_librdkafka_cppflags"
3874 LDFLAGS="$LDFLAGS $with_librdkafka_ldflags"
3876 if test "x$with_librdkafka" = "xyes"
3877 then
3878 AC_CHECK_HEADERS(librdkafka/rdkafka.h, [with_librdkafka="yes"], [with_librdkafka="no (librdkafka/rdkafka.h not found)"])
3879 fi
3881 if test "x$with_librdkafka" = "xyes"
3882 then
3883 AC_CHECK_LIB(rdkafka, rd_kafka_new, [with_librdkafka="yes"], [with_librdkafka="no (Symbol 'rd_kafka_new' not found)"])
3884 AC_CHECK_LIB(rdkafka, rd_kafka_conf_set_log_cb, [with_librdkafka_log_cb="yes"], [with_librdkafka_log_cb="no"])
3885 AC_CHECK_LIB(rdkafka, rd_kafka_set_logger, [with_librdkafka_logger="yes"], [with_librdkafka_logger="no"])
3886 fi
3887 if test "x$with_librdkafka" = "xyes"
3888 then
3889 BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags"
3890 BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags"
3891 if test "x$with_librdkafka_rpath" != "x"
3892 then
3893 BUILD_WITH_LIBRDKAFKA_LIBS="-Wl,-rpath,$with_librdkafka_rpath -lrdkafka"
3894 else
3895 BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka"
3896 fi
3897 AC_SUBST(BUILD_WITH_LIBRDKAFKA_CPPFLAGS)
3898 AC_SUBST(BUILD_WITH_LIBRDKAFKA_LDFLAGS)
3899 AC_SUBST(BUILD_WITH_LIBRDKAFKA_LIBS)
3900 AC_DEFINE(HAVE_LIBRDKAFKA, 1, [Define if librdkafka is present and usable.])
3901 if test "x$with_librdkafka_log_cb" = "xyes"
3902 then
3903 AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
3904 fi
3905 if test "x$with_librdkafka_logger" = "xyes"
3906 then
3907 AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
3908 fi
3909 fi
3910 CPPFLAGS="$SAVE_CPPFLAGS"
3911 LDFLAGS="$SAVE_LDFLAGS"
3912 AM_CONDITIONAL(BUILD_WITH_LIBRDKAFKA, test "x$with_librdkafka" = "xyes")
3914 # }}}
3916 # --with-librouteros {{{
3917 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3918 [
3919 if test "x$withval" = "xyes"
3920 then
3921 with_librouteros="yes"
3922 else if test "x$withval" = "xno"
3923 then
3924 with_librouteros="no"
3925 else
3926 with_librouteros="yes"
3927 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3928 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3929 fi; fi
3930 ],
3931 [with_librouteros="yes"])
3933 SAVE_CPPFLAGS="$CPPFLAGS"
3934 SAVE_LDFLAGS="$LDFLAGS"
3936 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3937 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3939 if test "x$with_librouteros" = "xyes"
3940 then
3941 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3942 then
3943 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3944 fi
3945 AC_CHECK_HEADERS(routeros_api.h,
3946 [with_librouteros="yes"],
3947 [with_librouteros="no (routeros_api.h not found)"])
3948 fi
3949 if test "x$with_librouteros" = "xyes"
3950 then
3951 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3952 then
3953 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3954 fi
3955 AC_CHECK_LIB(routeros, ros_interface,
3956 [with_librouteros="yes"],
3957 [with_librouteros="no (symbol 'ros_interface' not found)"])
3958 fi
3960 CPPFLAGS="$SAVE_CPPFLAGS"
3961 LDFLAGS="$SAVE_LDFLAGS"
3963 if test "x$with_librouteros" = "xyes"
3964 then
3965 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3966 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3967 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3968 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3969 fi
3970 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3971 # }}}
3973 # --with-librrd {{{
3974 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3975 librrd_cflags=""
3976 librrd_ldflags=""
3977 librrd_threadsafe="yes"
3978 librrd_rrdc_update="no"
3979 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3980 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3981 then
3982 librrd_cflags="-I$withval/include"
3983 librrd_ldflags="-L$withval/lib"
3984 with_librrd="yes"
3985 else
3986 with_librrd="$withval"
3987 fi
3988 ], [with_librrd="yes"])
3989 if test "x$with_librrd" = "xyes"
3990 then
3991 SAVE_CPPFLAGS="$CPPFLAGS"
3992 SAVE_LDFLAGS="$LDFLAGS"
3994 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3995 LDFLAGS="$LDFLAGS $librrd_ldflags"
3997 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3999 CPPFLAGS="$SAVE_CPPFLAGS"
4000 LDFLAGS="$SAVE_LDFLAGS"
4001 fi
4002 if test "x$with_librrd" = "xyes"
4003 then
4004 SAVE_CPPFLAGS="$CPPFLAGS"
4005 SAVE_LDFLAGS="$LDFLAGS"
4007 CPPFLAGS="$CPPFLAGS $librrd_cflags"
4008 LDFLAGS="$LDFLAGS $librrd_ldflags"
4010 AC_CHECK_LIB(rrd_th, rrd_update_r,
4011 [with_librrd="yes"
4012 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
4013 ],
4014 [librrd_threadsafe="no"
4015 AC_CHECK_LIB(rrd, rrd_update,
4016 [with_librrd="yes"
4017 librrd_ldflags="$librrd_ldflags -lrrd -lm"
4018 ],
4019 [with_librrd="no (symbol 'rrd_update' not found)"],
4020 [-lm])
4021 ],
4022 [-lm])
4024 if test "x$librrd_threadsafe" = "xyes"
4025 then
4026 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
4027 else
4028 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
4029 fi
4031 CPPFLAGS="$SAVE_CPPFLAGS"
4032 LDFLAGS="$SAVE_LDFLAGS"
4033 fi
4034 if test "x$with_librrd" = "xyes"
4035 then
4036 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
4037 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
4038 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
4039 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
4040 fi
4041 if test "x$librrd_threadsafe" = "xyes"
4042 then
4043 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
4044 fi
4045 # }}}
4047 # --with-libsensors {{{
4048 with_sensors_cflags=""
4049 with_sensors_ldflags=""
4050 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
4051 [
4052 if test "x$withval" = "xno"
4053 then
4054 with_libsensors="no"
4055 else
4056 with_libsensors="yes"
4057 if test "x$withval" != "xyes"
4058 then
4059 with_sensors_cflags="-I$withval/include"
4060 with_sensors_ldflags="-L$withval/lib"
4061 with_libsensors="yes"
4062 fi
4063 fi
4064 ],
4065 [
4066 if test "x$ac_system" = "xLinux"
4067 then
4068 with_libsensors="yes"
4069 else
4070 with_libsensors="no (Linux only library)"
4071 fi
4072 ])
4073 if test "x$with_libsensors" = "xyes"
4074 then
4075 SAVE_CPPFLAGS="$CPPFLAGS"
4076 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
4078 # AC_CHECK_HEADERS(sensors/sensors.h,
4079 # [
4080 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
4081 # ],
4082 # [with_libsensors="no (sensors/sensors.h not found)"])
4083 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
4085 CPPFLAGS="$SAVE_CPPFLAGS"
4086 fi
4087 if test "x$with_libsensors" = "xyes"
4088 then
4089 SAVE_CPPFLAGS="$CPPFLAGS"
4090 SAVE_LDFLAGS="$LDFLAGS"
4091 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
4092 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
4094 AC_CHECK_LIB(sensors, sensors_init,
4095 [
4096 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
4097 ],
4098 [with_libsensors="no (libsensors not found)"])
4100 CPPFLAGS="$SAVE_CPPFLAGS"
4101 LDFLAGS="$SAVE_LDFLAGS"
4102 fi
4103 if test "x$with_libsensors" = "xyes"
4104 then
4105 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
4106 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
4107 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
4108 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
4109 fi
4110 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
4111 # }}}
4113 # --with-libsigrok {{{
4114 with_libsigrok_cflags=""
4115 with_libsigrok_ldflags=""
4116 AC_ARG_WITH(libsigrok, [AS_HELP_STRING([--with-libsigrok@<:@=PREFIX@:>@], [Path to libsigrok.])],
4117 [
4118 if test "x$withval" = "xno"
4119 then
4120 with_libsigrok="no"
4121 else
4122 with_libsigrok="yes"
4123 if test "x$withval" != "xyes"
4124 then
4125 with_libsigrok_cflags="-I$withval/include"
4126 with_libsigrok_ldflags="-L$withval/lib"
4127 fi
4128 fi
4129 ],[with_libsigrok="yes"])
4131 # libsigrok has a glib dependency
4132 if test "x$with_libsigrok" = "xyes"
4133 then
4134 m4_ifdef([AM_PATH_GLIB_2_0],
4135 [
4136 AM_PATH_GLIB_2_0([2.28.0],
4137 [with_libsigrok_cflags="$with_libsigrok_cflags $GLIB_CFLAGS"; with_libsigrok_ldflags="$with_libsigrok_ldflags $GLIB_LIBS"])
4138 ],
4139 [
4140 with_libsigrok="no (glib not available)"
4141 ]
4142 )
4143 fi
4145 # libsigrok headers
4146 if test "x$with_libsigrok" = "xyes"
4147 then
4148 SAVE_CPPFLAGS="$CPPFLAGS"
4149 CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags"
4151 AC_CHECK_HEADERS(libsigrok/libsigrok.h, [], [with_libsigrok="no (libsigrok/libsigrok.h not found)"])
4153 CPPFLAGS="$SAVE_CPPFLAGS"
4154 fi
4156 # libsigrok library
4157 if test "x$with_libsigrok" = "xyes"
4158 then
4159 SAVE_CPPFLAGS="$CPPFLAGS"
4160 SAVE_LDFLAGS="$LDFLAGS"
4161 CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags"
4162 LDFLAGS="$LDFLAGS $with_libsigrok_ldflags"
4164 AC_CHECK_LIB(sigrok, sr_init,
4165 [
4166 AC_DEFINE(HAVE_LIBSIGROK, 1, [Define to 1 if you have the sigrok library (-lsigrok).])
4167 ],
4168 [with_libsigrok="no (libsigrok not found)"])
4170 CPPFLAGS="$SAVE_CPPFLAGS"
4171 LDFLAGS="$SAVE_LDFLAGS"
4172 fi
4173 if test "x$with_libsigrok" = "xyes"
4174 then
4175 BUILD_WITH_LIBSIGROK_CFLAGS="$with_libsigrok_cflags"
4176 BUILD_WITH_LIBSIGROK_LDFLAGS="$with_libsigrok_ldflags"
4177 AC_SUBST(BUILD_WITH_LIBSIGROK_CFLAGS)
4178 AC_SUBST(BUILD_WITH_LIBSIGROK_LDFLAGS)
4179 fi
4180 AM_CONDITIONAL(BUILD_WITH_LIBSIGROK, test "x$with_libsigrok" = "xyes")
4181 # }}}
4183 # --with-libstatgrab {{{
4184 with_libstatgrab_cflags=""
4185 with_libstatgrab_ldflags=""
4186 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
4187 [
4188 if test "x$withval" != "xno" \
4189 && test "x$withval" != "xyes"
4190 then
4191 with_libstatgrab_cflags="-I$withval/include"
4192 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
4193 with_libstatgrab="yes"
4194 with_libstatgrab_pkg_config="no"
4195 else
4196 with_libstatgrab="$withval"
4197 with_libstatgrab_pkg_config="yes"
4198 fi
4199 ],
4200 [
4201 with_libstatgrab="yes"
4202 with_libstatgrab_pkg_config="yes"
4203 ])
4205 if test "x$with_libstatgrab" = "xyes" \
4206 && test "x$with_libstatgrab_pkg_config" = "xyes"
4207 then
4208 if test "x$PKG_CONFIG" != "x"
4209 then
4210 AC_MSG_CHECKING([pkg-config for libstatgrab])
4211 temp_result="found"
4212 $PKG_CONFIG --exists libstatgrab 2>/dev/null
4213 if test "$?" != "0"
4214 then
4215 with_libstatgrab_pkg_config="no"
4216 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
4217 temp_result="not found"
4218 fi
4219 AC_MSG_RESULT([$temp_result])
4220 else
4221 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
4222 with_libstatgrab_pkg_config="no"
4223 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
4224 fi
4225 fi
4227 if test "x$with_libstatgrab" = "xyes" \
4228 && test "x$with_libstatgrab_pkg_config" = "xyes" \
4229 && test "x$with_libstatgrab_cflags" = "x"
4230 then
4231 AC_MSG_CHECKING([for libstatgrab CFLAGS])
4232 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
4233 if test "$?" = "0"
4234 then
4235 with_libstatgrab_cflags="$temp_result"
4236 else
4237 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
4238 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
4239 fi
4240 AC_MSG_RESULT([$temp_result])
4241 fi
4243 if test "x$with_libstatgrab" = "xyes" \
4244 && test "x$with_libstatgrab_pkg_config" = "xyes" \
4245 && test "x$with_libstatgrab_ldflags" = "x"
4246 then
4247 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
4248 temp_result="`$PKG_CONFIG --libs libstatgrab`"
4249 if test "$?" = "0"
4250 then
4251 with_libstatgrab_ldflags="$temp_result"
4252 else
4253 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
4254 temp_result="$PKG_CONFIG --libs libstatgrab failed"
4255 fi
4256 AC_MSG_RESULT([$temp_result])
4257 fi
4259 if test "x$with_libstatgrab" = "xyes"
4260 then
4261 SAVE_CPPFLAGS="$CPPFLAGS"
4262 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
4264 AC_CHECK_HEADERS(statgrab.h,
4265 [with_libstatgrab="yes"],
4266 [with_libstatgrab="no (statgrab.h not found)"])
4268 CPPFLAGS="$SAVE_CPPFLAGS"
4269 fi
4271 if test "x$with_libstatgrab" = "xyes"
4272 then
4273 SAVE_CFLAGS="$CFLAGS"
4274 SAVE_LDFLAGS="$LDFLAGS"
4276 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
4277 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
4279 AC_CHECK_LIB(statgrab, sg_init,
4280 [with_libstatgrab="yes"],
4281 [with_libstatgrab="no (symbol sg_init not found)"])
4283 CFLAGS="$SAVE_CFLAGS"
4284 LDFLAGS="$SAVE_LDFLAGS"
4285 fi
4287 if test "x$with_libstatgrab" = "xyes"
4288 then
4289 SAVE_CFLAGS="$CFLAGS"
4290 SAVE_LIBS="$LIBS"
4292 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
4293 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
4294 LIBS="-lstatgrab $LIBS"
4296 AC_CACHE_CHECK([if libstatgrab >= 0.90],
4297 [c_cv_have_libstatgrab_0_90],
4298 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4299 [[[
4300 #include <stdio.h>
4301 #include <statgrab.h>
4302 ]]],
4303 [[[
4304 if (sg_init()) return 0;
4305 ]]]
4306 )],
4307 [c_cv_have_libstatgrab_0_90="no"],
4308 [c_cv_have_libstatgrab_0_90="yes"]
4309 )
4310 )
4312 CFLAGS="$SAVE_CFLAGS"
4313 LDFLAGS="$SAVE_LDFLAGS"
4314 LIBS="$SAVE_LIBS"
4315 fi
4317 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
4318 if test "x$with_libstatgrab" = "xyes"
4319 then
4320 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
4321 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
4322 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
4323 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
4324 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
4325 if test "x$c_cv_have_libstatgrab_0_90" = "xyes"
4326 then
4327 AC_DEFINE(HAVE_LIBSTATGRAB_0_90, 1, [Define to 1 if libstatgrab version >= 0.90])
4328 fi
4329 fi
4330 # }}}
4332 # --with-libtokyotyrant {{{
4333 with_libtokyotyrant_cppflags=""
4334 with_libtokyotyrant_ldflags=""
4335 with_libtokyotyrant_libs=""
4336 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
4337 [
4338 if test "x$withval" = "xno"
4339 then
4340 with_libtokyotyrant="no"
4341 else if test "x$withval" = "xyes"
4342 then
4343 with_libtokyotyrant="yes"
4344 else
4345 with_libtokyotyrant_cppflags="-I$withval/include"
4346 with_libtokyotyrant_ldflags="-L$withval/include"
4347 with_libtokyotyrant_libs="-ltokyotyrant"
4348 with_libtokyotyrant="yes"
4349 fi; fi
4350 ],
4351 [
4352 with_libtokyotyrant="yes"
4353 ])
4355 if test "x$with_libtokyotyrant" = "xyes"
4356 then
4357 if $PKG_CONFIG --exists tokyotyrant
4358 then
4359 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
4360 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
4361 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
4362 fi
4363 fi
4365 SAVE_CPPFLAGS="$CPPFLAGS"
4366 SAVE_LDFLAGS="$LDFLAGS"
4367 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
4368 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
4370 if test "x$with_libtokyotyrant" = "xyes"
4371 then
4372 AC_CHECK_HEADERS(tcrdb.h,
4373 [
4374 AC_DEFINE(HAVE_TCRDB_H, 1,
4375 [Define to 1 if you have the <tcrdb.h> header file.])
4376 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
4377 fi
4379 if test "x$with_libtokyotyrant" = "xyes"
4380 then
4381 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
4382 [
4383 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
4384 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
4385 ],
4386 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
4387 [$with_libtokyotyrant_libs])
4388 fi
4390 CPPFLAGS="$SAVE_CPPFLAGS"
4391 LDFLAGS="$SAVE_LDFLAGS"
4393 if test "x$with_libtokyotyrant" = "xyes"
4394 then
4395 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
4396 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
4397 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
4398 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
4399 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
4400 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
4401 fi
4402 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
4403 # }}}
4405 # --with-libudev {{{
4406 with_libudev_cflags=""
4407 with_libudev_ldflags=""
4408 AC_ARG_WITH(libudev, [AS_HELP_STRING([--with-libudev@<:@=PREFIX@:>@], [Path to libudev.])],
4409 [
4410 if test "x$withval" = "xno"
4411 then
4412 with_libudev="no"
4413 else
4414 with_libudev="yes"
4415 if test "x$withval" != "xyes"
4416 then
4417 with_libudev_cflags="-I$withval/include"
4418 with_libudev_ldflags="-L$withval/lib"
4419 with_libudev="yes"
4420 fi
4421 fi
4422 ],
4423 [
4424 if test "x$ac_system" = "xLinux"
4425 then
4426 with_libudev="yes"
4427 else
4428 with_libudev="no (Linux only library)"
4429 fi
4430 ])
4431 if test "x$with_libudev" = "xyes"
4432 then
4433 SAVE_CPPFLAGS="$CPPFLAGS"
4434 CPPFLAGS="$CPPFLAGS $with_libudev_cflags"
4436 AC_CHECK_HEADERS(libudev.h, [], [with_libudev="no (libudev.h not found)"])
4438 CPPFLAGS="$SAVE_CPPFLAGS"
4439 fi
4440 if test "x$with_libudev" = "xyes"
4441 then
4442 SAVE_CPPFLAGS="$CPPFLAGS"
4443 SAVE_LDFLAGS="$LDFLAGS"
4444 CPPFLAGS="$CPPFLAGS $with_libudev_cflags"
4445 LDFLAGS="$LDFLAGS $with_libudev_ldflags"
4447 AC_CHECK_LIB(udev, udev_new,
4448 [
4449 AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if you have the udev library (-ludev).])
4450 ],
4451 [with_libudev="no (libudev not found)"])
4453 CPPFLAGS="$SAVE_CPPFLAGS"
4454 LDFLAGS="$SAVE_LDFLAGS"
4455 fi
4456 if test "x$with_libudev" = "xyes"
4457 then
4458 BUILD_WITH_LIBUDEV_CFLAGS="$with_libudev_cflags"
4459 BUILD_WITH_LIBUDEV_LDFLAGS="$with_libudev_ldflags"
4460 AC_SUBST(BUILD_WITH_LIBUDEV_CFLAGS)
4461 AC_SUBST(BUILD_WITH_LIBUDEV_LDFLAGS)
4462 fi
4463 AM_CONDITIONAL(BUILD_WITH_LIBUDEV, test "x$with_libudev" = "xyes")
4464 # }}}
4466 # --with-libupsclient {{{
4467 with_libupsclient_config=""
4468 with_libupsclient_cflags=""
4469 with_libupsclient_libs=""
4470 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
4471 [
4472 if test "x$withval" = "xno"
4473 then
4474 with_libupsclient="no"
4475 else if test "x$withval" = "xyes"
4476 then
4477 with_libupsclient="use_pkgconfig"
4478 else
4479 if test -x "$withval"
4480 then
4481 with_libupsclient_config="$withval"
4482 with_libupsclient="use_libupsclient_config"
4483 else if test -x "$withval/bin/libupsclient-config"
4484 then
4485 with_libupsclient_config="$withval/bin/libupsclient-config"
4486 with_libupsclient="use_libupsclient_config"
4487 else
4488 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
4489 with_libupsclient_cflags="-I$withval/include"
4490 with_libupsclient_libs="-L$withval/lib -lupsclient"
4491 with_libupsclient="yes"
4492 fi; fi
4493 fi; fi
4494 ],
4495 [with_libupsclient="use_pkgconfig"])
4497 # configure using libupsclient-config
4498 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4499 then
4500 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4501 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4502 if test $? -ne 0
4503 then
4504 with_libupsclient="no ($with_libupsclient_config failed)"
4505 fi
4506 with_libupsclient_libs="`$with_libupsclient_config --libs`"
4507 if test $? -ne 0
4508 then
4509 with_libupsclient="no ($with_libupsclient_config failed)"
4510 fi
4511 fi
4512 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4513 then
4514 with_libupsclient="yes"
4515 fi
4517 # configure using pkg-config
4518 if test "x$with_libupsclient" = "xuse_pkgconfig"
4519 then
4520 if test "x$PKG_CONFIG" = "x"
4521 then
4522 with_libupsclient="no (Don't have pkg-config)"
4523 fi
4524 fi
4525 if test "x$with_libupsclient" = "xuse_pkgconfig"
4526 then
4527 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4528 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4529 if test $? -ne 0
4530 then
4531 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4532 fi
4533 fi
4534 if test "x$with_libupsclient" = "xuse_pkgconfig"
4535 then
4536 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4537 if test $? -ne 0
4538 then
4539 with_libupsclient="no ($PKG_CONFIG failed)"
4540 fi
4541 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4542 if test $? -ne 0
4543 then
4544 with_libupsclient="no ($PKG_CONFIG failed)"
4545 fi
4546 fi
4547 if test "x$with_libupsclient" = "xuse_pkgconfig"
4548 then
4549 with_libupsclient="yes"
4550 fi
4552 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4553 # the actual checks.
4554 if test "x$with_libupsclient" = "xyes"
4555 then
4556 SAVE_CPPFLAGS="$CPPFLAGS"
4557 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4559 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4561 CPPFLAGS="$SAVE_CPPFLAGS"
4562 fi
4563 if test "x$with_libupsclient" = "xyes"
4564 then
4565 SAVE_CPPFLAGS="$CPPFLAGS"
4566 SAVE_LDFLAGS="$LDFLAGS"
4568 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4569 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4571 AC_CHECK_LIB(upsclient, upscli_connect,
4572 [with_libupsclient="yes"],
4573 [with_libupsclient="no (symbol upscli_connect not found)"])
4575 CPPFLAGS="$SAVE_CPPFLAGS"
4576 LDFLAGS="$SAVE_LDFLAGS"
4577 fi
4578 if test "x$with_libupsclient" = "xyes"
4579 then
4580 SAVE_CPPFLAGS="$CPPFLAGS"
4581 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4583 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4584 [#include <stdlib.h>
4585 #include <stdio.h>
4586 #include <upsclient.h>])
4588 CPPFLAGS="$SAVE_CPPFLAGS"
4589 fi
4590 if test "x$with_libupsclient" = "xyes"
4591 then
4592 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4593 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4594 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4595 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4596 fi
4597 # }}}
4599 # --with-libxmms {{{
4600 with_xmms_config="xmms-config"
4601 with_xmms_cflags=""
4602 with_xmms_libs=""
4603 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4604 [
4605 if test "x$withval" != "xno" \
4606 && test "x$withval" != "xyes"
4607 then
4608 if test -f "$withval" && test -x "$withval";
4609 then
4610 with_xmms_config="$withval"
4611 else if test -x "$withval/bin/xmms-config"
4612 then
4613 with_xmms_config="$withval/bin/xmms-config"
4614 fi; fi
4615 with_libxmms="yes"
4616 else if test "x$withval" = "xno"
4617 then
4618 with_libxmms="no"
4619 else
4620 with_libxmms="yes"
4621 fi; fi
4622 ],
4623 [
4624 with_libxmms="yes"
4625 ])
4626 if test "x$with_libxmms" = "xyes"
4627 then
4628 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4629 xmms_config_status=$?
4631 if test $xmms_config_status -ne 0
4632 then
4633 with_libxmms="no"
4634 fi
4635 fi
4636 if test "x$with_libxmms" = "xyes"
4637 then
4638 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4639 xmms_config_status=$?
4641 if test $xmms_config_status -ne 0
4642 then
4643 with_libxmms="no"
4644 fi
4645 fi
4646 if test "x$with_libxmms" = "xyes"
4647 then
4648 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4649 [
4650 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4651 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4652 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4653 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4654 ],
4655 [
4656 with_libxmms="no"
4657 ],
4658 [$with_xmms_libs])
4659 fi
4660 with_libxmms_numeric=0
4661 if test "x$with_libxmms" = "xyes"
4662 then
4663 with_libxmms_numeric=1
4664 fi
4665 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4666 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4667 # }}}
4669 # --with-libyajl {{{
4670 with_libyajl_cppflags=""
4671 with_libyajl_ldflags=""
4672 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4673 [
4674 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4675 then
4676 with_libyajl_cppflags="-I$withval/include"
4677 with_libyajl_ldflags="-L$withval/lib"
4678 with_libyajl="yes"
4679 else
4680 with_libyajl="$withval"
4681 fi
4682 ],
4683 [
4684 with_libyajl="yes"
4685 ])
4686 if test "x$with_libyajl" = "xyes"
4687 then
4688 SAVE_CPPFLAGS="$CPPFLAGS"
4689 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4691 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4692 AC_CHECK_HEADERS(yajl/yajl_version.h)
4694 CPPFLAGS="$SAVE_CPPFLAGS"
4695 fi
4696 if test "x$with_libyajl" = "xyes"
4697 then
4698 SAVE_CPPFLAGS="$CPPFLAGS"
4699 SAVE_LDFLAGS="$LDFLAGS"
4700 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4701 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4703 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4705 CPPFLAGS="$SAVE_CPPFLAGS"
4706 LDFLAGS="$SAVE_LDFLAGS"
4707 fi
4708 if test "x$with_libyajl" = "xyes"
4709 then
4710 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4711 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4712 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4713 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4714 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4715 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4716 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4717 fi
4718 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4719 # }}}
4721 # --with-mic {{{
4722 with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include"
4723 with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
4724 with_mic_libs=""
4725 AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
4726 [
4727 if test "x$withval" = "xno"
4728 then
4729 with_mic="no"
4730 else if test "x$withval" = "xyes"
4731 then
4732 with_mic="yes"
4733 else if test -d "$with_mic/lib"
4734 then
4735 AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured])
4736 with_mic_cflags="-I$withval/include"
4737 with_mic_ldpath="-L$withval/lib/Linux"
4738 with_mic_libs="-lMicAccessSDK -lscif -lpthread"
4739 with_mic="yes"
4740 fi; fi; fi
4741 ],
4742 [with_mic="yes"])
4743 if test "x$with_mic" = "xyes"
4744 then
4745 SAVE_CPPFLAGS="$CPPFLAGS"
4746 CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4747 AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"])
4748 CPPFLAGS="$SAVE_CPPFLAGS"
4749 fi
4750 if test "x$with_mic" = "xyes"
4751 then
4752 SAVE_CPPFLAGS="$CPPFLAGS"
4753 SAVE_LDFLAGS="$LDFLAGS"
4755 CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4756 LDFLAGS="$LDFLAGS $with_mic_ldpath"
4758 AC_CHECK_LIB(MicAccessSDK, MicInitAPI,
4759 [with_mic_ldpath="$with_mic_ldpath"
4760 with_mic_libs="-lMicAccessSDK -lscif -lpthread"],
4761 [with_mic="no (symbol MicInitAPI not found)"],[-lscif -lpthread])
4763 CPPFLAGS="$SAVE_CPPFLAGS"
4764 LDFLAGS="$SAVE_LDFLAGS"
4765 fi
4767 if test "x$with_mic" = "xyes"
4768 then
4769 BUILD_WITH_MIC_CPPFLAGS="$with_mic_cflags"
4770 BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath"
4771 BUILD_WITH_MIC_LDADD="$with_mic_libs"
4772 AC_SUBST(BUILD_WITH_MIC_CPPFLAGS)
4773 AC_SUBST(BUILD_WITH_MIC_LIBPATH)
4774 AC_SUBST(BUILD_WITH_MIC_LDADD)
4775 fi
4776 #}}}
4778 # --with-libvarnish {{{
4779 with_libvarnish_cppflags=""
4780 with_libvarnish_cflags=""
4781 with_libvarnish_libs=""
4782 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4783 [
4784 if test "x$withval" = "xno"
4785 then
4786 with_libvarnish="no"
4787 else if test "x$withval" = "xyes"
4788 then
4789 with_libvarnish="use_pkgconfig"
4790 else if test -d "$with_libvarnish/lib"
4791 then
4792 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4793 with_libvarnish_cflags="-I$withval/include"
4794 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4795 with_libvarnish="yes"
4796 fi; fi; fi
4797 ],
4798 [with_libvarnish="use_pkgconfig"])
4800 # configure using pkg-config
4801 if test "x$with_libvarnish" = "xuse_pkgconfig"
4802 then
4803 if test "x$PKG_CONFIG" = "x"
4804 then
4805 with_libvarnish="no (Don't have pkg-config)"
4806 fi
4807 fi
4808 if test "x$with_libvarnish" = "xuse_pkgconfig"
4809 then
4810 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4811 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4812 if test $? -ne 0
4813 then
4814 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4815 fi
4816 fi
4817 if test "x$with_libvarnish" = "xuse_pkgconfig"
4818 then
4819 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4820 if test $? -ne 0
4821 then
4822 with_libvarnish="no ($PKG_CONFIG failed)"
4823 fi
4824 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4825 if test $? -ne 0
4826 then
4827 with_libvarnish="no ($PKG_CONFIG failed)"
4828 fi
4829 fi
4830 if test "x$with_libvarnish" = "xuse_pkgconfig"
4831 then
4832 with_libvarnish="yes"
4833 fi
4835 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4836 # the actual checks.
4837 if test "x$with_libvarnish" = "xyes"
4838 then
4839 SAVE_CPPFLAGS="$CPPFLAGS"
4841 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4843 AC_CHECK_HEADERS(varnish/vapi/vsc.h,
4844 [AC_DEFINE([HAVE_VARNISH_V4], [1], [Varnish 4 API support])],
4845 [AC_CHECK_HEADERS(varnish/vsc.h,
4846 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4847 [AC_CHECK_HEADERS(varnish/varnishapi.h,
4848 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])],
4849 [with_libvarnish="no (found none of the varnish header files)"])])])
4851 CPPFLAGS="$SAVE_CPPFLAGS"
4852 fi
4853 if test "x$with_libvarnish" = "xyes"
4854 then
4855 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4856 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4857 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4858 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4859 fi
4860 # }}}
4862 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4863 with_libxml2="no (pkg-config isn't available)"
4864 with_libxml2_cflags=""
4865 with_libxml2_ldflags=""
4866 with_libvirt="no (pkg-config isn't available)"
4867 with_libvirt_cflags=""
4868 with_libvirt_ldflags=""
4869 if test "x$PKG_CONFIG" != "x"
4870 then
4871 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4872 if test "$?" = "0"
4873 then
4874 with_libxml2="yes"
4875 else
4876 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4877 fi
4879 $PKG_CONFIG --exists libvirt 2>/dev/null
4880 if test "$?" = "0"
4881 then
4882 with_libvirt="yes"
4883 else
4884 with_libvirt="no (pkg-config doesn't know libvirt)"
4885 fi
4886 fi
4887 if test "x$with_libxml2" = "xyes"
4888 then
4889 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4890 if test $? -ne 0
4891 then
4892 with_libxml2="no"
4893 fi
4894 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4895 if test $? -ne 0
4896 then
4897 with_libxml2="no"
4898 fi
4899 fi
4900 if test "x$with_libxml2" = "xyes"
4901 then
4902 SAVE_CPPFLAGS="$CPPFLAGS"
4903 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4905 AC_CHECK_HEADERS(libxml/parser.h, [],
4906 [with_libxml2="no (libxml/parser.h not found)"])
4908 CPPFLAGS="$SAVE_CPPFLAGS"
4909 fi
4910 if test "x$with_libxml2" = "xyes"
4911 then
4912 SAVE_CFLAGS="$CFLAGS"
4913 SAVE_LDFLAGS="$LDFLAGS"
4915 CFLAGS="$CFLAGS $with_libxml2_cflags"
4916 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4918 AC_CHECK_LIB(xml2, xmlXPathEval,
4919 [with_libxml2="yes"],
4920 [with_libxml2="no (symbol xmlXPathEval not found)"])
4922 CFLAGS="$SAVE_CFLAGS"
4923 LDFLAGS="$SAVE_LDFLAGS"
4924 fi
4925 dnl Add the right compiler flags and libraries.
4926 if test "x$with_libxml2" = "xyes"; then
4927 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4928 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4929 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4930 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4931 fi
4932 if test "x$with_libvirt" = "xyes"
4933 then
4934 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4935 if test $? -ne 0
4936 then
4937 with_libvirt="no"
4938 fi
4939 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4940 if test $? -ne 0
4941 then
4942 with_libvirt="no"
4943 fi
4944 fi
4945 if test "x$with_libvirt" = "xyes"
4946 then
4947 SAVE_CPPFLAGS="$CPPFLAGS"
4948 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4950 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4951 [with_libvirt="no (libvirt/libvirt.h not found)"])
4953 CPPFLAGS="$SAVE_CPPFLAGS"
4954 fi
4955 if test "x$with_libvirt" = "xyes"
4956 then
4957 SAVE_CFLAGS="$CFLAGS"
4958 SAVE_LDFLAGS="$LDFLAGS"
4960 CFLAGS="$CFLAGS $with_libvirt_cflags"
4961 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4963 AC_CHECK_LIB(virt, virDomainBlockStats,
4964 [with_libvirt="yes"],
4965 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4967 CFLAGS="$SAVE_CFLAGS"
4968 LDFLAGS="$SAVE_LDFLAGS"
4969 fi
4970 dnl Add the right compiler flags and libraries.
4971 if test "x$with_libvirt" = "xyes"; then
4972 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4973 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4974 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4975 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4976 fi
4977 # }}}
4979 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4980 with_libopenipmipthread="yes"
4981 with_libopenipmipthread_cflags=""
4982 with_libopenipmipthread_libs=""
4984 AC_MSG_CHECKING([for pkg-config])
4985 temp_result="no"
4986 if test "x$PKG_CONFIG" = "x"
4987 then
4988 with_libopenipmipthread="no"
4989 temp_result="no"
4990 else
4991 temp_result="$PKG_CONFIG"
4992 fi
4993 AC_MSG_RESULT([$temp_result])
4995 if test "x$with_libopenipmipthread" = "xyes"
4996 then
4997 AC_MSG_CHECKING([for libOpenIPMIpthread])
4998 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4999 if test "$?" != "0"
5000 then
5001 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
5002 fi
5003 AC_MSG_RESULT([$with_libopenipmipthread])
5004 fi
5006 if test "x$with_libopenipmipthread" = "xyes"
5007 then
5008 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
5009 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
5010 if test "$?" = "0"
5011 then
5012 with_libopenipmipthread_cflags="$temp_result"
5013 else
5014 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
5015 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
5016 fi
5017 AC_MSG_RESULT([$temp_result])
5018 fi
5020 if test "x$with_libopenipmipthread" = "xyes"
5021 then
5022 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
5023 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
5024 if test "$?" = "0"
5025 then
5026 with_libopenipmipthread_ldflags="$temp_result"
5027 else
5028 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
5029 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
5030 fi
5031 AC_MSG_RESULT([$temp_result])
5032 fi
5034 if test "x$with_libopenipmipthread" = "xyes"
5035 then
5036 SAVE_CPPFLAGS="$CPPFLAGS"
5037 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
5039 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
5040 [with_libopenipmipthread="yes"],
5041 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
5042 [#include <OpenIPMI/ipmiif.h>
5043 #include <OpenIPMI/ipmi_err.h>
5044 #include <OpenIPMI/ipmi_posix.h>
5045 #include <OpenIPMI/ipmi_conn.h>
5046 ])
5048 CPPFLAGS="$SAVE_CPPFLAGS"
5049 fi
5051 if test "x$with_libopenipmipthread" = "xyes"
5052 then
5053 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
5054 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
5055 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
5056 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
5057 fi
5058 # }}}
5060 # --with-libatasmart {{{
5061 with_libatasmart_cppflags=""
5062 with_libatasmart_ldflags=""
5063 AC_ARG_WITH(libatasmart, [AS_HELP_STRING([--with-libatasmart@<:@=PREFIX@:>@], [Path to libatasmart.])],
5064 [
5065 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5066 then
5067 with_libatasmart_cppflags="-I$withval/include"
5068 with_libatasmart_ldflags="-L$withval/lib"
5069 with_libatasmart="yes"
5070 else
5071 with_libatasmart="$withval"
5072 fi
5073 ],
5074 [
5075 if test "x$ac_system" = "xLinux"
5076 then
5077 with_libatasmart="yes"
5078 else
5079 with_libatasmart="no (Linux only library)"
5080 fi
5081 ])
5082 if test "x$with_libatasmart" = "xyes"
5083 then
5084 SAVE_CPPFLAGS="$CPPFLAGS"
5085 CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
5087 AC_CHECK_HEADERS(atasmart.h, [with_libatasmart="yes"], [with_libatasmart="no (atasmart.h not found)"])
5089 CPPFLAGS="$SAVE_CPPFLAGS"
5090 fi
5091 if test "x$with_libatasmart" = "xyes"
5092 then
5093 SAVE_CPPFLAGS="$CPPFLAGS"
5094 SAVE_LDFLAGS="$LDFLAGS"
5095 CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
5096 LDFLAGS="$LDFLAGS $with_libatasmart_ldflags"
5098 AC_CHECK_LIB(atasmart, sk_disk_open, [with_libatasmart="yes"], [with_libatasmart="no (Symbol 'sk_disk_open' not found)"])
5100 CPPFLAGS="$SAVE_CPPFLAGS"
5101 LDFLAGS="$SAVE_LDFLAGS"
5102 fi
5103 if test "x$with_libatasmart" = "xyes"
5104 then
5105 BUILD_WITH_LIBATASMART_CPPFLAGS="$with_libatasmart_cppflags"
5106 BUILD_WITH_LIBATASMART_LDFLAGS="$with_libatasmart_ldflags"
5107 BUILD_WITH_LIBATASMART_LIBS="-latasmart"
5108 AC_SUBST(BUILD_WITH_LIBATASMART_CPPFLAGS)
5109 AC_SUBST(BUILD_WITH_LIBATASMART_LDFLAGS)
5110 AC_SUBST(BUILD_WITH_LIBATASMART_LIBS)
5111 AC_DEFINE(HAVE_LIBATASMART, 1, [Define if libatasmart is present and usable.])
5112 fi
5113 AM_CONDITIONAL(BUILD_WITH_LIBATASMART, test "x$with_libatasmart" = "xyes")
5114 # }}}
5116 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
5117 [with_libnotify="yes"],
5118 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
5119 with_libnotify="no"
5120 else
5121 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
5122 fi])
5124 # Check for enabled/disabled features
5125 #
5127 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
5128 # ------------------------------------------------------------
5129 dnl
5130 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
5131 dnl
5132 AC_DEFUN(
5133 [AC_COLLECTD],
5134 [
5135 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
5136 m4_if(
5137 [$2],
5138 [enable],
5139 [dnl
5140 m4_define([EnDis],[disabled])dnl
5141 m4_define([YesNo],[no])dnl
5142 ],dnl
5143 [m4_if(
5144 [$2],
5145 [disable],
5146 [dnl
5147 m4_define([EnDis],[enabled])dnl
5148 m4_define([YesNo],[yes])dnl
5149 ],
5150 [dnl
5151 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
5152 ]dnl
5153 )]dnl
5154 )dnl
5155 m4_if([$3], [feature], [],
5156 [m4_if(
5157 [$3], [module], [],
5158 [dnl
5159 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
5160 ]dnl
5161 )]dnl
5162 )dnl
5163 AC_ARG_ENABLE(
5164 [$1],
5165 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
5166 [],
5167 enable_$1='[YesNo]'dnl
5168 )# AC_ARG_ENABLE
5169 if test "x$enable_$1" = "xno"
5170 then
5171 collectd_$1=0
5172 else
5173 if test "x$enable_$1" = "xyes"
5174 then
5175 collectd_$1=1
5176 else
5177 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
5178 collectd_$1=1
5179 enable_$1='yes'
5180 fi
5181 fi
5182 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
5183 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
5184 ]dnl
5185 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
5187 # AC_PLUGIN(name, default, info)
5188 # ------------------------------------------------------------
5189 dnl
5190 AC_DEFUN(
5191 [AC_PLUGIN],
5192 [
5193 enable_plugin="no"
5194 force="no"
5195 AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1],[$3]),
5196 [
5197 if test "x$enableval" = "xyes"
5198 then
5199 enable_plugin="yes"
5200 else if test "x$enableval" = "xforce"
5201 then
5202 enable_plugin="yes"
5203 force="yes"
5204 else
5205 enable_plugin="no (disabled on command line)"
5206 fi; fi
5207 ],
5208 [
5209 if test "x$enable_all_plugins" = "xauto"
5210 then
5211 if test "x$2" = "xyes"
5212 then
5213 enable_plugin="yes"
5214 else
5215 enable_plugin="no"
5216 fi
5217 else
5218 enable_plugin="$enable_all_plugins"
5219 fi
5220 ])
5221 if test "x$enable_plugin" = "xyes"
5222 then
5223 if test "x$2" = "xyes" || test "x$force" = "xyes"
5224 then
5225 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
5226 if test "x$2" != "xyes"
5227 then
5228 dependency_warning="yes"
5229 fi
5230 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
5231 dependency_error="yes"
5232 enable_plugin="no (dependency error)"
5233 fi
5234 fi
5235 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
5236 enable_$1="$enable_plugin"
5237 ]
5238 )# AC_PLUGIN(name, default, info)
5240 m4_divert_once([HELP_ENABLE], [
5241 collectd features:])
5242 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
5243 AC_COLLECTD([debug], [enable], [feature], [debugging])
5244 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
5245 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
5247 dependency_warning="no"
5248 dependency_error="no"
5250 plugin_ascent="no"
5251 plugin_barometer="no"
5252 plugin_battery="no"
5253 plugin_bind="no"
5254 plugin_ceph="no"
5255 plugin_cgroups="no"
5256 plugin_conntrack="no"
5257 plugin_contextswitch="no"
5258 plugin_cpu="no"
5259 plugin_cpufreq="no"
5260 plugin_curl_json="no"
5261 plugin_curl_xml="no"
5262 plugin_df="no"
5263 plugin_disk="no"
5264 plugin_drbd="no"
5265 plugin_entropy="no"
5266 plugin_ethstat="no"
5267 plugin_fscache="no"
5268 plugin_interface="no"
5269 plugin_ipmi="no"
5270 plugin_ipvs="no"
5271 plugin_irq="no"
5272 plugin_load="no"
5273 plugin_log_logstash="no"
5274 plugin_memory="no"
5275 plugin_multimeter="no"
5276 plugin_nfs="no"
5277 plugin_numa="no"
5278 plugin_perl="no"
5279 plugin_processes="no"
5280 plugin_protocols="no"
5281 plugin_serial="no"
5282 plugin_swap="no"
5283 plugin_tape="no"
5284 plugin_tcpconns="no"
5285 plugin_ted="no"
5286 plugin_thermal="no"
5287 plugin_turbostat="no"
5288 plugin_uptime="no"
5289 plugin_users="no"
5290 plugin_virt="no"
5291 plugin_vmem="no"
5292 plugin_vserver="no"
5293 plugin_wireless="no"
5294 plugin_zfs_arc="no"
5295 plugin_zone="no"
5296 plugin_zookeeper="no"
5298 # Linux
5299 if test "x$ac_system" = "xLinux"
5300 then
5301 plugin_battery="yes"
5302 plugin_conntrack="yes"
5303 plugin_contextswitch="yes"
5304 plugin_cgroups="yes"
5305 plugin_cpu="yes"
5306 plugin_cpufreq="yes"
5307 plugin_disk="yes"
5308 plugin_drbd="yes"
5309 plugin_entropy="yes"
5310 plugin_fscache="yes"
5311 plugin_interface="yes"
5312 plugin_ipc="yes"
5313 plugin_irq="yes"
5314 plugin_load="yes"
5315 plugin_lvm="yes"
5316 plugin_memory="yes"
5317 plugin_nfs="yes"
5318 plugin_numa="yes"
5319 plugin_processes="yes"
5320 plugin_protocols="yes"
5321 plugin_serial="yes"
5322 plugin_swap="yes"
5323 plugin_tcpconns="yes"
5324 plugin_thermal="yes"
5325 plugin_uptime="yes"
5326 plugin_vmem="yes"
5327 plugin_vserver="yes"
5328 plugin_wireless="yes"
5329 plugin_zfs_arc="yes"
5331 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
5332 then
5333 plugin_ipvs="yes"
5334 fi
5335 if test "x$c_cv_have_usable_asm_msrindex_h" = "xyes" && test "x$have_cpuid_h" = "xyes"
5336 then
5337 plugin_turbostat="yes"
5338 fi
5339 fi
5341 if test "x$ac_system" = "xOpenBSD"
5342 then
5343 plugin_tcpconns="yes"
5344 fi
5346 # Mac OS X devices
5347 if test "x$with_libiokit" = "xyes"
5348 then
5349 plugin_battery="yes"
5350 plugin_disk="yes"
5351 fi
5353 # AIX
5355 if test "x$ac_system" = "xAIX"
5356 then
5357 plugin_tcpconns="yes"
5358 plugin_ipc="yes"
5359 fi
5361 # FreeBSD
5363 if test "x$ac_system" = "xFreeBSD"
5364 then
5365 plugin_zfs_arc="yes"
5366 fi
5369 if test "x$with_perfstat" = "xyes"
5370 then
5371 plugin_cpu="yes"
5372 plugin_contextswitch="yes"
5373 plugin_disk="yes"
5374 plugin_memory="yes"
5375 plugin_swap="yes"
5376 plugin_interface="yes"
5377 plugin_load="yes"
5378 plugin_uptime="yes"
5379 fi
5381 if test "x$with_procinfo" = "xyes"
5382 then
5383 plugin_processes="yes"
5384 fi
5386 # Solaris
5387 if test "x$with_kstat" = "xyes"
5388 then
5389 plugin_nfs="yes"
5390 plugin_processes="yes"
5391 plugin_uptime="yes"
5392 plugin_zfs_arc="yes"
5393 plugin_zone="yes"
5394 fi
5396 if test "x$with_devinfo$with_kstat" = "xyesyes"
5397 then
5398 plugin_cpu="yes"
5399 plugin_disk="yes"
5400 plugin_interface="yes"
5401 plugin_memory="yes"
5402 plugin_tape="yes"
5403 fi
5405 # libi2c-dev
5406 with_libi2c="no"
5407 if test "x$ac_system" = "xLinux"
5408 then
5409 AC_CHECK_DECL(i2c_smbus_read_i2c_block_data,
5410 [with_libi2c="yes"],
5411 [with_libi2c="no (symbol i2c_smbus_read_i2c_block_data not found - have you installed libi2c-dev ?)"],
5412 [[#include <stdlib.h>
5413 #include <linux/i2c-dev.h>]])
5414 fi
5416 if test "x$with_libi2c" = "xyes"
5417 then
5418 plugin_barometer="yes"
5419 fi
5422 # libstatgrab
5423 if test "x$with_libstatgrab" = "xyes"
5424 then
5425 plugin_cpu="yes"
5426 plugin_disk="yes"
5427 plugin_interface="yes"
5428 plugin_load="yes"
5429 plugin_memory="yes"
5430 plugin_swap="yes"
5431 plugin_users="yes"
5432 fi
5434 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
5435 then
5436 plugin_ascent="yes"
5437 if test "x$have_strptime" = "xyes"
5438 then
5439 plugin_bind="yes"
5440 fi
5441 fi
5443 if test "x$with_libopenipmipthread" = "xyes"
5444 then
5445 plugin_ipmi="yes"
5446 fi
5448 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
5449 then
5450 plugin_curl_json="yes"
5451 fi
5453 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
5454 then
5455 plugin_curl_xml="yes"
5456 fi
5458 if test "x$with_libyajl" = "xyes"
5459 then
5460 plugin_ceph="yes"
5461 fi
5463 if test "x$have_processor_info" = "xyes"
5464 then
5465 plugin_cpu="yes"
5466 fi
5467 if test "x$have_sysctl" = "xyes"
5468 then
5469 plugin_cpu="yes"
5470 plugin_memory="yes"
5471 plugin_uptime="yes"
5472 if test "x$ac_system" = "xDarwin"
5473 then
5474 plugin_swap="yes"
5475 fi
5476 fi
5477 if test "x$have_sysctlbyname" = "xyes"
5478 then
5479 plugin_contextswitch="yes"
5480 plugin_cpu="yes"
5481 plugin_memory="yes"
5482 plugin_tcpconns="yes"
5483 fi
5485 # Df plugin: Check if we know how to determine mount points first.
5486 #if test "x$have_listmntent" = "xyes"; then
5487 # plugin_df="yes"
5488 #fi
5489 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
5490 then
5491 plugin_df="yes"
5492 fi
5493 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
5494 then
5495 plugin_df="yes"
5496 fi
5497 #if test "x$have_getmntent" = "xseq"
5498 #then
5499 # plugin_df="yes"
5500 #fi
5501 if test "x$c_cv_have_one_getmntent" = "xyes"
5502 then
5503 plugin_df="yes"
5504 fi
5506 if test "x$c_cv_have_getmntent_r" = "xyes"
5507 then
5508 plugin_df="yes"
5509 fi
5511 # Df plugin: Check if we have either `statfs' or `statvfs' second.
5512 if test "x$plugin_df" = "xyes"
5513 then
5514 plugin_df="no"
5515 if test "x$have_statfs" = "xyes"
5516 then
5517 plugin_df="yes"
5518 fi
5519 if test "x$have_statvfs" = "xyes"
5520 then
5521 plugin_df="yes"
5522 fi
5523 fi
5525 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
5526 then
5527 plugin_ethstat="yes"
5528 fi
5530 if test "x$have_getifaddrs" = "xyes"
5531 then
5532 plugin_interface="yes"
5533 fi
5535 if test "x$have_getloadavg" = "xyes"
5536 then
5537 plugin_load="yes"
5538 fi
5540 if test "x$with_libyajl" = "xyes"
5541 then
5542 plugin_log_logstash="yes"
5543 fi
5545 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
5546 then
5547 plugin_perl="yes"
5548 fi
5550 # Mac OS X memory interface
5551 if test "x$have_host_statistics" = "xyes"
5552 then
5553 plugin_memory="yes"
5554 fi
5556 if test "x$have_termios_h" = "xyes"
5557 then
5558 if test "x$ac_system" != "xAIX"
5559 then
5560 plugin_multimeter="yes"
5561 fi
5562 plugin_ted="yes"
5563 fi
5565 if test "x$have_thread_info" = "xyes"
5566 then
5567 plugin_processes="yes"
5568 fi
5570 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
5571 then
5572 plugin_processes="yes"
5573 fi
5575 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_openbsd" = "xyes"
5576 then
5577 plugin_processes="yes"
5578 fi
5580 if test "x$with_kvm_getswapinfo" = "xyes"
5581 then
5582 plugin_swap="yes"
5583 fi
5585 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
5586 then
5587 plugin_swap="yes"
5588 fi
5590 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
5591 then
5592 plugin_tcpconns="yes"
5593 fi
5595 if test "x$have_getutent" = "xyes"
5596 then
5597 plugin_users="yes"
5598 fi
5599 if test "x$have_getutxent" = "xyes"
5600 then
5601 plugin_users="yes"
5602 fi
5604 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
5605 then
5606 plugin_virt="yes"
5607 fi
5610 m4_divert_once([HELP_ENABLE], [
5611 collectd plugins:])
5613 AC_ARG_ENABLE([all-plugins],
5614 AS_HELP_STRING([--enable-all-plugins],[enable all plugins (auto by def)]),
5615 [
5616 if test "x$enableval" = "xyes"
5617 then
5618 enable_all_plugins="yes"
5619 else if test "x$enableval" = "xauto"
5620 then
5621 enable_all_plugins="auto"
5622 else
5623 enable_all_plugins="no"
5624 fi; fi
5625 ],
5626 [enable_all_plugins="auto"])
5628 m4_divert_once([HELP_ENABLE], [])
5630 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
5631 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
5632 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
5633 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
5634 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
5635 AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero's hardware sensors])
5636 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
5637 AC_PLUGIN([barometer], [$plugin_barometer], [Barometer sensor on I2C])
5638 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
5639 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
5640 AC_PLUGIN([ceph], [$plugin_ceph], [Ceph daemon statistics])
5641 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
5642 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
5643 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
5644 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
5645 AC_PLUGIN([csv], [yes], [CSV output plugin])
5646 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
5647 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
5648 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
5649 AC_PLUGIN([cgroups], [$plugin_cgroups], [CGroups CPU usage accounting])
5650 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
5651 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
5652 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
5653 AC_PLUGIN([drbd], [$plugin_drbd], [DRBD statistics])
5654 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
5655 AC_PLUGIN([email], [yes], [EMail statistics])
5656 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
5657 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
5658 AC_PLUGIN([exec], [yes], [Execution of external programs])
5659 AC_PLUGIN([fhcount], [yes], [File handles statistics])
5660 AC_PLUGIN([filecount], [yes], [Count files in directories])
5661 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
5662 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
5663 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
5664 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
5665 AC_PLUGIN([ipc], [$plugin_ipc], [IPC statistics])
5666 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
5667 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
5668 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
5669 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
5670 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
5671 AC_PLUGIN([load], [$plugin_load], [System load])
5672 AC_PLUGIN([logfile], [yes], [File logging plugin])
5673 AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging])
5674 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
5675 AC_PLUGIN([lvm], [$with_liblvm2app], [LVM statistics])
5676 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
5677 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
5678 AC_PLUGIN([match_hashed], [yes], [The hashed match])
5679 AC_PLUGIN([match_regex], [yes], [The regex match])
5680 AC_PLUGIN([match_timediff], [yes], [The timediff match])
5681 AC_PLUGIN([match_value], [yes], [The value match])
5682 AC_PLUGIN([mbmon], [yes], [Query mbmond])
5683 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5684 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5685 AC_PLUGIN([memcached], [yes], [memcached statistics])
5686 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5687 AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats])
5688 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5689 AC_PLUGIN([mqtt], [$with_libmosquitto], [MQTT output plugin])
5690 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5691 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5692 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5693 AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics])
5694 AC_PLUGIN([network], [yes], [Network communication plugin])
5695 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5696 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5697 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5698 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5699 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5700 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5701 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5702 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5703 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5704 AC_PLUGIN([openldap], [$with_libldap], [OpenLDAP statistics])
5705 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5706 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5707 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5708 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5709 # FIXME: Check for libevent, too.
5710 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5711 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5712 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5713 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5714 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5715 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5716 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5717 AC_PLUGIN([redis], [$with_libhiredis], [Redis plugin])
5718 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5719 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5720 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5721 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5722 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5723 AC_PLUGIN([sigrok], [$with_libsigrok], [sigrok acquisition sources])
5724 AC_PLUGIN([smart], [$with_libatasmart], [SMART statistics])
5725 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5726 AC_PLUGIN([statsd], [yes], [StatsD plugin])
5727 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5728 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5729 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5730 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5731 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5732 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5733 AC_PLUGIN([target_notification], [yes], [The notification target])
5734 AC_PLUGIN([target_replace], [yes], [The replace target])
5735 AC_PLUGIN([target_scale],[yes], [The scale target])
5736 AC_PLUGIN([target_set], [yes], [The set target])
5737 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5738 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5739 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5740 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5741 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5742 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5743 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5744 AC_PLUGIN([turbostat], [$plugin_turbostat], [Advanced statistic on Intel cpu states])
5745 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5746 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5747 AC_PLUGIN([users], [$plugin_users], [User statistics])
5748 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5749 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5750 AC_PLUGIN([virt], [$plugin_virt], [Virtual machine statistics])
5751 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5752 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5753 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5754 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5755 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5756 AC_PLUGIN([write_kafka], [$with_librdkafka], [Kafka output plugin])
5757 AC_PLUGIN([write_log], [yes], [Log output plugin])
5758 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5759 AC_PLUGIN([write_redis], [$with_libhiredis], [Redis output plugin])
5760 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5761 AC_PLUGIN([write_sensu], [yes], [Sensu output plugin])
5762 AC_PLUGIN([write_tsdb], [yes], [TSDB output plugin])
5763 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5764 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5765 AC_PLUGIN([zone], [$plugin_zone], [Solaris container statistics])
5766 AC_PLUGIN([zookeeper], [yes], [Zookeeper statistics])
5768 dnl Default configuration file
5769 # Load either syslog or logfile
5770 LOAD_PLUGIN_SYSLOG=""
5771 LOAD_PLUGIN_LOGFILE=""
5772 LOAD_PLUGIN_LOG_LOGSTASH=""
5774 AC_MSG_CHECKING([which default log plugin to load])
5775 default_log_plugin="none"
5776 if test "x$enable_syslog" = "xyes"
5777 then
5778 default_log_plugin="syslog"
5779 else
5780 LOAD_PLUGIN_SYSLOG="##"
5781 fi
5783 if test "x$enable_logfile" = "xyes"
5784 then
5785 if test "x$default_log_plugin" = "xnone"
5786 then
5787 default_log_plugin="logfile"
5788 else
5789 LOAD_PLUGIN_LOGFILE="#"
5790 fi
5791 else
5792 LOAD_PLUGIN_LOGFILE="##"
5793 fi
5795 if test "x$enable_log_logstash" = "xyes"
5796 then
5797 LOAD_PLUGIN_LOG_LOGSTASH="#"
5798 else
5799 LOAD_PLUGIN_LOG_LOGSTASH="##"
5800 fi
5803 AC_MSG_RESULT([$default_log_plugin])
5805 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5806 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5807 AC_SUBST(LOAD_PLUGIN_LOG_LOGSTASH)
5809 DEFAULT_LOG_LEVEL="info"
5810 if test "x$enable_debug" = "xyes"
5811 then
5812 DEFAULT_LOG_LEVEL="debug"
5813 fi
5814 AC_SUBST(DEFAULT_LOG_LEVEL)
5816 # Load only one of rrdtool, network, csv in the default config.
5817 LOAD_PLUGIN_RRDTOOL=""
5818 LOAD_PLUGIN_NETWORK=""
5819 LOAD_PLUGIN_CSV=""
5821 AC_MSG_CHECKING([which default write plugin to load])
5822 default_write_plugin="none"
5823 if test "x$enable_rrdtool" = "xyes"
5824 then
5825 default_write_plugin="rrdtool"
5826 else
5827 LOAD_PLUGIN_RRDTOOL="##"
5828 fi
5830 if test "x$enable_network" = "xyes"
5831 then
5832 if test "x$default_write_plugin" = "xnone"
5833 then
5834 default_write_plugin="network"
5835 else
5836 LOAD_PLUGIN_NETWORK="#"
5837 fi
5838 else
5839 LOAD_PLUGIN_NETWORK="##"
5840 fi
5842 if test "x$enable_csv" = "xyes"
5843 then
5844 if test "x$default_write_plugin" = "xnone"
5845 then
5846 default_write_plugin="csv"
5847 else
5848 LOAD_PLUGIN_CSV="#"
5849 fi
5850 else
5851 LOAD_PLUGIN_CSV="##"
5852 fi
5853 AC_MSG_RESULT([$default_write_plugin])
5855 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5856 AC_SUBST(LOAD_PLUGIN_NETWORK)
5857 AC_SUBST(LOAD_PLUGIN_CSV)
5859 dnl ip_vs.h
5860 if test "x$ac_system" = "xLinux" \
5861 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5862 then
5863 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5864 fi
5866 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5867 then
5868 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5869 fi
5871 dnl Perl bindings
5872 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5873 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5874 [
5875 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5876 then
5877 PERL_BINDINGS_OPTIONS="$withval"
5878 with_perl_bindings="yes"
5879 else
5880 with_perl_bindings="$withval"
5881 fi
5882 ],
5883 [
5884 if test -n "$perl_interpreter"
5885 then
5886 with_perl_bindings="yes"
5887 else
5888 with_perl_bindings="no (no perl interpreter found)"
5889 fi
5890 ])
5891 if test "x$with_perl_bindings" = "xyes"
5892 then
5893 PERL_BINDINGS="perl"
5894 else
5895 PERL_BINDINGS=""
5896 fi
5897 AC_SUBST(PERL_BINDINGS)
5898 AC_SUBST(PERL_BINDINGS_OPTIONS)
5900 dnl libcollectdclient
5901 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5902 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5903 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5905 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5907 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5909 AC_SUBST(LCC_VERSION_MAJOR)
5910 AC_SUBST(LCC_VERSION_MINOR)
5911 AC_SUBST(LCC_VERSION_PATCH)
5912 AC_SUBST(LCC_VERSION_EXTRA)
5913 AC_SUBST(LCC_VERSION_STRING)
5915 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5917 AC_CONFIG_FILES([Makefile src/Makefile src/daemon/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile])
5918 AC_OUTPUT
5920 if test "x$with_librrd" = "xyes" \
5921 && test "x$librrd_threadsafe" != "xyes"
5922 then
5923 with_librrd="yes (warning: librrd is not thread-safe)"
5924 fi
5926 if test "x$with_libperl" = "xyes"
5927 then
5928 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5929 else
5930 enable_perl="no (needs libperl)"
5931 fi
5933 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5934 then
5935 enable_perl="no (libperl doesn't support ithreads)"
5936 fi
5938 if test "x$with_perl_bindings" = "xyes" \
5939 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5940 then
5941 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5942 fi
5944 cat <<EOF;
5946 Configuration:
5947 Libraries:
5948 intel mic . . . . . . $with_mic
5949 libaquaero5 . . . . . $with_libaquaero5
5950 libatasmart . . . . . $with_libatasmart
5951 libcurl . . . . . . . $with_libcurl
5952 libdbi . . . . . . . $with_libdbi
5953 libesmtp . . . . . . $with_libesmtp
5954 libganglia . . . . . $with_libganglia
5955 libgcrypt . . . . . . $with_libgcrypt
5956 libhal . . . . . . . $with_libhal
5957 libhiredis . . . . . $with_libhiredis
5958 libi2c-dev . . . . . $with_libi2c
5959 libiokit . . . . . . $with_libiokit
5960 libiptc . . . . . . . $with_libiptc
5961 libjvm . . . . . . . $with_java
5962 libkstat . . . . . . $with_kstat
5963 libkvm . . . . . . . $with_libkvm
5964 libldap . . . . . . . $with_libldap
5965 liblvm2app . . . . . $with_liblvm2app
5966 libmemcached . . . . $with_libmemcached
5967 libmnl . . . . . . . $with_libmnl
5968 libmodbus . . . . . . $with_libmodbus
5969 libmongoc . . . . . . $with_libmongoc
5970 libmosquitto . . . . $with_libmosquitto
5971 libmysql . . . . . . $with_libmysql
5972 libnetapp . . . . . . $with_libnetapp
5973 libnetsnmp . . . . . $with_libnetsnmp
5974 libnotify . . . . . . $with_libnotify
5975 liboconfig . . . . . $with_liboconfig
5976 libopenipmi . . . . . $with_libopenipmipthread
5977 liboping . . . . . . $with_liboping
5978 libowcapi . . . . . . $with_libowcapi
5979 libpcap . . . . . . . $with_libpcap
5980 libperfstat . . . . . $with_perfstat
5981 libperl . . . . . . . $with_libperl
5982 libpq . . . . . . . . $with_libpq
5983 libpthread . . . . . $with_libpthread
5984 librabbitmq . . . . . $with_librabbitmq
5985 librdkafka . . . . . $with_librdkafka
5986 librouteros . . . . . $with_librouteros
5987 librrd . . . . . . . $with_librrd
5988 libsensors . . . . . $with_libsensors
5989 libsigrok . . . . . $with_libsigrok
5990 libstatgrab . . . . . $with_libstatgrab
5991 libtokyotyrant . . . $with_libtokyotyrant
5992 libudev . . . . . . . $with_libudev
5993 libupsclient . . . . $with_libupsclient
5994 libvarnish . . . . . $with_libvarnish
5995 libvirt . . . . . . . $with_libvirt
5996 libxml2 . . . . . . . $with_libxml2
5997 libxmms . . . . . . . $with_libxmms
5998 libyajl . . . . . . . $with_libyajl
5999 oracle . . . . . . . $with_oracle
6000 protobuf-c . . . . . $have_protoc_c
6001 python . . . . . . . $with_python
6003 Features:
6004 daemon mode . . . . . $enable_daemon
6005 debug . . . . . . . . $enable_debug
6007 Bindings:
6008 perl . . . . . . . . $with_perl_bindings
6010 Modules:
6011 aggregation . . . . . $enable_aggregation
6012 amqp . . . . . . . $enable_amqp
6013 apache . . . . . . . $enable_apache
6014 apcups . . . . . . . $enable_apcups
6015 apple_sensors . . . . $enable_apple_sensors
6016 aquaero . . . . . . . $enable_aquaero
6017 ascent . . . . . . . $enable_ascent
6018 barometer . . . . . . $enable_barometer
6019 battery . . . . . . . $enable_battery
6020 bind . . . . . . . . $enable_bind
6021 ceph . . . . . . . . $enable_ceph
6022 cgroups . . . . . . . $enable_cgroups
6023 conntrack . . . . . . $enable_conntrack
6024 contextswitch . . . . $enable_contextswitch
6025 cpu . . . . . . . . . $enable_cpu
6026 cpufreq . . . . . . . $enable_cpufreq
6027 csv . . . . . . . . . $enable_csv
6028 curl . . . . . . . . $enable_curl
6029 curl_json . . . . . . $enable_curl_json
6030 curl_xml . . . . . . $enable_curl_xml
6031 dbi . . . . . . . . . $enable_dbi
6032 df . . . . . . . . . $enable_df
6033 disk . . . . . . . . $enable_disk
6034 dns . . . . . . . . . $enable_dns
6035 drbd . . . . . . . . $enable_drbd
6036 email . . . . . . . . $enable_email
6037 entropy . . . . . . . $enable_entropy
6038 ethstat . . . . . . . $enable_ethstat
6039 exec . . . . . . . . $enable_exec
6040 fhcount . . . . . . . $enable_fhcount
6041 filecount . . . . . . $enable_filecount
6042 fscache . . . . . . . $enable_fscache
6043 gmond . . . . . . . . $enable_gmond
6044 hddtemp . . . . . . . $enable_hddtemp
6045 interface . . . . . . $enable_interface
6046 ipc . . . . . . . . . $enable_ipc
6047 ipmi . . . . . . . . $enable_ipmi
6048 iptables . . . . . . $enable_iptables
6049 ipvs . . . . . . . . $enable_ipvs
6050 irq . . . . . . . . . $enable_irq
6051 java . . . . . . . . $enable_java
6052 load . . . . . . . . $enable_load
6053 logfile . . . . . . . $enable_logfile
6054 log_logstash . . . . $enable_log_logstash
6055 lpar . . . . . . . . $enable_lpar
6056 lvm . . . . . . . . . $enable_lvm
6057 madwifi . . . . . . . $enable_madwifi
6058 match_empty_counter . $enable_match_empty_counter
6059 match_hashed . . . . $enable_match_hashed
6060 match_regex . . . . . $enable_match_regex
6061 match_timediff . . . $enable_match_timediff
6062 match_value . . . . . $enable_match_value
6063 mbmon . . . . . . . . $enable_mbmon
6064 md . . . . . . . . . $enable_md
6065 memcachec . . . . . . $enable_memcachec
6066 memcached . . . . . . $enable_memcached
6067 memory . . . . . . . $enable_memory
6068 mic . . . . . . . . . $enable_mic
6069 modbus . . . . . . . $enable_modbus
6070 mqtt . . . . . . . . $enable_mqtt
6071 multimeter . . . . . $enable_multimeter
6072 mysql . . . . . . . . $enable_mysql
6073 netapp . . . . . . . $enable_netapp
6074 netlink . . . . . . . $enable_netlink
6075 network . . . . . . . $enable_network
6076 nfs . . . . . . . . . $enable_nfs
6077 nginx . . . . . . . . $enable_nginx
6078 notify_desktop . . . $enable_notify_desktop
6079 notify_email . . . . $enable_notify_email
6080 ntpd . . . . . . . . $enable_ntpd
6081 numa . . . . . . . . $enable_numa
6082 nut . . . . . . . . . $enable_nut
6083 olsrd . . . . . . . . $enable_olsrd
6084 onewire . . . . . . . $enable_onewire
6085 openldap . . . . . . $enable_openldap
6086 openvpn . . . . . . . $enable_openvpn
6087 oracle . . . . . . . $enable_oracle
6088 perl . . . . . . . . $enable_perl
6089 pf . . . . . . . . . $enable_pf
6090 pinba . . . . . . . . $enable_pinba
6091 ping . . . . . . . . $enable_ping
6092 postgresql . . . . . $enable_postgresql
6093 powerdns . . . . . . $enable_powerdns
6094 processes . . . . . . $enable_processes
6095 protocols . . . . . . $enable_protocols
6096 python . . . . . . . $enable_python
6097 redis . . . . . . . . $enable_redis
6098 routeros . . . . . . $enable_routeros
6099 rrdcached . . . . . . $enable_rrdcached
6100 rrdtool . . . . . . . $enable_rrdtool
6101 sensors . . . . . . . $enable_sensors
6102 serial . . . . . . . $enable_serial
6103 sigrok . . . . . . . $enable_sigrok
6104 smart . . . . . . . . $enable_smart
6105 snmp . . . . . . . . $enable_snmp
6106 statsd . . . . . . . $enable_statsd
6107 swap . . . . . . . . $enable_swap
6108 syslog . . . . . . . $enable_syslog
6109 table . . . . . . . . $enable_table
6110 tail_csv . . . . . . $enable_tail_csv
6111 tail . . . . . . . . $enable_tail
6112 tape . . . . . . . . $enable_tape
6113 target_notification . $enable_target_notification
6114 target_replace . . . $enable_target_replace
6115 target_scale . . . . $enable_target_scale
6116 target_set . . . . . $enable_target_set
6117 target_v5upgrade . . $enable_target_v5upgrade
6118 tcpconns . . . . . . $enable_tcpconns
6119 teamspeak2 . . . . . $enable_teamspeak2
6120 ted . . . . . . . . . $enable_ted
6121 thermal . . . . . . . $enable_thermal
6122 threshold . . . . . . $enable_threshold
6123 tokyotyrant . . . . . $enable_tokyotyrant
6124 turbostat . . . . . . $enable_turbostat
6125 unixsock . . . . . . $enable_unixsock
6126 uptime . . . . . . . $enable_uptime
6127 users . . . . . . . . $enable_users
6128 uuid . . . . . . . . $enable_uuid
6129 varnish . . . . . . . $enable_varnish
6130 virt . . . . . . . . $enable_virt
6131 vmem . . . . . . . . $enable_vmem
6132 vserver . . . . . . . $enable_vserver
6133 wireless . . . . . . $enable_wireless
6134 write_graphite . . . $enable_write_graphite
6135 write_http . . . . . $enable_write_http
6136 write_kafka . . . . . $enable_write_kafka
6137 write_log . . . . . . $enable_write_log
6138 write_mongodb . . . . $enable_write_mongodb
6139 write_redis . . . . . $enable_write_redis
6140 write_riemann . . . . $enable_write_riemann
6141 write_sensu . . . . . $enable_write_sensu
6142 write_tsdb . . . . . $enable_write_tsdb
6143 xmms . . . . . . . . $enable_xmms
6144 zfs_arc . . . . . . . $enable_zfs_arc
6145 zone . . . . . . . . $enable_zone
6146 zookeeper . . . . . . $enable_zookeeper
6148 EOF
6150 if test "x$dependency_error" = "xyes"; then
6151 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
6152 fi
6154 if test "x$dependency_warning" = "xyes"; then
6155 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
6156 fi
6158 # vim: set fdm=marker :