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