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