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