bc431fec12170fbfabd252cbd5fc2b202f7c464e
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 ]]]
1165 )],
1166 [c_cv_have_one_getmntent="yes"],
1167 [c_cv_have_one_getmntent="no"]
1168 )
1169 )
1170 AC_CACHE_CHECK([whether getmntent takes two arguments],
1171 [c_cv_have_two_getmntent],
1172 AC_COMPILE_IFELSE(
1173 [AC_LANG_PROGRAM(
1174 [[[
1175 #include "$srcdir/src/utils_mount.h"
1176 ]]],
1177 [[[
1178 FILE *fh;
1179 struct mnttab mt;
1180 int status;
1181 fh = fopen ("/etc/mnttab", "r");
1182 status = getmntent (fh, &mt);
1183 ]]]
1184 )],
1185 [c_cv_have_two_getmntent="yes"],
1186 [c_cv_have_two_getmntent="no"]
1187 )
1188 )
1189 fi
1191 # Check for different versions of `getmntent' here..
1193 if test "x$have_getmntent" = "xc"; then
1194 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1195 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1196 [Define if the function getmntent exists and takes one argument.])
1197 fi
1198 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1199 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1200 [Define if the function getmntent exists and takes two arguments.])
1201 fi
1202 fi
1203 if test "x$have_getmntent" = "xsun"; then
1204 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1205 [Define if the function getmntent exists. It's the version from libsun.])
1206 fi
1207 if test "x$have_getmntent" = "xseq"; then
1208 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1209 [Define if the function getmntent exists. It's the version from libseq.])
1210 fi
1211 if test "x$have_getmntent" = "xgen"; then
1212 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1213 [Define if the function getmntent exists. It's the version from libgen.])
1214 fi
1216 # Check for htonll
1217 AC_CACHE_CHECK([if have htonll defined],
1218 [c_cv_have_htonll],
1219 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1220 [[[
1221 #include <sys/types.h>
1222 #include <netinet/in.h>
1223 #if HAVE_INTTYPES_H
1224 # include <inttypes.h>
1225 #endif
1226 ]]],
1227 [[[
1228 return htonll(0);
1229 ]]]
1230 )],
1231 [c_cv_have_htonll="yes"],
1232 [c_cv_have_htonll="no"]
1233 )
1234 )
1235 if test "x$c_cv_have_htonll" = "xyes"
1236 then
1237 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1238 fi
1240 # Check for structures
1241 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1242 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1243 [],
1244 [
1245 #include <sys/types.h>
1246 #include <sys/socket.h>
1247 #include <net/if.h>
1248 ])
1249 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1250 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1251 [],
1252 [
1253 #include <sys/types.h>
1254 #include <sys/socket.h>
1255 #include <linux/if.h>
1256 #include <linux/netdevice.h>
1257 ])
1258 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1259 [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1260 [],
1261 [
1262 #include <linux/inet_diag.h>
1263 ])
1266 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1267 [],
1268 [
1269 #include <netinet/in.h>
1270 #include <net/if.h>
1271 ])
1273 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1274 [
1275 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1276 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1277 have_struct_kinfo_proc_freebsd="yes"
1278 ],
1279 [
1280 have_struct_kinfo_proc_freebsd="no"
1281 ],
1282 [
1283 #include <kvm.h>
1284 #include <sys/param.h>
1285 #include <sys/sysctl.h>
1286 #include <sys/user.h>
1287 ])
1289 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1290 [
1291 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1292 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1293 have_struct_kinfo_proc_openbsd="yes"
1294 ],
1295 [
1296 have_struct_kinfo_proc_openbsd="no"
1297 ],
1298 [
1299 #include <sys/param.h>
1300 #include <sys/sysctl.h>
1301 #include <kvm.h>
1302 ])
1304 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1305 [#define _BSD_SOURCE
1306 #if HAVE_STDINT_H
1307 # include <stdint.h>
1308 #endif
1309 #if HAVE_SYS_TYPES_H
1310 # include <sys/types.h>
1311 #endif
1312 #if HAVE_NETINET_IN_SYSTM_H
1313 # include <netinet/in_systm.h>
1314 #endif
1315 #if HAVE_NETINET_IN_H
1316 # include <netinet/in.h>
1317 #endif
1318 #if HAVE_NETINET_IP_H
1319 # include <netinet/ip.h>
1320 #endif
1321 #if HAVE_NETINET_UDP_H
1322 # include <netinet/udp.h>
1323 #endif
1324 ])
1325 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1326 [#define _BSD_SOURCE
1327 #if HAVE_STDINT_H
1328 # include <stdint.h>
1329 #endif
1330 #if HAVE_SYS_TYPES_H
1331 # include <sys/types.h>
1332 #endif
1333 #if HAVE_NETINET_IN_SYSTM_H
1334 # include <netinet/in_systm.h>
1335 #endif
1336 #if HAVE_NETINET_IN_H
1337 # include <netinet/in.h>
1338 #endif
1339 #if HAVE_NETINET_IP_H
1340 # include <netinet/ip.h>
1341 #endif
1342 #if HAVE_NETINET_UDP_H
1343 # include <netinet/udp.h>
1344 #endif
1345 ])
1347 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1348 [],
1349 [],
1350 [
1351 #if HAVE_KSTAT_H
1352 # include <kstat.h>
1353 #endif
1354 ])
1356 #
1357 # Checks for libraries begin here
1358 #
1360 with_libresolv="yes"
1361 AC_CHECK_LIB(resolv, res_search,
1362 [
1363 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1364 ],
1365 [with_libresolv="no"])
1366 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1368 dnl Check for HAL (hardware abstraction library)
1369 with_libhal="yes"
1370 AC_CHECK_LIB(hal,libhal_device_property_exists,
1371 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1372 [with_libhal="no"])
1373 if test "x$with_libhal" = "xyes"; then
1374 if test "x$PKG_CONFIG" != "x"; then
1375 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1376 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1377 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1378 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1379 fi
1380 fi
1382 m4_divert_once([HELP_WITH], [
1383 collectd additional packages:])
1385 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1387 if test "x$ac_system" = "xAIX"
1388 then
1389 with_perfstat="yes"
1390 with_procinfo="yes"
1391 else
1392 with_perfstat="no (AIX only)"
1393 with_procinfo="no (AIX only)"
1394 fi
1396 if test "x$with_perfstat" = "xyes"
1397 then
1398 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1399 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1400 fi
1401 if test "x$with_perfstat" = "xyes"
1402 then
1403 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1404 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1405 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1406 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1407 then
1408 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1409 fi
1410 fi
1411 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1413 # Processes plugin under AIX.
1414 if test "x$with_procinfo" = "xyes"
1415 then
1416 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1417 fi
1418 if test "x$with_procinfo" = "xyes"
1419 then
1420 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1421 fi
1423 if test "x$ac_system" = "xSolaris"
1424 then
1425 with_kstat="yes"
1426 with_devinfo="yes"
1427 else
1428 with_kstat="no (Solaris only)"
1429 with_devinfo="no (Solaris only)"
1430 fi
1432 if test "x$with_kstat" = "xyes"
1433 then
1434 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1435 fi
1436 if test "x$with_kstat" = "xyes"
1437 then
1438 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1439 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1440 fi
1441 if test "x$with_kstat" = "xyes"
1442 then
1443 AC_DEFINE(HAVE_LIBKSTAT, 1,
1444 [Define to 1 if you have the 'kstat' library (-lkstat)])
1445 fi
1446 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1447 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1449 with_libiokit="no"
1450 if test "x$ac_system" = "xDarwin"
1451 then
1452 with_libiokit="yes"
1453 else
1454 with_libiokit="no"
1455 fi
1456 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1458 with_libkvm="no"
1459 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1460 if test "x$with_kvm_getprocs" = "xyes"
1461 then
1462 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1463 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1464 with_libkvm="yes"
1465 fi
1466 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1468 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1469 if test "x$with_kvm_getswapinfo" = "xyes"
1470 then
1471 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1472 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1473 with_libkvm="yes"
1474 fi
1475 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1477 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1478 if test "x$with_kvm_nlist" = "xyes"
1479 then
1480 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1481 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1482 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1483 with_libkvm="yes"
1484 fi
1485 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1487 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1488 if test "x$with_kvm_openfiles" = "xyes"
1489 then
1490 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1491 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1492 with_libkvm="yes"
1493 fi
1494 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1496 # --with-libcredis {{{
1497 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1498 [
1499 if test "x$withval" = "xyes"
1500 then
1501 with_libcredis="yes"
1502 else if test "x$withval" = "xno"
1503 then
1504 with_libcredis="no"
1505 else
1506 with_libcredis="yes"
1507 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1508 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1509 fi; fi
1510 ],
1511 [with_libcredis="yes"])
1513 SAVE_CPPFLAGS="$CPPFLAGS"
1514 SAVE_LDFLAGS="$LDFLAGS"
1516 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1517 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1519 if test "x$with_libcredis" = "xyes"
1520 then
1521 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1522 then
1523 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1524 fi
1525 AC_CHECK_HEADERS(credis.h,
1526 [with_libcredis="yes"],
1527 [with_libcredis="no (credis.h not found)"])
1528 fi
1529 if test "x$with_libcredis" = "xyes"
1530 then
1531 if test "x$LIBCREDIS_LDFLAGS" != "x"
1532 then
1533 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1534 fi
1535 AC_CHECK_LIB(credis, credis_info,
1536 [with_libcredis="yes"],
1537 [with_libcredis="no (symbol 'credis_info' not found)"])
1539 fi
1541 CPPFLAGS="$SAVE_CPPFLAGS"
1542 LDFLAGS="$SAVE_LDFLAGS"
1544 if test "x$with_libcredis" = "xyes"
1545 then
1546 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1547 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1548 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1549 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1550 fi
1551 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1552 # }}}
1554 # --with-libcurl {{{
1555 with_curl_config="curl-config"
1556 with_curl_cflags=""
1557 with_curl_libs=""
1558 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1559 [
1560 if test "x$withval" = "xno"
1561 then
1562 with_libcurl="no"
1563 else if test "x$withval" = "xyes"
1564 then
1565 with_libcurl="yes"
1566 else
1567 if test -f "$withval" && test -x "$withval"
1568 then
1569 with_curl_config="$withval"
1570 with_libcurl="yes"
1571 else if test -x "$withval/bin/curl-config"
1572 then
1573 with_curl_config="$withval/bin/curl-config"
1574 with_libcurl="yes"
1575 fi; fi
1576 with_libcurl="yes"
1577 fi; fi
1578 ],
1579 [
1580 with_libcurl="yes"
1581 ])
1582 if test "x$with_libcurl" = "xyes"
1583 then
1584 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1585 curl_config_status=$?
1587 if test $curl_config_status -ne 0
1588 then
1589 with_libcurl="no ($with_curl_config failed)"
1590 else
1591 SAVE_CPPFLAGS="$CPPFLAGS"
1592 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1594 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1596 CPPFLAGS="$SAVE_CPPFLAGS"
1597 fi
1598 fi
1599 if test "x$with_libcurl" = "xyes"
1600 then
1601 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1602 curl_config_status=$?
1604 if test $curl_config_status -ne 0
1605 then
1606 with_libcurl="no ($with_curl_config failed)"
1607 else
1608 AC_CHECK_LIB(curl, curl_easy_init,
1609 [with_libcurl="yes"],
1610 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1611 [$with_curl_libs])
1612 fi
1613 fi
1614 if test "x$with_libcurl" = "xyes"
1615 then
1616 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1617 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1618 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1619 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1620 fi
1621 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1622 # }}}
1624 # --with-libdbi {{{
1625 with_libdbi_cppflags=""
1626 with_libdbi_ldflags=""
1627 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1628 [
1629 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1630 then
1631 with_libdbi_cppflags="-I$withval/include"
1632 with_libdbi_ldflags="-L$withval/lib"
1633 with_libdbi="yes"
1634 else
1635 with_libdbi="$withval"
1636 fi
1637 ],
1638 [
1639 with_libdbi="yes"
1640 ])
1641 if test "x$with_libdbi" = "xyes"
1642 then
1643 SAVE_CPPFLAGS="$CPPFLAGS"
1644 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1646 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1648 CPPFLAGS="$SAVE_CPPFLAGS"
1649 fi
1650 if test "x$with_libdbi" = "xyes"
1651 then
1652 SAVE_CPPFLAGS="$CPPFLAGS"
1653 SAVE_LDFLAGS="$LDFLAGS"
1654 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1655 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1657 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1659 CPPFLAGS="$SAVE_CPPFLAGS"
1660 LDFLAGS="$SAVE_LDFLAGS"
1661 fi
1662 if test "x$with_libdbi" = "xyes"
1663 then
1664 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1665 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1666 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1667 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1668 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1669 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1670 fi
1671 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1672 # }}}
1674 # --with-libesmtp {{{
1675 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1676 [
1677 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1678 then
1679 LDFLAGS="$LDFLAGS -L$withval/lib"
1680 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1681 with_libesmtp="yes"
1682 else
1683 with_libesmtp="$withval"
1684 fi
1685 ],
1686 [
1687 with_libesmtp="yes"
1688 ])
1689 if test "x$with_libesmtp" = "xyes"
1690 then
1691 AC_CHECK_LIB(esmtp, smtp_create_session,
1692 [
1693 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1694 ], [with_libesmtp="no (libesmtp not found)"])
1695 fi
1696 if test "x$with_libesmtp" = "xyes"
1697 then
1698 AC_CHECK_HEADERS(libesmtp.h,
1699 [
1700 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1701 ], [with_libesmtp="no (libesmtp.h not found)"])
1702 fi
1703 if test "x$with_libesmtp" = "xyes"
1704 then
1705 collect_libesmtp=1
1706 else
1707 collect_libesmtp=0
1708 fi
1709 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1710 [Wether or not to use the esmtp library])
1711 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1712 # }}}
1714 # --with-libganglia {{{
1715 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1716 [
1717 if test -f "$withval" && test -x "$withval"
1718 then
1719 with_libganglia_config="$withval"
1720 with_libganglia="yes"
1721 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1722 then
1723 with_libganglia_config="$withval/bin/ganglia-config"
1724 with_libganglia="yes"
1725 else if test -d "$withval"
1726 then
1727 GANGLIA_CPPFLAGS="-I$withval/include"
1728 GANGLIA_LDFLAGS="-L$withval/lib"
1729 with_libganglia="yes"
1730 else
1731 with_libganglia_config="ganglia-config"
1732 with_libganglia="$withval"
1733 fi; fi; fi
1734 ],
1735 [
1736 with_libganglia_config="ganglia-config"
1737 with_libganglia="yes"
1738 ])
1740 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1741 then
1742 if test "x$GANGLIA_CPPFLAGS" = "x"
1743 then
1744 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1745 fi
1747 if test "x$GANGLIA_LDFLAGS" = "x"
1748 then
1749 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1750 fi
1752 if test "x$GANGLIA_LIBS" = "x"
1753 then
1754 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1755 fi
1756 fi
1758 SAVE_CPPFLAGS="$CPPFLAGS"
1759 SAVE_LDFLAGS="$LDFLAGS"
1760 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1761 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1763 if test "x$with_libganglia" = "xyes"
1764 then
1765 AC_CHECK_HEADERS(gm_protocol.h,
1766 [
1767 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1768 [Define to 1 if you have the <gm_protocol.h> header file.])
1769 ], [with_libganglia="no (gm_protocol.h not found)"])
1770 fi
1772 if test "x$with_libganglia" = "xyes"
1773 then
1774 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1775 [
1776 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1777 [Define to 1 if you have the ganglia library (-lganglia).])
1778 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1779 fi
1781 CPPFLAGS="$SAVE_CPPFLAGS"
1782 LDFLAGS="$SAVE_LDFLAGS"
1784 AC_SUBST(GANGLIA_CPPFLAGS)
1785 AC_SUBST(GANGLIA_LDFLAGS)
1786 AC_SUBST(GANGLIA_LIBS)
1787 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1788 # }}}
1790 # --with-libgcrypt {{{
1791 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1792 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1793 GCRYPT_LIBS="$GCRYPT_LIBS"
1794 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1795 [
1796 if test -f "$withval" && test -x "$withval"
1797 then
1798 with_libgcrypt_config="$withval"
1799 with_libgcrypt="yes"
1800 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1801 then
1802 with_libgcrypt_config="$withval/bin/gcrypt-config"
1803 with_libgcrypt="yes"
1804 else if test -d "$withval"
1805 then
1806 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1807 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1808 with_libgcrypt="yes"
1809 else
1810 with_libgcrypt_config="gcrypt-config"
1811 with_libgcrypt="$withval"
1812 fi; fi; fi
1813 ],
1814 [
1815 with_libgcrypt_config="libgcrypt-config"
1816 with_libgcrypt="yes"
1817 ])
1819 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1820 then
1821 if test "x$GCRYPT_CPPFLAGS" = "x"
1822 then
1823 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1824 fi
1826 if test "x$GCRYPT_LDFLAGS" = "x"
1827 then
1828 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1829 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1830 fi
1832 if test "x$GCRYPT_LIBS" = "x"
1833 then
1834 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1835 fi
1836 fi
1838 SAVE_CPPFLAGS="$CPPFLAGS"
1839 SAVE_LDFLAGS="$LDFLAGS"
1840 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1841 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1843 if test "x$with_libgcrypt" = "xyes"
1844 then
1845 if test "x$GCRYPT_CPPFLAGS" != "x"
1846 then
1847 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1848 fi
1849 AC_CHECK_HEADERS(gcrypt.h,
1850 [with_libgcrypt="yes"],
1851 [with_libgcrypt="no (gcrypt.h not found)"])
1852 fi
1854 if test "x$with_libgcrypt" = "xyes"
1855 then
1856 if test "x$GCRYPT_LDFLAGS" != "x"
1857 then
1858 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1859 fi
1860 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1861 [with_libgcrypt="yes"],
1862 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1864 if test "$with_libgcrypt" != "no"; then
1865 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
1866 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1867 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1868 fi
1869 fi
1871 CPPFLAGS="$SAVE_CPPFLAGS"
1872 LDFLAGS="$SAVE_LDFLAGS"
1874 if test "x$with_libgcrypt" = "xyes"
1875 then
1876 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1877 fi
1879 AC_SUBST(GCRYPT_CPPFLAGS)
1880 AC_SUBST(GCRYPT_LDFLAGS)
1881 AC_SUBST(GCRYPT_LIBS)
1882 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1883 # }}}
1885 # --with-libiptc {{{
1886 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1887 [
1888 if test "x$withval" = "xshipped"
1889 then
1890 with_libiptc="own"
1891 else if test "x$withval" = "xyes"
1892 then
1893 with_libiptc="pkgconfig"
1894 else if test "x$withval" = "xno"
1895 then
1896 with_libiptc="no"
1897 else
1898 with_libiptc="yes"
1899 with_libiptc_cflags="-I$withval/include"
1900 with_libiptc_libs="-L$withval/lib"
1901 fi; fi; fi
1902 ],
1903 [
1904 if test "x$ac_system" = "xLinux"
1905 then
1906 with_libiptc="pkgconfig"
1907 else
1908 with_libiptc="no (Linux only)"
1909 fi
1910 ])
1912 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1913 then
1914 with_libiptc="no (Don't have pkg-config)"
1915 fi
1917 if test "x$with_libiptc" = "xpkgconfig"
1918 then
1919 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1920 if test $? -ne 0
1921 then
1922 with_libiptc="no (pkg-config doesn't know libiptc)"
1923 fi
1924 fi
1925 if test "x$with_libiptc" = "xpkgconfig"
1926 then
1927 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1928 if test $? -ne 0
1929 then
1930 with_libiptc="no ($PKG_CONFIG failed)"
1931 fi
1932 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1933 if test $? -ne 0
1934 then
1935 with_libiptc="no ($PKG_CONFIG failed)"
1936 fi
1937 fi
1939 SAVE_CPPFLAGS="$CPPFLAGS"
1940 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1942 # check whether the header file for libiptc is available.
1943 if test "x$with_libiptc" = "xpkgconfig"
1944 then
1945 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1946 [with_libiptc="no (header file missing)"])
1947 fi
1948 # If the header file is available, check for the required type declaractions.
1949 # They may be missing in old versions of libiptc. In that case, they will be
1950 # declared in the iptables plugin.
1951 if test "x$with_libiptc" = "xpkgconfig"
1952 then
1953 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1954 fi
1955 # Check for the iptc_init symbol in the library.
1956 # This could be in iptc or ip4tc
1957 if test "x$with_libiptc" = "xpkgconfig"
1958 then
1959 SAVE_LIBS="$LIBS"
1960 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1961 [with_libiptc="pkgconfig"],
1962 [with_libiptc="no"],
1963 [$with_libiptc_libs])
1964 LIBS="$SAVE_LIBS"
1965 fi
1966 if test "x$with_libiptc" = "xpkgconfig"
1967 then
1968 with_libiptc="yes"
1969 fi
1971 CPPFLAGS="$SAVE_CPPFLAGS"
1973 if test "x$with_libiptc" = "xown"
1974 then
1975 with_libiptc_cflags=""
1976 with_libiptc_libs=""
1977 fi
1978 if test "x$with_libiptc" = "xown"
1979 then
1980 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1981 [
1982 with_libiptc="no (Linux iptables headers not found)"
1983 ],
1984 [
1985 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1986 ])
1987 fi
1988 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1989 if test "x$with_libiptc" = "xown"
1990 then
1991 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1992 with_libiptc="yes"
1993 fi
1995 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1996 if test "x$with_libiptc" = "xyes"
1997 then
1998 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1999 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2000 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2001 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2002 fi
2003 # }}}
2005 # --with-java {{{
2006 with_java_home="$JAVA_HOME"
2007 if test "x$with_java_home" = "x"
2008 then
2009 with_java_home="/usr/lib/jvm"
2010 fi
2011 with_java_vmtype="client"
2012 with_java_cflags=""
2013 with_java_libs=""
2014 JAVAC="$JAVAC"
2015 JAR="$JAR"
2016 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2017 [
2018 if test "x$withval" = "xno"
2019 then
2020 with_java="no"
2021 else if test "x$withval" = "xyes"
2022 then
2023 with_java="yes"
2024 else
2025 with_java_home="$withval"
2026 with_java="yes"
2027 fi; fi
2028 ],
2029 [with_java="yes"])
2030 if test "x$with_java" = "xyes"
2031 then
2032 if test -d "$with_java_home"
2033 then
2034 AC_MSG_CHECKING([for jni.h])
2035 TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2036 if test "x$TMPVAR" != "x"
2037 then
2038 AC_MSG_RESULT([found in $TMPVAR])
2039 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2040 else
2041 AC_MSG_RESULT([not found])
2042 fi
2044 AC_MSG_CHECKING([for jni_md.h])
2045 TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2046 if test "x$TMPVAR" != "x"
2047 then
2048 AC_MSG_RESULT([found in $TMPVAR])
2049 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2050 else
2051 AC_MSG_RESULT([not found])
2052 fi
2054 AC_MSG_CHECKING([for libjvm.so])
2055 TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2056 if test "x$TMPVAR" != "x"
2057 then
2058 AC_MSG_RESULT([found in $TMPVAR])
2059 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2060 else
2061 AC_MSG_RESULT([not found])
2062 fi
2064 if test "x$JAVAC" = "x"
2065 then
2066 AC_MSG_CHECKING([for javac])
2067 TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2068 if test "x$TMPVAR" != "x"
2069 then
2070 JAVAC="$TMPVAR"
2071 AC_MSG_RESULT([$JAVAC])
2072 else
2073 AC_MSG_RESULT([not found])
2074 fi
2075 fi
2076 if test "x$JAR" = "x"
2077 then
2078 AC_MSG_CHECKING([for jar])
2079 TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2080 if test "x$TMPVAR" != "x"
2081 then
2082 JAR="$TMPVAR"
2083 AC_MSG_RESULT([$JAR])
2084 else
2085 AC_MSG_RESULT([not found])
2086 fi
2087 fi
2088 else if test "x$with_java_home" != "x"
2089 then
2090 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2091 fi; fi
2092 fi
2094 if test "x$JAVA_CPPFLAGS" != "x"
2095 then
2096 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2097 fi
2098 if test "x$JAVA_CFLAGS" != "x"
2099 then
2100 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2101 fi
2102 if test "x$JAVA_LDFLAGS" != "x"
2103 then
2104 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2105 fi
2106 if test "x$JAVAC" = "x"
2107 then
2108 with_javac_path="$PATH"
2109 if test "x$with_java_home" != "x"
2110 then
2111 with_javac_path="$with_java_home:with_javac_path"
2112 if test -d "$with_java_home/bin"
2113 then
2114 with_javac_path="$with_java_home/bin:with_javac_path"
2115 fi
2116 fi
2118 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2119 fi
2120 if test "x$JAVAC" = "x"
2121 then
2122 with_java="no (javac not found)"
2123 fi
2124 if test "x$JAR" = "x"
2125 then
2126 with_jar_path="$PATH"
2127 if test "x$with_java_home" != "x"
2128 then
2129 with_jar_path="$with_java_home:$with_jar_path"
2130 if test -d "$with_java_home/bin"
2131 then
2132 with_jar_path="$with_java_home/bin:$with_jar_path"
2133 fi
2134 fi
2136 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2137 fi
2138 if test "x$JAR" = "x"
2139 then
2140 with_java="no (jar not found)"
2141 fi
2143 SAVE_CPPFLAGS="$CPPFLAGS"
2144 SAVE_CFLAGS="$CFLAGS"
2145 SAVE_LDFLAGS="$LDFLAGS"
2146 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2147 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2148 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2150 if test "x$with_java" = "xyes"
2151 then
2152 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2153 fi
2154 if test "x$with_java" = "xyes"
2155 then
2156 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2157 [with_java="yes"],
2158 [with_java="no (libjvm not found)"],
2159 [$JAVA_LIBS])
2160 fi
2161 if test "x$with_java" = "xyes"
2162 then
2163 JAVA_LIBS="$JAVA_LIBS -ljvm"
2164 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2165 fi
2167 CPPFLAGS="$SAVE_CPPFLAGS"
2168 CFLAGS="$SAVE_CFLAGS"
2169 LDFLAGS="$SAVE_LDFLAGS"
2171 AC_SUBST(JAVA_CPPFLAGS)
2172 AC_SUBST(JAVA_CFLAGS)
2173 AC_SUBST(JAVA_LDFLAGS)
2174 AC_SUBST(JAVA_LIBS)
2175 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2176 # }}}
2178 # --with-libmemcached {{{
2179 with_libmemcached_cppflags=""
2180 with_libmemcached_ldflags=""
2181 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2182 [
2183 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2184 then
2185 with_libmemcached_cppflags="-I$withval/include"
2186 with_libmemcached_ldflags="-L$withval/lib"
2187 with_libmemcached="yes"
2188 else
2189 with_libmemcached="$withval"
2190 fi
2191 ],
2192 [
2193 with_libmemcached="yes"
2194 ])
2195 if test "x$with_libmemcached" = "xyes"
2196 then
2197 SAVE_CPPFLAGS="$CPPFLAGS"
2198 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2200 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2202 CPPFLAGS="$SAVE_CPPFLAGS"
2203 fi
2204 if test "x$with_libmemcached" = "xyes"
2205 then
2206 SAVE_CPPFLAGS="$CPPFLAGS"
2207 SAVE_LDFLAGS="$LDFLAGS"
2208 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2209 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2211 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2213 CPPFLAGS="$SAVE_CPPFLAGS"
2214 LDFLAGS="$SAVE_LDFLAGS"
2215 fi
2216 if test "x$with_libmemcached" = "xyes"
2217 then
2218 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2219 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2220 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2221 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2222 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2223 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2224 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2225 fi
2226 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2227 # }}}
2229 # --with-libmodbus {{{
2230 with_libmodbus_config=""
2231 with_libmodbus_cflags=""
2232 with_libmodbus_libs=""
2233 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2234 [
2235 if test "x$withval" = "xno"
2236 then
2237 with_libmodbus="no"
2238 else if test "x$withval" = "xyes"
2239 then
2240 with_libmodbus="use_pkgconfig"
2241 else if test -d "$with_libmodbus/lib"
2242 then
2243 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2244 with_libmodbus_cflags="-I$withval/include"
2245 with_libmodbus_libs="-L$withval/lib -lmodbus"
2246 with_libmodbus="yes"
2247 fi; fi; fi
2248 ],
2249 [with_libmodbus="use_pkgconfig"])
2251 # configure using pkg-config
2252 if test "x$with_libmodbus" = "xuse_pkgconfig"
2253 then
2254 if test "x$PKG_CONFIG" = "x"
2255 then
2256 with_libmodbus="no (Don't have pkg-config)"
2257 fi
2258 fi
2259 if test "x$with_libmodbus" = "xuse_pkgconfig"
2260 then
2261 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2262 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2263 if test $? -ne 0
2264 then
2265 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2266 fi
2267 fi
2268 if test "x$with_libmodbus" = "xuse_pkgconfig"
2269 then
2270 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2271 if test $? -ne 0
2272 then
2273 with_libmodbus="no ($PKG_CONFIG failed)"
2274 fi
2275 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2276 if test $? -ne 0
2277 then
2278 with_libmodbus="no ($PKG_CONFIG failed)"
2279 fi
2280 fi
2281 if test "x$with_libmodbus" = "xuse_pkgconfig"
2282 then
2283 with_libmodbus="yes"
2284 fi
2286 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2287 # the actual checks.
2288 if test "x$with_libmodbus" = "xyes"
2289 then
2290 SAVE_CPPFLAGS="$CPPFLAGS"
2291 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2293 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2295 CPPFLAGS="$SAVE_CPPFLAGS"
2296 fi
2297 if test "x$with_libmodbus" = "xyes"
2298 then
2299 SAVE_CPPFLAGS="$CPPFLAGS"
2300 SAVE_LDFLAGS="$LDFLAGS"
2302 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2303 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2305 AC_CHECK_LIB(modbus, modbus_connect,
2306 [with_libmodbus="yes"],
2307 [with_libmodbus="no (symbol modbus_connect not found)"])
2309 CPPFLAGS="$SAVE_CPPFLAGS"
2310 LDFLAGS="$SAVE_LDFLAGS"
2311 fi
2312 if test "x$with_libmodbus" = "xyes"
2313 then
2314 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2315 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2316 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2317 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2318 fi
2319 # }}}
2321 # --with-libmongoc {{{
2322 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2323 [
2324 if test "x$withval" = "xyes"
2325 then
2326 with_libmongoc="yes"
2327 else if test "x$withval" = "xno"
2328 then
2329 with_libmongoc="no"
2330 else
2331 with_libmongoc="yes"
2332 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2333 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2334 fi; fi
2335 ],
2336 [with_libmongoc="yes"])
2338 SAVE_CPPFLAGS="$CPPFLAGS"
2339 SAVE_LDFLAGS="$LDFLAGS"
2341 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2342 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2344 if test "x$with_libmongoc" = "xyes"
2345 then
2346 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2347 then
2348 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2349 fi
2350 AC_CHECK_HEADERS(mongo.h,
2351 [with_libmongoc="yes"],
2352 [with_libmongoc="no ('mongo.h' not found)"],
2353 [#if HAVE_STDINT_H
2354 # define MONGO_HAVE_STDINT 1
2355 #else
2356 # define MONGO_USE_LONG_LONG_INT 1
2357 #endif
2358 ])
2359 fi
2360 if test "x$with_libmongoc" = "xyes"
2361 then
2362 if test "x$LIBMONGOC_LDFLAGS" != "x"
2363 then
2364 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2365 fi
2366 AC_CHECK_LIB(mongoc, mongo_run_command,
2367 [with_libmongoc="yes"],
2368 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2369 fi
2371 CPPFLAGS="$SAVE_CPPFLAGS"
2372 LDFLAGS="$SAVE_LDFLAGS"
2374 if test "x$with_libmongoc" = "xyes"
2375 then
2376 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2377 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2378 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2379 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2380 fi
2381 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2382 # }}}
2384 # --with-libmysql {{{
2385 with_mysql_config="mysql_config"
2386 with_mysql_cflags=""
2387 with_mysql_libs=""
2388 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2389 [
2390 if test "x$withval" = "xno"
2391 then
2392 with_libmysql="no"
2393 else if test "x$withval" = "xyes"
2394 then
2395 with_libmysql="yes"
2396 else
2397 if test -f "$withval" && test -x "$withval";
2398 then
2399 with_mysql_config="$withval"
2400 else if test -x "$withval/bin/mysql_config"
2401 then
2402 with_mysql_config="$withval/bin/mysql_config"
2403 fi; fi
2404 with_libmysql="yes"
2405 fi; fi
2406 ],
2407 [
2408 with_libmysql="yes"
2409 ])
2410 if test "x$with_libmysql" = "xyes"
2411 then
2412 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2413 mysql_config_status=$?
2415 if test $mysql_config_status -ne 0
2416 then
2417 with_libmysql="no ($with_mysql_config failed)"
2418 else
2419 SAVE_CPPFLAGS="$CPPFLAGS"
2420 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2422 have_mysql_h="no"
2423 have_mysql_mysql_h="no"
2424 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2426 if test "x$have_mysql_h" = "xno"
2427 then
2428 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2429 fi
2431 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2432 then
2433 with_libmysql="no (mysql.h not found)"
2434 fi
2436 CPPFLAGS="$SAVE_CPPFLAGS"
2437 fi
2438 fi
2439 if test "x$with_libmysql" = "xyes"
2440 then
2441 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2442 mysql_config_status=$?
2444 if test $mysql_config_status -ne 0
2445 then
2446 with_libmysql="no ($with_mysql_config failed)"
2447 else
2448 AC_CHECK_LIB(mysqlclient, mysql_init,
2449 [with_libmysql="yes"],
2450 [with_libmysql="no (symbol 'mysql_init' not found)"],
2451 [$with_mysql_libs])
2453 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2454 [with_libmysql="yes"],
2455 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2456 [$with_mysql_libs])
2457 fi
2458 fi
2459 if test "x$with_libmysql" = "xyes"
2460 then
2461 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2462 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2463 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2464 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2465 fi
2466 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2467 # }}}
2469 # --with-libnetlink {{{
2470 with_libnetlink_cflags=""
2471 with_libnetlink_libs="-lnetlink"
2472 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2473 [
2474 echo "libnetlink: withval = $withval"
2475 if test "x$withval" = "xyes"
2476 then
2477 with_libnetlink="yes"
2478 else if test "x$withval" = "xno"
2479 then
2480 with_libnetlink="no"
2481 else
2482 if test -d "$withval/include"
2483 then
2484 with_libnetlink_cflags="-I$withval/include"
2485 with_libnetlink_libs="-L$withval/lib -lnetlink"
2486 with_libnetlink="yes"
2487 else
2488 AC_MSG_ERROR("no such directory: $withval/include")
2489 fi
2490 fi; fi
2491 ],
2492 [
2493 if test "x$ac_system" = "xLinux"
2494 then
2495 with_libnetlink="yes"
2496 else
2497 with_libnetlink="no (Linux only library)"
2498 fi
2499 ])
2500 if test "x$with_libnetlink" = "xyes"
2501 then
2502 SAVE_CFLAGS="$CFLAGS"
2503 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2505 with_libnetlink="no (libnetlink.h not found)"
2507 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2508 [
2509 with_libnetlink="yes"
2510 break
2511 ], [],
2512 [#include <stdio.h>
2513 #include <sys/types.h>
2514 #include <asm/types.h>
2515 #include <sys/socket.h>
2516 #include <linux/netlink.h>
2517 #include <linux/rtnetlink.h>])
2518 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2519 [#include <stdio.h>
2520 #include <sys/types.h>
2521 #include <asm/types.h>
2522 #include <sys/socket.h>])
2524 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2525 [[[
2526 #include <stdio.h>
2527 #include <sys/types.h>
2528 #include <asm/types.h>
2529 #include <sys/socket.h>
2530 #include <linux/netlink.h>
2531 #include <linux/rtnetlink.h>
2532 ]]],
2533 [[[
2534 int retval = TCA_STATS2;
2535 return (retval);
2536 ]]]
2537 )],
2538 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2541 [[[
2542 #include <stdio.h>
2543 #include <sys/types.h>
2544 #include <asm/types.h>
2545 #include <sys/socket.h>
2546 #include <linux/netlink.h>
2547 #include <linux/rtnetlink.h>
2548 ]]],
2549 [[[
2550 int retval = TCA_STATS;
2551 return (retval);
2552 ]]]
2553 )],
2554 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2556 CFLAGS="$SAVE_CFLAGS"
2557 fi
2558 if test "x$with_libnetlink" = "xyes"
2559 then
2560 AC_CHECK_LIB(netlink, rtnl_open,
2561 [with_libnetlink="yes"],
2562 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2563 [$with_libnetlink_libs])
2564 fi
2565 if test "x$with_libnetlink" = "xyes"
2566 then
2567 SAVE_CFLAGS="$CFLAGS"
2568 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2570 AC_CACHE_CHECK(
2571 [if function 'rtnl_dump_filter' expects five arguments],
2572 [c_cv_rtnl_dump_filter_five_args],
2573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2574 [[[
2575 #include <stdio.h>
2576 #include <sys/types.h>
2577 #include <asm/types.h>
2578 #include <sys/socket.h>
2579 #if HAVE_LIBNETLINK_H
2580 # include <libnetlink.h>
2581 #elif HAVE_IPROUTE_LIBNETLINK_H
2582 # include <iproute/libnetlink.h>
2583 #elif HAVE_LINUX_LIBNETLINK_H
2584 # include <linux/libnetlink.h>
2585 #endif
2586 ]]],
2587 [[[
2588 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2589 return 1;
2590 return 0;
2591 ]]]
2592 )],
2593 [c_cv_rtnl_dump_filter_five_args="yes"],
2594 [c_cv_rtnl_dump_filter_five_args="no"]
2595 )
2596 )
2598 AC_CACHE_CHECK(
2599 [if function 'rtnl_dump_filter' expects three arguments],
2600 [c_cv_rtnl_dump_filter_three_args],
2601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2602 [[[
2603 #include <stdio.h>
2604 #include <sys/types.h>
2605 #include <asm/types.h>
2606 #include <sys/socket.h>
2607 #if HAVE_LIBNETLINK_H
2608 # include <libnetlink.h>
2609 #elif HAVE_IPROUTE_LIBNETLINK_H
2610 # include <iproute/libnetlink.h>
2611 #elif HAVE_LINUX_LIBNETLINK_H
2612 # include <linux/libnetlink.h>
2613 #endif
2614 ]]],
2615 [[[
2616 if (rtnl_dump_filter(NULL, NULL, NULL))
2617 return 1;
2618 return 0;
2619 ]]]
2620 )],
2621 [c_cv_rtnl_dump_filter_three_args="yes"],
2622 [c_cv_rtnl_dump_filter_three_args="no"]
2623 )
2624 )
2626 CFLAGS="$SAVE_CFLAGS"
2628 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2629 then
2630 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2631 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2632 fi
2633 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2634 then
2635 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2636 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2637 fi
2639 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2640 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2641 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2642 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2643 fi
2644 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2645 # }}}
2647 # --with-libnetapp {{{
2648 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2649 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2650 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2651 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2652 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2653 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2654 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2655 [
2656 if test -d "$withval"
2657 then
2658 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2659 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2660 with_libnetapp="yes"
2661 else
2662 with_libnetapp="$withval"
2663 fi
2664 ],
2665 [
2666 with_libnetapp="yes"
2667 ])
2669 SAVE_CPPFLAGS="$CPPFLAGS"
2670 SAVE_LDFLAGS="$LDFLAGS"
2671 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2672 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2674 if test "x$with_libnetapp" = "xyes"
2675 then
2676 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2677 then
2678 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2679 fi
2680 AC_CHECK_HEADERS(netapp_api.h,
2681 [with_libnetapp="yes"],
2682 [with_libnetapp="no (netapp_api.h not found)"])
2683 fi
2685 if test "x$with_libnetapp" = "xyes"
2686 then
2687 if test "x$LIBNETAPP_LDFLAGS" != "x"
2688 then
2689 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2690 fi
2692 if test "x$LIBNETAPP_LIBS" = "x"
2693 then
2694 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2695 fi
2696 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2698 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2699 [with_libnetapp="yes"],
2700 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2701 [$LIBNETAPP_LIBS])
2702 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2703 fi
2705 CPPFLAGS="$SAVE_CPPFLAGS"
2706 LDFLAGS="$SAVE_LDFLAGS"
2708 if test "x$with_libnetapp" = "xyes"
2709 then
2710 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2711 fi
2713 AC_SUBST(LIBNETAPP_CPPFLAGS)
2714 AC_SUBST(LIBNETAPP_LDFLAGS)
2715 AC_SUBST(LIBNETAPP_LIBS)
2716 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2717 # }}}
2719 # --with-libnetsnmp {{{
2720 with_snmp_config="net-snmp-config"
2721 with_snmp_cflags=""
2722 with_snmp_libs=""
2723 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2724 [
2725 if test "x$withval" = "xno"
2726 then
2727 with_libnetsnmp="no"
2728 else if test "x$withval" = "xyes"
2729 then
2730 with_libnetsnmp="yes"
2731 else
2732 if test -x "$withval"
2733 then
2734 with_snmp_config="$withval"
2735 with_libnetsnmp="yes"
2736 else
2737 with_snmp_config="$withval/bin/net-snmp-config"
2738 with_libnetsnmp="yes"
2739 fi
2740 fi; fi
2741 ],
2742 [with_libnetsnmp="yes"])
2743 if test "x$with_libnetsnmp" = "xyes"
2744 then
2745 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2746 snmp_config_status=$?
2748 if test $snmp_config_status -ne 0
2749 then
2750 with_libnetsnmp="no ($with_snmp_config failed)"
2751 else
2752 SAVE_CPPFLAGS="$CPPFLAGS"
2753 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2755 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2757 CPPFLAGS="$SAVE_CPPFLAGS"
2758 fi
2759 fi
2760 if test "x$with_libnetsnmp" = "xyes"
2761 then
2762 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2763 snmp_config_status=$?
2765 if test $snmp_config_status -ne 0
2766 then
2767 with_libnetsnmp="no ($with_snmp_config failed)"
2768 else
2769 AC_CHECK_LIB(netsnmp, init_snmp,
2770 [with_libnetsnmp="yes"],
2771 [with_libnetsnmp="no (libnetsnmp not found)"],
2772 [$with_snmp_libs])
2773 fi
2774 fi
2775 if test "x$with_libnetsnmp" = "xyes"
2776 then
2777 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2778 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2779 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2780 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2781 fi
2782 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2783 # }}}
2785 # --with-liboconfig {{{
2786 with_own_liboconfig="no"
2787 liboconfig_LDFLAGS="$LDFLAGS"
2788 liboconfig_CPPFLAGS="$CPPFLAGS"
2789 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2790 [
2791 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2792 then
2793 if test -d "$withval/lib"
2794 then
2795 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2796 fi
2797 if test -d "$withval/include"
2798 then
2799 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2800 fi
2801 fi
2802 if test "x$withval" = "xno"
2803 then
2804 AC_MSG_ERROR("liboconfig is required")
2805 fi
2806 ],
2807 [
2808 with_liboconfig="yes"
2809 ])
2811 save_LDFLAGS="$LDFLAGS"
2812 save_CPPFLAGS="$CPPFLAGS"
2813 LDFLAGS="$liboconfig_LDFLAGS"
2814 CPPFLAGS="$liboconfig_CPPFLAGS"
2815 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2816 [
2817 with_liboconfig="yes"
2818 with_own_liboconfig="no"
2819 ],
2820 [
2821 with_liboconfig="yes"
2822 with_own_liboconfig="yes"
2823 LDFLAGS="$save_LDFLAGS"
2824 CPPFLAGS="$save_CPPFLAGS"
2825 ])
2827 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2828 if test "x$with_own_liboconfig" = "xyes"
2829 then
2830 with_liboconfig="yes (shipped version)"
2831 fi
2832 # }}}
2834 # --with-liboping {{{
2835 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2836 [
2837 if test "x$withval" = "xyes"
2838 then
2839 with_liboping="yes"
2840 else if test "x$withval" = "xno"
2841 then
2842 with_liboping="no"
2843 else
2844 with_liboping="yes"
2845 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2846 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2847 fi; fi
2848 ],
2849 [with_liboping="yes"])
2851 SAVE_CPPFLAGS="$CPPFLAGS"
2852 SAVE_LDFLAGS="$LDFLAGS"
2854 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2855 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2857 if test "x$with_liboping" = "xyes"
2858 then
2859 if test "x$LIBOPING_CPPFLAGS" != "x"
2860 then
2861 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2862 fi
2863 AC_CHECK_HEADERS(oping.h,
2864 [with_liboping="yes"],
2865 [with_liboping="no (oping.h not found)"])
2866 fi
2867 if test "x$with_liboping" = "xyes"
2868 then
2869 if test "x$LIBOPING_LDFLAGS" != "x"
2870 then
2871 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2872 fi
2873 AC_CHECK_LIB(oping, ping_construct,
2874 [with_liboping="yes"],
2875 [with_liboping="no (symbol 'ping_construct' not found)"])
2876 fi
2878 CPPFLAGS="$SAVE_CPPFLAGS"
2879 LDFLAGS="$SAVE_LDFLAGS"
2881 if test "x$with_liboping" = "xyes"
2882 then
2883 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2884 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2885 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2886 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2887 fi
2888 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2889 # }}}
2891 # --with-oracle {{{
2892 with_oracle_cppflags=""
2893 with_oracle_libs=""
2894 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2895 [
2896 if test "x$withval" = "xyes"
2897 then
2898 if test "x$ORACLE_HOME" = "x"
2899 then
2900 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2901 fi
2902 with_oracle="yes"
2903 else if test "x$withval" = "xno"
2904 then
2905 with_oracle="no"
2906 else
2907 with_oracle="yes"
2908 ORACLE_HOME="$withval"
2909 fi; fi
2910 ],
2911 [
2912 if test "x$ORACLE_HOME" = "x"
2913 then
2914 with_oracle="no (ORACLE_HOME is not set)"
2915 else
2916 with_oracle="yes"
2917 fi
2918 ])
2919 if test "x$ORACLE_HOME" != "x"
2920 then
2921 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2923 if test -e "$ORACLE_HOME/lib/ldflags"
2924 then
2925 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2926 fi
2927 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2928 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2929 fi
2930 if test "x$with_oracle" = "xyes"
2931 then
2932 SAVE_CPPFLAGS="$CPPFLAGS"
2933 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2935 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2937 CPPFLAGS="$SAVE_CPPFLAGS"
2938 fi
2939 if test "x$with_oracle" = "xyes"
2940 then
2941 SAVE_CPPFLAGS="$CPPFLAGS"
2942 SAVE_LIBS="$LIBS"
2943 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2944 LIBS="$LIBS $with_oracle_libs"
2946 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2948 CPPFLAGS="$SAVE_CPPFLAGS"
2949 LIBS="$SAVE_LIBS"
2950 fi
2951 if test "x$with_oracle" = "xyes"
2952 then
2953 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2954 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2955 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2956 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2957 fi
2958 # }}}
2960 # --with-libowcapi {{{
2961 with_libowcapi_cppflags=""
2962 with_libowcapi_libs="-lowcapi"
2963 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2964 [
2965 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2966 then
2967 with_libowcapi_cppflags="-I$withval/include"
2968 with_libowcapi_libs="-L$withval/lib -lowcapi"
2969 with_libowcapi="yes"
2970 else
2971 with_libowcapi="$withval"
2972 fi
2973 ],
2974 [
2975 with_libowcapi="yes"
2976 ])
2977 if test "x$with_libowcapi" = "xyes"
2978 then
2979 SAVE_CPPFLAGS="$CPPFLAGS"
2980 CPPFLAGS="$with_libowcapi_cppflags"
2982 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2984 CPPFLAGS="$SAVE_CPPFLAGS"
2985 fi
2986 if test "x$with_libowcapi" = "xyes"
2987 then
2988 SAVE_LDFLAGS="$LDFLAGS"
2989 SAVE_CPPFLAGS="$CPPFLAGS"
2990 LDFLAGS="$with_libowcapi_libs"
2991 CPPFLAGS="$with_libowcapi_cppflags"
2993 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2995 LDFLAGS="$SAVE_LDFLAGS"
2996 CPPFLAGS="$SAVE_CPPFLAGS"
2997 fi
2998 if test "x$with_libowcapi" = "xyes"
2999 then
3000 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3001 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3002 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3003 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3004 fi
3005 # }}}
3007 # --with-libpcap {{{
3008 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3009 [
3010 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3011 then
3012 LDFLAGS="$LDFLAGS -L$withval/lib"
3013 CPPFLAGS="$CPPFLAGS -I$withval/include"
3014 with_libpcap="yes"
3015 else
3016 with_libpcap="$withval"
3017 fi
3018 ],
3019 [
3020 with_libpcap="yes"
3021 ])
3022 if test "x$with_libpcap" = "xyes"
3023 then
3024 AC_CHECK_LIB(pcap, pcap_open_live,
3025 [
3026 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3027 ], [with_libpcap="no (libpcap not found)"])
3028 fi
3029 if test "x$with_libpcap" = "xyes"
3030 then
3031 AC_CHECK_HEADERS(pcap.h,,
3032 [with_libpcap="no (pcap.h not found)"])
3033 fi
3034 if test "x$with_libpcap" = "xyes"
3035 then
3036 AC_CHECK_HEADERS(pcap-bpf.h,,
3037 [with_libpcap="no (pcap-bpf.h not found)"])
3038 fi
3039 if test "x$with_libpcap" = "xyes"
3040 then
3041 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3042 [c_cv_libpcap_have_pcap_error_iface_not_up],
3043 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3044 [[[
3045 #include <pcap.h>
3046 ]]],
3047 [[[
3048 int val = PCAP_ERROR_IFACE_NOT_UP;
3049 ]]]
3050 )],
3051 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3052 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3053 fi
3054 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3055 then
3056 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3057 fi
3058 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3059 # }}}
3061 # --with-libperl {{{
3062 perl_interpreter="perl"
3063 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3064 [
3065 if test -f "$withval" && test -x "$withval"
3066 then
3067 perl_interpreter="$withval"
3068 with_libperl="yes"
3069 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3070 then
3071 LDFLAGS="$LDFLAGS -L$withval/lib"
3072 CPPFLAGS="$CPPFLAGS -I$withval/include"
3073 perl_interpreter="$withval/bin/perl"
3074 with_libperl="yes"
3075 else
3076 with_libperl="$withval"
3077 fi; fi
3078 ],
3079 [
3080 with_libperl="yes"
3081 ])
3083 AC_MSG_CHECKING([for perl])
3084 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3085 if test -x "$perl_interpreter"
3086 then
3087 AC_MSG_RESULT([yes ($perl_interpreter)])
3088 else
3089 perl_interpreter=""
3090 AC_MSG_RESULT([no])
3091 fi
3093 AC_SUBST(PERL, "$perl_interpreter")
3095 if test "x$with_libperl" = "xyes" \
3096 && test -n "$perl_interpreter"
3097 then
3098 SAVE_CFLAGS="$CFLAGS"
3099 SAVE_LIBS="$LIBS"
3100 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3101 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3102 PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3103 CFLAGS="$CFLAGS $PERL_CFLAGS"
3104 LIBS="$LIBS $PERL_LIBS"
3106 AC_CACHE_CHECK([for libperl],
3107 [c_cv_have_libperl],
3108 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3109 [[[
3110 #define PERL_NO_GET_CONTEXT
3111 #include <EXTERN.h>
3112 #include <perl.h>
3113 #include <XSUB.h>
3114 ]]],
3115 [[[
3116 dTHX;
3117 load_module (PERL_LOADMOD_NOIMPORT,
3118 newSVpv ("Collectd::Plugin::FooBar", 24),
3119 Nullsv);
3120 ]]]
3121 )],
3122 [c_cv_have_libperl="yes"],
3123 [c_cv_have_libperl="no"]
3124 )
3125 )
3127 if test "x$c_cv_have_libperl" = "xyes"
3128 then
3129 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3130 AC_SUBST(PERL_CFLAGS)
3131 AC_SUBST(PERL_LIBS)
3132 else
3133 with_libperl="no"
3134 fi
3136 CFLAGS="$SAVE_CFLAGS"
3137 LIBS="$SAVE_LIBS"
3138 else if test -z "$perl_interpreter"; then
3139 with_libperl="no (no perl interpreter found)"
3140 c_cv_have_libperl="no"
3141 fi; fi
3142 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3144 if test "x$with_libperl" = "xyes"
3145 then
3146 SAVE_CFLAGS="$CFLAGS"
3147 SAVE_LIBS="$LIBS"
3148 CFLAGS="$CFLAGS $PERL_CFLAGS"
3149 LIBS="$LIBS $PERL_LIBS"
3151 AC_CACHE_CHECK([if perl supports ithreads],
3152 [c_cv_have_perl_ithreads],
3153 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3154 [[[
3155 #include <EXTERN.h>
3156 #include <perl.h>
3157 #include <XSUB.h>
3159 #if !defined(USE_ITHREADS)
3160 # error "Perl does not support ithreads!"
3161 #endif /* !defined(USE_ITHREADS) */
3162 ]]],
3163 [[[ ]]]
3164 )],
3165 [c_cv_have_perl_ithreads="yes"],
3166 [c_cv_have_perl_ithreads="no"]
3167 )
3168 )
3170 if test "x$c_cv_have_perl_ithreads" = "xyes"
3171 then
3172 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3173 fi
3175 CFLAGS="$SAVE_CFLAGS"
3176 LIBS="$SAVE_LIBS"
3177 fi
3179 if test "x$with_libperl" = "xyes"
3180 then
3181 SAVE_CFLAGS="$CFLAGS"
3182 SAVE_LIBS="$LIBS"
3183 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3184 # (see issues #41 and #42)
3185 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3186 LIBS="$LIBS $PERL_LIBS"
3188 AC_CACHE_CHECK([for broken Perl_load_module()],
3189 [c_cv_have_broken_perl_load_module],
3190 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3191 [[[
3192 #define PERL_NO_GET_CONTEXT
3193 #include <EXTERN.h>
3194 #include <perl.h>
3195 #include <XSUB.h>
3196 ]]],
3197 [[[
3198 dTHX;
3199 load_module (PERL_LOADMOD_NOIMPORT,
3200 newSVpv ("Collectd::Plugin::FooBar", 24),
3201 Nullsv);
3202 ]]]
3203 )],
3204 [c_cv_have_broken_perl_load_module="no"],
3205 [c_cv_have_broken_perl_load_module="yes"]
3206 )
3207 )
3209 CFLAGS="$SAVE_CFLAGS"
3210 LIBS="$SAVE_LIBS"
3211 fi
3212 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3213 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3215 if test "x$with_libperl" = "xyes"
3216 then
3217 SAVE_CFLAGS="$CFLAGS"
3218 SAVE_LIBS="$LIBS"
3219 CFLAGS="$CFLAGS $PERL_CFLAGS"
3220 LIBS="$LIBS $PERL_LIBS"
3222 AC_CHECK_MEMBER(
3223 [struct mgvtbl.svt_local],
3224 [have_struct_mgvtbl_svt_local="yes"],
3225 [have_struct_mgvtbl_svt_local="no"],
3226 [
3227 #include <EXTERN.h>
3228 #include <perl.h>
3229 #include <XSUB.h>
3230 ])
3232 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3233 then
3234 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3235 [Define if Perl's struct mgvtbl has member svt_local.])
3236 fi
3238 CFLAGS="$SAVE_CFLAGS"
3239 LIBS="$SAVE_LIBS"
3240 fi
3241 # }}}
3243 # --with-libpq {{{
3244 with_pg_config="pg_config"
3245 with_libpq_includedir=""
3246 with_libpq_libdir=""
3247 with_libpq_cppflags=""
3248 with_libpq_ldflags=""
3249 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3250 [Path to libpq.])],
3251 [
3252 if test "x$withval" = "xno"
3253 then
3254 with_libpq="no"
3255 else if test "x$withval" = "xyes"
3256 then
3257 with_libpq="yes"
3258 else
3259 if test -f "$withval" && test -x "$withval";
3260 then
3261 with_pg_config="$withval"
3262 else if test -x "$withval/bin/pg_config"
3263 then
3264 with_pg_config="$withval/bin/pg_config"
3265 fi; fi
3266 with_libpq="yes"
3267 fi; fi
3268 ],
3269 [
3270 with_libpq="yes"
3271 ])
3272 if test "x$with_libpq" = "xyes"
3273 then
3274 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3275 pg_config_status=$?
3277 if test $pg_config_status -eq 0
3278 then
3279 if test -n "$with_libpq_includedir"; then
3280 for dir in $with_libpq_includedir; do
3281 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3282 done
3283 fi
3284 else
3285 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3286 fi
3288 SAVE_CPPFLAGS="$CPPFLAGS"
3289 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3291 AC_CHECK_HEADERS(libpq-fe.h, [],
3292 [with_libpq="no (libpq-fe.h not found)"], [])
3294 CPPFLAGS="$SAVE_CPPFLAGS"
3295 fi
3296 if test "x$with_libpq" = "xyes"
3297 then
3298 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3299 pg_config_status=$?
3301 if test $pg_config_status -eq 0
3302 then
3303 if test -n "$with_libpq_libdir"; then
3304 for dir in $with_libpq_libdir; do
3305 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3306 done
3307 fi
3308 else
3309 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3310 fi
3312 SAVE_LDFLAGS="$LDFLAGS"
3313 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3315 AC_CHECK_LIB(pq, PQconnectdb,
3316 [with_libpq="yes"],
3317 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3319 AC_CHECK_LIB(pq, PQserverVersion,
3320 [with_libpq="yes"],
3321 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3323 LDFLAGS="$SAVE_LDFLAGS"
3324 fi
3325 if test "x$with_libpq" = "xyes"
3326 then
3327 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3328 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3329 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3330 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3331 fi
3332 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3333 # }}}
3335 # --with-libpthread {{{
3336 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3337 [ if test "x$withval" != "xno" \
3338 && test "x$withval" != "xyes"
3339 then
3340 LDFLAGS="$LDFLAGS -L$withval/lib"
3341 CPPFLAGS="$CPPFLAGS -I$withval/include"
3342 with_libpthread="yes"
3343 else
3344 if test "x$withval" = "xno"
3345 then
3346 with_libpthread="no (disabled)"
3347 fi
3348 fi
3349 ], [with_libpthread="yes"])
3350 if test "x$with_libpthread" = "xyes"
3351 then
3352 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3353 fi
3355 if test "x$with_libpthread" = "xyes"
3356 then
3357 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3358 fi
3359 if test "x$with_libpthread" = "xyes"
3360 then
3361 collect_pthread=1
3362 else
3363 collect_pthread=0
3364 fi
3365 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3366 [Wether or not to use pthread (POSIX threads) library])
3367 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3368 # }}}
3370 # --with-python {{{
3371 with_python_prog=""
3372 with_python_path="$PATH"
3373 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3374 [
3375 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3376 then
3377 with_python="$withval"
3378 else if test -x "$withval"
3379 then
3380 with_python_prog="$withval"
3381 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3382 with_python="yes"
3383 else if test -d "$withval"
3384 then
3385 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3386 with_python="yes"
3387 else
3388 AC_MSG_WARN([Argument not recognized: $withval])
3389 fi; fi; fi
3390 ], [with_python="yes"])
3392 SAVE_PATH="$PATH"
3393 SAVE_CPPFLAGS="$CPPFLAGS"
3394 SAVE_LDFLAGS="$LDFLAGS"
3395 SAVE_LIBS="$LIBS"
3397 PATH="$with_python_path"
3399 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3400 then
3401 AC_MSG_CHECKING([for python])
3402 with_python_prog="`which python 2>/dev/null`"
3403 if test "x$with_python_prog" = "x"
3404 then
3405 AC_MSG_RESULT([not found])
3406 with_python="no (interpreter not found)"
3407 else
3408 AC_MSG_RESULT([$with_python_prog])
3409 fi
3410 fi
3412 if test "x$with_python" = "xyes"
3413 then
3414 AC_MSG_CHECKING([for Python CPPFLAGS])
3415 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3416 python_config_status=$?
3418 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3419 then
3420 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3421 with_python="no"
3422 else
3423 AC_MSG_RESULT([$python_include_path])
3424 fi
3425 fi
3427 if test "x$with_python" = "xyes"
3428 then
3429 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3430 AC_CHECK_HEADERS(Python.h,
3431 [with_python="yes"],
3432 [with_python="no ('Python.h' not found)"])
3433 fi
3435 if test "x$with_python" = "xyes"
3436 then
3437 AC_MSG_CHECKING([for Python LDFLAGS])
3438 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`
3439 python_config_status=$?
3441 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3442 then
3443 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3444 with_python="no"
3445 else
3446 AC_MSG_RESULT([$python_library_path])
3447 fi
3448 fi
3450 if test "x$with_python" = "xyes"
3451 then
3452 AC_MSG_CHECKING([for Python LIBS])
3453 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`
3454 python_config_status=$?
3456 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3457 then
3458 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3459 with_python="no"
3460 else
3461 AC_MSG_RESULT([$python_library_flags])
3462 fi
3463 fi
3465 if test "x$with_python" = "xyes"
3466 then
3467 LDFLAGS="-L$python_library_path $LDFLAGS"
3468 LIBS="$python_library_flags $LIBS"
3470 AC_CHECK_FUNC(PyObject_CallFunction,
3471 [with_python="yes"],
3472 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3473 fi
3475 PATH="$SAVE_PATH"
3476 CPPFLAGS="$SAVE_CPPFLAGS"
3477 LDFLAGS="$SAVE_LDFLAGS"
3478 LIBS="$SAVE_LIBS"
3480 if test "x$with_python" = "xyes"
3481 then
3482 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3483 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3484 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3485 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3486 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3487 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3488 fi
3489 # }}} --with-python
3491 # --with-librabbitmq {{{
3492 with_librabbitmq_cppflags=""
3493 with_librabbitmq_ldflags=""
3494 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3495 [
3496 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3497 then
3498 with_librabbitmq_cppflags="-I$withval/include"
3499 with_librabbitmq_ldflags="-L$withval/lib"
3500 with_librabbitmq="yes"
3501 else
3502 with_librabbitmq="$withval"
3503 fi
3504 ],
3505 [
3506 with_librabbitmq="yes"
3507 ])
3508 SAVE_CPPFLAGS="$CPPFLAGS"
3509 SAVE_LDFLAGS="$LDFLAGS"
3510 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3511 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3512 if test "x$with_librabbitmq" = "xyes"
3513 then
3514 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3515 fi
3516 if test "x$with_librabbitmq" = "xyes"
3517 then
3518 # librabbitmq up to version 0.9.1 provides "library_errno", later
3519 # versions use "library_error". The library does not provide a version
3520 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3521 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3522 [
3523 #if HAVE_STDLIB_H
3524 # include <stdlib.h>
3525 #endif
3526 #if HAVE_STDIO_H
3527 # include <stdio.h>
3528 #endif
3529 #if HAVE_STDINT_H
3530 # include <stdint.h>
3531 #endif
3532 #if HAVE_INTTYPES_H
3533 # include <inttypes.h>
3534 #endif
3535 #include <amqp.h>
3536 ])
3537 fi
3538 if test "x$with_librabbitmq" = "xyes"
3539 then
3540 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3541 fi
3542 if test "x$with_librabbitmq" = "xyes"
3543 then
3544 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3545 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3546 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3547 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3548 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3549 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3550 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3551 fi
3552 CPPFLAGS="$SAVE_CPPFLAGS"
3553 LDFLAGS="$SAVE_LDFLAGS"
3554 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3556 with_amqp_tcp_socket="no"
3557 if test "x$with_librabbitmq" = "xyes"
3558 then
3559 SAVE_CPPFLAGS="$CPPFLAGS"
3560 SAVE_LDFLAGS="$LDFLAGS"
3561 SAVE_LIBS="$LIBS"
3562 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3563 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3564 LIBS="-lrabbitmq"
3566 AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3567 AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3568 if test "x$with_amqp_tcp_socket" = "xyes"
3569 then
3570 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3571 [Define if librabbitmq provides the new TCP socket interface.])
3572 fi
3574 AC_CHECK_DECLS(amqp_socket_close,
3575 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3576 [[
3577 #include <amqp.h>
3578 #ifdef HAVE_AMQP_TCP_SOCKET_H
3579 # include <amqp_tcp_socket.h>
3580 #endif
3581 #ifdef HAVE_AMQP_SOCKET_H
3582 # include <amqp_socket.h>
3583 #endif
3584 ]])
3586 CPPFLAGS="$SAVE_CPPFLAGS"
3587 LDFLAGS="$SAVE_LDFLAGS"
3588 LIBS="$SAVE_LIBS"
3589 fi
3590 # }}}
3592 # --with-librouteros {{{
3593 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3594 [
3595 if test "x$withval" = "xyes"
3596 then
3597 with_librouteros="yes"
3598 else if test "x$withval" = "xno"
3599 then
3600 with_librouteros="no"
3601 else
3602 with_librouteros="yes"
3603 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3604 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3605 fi; fi
3606 ],
3607 [with_librouteros="yes"])
3609 SAVE_CPPFLAGS="$CPPFLAGS"
3610 SAVE_LDFLAGS="$LDFLAGS"
3612 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3613 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3615 if test "x$with_librouteros" = "xyes"
3616 then
3617 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3618 then
3619 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3620 fi
3621 AC_CHECK_HEADERS(routeros_api.h,
3622 [with_librouteros="yes"],
3623 [with_librouteros="no (routeros_api.h not found)"])
3624 fi
3625 if test "x$with_librouteros" = "xyes"
3626 then
3627 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3628 then
3629 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3630 fi
3631 AC_CHECK_LIB(routeros, ros_interface,
3632 [with_librouteros="yes"],
3633 [with_librouteros="no (symbol 'ros_interface' not found)"])
3634 fi
3636 CPPFLAGS="$SAVE_CPPFLAGS"
3637 LDFLAGS="$SAVE_LDFLAGS"
3639 if test "x$with_librouteros" = "xyes"
3640 then
3641 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3642 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3643 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3644 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3645 fi
3646 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3647 # }}}
3649 # --with-librrd {{{
3650 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3651 librrd_cflags=""
3652 librrd_ldflags=""
3653 librrd_threadsafe="yes"
3654 librrd_rrdc_update="no"
3655 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3656 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3657 then
3658 librrd_cflags="-I$withval/include"
3659 librrd_ldflags="-L$withval/lib"
3660 with_librrd="yes"
3661 else
3662 with_librrd="$withval"
3663 fi
3664 ], [with_librrd="yes"])
3665 if test "x$with_librrd" = "xyes"
3666 then
3667 SAVE_CPPFLAGS="$CPPFLAGS"
3668 SAVE_LDFLAGS="$LDFLAGS"
3670 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3671 LDFLAGS="$LDFLAGS $librrd_ldflags"
3673 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3675 CPPFLAGS="$SAVE_CPPFLAGS"
3676 LDFLAGS="$SAVE_LDFLAGS"
3677 fi
3678 if test "x$with_librrd" = "xyes"
3679 then
3680 SAVE_CPPFLAGS="$CPPFLAGS"
3681 SAVE_LDFLAGS="$LDFLAGS"
3683 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3684 LDFLAGS="$LDFLAGS $librrd_ldflags"
3686 AC_CHECK_LIB(rrd_th, rrd_update_r,
3687 [with_librrd="yes"
3688 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3689 ],
3690 [librrd_threadsafe="no"
3691 AC_CHECK_LIB(rrd, rrd_update,
3692 [with_librrd="yes"
3693 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3694 ],
3695 [with_librrd="no (symbol 'rrd_update' not found)"],
3696 [-lm])
3697 ],
3698 [-lm])
3700 if test "x$librrd_threadsafe" = "xyes"
3701 then
3702 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3703 else
3704 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3705 fi
3707 CPPFLAGS="$SAVE_CPPFLAGS"
3708 LDFLAGS="$SAVE_LDFLAGS"
3709 fi
3710 if test "x$with_librrd" = "xyes"
3711 then
3712 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3713 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3714 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3715 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3716 fi
3717 if test "x$librrd_threadsafe" = "xyes"
3718 then
3719 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3720 fi
3721 # }}}
3723 # --with-libsensors {{{
3724 with_sensors_cflags=""
3725 with_sensors_ldflags=""
3726 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3727 [
3728 if test "x$withval" = "xno"
3729 then
3730 with_libsensors="no"
3731 else
3732 with_libsensors="yes"
3733 if test "x$withval" != "xyes"
3734 then
3735 with_sensors_cflags="-I$withval/include"
3736 with_sensors_ldflags="-L$withval/lib"
3737 with_libsensors="yes"
3738 fi
3739 fi
3740 ],
3741 [
3742 if test "x$ac_system" = "xLinux"
3743 then
3744 with_libsensors="yes"
3745 else
3746 with_libsensors="no (Linux only library)"
3747 fi
3748 ])
3749 if test "x$with_libsensors" = "xyes"
3750 then
3751 SAVE_CPPFLAGS="$CPPFLAGS"
3752 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3754 # AC_CHECK_HEADERS(sensors/sensors.h,
3755 # [
3756 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3757 # ],
3758 # [with_libsensors="no (sensors/sensors.h not found)"])
3759 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3761 CPPFLAGS="$SAVE_CPPFLAGS"
3762 fi
3763 if test "x$with_libsensors" = "xyes"
3764 then
3765 SAVE_CPPFLAGS="$CPPFLAGS"
3766 SAVE_LDFLAGS="$LDFLAGS"
3767 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3768 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3770 AC_CHECK_LIB(sensors, sensors_init,
3771 [
3772 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3773 ],
3774 [with_libsensors="no (libsensors not found)"])
3776 CPPFLAGS="$SAVE_CPPFLAGS"
3777 LDFLAGS="$SAVE_LDFLAGS"
3778 fi
3779 if test "x$with_libsensors" = "xyes"
3780 then
3781 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3782 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3783 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3784 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3785 fi
3786 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3787 # }}}
3789 # --with-libstatgrab {{{
3790 with_libstatgrab_cflags=""
3791 with_libstatgrab_ldflags=""
3792 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3793 [
3794 if test "x$withval" != "xno" \
3795 && test "x$withval" != "xyes"
3796 then
3797 with_libstatgrab_cflags="-I$withval/include"
3798 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3799 with_libstatgrab="yes"
3800 with_libstatgrab_pkg_config="no"
3801 else
3802 with_libstatgrab="$withval"
3803 with_libstatgrab_pkg_config="yes"
3804 fi
3805 ],
3806 [
3807 with_libstatgrab="yes"
3808 with_libstatgrab_pkg_config="yes"
3809 ])
3811 if test "x$with_libstatgrab" = "xyes" \
3812 && test "x$with_libstatgrab_pkg_config" = "xyes"
3813 then
3814 if test "x$PKG_CONFIG" != "x"
3815 then
3816 AC_MSG_CHECKING([pkg-config for libstatgrab])
3817 temp_result="found"
3818 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3819 if test "$?" != "0"
3820 then
3821 with_libstatgrab_pkg_config="no"
3822 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3823 temp_result="not found"
3824 fi
3825 AC_MSG_RESULT([$temp_result])
3826 else
3827 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3828 with_libstatgrab_pkg_config="no"
3829 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3830 fi
3831 fi
3833 if test "x$with_libstatgrab" = "xyes" \
3834 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3835 && test "x$with_libstatgrab_cflags" = "x"
3836 then
3837 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3838 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3839 if test "$?" = "0"
3840 then
3841 with_libstatgrab_cflags="$temp_result"
3842 else
3843 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3844 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3845 fi
3846 AC_MSG_RESULT([$temp_result])
3847 fi
3849 if test "x$with_libstatgrab" = "xyes" \
3850 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3851 && test "x$with_libstatgrab_ldflags" = "x"
3852 then
3853 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3854 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3855 if test "$?" = "0"
3856 then
3857 with_libstatgrab_ldflags="$temp_result"
3858 else
3859 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3860 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3861 fi
3862 AC_MSG_RESULT([$temp_result])
3863 fi
3865 if test "x$with_libstatgrab" = "xyes"
3866 then
3867 SAVE_CPPFLAGS="$CPPFLAGS"
3868 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3870 AC_CHECK_HEADERS(statgrab.h,
3871 [with_libstatgrab="yes"],
3872 [with_libstatgrab="no (statgrab.h not found)"])
3874 CPPFLAGS="$SAVE_CPPFLAGS"
3875 fi
3877 if test "x$with_libstatgrab" = "xyes"
3878 then
3879 SAVE_CFLAGS="$CFLAGS"
3880 SAVE_LDFLAGS="$LDFLAGS"
3882 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3883 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3885 AC_CHECK_LIB(statgrab, sg_init,
3886 [with_libstatgrab="yes"],
3887 [with_libstatgrab="no (symbol sg_init not found)"])
3889 CFLAGS="$SAVE_CFLAGS"
3890 LDFLAGS="$SAVE_LDFLAGS"
3891 fi
3893 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3894 if test "x$with_libstatgrab" = "xyes"
3895 then
3896 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3897 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3898 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3899 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3900 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3901 fi
3902 # }}}
3904 # --with-libtokyotyrant {{{
3905 with_libtokyotyrant_cppflags=""
3906 with_libtokyotyrant_ldflags=""
3907 with_libtokyotyrant_libs=""
3908 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3909 [
3910 if test "x$withval" = "xno"
3911 then
3912 with_libtokyotyrant="no"
3913 else if test "x$withval" = "xyes"
3914 then
3915 with_libtokyotyrant="yes"
3916 else
3917 with_libtokyotyrant_cppflags="-I$withval/include"
3918 with_libtokyotyrant_ldflags="-L$withval/include"
3919 with_libtokyotyrant_libs="-ltokyotyrant"
3920 with_libtokyotyrant="yes"
3921 fi; fi
3922 ],
3923 [
3924 with_libtokyotyrant="yes"
3925 ])
3927 if test "x$with_libtokyotyrant" = "xyes"
3928 then
3929 if $PKG_CONFIG --exists tokyotyrant
3930 then
3931 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3932 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
3933 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
3934 fi
3935 fi
3937 SAVE_CPPFLAGS="$CPPFLAGS"
3938 SAVE_LDFLAGS="$LDFLAGS"
3939 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3940 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3942 if test "x$with_libtokyotyrant" = "xyes"
3943 then
3944 AC_CHECK_HEADERS(tcrdb.h,
3945 [
3946 AC_DEFINE(HAVE_TCRDB_H, 1,
3947 [Define to 1 if you have the <tcrdb.h> header file.])
3948 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3949 fi
3951 if test "x$with_libtokyotyrant" = "xyes"
3952 then
3953 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3954 [
3955 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3956 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3957 ],
3958 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3959 [$with_libtokyotyrant_libs])
3960 fi
3962 CPPFLAGS="$SAVE_CPPFLAGS"
3963 LDFLAGS="$SAVE_LDFLAGS"
3965 if test "x$with_libtokyotyrant" = "xyes"
3966 then
3967 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3968 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3969 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3970 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3971 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3972 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3973 fi
3974 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3975 # }}}
3977 # --with-libupsclient {{{
3978 with_libupsclient_config=""
3979 with_libupsclient_cflags=""
3980 with_libupsclient_libs=""
3981 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3982 [
3983 if test "x$withval" = "xno"
3984 then
3985 with_libupsclient="no"
3986 else if test "x$withval" = "xyes"
3987 then
3988 with_libupsclient="use_pkgconfig"
3989 else
3990 if test -x "$withval"
3991 then
3992 with_libupsclient_config="$withval"
3993 with_libupsclient="use_libupsclient_config"
3994 else if test -x "$withval/bin/libupsclient-config"
3995 then
3996 with_libupsclient_config="$withval/bin/libupsclient-config"
3997 with_libupsclient="use_libupsclient_config"
3998 else
3999 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
4000 with_libupsclient_cflags="-I$withval/include"
4001 with_libupsclient_libs="-L$withval/lib -lupsclient"
4002 with_libupsclient="yes"
4003 fi; fi
4004 fi; fi
4005 ],
4006 [with_libupsclient="use_pkgconfig"])
4008 # configure using libupsclient-config
4009 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4010 then
4011 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4012 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4013 if test $? -ne 0
4014 then
4015 with_libupsclient="no ($with_libupsclient_config failed)"
4016 fi
4017 with_libupsclient_libs="`$with_libupsclient_config --libs`"
4018 if test $? -ne 0
4019 then
4020 with_libupsclient="no ($with_libupsclient_config failed)"
4021 fi
4022 fi
4023 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4024 then
4025 with_libupsclient="yes"
4026 fi
4028 # configure using pkg-config
4029 if test "x$with_libupsclient" = "xuse_pkgconfig"
4030 then
4031 if test "x$PKG_CONFIG" = "x"
4032 then
4033 with_libupsclient="no (Don't have pkg-config)"
4034 fi
4035 fi
4036 if test "x$with_libupsclient" = "xuse_pkgconfig"
4037 then
4038 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4039 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4040 if test $? -ne 0
4041 then
4042 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4043 fi
4044 fi
4045 if test "x$with_libupsclient" = "xuse_pkgconfig"
4046 then
4047 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4048 if test $? -ne 0
4049 then
4050 with_libupsclient="no ($PKG_CONFIG failed)"
4051 fi
4052 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4053 if test $? -ne 0
4054 then
4055 with_libupsclient="no ($PKG_CONFIG failed)"
4056 fi
4057 fi
4058 if test "x$with_libupsclient" = "xuse_pkgconfig"
4059 then
4060 with_libupsclient="yes"
4061 fi
4063 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4064 # the actual checks.
4065 if test "x$with_libupsclient" = "xyes"
4066 then
4067 SAVE_CPPFLAGS="$CPPFLAGS"
4068 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4070 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4072 CPPFLAGS="$SAVE_CPPFLAGS"
4073 fi
4074 if test "x$with_libupsclient" = "xyes"
4075 then
4076 SAVE_CPPFLAGS="$CPPFLAGS"
4077 SAVE_LDFLAGS="$LDFLAGS"
4079 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4080 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4082 AC_CHECK_LIB(upsclient, upscli_connect,
4083 [with_libupsclient="yes"],
4084 [with_libupsclient="no (symbol upscli_connect not found)"])
4086 CPPFLAGS="$SAVE_CPPFLAGS"
4087 LDFLAGS="$SAVE_LDFLAGS"
4088 fi
4089 if test "x$with_libupsclient" = "xyes"
4090 then
4091 SAVE_CPPFLAGS="$CPPFLAGS"
4092 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4094 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4095 [#include <stdlib.h>
4096 #include <stdio.h>
4097 #include <upsclient.h>])
4099 CPPFLAGS="$SAVE_CPPFLAGS"
4100 fi
4101 if test "x$with_libupsclient" = "xyes"
4102 then
4103 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4104 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4105 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4106 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4107 fi
4108 # }}}
4110 # --with-libxmms {{{
4111 with_xmms_config="xmms-config"
4112 with_xmms_cflags=""
4113 with_xmms_libs=""
4114 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4115 [
4116 if test "x$withval" != "xno" \
4117 && test "x$withval" != "xyes"
4118 then
4119 if test -f "$withval" && test -x "$withval";
4120 then
4121 with_xmms_config="$withval"
4122 else if test -x "$withval/bin/xmms-config"
4123 then
4124 with_xmms_config="$withval/bin/xmms-config"
4125 fi; fi
4126 with_libxmms="yes"
4127 else if test "x$withval" = "xno"
4128 then
4129 with_libxmms="no"
4130 else
4131 with_libxmms="yes"
4132 fi; fi
4133 ],
4134 [
4135 with_libxmms="yes"
4136 ])
4137 if test "x$with_libxmms" = "xyes"
4138 then
4139 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4140 xmms_config_status=$?
4142 if test $xmms_config_status -ne 0
4143 then
4144 with_libxmms="no"
4145 fi
4146 fi
4147 if test "x$with_libxmms" = "xyes"
4148 then
4149 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4150 xmms_config_status=$?
4152 if test $xmms_config_status -ne 0
4153 then
4154 with_libxmms="no"
4155 fi
4156 fi
4157 if test "x$with_libxmms" = "xyes"
4158 then
4159 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4160 [
4161 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4162 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4163 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4164 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4165 ],
4166 [
4167 with_libxmms="no"
4168 ],
4169 [$with_xmms_libs])
4170 fi
4171 with_libxmms_numeric=0
4172 if test "x$with_libxmms" = "xyes"
4173 then
4174 with_libxmms_numeric=1
4175 fi
4176 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4177 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4178 # }}}
4180 # --with-libyajl {{{
4181 with_libyajl_cppflags=""
4182 with_libyajl_ldflags=""
4183 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4184 [
4185 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4186 then
4187 with_libyajl_cppflags="-I$withval/include"
4188 with_libyajl_ldflags="-L$withval/lib"
4189 with_libyajl="yes"
4190 else
4191 with_libyajl="$withval"
4192 fi
4193 ],
4194 [
4195 with_libyajl="yes"
4196 ])
4197 if test "x$with_libyajl" = "xyes"
4198 then
4199 SAVE_CPPFLAGS="$CPPFLAGS"
4200 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4202 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4203 AC_CHECK_HEADERS(yajl/yajl_version.h)
4205 CPPFLAGS="$SAVE_CPPFLAGS"
4206 fi
4207 if test "x$with_libyajl" = "xyes"
4208 then
4209 SAVE_CPPFLAGS="$CPPFLAGS"
4210 SAVE_LDFLAGS="$LDFLAGS"
4211 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4212 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4214 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4216 CPPFLAGS="$SAVE_CPPFLAGS"
4217 LDFLAGS="$SAVE_LDFLAGS"
4218 fi
4219 if test "x$with_libyajl" = "xyes"
4220 then
4221 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4222 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4223 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4224 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4225 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4226 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4227 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4228 fi
4229 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4230 # }}}
4232 # --with-libvarnish {{{
4233 with_libvarnish_cppflags=""
4234 with_libvarnish_cflags=""
4235 with_libvarnish_libs=""
4236 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4237 [
4238 if test "x$withval" = "xno"
4239 then
4240 with_libvarnish="no"
4241 else if test "x$withval" = "xyes"
4242 then
4243 with_libvarnish="use_pkgconfig"
4244 else if test -d "$with_libvarnish/lib"
4245 then
4246 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4247 with_libvarnish_cflags="-I$withval/include"
4248 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4249 with_libvarnish="yes"
4250 fi; fi; fi
4251 ],
4252 [with_libvarnish="use_pkgconfig"])
4254 # configure using pkg-config
4255 if test "x$with_libvarnish" = "xuse_pkgconfig"
4256 then
4257 if test "x$PKG_CONFIG" = "x"
4258 then
4259 with_libvarnish="no (Don't have pkg-config)"
4260 fi
4261 fi
4262 if test "x$with_libvarnish" = "xuse_pkgconfig"
4263 then
4264 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4265 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4266 if test $? -ne 0
4267 then
4268 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4269 fi
4270 fi
4271 if test "x$with_libvarnish" = "xuse_pkgconfig"
4272 then
4273 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4274 if test $? -ne 0
4275 then
4276 with_libvarnish="no ($PKG_CONFIG failed)"
4277 fi
4278 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4279 if test $? -ne 0
4280 then
4281 with_libvarnish="no ($PKG_CONFIG failed)"
4282 fi
4283 fi
4284 if test "x$with_libvarnish" = "xuse_pkgconfig"
4285 then
4286 with_libvarnish="yes"
4287 fi
4289 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4290 # the actual checks.
4291 if test "x$with_libvarnish" = "xyes"
4292 then
4293 SAVE_CPPFLAGS="$CPPFLAGS"
4294 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4295 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4297 CPPFLAGS="$SAVE_CPPFLAGS"
4298 fi
4299 if test "x$with_libvarnish" = "xyes"
4300 then
4301 SAVE_CPPFLAGS="$CPPFLAGS"
4302 #SAVE_LDFLAGS="$LDFLAGS"
4304 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4305 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4307 AC_CHECK_HEADERS(varnish/vsc.h,
4308 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4309 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4311 CPPFLAGS="$SAVE_CPPFLAGS"
4312 #LDFLAGS="$SAVE_LDFLAGS"
4313 fi
4314 if test "x$with_libvarnish" = "xyes"
4315 then
4316 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4317 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4318 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4319 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4320 fi
4321 # }}}
4323 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4324 with_libxml2="no (pkg-config isn't available)"
4325 with_libxml2_cflags=""
4326 with_libxml2_ldflags=""
4327 with_libvirt="no (pkg-config isn't available)"
4328 with_libvirt_cflags=""
4329 with_libvirt_ldflags=""
4330 if test "x$PKG_CONFIG" != "x"
4331 then
4332 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4333 if test "$?" = "0"
4334 then
4335 with_libxml2="yes"
4336 else
4337 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4338 fi
4340 $PKG_CONFIG --exists libvirt 2>/dev/null
4341 if test "$?" = "0"
4342 then
4343 with_libvirt="yes"
4344 else
4345 with_libvirt="no (pkg-config doesn't know libvirt)"
4346 fi
4347 fi
4348 if test "x$with_libxml2" = "xyes"
4349 then
4350 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4351 if test $? -ne 0
4352 then
4353 with_libxml2="no"
4354 fi
4355 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4356 if test $? -ne 0
4357 then
4358 with_libxml2="no"
4359 fi
4360 fi
4361 if test "x$with_libxml2" = "xyes"
4362 then
4363 SAVE_CPPFLAGS="$CPPFLAGS"
4364 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4366 AC_CHECK_HEADERS(libxml/parser.h, [],
4367 [with_libxml2="no (libxml/parser.h not found)"])
4369 CPPFLAGS="$SAVE_CPPFLAGS"
4370 fi
4371 if test "x$with_libxml2" = "xyes"
4372 then
4373 SAVE_CFLAGS="$CFLAGS"
4374 SAVE_LDFLAGS="$LDFLAGS"
4376 CFLAGS="$CFLAGS $with_libxml2_cflags"
4377 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4379 AC_CHECK_LIB(xml2, xmlXPathEval,
4380 [with_libxml2="yes"],
4381 [with_libxml2="no (symbol xmlXPathEval not found)"])
4383 CFLAGS="$SAVE_CFLAGS"
4384 LDFLAGS="$SAVE_LDFLAGS"
4385 fi
4386 dnl Add the right compiler flags and libraries.
4387 if test "x$with_libxml2" = "xyes"; then
4388 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4389 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4390 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4391 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4392 fi
4393 if test "x$with_libvirt" = "xyes"
4394 then
4395 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4396 if test $? -ne 0
4397 then
4398 with_libvirt="no"
4399 fi
4400 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4401 if test $? -ne 0
4402 then
4403 with_libvirt="no"
4404 fi
4405 fi
4406 if test "x$with_libvirt" = "xyes"
4407 then
4408 SAVE_CPPFLAGS="$CPPFLAGS"
4409 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4411 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4412 [with_libvirt="no (libvirt/libvirt.h not found)"])
4414 CPPFLAGS="$SAVE_CPPFLAGS"
4415 fi
4416 if test "x$with_libvirt" = "xyes"
4417 then
4418 SAVE_CFLAGS="$CFLAGS"
4419 SAVE_LDFLAGS="$LDFLAGS"
4421 CFLAGS="$CFLAGS $with_libvirt_cflags"
4422 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4424 AC_CHECK_LIB(virt, virDomainBlockStats,
4425 [with_libvirt="yes"],
4426 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4428 CFLAGS="$SAVE_CFLAGS"
4429 LDFLAGS="$SAVE_LDFLAGS"
4430 fi
4431 dnl Add the right compiler flags and libraries.
4432 if test "x$with_libvirt" = "xyes"; then
4433 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4434 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4435 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4436 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4437 fi
4438 # }}}
4440 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4441 with_libopenipmipthread="yes"
4442 with_libopenipmipthread_cflags=""
4443 with_libopenipmipthread_libs=""
4445 AC_MSG_CHECKING([for pkg-config])
4446 temp_result="no"
4447 if test "x$PKG_CONFIG" = "x"
4448 then
4449 with_libopenipmipthread="no"
4450 temp_result="no"
4451 else
4452 temp_result="$PKG_CONFIG"
4453 fi
4454 AC_MSG_RESULT([$temp_result])
4456 if test "x$with_libopenipmipthread" = "xyes"
4457 then
4458 AC_MSG_CHECKING([for libOpenIPMIpthread])
4459 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4460 if test "$?" != "0"
4461 then
4462 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4463 fi
4464 AC_MSG_RESULT([$with_libopenipmipthread])
4465 fi
4467 if test "x$with_libopenipmipthread" = "xyes"
4468 then
4469 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4470 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4471 if test "$?" = "0"
4472 then
4473 with_libopenipmipthread_cflags="$temp_result"
4474 else
4475 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4476 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4477 fi
4478 AC_MSG_RESULT([$temp_result])
4479 fi
4481 if test "x$with_libopenipmipthread" = "xyes"
4482 then
4483 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4484 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4485 if test "$?" = "0"
4486 then
4487 with_libopenipmipthread_ldflags="$temp_result"
4488 else
4489 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4490 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4491 fi
4492 AC_MSG_RESULT([$temp_result])
4493 fi
4495 if test "x$with_libopenipmipthread" = "xyes"
4496 then
4497 SAVE_CPPFLAGS="$CPPFLAGS"
4498 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4500 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4501 [with_libopenipmipthread="yes"],
4502 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4503 [#include <OpenIPMI/ipmiif.h>
4504 #include <OpenIPMI/ipmi_err.h>
4505 #include <OpenIPMI/ipmi_posix.h>
4506 #include <OpenIPMI/ipmi_conn.h>
4507 ])
4509 CPPFLAGS="$SAVE_CPPFLAGS"
4510 fi
4512 if test "x$with_libopenipmipthread" = "xyes"
4513 then
4514 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4515 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4516 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4517 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4518 fi
4519 # }}}
4521 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4522 [with_libnotify="yes"],
4523 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4524 with_libnotify="no"
4525 else
4526 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4527 fi])
4529 # Check for enabled/disabled features
4530 #
4532 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4533 # ------------------------------------------------------------
4534 dnl
4535 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4536 dnl
4537 AC_DEFUN(
4538 [AC_COLLECTD],
4539 [
4540 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4541 m4_if(
4542 [$2],
4543 [enable],
4544 [dnl
4545 m4_define([EnDis],[disabled])dnl
4546 m4_define([YesNo],[no])dnl
4547 ],dnl
4548 [m4_if(
4549 [$2],
4550 [disable],
4551 [dnl
4552 m4_define([EnDis],[enabled])dnl
4553 m4_define([YesNo],[yes])dnl
4554 ],
4555 [dnl
4556 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4557 ]dnl
4558 )]dnl
4559 )dnl
4560 m4_if([$3], [feature], [],
4561 [m4_if(
4562 [$3], [module], [],
4563 [dnl
4564 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4565 ]dnl
4566 )]dnl
4567 )dnl
4568 AC_ARG_ENABLE(
4569 [$1],
4570 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4571 [],
4572 enable_$1='[YesNo]'dnl
4573 )# AC_ARG_ENABLE
4574 if test "x$enable_$1" = "xno"
4575 then
4576 collectd_$1=0
4577 else
4578 if test "x$enable_$1" = "xyes"
4579 then
4580 collectd_$1=1
4581 else
4582 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4583 collectd_$1=1
4584 enable_$1='yes'
4585 fi
4586 fi
4587 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4588 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4589 ]dnl
4590 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4592 # AC_PLUGIN(name, default, info)
4593 # ------------------------------------------------------------
4594 dnl
4595 AC_DEFUN(
4596 [AC_PLUGIN],
4597 [
4598 enable_plugin="no"
4599 force="no"
4600 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4601 [
4602 if test "x$enableval" = "xyes"
4603 then
4604 enable_plugin="yes"
4605 else if test "x$enableval" = "xforce"
4606 then
4607 enable_plugin="yes"
4608 force="yes"
4609 else
4610 enable_plugin="no (disabled on command line)"
4611 fi; fi
4612 ],
4613 [
4614 if test "x$enable_all_plugins" = "xauto"
4615 then
4616 if test "x$2" = "xyes"
4617 then
4618 enable_plugin="yes"
4619 else
4620 enable_plugin="no"
4621 fi
4622 else
4623 enable_plugin="$enable_all_plugins"
4624 fi
4625 ])
4626 if test "x$enable_plugin" = "xyes"
4627 then
4628 if test "x$2" = "xyes" || test "x$force" = "xyes"
4629 then
4630 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4631 if test "x$2" != "xyes"
4632 then
4633 dependency_warning="yes"
4634 fi
4635 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4636 dependency_error="yes"
4637 enable_plugin="no (dependency error)"
4638 fi
4639 fi
4640 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4641 enable_$1="$enable_plugin"
4642 ]
4643 )# AC_PLUGIN(name, default, info)
4645 m4_divert_once([HELP_ENABLE], [
4646 collectd features:])
4647 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4648 AC_COLLECTD([debug], [enable], [feature], [debugging])
4649 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4650 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4652 dependency_warning="no"
4653 dependency_error="no"
4655 plugin_ascent="no"
4656 plugin_battery="no"
4657 plugin_bind="no"
4658 plugin_conntrack="no"
4659 plugin_contextswitch="no"
4660 plugin_cpu="no"
4661 plugin_cpufreq="no"
4662 plugin_curl_json="no"
4663 plugin_curl_xml="no"
4664 plugin_df="no"
4665 plugin_disk="no"
4666 plugin_entropy="no"
4667 plugin_ethstat="no"
4668 plugin_fscache="no"
4669 plugin_interface="no"
4670 plugin_ipmi="no"
4671 plugin_ipvs="no"
4672 plugin_irq="no"
4673 plugin_libvirt="no"
4674 plugin_load="no"
4675 plugin_memory="no"
4676 plugin_multimeter="no"
4677 plugin_nfs="no"
4678 plugin_numa="no"
4679 plugin_perl="no"
4680 plugin_processes="no"
4681 plugin_protocols="no"
4682 plugin_serial="no"
4683 plugin_swap="no"
4684 plugin_tape="no"
4685 plugin_tcpconns="no"
4686 plugin_ted="no"
4687 plugin_thermal="no"
4688 plugin_users="no"
4689 plugin_uptime="no"
4690 plugin_vmem="no"
4691 plugin_vserver="no"
4692 plugin_wireless="no"
4693 plugin_zfs_arc="no"
4695 # Linux
4696 if test "x$ac_system" = "xLinux"
4697 then
4698 plugin_battery="yes"
4699 plugin_conntrack="yes"
4700 plugin_contextswitch="yes"
4701 plugin_cpu="yes"
4702 plugin_cpufreq="yes"
4703 plugin_disk="yes"
4704 plugin_entropy="yes"
4705 plugin_fscache="yes"
4706 plugin_interface="yes"
4707 plugin_irq="yes"
4708 plugin_load="yes"
4709 plugin_memory="yes"
4710 plugin_nfs="yes"
4711 plugin_numa="yes"
4712 plugin_processes="yes"
4713 plugin_protocols="yes"
4714 plugin_serial="yes"
4715 plugin_swap="yes"
4716 plugin_tcpconns="yes"
4717 plugin_thermal="yes"
4718 plugin_uptime="yes"
4719 plugin_vmem="yes"
4720 plugin_vserver="yes"
4721 plugin_wireless="yes"
4723 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4724 then
4725 plugin_ipvs="yes"
4726 fi
4727 fi
4729 if test "x$ac_system" = "xOpenBSD"
4730 then
4731 plugin_tcpconns="yes"
4732 fi
4734 # Mac OS X devices
4735 if test "x$with_libiokit" = "xyes"
4736 then
4737 plugin_battery="yes"
4738 plugin_disk="yes"
4739 fi
4741 # AIX
4743 if test "x$ac_system" = "xAIX"
4744 then
4745 plugin_tcpconns="yes"
4746 fi
4748 if test "x$with_perfstat" = "xyes"
4749 then
4750 plugin_cpu="yes"
4751 plugin_contextswitch="yes"
4752 plugin_disk="yes"
4753 plugin_memory="yes"
4754 plugin_swap="yes"
4755 plugin_interface="yes"
4756 plugin_load="yes"
4757 plugin_uptime="yes"
4758 fi
4760 if test "x$with_procinfo" = "xyes"
4761 then
4762 plugin_processes="yes"
4763 fi
4765 # Solaris
4766 if test "x$with_kstat" = "xyes"
4767 then
4768 plugin_nfs="yes"
4769 plugin_uptime="yes"
4770 plugin_zfs_arc="yes"
4771 fi
4773 if test "x$with_devinfo$with_kstat" = "xyesyes"
4774 then
4775 plugin_cpu="yes"
4776 plugin_disk="yes"
4777 plugin_interface="yes"
4778 plugin_memory="yes"
4779 plugin_tape="yes"
4780 fi
4782 # libstatgrab
4783 if test "x$with_libstatgrab" = "xyes"
4784 then
4785 plugin_cpu="yes"
4786 plugin_disk="yes"
4787 plugin_interface="yes"
4788 plugin_load="yes"
4789 plugin_memory="yes"
4790 plugin_swap="yes"
4791 plugin_users="yes"
4792 fi
4794 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4795 then
4796 plugin_ascent="yes"
4797 if test "x$have_strptime" = "xyes"
4798 then
4799 plugin_bind="yes"
4800 fi
4801 fi
4803 if test "x$with_libopenipmipthread" = "xyes"
4804 then
4805 plugin_ipmi="yes"
4806 fi
4808 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4809 then
4810 plugin_curl_json="yes"
4811 fi
4813 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4814 then
4815 plugin_curl_xml="yes"
4816 fi
4818 if test "x$have_processor_info" = "xyes"
4819 then
4820 plugin_cpu="yes"
4821 fi
4822 if test "x$have_sysctl" = "xyes"
4823 then
4824 plugin_cpu="yes"
4825 plugin_memory="yes"
4826 plugin_uptime="yes"
4827 if test "x$ac_system" = "xDarwin"
4828 then
4829 plugin_swap="yes"
4830 fi
4831 fi
4832 if test "x$have_sysctlbyname" = "xyes"
4833 then
4834 plugin_contextswitch="yes"
4835 plugin_cpu="yes"
4836 plugin_memory="yes"
4837 plugin_tcpconns="yes"
4838 fi
4840 # Df plugin: Check if we know how to determine mount points first.
4841 #if test "x$have_listmntent" = "xyes"; then
4842 # plugin_df="yes"
4843 #fi
4844 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4845 then
4846 plugin_df="yes"
4847 fi
4848 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4849 then
4850 plugin_df="yes"
4851 fi
4852 #if test "x$have_getmntent" = "xseq"
4853 #then
4854 # plugin_df="yes"
4855 #fi
4856 if test "x$c_cv_have_one_getmntent" = "xyes"
4857 then
4858 plugin_df="yes"
4859 fi
4861 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4862 if test "x$plugin_df" = "xyes"
4863 then
4864 plugin_df="no"
4865 if test "x$have_statfs" = "xyes"
4866 then
4867 plugin_df="yes"
4868 fi
4869 if test "x$have_statvfs" = "xyes"
4870 then
4871 plugin_df="yes"
4872 fi
4873 fi
4875 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4876 then
4877 plugin_ethstat="yes"
4878 fi
4880 if test "x$have_getifaddrs" = "xyes"
4881 then
4882 plugin_interface="yes"
4883 fi
4885 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4886 then
4887 plugin_libvirt="yes"
4888 fi
4890 if test "x$have_getloadavg" = "xyes"
4891 then
4892 plugin_load="yes"
4893 fi
4895 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4896 then
4897 plugin_perl="yes"
4898 fi
4900 # Mac OS X memory interface
4901 if test "x$have_host_statistics" = "xyes"
4902 then
4903 plugin_memory="yes"
4904 fi
4906 if test "x$have_termios_h" = "xyes"
4907 then
4908 plugin_multimeter="yes"
4909 plugin_ted="yes"
4910 fi
4912 if test "x$have_thread_info" = "xyes"
4913 then
4914 plugin_processes="yes"
4915 fi
4917 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4918 then
4919 plugin_processes="yes"
4920 fi
4922 if test "x$with_kvm_getswapinfo" = "xyes"
4923 then
4924 plugin_swap="yes"
4925 fi
4927 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4928 then
4929 plugin_swap="yes"
4930 fi
4932 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4933 then
4934 plugin_tcpconns="yes"
4935 fi
4937 if test "x$have_getutent" = "xyes"
4938 then
4939 plugin_users="yes"
4940 fi
4941 if test "x$have_getutxent" = "xyes"
4942 then
4943 plugin_users="yes"
4944 fi
4946 m4_divert_once([HELP_ENABLE], [
4947 collectd plugins:])
4949 AC_ARG_ENABLE([all-plugins],
4950 AC_HELP_STRING([--enable-all-plugins],
4951 [enable all plugins (auto by def)]),
4952 [
4953 if test "x$enableval" = "xyes"
4954 then
4955 enable_all_plugins="yes"
4956 else if test "x$enableval" = "xauto"
4957 then
4958 enable_all_plugins="auto"
4959 else
4960 enable_all_plugins="no"
4961 fi; fi
4962 ],
4963 [enable_all_plugins="auto"])
4965 m4_divert_once([HELP_ENABLE], [])
4967 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4968 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4969 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4970 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4971 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4972 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4973 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4974 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4975 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4976 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4977 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4978 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4979 AC_PLUGIN([csv], [yes], [CSV output plugin])
4980 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4981 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4982 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4983 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4984 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4985 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4986 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4987 AC_PLUGIN([email], [yes], [EMail statistics])
4988 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4989 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4990 AC_PLUGIN([exec], [yes], [Execution of external programs])
4991 AC_PLUGIN([filecount], [yes], [Count files in directories])
4992 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4993 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4994 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4995 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4996 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4997 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4998 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4999 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
5000 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
5001 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
5002 AC_PLUGIN([load], [$plugin_load], [System load])
5003 AC_PLUGIN([logfile], [yes], [File logging plugin])
5004 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
5005 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
5006 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
5007 AC_PLUGIN([match_hashed], [yes], [The hashed match])
5008 AC_PLUGIN([match_regex], [yes], [The regex match])
5009 AC_PLUGIN([match_timediff], [yes], [The timediff match])
5010 AC_PLUGIN([match_value], [yes], [The value match])
5011 AC_PLUGIN([mbmon], [yes], [Query mbmond])
5012 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5013 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5014 AC_PLUGIN([memcached], [yes], [memcached statistics])
5015 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5016 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5017 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5018 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5019 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5020 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
5021 AC_PLUGIN([network], [yes], [Network communication plugin])
5022 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5023 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5024 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5025 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5026 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5027 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5028 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5029 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5030 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5031 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5032 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5033 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5034 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5035 # FIXME: Check for libevent, too.
5036 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5037 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5038 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5039 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5040 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5041 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5042 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5043 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
5044 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5045 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5046 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5047 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5048 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5049 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5050 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5051 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5052 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5053 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5054 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5055 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5056 AC_PLUGIN([target_notification], [yes], [The notification target])
5057 AC_PLUGIN([target_replace], [yes], [The replace target])
5058 AC_PLUGIN([target_scale],[yes], [The scale target])
5059 AC_PLUGIN([target_set], [yes], [The set target])
5060 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5061 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5062 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5063 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5064 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5065 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5066 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5067 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5068 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5069 AC_PLUGIN([users], [$plugin_users], [User statistics])
5070 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5071 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5072 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5073 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5074 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5075 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5076 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5077 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5078 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5079 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5080 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5081 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5083 dnl Default configuration file
5084 # Load either syslog or logfile
5085 LOAD_PLUGIN_SYSLOG=""
5086 LOAD_PLUGIN_LOGFILE=""
5088 AC_MSG_CHECKING([which default log plugin to load])
5089 default_log_plugin="none"
5090 if test "x$enable_syslog" = "xyes"
5091 then
5092 default_log_plugin="syslog"
5093 else
5094 LOAD_PLUGIN_SYSLOG="##"
5095 fi
5097 if test "x$enable_logfile" = "xyes"
5098 then
5099 if test "x$default_log_plugin" = "xnone"
5100 then
5101 default_log_plugin="logfile"
5102 else
5103 LOAD_PLUGIN_LOGFILE="#"
5104 fi
5105 else
5106 LOAD_PLUGIN_LOGFILE="##"
5107 fi
5108 AC_MSG_RESULT([$default_log_plugin])
5110 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5111 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5113 DEFAULT_LOG_LEVEL="info"
5114 if test "x$enable_debug" = "xyes"
5115 then
5116 DEFAULT_LOG_LEVEL="debug"
5117 fi
5118 AC_SUBST(DEFAULT_LOG_LEVEL)
5120 # Load only one of rrdtool, network, csv in the default config.
5121 LOAD_PLUGIN_RRDTOOL=""
5122 LOAD_PLUGIN_NETWORK=""
5123 LOAD_PLUGIN_CSV=""
5125 AC_MSG_CHECKING([which default write plugin to load])
5126 default_write_plugin="none"
5127 if test "x$enable_rrdtool" = "xyes"
5128 then
5129 default_write_plugin="rrdtool"
5130 else
5131 LOAD_PLUGIN_RRDTOOL="##"
5132 fi
5134 if test "x$enable_network" = "xyes"
5135 then
5136 if test "x$default_write_plugin" = "xnone"
5137 then
5138 default_write_plugin="network"
5139 else
5140 LOAD_PLUGIN_NETWORK="#"
5141 fi
5142 else
5143 LOAD_PLUGIN_NETWORK="##"
5144 fi
5146 if test "x$enable_csv" = "xyes"
5147 then
5148 if test "x$default_write_plugin" = "xnone"
5149 then
5150 default_write_plugin="csv"
5151 else
5152 LOAD_PLUGIN_CSV="#"
5153 fi
5154 else
5155 LOAD_PLUGIN_CSV="##"
5156 fi
5157 AC_MSG_RESULT([$default_write_plugin])
5159 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5160 AC_SUBST(LOAD_PLUGIN_NETWORK)
5161 AC_SUBST(LOAD_PLUGIN_CSV)
5163 dnl ip_vs.h
5164 if test "x$ac_system" = "xLinux" \
5165 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5166 then
5167 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5168 fi
5170 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5171 then
5172 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5173 fi
5175 dnl Perl bindings
5176 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5177 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5178 [
5179 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5180 then
5181 PERL_BINDINGS_OPTIONS="$withval"
5182 with_perl_bindings="yes"
5183 else
5184 with_perl_bindings="$withval"
5185 fi
5186 ],
5187 [
5188 if test -n "$perl_interpreter"
5189 then
5190 with_perl_bindings="yes"
5191 else
5192 with_perl_bindings="no (no perl interpreter found)"
5193 fi
5194 ])
5195 if test "x$with_perl_bindings" = "xyes"
5196 then
5197 PERL_BINDINGS="perl"
5198 else
5199 PERL_BINDINGS=""
5200 fi
5201 AC_SUBST(PERL_BINDINGS)
5202 AC_SUBST(PERL_BINDINGS_OPTIONS)
5204 dnl libcollectdclient
5205 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5206 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5207 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5209 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5211 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5213 AC_SUBST(LCC_VERSION_MAJOR)
5214 AC_SUBST(LCC_VERSION_MINOR)
5215 AC_SUBST(LCC_VERSION_PATCH)
5216 AC_SUBST(LCC_VERSION_EXTRA)
5217 AC_SUBST(LCC_VERSION_STRING)
5219 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5221 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5223 if test "x$with_librrd" = "xyes" \
5224 && test "x$librrd_threadsafe" != "xyes"
5225 then
5226 with_librrd="yes (warning: librrd is not thread-safe)"
5227 fi
5229 if test "x$with_libperl" = "xyes"
5230 then
5231 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5232 else
5233 enable_perl="no (needs libperl)"
5234 fi
5236 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5237 then
5238 enable_perl="no (libperl doesn't support ithreads)"
5239 fi
5241 if test "x$with_perl_bindings" = "xyes" \
5242 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5243 then
5244 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5245 fi
5247 cat <<EOF;
5249 Configuration:
5250 Libraries:
5251 libcredis . . . . . . $with_libcredis
5252 libcurl . . . . . . . $with_libcurl
5253 libdbi . . . . . . . $with_libdbi
5254 libesmtp . . . . . . $with_libesmtp
5255 libganglia . . . . . $with_libganglia
5256 libgcrypt . . . . . . $with_libgcrypt
5257 libhal . . . . . . . $with_libhal
5258 libiokit . . . . . . $with_libiokit
5259 libiptc . . . . . . . $with_libiptc
5260 libjvm . . . . . . . $with_java
5261 libkstat . . . . . . $with_kstat
5262 libkvm . . . . . . . $with_libkvm
5263 libmemcached . . . . $with_libmemcached
5264 libmodbus . . . . . . $with_libmodbus
5265 libmongoc . . . . . . $with_libmongoc
5266 libmysql . . . . . . $with_libmysql
5267 libnetapp . . . . . . $with_libnetapp
5268 libnetlink . . . . . $with_libnetlink
5269 libnetsnmp . . . . . $with_libnetsnmp
5270 libnotify . . . . . . $with_libnotify
5271 liboconfig . . . . . $with_liboconfig
5272 libopenipmi . . . . . $with_libopenipmipthread
5273 liboping . . . . . . $with_liboping
5274 libowcapi . . . . . . $with_libowcapi
5275 libpcap . . . . . . . $with_libpcap
5276 libperfstat . . . . . $with_perfstat
5277 libperl . . . . . . . $with_libperl
5278 libpq . . . . . . . . $with_libpq
5279 libpthread . . . . . $with_libpthread
5280 librabbitmq . . . . . $with_librabbitmq
5281 librouteros . . . . . $with_librouteros
5282 librrd . . . . . . . $with_librrd
5283 libsensors . . . . . $with_libsensors
5284 libstatgrab . . . . . $with_libstatgrab
5285 libtokyotyrant . . . $with_libtokyotyrant
5286 libupsclient . . . . $with_libupsclient
5287 libvarnish . . . . . $with_libvarnish
5288 libvirt . . . . . . . $with_libvirt
5289 libxml2 . . . . . . . $with_libxml2
5290 libxmms . . . . . . . $with_libxmms
5291 libyajl . . . . . . . $with_libyajl
5292 oracle . . . . . . . $with_oracle
5293 protobuf-c . . . . . $have_protoc_c
5294 python . . . . . . . $with_python
5296 Features:
5297 daemon mode . . . . . $enable_daemon
5298 debug . . . . . . . . $enable_debug
5300 Bindings:
5301 perl . . . . . . . . $with_perl_bindings
5303 Modules:
5304 aggregation . . . . . $enable_aggregation
5305 amqp . . . . . . . $enable_amqp
5306 apache . . . . . . . $enable_apache
5307 apcups . . . . . . . $enable_apcups
5308 apple_sensors . . . . $enable_apple_sensors
5309 ascent . . . . . . . $enable_ascent
5310 battery . . . . . . . $enable_battery
5311 bind . . . . . . . . $enable_bind
5312 conntrack . . . . . . $enable_conntrack
5313 contextswitch . . . . $enable_contextswitch
5314 cpu . . . . . . . . . $enable_cpu
5315 cpufreq . . . . . . . $enable_cpufreq
5316 csv . . . . . . . . . $enable_csv
5317 curl . . . . . . . . $enable_curl
5318 curl_json . . . . . . $enable_curl_json
5319 curl_xml . . . . . . $enable_curl_xml
5320 dbi . . . . . . . . . $enable_dbi
5321 df . . . . . . . . . $enable_df
5322 disk . . . . . . . . $enable_disk
5323 dns . . . . . . . . . $enable_dns
5324 email . . . . . . . . $enable_email
5325 entropy . . . . . . . $enable_entropy
5326 ethstat . . . . . . . $enable_ethstat
5327 exec . . . . . . . . $enable_exec
5328 filecount . . . . . . $enable_filecount
5329 fscache . . . . . . . $enable_fscache
5330 gmond . . . . . . . . $enable_gmond
5331 hddtemp . . . . . . . $enable_hddtemp
5332 interface . . . . . . $enable_interface
5333 ipmi . . . . . . . . $enable_ipmi
5334 iptables . . . . . . $enable_iptables
5335 ipvs . . . . . . . . $enable_ipvs
5336 irq . . . . . . . . . $enable_irq
5337 java . . . . . . . . $enable_java
5338 libvirt . . . . . . . $enable_libvirt
5339 load . . . . . . . . $enable_load
5340 logfile . . . . . . . $enable_logfile
5341 lpar . . . . . . . . $enable_lpar
5342 madwifi . . . . . . . $enable_madwifi
5343 match_empty_counter . $enable_match_empty_counter
5344 match_hashed . . . . $enable_match_hashed
5345 match_regex . . . . . $enable_match_regex
5346 match_timediff . . . $enable_match_timediff
5347 match_value . . . . . $enable_match_value
5348 mbmon . . . . . . . . $enable_mbmon
5349 md . . . . . . . . . $enable_md
5350 memcachec . . . . . . $enable_memcachec
5351 memcached . . . . . . $enable_memcached
5352 memory . . . . . . . $enable_memory
5353 modbus . . . . . . . $enable_modbus
5354 multimeter . . . . . $enable_multimeter
5355 mysql . . . . . . . . $enable_mysql
5356 netapp . . . . . . . $enable_netapp
5357 netlink . . . . . . . $enable_netlink
5358 network . . . . . . . $enable_network
5359 nfs . . . . . . . . . $enable_nfs
5360 nginx . . . . . . . . $enable_nginx
5361 notify_desktop . . . $enable_notify_desktop
5362 notify_email . . . . $enable_notify_email
5363 ntpd . . . . . . . . $enable_ntpd
5364 numa . . . . . . . . $enable_numa
5365 nut . . . . . . . . . $enable_nut
5366 olsrd . . . . . . . . $enable_olsrd
5367 onewire . . . . . . . $enable_onewire
5368 openvpn . . . . . . . $enable_openvpn
5369 oracle . . . . . . . $enable_oracle
5370 perl . . . . . . . . $enable_perl
5371 pf . . . . . . . . . $enable_pf
5372 pinba . . . . . . . . $enable_pinba
5373 ping . . . . . . . . $enable_ping
5374 postgresql . . . . . $enable_postgresql
5375 powerdns . . . . . . $enable_powerdns
5376 processes . . . . . . $enable_processes
5377 protocols . . . . . . $enable_protocols
5378 python . . . . . . . $enable_python
5379 redis . . . . . . . . $enable_redis
5380 routeros . . . . . . $enable_routeros
5381 rrdcached . . . . . . $enable_rrdcached
5382 rrdtool . . . . . . . $enable_rrdtool
5383 sensors . . . . . . . $enable_sensors
5384 serial . . . . . . . $enable_serial
5385 snmp . . . . . . . . $enable_snmp
5386 swap . . . . . . . . $enable_swap
5387 syslog . . . . . . . $enable_syslog
5388 table . . . . . . . . $enable_table
5389 tail . . . . . . . . $enable_tail
5390 tail_csv . . . . . . $enable_tail_csv
5391 tape . . . . . . . . $enable_tape
5392 target_notification . $enable_target_notification
5393 target_replace . . . $enable_target_replace
5394 target_scale . . . . $enable_target_scale
5395 target_set . . . . . $enable_target_set
5396 target_v5upgrade . . $enable_target_v5upgrade
5397 tcpconns . . . . . . $enable_tcpconns
5398 teamspeak2 . . . . . $enable_teamspeak2
5399 ted . . . . . . . . . $enable_ted
5400 thermal . . . . . . . $enable_thermal
5401 threshold . . . . . . $enable_threshold
5402 tokyotyrant . . . . . $enable_tokyotyrant
5403 unixsock . . . . . . $enable_unixsock
5404 uptime . . . . . . . $enable_uptime
5405 users . . . . . . . . $enable_users
5406 uuid . . . . . . . . $enable_uuid
5407 varnish . . . . . . . $enable_varnish
5408 vmem . . . . . . . . $enable_vmem
5409 vserver . . . . . . . $enable_vserver
5410 wireless . . . . . . $enable_wireless
5411 write_graphite . . . $enable_write_graphite
5412 write_http . . . . . $enable_write_http
5413 write_mongodb . . . . $enable_write_mongodb
5414 write_redis . . . . . $enable_write_redis
5415 write_riemann . . . . $enable_write_riemann
5416 xmms . . . . . . . . $enable_xmms
5417 zfs_arc . . . . . . . $enable_zfs_arc
5419 EOF
5421 if test "x$dependency_error" = "xyes"; then
5422 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5423 fi
5425 if test "x$dependency_warning" = "xyes"; then
5426 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5427 fi
5429 # vim: set fdm=marker :