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/collectd.c)
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])
28 AC_LANG(C)
30 AC_PREFIX_DEFAULT("/opt/collectd")
32 AC_SYS_LARGEFILE
34 #
35 # Checks for programs.
36 #
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AC_PROG_MAKE_SET
42 AM_PROG_CC_C_O
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
45 AC_DISABLE_STATIC
46 AC_PROG_LIBTOOL
47 AC_PROG_LEX
48 AC_PROG_YACC
49 PKG_PROG_PKG_CONFIG
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h],
53 [have_protobuf_c_h="yes"],
54 [have_protobuf_c_h="no"])
55 if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes"
56 then
57 have_protoc_c="no (unable to find <google/protobuf-c/protobuf-c.h>)"
58 fi
59 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
61 AC_MSG_CHECKING([for kernel type ($host_os)])
62 case $host_os in
63 *linux*)
64 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
65 ac_system="Linux"
66 ;;
67 *solaris*)
68 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
69 ac_system="Solaris"
70 ;;
71 *darwin*)
72 ac_system="Darwin"
73 ;;
74 *openbsd*)
75 ac_system="OpenBSD"
76 ;;
77 *aix*)
78 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
79 ac_system="AIX"
80 ;;
81 *)
82 ac_system="unknown"
83 esac
84 AC_MSG_RESULT([$ac_system])
86 if test "x$ac_system" = "xLinux"
87 then
88 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
89 if test -z "$KERNEL_DIR"
90 then
91 KERNEL_DIR="/lib/modules/`uname -r`/source"
92 fi
94 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
95 AC_SUBST(KERNEL_CFLAGS)
96 fi
98 if test "x$ac_system" = "xSolaris"
99 then
100 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
101 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
102 fi
103 if test "x$ac_system" = "xAIX"
104 then
105 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
106 fi
108 # Where to install .pc files.
109 pkgconfigdir="${libdir}/pkgconfig"
110 AC_SUBST(pkgconfigdir)
112 # Check for standards compliance mode
113 AC_ARG_ENABLE(standards,
114 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
115 [enable_standards="$enableval"],
116 [enable_standards="no"])
117 if test "x$enable_standards" = "xyes"
118 then
119 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
120 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
121 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
122 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
123 if test "x$GCC" = "xyes"
124 then
125 CFLAGS="$CFLAGS -std=c99"
126 fi
127 fi
128 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
130 #
131 # Checks for header files.
132 #
133 AC_HEADER_STDC
134 AC_HEADER_SYS_WAIT
135 AC_HEADER_DIRENT
136 AC_HEADER_STDBOOL
138 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)
140 # For ping library
141 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
142 [#if HAVE_STDINT_H
143 # include <stdint.h>
144 #endif
145 #if HAVE_SYS_TYPES_H
146 # include <sys/types.h>
147 #endif
148 ])
149 AC_CHECK_HEADERS(netinet/in.h, [], [],
150 [#if HAVE_STDINT_H
151 # include <stdint.h>
152 #endif
153 #if HAVE_SYS_TYPES_H
154 # include <sys/types.h>
155 #endif
156 #if HAVE_NETINET_IN_SYSTM_H
157 # include <netinet/in_systm.h>
158 #endif
159 ])
160 AC_CHECK_HEADERS(netinet/ip.h, [], [],
161 [#if HAVE_STDINT_H
162 # include <stdint.h>
163 #endif
164 #if HAVE_SYS_TYPES_H
165 # include <sys/types.h>
166 #endif
167 #if HAVE_NETINET_IN_SYSTM_H
168 # include <netinet/in_systm.h>
169 #endif
170 #if HAVE_NETINET_IN_H
171 # include <netinet/in.h>
172 #endif
173 ])
174 AC_CHECK_HEADERS(netinet/ip_icmp.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 #if HAVE_NETINET_IP_H
188 # include <netinet/ip.h>
189 #endif
190 ])
191 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
192 [#if HAVE_STDINT_H
193 # include <stdint.h>
194 #endif
195 #if HAVE_SYS_TYPES_H
196 # include <sys/types.h>
197 #endif
198 #if HAVE_NETINET_IN_SYSTM_H
199 # include <netinet/in_systm.h>
200 #endif
201 #if HAVE_NETINET_IN_H
202 # include <netinet/in.h>
203 #endif
204 #if HAVE_NETINET_IP_H
205 # include <netinet/ip.h>
206 #endif
207 ])
208 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
209 [#if HAVE_STDINT_H
210 # include <stdint.h>
211 #endif
212 #if HAVE_SYS_TYPES_H
213 # include <sys/types.h>
214 #endif
215 #if HAVE_NETINET_IN_SYSTM_H
216 # include <netinet/in_systm.h>
217 #endif
218 #if HAVE_NETINET_IN_H
219 # include <netinet/in.h>
220 #endif
221 ])
222 AC_CHECK_HEADERS(netinet/icmp6.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 #if HAVE_NETINET_IP6_H
236 # include <netinet/ip6.h>
237 #endif
238 ])
239 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
240 [#if HAVE_STDINT_H
241 # include <stdint.h>
242 #endif
243 #if HAVE_SYS_TYPES_H
244 # include <sys/types.h>
245 #endif
246 #if HAVE_NETINET_IN_SYSTM_H
247 # include <netinet/in_systm.h>
248 #endif
249 #if HAVE_NETINET_IN_H
250 # include <netinet/in.h>
251 #endif
252 #if HAVE_NETINET_IP_H
253 # include <netinet/ip.h>
254 #endif
255 ])
256 AC_CHECK_HEADERS(netinet/udp.h, [], [],
257 [#if HAVE_STDINT_H
258 # include <stdint.h>
259 #endif
260 #if HAVE_SYS_TYPES_H
261 # include <sys/types.h>
262 #endif
263 #if HAVE_NETINET_IN_SYSTM_H
264 # include <netinet/in_systm.h>
265 #endif
266 #if HAVE_NETINET_IN_H
267 # include <netinet/in.h>
268 #endif
269 #if HAVE_NETINET_IP_H
270 # include <netinet/ip.h>
271 #endif
272 ])
274 # For cpu modules
275 AC_CHECK_HEADERS(sys/dkstat.h)
276 if test "x$ac_system" = "xDarwin"
277 then
278 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)
279 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
280 # For the battery plugin
281 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
282 [
283 #if HAVE_IOKIT_IOKITLIB_H
284 # include <IOKit/IOKitLib.h>
285 #endif
286 #if HAVE_IOKIT_IOTYPES_H
287 # include <IOKit/IOTypes.h>
288 #endif
289 ])
291 fi
293 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
294 [
295 #if HAVE_SYS_TYPES_H
296 # include <sys/types.h>
297 #endif
298 #if HAVE_SYS_PARAM_H
299 # include <sys/param.h>
300 #endif
301 ])
303 AC_MSG_CHECKING([for sysctl kern.cp_times])
304 if test -x /sbin/sysctl
305 then
306 /sbin/sysctl kern.cp_times 2>/dev/null
307 if test $? -eq 0
308 then
309 AC_MSG_RESULT([yes])
310 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
311 [Define if sysctl supports kern.cp_times])
312 else
313 AC_MSG_RESULT([no])
314 fi
315 else
316 AC_MSG_RESULT([no])
317 fi
319 # For hddtemp module
320 AC_CHECK_HEADERS(linux/major.h)
322 # For md module (Linux only)
323 if test "x$ac_system" = "xLinux"
324 then
325 AC_CHECK_HEADERS(linux/raid/md_u.h,
326 [have_linux_raid_md_u_h="yes"],
327 [have_linux_raid_md_u_h="no"],
328 [
329 #include <sys/ioctl.h>
330 #include <linux/major.h>
331 #include <linux/types.h>
332 ])
333 else
334 have_linux_raid_md_u_h="no"
335 fi
337 # For the swap module
338 have_linux_wireless_h="no"
339 if test "x$ac_system" = "xLinux"
340 then
341 AC_CHECK_HEADERS(linux/wireless.h,
342 [have_linux_wireless_h="yes"],
343 [have_linux_wireless_h="no"],
344 [
345 #include <dirent.h>
346 #include <sys/ioctl.h>
347 #include <sys/socket.h>
348 ])
349 fi
351 # For the swap module
352 have_sys_swap_h="yes"
353 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
354 [
355 #undef _FILE_OFFSET_BITS
356 #undef _LARGEFILE64_SOURCE
357 #if HAVE_SYS_TYPES_H
358 # include <sys/types.h>
359 #endif
360 #if HAVE_SYS_PARAM_H
361 # include <sys/param.h>
362 #endif
363 ])
365 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
366 then
367 hint_64=""
368 if test "x$GCC" = "xyes"
369 then
370 hint_64="CFLAGS='-m64'"
371 else
372 hint_64="CFLAGS='-xarch=v9'"
373 fi
374 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
375 fi
377 # For load module
378 # For the processes plugin
379 # For users module
380 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
382 # For interface plugin
383 AC_CHECK_HEADERS(ifaddrs.h)
384 AC_CHECK_HEADERS(net/if.h, [], [],
385 [
386 #if HAVE_SYS_TYPES_H
387 # include <sys/types.h>
388 #endif
389 #if HAVE_SYS_SOCKET_H
390 # include <sys/socket.h>
391 #endif
392 ])
393 AC_CHECK_HEADERS(linux/if.h, [], [],
394 [
395 #if HAVE_SYS_TYPES_H
396 # include <sys/types.h>
397 #endif
398 #if HAVE_SYS_SOCKET_H
399 # include <sys/socket.h>
400 #endif
401 ])
402 AC_CHECK_HEADERS(linux/inet_diag.h, [], [],
403 [
404 #if HAVE_SYS_TYPES_H
405 # include <sys/types.h>
406 #endif
407 #if HAVE_SYS_SOCKET_H
408 # include <sys/socket.h>
409 #endif
410 #if HAVE_LINUX_INET_DIAG_H
411 # include <linux/inet_diag.h>
412 #endif
413 ])
414 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
415 [
416 #if HAVE_SYS_TYPES_H
417 # include <sys/types.h>
418 #endif
419 #if HAVE_SYS_SOCKET_H
420 # include <sys/socket.h>
421 #endif
422 #if HAVE_LINUX_IF_H
423 # include <linux/if.h>
424 #endif
425 ])
427 # For ethstat module
428 AC_CHECK_HEADERS(linux/sockios.h,
429 [have_linux_sockios_h="yes"],
430 [have_linux_sockios_h="no"],
431 [
432 #if HAVE_SYS_IOCTL_H
433 # include <sys/ioctl.h>
434 #endif
435 #if HAVE_NET_IF_H
436 # include <net/if.h>
437 #endif
438 ])
439 AC_CHECK_HEADERS(linux/ethtool.h,
440 [have_linux_ethtool_h="yes"],
441 [have_linux_ethtool_h="no"],
442 [
443 #if HAVE_SYS_IOCTL_H
444 # include <sys/ioctl.h>
445 #endif
446 #if HAVE_NET_IF_H
447 # include <net/if.h>
448 #endif
449 #if HAVE_LINUX_SOCKIOS_H
450 # include <linux/sockios.h>
451 #endif
452 ])
454 # For ipvs module
455 have_linux_ip_vs_h="no"
456 have_net_ip_vs_h="no"
457 have_ip_vs_h="no"
458 ip_vs_h_needs_kernel_cflags="no"
459 if test "x$ac_system" = "xLinux"
460 then
461 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
462 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
463 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
465 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
466 then
467 SAVE_CFLAGS="$CFLAGS"
468 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
470 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
472 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
473 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
474 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
476 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
477 then
478 ip_vs_h_needs_kernel_cflags="yes"
479 fi
481 CFLAGS="$SAVE_CFLAGS"
482 fi
483 fi
484 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
486 # For quota module
487 AC_CHECK_HEADERS(sys/ucred.h, [], [],
488 [
489 #if HAVE_SYS_TYPES_H
490 # include <sys/types.h>
491 #endif
492 #if HAVE_SYS_PARAM_H
493 # include <sys/param.h>
494 #endif
495 ])
497 # For mount interface
498 AC_CHECK_HEADERS(sys/mount.h, [], [],
499 [
500 #if HAVE_SYS_TYPES_H
501 # include <sys/types.h>
502 #endif
503 #if HAVE_SYS_PARAM_H
504 # include <sys/param.h>
505 #endif
506 ])
508 # For the email plugin
509 AC_CHECK_HEADERS(linux/un.h, [], [],
510 [
511 #if HAVE_SYS_SOCKET_H
512 # include <sys/socket.h>
513 #endif
514 ])
516 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 kvm.h wordexp.h)
518 # For the dns plugin
519 AC_CHECK_HEADERS(arpa/nameser.h)
520 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
521 [
522 #if HAVE_ARPA_NAMESER_H
523 # include <arpa/nameser.h>
524 #endif
525 ])
527 AC_CHECK_HEADERS(net/if_arp.h, [], [],
528 [#if HAVE_SYS_SOCKET_H
529 # include <sys/socket.h>
530 #endif
531 ])
532 AC_CHECK_HEADERS(net/ppp_defs.h)
533 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
534 [#if HAVE_NET_PPP_DEFS_H
535 # include <net/ppp_defs.h>
536 #endif
537 ])
538 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
539 [#if HAVE_STDINT_H
540 # include <stdint.h>
541 #endif
542 #if HAVE_SYS_TYPES_H
543 # include <sys/types.h>
544 #endif
545 #if HAVE_SYS_SOCKET_H
546 # include <sys/socket.h>
547 #endif
548 #if HAVE_NET_IF_H
549 # include <net/if.h>
550 #endif
551 #if HAVE_NETINET_IN_H
552 # include <netinet/in.h>
553 #endif
554 ])
556 AC_CHECK_HEADERS(netinet/ip_compat.h)
558 have_net_pfvar_h="no"
559 AC_CHECK_HEADERS(net/pfvar.h,
560 [have_net_pfvar_h="yes"],
561 [have_net_pfvar_h="no"],
562 [
563 #if HAVE_SYS_IOCTL_H
564 # include <sys/ioctl.h>
565 #endif
566 #if HAVE_SYS_SOCKET_H
567 # include <sys/socket.h>
568 #endif
569 #if HAVE_NET_IF_H
570 # include <net/if.h>
571 #endif
572 ])
574 # For the multimeter plugin
575 have_termios_h="no"
576 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
578 #
579 # Checks for typedefs, structures, and compiler characteristics.
580 #
581 AC_C_CONST
582 AC_TYPE_PID_T
583 AC_TYPE_SIZE_T
584 AC_TYPE_UID_T
585 AC_HEADER_TIME
587 #
588 # Checks for library functions.
589 #
590 AC_PROG_GCC_TRADITIONAL
591 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
593 AC_FUNC_STRERROR_R
595 SAVE_CFLAGS="$CFLAGS"
596 # Emulate behavior of src/Makefile.am
597 if test "x$GCC" = "xyes"
598 then
599 CFLAGS="$CFLAGS -Wall -Werror"
600 fi
602 AC_CACHE_CHECK([for strtok_r],
603 [c_cv_have_strtok_r_default],
604 AC_LINK_IFELSE(
605 [AC_LANG_PROGRAM(
606 [[[
607 #include <stdlib.h>
608 #include <stdio.h>
609 #include <string.h>
610 ]]],
611 [[[
612 char buffer[] = "foo,bar,baz";
613 char *token;
614 char *dummy;
615 char *saveptr;
617 dummy = buffer;
618 saveptr = NULL;
619 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
620 {
621 dummy = NULL;
622 printf ("token = %s;\n", token);
623 }
624 ]]]
625 )],
626 [c_cv_have_strtok_r_default="yes"],
627 [c_cv_have_strtok_r_default="no"]
628 )
629 )
631 if test "x$c_cv_have_strtok_r_default" = "xno"
632 then
633 CFLAGS="$CFLAGS -D_REENTRANT=1"
635 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
636 [c_cv_have_strtok_r_reentrant],
637 AC_LINK_IFELSE(
638 [AC_LANG_PROGRAM(
639 [[[
640 #include <stdlib.h>
641 #include <stdio.h>
642 #include <string.h>
643 ]]],
644 [[[
645 char buffer[] = "foo,bar,baz";
646 char *token;
647 char *dummy;
648 char *saveptr;
650 dummy = buffer;
651 saveptr = NULL;
652 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
653 {
654 dummy = NULL;
655 printf ("token = %s;\n", token);
656 }
657 ]]]
658 )],
659 [c_cv_have_strtok_r_reentrant="yes"],
660 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
661 )
662 )
663 fi
665 CFLAGS="$SAVE_CFLAGS"
666 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
667 then
668 CFLAGS="$CFLAGS -D_REENTRANT=1"
669 fi
671 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
673 socket_needs_socket="no"
674 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
675 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
677 clock_gettime_needs_rt="no"
678 clock_gettime_needs_posix4="no"
679 have_clock_gettime="no"
680 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
681 if test "x$have_clock_gettime" = "xno"
682 then
683 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
684 have_clock_gettime="yes"])
685 fi
686 if test "x$have_clock_gettime" = "xno"
687 then
688 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
689 have_clock_gettime="yes"])
690 fi
691 if test "x$have_clock_gettime" = "xyes"
692 then
693 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
694 else
695 AC_MSG_WARN(cannot find clock_gettime)
696 fi
698 nanosleep_needs_rt="no"
699 nanosleep_needs_posix4="no"
700 AC_CHECK_FUNCS(nanosleep,
701 [],
702 AC_CHECK_LIB(rt, nanosleep,
703 [nanosleep_needs_rt="yes"],
704 AC_CHECK_LIB(posix4, nanosleep,
705 [nanosleep_needs_posix4="yes"],
706 AC_MSG_ERROR(cannot find nanosleep))))
708 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
709 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
711 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
712 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
713 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
714 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
715 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
716 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
717 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
718 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
719 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
720 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
721 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
722 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
724 # Check for strptime {{{
725 if test "x$GCC" = "xyes"
726 then
727 SAVE_CFLAGS="$CFLAGS"
728 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
729 fi
731 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
732 if test "x$have_strptime" = "xyes"
733 then
734 AC_CACHE_CHECK([whether strptime is exported by default],
735 [c_cv_have_strptime_default],
736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
737 [[[
738 #include <time.h>
739 ]]],
740 [[[
741 struct tm stm;
742 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
743 ]]]
744 )],
745 [c_cv_have_strptime_default="yes"],
746 [c_cv_have_strptime_default="no"]))
747 fi
748 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
749 then
750 AC_CACHE_CHECK([whether strptime needs standards mode],
751 [c_cv_have_strptime_standards],
752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
753 [[[
754 #ifndef _ISOC99_SOURCE
755 # define _ISOC99_SOURCE 1
756 #endif
757 #ifndef _POSIX_C_SOURCE
758 # define _POSIX_C_SOURCE 200112L
759 #endif
760 #ifndef _XOPEN_SOURCE
761 # define _XOPEN_SOURCE 500
762 #endif
763 #include <time.h>
764 ]]],
765 [[[
766 struct tm stm;
767 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
768 ]]]
769 )],
770 [c_cv_have_strptime_standards="yes"],
771 [c_cv_have_strptime_standards="no"]))
773 if test "x$c_cv_have_strptime_standards" = "xyes"
774 then
775 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
776 else
777 have_strptime="no"
778 fi
779 fi
781 if test "x$GCC" = "xyes"
782 then
783 CFLAGS="$SAVE_CFLAGS"
784 fi
785 # }}} Check for strptime
787 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
788 if test "x$have_swapctl" = "xyes"; then
789 AC_CACHE_CHECK([whether swapctl takes two arguments],
790 [c_cv_have_swapctl_two_args],
791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
792 [[[
793 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
794 # undef _FILE_OFFSET_BITS
795 # undef _LARGEFILE64_SOURCE
796 #endif
797 #include <sys/stat.h>
798 #include <sys/swap.h>
799 ]]],
800 [[[
801 int num = swapctl(0, NULL);
802 ]]]
803 )],
804 [c_cv_have_swapctl_two_args="yes"],
805 [c_cv_have_swapctl_two_args="no"]
806 )
807 )
808 AC_CACHE_CHECK([whether swapctl takes three arguments],
809 [c_cv_have_swapctl_three_args],
810 AC_COMPILE_IFELSE(
811 [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/swap.h>
819 ]]],
820 [[[
821 int num = swapctl(0, NULL, 0);
822 ]]]
823 )],
824 [c_cv_have_swapctl_three_args="yes"],
825 [c_cv_have_swapctl_three_args="no"]
826 )
827 )
828 fi
829 # Check for different versions of `swapctl' here..
830 if test "x$have_swapctl" = "xyes"; then
831 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
832 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
833 [Define if the function swapctl exists and takes two arguments.])
834 fi
835 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
836 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
837 [Define if the function swapctl exists and takes three arguments.])
838 fi
839 fi
841 # Check for NAN
842 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
843 [
844 if test "x$withval" = "xno"; then
845 nan_type="none"
846 else if test "x$withval" = "xyes"; then
847 nan_type="zero"
848 else
849 nan_type="$withval"
850 fi; fi
851 ],
852 [nan_type="none"])
853 if test "x$nan_type" = "xnone"; then
854 AC_CACHE_CHECK([whether NAN is defined by default],
855 [c_cv_have_nan_default],
856 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
857 [[[
858 #include <stdlib.h>
859 #include <math.h>
860 static double foo = NAN;
861 ]]],
862 [[[
863 if (isnan (foo))
864 return 0;
865 else
866 return 1;
867 ]]]
868 )],
869 [c_cv_have_nan_default="yes"],
870 [c_cv_have_nan_default="no"]
871 )
872 )
873 if test "x$c_cv_have_nan_default" = "xyes"
874 then
875 nan_type="default"
876 fi
877 fi
878 if test "x$nan_type" = "xnone"; then
879 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
880 [c_cv_have_nan_isoc],
881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
882 [[[
883 #include <stdlib.h>
884 #define __USE_ISOC99 1
885 #include <math.h>
886 static double foo = NAN;
887 ]]],
888 [[[
889 if (isnan (foo))
890 return 0;
891 else
892 return 1;
893 ]]]
894 )],
895 [c_cv_have_nan_isoc="yes"],
896 [c_cv_have_nan_isoc="no"]
897 )
898 )
899 if test "x$c_cv_have_nan_isoc" = "xyes"
900 then
901 nan_type="isoc99"
902 fi
903 fi
904 if test "x$nan_type" = "xnone"; then
905 SAVE_LDFLAGS=$LDFLAGS
906 LDFLAGS="$LDFLAGS -lm"
907 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
908 [c_cv_have_nan_zero],
909 AC_RUN_IFELSE([AC_LANG_PROGRAM(
910 [[[
911 #include <stdlib.h>
912 #include <math.h>
913 #ifdef NAN
914 # undef NAN
915 #endif
916 #define NAN (0.0 / 0.0)
917 #ifndef isnan
918 # define isnan(f) ((f) != (f))
919 #endif
920 static double foo = NAN;
921 ]]],
922 [[[
923 if (isnan (foo))
924 return 0;
925 else
926 return 1;
927 ]]]
928 )],
929 [c_cv_have_nan_zero="yes"],
930 [c_cv_have_nan_zero="no"]
931 )
932 )
933 LDFLAGS=$SAVE_LDFLAGS
934 if test "x$c_cv_have_nan_zero" = "xyes"
935 then
936 nan_type="zero"
937 fi
938 fi
940 if test "x$nan_type" = "xdefault"; then
941 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
942 [Define if NAN is defined by default and can initialize static variables.])
943 else if test "x$nan_type" = "xisoc99"; then
944 AC_DEFINE(NAN_STATIC_ISOC, 1,
945 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
946 else if test "x$nan_type" = "xzero"; then
947 AC_DEFINE(NAN_ZERO_ZERO, 1,
948 [Define if NAN can be defined as (0.0 / 0.0)])
949 else
950 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
951 fi; fi; fi
953 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
954 [
955 if test "x$withval" = "xnothing"; then
956 fp_layout_type="nothing"
957 else if test "x$withval" = "xendianflip"; then
958 fp_layout_type="endianflip"
959 else if test "x$withval" = "xintswap"; then
960 fp_layout_type="intswap"
961 else
962 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
963 fi; fi; fi
964 ],
965 [fp_layout_type="unknown"])
967 if test "x$fp_layout_type" = "xunknown"; then
968 AC_CACHE_CHECK([if doubles are stored in x86 representation],
969 [c_cv_fp_layout_need_nothing],
970 AC_RUN_IFELSE([AC_LANG_PROGRAM(
971 [[[
972 #include <stdlib.h>
973 #include <stdio.h>
974 #include <string.h>
975 #if HAVE_STDINT_H
976 # include <stdint.h>
977 #endif
978 #if HAVE_INTTYPES_H
979 # include <inttypes.h>
980 #endif
981 #if HAVE_STDBOOL_H
982 # include <stdbool.h>
983 #endif
984 ]]],
985 [[[
986 uint64_t i0;
987 uint64_t i1;
988 uint8_t c[8];
989 double d;
991 d = 8.642135e130;
992 memcpy ((void *) &i0, (void *) &d, 8);
994 i1 = i0;
995 memcpy ((void *) c, (void *) &i1, 8);
997 if ((c[0] == 0x2f) && (c[1] == 0x25)
998 && (c[2] == 0xc0) && (c[3] == 0xc7)
999 && (c[4] == 0x43) && (c[5] == 0x2b)
1000 && (c[6] == 0x1f) && (c[7] == 0x5b))
1001 return (0);
1002 else
1003 return (1);
1004 ]]]
1005 )],
1006 [c_cv_fp_layout_need_nothing="yes"],
1007 [c_cv_fp_layout_need_nothing="no"]
1008 )
1009 )
1010 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1011 fp_layout_type="nothing"
1012 fi
1013 fi
1014 if test "x$fp_layout_type" = "xunknown"; then
1015 AC_CACHE_CHECK([if endianflip converts to x86 representation],
1016 [c_cv_fp_layout_need_endianflip],
1017 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1018 [[[
1019 #include <stdlib.h>
1020 #include <stdio.h>
1021 #include <string.h>
1022 #if HAVE_STDINT_H
1023 # include <stdint.h>
1024 #endif
1025 #if HAVE_INTTYPES_H
1026 # include <inttypes.h>
1027 #endif
1028 #if HAVE_STDBOOL_H
1029 # include <stdbool.h>
1030 #endif
1031 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1032 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1033 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1034 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1035 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1036 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1037 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1038 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1039 ]]],
1040 [[[
1041 uint64_t i0;
1042 uint64_t i1;
1043 uint8_t c[8];
1044 double d;
1046 d = 8.642135e130;
1047 memcpy ((void *) &i0, (void *) &d, 8);
1049 i1 = endianflip (i0);
1050 memcpy ((void *) c, (void *) &i1, 8);
1052 if ((c[0] == 0x2f) && (c[1] == 0x25)
1053 && (c[2] == 0xc0) && (c[3] == 0xc7)
1054 && (c[4] == 0x43) && (c[5] == 0x2b)
1055 && (c[6] == 0x1f) && (c[7] == 0x5b))
1056 return (0);
1057 else
1058 return (1);
1059 ]]]
1060 )],
1061 [c_cv_fp_layout_need_endianflip="yes"],
1062 [c_cv_fp_layout_need_endianflip="no"]
1063 )
1064 )
1065 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1066 fp_layout_type="endianflip"
1067 fi
1068 fi
1069 if test "x$fp_layout_type" = "xunknown"; then
1070 AC_CACHE_CHECK([if intswap converts to x86 representation],
1071 [c_cv_fp_layout_need_intswap],
1072 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1073 [[[
1074 #include <stdlib.h>
1075 #include <stdio.h>
1076 #include <string.h>
1077 #if HAVE_STDINT_H
1078 # include <stdint.h>
1079 #endif
1080 #if HAVE_INTTYPES_H
1081 # include <inttypes.h>
1082 #endif
1083 #if HAVE_STDBOOL_H
1084 # include <stdbool.h>
1085 #endif
1086 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1087 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1088 ]]],
1089 [[[
1090 uint64_t i0;
1091 uint64_t i1;
1092 uint8_t c[8];
1093 double d;
1095 d = 8.642135e130;
1096 memcpy ((void *) &i0, (void *) &d, 8);
1098 i1 = intswap (i0);
1099 memcpy ((void *) c, (void *) &i1, 8);
1101 if ((c[0] == 0x2f) && (c[1] == 0x25)
1102 && (c[2] == 0xc0) && (c[3] == 0xc7)
1103 && (c[4] == 0x43) && (c[5] == 0x2b)
1104 && (c[6] == 0x1f) && (c[7] == 0x5b))
1105 return (0);
1106 else
1107 return (1);
1108 ]]]
1109 )],
1110 [c_cv_fp_layout_need_intswap="yes"],
1111 [c_cv_fp_layout_need_intswap="no"]
1112 )
1113 )
1114 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1115 fp_layout_type="intswap"
1116 fi
1117 fi
1119 if test "x$fp_layout_type" = "xnothing"; then
1120 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1121 [Define if doubles are stored in x86 representation.])
1122 else if test "x$fp_layout_type" = "xendianflip"; then
1123 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1124 [Define if endianflip is needed to convert to x86 representation.])
1125 else if test "x$fp_layout_type" = "xintswap"; then
1126 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1127 [Define if intswap is needed to convert to x86 representation.])
1128 else
1129 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1130 fi; fi; fi
1132 have_getfsstat="no"
1133 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1134 have_getvfsstat="no"
1135 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1136 have_listmntent="no"
1137 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1139 have_getmntent="no"
1140 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1141 if test "x$have_getmntent" = "xno"; then
1142 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1143 fi
1144 if test "x$have_getmntent" = "xno"; then
1145 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1146 fi
1147 if test "x$have_getmntent" = "xno"; then
1148 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1149 fi
1151 if test "x$have_getmntent" = "xc"; then
1152 AC_CACHE_CHECK([whether getmntent takes one argument],
1153 [c_cv_have_one_getmntent],
1154 AC_COMPILE_IFELSE(
1155 [AC_LANG_PROGRAM(
1156 [[[
1157 #include "$srcdir/src/utils_mount.h"
1158 ]]],
1159 [[[
1160 FILE *fh;
1161 struct mntent *me;
1162 fh = setmntent ("/etc/mtab", "r");
1163 me = getmntent (fh);
1164 return(me->mnt_passno);
1165 ]]]
1166 )],
1167 [c_cv_have_one_getmntent="yes"],
1168 [c_cv_have_one_getmntent="no"]
1169 )
1170 )
1171 AC_CACHE_CHECK([whether getmntent takes two arguments],
1172 [c_cv_have_two_getmntent],
1173 AC_COMPILE_IFELSE(
1174 [AC_LANG_PROGRAM(
1175 [[[
1176 #include "$srcdir/src/utils_mount.h"
1177 ]]],
1178 [[[
1179 FILE *fh;
1180 struct mnttab mt;
1181 int status;
1182 fh = fopen ("/etc/mnttab", "r");
1183 status = getmntent (fh, &mt);
1184 return(status);
1185 ]]]
1186 )],
1187 [c_cv_have_two_getmntent="yes"],
1188 [c_cv_have_two_getmntent="no"]
1189 )
1190 )
1191 fi
1193 # Check for different versions of `getmntent' here..
1195 if test "x$have_getmntent" = "xc"; then
1196 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1197 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1198 [Define if the function getmntent exists and takes one argument.])
1199 fi
1200 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1201 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1202 [Define if the function getmntent exists and takes two arguments.])
1203 fi
1204 fi
1205 if test "x$have_getmntent" = "xsun"; then
1206 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1207 [Define if the function getmntent exists. It's the version from libsun.])
1208 fi
1209 if test "x$have_getmntent" = "xseq"; then
1210 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1211 [Define if the function getmntent exists. It's the version from libseq.])
1212 fi
1213 if test "x$have_getmntent" = "xgen"; then
1214 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1215 [Define if the function getmntent exists. It's the version from libgen.])
1216 fi
1218 # Check for htonll
1219 AC_CACHE_CHECK([if have htonll defined],
1220 [c_cv_have_htonll],
1221 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1222 [[[
1223 #include <sys/types.h>
1224 #include <netinet/in.h>
1225 #if HAVE_INTTYPES_H
1226 # include <inttypes.h>
1227 #endif
1228 ]]],
1229 [[[
1230 return htonll(0);
1231 ]]]
1232 )],
1233 [c_cv_have_htonll="yes"],
1234 [c_cv_have_htonll="no"]
1235 )
1236 )
1237 if test "x$c_cv_have_htonll" = "xyes"
1238 then
1239 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1240 fi
1242 # Check for structures
1243 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1244 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1245 [],
1246 [
1247 #include <sys/types.h>
1248 #include <sys/socket.h>
1249 #include <net/if.h>
1250 ])
1251 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1252 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1253 [],
1254 [
1255 #include <sys/types.h>
1256 #include <sys/socket.h>
1257 #include <linux/if.h>
1258 #include <linux/netdevice.h>
1259 ])
1260 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1261 [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1262 [],
1263 [
1264 #include <linux/inet_diag.h>
1265 ])
1268 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1269 [],
1270 [
1271 #include <netinet/in.h>
1272 #include <net/if.h>
1273 ])
1275 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1276 [
1277 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1278 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1279 have_struct_kinfo_proc_freebsd="yes"
1280 ],
1281 [
1282 have_struct_kinfo_proc_freebsd="no"
1283 ],
1284 [
1285 #include <kvm.h>
1286 #include <sys/param.h>
1287 #include <sys/sysctl.h>
1288 #include <sys/user.h>
1289 ])
1291 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1292 [
1293 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1294 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1295 have_struct_kinfo_proc_openbsd="yes"
1296 ],
1297 [
1298 have_struct_kinfo_proc_openbsd="no"
1299 ],
1300 [
1301 #include <sys/param.h>
1302 #include <sys/sysctl.h>
1303 #include <kvm.h>
1304 ])
1306 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1307 [#define _BSD_SOURCE
1308 #if HAVE_STDINT_H
1309 # include <stdint.h>
1310 #endif
1311 #if HAVE_SYS_TYPES_H
1312 # include <sys/types.h>
1313 #endif
1314 #if HAVE_NETINET_IN_SYSTM_H
1315 # include <netinet/in_systm.h>
1316 #endif
1317 #if HAVE_NETINET_IN_H
1318 # include <netinet/in.h>
1319 #endif
1320 #if HAVE_NETINET_IP_H
1321 # include <netinet/ip.h>
1322 #endif
1323 #if HAVE_NETINET_UDP_H
1324 # include <netinet/udp.h>
1325 #endif
1326 ])
1327 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1328 [#define _BSD_SOURCE
1329 #if HAVE_STDINT_H
1330 # include <stdint.h>
1331 #endif
1332 #if HAVE_SYS_TYPES_H
1333 # include <sys/types.h>
1334 #endif
1335 #if HAVE_NETINET_IN_SYSTM_H
1336 # include <netinet/in_systm.h>
1337 #endif
1338 #if HAVE_NETINET_IN_H
1339 # include <netinet/in.h>
1340 #endif
1341 #if HAVE_NETINET_IP_H
1342 # include <netinet/ip.h>
1343 #endif
1344 #if HAVE_NETINET_UDP_H
1345 # include <netinet/udp.h>
1346 #endif
1347 ])
1349 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1350 [],
1351 [],
1352 [
1353 #if HAVE_KSTAT_H
1354 # include <kstat.h>
1355 #endif
1356 ])
1358 #
1359 # Checks for libraries begin here
1360 #
1362 with_libresolv="yes"
1363 AC_CHECK_LIB(resolv, res_search,
1364 [
1365 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1366 ],
1367 [with_libresolv="no"])
1368 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1370 dnl Check for HAL (hardware abstraction library)
1371 with_libhal="yes"
1372 AC_CHECK_LIB(hal,libhal_device_property_exists,
1373 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1374 [with_libhal="no"])
1375 if test "x$with_libhal" = "xyes"; then
1376 if test "x$PKG_CONFIG" != "x"; then
1377 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1378 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1379 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1380 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1381 fi
1382 fi
1384 m4_divert_once([HELP_WITH], [
1385 collectd additional packages:])
1387 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1389 if test "x$ac_system" = "xAIX"
1390 then
1391 with_perfstat="yes"
1392 with_procinfo="yes"
1393 else
1394 with_perfstat="no (AIX only)"
1395 with_procinfo="no (AIX only)"
1396 fi
1398 if test "x$with_perfstat" = "xyes"
1399 then
1400 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1401 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1402 fi
1403 if test "x$with_perfstat" = "xyes"
1404 then
1405 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1406 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1407 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1408 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1409 then
1410 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1411 fi
1412 fi
1413 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1415 # Processes plugin under AIX.
1416 if test "x$with_procinfo" = "xyes"
1417 then
1418 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1419 fi
1420 if test "x$with_procinfo" = "xyes"
1421 then
1422 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1423 fi
1425 if test "x$ac_system" = "xSolaris"
1426 then
1427 with_kstat="yes"
1428 with_devinfo="yes"
1429 else
1430 with_kstat="no (Solaris only)"
1431 with_devinfo="no (Solaris only)"
1432 fi
1434 if test "x$with_kstat" = "xyes"
1435 then
1436 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1437 fi
1438 if test "x$with_kstat" = "xyes"
1439 then
1440 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1441 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1442 fi
1443 if test "x$with_kstat" = "xyes"
1444 then
1445 AC_DEFINE(HAVE_LIBKSTAT, 1,
1446 [Define to 1 if you have the 'kstat' library (-lkstat)])
1447 fi
1448 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1449 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1451 with_libiokit="no"
1452 if test "x$ac_system" = "xDarwin"
1453 then
1454 with_libiokit="yes"
1455 else
1456 with_libiokit="no"
1457 fi
1458 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1460 with_libkvm="no"
1461 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1462 if test "x$with_kvm_getprocs" = "xyes"
1463 then
1464 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1465 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1466 with_libkvm="yes"
1467 fi
1468 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1470 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1471 if test "x$with_kvm_getswapinfo" = "xyes"
1472 then
1473 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1474 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1475 with_libkvm="yes"
1476 fi
1477 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1479 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1480 if test "x$with_kvm_nlist" = "xyes"
1481 then
1482 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1483 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1484 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1485 with_libkvm="yes"
1486 fi
1487 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1489 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1490 if test "x$with_kvm_openfiles" = "xyes"
1491 then
1492 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1493 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1494 with_libkvm="yes"
1495 fi
1496 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1498 # --with-libcredis {{{
1499 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1500 [
1501 if test "x$withval" = "xyes"
1502 then
1503 with_libcredis="yes"
1504 else if test "x$withval" = "xno"
1505 then
1506 with_libcredis="no"
1507 else
1508 with_libcredis="yes"
1509 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1510 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1511 fi; fi
1512 ],
1513 [with_libcredis="yes"])
1515 SAVE_CPPFLAGS="$CPPFLAGS"
1516 SAVE_LDFLAGS="$LDFLAGS"
1518 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1519 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1521 if test "x$with_libcredis" = "xyes"
1522 then
1523 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1524 then
1525 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1526 fi
1527 AC_CHECK_HEADERS(credis.h,
1528 [with_libcredis="yes"],
1529 [with_libcredis="no (credis.h not found)"])
1530 fi
1531 if test "x$with_libcredis" = "xyes"
1532 then
1533 if test "x$LIBCREDIS_LDFLAGS" != "x"
1534 then
1535 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1536 fi
1537 AC_CHECK_LIB(credis, credis_info,
1538 [with_libcredis="yes"],
1539 [with_libcredis="no (symbol 'credis_info' not found)"])
1541 fi
1543 CPPFLAGS="$SAVE_CPPFLAGS"
1544 LDFLAGS="$SAVE_LDFLAGS"
1546 if test "x$with_libcredis" = "xyes"
1547 then
1548 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1549 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1550 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1551 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1552 fi
1553 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1554 # }}}
1556 # --with-libcurl {{{
1557 with_curl_config="curl-config"
1558 with_curl_cflags=""
1559 with_curl_libs=""
1560 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1561 [
1562 if test "x$withval" = "xno"
1563 then
1564 with_libcurl="no"
1565 else if test "x$withval" = "xyes"
1566 then
1567 with_libcurl="yes"
1568 else
1569 if test -f "$withval" && test -x "$withval"
1570 then
1571 with_curl_config="$withval"
1572 with_libcurl="yes"
1573 else if test -x "$withval/bin/curl-config"
1574 then
1575 with_curl_config="$withval/bin/curl-config"
1576 with_libcurl="yes"
1577 fi; fi
1578 with_libcurl="yes"
1579 fi; fi
1580 ],
1581 [
1582 with_libcurl="yes"
1583 ])
1584 if test "x$with_libcurl" = "xyes"
1585 then
1586 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1587 curl_config_status=$?
1589 if test $curl_config_status -ne 0
1590 then
1591 with_libcurl="no ($with_curl_config failed)"
1592 else
1593 SAVE_CPPFLAGS="$CPPFLAGS"
1594 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1596 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1598 CPPFLAGS="$SAVE_CPPFLAGS"
1599 fi
1600 fi
1601 if test "x$with_libcurl" = "xyes"
1602 then
1603 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1604 curl_config_status=$?
1606 if test $curl_config_status -ne 0
1607 then
1608 with_libcurl="no ($with_curl_config failed)"
1609 else
1610 AC_CHECK_LIB(curl, curl_easy_init,
1611 [with_libcurl="yes"],
1612 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1613 [$with_curl_libs])
1614 fi
1615 fi
1616 if test "x$with_libcurl" = "xyes"
1617 then
1618 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1619 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1620 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1621 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1622 fi
1623 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1624 # }}}
1626 # --with-libdbi {{{
1627 with_libdbi_cppflags=""
1628 with_libdbi_ldflags=""
1629 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1630 [
1631 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1632 then
1633 with_libdbi_cppflags="-I$withval/include"
1634 with_libdbi_ldflags="-L$withval/lib"
1635 with_libdbi="yes"
1636 else
1637 with_libdbi="$withval"
1638 fi
1639 ],
1640 [
1641 with_libdbi="yes"
1642 ])
1643 if test "x$with_libdbi" = "xyes"
1644 then
1645 SAVE_CPPFLAGS="$CPPFLAGS"
1646 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1648 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1650 CPPFLAGS="$SAVE_CPPFLAGS"
1651 fi
1652 if test "x$with_libdbi" = "xyes"
1653 then
1654 SAVE_CPPFLAGS="$CPPFLAGS"
1655 SAVE_LDFLAGS="$LDFLAGS"
1656 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1657 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1659 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1661 CPPFLAGS="$SAVE_CPPFLAGS"
1662 LDFLAGS="$SAVE_LDFLAGS"
1663 fi
1664 if test "x$with_libdbi" = "xyes"
1665 then
1666 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1667 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1668 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1669 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1670 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1671 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1672 fi
1673 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1674 # }}}
1676 # --with-libesmtp {{{
1677 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1678 [
1679 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1680 then
1681 LDFLAGS="$LDFLAGS -L$withval/lib"
1682 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1683 with_libesmtp="yes"
1684 else
1685 with_libesmtp="$withval"
1686 fi
1687 ],
1688 [
1689 with_libesmtp="yes"
1690 ])
1691 if test "x$with_libesmtp" = "xyes"
1692 then
1693 AC_CHECK_LIB(esmtp, smtp_create_session,
1694 [
1695 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1696 ], [with_libesmtp="no (libesmtp not found)"])
1697 fi
1698 if test "x$with_libesmtp" = "xyes"
1699 then
1700 AC_CHECK_HEADERS(libesmtp.h,
1701 [
1702 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1703 ], [with_libesmtp="no (libesmtp.h not found)"])
1704 fi
1705 if test "x$with_libesmtp" = "xyes"
1706 then
1707 collect_libesmtp=1
1708 else
1709 collect_libesmtp=0
1710 fi
1711 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1712 [Wether or not to use the esmtp library])
1713 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1714 # }}}
1716 # --with-libganglia {{{
1717 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1718 [
1719 if test -f "$withval" && test -x "$withval"
1720 then
1721 with_libganglia_config="$withval"
1722 with_libganglia="yes"
1723 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1724 then
1725 with_libganglia_config="$withval/bin/ganglia-config"
1726 with_libganglia="yes"
1727 else if test -d "$withval"
1728 then
1729 GANGLIA_CPPFLAGS="-I$withval/include"
1730 GANGLIA_LDFLAGS="-L$withval/lib"
1731 with_libganglia="yes"
1732 else
1733 with_libganglia_config="ganglia-config"
1734 with_libganglia="$withval"
1735 fi; fi; fi
1736 ],
1737 [
1738 with_libganglia_config="ganglia-config"
1739 with_libganglia="yes"
1740 ])
1742 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1743 then
1744 if test "x$GANGLIA_CPPFLAGS" = "x"
1745 then
1746 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1747 fi
1749 if test "x$GANGLIA_LDFLAGS" = "x"
1750 then
1751 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1752 fi
1754 if test "x$GANGLIA_LIBS" = "x"
1755 then
1756 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1757 fi
1758 fi
1760 SAVE_CPPFLAGS="$CPPFLAGS"
1761 SAVE_LDFLAGS="$LDFLAGS"
1762 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1763 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1765 if test "x$with_libganglia" = "xyes"
1766 then
1767 AC_CHECK_HEADERS(gm_protocol.h,
1768 [
1769 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1770 [Define to 1 if you have the <gm_protocol.h> header file.])
1771 ], [with_libganglia="no (gm_protocol.h not found)"])
1772 fi
1774 if test "x$with_libganglia" = "xyes"
1775 then
1776 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1777 [
1778 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1779 [Define to 1 if you have the ganglia library (-lganglia).])
1780 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1781 fi
1783 CPPFLAGS="$SAVE_CPPFLAGS"
1784 LDFLAGS="$SAVE_LDFLAGS"
1786 AC_SUBST(GANGLIA_CPPFLAGS)
1787 AC_SUBST(GANGLIA_LDFLAGS)
1788 AC_SUBST(GANGLIA_LIBS)
1789 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1790 # }}}
1792 # --with-libgcrypt {{{
1793 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1794 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1795 GCRYPT_LIBS="$GCRYPT_LIBS"
1796 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1797 [
1798 if test -f "$withval" && test -x "$withval"
1799 then
1800 with_libgcrypt_config="$withval"
1801 with_libgcrypt="yes"
1802 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1803 then
1804 with_libgcrypt_config="$withval/bin/gcrypt-config"
1805 with_libgcrypt="yes"
1806 else if test -d "$withval"
1807 then
1808 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1809 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1810 with_libgcrypt="yes"
1811 else
1812 with_libgcrypt_config="gcrypt-config"
1813 with_libgcrypt="$withval"
1814 fi; fi; fi
1815 ],
1816 [
1817 with_libgcrypt_config="libgcrypt-config"
1818 with_libgcrypt="yes"
1819 ])
1821 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1822 then
1823 if test "x$GCRYPT_CPPFLAGS" = "x"
1824 then
1825 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1826 fi
1828 if test "x$GCRYPT_LDFLAGS" = "x"
1829 then
1830 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1831 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1832 fi
1834 if test "x$GCRYPT_LIBS" = "x"
1835 then
1836 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1837 fi
1838 fi
1840 SAVE_CPPFLAGS="$CPPFLAGS"
1841 SAVE_LDFLAGS="$LDFLAGS"
1842 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1843 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1845 if test "x$with_libgcrypt" = "xyes"
1846 then
1847 if test "x$GCRYPT_CPPFLAGS" != "x"
1848 then
1849 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1850 fi
1851 AC_CHECK_HEADERS(gcrypt.h,
1852 [with_libgcrypt="yes"],
1853 [with_libgcrypt="no (gcrypt.h not found)"])
1854 fi
1856 if test "x$with_libgcrypt" = "xyes"
1857 then
1858 if test "x$GCRYPT_LDFLAGS" != "x"
1859 then
1860 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1861 fi
1862 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1863 [with_libgcrypt="yes"],
1864 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1866 if test "$with_libgcrypt" != "no"; then
1867 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
1868 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1869 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1870 fi
1871 fi
1873 CPPFLAGS="$SAVE_CPPFLAGS"
1874 LDFLAGS="$SAVE_LDFLAGS"
1876 if test "x$with_libgcrypt" = "xyes"
1877 then
1878 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1879 fi
1881 AC_SUBST(GCRYPT_CPPFLAGS)
1882 AC_SUBST(GCRYPT_LDFLAGS)
1883 AC_SUBST(GCRYPT_LIBS)
1884 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1885 # }}}
1887 # --with-libiptc {{{
1888 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1889 [
1890 if test "x$withval" = "xshipped"
1891 then
1892 with_libiptc="own"
1893 else if test "x$withval" = "xyes"
1894 then
1895 with_libiptc="pkgconfig"
1896 else if test "x$withval" = "xno"
1897 then
1898 with_libiptc="no"
1899 else
1900 with_libiptc="yes"
1901 with_libiptc_cflags="-I$withval/include"
1902 with_libiptc_libs="-L$withval/lib"
1903 fi; fi; fi
1904 ],
1905 [
1906 if test "x$ac_system" = "xLinux"
1907 then
1908 with_libiptc="pkgconfig"
1909 else
1910 with_libiptc="no (Linux only)"
1911 fi
1912 ])
1914 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1915 then
1916 with_libiptc="no (Don't have pkg-config)"
1917 fi
1919 if test "x$with_libiptc" = "xpkgconfig"
1920 then
1921 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1922 if test $? -ne 0
1923 then
1924 with_libiptc="no (pkg-config doesn't know libiptc)"
1925 fi
1926 fi
1927 if test "x$with_libiptc" = "xpkgconfig"
1928 then
1929 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1930 if test $? -ne 0
1931 then
1932 with_libiptc="no ($PKG_CONFIG failed)"
1933 fi
1934 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1935 if test $? -ne 0
1936 then
1937 with_libiptc="no ($PKG_CONFIG failed)"
1938 fi
1939 fi
1941 SAVE_CPPFLAGS="$CPPFLAGS"
1942 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1944 # check whether the header file for libiptc is available.
1945 if test "x$with_libiptc" = "xpkgconfig"
1946 then
1947 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1948 [with_libiptc="no (header file missing)"])
1949 fi
1950 # If the header file is available, check for the required type declaractions.
1951 # They may be missing in old versions of libiptc. In that case, they will be
1952 # declared in the iptables plugin.
1953 if test "x$with_libiptc" = "xpkgconfig"
1954 then
1955 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1956 fi
1957 # Check for the iptc_init symbol in the library.
1958 # This could be in iptc or ip4tc
1959 if test "x$with_libiptc" = "xpkgconfig"
1960 then
1961 SAVE_LIBS="$LIBS"
1962 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1963 [with_libiptc="pkgconfig"],
1964 [with_libiptc="no"],
1965 [$with_libiptc_libs])
1966 LIBS="$SAVE_LIBS"
1967 fi
1968 if test "x$with_libiptc" = "xpkgconfig"
1969 then
1970 with_libiptc="yes"
1971 fi
1973 CPPFLAGS="$SAVE_CPPFLAGS"
1975 if test "x$with_libiptc" = "xown"
1976 then
1977 with_libiptc_cflags=""
1978 with_libiptc_libs=""
1979 fi
1980 if test "x$with_libiptc" = "xown"
1981 then
1982 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1983 [
1984 with_libiptc="no (Linux iptables headers not found)"
1985 ],
1986 [
1987 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1988 ])
1989 fi
1990 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1991 if test "x$with_libiptc" = "xown"
1992 then
1993 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1994 with_libiptc="yes"
1995 fi
1997 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1998 if test "x$with_libiptc" = "xyes"
1999 then
2000 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
2001 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2002 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2003 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2004 fi
2005 # }}}
2007 # --with-java {{{
2008 with_java_home="$JAVA_HOME"
2009 if test "x$with_java_home" = "x"
2010 then
2011 with_java_home="/usr/lib/jvm"
2012 fi
2013 with_java_vmtype="client"
2014 with_java_cflags=""
2015 with_java_libs=""
2016 JAVAC="$JAVAC"
2017 JAR="$JAR"
2018 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2019 [
2020 if test "x$withval" = "xno"
2021 then
2022 with_java="no"
2023 else if test "x$withval" = "xyes"
2024 then
2025 with_java="yes"
2026 else
2027 with_java_home="$withval"
2028 with_java="yes"
2029 fi; fi
2030 ],
2031 [with_java="yes"])
2032 if test "x$with_java" = "xyes"
2033 then
2034 if test -d "$with_java_home"
2035 then
2036 AC_MSG_CHECKING([for jni.h])
2037 TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2038 if test "x$TMPVAR" != "x"
2039 then
2040 AC_MSG_RESULT([found in $TMPVAR])
2041 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2042 else
2043 AC_MSG_RESULT([not found])
2044 fi
2046 AC_MSG_CHECKING([for jni_md.h])
2047 TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2048 if test "x$TMPVAR" != "x"
2049 then
2050 AC_MSG_RESULT([found in $TMPVAR])
2051 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2052 else
2053 AC_MSG_RESULT([not found])
2054 fi
2056 AC_MSG_CHECKING([for libjvm.so])
2057 TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2058 if test "x$TMPVAR" != "x"
2059 then
2060 AC_MSG_RESULT([found in $TMPVAR])
2061 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2062 else
2063 AC_MSG_RESULT([not found])
2064 fi
2066 if test "x$JAVAC" = "x"
2067 then
2068 AC_MSG_CHECKING([for javac])
2069 TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2070 if test "x$TMPVAR" != "x"
2071 then
2072 JAVAC="$TMPVAR"
2073 AC_MSG_RESULT([$JAVAC])
2074 else
2075 AC_MSG_RESULT([not found])
2076 fi
2077 fi
2078 if test "x$JAR" = "x"
2079 then
2080 AC_MSG_CHECKING([for jar])
2081 TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2082 if test "x$TMPVAR" != "x"
2083 then
2084 JAR="$TMPVAR"
2085 AC_MSG_RESULT([$JAR])
2086 else
2087 AC_MSG_RESULT([not found])
2088 fi
2089 fi
2090 else if test "x$with_java_home" != "x"
2091 then
2092 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2093 fi; fi
2094 fi
2096 if test "x$JAVA_CPPFLAGS" != "x"
2097 then
2098 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2099 fi
2100 if test "x$JAVA_CFLAGS" != "x"
2101 then
2102 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2103 fi
2104 if test "x$JAVA_LDFLAGS" != "x"
2105 then
2106 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2107 fi
2108 if test "x$JAVAC" = "x"
2109 then
2110 with_javac_path="$PATH"
2111 if test "x$with_java_home" != "x"
2112 then
2113 with_javac_path="$with_java_home:with_javac_path"
2114 if test -d "$with_java_home/bin"
2115 then
2116 with_javac_path="$with_java_home/bin:with_javac_path"
2117 fi
2118 fi
2120 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2121 fi
2122 if test "x$JAVAC" = "x"
2123 then
2124 with_java="no (javac not found)"
2125 fi
2126 if test "x$JAR" = "x"
2127 then
2128 with_jar_path="$PATH"
2129 if test "x$with_java_home" != "x"
2130 then
2131 with_jar_path="$with_java_home:$with_jar_path"
2132 if test -d "$with_java_home/bin"
2133 then
2134 with_jar_path="$with_java_home/bin:$with_jar_path"
2135 fi
2136 fi
2138 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2139 fi
2140 if test "x$JAR" = "x"
2141 then
2142 with_java="no (jar not found)"
2143 fi
2145 SAVE_CPPFLAGS="$CPPFLAGS"
2146 SAVE_CFLAGS="$CFLAGS"
2147 SAVE_LDFLAGS="$LDFLAGS"
2148 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2149 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2150 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2152 if test "x$with_java" = "xyes"
2153 then
2154 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2155 fi
2156 if test "x$with_java" = "xyes"
2157 then
2158 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2159 [with_java="yes"],
2160 [with_java="no (libjvm not found)"],
2161 [$JAVA_LIBS])
2162 fi
2163 if test "x$with_java" = "xyes"
2164 then
2165 JAVA_LIBS="$JAVA_LIBS -ljvm"
2166 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2167 fi
2169 CPPFLAGS="$SAVE_CPPFLAGS"
2170 CFLAGS="$SAVE_CFLAGS"
2171 LDFLAGS="$SAVE_LDFLAGS"
2173 AC_SUBST(JAVA_CPPFLAGS)
2174 AC_SUBST(JAVA_CFLAGS)
2175 AC_SUBST(JAVA_LDFLAGS)
2176 AC_SUBST(JAVA_LIBS)
2177 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2178 # }}}
2180 # --with-libmemcached {{{
2181 with_libmemcached_cppflags=""
2182 with_libmemcached_ldflags=""
2183 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2184 [
2185 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2186 then
2187 with_libmemcached_cppflags="-I$withval/include"
2188 with_libmemcached_ldflags="-L$withval/lib"
2189 with_libmemcached="yes"
2190 else
2191 with_libmemcached="$withval"
2192 fi
2193 ],
2194 [
2195 with_libmemcached="yes"
2196 ])
2197 if test "x$with_libmemcached" = "xyes"
2198 then
2199 SAVE_CPPFLAGS="$CPPFLAGS"
2200 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2202 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2204 CPPFLAGS="$SAVE_CPPFLAGS"
2205 fi
2206 if test "x$with_libmemcached" = "xyes"
2207 then
2208 SAVE_CPPFLAGS="$CPPFLAGS"
2209 SAVE_LDFLAGS="$LDFLAGS"
2210 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2211 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2213 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2215 CPPFLAGS="$SAVE_CPPFLAGS"
2216 LDFLAGS="$SAVE_LDFLAGS"
2217 fi
2218 if test "x$with_libmemcached" = "xyes"
2219 then
2220 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2221 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2222 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2223 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2224 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2225 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2226 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2227 fi
2228 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2229 # }}}
2231 # --with-libmodbus {{{
2232 with_libmodbus_config=""
2233 with_libmodbus_cflags=""
2234 with_libmodbus_libs=""
2235 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2236 [
2237 if test "x$withval" = "xno"
2238 then
2239 with_libmodbus="no"
2240 else if test "x$withval" = "xyes"
2241 then
2242 with_libmodbus="use_pkgconfig"
2243 else if test -d "$with_libmodbus/lib"
2244 then
2245 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2246 with_libmodbus_cflags="-I$withval/include"
2247 with_libmodbus_libs="-L$withval/lib -lmodbus"
2248 with_libmodbus="yes"
2249 fi; fi; fi
2250 ],
2251 [with_libmodbus="use_pkgconfig"])
2253 # configure using pkg-config
2254 if test "x$with_libmodbus" = "xuse_pkgconfig"
2255 then
2256 if test "x$PKG_CONFIG" = "x"
2257 then
2258 with_libmodbus="no (Don't have pkg-config)"
2259 fi
2260 fi
2261 if test "x$with_libmodbus" = "xuse_pkgconfig"
2262 then
2263 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2264 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2265 if test $? -ne 0
2266 then
2267 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2268 fi
2269 fi
2270 if test "x$with_libmodbus" = "xuse_pkgconfig"
2271 then
2272 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2273 if test $? -ne 0
2274 then
2275 with_libmodbus="no ($PKG_CONFIG failed)"
2276 fi
2277 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2278 if test $? -ne 0
2279 then
2280 with_libmodbus="no ($PKG_CONFIG failed)"
2281 fi
2282 fi
2283 if test "x$with_libmodbus" = "xuse_pkgconfig"
2284 then
2285 with_libmodbus="yes"
2286 fi
2288 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2289 # the actual checks.
2290 if test "x$with_libmodbus" = "xyes"
2291 then
2292 SAVE_CPPFLAGS="$CPPFLAGS"
2293 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2295 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2297 CPPFLAGS="$SAVE_CPPFLAGS"
2298 fi
2299 if test "x$with_libmodbus" = "xyes"
2300 then
2301 SAVE_CPPFLAGS="$CPPFLAGS"
2302 SAVE_LDFLAGS="$LDFLAGS"
2304 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2305 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2307 AC_CHECK_LIB(modbus, modbus_connect,
2308 [with_libmodbus="yes"],
2309 [with_libmodbus="no (symbol modbus_connect not found)"])
2311 CPPFLAGS="$SAVE_CPPFLAGS"
2312 LDFLAGS="$SAVE_LDFLAGS"
2313 fi
2314 if test "x$with_libmodbus" = "xyes"
2315 then
2316 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2317 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2318 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2319 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2320 fi
2321 # }}}
2323 # --with-libmongoc {{{
2324 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2325 [
2326 if test "x$withval" = "xyes"
2327 then
2328 with_libmongoc="yes"
2329 else if test "x$withval" = "xno"
2330 then
2331 with_libmongoc="no"
2332 else
2333 with_libmongoc="yes"
2334 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2335 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2336 fi; fi
2337 ],
2338 [with_libmongoc="yes"])
2340 SAVE_CPPFLAGS="$CPPFLAGS"
2341 SAVE_LDFLAGS="$LDFLAGS"
2343 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2344 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2346 if test "x$with_libmongoc" = "xyes"
2347 then
2348 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2349 then
2350 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2351 fi
2352 AC_CHECK_HEADERS(mongo.h,
2353 [with_libmongoc="yes"],
2354 [with_libmongoc="no ('mongo.h' not found)"],
2355 [#if HAVE_STDINT_H
2356 # define MONGO_HAVE_STDINT 1
2357 #else
2358 # define MONGO_USE_LONG_LONG_INT 1
2359 #endif
2360 ])
2361 fi
2362 if test "x$with_libmongoc" = "xyes"
2363 then
2364 if test "x$LIBMONGOC_LDFLAGS" != "x"
2365 then
2366 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2367 fi
2368 AC_CHECK_LIB(mongoc, mongo_run_command,
2369 [with_libmongoc="yes"],
2370 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2371 fi
2373 CPPFLAGS="$SAVE_CPPFLAGS"
2374 LDFLAGS="$SAVE_LDFLAGS"
2376 if test "x$with_libmongoc" = "xyes"
2377 then
2378 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2379 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2380 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2381 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2382 fi
2383 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2384 # }}}
2386 # --with-libmysql {{{
2387 with_mysql_config="mysql_config"
2388 with_mysql_cflags=""
2389 with_mysql_libs=""
2390 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2391 [
2392 if test "x$withval" = "xno"
2393 then
2394 with_libmysql="no"
2395 else if test "x$withval" = "xyes"
2396 then
2397 with_libmysql="yes"
2398 else
2399 if test -f "$withval" && test -x "$withval";
2400 then
2401 with_mysql_config="$withval"
2402 else if test -x "$withval/bin/mysql_config"
2403 then
2404 with_mysql_config="$withval/bin/mysql_config"
2405 fi; fi
2406 with_libmysql="yes"
2407 fi; fi
2408 ],
2409 [
2410 with_libmysql="yes"
2411 ])
2412 if test "x$with_libmysql" = "xyes"
2413 then
2414 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2415 mysql_config_status=$?
2417 if test $mysql_config_status -ne 0
2418 then
2419 with_libmysql="no ($with_mysql_config failed)"
2420 else
2421 SAVE_CPPFLAGS="$CPPFLAGS"
2422 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2424 have_mysql_h="no"
2425 have_mysql_mysql_h="no"
2426 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2428 if test "x$have_mysql_h" = "xno"
2429 then
2430 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2431 fi
2433 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2434 then
2435 with_libmysql="no (mysql.h not found)"
2436 fi
2438 CPPFLAGS="$SAVE_CPPFLAGS"
2439 fi
2440 fi
2441 if test "x$with_libmysql" = "xyes"
2442 then
2443 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2444 mysql_config_status=$?
2446 if test $mysql_config_status -ne 0
2447 then
2448 with_libmysql="no ($with_mysql_config failed)"
2449 else
2450 AC_CHECK_LIB(mysqlclient, mysql_init,
2451 [with_libmysql="yes"],
2452 [with_libmysql="no (symbol 'mysql_init' not found)"],
2453 [$with_mysql_libs])
2455 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2456 [with_libmysql="yes"],
2457 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2458 [$with_mysql_libs])
2459 fi
2460 fi
2461 if test "x$with_libmysql" = "xyes"
2462 then
2463 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2464 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2465 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2466 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2467 fi
2468 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2469 # }}}
2471 # --with-libnetlink {{{
2472 with_libnetlink_cflags=""
2473 with_libnetlink_libs="-lnetlink"
2474 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2475 [
2476 echo "libnetlink: withval = $withval"
2477 if test "x$withval" = "xyes"
2478 then
2479 with_libnetlink="yes"
2480 else if test "x$withval" = "xno"
2481 then
2482 with_libnetlink="no"
2483 else
2484 if test -d "$withval/include"
2485 then
2486 with_libnetlink_cflags="-I$withval/include"
2487 with_libnetlink_libs="-L$withval/lib -lnetlink"
2488 with_libnetlink="yes"
2489 else
2490 AC_MSG_ERROR("no such directory: $withval/include")
2491 fi
2492 fi; fi
2493 ],
2494 [
2495 if test "x$ac_system" = "xLinux"
2496 then
2497 with_libnetlink="yes"
2498 else
2499 with_libnetlink="no (Linux only library)"
2500 fi
2501 ])
2502 if test "x$with_libnetlink" = "xyes"
2503 then
2504 SAVE_CFLAGS="$CFLAGS"
2505 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2507 with_libnetlink="no (libnetlink.h not found)"
2509 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2510 [
2511 with_libnetlink="yes"
2512 break
2513 ], [],
2514 [#include <stdio.h>
2515 #include <sys/types.h>
2516 #include <asm/types.h>
2517 #include <sys/socket.h>
2518 #include <linux/netlink.h>
2519 #include <linux/rtnetlink.h>])
2520 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2521 [#include <stdio.h>
2522 #include <sys/types.h>
2523 #include <asm/types.h>
2524 #include <sys/socket.h>])
2526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2527 [[[
2528 #include <stdio.h>
2529 #include <sys/types.h>
2530 #include <asm/types.h>
2531 #include <sys/socket.h>
2532 #include <linux/netlink.h>
2533 #include <linux/rtnetlink.h>
2534 ]]],
2535 [[[
2536 int retval = TCA_STATS2;
2537 return (retval);
2538 ]]]
2539 )],
2540 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2543 [[[
2544 #include <stdio.h>
2545 #include <sys/types.h>
2546 #include <asm/types.h>
2547 #include <sys/socket.h>
2548 #include <linux/netlink.h>
2549 #include <linux/rtnetlink.h>
2550 ]]],
2551 [[[
2552 int retval = TCA_STATS;
2553 return (retval);
2554 ]]]
2555 )],
2556 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2558 CFLAGS="$SAVE_CFLAGS"
2559 fi
2560 if test "x$with_libnetlink" = "xyes"
2561 then
2562 AC_CHECK_LIB(netlink, rtnl_open,
2563 [with_libnetlink="yes"],
2564 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2565 [$with_libnetlink_libs])
2566 fi
2567 if test "x$with_libnetlink" = "xyes"
2568 then
2569 SAVE_CFLAGS="$CFLAGS"
2570 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2572 AC_CACHE_CHECK(
2573 [if function 'rtnl_dump_filter' expects five arguments],
2574 [c_cv_rtnl_dump_filter_five_args],
2575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2576 [[[
2577 #include <stdio.h>
2578 #include <sys/types.h>
2579 #include <asm/types.h>
2580 #include <sys/socket.h>
2581 #if HAVE_LIBNETLINK_H
2582 # include <libnetlink.h>
2583 #elif HAVE_IPROUTE_LIBNETLINK_H
2584 # include <iproute/libnetlink.h>
2585 #elif HAVE_LINUX_LIBNETLINK_H
2586 # include <linux/libnetlink.h>
2587 #endif
2588 ]]],
2589 [[[
2590 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2591 return 1;
2592 return 0;
2593 ]]]
2594 )],
2595 [c_cv_rtnl_dump_filter_five_args="yes"],
2596 [c_cv_rtnl_dump_filter_five_args="no"]
2597 )
2598 )
2600 AC_CACHE_CHECK(
2601 [if function 'rtnl_dump_filter' expects three arguments],
2602 [c_cv_rtnl_dump_filter_three_args],
2603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2604 [[[
2605 #include <stdio.h>
2606 #include <sys/types.h>
2607 #include <asm/types.h>
2608 #include <sys/socket.h>
2609 #if HAVE_LIBNETLINK_H
2610 # include <libnetlink.h>
2611 #elif HAVE_IPROUTE_LIBNETLINK_H
2612 # include <iproute/libnetlink.h>
2613 #elif HAVE_LINUX_LIBNETLINK_H
2614 # include <linux/libnetlink.h>
2615 #endif
2616 ]]],
2617 [[[
2618 if (rtnl_dump_filter(NULL, NULL, NULL))
2619 return 1;
2620 return 0;
2621 ]]]
2622 )],
2623 [c_cv_rtnl_dump_filter_three_args="yes"],
2624 [c_cv_rtnl_dump_filter_three_args="no"]
2625 )
2626 )
2628 CFLAGS="$SAVE_CFLAGS"
2630 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2631 then
2632 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2633 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2634 fi
2635 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2636 then
2637 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2638 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2639 fi
2641 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2642 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2643 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2644 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2645 fi
2646 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2647 # }}}
2649 # --with-libnetapp {{{
2650 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2651 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2652 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2653 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2654 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2655 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2656 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2657 [
2658 if test -d "$withval"
2659 then
2660 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2661 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2662 with_libnetapp="yes"
2663 else
2664 with_libnetapp="$withval"
2665 fi
2666 ],
2667 [
2668 with_libnetapp="yes"
2669 ])
2671 SAVE_CPPFLAGS="$CPPFLAGS"
2672 SAVE_LDFLAGS="$LDFLAGS"
2673 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2674 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2676 if test "x$with_libnetapp" = "xyes"
2677 then
2678 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2679 then
2680 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2681 fi
2682 AC_CHECK_HEADERS(netapp_api.h,
2683 [with_libnetapp="yes"],
2684 [with_libnetapp="no (netapp_api.h not found)"])
2685 fi
2687 if test "x$with_libnetapp" = "xyes"
2688 then
2689 if test "x$LIBNETAPP_LDFLAGS" != "x"
2690 then
2691 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2692 fi
2694 if test "x$LIBNETAPP_LIBS" = "x"
2695 then
2696 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2697 fi
2698 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2700 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2701 [with_libnetapp="yes"],
2702 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2703 [$LIBNETAPP_LIBS])
2704 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2705 fi
2707 CPPFLAGS="$SAVE_CPPFLAGS"
2708 LDFLAGS="$SAVE_LDFLAGS"
2710 if test "x$with_libnetapp" = "xyes"
2711 then
2712 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2713 fi
2715 AC_SUBST(LIBNETAPP_CPPFLAGS)
2716 AC_SUBST(LIBNETAPP_LDFLAGS)
2717 AC_SUBST(LIBNETAPP_LIBS)
2718 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2719 # }}}
2721 # --with-libnetsnmp {{{
2722 with_snmp_config="net-snmp-config"
2723 with_snmp_cflags=""
2724 with_snmp_libs=""
2725 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2726 [
2727 if test "x$withval" = "xno"
2728 then
2729 with_libnetsnmp="no"
2730 else if test "x$withval" = "xyes"
2731 then
2732 with_libnetsnmp="yes"
2733 else
2734 if test -x "$withval"
2735 then
2736 with_snmp_config="$withval"
2737 with_libnetsnmp="yes"
2738 else
2739 with_snmp_config="$withval/bin/net-snmp-config"
2740 with_libnetsnmp="yes"
2741 fi
2742 fi; fi
2743 ],
2744 [with_libnetsnmp="yes"])
2745 if test "x$with_libnetsnmp" = "xyes"
2746 then
2747 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2748 snmp_config_status=$?
2750 if test $snmp_config_status -ne 0
2751 then
2752 with_libnetsnmp="no ($with_snmp_config failed)"
2753 else
2754 SAVE_CPPFLAGS="$CPPFLAGS"
2755 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2757 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2759 CPPFLAGS="$SAVE_CPPFLAGS"
2760 fi
2761 fi
2762 if test "x$with_libnetsnmp" = "xyes"
2763 then
2764 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2765 snmp_config_status=$?
2767 if test $snmp_config_status -ne 0
2768 then
2769 with_libnetsnmp="no ($with_snmp_config failed)"
2770 else
2771 AC_CHECK_LIB(netsnmp, init_snmp,
2772 [with_libnetsnmp="yes"],
2773 [with_libnetsnmp="no (libnetsnmp not found)"],
2774 [$with_snmp_libs])
2775 fi
2776 fi
2777 if test "x$with_libnetsnmp" = "xyes"
2778 then
2779 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2780 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2781 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2782 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2783 fi
2784 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2785 # }}}
2787 # --with-liboconfig {{{
2788 with_own_liboconfig="no"
2789 liboconfig_LDFLAGS="$LDFLAGS"
2790 liboconfig_CPPFLAGS="$CPPFLAGS"
2791 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2792 [
2793 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2794 then
2795 if test -d "$withval/lib"
2796 then
2797 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2798 fi
2799 if test -d "$withval/include"
2800 then
2801 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2802 fi
2803 fi
2804 if test "x$withval" = "xno"
2805 then
2806 AC_MSG_ERROR("liboconfig is required")
2807 fi
2808 ],
2809 [
2810 with_liboconfig="yes"
2811 ])
2813 save_LDFLAGS="$LDFLAGS"
2814 save_CPPFLAGS="$CPPFLAGS"
2815 LDFLAGS="$liboconfig_LDFLAGS"
2816 CPPFLAGS="$liboconfig_CPPFLAGS"
2817 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2818 [
2819 with_liboconfig="yes"
2820 with_own_liboconfig="no"
2821 ],
2822 [
2823 with_liboconfig="yes"
2824 with_own_liboconfig="yes"
2825 LDFLAGS="$save_LDFLAGS"
2826 CPPFLAGS="$save_CPPFLAGS"
2827 ])
2829 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2830 if test "x$with_own_liboconfig" = "xyes"
2831 then
2832 with_liboconfig="yes (shipped version)"
2833 fi
2834 # }}}
2836 # --with-liboping {{{
2837 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2838 [
2839 if test "x$withval" = "xyes"
2840 then
2841 with_liboping="yes"
2842 else if test "x$withval" = "xno"
2843 then
2844 with_liboping="no"
2845 else
2846 with_liboping="yes"
2847 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2848 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2849 fi; fi
2850 ],
2851 [with_liboping="yes"])
2853 SAVE_CPPFLAGS="$CPPFLAGS"
2854 SAVE_LDFLAGS="$LDFLAGS"
2856 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2857 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2859 if test "x$with_liboping" = "xyes"
2860 then
2861 if test "x$LIBOPING_CPPFLAGS" != "x"
2862 then
2863 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2864 fi
2865 AC_CHECK_HEADERS(oping.h,
2866 [with_liboping="yes"],
2867 [with_liboping="no (oping.h not found)"])
2868 fi
2869 if test "x$with_liboping" = "xyes"
2870 then
2871 if test "x$LIBOPING_LDFLAGS" != "x"
2872 then
2873 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2874 fi
2875 AC_CHECK_LIB(oping, ping_construct,
2876 [with_liboping="yes"],
2877 [with_liboping="no (symbol 'ping_construct' not found)"])
2878 fi
2880 CPPFLAGS="$SAVE_CPPFLAGS"
2881 LDFLAGS="$SAVE_LDFLAGS"
2883 if test "x$with_liboping" = "xyes"
2884 then
2885 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2886 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2887 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2888 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2889 fi
2890 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2891 # }}}
2893 # --with-oracle {{{
2894 with_oracle_cppflags=""
2895 with_oracle_libs=""
2896 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2897 [
2898 if test "x$withval" = "xyes"
2899 then
2900 if test "x$ORACLE_HOME" = "x"
2901 then
2902 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2903 fi
2904 with_oracle="yes"
2905 else if test "x$withval" = "xno"
2906 then
2907 with_oracle="no"
2908 else
2909 with_oracle="yes"
2910 ORACLE_HOME="$withval"
2911 fi; fi
2912 ],
2913 [
2914 if test "x$ORACLE_HOME" = "x"
2915 then
2916 with_oracle="no (ORACLE_HOME is not set)"
2917 else
2918 with_oracle="yes"
2919 fi
2920 ])
2921 if test "x$ORACLE_HOME" != "x"
2922 then
2923 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2925 if test -e "$ORACLE_HOME/lib/ldflags"
2926 then
2927 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2928 fi
2929 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2930 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2931 fi
2932 if test "x$with_oracle" = "xyes"
2933 then
2934 SAVE_CPPFLAGS="$CPPFLAGS"
2935 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2937 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2939 CPPFLAGS="$SAVE_CPPFLAGS"
2940 fi
2941 if test "x$with_oracle" = "xyes"
2942 then
2943 SAVE_CPPFLAGS="$CPPFLAGS"
2944 SAVE_LIBS="$LIBS"
2945 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2946 LIBS="$LIBS $with_oracle_libs"
2948 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2950 CPPFLAGS="$SAVE_CPPFLAGS"
2951 LIBS="$SAVE_LIBS"
2952 fi
2953 if test "x$with_oracle" = "xyes"
2954 then
2955 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2956 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2957 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2958 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2959 fi
2960 # }}}
2962 # --with-libowcapi {{{
2963 with_libowcapi_cppflags=""
2964 with_libowcapi_libs="-lowcapi"
2965 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2966 [
2967 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2968 then
2969 with_libowcapi_cppflags="-I$withval/include"
2970 with_libowcapi_libs="-L$withval/lib -lowcapi"
2971 with_libowcapi="yes"
2972 else
2973 with_libowcapi="$withval"
2974 fi
2975 ],
2976 [
2977 with_libowcapi="yes"
2978 ])
2979 if test "x$with_libowcapi" = "xyes"
2980 then
2981 SAVE_CPPFLAGS="$CPPFLAGS"
2982 CPPFLAGS="$with_libowcapi_cppflags"
2984 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2986 CPPFLAGS="$SAVE_CPPFLAGS"
2987 fi
2988 if test "x$with_libowcapi" = "xyes"
2989 then
2990 SAVE_LDFLAGS="$LDFLAGS"
2991 SAVE_CPPFLAGS="$CPPFLAGS"
2992 LDFLAGS="$with_libowcapi_libs"
2993 CPPFLAGS="$with_libowcapi_cppflags"
2995 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2997 LDFLAGS="$SAVE_LDFLAGS"
2998 CPPFLAGS="$SAVE_CPPFLAGS"
2999 fi
3000 if test "x$with_libowcapi" = "xyes"
3001 then
3002 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3003 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3004 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3005 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3006 fi
3007 # }}}
3009 # --with-libpcap {{{
3010 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3011 [
3012 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3013 then
3014 LDFLAGS="$LDFLAGS -L$withval/lib"
3015 CPPFLAGS="$CPPFLAGS -I$withval/include"
3016 with_libpcap="yes"
3017 else
3018 with_libpcap="$withval"
3019 fi
3020 ],
3021 [
3022 with_libpcap="yes"
3023 ])
3024 if test "x$with_libpcap" = "xyes"
3025 then
3026 AC_CHECK_LIB(pcap, pcap_open_live,
3027 [
3028 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3029 ], [with_libpcap="no (libpcap not found)"])
3030 fi
3031 if test "x$with_libpcap" = "xyes"
3032 then
3033 AC_CHECK_HEADERS(pcap.h,,
3034 [with_libpcap="no (pcap.h not found)"])
3035 fi
3036 if test "x$with_libpcap" = "xyes"
3037 then
3038 AC_CHECK_HEADERS(pcap-bpf.h,,
3039 [with_libpcap="no (pcap-bpf.h not found)"])
3040 fi
3041 if test "x$with_libpcap" = "xyes"
3042 then
3043 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3044 [c_cv_libpcap_have_pcap_error_iface_not_up],
3045 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3046 [[[
3047 #include <pcap.h>
3048 ]]],
3049 [[[
3050 int val = PCAP_ERROR_IFACE_NOT_UP;
3051 return(val);
3052 ]]]
3053 )],
3054 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3055 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3056 fi
3057 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3058 then
3059 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3060 fi
3061 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3062 # }}}
3064 # --with-libperl {{{
3065 perl_interpreter="perl"
3066 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3067 [
3068 if test -f "$withval" && test -x "$withval"
3069 then
3070 perl_interpreter="$withval"
3071 with_libperl="yes"
3072 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3073 then
3074 LDFLAGS="$LDFLAGS -L$withval/lib"
3075 CPPFLAGS="$CPPFLAGS -I$withval/include"
3076 perl_interpreter="$withval/bin/perl"
3077 with_libperl="yes"
3078 else
3079 with_libperl="$withval"
3080 fi; fi
3081 ],
3082 [
3083 with_libperl="yes"
3084 ])
3086 AC_MSG_CHECKING([for perl])
3087 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3088 if test -x "$perl_interpreter"
3089 then
3090 AC_MSG_RESULT([yes ($perl_interpreter)])
3091 else
3092 perl_interpreter=""
3093 AC_MSG_RESULT([no])
3094 fi
3096 AC_SUBST(PERL, "$perl_interpreter")
3098 if test "x$with_libperl" = "xyes" \
3099 && test -n "$perl_interpreter"
3100 then
3101 SAVE_CFLAGS="$CFLAGS"
3102 SAVE_LIBS="$LIBS"
3103 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3104 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3105 PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3106 CFLAGS="$CFLAGS $PERL_CFLAGS"
3107 LIBS="$LIBS $PERL_LIBS"
3109 AC_CACHE_CHECK([for libperl],
3110 [c_cv_have_libperl],
3111 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3112 [[[
3113 #define PERL_NO_GET_CONTEXT
3114 #include <EXTERN.h>
3115 #include <perl.h>
3116 #include <XSUB.h>
3117 ]]],
3118 [[[
3119 dTHX;
3120 load_module (PERL_LOADMOD_NOIMPORT,
3121 newSVpv ("Collectd::Plugin::FooBar", 24),
3122 Nullsv);
3123 ]]]
3124 )],
3125 [c_cv_have_libperl="yes"],
3126 [c_cv_have_libperl="no"]
3127 )
3128 )
3130 if test "x$c_cv_have_libperl" = "xyes"
3131 then
3132 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3133 AC_SUBST(PERL_CFLAGS)
3134 AC_SUBST(PERL_LIBS)
3135 else
3136 with_libperl="no"
3137 fi
3139 CFLAGS="$SAVE_CFLAGS"
3140 LIBS="$SAVE_LIBS"
3141 else if test -z "$perl_interpreter"; then
3142 with_libperl="no (no perl interpreter found)"
3143 c_cv_have_libperl="no"
3144 fi; fi
3145 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3147 if test "x$with_libperl" = "xyes"
3148 then
3149 SAVE_CFLAGS="$CFLAGS"
3150 SAVE_LIBS="$LIBS"
3151 CFLAGS="$CFLAGS $PERL_CFLAGS"
3152 LIBS="$LIBS $PERL_LIBS"
3154 AC_CACHE_CHECK([if perl supports ithreads],
3155 [c_cv_have_perl_ithreads],
3156 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3157 [[[
3158 #include <EXTERN.h>
3159 #include <perl.h>
3160 #include <XSUB.h>
3162 #if !defined(USE_ITHREADS)
3163 # error "Perl does not support ithreads!"
3164 #endif /* !defined(USE_ITHREADS) */
3165 ]]],
3166 [[[ ]]]
3167 )],
3168 [c_cv_have_perl_ithreads="yes"],
3169 [c_cv_have_perl_ithreads="no"]
3170 )
3171 )
3173 if test "x$c_cv_have_perl_ithreads" = "xyes"
3174 then
3175 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3176 fi
3178 CFLAGS="$SAVE_CFLAGS"
3179 LIBS="$SAVE_LIBS"
3180 fi
3182 if test "x$with_libperl" = "xyes"
3183 then
3184 SAVE_CFLAGS="$CFLAGS"
3185 SAVE_LIBS="$LIBS"
3186 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3187 # (see issues #41 and #42)
3188 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3189 LIBS="$LIBS $PERL_LIBS"
3191 AC_CACHE_CHECK([for broken Perl_load_module()],
3192 [c_cv_have_broken_perl_load_module],
3193 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3194 [[[
3195 #define PERL_NO_GET_CONTEXT
3196 #include <EXTERN.h>
3197 #include <perl.h>
3198 #include <XSUB.h>
3199 ]]],
3200 [[[
3201 dTHX;
3202 load_module (PERL_LOADMOD_NOIMPORT,
3203 newSVpv ("Collectd::Plugin::FooBar", 24),
3204 Nullsv);
3205 ]]]
3206 )],
3207 [c_cv_have_broken_perl_load_module="no"],
3208 [c_cv_have_broken_perl_load_module="yes"]
3209 )
3210 )
3212 CFLAGS="$SAVE_CFLAGS"
3213 LIBS="$SAVE_LIBS"
3214 fi
3215 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3216 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3218 if test "x$with_libperl" = "xyes"
3219 then
3220 SAVE_CFLAGS="$CFLAGS"
3221 SAVE_LIBS="$LIBS"
3222 CFLAGS="$CFLAGS $PERL_CFLAGS"
3223 LIBS="$LIBS $PERL_LIBS"
3225 AC_CHECK_MEMBER(
3226 [struct mgvtbl.svt_local],
3227 [have_struct_mgvtbl_svt_local="yes"],
3228 [have_struct_mgvtbl_svt_local="no"],
3229 [
3230 #include <EXTERN.h>
3231 #include <perl.h>
3232 #include <XSUB.h>
3233 ])
3235 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3236 then
3237 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3238 [Define if Perl's struct mgvtbl has member svt_local.])
3239 fi
3241 CFLAGS="$SAVE_CFLAGS"
3242 LIBS="$SAVE_LIBS"
3243 fi
3244 # }}}
3246 # --with-libpq {{{
3247 with_pg_config="pg_config"
3248 with_libpq_includedir=""
3249 with_libpq_libdir=""
3250 with_libpq_cppflags=""
3251 with_libpq_ldflags=""
3252 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3253 [Path to libpq.])],
3254 [
3255 if test "x$withval" = "xno"
3256 then
3257 with_libpq="no"
3258 else if test "x$withval" = "xyes"
3259 then
3260 with_libpq="yes"
3261 else
3262 if test -f "$withval" && test -x "$withval";
3263 then
3264 with_pg_config="$withval"
3265 else if test -x "$withval/bin/pg_config"
3266 then
3267 with_pg_config="$withval/bin/pg_config"
3268 fi; fi
3269 with_libpq="yes"
3270 fi; fi
3271 ],
3272 [
3273 with_libpq="yes"
3274 ])
3275 if test "x$with_libpq" = "xyes"
3276 then
3277 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3278 pg_config_status=$?
3280 if test $pg_config_status -eq 0
3281 then
3282 if test -n "$with_libpq_includedir"; then
3283 for dir in $with_libpq_includedir; do
3284 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3285 done
3286 fi
3287 else
3288 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3289 fi
3291 SAVE_CPPFLAGS="$CPPFLAGS"
3292 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3294 AC_CHECK_HEADERS(libpq-fe.h, [],
3295 [with_libpq="no (libpq-fe.h not found)"], [])
3297 CPPFLAGS="$SAVE_CPPFLAGS"
3298 fi
3299 if test "x$with_libpq" = "xyes"
3300 then
3301 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3302 pg_config_status=$?
3304 if test $pg_config_status -eq 0
3305 then
3306 if test -n "$with_libpq_libdir"; then
3307 for dir in $with_libpq_libdir; do
3308 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3309 done
3310 fi
3311 else
3312 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3313 fi
3315 SAVE_LDFLAGS="$LDFLAGS"
3316 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3318 AC_CHECK_LIB(pq, PQconnectdb,
3319 [with_libpq="yes"],
3320 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3322 AC_CHECK_LIB(pq, PQserverVersion,
3323 [with_libpq="yes"],
3324 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3326 LDFLAGS="$SAVE_LDFLAGS"
3327 fi
3328 if test "x$with_libpq" = "xyes"
3329 then
3330 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3331 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3332 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3333 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3334 fi
3335 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3336 # }}}
3338 # --with-libpthread {{{
3339 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3340 [ if test "x$withval" != "xno" \
3341 && test "x$withval" != "xyes"
3342 then
3343 LDFLAGS="$LDFLAGS -L$withval/lib"
3344 CPPFLAGS="$CPPFLAGS -I$withval/include"
3345 with_libpthread="yes"
3346 else
3347 if test "x$withval" = "xno"
3348 then
3349 with_libpthread="no (disabled)"
3350 fi
3351 fi
3352 ], [with_libpthread="yes"])
3353 if test "x$with_libpthread" = "xyes"
3354 then
3355 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3356 fi
3358 if test "x$with_libpthread" = "xyes"
3359 then
3360 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3361 fi
3362 if test "x$with_libpthread" = "xyes"
3363 then
3364 collect_pthread=1
3365 else
3366 collect_pthread=0
3367 fi
3368 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3369 [Wether or not to use pthread (POSIX threads) library])
3370 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3371 # }}}
3373 # --with-python {{{
3374 with_python_prog=""
3375 with_python_path="$PATH"
3376 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3377 [
3378 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3379 then
3380 with_python="$withval"
3381 else if test -x "$withval"
3382 then
3383 with_python_prog="$withval"
3384 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3385 with_python="yes"
3386 else if test -d "$withval"
3387 then
3388 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3389 with_python="yes"
3390 else
3391 AC_MSG_WARN([Argument not recognized: $withval])
3392 fi; fi; fi
3393 ], [with_python="yes"])
3395 SAVE_PATH="$PATH"
3396 SAVE_CPPFLAGS="$CPPFLAGS"
3397 SAVE_LDFLAGS="$LDFLAGS"
3398 SAVE_LIBS="$LIBS"
3400 PATH="$with_python_path"
3402 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3403 then
3404 AC_MSG_CHECKING([for python])
3405 with_python_prog="`which python 2>/dev/null`"
3406 if test "x$with_python_prog" = "x"
3407 then
3408 AC_MSG_RESULT([not found])
3409 with_python="no (interpreter not found)"
3410 else
3411 AC_MSG_RESULT([$with_python_prog])
3412 fi
3413 fi
3415 if test "x$with_python" = "xyes"
3416 then
3417 AC_MSG_CHECKING([for Python CPPFLAGS])
3418 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3419 python_config_status=$?
3421 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3422 then
3423 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3424 with_python="no"
3425 else
3426 AC_MSG_RESULT([$python_include_path])
3427 fi
3428 fi
3430 if test "x$with_python" = "xyes"
3431 then
3432 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3433 AC_CHECK_HEADERS(Python.h,
3434 [with_python="yes"],
3435 [with_python="no ('Python.h' not found)"])
3436 fi
3438 if test "x$with_python" = "xyes"
3439 then
3440 AC_MSG_CHECKING([for Python LDFLAGS])
3441 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`
3442 python_config_status=$?
3444 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3445 then
3446 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3447 with_python="no"
3448 else
3449 AC_MSG_RESULT([$python_library_path])
3450 fi
3451 fi
3453 if test "x$with_python" = "xyes"
3454 then
3455 AC_MSG_CHECKING([for Python LIBS])
3456 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`
3457 python_config_status=$?
3459 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3460 then
3461 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3462 with_python="no"
3463 else
3464 AC_MSG_RESULT([$python_library_flags])
3465 fi
3466 fi
3468 if test "x$with_python" = "xyes"
3469 then
3470 LDFLAGS="-L$python_library_path $LDFLAGS"
3471 LIBS="$python_library_flags $LIBS"
3473 AC_CHECK_FUNC(PyObject_CallFunction,
3474 [with_python="yes"],
3475 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3476 fi
3478 PATH="$SAVE_PATH"
3479 CPPFLAGS="$SAVE_CPPFLAGS"
3480 LDFLAGS="$SAVE_LDFLAGS"
3481 LIBS="$SAVE_LIBS"
3483 if test "x$with_python" = "xyes"
3484 then
3485 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3486 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3487 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3488 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3489 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3490 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3491 fi
3492 # }}} --with-python
3494 # --with-librabbitmq {{{
3495 with_librabbitmq_cppflags=""
3496 with_librabbitmq_ldflags=""
3497 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3498 [
3499 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3500 then
3501 with_librabbitmq_cppflags="-I$withval/include"
3502 with_librabbitmq_ldflags="-L$withval/lib"
3503 with_librabbitmq="yes"
3504 else
3505 with_librabbitmq="$withval"
3506 fi
3507 ],
3508 [
3509 with_librabbitmq="yes"
3510 ])
3511 SAVE_CPPFLAGS="$CPPFLAGS"
3512 SAVE_LDFLAGS="$LDFLAGS"
3513 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3514 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3515 if test "x$with_librabbitmq" = "xyes"
3516 then
3517 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3518 fi
3519 if test "x$with_librabbitmq" = "xyes"
3520 then
3521 # librabbitmq up to version 0.9.1 provides "library_errno", later
3522 # versions use "library_error". The library does not provide a version
3523 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3524 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3525 [
3526 #if HAVE_STDLIB_H
3527 # include <stdlib.h>
3528 #endif
3529 #if HAVE_STDIO_H
3530 # include <stdio.h>
3531 #endif
3532 #if HAVE_STDINT_H
3533 # include <stdint.h>
3534 #endif
3535 #if HAVE_INTTYPES_H
3536 # include <inttypes.h>
3537 #endif
3538 #include <amqp.h>
3539 ])
3540 fi
3541 if test "x$with_librabbitmq" = "xyes"
3542 then
3543 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3544 fi
3545 if test "x$with_librabbitmq" = "xyes"
3546 then
3547 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3548 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3549 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3550 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3551 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3552 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3553 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3554 fi
3555 CPPFLAGS="$SAVE_CPPFLAGS"
3556 LDFLAGS="$SAVE_LDFLAGS"
3557 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3559 with_amqp_tcp_socket="no"
3560 if test "x$with_librabbitmq" = "xyes"
3561 then
3562 SAVE_CPPFLAGS="$CPPFLAGS"
3563 SAVE_LDFLAGS="$LDFLAGS"
3564 SAVE_LIBS="$LIBS"
3565 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3566 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3567 LIBS="-lrabbitmq"
3569 AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3570 AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3571 if test "x$with_amqp_tcp_socket" = "xyes"
3572 then
3573 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3574 [Define if librabbitmq provides the new TCP socket interface.])
3575 fi
3577 AC_CHECK_DECLS(amqp_socket_close,
3578 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3579 [[
3580 #include <amqp.h>
3581 #ifdef HAVE_AMQP_TCP_SOCKET_H
3582 # include <amqp_tcp_socket.h>
3583 #endif
3584 #ifdef HAVE_AMQP_SOCKET_H
3585 # include <amqp_socket.h>
3586 #endif
3587 ]])
3589 CPPFLAGS="$SAVE_CPPFLAGS"
3590 LDFLAGS="$SAVE_LDFLAGS"
3591 LIBS="$SAVE_LIBS"
3592 fi
3593 # }}}
3595 # --with-librouteros {{{
3596 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3597 [
3598 if test "x$withval" = "xyes"
3599 then
3600 with_librouteros="yes"
3601 else if test "x$withval" = "xno"
3602 then
3603 with_librouteros="no"
3604 else
3605 with_librouteros="yes"
3606 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3607 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3608 fi; fi
3609 ],
3610 [with_librouteros="yes"])
3612 SAVE_CPPFLAGS="$CPPFLAGS"
3613 SAVE_LDFLAGS="$LDFLAGS"
3615 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3616 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3618 if test "x$with_librouteros" = "xyes"
3619 then
3620 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3621 then
3622 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3623 fi
3624 AC_CHECK_HEADERS(routeros_api.h,
3625 [with_librouteros="yes"],
3626 [with_librouteros="no (routeros_api.h not found)"])
3627 fi
3628 if test "x$with_librouteros" = "xyes"
3629 then
3630 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3631 then
3632 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3633 fi
3634 AC_CHECK_LIB(routeros, ros_interface,
3635 [with_librouteros="yes"],
3636 [with_librouteros="no (symbol 'ros_interface' not found)"])
3637 fi
3639 CPPFLAGS="$SAVE_CPPFLAGS"
3640 LDFLAGS="$SAVE_LDFLAGS"
3642 if test "x$with_librouteros" = "xyes"
3643 then
3644 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3645 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3646 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3647 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3648 fi
3649 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3650 # }}}
3652 # --with-librrd {{{
3653 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3654 librrd_cflags=""
3655 librrd_ldflags=""
3656 librrd_threadsafe="yes"
3657 librrd_rrdc_update="no"
3658 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3659 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3660 then
3661 librrd_cflags="-I$withval/include"
3662 librrd_ldflags="-L$withval/lib"
3663 with_librrd="yes"
3664 else
3665 with_librrd="$withval"
3666 fi
3667 ], [with_librrd="yes"])
3668 if test "x$with_librrd" = "xyes"
3669 then
3670 SAVE_CPPFLAGS="$CPPFLAGS"
3671 SAVE_LDFLAGS="$LDFLAGS"
3673 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3674 LDFLAGS="$LDFLAGS $librrd_ldflags"
3676 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3678 CPPFLAGS="$SAVE_CPPFLAGS"
3679 LDFLAGS="$SAVE_LDFLAGS"
3680 fi
3681 if test "x$with_librrd" = "xyes"
3682 then
3683 SAVE_CPPFLAGS="$CPPFLAGS"
3684 SAVE_LDFLAGS="$LDFLAGS"
3686 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3687 LDFLAGS="$LDFLAGS $librrd_ldflags"
3689 AC_CHECK_LIB(rrd_th, rrd_update_r,
3690 [with_librrd="yes"
3691 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3692 ],
3693 [librrd_threadsafe="no"
3694 AC_CHECK_LIB(rrd, rrd_update,
3695 [with_librrd="yes"
3696 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3697 ],
3698 [with_librrd="no (symbol 'rrd_update' not found)"],
3699 [-lm])
3700 ],
3701 [-lm])
3703 if test "x$librrd_threadsafe" = "xyes"
3704 then
3705 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3706 else
3707 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3708 fi
3710 CPPFLAGS="$SAVE_CPPFLAGS"
3711 LDFLAGS="$SAVE_LDFLAGS"
3712 fi
3713 if test "x$with_librrd" = "xyes"
3714 then
3715 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3716 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3717 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3718 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3719 fi
3720 if test "x$librrd_threadsafe" = "xyes"
3721 then
3722 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3723 fi
3724 # }}}
3726 # --with-libsensors {{{
3727 with_sensors_cflags=""
3728 with_sensors_ldflags=""
3729 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3730 [
3731 if test "x$withval" = "xno"
3732 then
3733 with_libsensors="no"
3734 else
3735 with_libsensors="yes"
3736 if test "x$withval" != "xyes"
3737 then
3738 with_sensors_cflags="-I$withval/include"
3739 with_sensors_ldflags="-L$withval/lib"
3740 with_libsensors="yes"
3741 fi
3742 fi
3743 ],
3744 [
3745 if test "x$ac_system" = "xLinux"
3746 then
3747 with_libsensors="yes"
3748 else
3749 with_libsensors="no (Linux only library)"
3750 fi
3751 ])
3752 if test "x$with_libsensors" = "xyes"
3753 then
3754 SAVE_CPPFLAGS="$CPPFLAGS"
3755 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3757 # AC_CHECK_HEADERS(sensors/sensors.h,
3758 # [
3759 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3760 # ],
3761 # [with_libsensors="no (sensors/sensors.h not found)"])
3762 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3764 CPPFLAGS="$SAVE_CPPFLAGS"
3765 fi
3766 if test "x$with_libsensors" = "xyes"
3767 then
3768 SAVE_CPPFLAGS="$CPPFLAGS"
3769 SAVE_LDFLAGS="$LDFLAGS"
3770 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3771 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3773 AC_CHECK_LIB(sensors, sensors_init,
3774 [
3775 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3776 ],
3777 [with_libsensors="no (libsensors not found)"])
3779 CPPFLAGS="$SAVE_CPPFLAGS"
3780 LDFLAGS="$SAVE_LDFLAGS"
3781 fi
3782 if test "x$with_libsensors" = "xyes"
3783 then
3784 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3785 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3786 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3787 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3788 fi
3789 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3790 # }}}
3792 # --with-libstatgrab {{{
3793 with_libstatgrab_cflags=""
3794 with_libstatgrab_ldflags=""
3795 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3796 [
3797 if test "x$withval" != "xno" \
3798 && test "x$withval" != "xyes"
3799 then
3800 with_libstatgrab_cflags="-I$withval/include"
3801 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3802 with_libstatgrab="yes"
3803 with_libstatgrab_pkg_config="no"
3804 else
3805 with_libstatgrab="$withval"
3806 with_libstatgrab_pkg_config="yes"
3807 fi
3808 ],
3809 [
3810 with_libstatgrab="yes"
3811 with_libstatgrab_pkg_config="yes"
3812 ])
3814 if test "x$with_libstatgrab" = "xyes" \
3815 && test "x$with_libstatgrab_pkg_config" = "xyes"
3816 then
3817 if test "x$PKG_CONFIG" != "x"
3818 then
3819 AC_MSG_CHECKING([pkg-config for libstatgrab])
3820 temp_result="found"
3821 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3822 if test "$?" != "0"
3823 then
3824 with_libstatgrab_pkg_config="no"
3825 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3826 temp_result="not found"
3827 fi
3828 AC_MSG_RESULT([$temp_result])
3829 else
3830 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3831 with_libstatgrab_pkg_config="no"
3832 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3833 fi
3834 fi
3836 if test "x$with_libstatgrab" = "xyes" \
3837 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3838 && test "x$with_libstatgrab_cflags" = "x"
3839 then
3840 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3841 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3842 if test "$?" = "0"
3843 then
3844 with_libstatgrab_cflags="$temp_result"
3845 else
3846 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3847 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3848 fi
3849 AC_MSG_RESULT([$temp_result])
3850 fi
3852 if test "x$with_libstatgrab" = "xyes" \
3853 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3854 && test "x$with_libstatgrab_ldflags" = "x"
3855 then
3856 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3857 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3858 if test "$?" = "0"
3859 then
3860 with_libstatgrab_ldflags="$temp_result"
3861 else
3862 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3863 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3864 fi
3865 AC_MSG_RESULT([$temp_result])
3866 fi
3868 if test "x$with_libstatgrab" = "xyes"
3869 then
3870 SAVE_CPPFLAGS="$CPPFLAGS"
3871 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3873 AC_CHECK_HEADERS(statgrab.h,
3874 [with_libstatgrab="yes"],
3875 [with_libstatgrab="no (statgrab.h not found)"])
3877 CPPFLAGS="$SAVE_CPPFLAGS"
3878 fi
3880 if test "x$with_libstatgrab" = "xyes"
3881 then
3882 SAVE_CFLAGS="$CFLAGS"
3883 SAVE_LDFLAGS="$LDFLAGS"
3885 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3886 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3888 AC_CHECK_LIB(statgrab, sg_init,
3889 [with_libstatgrab="yes"],
3890 [with_libstatgrab="no (symbol sg_init not found)"])
3892 CFLAGS="$SAVE_CFLAGS"
3893 LDFLAGS="$SAVE_LDFLAGS"
3894 fi
3896 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3897 if test "x$with_libstatgrab" = "xyes"
3898 then
3899 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3900 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3901 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3902 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3903 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3904 fi
3905 # }}}
3907 # --with-libtokyotyrant {{{
3908 with_libtokyotyrant_cppflags=""
3909 with_libtokyotyrant_ldflags=""
3910 with_libtokyotyrant_libs=""
3911 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3912 [
3913 if test "x$withval" = "xno"
3914 then
3915 with_libtokyotyrant="no"
3916 else if test "x$withval" = "xyes"
3917 then
3918 with_libtokyotyrant="yes"
3919 else
3920 with_libtokyotyrant_cppflags="-I$withval/include"
3921 with_libtokyotyrant_ldflags="-L$withval/include"
3922 with_libtokyotyrant_libs="-ltokyotyrant"
3923 with_libtokyotyrant="yes"
3924 fi; fi
3925 ],
3926 [
3927 with_libtokyotyrant="yes"
3928 ])
3930 if test "x$with_libtokyotyrant" = "xyes"
3931 then
3932 if $PKG_CONFIG --exists tokyotyrant
3933 then
3934 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3935 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
3936 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
3937 fi
3938 fi
3940 SAVE_CPPFLAGS="$CPPFLAGS"
3941 SAVE_LDFLAGS="$LDFLAGS"
3942 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3943 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3945 if test "x$with_libtokyotyrant" = "xyes"
3946 then
3947 AC_CHECK_HEADERS(tcrdb.h,
3948 [
3949 AC_DEFINE(HAVE_TCRDB_H, 1,
3950 [Define to 1 if you have the <tcrdb.h> header file.])
3951 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3952 fi
3954 if test "x$with_libtokyotyrant" = "xyes"
3955 then
3956 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3957 [
3958 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3959 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3960 ],
3961 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3962 [$with_libtokyotyrant_libs])
3963 fi
3965 CPPFLAGS="$SAVE_CPPFLAGS"
3966 LDFLAGS="$SAVE_LDFLAGS"
3968 if test "x$with_libtokyotyrant" = "xyes"
3969 then
3970 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3971 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3972 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3973 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3974 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3975 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3976 fi
3977 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3978 # }}}
3980 # --with-libupsclient {{{
3981 with_libupsclient_config=""
3982 with_libupsclient_cflags=""
3983 with_libupsclient_libs=""
3984 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3985 [
3986 if test "x$withval" = "xno"
3987 then
3988 with_libupsclient="no"
3989 else if test "x$withval" = "xyes"
3990 then
3991 with_libupsclient="use_pkgconfig"
3992 else
3993 if test -x "$withval"
3994 then
3995 with_libupsclient_config="$withval"
3996 with_libupsclient="use_libupsclient_config"
3997 else if test -x "$withval/bin/libupsclient-config"
3998 then
3999 with_libupsclient_config="$withval/bin/libupsclient-config"
4000 with_libupsclient="use_libupsclient_config"
4001 else
4002 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
4003 with_libupsclient_cflags="-I$withval/include"
4004 with_libupsclient_libs="-L$withval/lib -lupsclient"
4005 with_libupsclient="yes"
4006 fi; fi
4007 fi; fi
4008 ],
4009 [with_libupsclient="use_pkgconfig"])
4011 # configure using libupsclient-config
4012 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4013 then
4014 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4015 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4016 if test $? -ne 0
4017 then
4018 with_libupsclient="no ($with_libupsclient_config failed)"
4019 fi
4020 with_libupsclient_libs="`$with_libupsclient_config --libs`"
4021 if test $? -ne 0
4022 then
4023 with_libupsclient="no ($with_libupsclient_config failed)"
4024 fi
4025 fi
4026 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4027 then
4028 with_libupsclient="yes"
4029 fi
4031 # configure using pkg-config
4032 if test "x$with_libupsclient" = "xuse_pkgconfig"
4033 then
4034 if test "x$PKG_CONFIG" = "x"
4035 then
4036 with_libupsclient="no (Don't have pkg-config)"
4037 fi
4038 fi
4039 if test "x$with_libupsclient" = "xuse_pkgconfig"
4040 then
4041 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4042 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4043 if test $? -ne 0
4044 then
4045 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4046 fi
4047 fi
4048 if test "x$with_libupsclient" = "xuse_pkgconfig"
4049 then
4050 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4051 if test $? -ne 0
4052 then
4053 with_libupsclient="no ($PKG_CONFIG failed)"
4054 fi
4055 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4056 if test $? -ne 0
4057 then
4058 with_libupsclient="no ($PKG_CONFIG failed)"
4059 fi
4060 fi
4061 if test "x$with_libupsclient" = "xuse_pkgconfig"
4062 then
4063 with_libupsclient="yes"
4064 fi
4066 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4067 # the actual checks.
4068 if test "x$with_libupsclient" = "xyes"
4069 then
4070 SAVE_CPPFLAGS="$CPPFLAGS"
4071 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4073 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4075 CPPFLAGS="$SAVE_CPPFLAGS"
4076 fi
4077 if test "x$with_libupsclient" = "xyes"
4078 then
4079 SAVE_CPPFLAGS="$CPPFLAGS"
4080 SAVE_LDFLAGS="$LDFLAGS"
4082 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4083 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4085 AC_CHECK_LIB(upsclient, upscli_connect,
4086 [with_libupsclient="yes"],
4087 [with_libupsclient="no (symbol upscli_connect not found)"])
4089 CPPFLAGS="$SAVE_CPPFLAGS"
4090 LDFLAGS="$SAVE_LDFLAGS"
4091 fi
4092 if test "x$with_libupsclient" = "xyes"
4093 then
4094 SAVE_CPPFLAGS="$CPPFLAGS"
4095 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4097 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4098 [#include <stdlib.h>
4099 #include <stdio.h>
4100 #include <upsclient.h>])
4102 CPPFLAGS="$SAVE_CPPFLAGS"
4103 fi
4104 if test "x$with_libupsclient" = "xyes"
4105 then
4106 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4107 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4108 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4109 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4110 fi
4111 # }}}
4113 # --with-libxmms {{{
4114 with_xmms_config="xmms-config"
4115 with_xmms_cflags=""
4116 with_xmms_libs=""
4117 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4118 [
4119 if test "x$withval" != "xno" \
4120 && test "x$withval" != "xyes"
4121 then
4122 if test -f "$withval" && test -x "$withval";
4123 then
4124 with_xmms_config="$withval"
4125 else if test -x "$withval/bin/xmms-config"
4126 then
4127 with_xmms_config="$withval/bin/xmms-config"
4128 fi; fi
4129 with_libxmms="yes"
4130 else if test "x$withval" = "xno"
4131 then
4132 with_libxmms="no"
4133 else
4134 with_libxmms="yes"
4135 fi; fi
4136 ],
4137 [
4138 with_libxmms="yes"
4139 ])
4140 if test "x$with_libxmms" = "xyes"
4141 then
4142 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4143 xmms_config_status=$?
4145 if test $xmms_config_status -ne 0
4146 then
4147 with_libxmms="no"
4148 fi
4149 fi
4150 if test "x$with_libxmms" = "xyes"
4151 then
4152 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4153 xmms_config_status=$?
4155 if test $xmms_config_status -ne 0
4156 then
4157 with_libxmms="no"
4158 fi
4159 fi
4160 if test "x$with_libxmms" = "xyes"
4161 then
4162 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4163 [
4164 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4165 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4166 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4167 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4168 ],
4169 [
4170 with_libxmms="no"
4171 ],
4172 [$with_xmms_libs])
4173 fi
4174 with_libxmms_numeric=0
4175 if test "x$with_libxmms" = "xyes"
4176 then
4177 with_libxmms_numeric=1
4178 fi
4179 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4180 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4181 # }}}
4183 # --with-libyajl {{{
4184 with_libyajl_cppflags=""
4185 with_libyajl_ldflags=""
4186 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4187 [
4188 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4189 then
4190 with_libyajl_cppflags="-I$withval/include"
4191 with_libyajl_ldflags="-L$withval/lib"
4192 with_libyajl="yes"
4193 else
4194 with_libyajl="$withval"
4195 fi
4196 ],
4197 [
4198 with_libyajl="yes"
4199 ])
4200 if test "x$with_libyajl" = "xyes"
4201 then
4202 SAVE_CPPFLAGS="$CPPFLAGS"
4203 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4205 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4206 AC_CHECK_HEADERS(yajl/yajl_version.h)
4208 CPPFLAGS="$SAVE_CPPFLAGS"
4209 fi
4210 if test "x$with_libyajl" = "xyes"
4211 then
4212 SAVE_CPPFLAGS="$CPPFLAGS"
4213 SAVE_LDFLAGS="$LDFLAGS"
4214 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4215 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4217 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4219 CPPFLAGS="$SAVE_CPPFLAGS"
4220 LDFLAGS="$SAVE_LDFLAGS"
4221 fi
4222 if test "x$with_libyajl" = "xyes"
4223 then
4224 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4225 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4226 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4227 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4228 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4229 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4230 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4231 fi
4232 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4233 # }}}
4235 # --with-libvarnish {{{
4236 with_libvarnish_cppflags=""
4237 with_libvarnish_cflags=""
4238 with_libvarnish_libs=""
4239 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4240 [
4241 if test "x$withval" = "xno"
4242 then
4243 with_libvarnish="no"
4244 else if test "x$withval" = "xyes"
4245 then
4246 with_libvarnish="use_pkgconfig"
4247 else if test -d "$with_libvarnish/lib"
4248 then
4249 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4250 with_libvarnish_cflags="-I$withval/include"
4251 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4252 with_libvarnish="yes"
4253 fi; fi; fi
4254 ],
4255 [with_libvarnish="use_pkgconfig"])
4257 # configure using pkg-config
4258 if test "x$with_libvarnish" = "xuse_pkgconfig"
4259 then
4260 if test "x$PKG_CONFIG" = "x"
4261 then
4262 with_libvarnish="no (Don't have pkg-config)"
4263 fi
4264 fi
4265 if test "x$with_libvarnish" = "xuse_pkgconfig"
4266 then
4267 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4268 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4269 if test $? -ne 0
4270 then
4271 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4272 fi
4273 fi
4274 if test "x$with_libvarnish" = "xuse_pkgconfig"
4275 then
4276 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4277 if test $? -ne 0
4278 then
4279 with_libvarnish="no ($PKG_CONFIG failed)"
4280 fi
4281 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4282 if test $? -ne 0
4283 then
4284 with_libvarnish="no ($PKG_CONFIG failed)"
4285 fi
4286 fi
4287 if test "x$with_libvarnish" = "xuse_pkgconfig"
4288 then
4289 with_libvarnish="yes"
4290 fi
4292 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4293 # the actual checks.
4294 if test "x$with_libvarnish" = "xyes"
4295 then
4296 SAVE_CPPFLAGS="$CPPFLAGS"
4297 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4298 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4300 CPPFLAGS="$SAVE_CPPFLAGS"
4301 fi
4302 if test "x$with_libvarnish" = "xyes"
4303 then
4304 SAVE_CPPFLAGS="$CPPFLAGS"
4305 #SAVE_LDFLAGS="$LDFLAGS"
4307 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4308 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4310 AC_CHECK_HEADERS(varnish/vsc.h,
4311 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4312 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4314 CPPFLAGS="$SAVE_CPPFLAGS"
4315 #LDFLAGS="$SAVE_LDFLAGS"
4316 fi
4317 if test "x$with_libvarnish" = "xyes"
4318 then
4319 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4320 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4321 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4322 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4323 fi
4324 # }}}
4326 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4327 with_libxml2="no (pkg-config isn't available)"
4328 with_libxml2_cflags=""
4329 with_libxml2_ldflags=""
4330 with_libvirt="no (pkg-config isn't available)"
4331 with_libvirt_cflags=""
4332 with_libvirt_ldflags=""
4333 if test "x$PKG_CONFIG" != "x"
4334 then
4335 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4336 if test "$?" = "0"
4337 then
4338 with_libxml2="yes"
4339 else
4340 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4341 fi
4343 $PKG_CONFIG --exists libvirt 2>/dev/null
4344 if test "$?" = "0"
4345 then
4346 with_libvirt="yes"
4347 else
4348 with_libvirt="no (pkg-config doesn't know libvirt)"
4349 fi
4350 fi
4351 if test "x$with_libxml2" = "xyes"
4352 then
4353 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4354 if test $? -ne 0
4355 then
4356 with_libxml2="no"
4357 fi
4358 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4359 if test $? -ne 0
4360 then
4361 with_libxml2="no"
4362 fi
4363 fi
4364 if test "x$with_libxml2" = "xyes"
4365 then
4366 SAVE_CPPFLAGS="$CPPFLAGS"
4367 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4369 AC_CHECK_HEADERS(libxml/parser.h, [],
4370 [with_libxml2="no (libxml/parser.h not found)"])
4372 CPPFLAGS="$SAVE_CPPFLAGS"
4373 fi
4374 if test "x$with_libxml2" = "xyes"
4375 then
4376 SAVE_CFLAGS="$CFLAGS"
4377 SAVE_LDFLAGS="$LDFLAGS"
4379 CFLAGS="$CFLAGS $with_libxml2_cflags"
4380 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4382 AC_CHECK_LIB(xml2, xmlXPathEval,
4383 [with_libxml2="yes"],
4384 [with_libxml2="no (symbol xmlXPathEval not found)"])
4386 CFLAGS="$SAVE_CFLAGS"
4387 LDFLAGS="$SAVE_LDFLAGS"
4388 fi
4389 dnl Add the right compiler flags and libraries.
4390 if test "x$with_libxml2" = "xyes"; then
4391 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4392 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4393 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4394 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4395 fi
4396 if test "x$with_libvirt" = "xyes"
4397 then
4398 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4399 if test $? -ne 0
4400 then
4401 with_libvirt="no"
4402 fi
4403 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4404 if test $? -ne 0
4405 then
4406 with_libvirt="no"
4407 fi
4408 fi
4409 if test "x$with_libvirt" = "xyes"
4410 then
4411 SAVE_CPPFLAGS="$CPPFLAGS"
4412 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4414 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4415 [with_libvirt="no (libvirt/libvirt.h not found)"])
4417 CPPFLAGS="$SAVE_CPPFLAGS"
4418 fi
4419 if test "x$with_libvirt" = "xyes"
4420 then
4421 SAVE_CFLAGS="$CFLAGS"
4422 SAVE_LDFLAGS="$LDFLAGS"
4424 CFLAGS="$CFLAGS $with_libvirt_cflags"
4425 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4427 AC_CHECK_LIB(virt, virDomainBlockStats,
4428 [with_libvirt="yes"],
4429 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4431 CFLAGS="$SAVE_CFLAGS"
4432 LDFLAGS="$SAVE_LDFLAGS"
4433 fi
4434 dnl Add the right compiler flags and libraries.
4435 if test "x$with_libvirt" = "xyes"; then
4436 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4437 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4438 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4439 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4440 fi
4441 # }}}
4443 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4444 with_libopenipmipthread="yes"
4445 with_libopenipmipthread_cflags=""
4446 with_libopenipmipthread_libs=""
4448 AC_MSG_CHECKING([for pkg-config])
4449 temp_result="no"
4450 if test "x$PKG_CONFIG" = "x"
4451 then
4452 with_libopenipmipthread="no"
4453 temp_result="no"
4454 else
4455 temp_result="$PKG_CONFIG"
4456 fi
4457 AC_MSG_RESULT([$temp_result])
4459 if test "x$with_libopenipmipthread" = "xyes"
4460 then
4461 AC_MSG_CHECKING([for libOpenIPMIpthread])
4462 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4463 if test "$?" != "0"
4464 then
4465 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4466 fi
4467 AC_MSG_RESULT([$with_libopenipmipthread])
4468 fi
4470 if test "x$with_libopenipmipthread" = "xyes"
4471 then
4472 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4473 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4474 if test "$?" = "0"
4475 then
4476 with_libopenipmipthread_cflags="$temp_result"
4477 else
4478 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4479 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4480 fi
4481 AC_MSG_RESULT([$temp_result])
4482 fi
4484 if test "x$with_libopenipmipthread" = "xyes"
4485 then
4486 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4487 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4488 if test "$?" = "0"
4489 then
4490 with_libopenipmipthread_ldflags="$temp_result"
4491 else
4492 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4493 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4494 fi
4495 AC_MSG_RESULT([$temp_result])
4496 fi
4498 if test "x$with_libopenipmipthread" = "xyes"
4499 then
4500 SAVE_CPPFLAGS="$CPPFLAGS"
4501 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4503 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4504 [with_libopenipmipthread="yes"],
4505 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4506 [#include <OpenIPMI/ipmiif.h>
4507 #include <OpenIPMI/ipmi_err.h>
4508 #include <OpenIPMI/ipmi_posix.h>
4509 #include <OpenIPMI/ipmi_conn.h>
4510 ])
4512 CPPFLAGS="$SAVE_CPPFLAGS"
4513 fi
4515 if test "x$with_libopenipmipthread" = "xyes"
4516 then
4517 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4518 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4519 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4520 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4521 fi
4522 # }}}
4524 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4525 [with_libnotify="yes"],
4526 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4527 with_libnotify="no"
4528 else
4529 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4530 fi])
4532 # Check for enabled/disabled features
4533 #
4535 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4536 # ------------------------------------------------------------
4537 dnl
4538 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4539 dnl
4540 AC_DEFUN(
4541 [AC_COLLECTD],
4542 [
4543 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4544 m4_if(
4545 [$2],
4546 [enable],
4547 [dnl
4548 m4_define([EnDis],[disabled])dnl
4549 m4_define([YesNo],[no])dnl
4550 ],dnl
4551 [m4_if(
4552 [$2],
4553 [disable],
4554 [dnl
4555 m4_define([EnDis],[enabled])dnl
4556 m4_define([YesNo],[yes])dnl
4557 ],
4558 [dnl
4559 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4560 ]dnl
4561 )]dnl
4562 )dnl
4563 m4_if([$3], [feature], [],
4564 [m4_if(
4565 [$3], [module], [],
4566 [dnl
4567 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4568 ]dnl
4569 )]dnl
4570 )dnl
4571 AC_ARG_ENABLE(
4572 [$1],
4573 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4574 [],
4575 enable_$1='[YesNo]'dnl
4576 )# AC_ARG_ENABLE
4577 if test "x$enable_$1" = "xno"
4578 then
4579 collectd_$1=0
4580 else
4581 if test "x$enable_$1" = "xyes"
4582 then
4583 collectd_$1=1
4584 else
4585 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4586 collectd_$1=1
4587 enable_$1='yes'
4588 fi
4589 fi
4590 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4591 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4592 ]dnl
4593 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4595 # AC_PLUGIN(name, default, info)
4596 # ------------------------------------------------------------
4597 dnl
4598 AC_DEFUN(
4599 [AC_PLUGIN],
4600 [
4601 enable_plugin="no"
4602 force="no"
4603 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4604 [
4605 if test "x$enableval" = "xyes"
4606 then
4607 enable_plugin="yes"
4608 else if test "x$enableval" = "xforce"
4609 then
4610 enable_plugin="yes"
4611 force="yes"
4612 else
4613 enable_plugin="no (disabled on command line)"
4614 fi; fi
4615 ],
4616 [
4617 if test "x$enable_all_plugins" = "xauto"
4618 then
4619 if test "x$2" = "xyes"
4620 then
4621 enable_plugin="yes"
4622 else
4623 enable_plugin="no"
4624 fi
4625 else
4626 enable_plugin="$enable_all_plugins"
4627 fi
4628 ])
4629 if test "x$enable_plugin" = "xyes"
4630 then
4631 if test "x$2" = "xyes" || test "x$force" = "xyes"
4632 then
4633 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4634 if test "x$2" != "xyes"
4635 then
4636 dependency_warning="yes"
4637 fi
4638 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4639 dependency_error="yes"
4640 enable_plugin="no (dependency error)"
4641 fi
4642 fi
4643 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4644 enable_$1="$enable_plugin"
4645 ]
4646 )# AC_PLUGIN(name, default, info)
4648 m4_divert_once([HELP_ENABLE], [
4649 collectd features:])
4650 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4651 AC_COLLECTD([debug], [enable], [feature], [debugging])
4652 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4653 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4655 dependency_warning="no"
4656 dependency_error="no"
4658 plugin_ascent="no"
4659 plugin_battery="no"
4660 plugin_bind="no"
4661 plugin_conntrack="no"
4662 plugin_contextswitch="no"
4663 plugin_cpu="no"
4664 plugin_cpufreq="no"
4665 plugin_curl_json="no"
4666 plugin_curl_xml="no"
4667 plugin_df="no"
4668 plugin_disk="no"
4669 plugin_entropy="no"
4670 plugin_ethstat="no"
4671 plugin_fscache="no"
4672 plugin_interface="no"
4673 plugin_ipmi="no"
4674 plugin_ipvs="no"
4675 plugin_irq="no"
4676 plugin_libvirt="no"
4677 plugin_load="no"
4678 plugin_memory="no"
4679 plugin_multimeter="no"
4680 plugin_nfs="no"
4681 plugin_numa="no"
4682 plugin_perl="no"
4683 plugin_processes="no"
4684 plugin_protocols="no"
4685 plugin_serial="no"
4686 plugin_swap="no"
4687 plugin_tape="no"
4688 plugin_tcpconns="no"
4689 plugin_ted="no"
4690 plugin_thermal="no"
4691 plugin_users="no"
4692 plugin_uptime="no"
4693 plugin_vmem="no"
4694 plugin_vserver="no"
4695 plugin_wireless="no"
4696 plugin_zfs_arc="no"
4698 # Linux
4699 if test "x$ac_system" = "xLinux"
4700 then
4701 plugin_battery="yes"
4702 plugin_conntrack="yes"
4703 plugin_contextswitch="yes"
4704 plugin_cpu="yes"
4705 plugin_cpufreq="yes"
4706 plugin_disk="yes"
4707 plugin_entropy="yes"
4708 plugin_fscache="yes"
4709 plugin_interface="yes"
4710 plugin_irq="yes"
4711 plugin_load="yes"
4712 plugin_memory="yes"
4713 plugin_nfs="yes"
4714 plugin_numa="yes"
4715 plugin_processes="yes"
4716 plugin_protocols="yes"
4717 plugin_serial="yes"
4718 plugin_swap="yes"
4719 plugin_tcpconns="yes"
4720 plugin_thermal="yes"
4721 plugin_uptime="yes"
4722 plugin_vmem="yes"
4723 plugin_vserver="yes"
4724 plugin_wireless="yes"
4726 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4727 then
4728 plugin_ipvs="yes"
4729 fi
4730 fi
4732 if test "x$ac_system" = "xOpenBSD"
4733 then
4734 plugin_tcpconns="yes"
4735 fi
4737 # Mac OS X devices
4738 if test "x$with_libiokit" = "xyes"
4739 then
4740 plugin_battery="yes"
4741 plugin_disk="yes"
4742 fi
4744 # AIX
4746 if test "x$ac_system" = "xAIX"
4747 then
4748 plugin_tcpconns="yes"
4749 fi
4751 if test "x$with_perfstat" = "xyes"
4752 then
4753 plugin_cpu="yes"
4754 plugin_contextswitch="yes"
4755 plugin_disk="yes"
4756 plugin_memory="yes"
4757 plugin_swap="yes"
4758 plugin_interface="yes"
4759 plugin_load="yes"
4760 plugin_uptime="yes"
4761 fi
4763 if test "x$with_procinfo" = "xyes"
4764 then
4765 plugin_processes="yes"
4766 fi
4768 # Solaris
4769 if test "x$with_kstat" = "xyes"
4770 then
4771 plugin_nfs="yes"
4772 plugin_uptime="yes"
4773 plugin_zfs_arc="yes"
4774 fi
4776 if test "x$with_devinfo$with_kstat" = "xyesyes"
4777 then
4778 plugin_cpu="yes"
4779 plugin_disk="yes"
4780 plugin_interface="yes"
4781 plugin_memory="yes"
4782 plugin_tape="yes"
4783 fi
4785 # libstatgrab
4786 if test "x$with_libstatgrab" = "xyes"
4787 then
4788 plugin_cpu="yes"
4789 plugin_disk="yes"
4790 plugin_interface="yes"
4791 plugin_load="yes"
4792 plugin_memory="yes"
4793 plugin_swap="yes"
4794 plugin_users="yes"
4795 fi
4797 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4798 then
4799 plugin_ascent="yes"
4800 if test "x$have_strptime" = "xyes"
4801 then
4802 plugin_bind="yes"
4803 fi
4804 fi
4806 if test "x$with_libopenipmipthread" = "xyes"
4807 then
4808 plugin_ipmi="yes"
4809 fi
4811 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4812 then
4813 plugin_curl_json="yes"
4814 fi
4816 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4817 then
4818 plugin_curl_xml="yes"
4819 fi
4821 if test "x$have_processor_info" = "xyes"
4822 then
4823 plugin_cpu="yes"
4824 fi
4825 if test "x$have_sysctl" = "xyes"
4826 then
4827 plugin_cpu="yes"
4828 plugin_memory="yes"
4829 plugin_uptime="yes"
4830 if test "x$ac_system" = "xDarwin"
4831 then
4832 plugin_swap="yes"
4833 fi
4834 fi
4835 if test "x$have_sysctlbyname" = "xyes"
4836 then
4837 plugin_contextswitch="yes"
4838 plugin_cpu="yes"
4839 plugin_memory="yes"
4840 plugin_tcpconns="yes"
4841 fi
4843 # Df plugin: Check if we know how to determine mount points first.
4844 #if test "x$have_listmntent" = "xyes"; then
4845 # plugin_df="yes"
4846 #fi
4847 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4848 then
4849 plugin_df="yes"
4850 fi
4851 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4852 then
4853 plugin_df="yes"
4854 fi
4855 #if test "x$have_getmntent" = "xseq"
4856 #then
4857 # plugin_df="yes"
4858 #fi
4859 if test "x$c_cv_have_one_getmntent" = "xyes"
4860 then
4861 plugin_df="yes"
4862 fi
4864 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4865 if test "x$plugin_df" = "xyes"
4866 then
4867 plugin_df="no"
4868 if test "x$have_statfs" = "xyes"
4869 then
4870 plugin_df="yes"
4871 fi
4872 if test "x$have_statvfs" = "xyes"
4873 then
4874 plugin_df="yes"
4875 fi
4876 fi
4878 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4879 then
4880 plugin_ethstat="yes"
4881 fi
4883 if test "x$have_getifaddrs" = "xyes"
4884 then
4885 plugin_interface="yes"
4886 fi
4888 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4889 then
4890 plugin_libvirt="yes"
4891 fi
4893 if test "x$have_getloadavg" = "xyes"
4894 then
4895 plugin_load="yes"
4896 fi
4898 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4899 then
4900 plugin_perl="yes"
4901 fi
4903 # Mac OS X memory interface
4904 if test "x$have_host_statistics" = "xyes"
4905 then
4906 plugin_memory="yes"
4907 fi
4909 if test "x$have_termios_h" = "xyes"
4910 then
4911 plugin_multimeter="yes"
4912 plugin_ted="yes"
4913 fi
4915 if test "x$have_thread_info" = "xyes"
4916 then
4917 plugin_processes="yes"
4918 fi
4920 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4921 then
4922 plugin_processes="yes"
4923 fi
4925 if test "x$with_kvm_getswapinfo" = "xyes"
4926 then
4927 plugin_swap="yes"
4928 fi
4930 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4931 then
4932 plugin_swap="yes"
4933 fi
4935 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4936 then
4937 plugin_tcpconns="yes"
4938 fi
4940 if test "x$have_getutent" = "xyes"
4941 then
4942 plugin_users="yes"
4943 fi
4944 if test "x$have_getutxent" = "xyes"
4945 then
4946 plugin_users="yes"
4947 fi
4949 m4_divert_once([HELP_ENABLE], [
4950 collectd plugins:])
4952 AC_ARG_ENABLE([all-plugins],
4953 AC_HELP_STRING([--enable-all-plugins],
4954 [enable all plugins (auto by def)]),
4955 [
4956 if test "x$enableval" = "xyes"
4957 then
4958 enable_all_plugins="yes"
4959 else if test "x$enableval" = "xauto"
4960 then
4961 enable_all_plugins="auto"
4962 else
4963 enable_all_plugins="no"
4964 fi; fi
4965 ],
4966 [enable_all_plugins="auto"])
4968 m4_divert_once([HELP_ENABLE], [])
4970 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4971 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4972 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4973 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4974 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4975 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4976 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4977 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4978 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4979 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4980 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4981 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4982 AC_PLUGIN([csv], [yes], [CSV output plugin])
4983 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4984 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4985 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4986 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4987 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4988 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4989 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4990 AC_PLUGIN([email], [yes], [EMail statistics])
4991 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4992 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4993 AC_PLUGIN([exec], [yes], [Execution of external programs])
4994 AC_PLUGIN([filecount], [yes], [Count files in directories])
4995 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4996 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4997 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4998 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4999 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
5000 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
5001 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
5002 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
5003 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
5004 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
5005 AC_PLUGIN([load], [$plugin_load], [System load])
5006 AC_PLUGIN([logfile], [yes], [File logging plugin])
5007 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
5008 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
5009 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
5010 AC_PLUGIN([match_hashed], [yes], [The hashed match])
5011 AC_PLUGIN([match_regex], [yes], [The regex match])
5012 AC_PLUGIN([match_timediff], [yes], [The timediff match])
5013 AC_PLUGIN([match_value], [yes], [The value match])
5014 AC_PLUGIN([mbmon], [yes], [Query mbmond])
5015 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5016 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5017 AC_PLUGIN([memcached], [yes], [memcached statistics])
5018 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5019 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5020 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5021 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5022 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5023 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
5024 AC_PLUGIN([network], [yes], [Network communication plugin])
5025 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5026 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5027 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5028 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5029 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5030 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5031 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5032 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5033 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5034 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5035 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5036 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5037 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5038 # FIXME: Check for libevent, too.
5039 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5040 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5041 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5042 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5043 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5044 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5045 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5046 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
5047 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5048 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5049 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5050 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5051 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5052 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5053 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5054 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5055 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5056 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5057 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5058 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5059 AC_PLUGIN([target_notification], [yes], [The notification target])
5060 AC_PLUGIN([target_replace], [yes], [The replace target])
5061 AC_PLUGIN([target_scale],[yes], [The scale target])
5062 AC_PLUGIN([target_set], [yes], [The set target])
5063 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5064 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5065 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5066 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5067 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5068 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5069 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5070 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5071 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5072 AC_PLUGIN([users], [$plugin_users], [User statistics])
5073 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5074 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5075 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5076 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5077 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5078 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5079 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5080 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5081 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5082 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5083 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5084 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5086 dnl Default configuration file
5087 # Load either syslog or logfile
5088 LOAD_PLUGIN_SYSLOG=""
5089 LOAD_PLUGIN_LOGFILE=""
5091 AC_MSG_CHECKING([which default log plugin to load])
5092 default_log_plugin="none"
5093 if test "x$enable_syslog" = "xyes"
5094 then
5095 default_log_plugin="syslog"
5096 else
5097 LOAD_PLUGIN_SYSLOG="##"
5098 fi
5100 if test "x$enable_logfile" = "xyes"
5101 then
5102 if test "x$default_log_plugin" = "xnone"
5103 then
5104 default_log_plugin="logfile"
5105 else
5106 LOAD_PLUGIN_LOGFILE="#"
5107 fi
5108 else
5109 LOAD_PLUGIN_LOGFILE="##"
5110 fi
5111 AC_MSG_RESULT([$default_log_plugin])
5113 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5114 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5116 DEFAULT_LOG_LEVEL="info"
5117 if test "x$enable_debug" = "xyes"
5118 then
5119 DEFAULT_LOG_LEVEL="debug"
5120 fi
5121 AC_SUBST(DEFAULT_LOG_LEVEL)
5123 # Load only one of rrdtool, network, csv in the default config.
5124 LOAD_PLUGIN_RRDTOOL=""
5125 LOAD_PLUGIN_NETWORK=""
5126 LOAD_PLUGIN_CSV=""
5128 AC_MSG_CHECKING([which default write plugin to load])
5129 default_write_plugin="none"
5130 if test "x$enable_rrdtool" = "xyes"
5131 then
5132 default_write_plugin="rrdtool"
5133 else
5134 LOAD_PLUGIN_RRDTOOL="##"
5135 fi
5137 if test "x$enable_network" = "xyes"
5138 then
5139 if test "x$default_write_plugin" = "xnone"
5140 then
5141 default_write_plugin="network"
5142 else
5143 LOAD_PLUGIN_NETWORK="#"
5144 fi
5145 else
5146 LOAD_PLUGIN_NETWORK="##"
5147 fi
5149 if test "x$enable_csv" = "xyes"
5150 then
5151 if test "x$default_write_plugin" = "xnone"
5152 then
5153 default_write_plugin="csv"
5154 else
5155 LOAD_PLUGIN_CSV="#"
5156 fi
5157 else
5158 LOAD_PLUGIN_CSV="##"
5159 fi
5160 AC_MSG_RESULT([$default_write_plugin])
5162 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5163 AC_SUBST(LOAD_PLUGIN_NETWORK)
5164 AC_SUBST(LOAD_PLUGIN_CSV)
5166 dnl ip_vs.h
5167 if test "x$ac_system" = "xLinux" \
5168 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5169 then
5170 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5171 fi
5173 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5174 then
5175 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5176 fi
5178 dnl Perl bindings
5179 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5180 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5181 [
5182 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5183 then
5184 PERL_BINDINGS_OPTIONS="$withval"
5185 with_perl_bindings="yes"
5186 else
5187 with_perl_bindings="$withval"
5188 fi
5189 ],
5190 [
5191 if test -n "$perl_interpreter"
5192 then
5193 with_perl_bindings="yes"
5194 else
5195 with_perl_bindings="no (no perl interpreter found)"
5196 fi
5197 ])
5198 if test "x$with_perl_bindings" = "xyes"
5199 then
5200 PERL_BINDINGS="perl"
5201 else
5202 PERL_BINDINGS=""
5203 fi
5204 AC_SUBST(PERL_BINDINGS)
5205 AC_SUBST(PERL_BINDINGS_OPTIONS)
5207 dnl libcollectdclient
5208 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5209 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5210 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5212 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5214 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5216 AC_SUBST(LCC_VERSION_MAJOR)
5217 AC_SUBST(LCC_VERSION_MINOR)
5218 AC_SUBST(LCC_VERSION_PATCH)
5219 AC_SUBST(LCC_VERSION_EXTRA)
5220 AC_SUBST(LCC_VERSION_STRING)
5222 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5224 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5226 if test "x$with_librrd" = "xyes" \
5227 && test "x$librrd_threadsafe" != "xyes"
5228 then
5229 with_librrd="yes (warning: librrd is not thread-safe)"
5230 fi
5232 if test "x$with_libperl" = "xyes"
5233 then
5234 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5235 else
5236 enable_perl="no (needs libperl)"
5237 fi
5239 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5240 then
5241 enable_perl="no (libperl doesn't support ithreads)"
5242 fi
5244 if test "x$with_perl_bindings" = "xyes" \
5245 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5246 then
5247 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5248 fi
5250 cat <<EOF;
5252 Configuration:
5253 Libraries:
5254 libcredis . . . . . . $with_libcredis
5255 libcurl . . . . . . . $with_libcurl
5256 libdbi . . . . . . . $with_libdbi
5257 libesmtp . . . . . . $with_libesmtp
5258 libganglia . . . . . $with_libganglia
5259 libgcrypt . . . . . . $with_libgcrypt
5260 libhal . . . . . . . $with_libhal
5261 libiokit . . . . . . $with_libiokit
5262 libiptc . . . . . . . $with_libiptc
5263 libjvm . . . . . . . $with_java
5264 libkstat . . . . . . $with_kstat
5265 libkvm . . . . . . . $with_libkvm
5266 libmemcached . . . . $with_libmemcached
5267 libmodbus . . . . . . $with_libmodbus
5268 libmongoc . . . . . . $with_libmongoc
5269 libmysql . . . . . . $with_libmysql
5270 libnetapp . . . . . . $with_libnetapp
5271 libnetlink . . . . . $with_libnetlink
5272 libnetsnmp . . . . . $with_libnetsnmp
5273 libnotify . . . . . . $with_libnotify
5274 liboconfig . . . . . $with_liboconfig
5275 libopenipmi . . . . . $with_libopenipmipthread
5276 liboping . . . . . . $with_liboping
5277 libowcapi . . . . . . $with_libowcapi
5278 libpcap . . . . . . . $with_libpcap
5279 libperfstat . . . . . $with_perfstat
5280 libperl . . . . . . . $with_libperl
5281 libpq . . . . . . . . $with_libpq
5282 libpthread . . . . . $with_libpthread
5283 librabbitmq . . . . . $with_librabbitmq
5284 librouteros . . . . . $with_librouteros
5285 librrd . . . . . . . $with_librrd
5286 libsensors . . . . . $with_libsensors
5287 libstatgrab . . . . . $with_libstatgrab
5288 libtokyotyrant . . . $with_libtokyotyrant
5289 libupsclient . . . . $with_libupsclient
5290 libvarnish . . . . . $with_libvarnish
5291 libvirt . . . . . . . $with_libvirt
5292 libxml2 . . . . . . . $with_libxml2
5293 libxmms . . . . . . . $with_libxmms
5294 libyajl . . . . . . . $with_libyajl
5295 oracle . . . . . . . $with_oracle
5296 protobuf-c . . . . . $have_protoc_c
5297 python . . . . . . . $with_python
5299 Features:
5300 daemon mode . . . . . $enable_daemon
5301 debug . . . . . . . . $enable_debug
5303 Bindings:
5304 perl . . . . . . . . $with_perl_bindings
5306 Modules:
5307 aggregation . . . . . $enable_aggregation
5308 amqp . . . . . . . $enable_amqp
5309 apache . . . . . . . $enable_apache
5310 apcups . . . . . . . $enable_apcups
5311 apple_sensors . . . . $enable_apple_sensors
5312 ascent . . . . . . . $enable_ascent
5313 battery . . . . . . . $enable_battery
5314 bind . . . . . . . . $enable_bind
5315 conntrack . . . . . . $enable_conntrack
5316 contextswitch . . . . $enable_contextswitch
5317 cpu . . . . . . . . . $enable_cpu
5318 cpufreq . . . . . . . $enable_cpufreq
5319 csv . . . . . . . . . $enable_csv
5320 curl . . . . . . . . $enable_curl
5321 curl_json . . . . . . $enable_curl_json
5322 curl_xml . . . . . . $enable_curl_xml
5323 dbi . . . . . . . . . $enable_dbi
5324 df . . . . . . . . . $enable_df
5325 disk . . . . . . . . $enable_disk
5326 dns . . . . . . . . . $enable_dns
5327 email . . . . . . . . $enable_email
5328 entropy . . . . . . . $enable_entropy
5329 ethstat . . . . . . . $enable_ethstat
5330 exec . . . . . . . . $enable_exec
5331 filecount . . . . . . $enable_filecount
5332 fscache . . . . . . . $enable_fscache
5333 gmond . . . . . . . . $enable_gmond
5334 hddtemp . . . . . . . $enable_hddtemp
5335 interface . . . . . . $enable_interface
5336 ipmi . . . . . . . . $enable_ipmi
5337 iptables . . . . . . $enable_iptables
5338 ipvs . . . . . . . . $enable_ipvs
5339 irq . . . . . . . . . $enable_irq
5340 java . . . . . . . . $enable_java
5341 libvirt . . . . . . . $enable_libvirt
5342 load . . . . . . . . $enable_load
5343 logfile . . . . . . . $enable_logfile
5344 lpar . . . . . . . . $enable_lpar
5345 madwifi . . . . . . . $enable_madwifi
5346 match_empty_counter . $enable_match_empty_counter
5347 match_hashed . . . . $enable_match_hashed
5348 match_regex . . . . . $enable_match_regex
5349 match_timediff . . . $enable_match_timediff
5350 match_value . . . . . $enable_match_value
5351 mbmon . . . . . . . . $enable_mbmon
5352 md . . . . . . . . . $enable_md
5353 memcachec . . . . . . $enable_memcachec
5354 memcached . . . . . . $enable_memcached
5355 memory . . . . . . . $enable_memory
5356 modbus . . . . . . . $enable_modbus
5357 multimeter . . . . . $enable_multimeter
5358 mysql . . . . . . . . $enable_mysql
5359 netapp . . . . . . . $enable_netapp
5360 netlink . . . . . . . $enable_netlink
5361 network . . . . . . . $enable_network
5362 nfs . . . . . . . . . $enable_nfs
5363 nginx . . . . . . . . $enable_nginx
5364 notify_desktop . . . $enable_notify_desktop
5365 notify_email . . . . $enable_notify_email
5366 ntpd . . . . . . . . $enable_ntpd
5367 numa . . . . . . . . $enable_numa
5368 nut . . . . . . . . . $enable_nut
5369 olsrd . . . . . . . . $enable_olsrd
5370 onewire . . . . . . . $enable_onewire
5371 openvpn . . . . . . . $enable_openvpn
5372 oracle . . . . . . . $enable_oracle
5373 perl . . . . . . . . $enable_perl
5374 pf . . . . . . . . . $enable_pf
5375 pinba . . . . . . . . $enable_pinba
5376 ping . . . . . . . . $enable_ping
5377 postgresql . . . . . $enable_postgresql
5378 powerdns . . . . . . $enable_powerdns
5379 processes . . . . . . $enable_processes
5380 protocols . . . . . . $enable_protocols
5381 python . . . . . . . $enable_python
5382 redis . . . . . . . . $enable_redis
5383 routeros . . . . . . $enable_routeros
5384 rrdcached . . . . . . $enable_rrdcached
5385 rrdtool . . . . . . . $enable_rrdtool
5386 sensors . . . . . . . $enable_sensors
5387 serial . . . . . . . $enable_serial
5388 snmp . . . . . . . . $enable_snmp
5389 swap . . . . . . . . $enable_swap
5390 syslog . . . . . . . $enable_syslog
5391 table . . . . . . . . $enable_table
5392 tail . . . . . . . . $enable_tail
5393 tail_csv . . . . . . $enable_tail_csv
5394 tape . . . . . . . . $enable_tape
5395 target_notification . $enable_target_notification
5396 target_replace . . . $enable_target_replace
5397 target_scale . . . . $enable_target_scale
5398 target_set . . . . . $enable_target_set
5399 target_v5upgrade . . $enable_target_v5upgrade
5400 tcpconns . . . . . . $enable_tcpconns
5401 teamspeak2 . . . . . $enable_teamspeak2
5402 ted . . . . . . . . . $enable_ted
5403 thermal . . . . . . . $enable_thermal
5404 threshold . . . . . . $enable_threshold
5405 tokyotyrant . . . . . $enable_tokyotyrant
5406 unixsock . . . . . . $enable_unixsock
5407 uptime . . . . . . . $enable_uptime
5408 users . . . . . . . . $enable_users
5409 uuid . . . . . . . . $enable_uuid
5410 varnish . . . . . . . $enable_varnish
5411 vmem . . . . . . . . $enable_vmem
5412 vserver . . . . . . . $enable_vserver
5413 wireless . . . . . . $enable_wireless
5414 write_graphite . . . $enable_write_graphite
5415 write_http . . . . . $enable_write_http
5416 write_mongodb . . . . $enable_write_mongodb
5417 write_redis . . . . . $enable_write_redis
5418 write_riemann . . . . $enable_write_riemann
5419 xmms . . . . . . . . $enable_xmms
5420 zfs_arc . . . . . . . $enable_zfs_arc
5422 EOF
5424 if test "x$dependency_error" = "xyes"; then
5425 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5426 fi
5428 if test "x$dependency_warning" = "xyes"; then
5429 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5430 fi
5432 # vim: set fdm=marker :