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