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