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