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 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_PROG_CC_C_O
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
23 dnl configure libtool
24 AC_DISABLE_STATIC
25 AC_LIBLTDL_CONVENIENCE
26 AC_SUBST(LTDLINCL)
27 AC_SUBST(LIBLTDL)
28 AC_LIBTOOL_DLOPEN
29 AC_PROG_LIBTOOL
30 AC_PROG_LEX
31 AC_PROG_YACC
32 PKG_PROG_PKG_CONFIG
33 AC_CONFIG_SUBDIRS(libltdl)
35 AC_MSG_CHECKING([for kernel type ($host_os)])
36 case $host_os in
37 *linux*)
38 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
39 ac_system="Linux"
40 ;;
41 *solaris*)
42 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
43 ac_system="Solaris"
44 ;;
45 *darwin*)
46 ac_system="Darwin"
47 ;;
48 *openbsd*)
49 ac_system="OpenBSD"
50 ;;
51 *)
52 ac_system="unknown"
53 esac
54 AC_MSG_RESULT([$ac_system])
56 if test "x$ac_system" = "xLinux"
57 then
58 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
59 if test -z "$KERNEL_DIR"
60 then
61 KERNEL_DIR="/lib/modules/`uname -r`/source"
62 fi
64 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
65 AC_SUBST(KERNEL_CFLAGS)
66 fi
68 #
69 # Checks for header files.
70 #
71 AC_HEADER_STDC
72 AC_HEADER_SYS_WAIT
73 AC_HEADER_DIRENT
75 AC_CHECK_HEADERS(stdio.h stdint.h stdbool.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)
77 # For ping library
78 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
79 [#if HAVE_STDINT_H
80 # include <stdint.h>
81 #endif
82 #if HAVE_SYS_TYPES_H
83 # include <sys/types.h>
84 #endif
85 ])
86 AC_CHECK_HEADERS(netinet/in.h, [], [],
87 [#if HAVE_STDINT_H
88 # include <stdint.h>
89 #endif
90 #if HAVE_SYS_TYPES_H
91 # include <sys/types.h>
92 #endif
93 #if HAVE_NETINET_IN_SYSTM_H
94 # include <netinet/in_systm.h>
95 #endif
96 ])
97 AC_CHECK_HEADERS(netinet/ip.h, [], [],
98 [#if HAVE_STDINT_H
99 # include <stdint.h>
100 #endif
101 #if HAVE_SYS_TYPES_H
102 # include <sys/types.h>
103 #endif
104 #if HAVE_NETINET_IN_SYSTM_H
105 # include <netinet/in_systm.h>
106 #endif
107 #if HAVE_NETINET_IN_H
108 # include <netinet/in.h>
109 #endif
110 ])
111 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
112 [#if HAVE_STDINT_H
113 # include <stdint.h>
114 #endif
115 #if HAVE_SYS_TYPES_H
116 # include <sys/types.h>
117 #endif
118 #if HAVE_NETINET_IN_SYSTM_H
119 # include <netinet/in_systm.h>
120 #endif
121 #if HAVE_NETINET_IN_H
122 # include <netinet/in.h>
123 #endif
124 #if HAVE_NETINET_IP_H
125 # include <netinet/ip.h>
126 #endif
127 ])
128 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
129 [#if HAVE_STDINT_H
130 # include <stdint.h>
131 #endif
132 #if HAVE_SYS_TYPES_H
133 # include <sys/types.h>
134 #endif
135 #if HAVE_NETINET_IN_SYSTM_H
136 # include <netinet/in_systm.h>
137 #endif
138 #if HAVE_NETINET_IN_H
139 # include <netinet/in.h>
140 #endif
141 #if HAVE_NETINET_IP_H
142 # include <netinet/ip.h>
143 #endif
144 ])
145 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
146 [#if HAVE_STDINT_H
147 # include <stdint.h>
148 #endif
149 #if HAVE_SYS_TYPES_H
150 # include <sys/types.h>
151 #endif
152 #if HAVE_NETINET_IN_SYSTM_H
153 # include <netinet/in_systm.h>
154 #endif
155 #if HAVE_NETINET_IN_H
156 # include <netinet/in.h>
157 #endif
158 ])
159 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
160 [#if HAVE_STDINT_H
161 # include <stdint.h>
162 #endif
163 #if HAVE_SYS_TYPES_H
164 # include <sys/types.h>
165 #endif
166 #if HAVE_NETINET_IN_SYSTM_H
167 # include <netinet/in_systm.h>
168 #endif
169 #if HAVE_NETINET_IN_H
170 # include <netinet/in.h>
171 #endif
172 #if HAVE_NETINET_IP6_H
173 # include <netinet/ip6.h>
174 #endif
175 ])
176 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
177 [#if HAVE_STDINT_H
178 # include <stdint.h>
179 #endif
180 #if HAVE_SYS_TYPES_H
181 # include <sys/types.h>
182 #endif
183 #if HAVE_NETINET_IN_SYSTM_H
184 # include <netinet/in_systm.h>
185 #endif
186 #if HAVE_NETINET_IN_H
187 # include <netinet/in.h>
188 #endif
189 #if HAVE_NETINET_IP_H
190 # include <netinet/ip.h>
191 #endif
192 ])
193 AC_CHECK_HEADERS(netinet/udp.h, [], [],
194 [#if HAVE_STDINT_H
195 # include <stdint.h>
196 #endif
197 #if HAVE_SYS_TYPES_H
198 # include <sys/types.h>
199 #endif
200 #if HAVE_NETINET_IN_SYSTM_H
201 # include <netinet/in_systm.h>
202 #endif
203 #if HAVE_NETINET_IN_H
204 # include <netinet/in.h>
205 #endif
206 #if HAVE_NETINET_IP_H
207 # include <netinet/ip.h>
208 #endif
209 ])
211 # For cpu modules
212 AC_CHECK_HEADERS(sys/dkstat.h)
213 if test "x$ac_system" = "xDarwin"
214 then
215 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)
216 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
217 fi
218 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
219 [
220 #if HAVE_SYS_TYPES_H
221 # include <sys/types.h>
222 #endif
223 #if HAVE_SYS_PARAM_H
224 # include <sys/param.h>
225 #endif
226 ])
228 # For hddtemp module
229 AC_CHECK_HEADERS(linux/major.h libgen.h)
231 # For the battery plugin
232 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
233 [
234 #if HAVE_IOKIT_IOKITLIB_H
235 # include <IOKit/IOKitLib.h>
236 #endif
237 #if HAVE_IOKIT_IOTYPES_H
238 # include <IOKit/IOTypes.h>
239 #endif
240 ])
242 # For the swap module
243 AC_CHECK_HEADERS(sys/swap.h, [], [],
244 [
245 #if HAVE_SYS_TYPES_H
246 # include <sys/types.h>
247 #endif
248 #if HAVE_SYS_PARAM_H
249 # include <sys/param.h>
250 #endif
251 ])
253 # For load module
254 # For the processes plugin
255 # For users module
256 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
258 # For interface plugin
259 AC_CHECK_HEADERS(ifaddrs.h)
260 AC_CHECK_HEADERS(net/if.h, [], [],
261 [
262 #if HAVE_SYS_TYPES_H
263 # include <sys/types.h>
264 #endif
265 #if HAVE_SYS_SOCKET_H
266 # include <sys/socket.h>
267 #endif
268 ])
269 AC_CHECK_HEADERS(linux/if.h, [], [],
270 [
271 #if HAVE_SYS_TYPES_H
272 # include <sys/types.h>
273 #endif
274 #if HAVE_SYS_SOCKET_H
275 # include <sys/socket.h>
276 #endif
277 ])
278 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
279 [
280 #if HAVE_SYS_TYPES_H
281 # include <sys/types.h>
282 #endif
283 #if HAVE_SYS_SOCKET_H
284 # include <sys/socket.h>
285 #endif
286 #if HAVE_LINUX_IF_H
287 # include <linux/if.h>
288 #endif
289 ])
291 # For ipvs module
292 have_net_ip_vs_h="no"
293 have_ip_vs_h="no"
294 if test "x$ac_system" = "xLinux"
295 then
296 SAVE_CFLAGS=$CFLAGS
297 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
299 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
300 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
302 CFLAGS=$SAVE_CFLAGS
303 fi
305 # For quota module
306 AC_CHECK_HEADERS(sys/ucred.h, [], [],
307 [
308 #if HAVE_SYS_TYPES_H
309 # include <sys/types.h>
310 #endif
311 #if HAVE_SYS_PARAM_H
312 # include <sys/param.h>
313 #endif
314 ])
316 # For mount interface
317 AC_CHECK_HEADERS(sys/mount.h, [], [],
318 [
319 #if HAVE_SYS_TYPES_H
320 # include <sys/types.h>
321 #endif
322 #if HAVE_SYS_PARAM_H
323 # include <sys/param.h>
324 #endif
325 ])
327 # For the email plugin
328 AC_CHECK_HEADERS(linux/un.h, [], [],
329 [
330 #if HAVE_SYS_SOCKET_H
331 # include <sys/socket.h>
332 #endif
333 ])
335 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.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)
337 # For the dns plugin
338 AC_CHECK_HEADERS(arpa/nameser.h)
339 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
340 [
341 #if HAVE_ARPA_NAMESER_H
342 # include <arpa/nameser.h>
343 #endif
344 ])
346 AC_CHECK_HEADERS(net/if_arp.h, [], [],
347 [#if HAVE_SYS_SOCKET_H
348 # include <sys/socket.h>
349 #endif
350 ])
351 AC_CHECK_HEADERS(net/ppp_defs.h)
352 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
353 [#if HAVE_NET_PPP_DEFS_H
354 # include <net/ppp_defs.h>
355 #endif
356 ])
357 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
358 [#if HAVE_STDINT_H
359 # include <stdint.h>
360 #endif
361 #if HAVE_SYS_TYPES_H
362 # include <sys/types.h>
363 #endif
364 #if HAVE_SYS_SOCKET_H
365 # include <sys/socket.h>
366 #endif
367 #if HAVE_NET_IF_H
368 # include <net/if.h>
369 #endif
370 #if HAVE_NETINET_IN_H
371 # include <netinet/in.h>
372 #endif
373 ])
375 # For the multimeter plugin
376 have_termios_h="no"
377 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
379 #
380 # Checks for typedefs, structures, and compiler characteristics.
381 #
382 AC_C_CONST
383 AC_TYPE_PID_T
384 AC_TYPE_SIZE_T
385 AC_TYPE_UID_T
386 AC_HEADER_TIME
388 #
389 # Checks for library functions.
390 #
391 AC_PROG_GCC_TRADITIONAL
392 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
394 AC_FUNC_STRERROR_R
396 AC_CACHE_CHECK([for strtok_r],
397 [have_strtok_r_default],
398 AC_LINK_IFELSE(
399 AC_LANG_PROGRAM(
400 [[[[
401 #include <stdlib.h>
402 #include <stdio.h>
403 #include <string.h>
404 ]]]],
405 [[[[
406 char buffer[] = "foo,bar,baz";
407 char *token;
408 char *dummy;
409 char *saveptr;
411 dummy = buffer;
412 saveptr = NULL;
413 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
414 {
415 dummy = NULL;
416 printf ("token = %s;\n", token);
417 }
418 ]]]]),
419 [have_strtok_r_default="yes"],
420 [have_strtok_r_default="no"]
421 )
422 )
424 if test "x$have_strtok_r_default" = "xno"
425 then
426 SAVE_CFLAGS="$CFLAGS"
427 CFLAGS="$CFLAGS -D_REENTRANT=1"
429 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
430 [have_strtok_r_reentrant],
431 AC_LINK_IFELSE(
432 AC_LANG_PROGRAM(
433 [[[[
434 #include <stdlib.h>
435 #include <stdio.h>
436 #include <string.h>
437 ]]]],
438 [[[[
439 char buffer[] = "foo,bar,baz";
440 char *token;
441 char *dummy;
442 char *saveptr;
444 dummy = buffer;
445 saveptr = NULL;
446 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
447 {
448 dummy = NULL;
449 printf ("token = %s;\n", token);
450 }
451 ]]]]),
452 [have_strtok_r_reentrant="yes"],
453 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
454 )
455 )
456 fi
458 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
460 socket_needs_socket="no"
461 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
462 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
464 nanosleep_needs_rt="no"
465 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
466 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
468 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
469 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
470 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
471 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
472 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
473 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
474 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
475 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
476 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
477 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
479 # For load module
480 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
482 # Check for NAN
483 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
484 [
485 if test "x$withval" = "xno"; then
486 nan_type="none"
487 else if test "x$withval" = "xyes"; then
488 nan_type="zero"
489 else
490 nan_type="$withval"
491 fi; fi
492 ],
493 [nan_type="none"])
494 if test "x$nan_type" = "xnone"; then
495 AC_CACHE_CHECK([whether NAN is defined by default],
496 [have_nan_default],
497 AC_COMPILE_IFELSE(
498 AC_LANG_PROGRAM(
499 [[
500 #include <stdlib.h>
501 #include <math.h>
502 static float foo = NAN;
503 ]],
504 [[
505 if (isnan (foo))
506 return 0;
507 else
508 return 1;
509 ]]),
510 [have_nan_default="yes"],
511 [have_nan_default="no"]
512 )
513 )
514 if test "x$have_nan_default" = "xyes"
515 then
516 nan_type="default"
517 fi
518 fi
519 if test "x$nan_type" = "xnone"; then
520 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
521 [have_nan_isoc],
522 AC_COMPILE_IFELSE(
523 AC_LANG_PROGRAM(
524 [[
525 #include <stdlib.h>
526 #define __USE_ISOC99 1
527 #include <math.h>
528 static float foo = NAN;
529 ]],
530 [[
531 if (isnan (foo))
532 return 0;
533 else
534 return 1;
535 ]]),
536 [have_nan_isoc="yes"],
537 [have_nan_isoc="no"]
538 )
539 )
540 if test "x$have_nan_isoc" = "xyes"
541 then
542 nan_type="isoc99"
543 fi
544 fi
545 if test "x$nan_type" = "xnone"; then
546 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
547 [have_nan_zero],
548 AC_RUN_IFELSE(
549 AC_LANG_PROGRAM(
550 [[
551 #include <stdlib.h>
552 #include <math.h>
553 #ifdef NAN
554 # undef NAN
555 #endif
556 #define NAN (0.0 / 0.0)
557 #ifndef isnan
558 # define isnan(f) ((f) != (f))
559 #endif
560 static float foo = NAN;
561 ]],
562 [[
563 if (isnan (foo))
564 return 0;
565 else
566 return 1;
567 ]]),
568 [have_nan_zero="yes"],
569 [have_nan_zero="no"]
570 )
571 )
572 if test "x$have_nan_zero" = "xyes"
573 then
574 nan_type="zero"
575 fi
576 fi
578 if test "x$nan_type" = "xdefault"; then
579 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
580 [Define if NAN is defined by default and can initialize static variables.])
581 else if test "x$nan_type" = "xisoc99"; then
582 AC_DEFINE(NAN_STATIC_ISOC, 1,
583 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
584 else if test "x$nan_type" = "xzero"; then
585 AC_DEFINE(NAN_ZERO_ZERO, 1,
586 [Define if NAN can be defined as (0.0 / 0.0)])
587 else
588 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
589 fi; fi; fi
591 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
592 [
593 if test "x$withval" = "xnothing"; then
594 fp_layout_type="nothing"
595 else if test "x$withval" = "xendianflip"; then
596 fp_layout_type="endianflip"
597 else if test "x$withval" = "xintswap"; then
598 fp_layout_type="intswap"
599 else
600 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
601 fi; fi; fi
602 ],
603 [fp_layout_type="unknown"])
605 if test "x$fp_layout_type" = "xunknown"; then
606 AC_CACHE_CHECK([if doubles are stored in x86 representation],
607 [fp_layout_need_nothing],
608 AC_RUN_IFELSE(
609 AC_LANG_PROGRAM(
610 [[[[
611 #include <stdlib.h>
612 #include <stdio.h>
613 #include <string.h>
614 #if HAVE_STDINT_H
615 # include <stdint.h>
616 #endif
617 #if HAVE_STDBOOL_H
618 # include <stdbool.h>
619 #endif
620 ]]]],
621 [[[[
622 uint64_t i0;
623 uint64_t i1;
624 uint8_t c[8];
625 double d;
627 d = 8.642135e130;
628 memcpy ((void *) &i0, (void *) &d, 8);
630 i1 = i0;
631 memcpy ((void *) c, (void *) &i1, 8);
633 if ((c[0] == 0x2f) && (c[1] == 0x25)
634 && (c[2] == 0xc0) && (c[3] == 0xc7)
635 && (c[4] == 0x43) && (c[5] == 0x2b)
636 && (c[6] == 0x1f) && (c[7] == 0x5b))
637 return (0);
638 else
639 return (1);
640 ]]]]),
641 [fp_layout_need_nothing="yes"],
642 [fp_layout_need_nothing="no"]
643 )
644 )
645 if test "x$fp_layout_need_nothing" = "xyes"; then
646 fp_layout_type="nothing"
647 fi
648 fi
649 if test "x$fp_layout_type" = "xunknown"; then
650 AC_CACHE_CHECK([if endianflip converts to x86 representation],
651 [fp_layout_need_endianflip],
652 AC_RUN_IFELSE(
653 AC_LANG_PROGRAM(
654 [[[[
655 #include <stdlib.h>
656 #include <stdio.h>
657 #include <string.h>
658 #if HAVE_STDINT_H
659 # include <stdint.h>
660 #endif
661 #if HAVE_STDBOOL_H
662 # include <stdbool.h>
663 #endif
664 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
665 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
666 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
667 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
668 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
669 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
670 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
671 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
672 ]]]],
673 [[[[
674 uint64_t i0;
675 uint64_t i1;
676 uint8_t c[8];
677 double d;
679 d = 8.642135e130;
680 memcpy ((void *) &i0, (void *) &d, 8);
682 i1 = endianflip (i0);
683 memcpy ((void *) c, (void *) &i1, 8);
685 if ((c[0] == 0x2f) && (c[1] == 0x25)
686 && (c[2] == 0xc0) && (c[3] == 0xc7)
687 && (c[4] == 0x43) && (c[5] == 0x2b)
688 && (c[6] == 0x1f) && (c[7] == 0x5b))
689 return (0);
690 else
691 return (1);
692 ]]]]),
693 [fp_layout_need_endianflip="yes"],
694 [fp_layout_need_endianflip="no"]
695 )
696 )
697 if test "x$fp_layout_need_endianflip" = "xyes"; then
698 fp_layout_type="endianflip"
699 fi
700 fi
701 if test "x$fp_layout_type" = "xunknown"; then
702 AC_CACHE_CHECK([if intswap converts to x86 representation],
703 [fp_layout_need_intswap],
704 AC_RUN_IFELSE(
705 AC_LANG_PROGRAM(
706 [[[[
707 #include <stdlib.h>
708 #include <stdio.h>
709 #include <string.h>
710 #if HAVE_STDINT_H
711 # include <stdint.h>
712 #endif
713 #if HAVE_STDBOOL_H
714 # include <stdbool.h>
715 #endif
716 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
717 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
718 ]]]],
719 [[[[
720 uint64_t i0;
721 uint64_t i1;
722 uint8_t c[8];
723 double d;
725 d = 8.642135e130;
726 memcpy ((void *) &i0, (void *) &d, 8);
728 i1 = intswap (i0);
729 memcpy ((void *) c, (void *) &i1, 8);
731 if ((c[0] == 0x2f) && (c[1] == 0x25)
732 && (c[2] == 0xc0) && (c[3] == 0xc7)
733 && (c[4] == 0x43) && (c[5] == 0x2b)
734 && (c[6] == 0x1f) && (c[7] == 0x5b))
735 return (0);
736 else
737 return (1);
738 ]]]]),
739 [fp_layout_need_intswap="yes"],
740 [fp_layout_need_intswap="no"]
741 )
742 )
743 if test "x$fp_layout_need_intswap" = "xyes"; then
744 fp_layout_type="intswap"
745 fi
746 fi
748 if test "x$fp_layout_type" = "xnothing"; then
749 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
750 [Define if doubles are stored in x86 representation.])
751 else if test "x$fp_layout_type" = "xendianflip"; then
752 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
753 [Define if endianflip is needed to convert to x86 representation.])
754 else if test "x$fp_layout_type" = "xintswap"; then
755 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
756 [Define if intswap is needed to convert to x86 representation.])
757 else
758 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
759 fi; fi; fi
761 have_getfsstat="no"
762 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
763 have_getvfsstat="no"
764 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
765 have_listmntent="no"
766 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
768 have_getmntent="no"
769 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
770 if test "x$have_getmntent" = "xno"; then
771 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
772 fi
773 if test "x$have_getmntent" = "xno"; then
774 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
775 fi
776 if test "x$have_getmntent" = "xno"; then
777 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
778 fi
780 if test "x$have_getmntent" = "xc"; then
781 AC_CACHE_CHECK([whether getmntent takes one argument],
782 [have_one_getmntent],
783 AC_COMPILE_IFELSE(
784 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
785 #include <mntent.h>
786 #include "$srcdir/src/utils_mount.h"]],
787 [[
788 FILE *fh;
789 struct mntent *me;
790 fh = setmntent ("/etc/mtab", "r");
791 me = getmntent (fh);
792 ]]
793 ),
794 [have_one_getmntent="yes"],
795 [have_one_getmntent="no"]
796 )
797 )
798 AC_CACHE_CHECK([whether getmntent takes two arguments],
799 [have_two_getmntent],
800 AC_COMPILE_IFELSE(
801 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
802 #include <sys/mnttab.h>
803 #include "$srcdir/src/utils_mount.h"]],
804 [[
805 FILE *fh;
806 struct mnttab mt;
807 int status;
808 fh = fopen ("/etc/mnttab", "r");
809 status = getmntent (fh, &mt);
810 ]]
811 ),
812 [have_two_getmntent="yes"],
813 [have_two_getmntent="no"]
814 )
815 )
816 fi
818 # Check for different versions of `getmntent' here..
820 if test "x$have_getmntent" = "xc"; then
821 if test "x$have_one_getmntent" = "xyes"; then
822 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
823 [Define if the function getmntent exists and takes one argument.])
824 fi
825 if test "x$have_two_getmntent" = "xyes"; then
826 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
827 [Define if the function getmntent exists and takes two arguments.])
828 fi
829 fi
830 if test "x$have_getmntent" = "xsun"; then
831 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
832 [Define if the function getmntent exists. It's the version from libsun.])
833 fi
834 if test "x$have_getmntent" = "xseq"; then
835 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
836 [Define if the function getmntent exists. It's the version from libseq.])
837 fi
838 if test "x$have_getmntent" = "xgen"; then
839 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
840 [Define if the function getmntent exists. It's the version from libgen.])
841 fi
843 # Check for structures
844 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
845 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
846 [],
847 [
848 #include <sys/types.h>
849 #include <sys/socket.h>
850 #include <net/if.h>
851 ])
852 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
853 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
854 [],
855 [
856 #include <sys/types.h>
857 #include <sys/socket.h>
858 #include <linux/if.h>
859 #include <linux/netdevice.h>
860 ])
862 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
863 [#if HAVE_STDINT_H
864 # include <stdint.h>
865 #endif
866 #if HAVE_SYS_TYPES_H
867 # include <sys/types.h>
868 #endif
869 #if HAVE_NETINET_IN_SYSTM_H
870 # include <netinet/in_systm.h>
871 #endif
872 #if HAVE_NETINET_IN_H
873 # include <netinet/in.h>
874 #endif
875 #if HAVE_NETINET_IP_H
876 # include <netinet/ip.h>
877 #endif
878 #if HAVE_NETINET_UDP_H
879 # include <netinet/udp.h>
880 #endif
881 ])
882 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
883 [#if HAVE_STDINT_H
884 # include <stdint.h>
885 #endif
886 #if HAVE_SYS_TYPES_H
887 # include <sys/types.h>
888 #endif
889 #if HAVE_NETINET_IN_SYSTM_H
890 # include <netinet/in_systm.h>
891 #endif
892 #if HAVE_NETINET_IN_H
893 # include <netinet/in.h>
894 #endif
895 #if HAVE_NETINET_IP_H
896 # include <netinet/ip.h>
897 #endif
898 #if HAVE_NETINET_UDP_H
899 # include <netinet/udp.h>
900 #endif
901 ])
903 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
904 [],
905 [],
906 [
907 #if HAVE_KSTAT_H
908 # include <kstat.h>
909 #endif
910 ])
912 #
913 # Checks for libraries begin here
914 #
915 with_libresolv="yes"
916 AC_CHECK_LIB(resolv, res_search,
917 [
918 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
919 ],
920 [with_libresolv="no"])
921 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
923 dnl Check for HAL (hardware abstraction library)
924 with_libhal="yes"
925 AC_CHECK_LIB(hal,libhal_device_property_exists,
926 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
927 [with_libhal="no"])
928 if test "x$with_libhal" = "xyes"; then
929 if test "x$PKG_CONFIG" != "x"; then
930 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
931 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
932 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
933 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
934 fi
935 fi
937 m4_divert_once([HELP_WITH], [
938 collectd additional packages:])
940 if test "x$ac_system" = "xSolaris"
941 then
942 with_kstat="yes"
943 with_devinfo="yes"
944 else
945 with_kstat="no (Solaris only)"
946 with_devinfo="no (Solaris only)"
947 fi
949 if test "x$with_kstat" = "xyes"
950 then
951 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
952 fi
953 if test "x$with_kstat" = "xyes"
954 then
955 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
956 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
957 fi
958 if test "x$with_kstat" = "xyes"
959 then
960 AC_DEFINE(HAVE_LIBKSTAT, 1,
961 [Define to 1 if you have the 'kstat' library (-lkstat)])
962 fi
963 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
964 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
966 with_libiokit="no"
967 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
968 [
969 with_libiokit="yes"
970 ],
971 [
972 with_libiokit="no"
973 ])
974 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
976 with_libkvm="no"
977 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
978 if test "x$with_kvm_getprocs" = "xyes"
979 then
980 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
981 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
982 with_libkvm="yes"
983 fi
984 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
986 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
987 if test "x$with_kvm_getswapinfo" = "xyes"
988 then
989 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
990 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
991 with_libkvm="yes"
992 fi
993 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
995 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
996 if test "x$with_kvm_nlist" = "xyes"
997 then
998 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
999 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1000 with_libkvm="yes"
1001 fi
1002 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1004 # --with-libcurl {{{
1005 with_curl_config="curl-config"
1006 with_curl_cflags=""
1007 with_curl_libs=""
1008 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1009 [
1010 if test "x$withval" = "xno"
1011 then
1012 with_libcurl="no"
1013 else if test "x$withval" = "xyes"
1014 then
1015 with_libcurl="yes"
1016 else
1017 if test -f "$withval" && test -x "$withval"
1018 then
1019 with_curl_config="$withval"
1020 with_libcurl="yes"
1021 else if test -x "$withval/bin/curl-config"
1022 then
1023 with_curl_config="$withval/bin/curl-config"
1024 with_libcurl="yes"
1025 fi; fi
1026 with_libcurl="yes"
1027 fi; fi
1028 ],
1029 [
1030 with_libcurl="yes"
1031 ])
1032 if test "x$with_libcurl" = "xyes"
1033 then
1034 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1035 curl_config_status=$?
1037 if test $curl_config_status -ne 0
1038 then
1039 with_libcurl="no ($with_curl_config failed)"
1040 else
1041 SAVE_CPPFLAGS="$CPPFLAGS"
1042 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1044 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1046 CPPFLAGS="$SAVE_CPPFLAGS"
1047 fi
1048 fi
1049 if test "x$with_libcurl" = "xyes"
1050 then
1051 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1052 curl_config_status=$?
1054 if test $curl_config_status -ne 0
1055 then
1056 with_libcurl="no ($with_curl_config failed)"
1057 else
1058 AC_CHECK_LIB(curl, curl_easy_init,
1059 [with_libcurl="yes"],
1060 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1061 [$with_curl_libs])
1062 fi
1063 fi
1064 if test "x$with_libcurl" = "xyes"
1065 then
1066 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1067 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1068 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1069 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1070 fi
1071 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1072 # }}}
1074 # --with-libdbi {{{
1075 with_libdbi_cppflags=""
1076 with_libdbi_ldflags=""
1077 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1078 [
1079 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1080 then
1081 with_libdbi_cppflags="-I$withval/include"
1082 with_libdbi_ldflags="-L$withval/lib"
1083 with_libdbi="yes"
1084 else
1085 with_libdbi="$withval"
1086 fi
1087 ],
1088 [
1089 with_libdbi="yes"
1090 ])
1091 if test "x$with_libdbi" = "xyes"
1092 then
1093 SAVE_CPPFLAGS="$CPPFLAGS"
1094 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1096 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1098 CPPFLAGS="$SAVE_CPPFLAGS"
1099 fi
1100 if test "x$with_libdbi" = "xyes"
1101 then
1102 SAVE_CPPFLAGS="$CPPFLAGS"
1103 SAVE_LDFLAGS="$LDFLAGS"
1104 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1105 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1107 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1109 CPPFLAGS="$SAVE_CPPFLAGS"
1110 LDFLAGS="$SAVE_LDFLAGS"
1111 fi
1112 if test "x$with_libdbi" = "xyes"
1113 then
1114 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1115 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1116 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1117 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1118 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1119 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1120 fi
1121 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1122 # }}}
1124 # --with-libesmtp {{{
1125 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1126 [
1127 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1128 then
1129 LDFLAGS="$LDFLAGS -L$withval/lib"
1130 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1131 with_libesmtp="yes"
1132 else
1133 with_libesmtp="$withval"
1134 fi
1135 ],
1136 [
1137 with_libesmtp="yes"
1138 ])
1139 if test "x$with_libesmtp" = "xyes"
1140 then
1141 AC_CHECK_LIB(esmtp, smtp_create_session,
1142 [
1143 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1144 ], [with_libesmtp="no (libesmtp not found)"])
1145 fi
1146 if test "x$with_libesmtp" = "xyes"
1147 then
1148 AC_CHECK_HEADERS(libesmtp.h,
1149 [
1150 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1151 ], [with_libesmtp="no (libesmtp.h not found)"])
1152 fi
1153 if test "x$with_libesmtp" = "xyes"
1154 then
1155 collect_libesmtp=1
1156 else
1157 collect_libesmtp=0
1158 fi
1159 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1160 [Wether or not to use the esmtp library])
1161 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1162 # }}}
1164 # --with-libiptc {{{
1165 with_own_libiptc="no"
1166 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1167 [
1168 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1169 then
1170 LDFLAGS="$LDFLAGS -L$withval/lib"
1171 CPPFLAGS="$CPPFLAGS -I$withval/include"
1172 with_libiptc="yes"
1173 else
1174 with_libiptc="$withval"
1175 fi
1176 ],
1177 [
1178 if test "x$ac_system" = "xLinux"
1179 then
1180 with_libiptc="yes"
1181 else
1182 with_libiptc="no (Linux only)"
1183 fi
1184 ])
1185 if test "x$with_libiptc" = "xyes"
1186 then
1187 AC_CHECK_LIB(iptc, iptc_init,
1188 [
1189 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1190 ],
1191 [
1192 with_libiptc="yes"
1193 with_own_libiptc="yes"
1194 ])
1195 fi
1196 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1197 then
1198 AC_CHECK_HEADERS(libiptc/libiptc.h,
1199 [
1200 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1201 ],
1202 [
1203 with_libiptc="yes"
1204 with_own_libiptc="yes"
1205 ])
1206 fi
1207 if test "x$with_libiptc" = "xyes"
1208 then
1209 SAVE_CFLAGS=$CFLAGS
1210 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1212 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1213 [
1214 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1215 with_own_libiptc="no"
1216 ],
1217 [
1218 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1219 ])
1221 CFLAGS=$SAVE_CFLAGS
1222 fi
1223 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1224 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1225 if test "x$with_own_libiptc" = "xyes"
1226 then
1227 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1228 fi
1229 # }}}
1231 # --with-libmysql {{{
1232 with_mysql_config="mysql_config"
1233 with_mysql_cflags=""
1234 with_mysql_libs=""
1235 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1236 [
1237 if test "x$withval" = "xno"
1238 then
1239 with_libmysql="no"
1240 else if test "x$withval" = "xyes"
1241 then
1242 with_libmysql="yes"
1243 else
1244 if test -f "$withval" && test -x "$withval";
1245 then
1246 with_mysql_config="$withval"
1247 else if test -x "$withval/bin/mysql_config"
1248 then
1249 with_mysql_config="$withval/bin/mysql_config"
1250 fi; fi
1251 with_libmysql="yes"
1252 fi; fi
1253 ],
1254 [
1255 with_libmysql="yes"
1256 ])
1257 if test "x$with_libmysql" = "xyes"
1258 then
1259 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1260 mysql_config_status=$?
1262 if test $mysql_config_status -ne 0
1263 then
1264 with_libmysql="no ($with_mysql_config failed)"
1265 else
1266 SAVE_CPPFLAGS="$CPPFLAGS"
1267 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1269 have_mysql_h="no"
1270 have_mysql_mysql_h="no"
1271 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1273 if test "x$have_mysql_h" = "xno"
1274 then
1275 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1276 fi
1278 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1279 then
1280 with_libmysql="no (mysql.h not found)"
1281 fi
1283 CPPFLAGS="$SAVE_CPPFLAGS"
1284 fi
1285 fi
1286 if test "x$with_libmysql" = "xyes"
1287 then
1288 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1289 mysql_config_status=$?
1291 if test $mysql_config_status -ne 0
1292 then
1293 with_libmysql="no ($with_mysql_config failed)"
1294 else
1295 AC_CHECK_LIB(mysqlclient, mysql_init,
1296 [with_libmysql="yes"],
1297 [with_libmysql="no (symbol 'mysql_init' not found)"],
1298 [$with_mysql_libs])
1299 fi
1300 fi
1301 if test "x$with_libmysql" = "xyes"
1302 then
1303 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1304 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1305 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1306 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1307 fi
1308 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1309 # }}}
1311 # --with-libnetlink {{{
1312 with_libnetlink_cflags=""
1313 with_libnetlink_libs="-lnetlink"
1314 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1315 [
1316 echo "libnetlink: withval = $withval"
1317 if test "x$withval" = "xyes"
1318 then
1319 with_libnetlink="yes"
1320 else if test "x$withval" = "xno"
1321 then
1322 with_libnetlink="no"
1323 else
1324 if test -d "$withval/include"
1325 then
1326 with_libnetlink_cflags="-I$withval/include"
1327 with_libnetlink_libs="-L$withval/lib -lnetlink"
1328 with_libnetlink="yes"
1329 else
1330 AC_MSG_ERROR("no such directory: $withval/include")
1331 fi
1332 fi; fi
1333 ],
1334 [
1335 if test "x$ac_system" = "xLinux"
1336 then
1337 with_libnetlink="yes"
1338 else
1339 with_libnetlink="no (Linux only library)"
1340 fi
1341 ])
1342 if test "x$with_libnetlink" = "xyes"
1343 then
1344 SAVE_CFLAGS=$CFLAGS
1345 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1347 with_libnetlink="no (libnetlink.h not found)"
1349 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1350 [
1351 with_libnetlink="yes"
1352 break
1353 ], [],
1354 [#include <stdio.h>
1355 #include <sys/types.h>
1356 #include <asm/types.h>
1357 #include <sys/socket.h>
1358 #include <linux/netlink.h>
1359 #include <linux/rtnetlink.h>])
1360 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1361 [#include <stdio.h>
1362 #include <sys/types.h>
1363 #include <asm/types.h>
1364 #include <sys/socket.h>])
1366 AC_COMPILE_IFELSE(
1367 [#include <stdio.h>
1368 #include <sys/types.h>
1369 #include <asm/types.h>
1370 #include <sys/socket.h>
1371 #include <linux/netlink.h>
1372 #include <linux/rtnetlink.h>
1374 int main (void)
1375 {
1376 int retval = TCA_STATS2;
1377 return (retval);
1378 }],
1379 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1380 []);
1382 AC_COMPILE_IFELSE(
1383 [#include <stdio.h>
1384 #include <sys/types.h>
1385 #include <asm/types.h>
1386 #include <sys/socket.h>
1387 #include <linux/netlink.h>
1388 #include <linux/rtnetlink.h>
1390 int main (void)
1391 {
1392 int retval = TCA_STATS;
1393 return (retval);
1394 }],
1395 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1396 []);
1398 CFLAGS="$SAVE_CFLAGS"
1399 fi
1400 if test "x$with_libnetlink" = "xyes"
1401 then
1402 AC_CHECK_LIB(netlink, rtnl_open,
1403 [with_libnetlink="yes"],
1404 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1405 [$with_libnetlink_libs])
1406 fi
1407 if test "x$with_libnetlink" = "xyes"
1408 then
1409 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1410 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1411 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1412 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1413 fi
1414 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1415 # }}}
1417 # --with-libnetsnmp {{{
1418 with_snmp_config="net-snmp-config"
1419 with_snmp_cflags=""
1420 with_snmp_libs=""
1421 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1422 [
1423 if test "x$withval" = "xno"
1424 then
1425 with_libnetsnmp="no"
1426 else if test "x$withval" = "xyes"
1427 then
1428 with_libnetsnmp="yes"
1429 else
1430 if test -x "$withval"
1431 then
1432 with_snmp_config="$withval"
1433 with_libnetsnmp="yes"
1434 else
1435 with_snmp_config="$withval/bin/net-snmp-config"
1436 with_libnetsnmp="yes"
1437 fi
1438 fi; fi
1439 ],
1440 [with_libnetsnmp="yes"])
1441 if test "x$with_libnetsnmp" = "xyes"
1442 then
1443 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1444 snmp_config_status=$?
1446 if test $snmp_config_status -ne 0
1447 then
1448 with_libnetsnmp="no ($with_snmp_config failed)"
1449 else
1450 SAVE_CPPFLAGS="$CPPFLAGS"
1451 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1453 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1455 CPPFLAGS="$SAVE_CPPFLAGS"
1456 fi
1457 fi
1458 if test "x$with_libnetsnmp" = "xyes"
1459 then
1460 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1461 snmp_config_status=$?
1463 if test $snmp_config_status -ne 0
1464 then
1465 with_libnetsnmp="no ($with_snmp_config failed)"
1466 else
1467 AC_CHECK_LIB(netsnmp, init_snmp,
1468 [with_libnetsnmp="yes"],
1469 [with_libnetsnmp="no (libnetsnmp not found)"],
1470 [$with_snmp_libs])
1471 fi
1472 fi
1473 if test "x$with_libnetsnmp" = "xyes"
1474 then
1475 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1476 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1477 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1478 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1479 fi
1480 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1481 # }}}
1483 # --with-liboconfig {{{
1484 with_own_liboconfig="no"
1485 liboconfig_LDFLAGS="$LDFLAGS"
1486 liboconfig_CPPFLAGS="$CPPFLAGS"
1487 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1488 [
1489 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1490 then
1491 if test -d "$withval/lib"
1492 then
1493 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1494 fi
1495 if test -d "$withval/include"
1496 then
1497 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1498 fi
1499 fi
1500 if test "x$withval" = "xno"
1501 then
1502 AC_MSG_ERROR("liboconfig is required")
1503 fi
1504 ],
1505 [
1506 with_liboconfig="yes"
1507 ])
1509 save_LDFLAGS="$LDFLAGS"
1510 save_CPPFLAGS="$CPPFLAGS"
1511 LDFLAGS="$liboconfig_LDFLAGS"
1512 CPPFLAGS="$liboconfig_CPPFLAGS"
1513 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1514 [
1515 with_liboconfig="yes"
1516 with_own_liboconfig="no"
1517 ],
1518 [
1519 with_liboconfig="yes"
1520 with_own_liboconfig="yes"
1521 LDFLAGS="$save_LDFLAGS"
1522 CPPFLAGS="$save_CPPFLAGS"
1523 ])
1525 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1526 if test "x$with_own_liboconfig" = "xyes"
1527 then
1528 with_liboconfig="yes (shipped version)"
1529 fi
1530 # }}}
1532 # --with-liboping {{{
1533 with_own_liboping="no"
1534 liboping_LDFLAGS="$LDFLAGS"
1535 liboping_CPPFLAGS="$CPPFLAGS"
1536 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1537 [
1538 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1539 then
1540 if test -d "$withval/lib"
1541 then
1542 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1543 fi
1544 if test -d "$withval/include"
1545 then
1546 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1547 fi
1548 fi
1549 if test "x$withval" = "xno"
1550 then
1551 with_liboping="no"
1552 with_own_liboping="no"
1553 else if test "x$withval" = "xyes"
1554 then
1555 with_liboping="yes"
1556 fi; fi
1557 ],
1558 [
1559 with_liboping="yes"
1560 ])
1562 if test "x$with_liboping" = "xyes"
1563 then
1564 save_LDFLAGS="$LDFLAGS"
1565 save_CPPFLAGS="$CPPFLAGS"
1566 LDFLAGS="$liboping_LDFLAGS"
1567 CPPFLAGS="$liboping_CPPFLAGS"
1568 AC_CHECK_LIB(oping, ping_construct,
1569 [
1570 with_liboping="yes"
1571 with_own_liboping="no"
1572 ],
1573 [
1574 with_liboping="yes"
1575 with_own_liboping="yes"
1576 LDFLAGS="$save_LDFLAGS"
1577 CPPFLAGS="$save_CPPFLAGS"
1578 ])
1579 fi
1580 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1581 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1582 # }}}
1584 # --with-oracle {{{
1585 with_oracle_cppflags=""
1586 with_oracle_libs=""
1587 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
1588 [
1589 if test "x$withval" = "xyes"
1590 then
1591 if test "x$ORACLE_HOME" = "x"
1592 then
1593 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
1594 fi
1595 with_oracle="yes"
1596 else if test "x$withval" = "xno"
1597 then
1598 with_oracle="no"
1599 else
1600 with_oracle="yes"
1601 ORACLE_HOME="$withval"
1602 fi; fi
1603 ],
1604 [
1605 if test "x$ORACLE_HOME" = "x"
1606 then
1607 with_oracle="no (ORACLE_HOME is not set)"
1608 else
1609 with_oracle="yes"
1610 fi
1611 ])
1612 if test "x$ORACLE_HOME" != "x"
1613 then
1614 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
1616 if test -e "$ORACLE_HOME/lib/ldflags"
1617 then
1618 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
1619 fi
1620 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
1621 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
1622 fi
1623 if test "x$with_oracle" = "xyes"
1624 then
1625 SAVE_CPPFLAGS="$CPPFLAGS"
1626 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
1628 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
1630 CPPFLAGS="$SAVE_CPPFLAGS"
1631 fi
1632 if test "x$with_oracle" = "xyes"
1633 then
1634 SAVE_CPPFLAGS="$CPPFLAGS"
1635 SAVE_LDFLAGS="$LDFLAGS"
1636 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
1637 LDFLAGS="$LDFLAGS $with_oracle_libs"
1639 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
1641 CPPFLAGS="$SAVE_CPPFLAGS"
1642 LDFLAGS="$SAVE_LDFLAGS"
1643 fi
1644 if test "x$with_oracle" = "xyes"
1645 then
1646 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
1647 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
1648 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
1649 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
1650 fi
1651 # }}}
1653 # --with-libowcapi {{{
1654 with_libowcapi_cppflags=""
1655 with_libowcapi_libs="-lowcapi"
1656 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1657 [
1658 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1659 then
1660 with_libowcapi_cppflags="-I$withval/include"
1661 with_libowcapi_libs="-L$withval/lib -lowcapi"
1662 with_libowcapi="yes"
1663 else
1664 with_libowcapi="$withval"
1665 fi
1666 ],
1667 [
1668 with_libowcapi="yes"
1669 ])
1670 if test "x$with_libowcapi" = "xyes"
1671 then
1672 SAVE_CPPFLAGS="$CPPFLAGS"
1673 CPPFLAGS="$with_libowcapi_cppflags"
1675 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1677 CPPFLAGS="$SAVE_CPPFLAGS"
1678 fi
1679 if test "x$with_libowcapi" = "xyes"
1680 then
1681 SAVE_LDFLAGS="$LDFLAGS"
1682 SAVE_CPPFLAGS="$CPPFLAGS"
1683 LDFLAGS="$with_libowcapi_libs"
1684 CPPFLAGS="$with_libowcapi_cppflags"
1686 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1688 LDFLAGS="$SAVE_LDFLAGS"
1689 CPPFLAGS="$SAVE_CPPFLAGS"
1690 fi
1691 if test "x$with_libowcapi" = "xyes"
1692 then
1693 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1694 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1695 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1696 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1697 fi
1698 # }}}
1700 # --with-libpcap {{{
1701 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1702 [
1703 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1704 then
1705 LDFLAGS="$LDFLAGS -L$withval/lib"
1706 CPPFLAGS="$CPPFLAGS -I$withval/include"
1707 with_libpcap="yes"
1708 else
1709 with_libpcap="$withval"
1710 fi
1711 ],
1712 [
1713 with_libpcap="yes"
1714 ])
1715 if test "x$with_libpcap" = "xyes"
1716 then
1717 AC_CHECK_LIB(pcap, pcap_open_live,
1718 [
1719 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1720 ], [with_libpcap="no (libpcap not found)"])
1721 fi
1722 if test "x$with_libpcap" = "xyes"
1723 then
1724 AC_CHECK_HEADERS(pcap.h,
1725 [
1726 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1727 ], [with_libpcap="no (pcap.h not found)"])
1728 fi
1729 if test "x$with_libpcap" = "xyes"
1730 then
1731 collect_libpcap=1
1732 else
1733 collect_libpcap=0
1734 fi
1735 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1736 [Wether or not to use the pcap library])
1737 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1738 # }}}
1740 # --with-libpcre {{{
1741 with_pcre_config="pcre-config"
1742 with_pcre_cflags=""
1743 with_pcre_libs=""
1744 AC_ARG_WITH(libpcre, [AS_HELP_STRING([--with-libpcre@<:@=PREFIX@:>@],
1745 [Path to libpcre.])],
1746 [
1747 if test "x$withval" = "xno"
1748 then
1749 with_libpcre="no"
1750 else if test "x$withval" = "xyes"
1751 then
1752 with_libpcre="yes"
1753 else
1754 if test -f "$withval" && test -x "$withval"
1755 then
1756 with_pcre_config="$withval"
1757 else if test -x "$withval/bin/pcre-config"
1758 then
1759 with_pcre_config="$withval/bin/pcre-config"
1760 fi; fi
1761 with_libpcre="yes"
1762 fi; fi
1763 ],
1764 [
1765 with_libpcre="yes"
1766 ])
1768 if test "x$with_libpcre" = "xyes"
1769 then
1770 with_pcre_cflags=`$with_pcre_config --cflags 2>/dev/null`
1771 pcre_config_status=$?
1773 if test $pcre_config_status -ne 0
1774 then
1775 with_libpcre="no ($with_pcre_config failed)"
1776 else
1777 SAVE_CPPFLAGS="$CPPFLAGS"
1778 CPPFLAGS="$CPPFLAGS $with_pcre_cflags"
1780 AC_CHECK_HEADERS(pcre.h, [], [with_libpcre="no (pcre.h not found)"], [])
1782 CPPFLAGS="$SAVE_CPPFLAGS"
1783 fi
1784 fi
1786 if test "x$with_libpcre" = "xyes"
1787 then
1788 with_pcre_libs=`$with_pcre_config --libs 2>/dev/null`
1789 pcre_config_status=$?
1791 if test $pcre_config_status -ne 0
1792 then
1793 with_libpcre="no ($with_pcre_config failed)"
1794 else
1795 AC_CHECK_LIB(pcre, pcre_compile,
1796 [with_libpcre="yes"],
1797 [with_libpcre="no (symbol 'pcre_compile' not found)"],
1798 [$with_pcre_libs])
1799 fi
1800 fi
1802 if test "x$with_libpcre" = "xyes"
1803 then
1804 BUILD_WITH_LIBPCRE_CFLAGS="$with_pcre_cflags"
1805 BUILD_WITH_LIBPCRE_LIBS="$with_pcre_libs"
1806 AC_SUBST(BUILD_WITH_LIBPCRE_CFLAGS)
1807 AC_SUBST(BUILD_WITH_LIBPCRE_LIBS)
1808 fi
1809 AM_CONDITIONAL(BUILD_WITH_LIBPCRE, test "x$with_libpcre" = "xyes")
1810 # }}}
1812 # --with-libperl {{{
1813 perl_interpreter="perl"
1814 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1815 [
1816 if test -x "$withval"
1817 then
1818 perl_interpreter="$withval"
1819 with_libperl="yes"
1820 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1821 then
1822 LDFLAGS="$LDFLAGS -L$withval/lib"
1823 CPPFLAGS="$CPPFLAGS -I$withval/include"
1824 perl_interpreter="$withval/bin/perl"
1825 with_libperl="yes"
1826 else
1827 with_libperl="$withval"
1828 fi; fi
1829 ],
1830 [
1831 with_libperl="yes"
1832 ])
1834 AC_MSG_CHECKING([for perl])
1835 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1836 if test -x "$perl_interpreter"
1837 then
1838 AC_MSG_RESULT([yes ($perl_interpreter)])
1839 else
1840 perl_interpreter=""
1841 AC_MSG_RESULT([no])
1842 fi
1844 AC_SUBST(PERL, "$perl_interpreter")
1846 if test "x$with_libperl" = "xyes" \
1847 && test -n "$perl_interpreter"
1848 then
1849 SAVE_CFLAGS=$CFLAGS
1850 SAVE_LDFLAGS=$LDFLAGS
1851 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1852 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1853 CFLAGS="$CFLAGS $PERL_CFLAGS"
1854 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1856 AC_CACHE_CHECK([for libperl],
1857 [have_libperl],
1858 AC_LINK_IFELSE(
1859 AC_LANG_PROGRAM(
1860 [[
1861 #define PERL_NO_GET_CONTEXT
1862 #include <EXTERN.h>
1863 #include <perl.h>
1864 #include <XSUB.h>
1865 ]],
1866 [[
1867 dTHX;
1868 load_module (PERL_LOADMOD_NOIMPORT,
1869 newSVpv ("Collectd::Plugin::FooBar", 24),
1870 Nullsv);
1871 ]]),
1872 [have_libperl="yes"],
1873 [have_libperl="no"]
1874 )
1875 )
1877 if test "x$have_libperl" = "xyes"
1878 then
1879 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1880 AC_SUBST(PERL_CFLAGS)
1881 AC_SUBST(PERL_LDFLAGS)
1882 else
1883 with_libperl="no"
1884 fi
1886 CFLAGS=$SAVE_CFLAGS
1887 LDFLAGS=$SAVE_LDFLAGS
1888 else if test -z "$perl_interpreter"; then
1889 with_libperl="no (no perl interpreter found)"
1890 have_libperl="no"
1891 fi; fi
1892 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1894 if test "x$with_libperl" = "xyes"
1895 then
1896 SAVE_CFLAGS=$CFLAGS
1897 SAVE_LDFLAGS=$LDFLAGS
1898 CFLAGS="$CFLAGS $PERL_CFLAGS"
1899 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1901 AC_CACHE_CHECK([if perl supports ithreads],
1902 [have_perl_ithreads],
1903 AC_LINK_IFELSE(
1904 AC_LANG_PROGRAM(
1905 [[
1906 #include <EXTERN.h>
1907 #include <perl.h>
1908 #include <XSUB.h>
1910 #if !defined(USE_ITHREADS)
1911 # error "Perl does not support ithreads!"
1912 #endif /* !defined(USE_ITHREADS) */
1913 ]],
1914 [[ ]]),
1915 [have_perl_ithreads="yes"],
1916 [have_perl_ithreads="no"]
1917 )
1918 )
1920 if test "x$have_perl_ithreads" = "xyes"
1921 then
1922 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1923 fi
1925 CFLAGS=$SAVE_CFLAGS
1926 LDFLAGS=$SAVE_LDFLAGS
1927 fi
1928 # }}}
1930 # --with-libpq {{{
1931 with_pg_config="pg_config"
1932 with_libpq_includedir=""
1933 with_libpq_libdir=""
1934 with_libpq_cppflags=""
1935 with_libpq_ldflags=""
1936 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
1937 [Path to libpq.])],
1938 [
1939 if test "x$withval" = "xno"
1940 then
1941 with_libpq="no"
1942 else if test "x$withval" = "xyes"
1943 then
1944 with_libpq="yes"
1945 else
1946 if test -f "$withval" && test -x "$withval";
1947 then
1948 with_pg_config="$withval"
1949 else if test -x "$withval/bin/pg_config"
1950 then
1951 with_pg_config="$withval/bin/pg_config"
1952 fi; fi
1953 with_libpq="yes"
1954 fi; fi
1955 ],
1956 [
1957 with_libpq="yes"
1958 ])
1959 if test "x$with_libpq" = "xyes"
1960 then
1961 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
1962 pg_config_status=$?
1964 if test $pg_config_status -eq 0
1965 then
1966 if test -n "$with_libpq_includedir"; then
1967 for dir in $with_libpq_includedir; do
1968 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
1969 done
1970 fi
1971 else
1972 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
1973 fi
1975 SAVE_CPPFLAGS="$CPPFLAGS"
1976 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
1978 AC_CHECK_HEADERS(libpq-fe.h, [],
1979 [with_libpq="no (libpq-fe.h not found)"], [])
1981 CPPFLAGS="$SAVE_CPPFLAGS"
1982 fi
1983 if test "x$with_libpq" = "xyes"
1984 then
1985 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
1986 pg_config_status=$?
1988 if test $pg_config_status -eq 0
1989 then
1990 if test -n "$with_libpq_libdir"; then
1991 for dir in $with_libpq_libdir; do
1992 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
1993 done
1994 fi
1995 else
1996 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
1997 fi
1999 SAVE_LDFLAGS="$LDFLAGS"
2000 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2002 AC_CHECK_LIB(pq, PQconnectdb,
2003 [with_libpq="yes"],
2004 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2006 LDFLAGS="$SAVE_LDFLAGS"
2007 fi
2008 if test "x$with_libpq" = "xyes"
2009 then
2010 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2011 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2012 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2013 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2014 fi
2015 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2016 # }}}
2018 # --with-libpthread {{{
2019 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2020 [ if test "x$withval" != "xno" \
2021 && test "x$withval" != "xyes"
2022 then
2023 LDFLAGS="$LDFLAGS -L$withval/lib"
2024 CPPFLAGS="$CPPFLAGS -I$withval/include"
2025 with_libpthread="yes"
2026 else
2027 if test "x$withval" = "xno"
2028 then
2029 with_libpthread="no (disabled)"
2030 fi
2031 fi
2032 ], [with_libpthread="yes"])
2033 if test "x$with_libpthread" = "xyes"
2034 then
2035 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2036 fi
2037 if test "x$with_libpthread" = "xyes"
2038 then
2039 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2040 fi
2041 if test "x$with_libpthread" = "xyes"
2042 then
2043 collect_pthread=1
2044 else
2045 collect_pthread=0
2046 fi
2047 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2048 [Wether or not to use pthread (POSIX threads) library])
2049 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2050 # }}}
2052 # --with-librrd {{{
2053 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2054 librrd_cflags=""
2055 librrd_ldflags=""
2056 librrd_threadsafe="yes"
2057 librrd_rrdc_update="no"
2058 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2059 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2060 then
2061 librrd_cflags="-I$withval/include"
2062 librrd_ldflags="-L$withval/lib"
2063 with_librrd="yes"
2064 else
2065 with_librrd="$withval"
2066 fi
2067 ], [with_librrd="yes"])
2068 if test "x$with_librrd" = "xyes"
2069 then
2070 SAVE_CPPFLAGS="$CPPFLAGS"
2071 SAVE_LDFLAGS="$LDFLAGS"
2073 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2074 LDFLAGS="$LDFLAGS $librrd_ldflags"
2076 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2078 CPPFLAGS="$SAVE_CPPFLAGS"
2079 LDFLAGS="$SAVE_LDFLAGS"
2080 fi
2081 if test "x$with_librrd" = "xyes"
2082 then
2083 SAVE_CPPFLAGS="$CPPFLAGS"
2084 SAVE_LDFLAGS="$LDFLAGS"
2086 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2087 LDFLAGS="$LDFLAGS $librrd_ldflags"
2089 AC_CHECK_LIB(rrd_th, rrd_update_r,
2090 [with_librrd="yes"
2091 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2092 ],
2093 [librrd_threadsafe="no"
2094 AC_CHECK_LIB(rrd, rrd_update,
2095 [with_librrd="yes"
2096 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2097 ],
2098 [with_librrd="no (symbol 'rrd_update' not found)"],
2099 [-lm])
2100 ],
2101 [-lm])
2103 if test "x$librrd_threadsafe" = "xyes"
2104 then
2105 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2106 else
2107 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2108 fi
2110 CPPFLAGS="$SAVE_CPPFLAGS"
2111 LDFLAGS="$SAVE_LDFLAGS"
2112 fi
2113 if test "x$with_librrd" = "xyes"
2114 then
2115 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2116 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2117 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2118 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2119 fi
2120 if test "x$librrd_threadsafe" = "xyes"
2121 then
2122 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2123 fi
2124 # }}}
2126 # --with-libsensors {{{
2127 with_sensors_cflags=""
2128 with_sensors_ldflags=""
2129 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2130 [
2131 if test "x$withval" = "xno"
2132 then
2133 with_libsensors="no"
2134 else
2135 with_libsensors="yes"
2136 if test "x$withval" != "xyes"
2137 then
2138 with_sensors_cflags="-I$withval/include"
2139 with_sensors_ldflags="-L$withval/lib"
2140 with_libsensors="yes"
2141 fi
2142 fi
2143 ],
2144 [
2145 if test "x$ac_system" = "xLinux"
2146 then
2147 with_libsensors="yes"
2148 else
2149 with_libsensors="no (Linux only library)"
2150 fi
2151 ])
2152 if test "x$with_libsensors" = "xyes"
2153 then
2154 SAVE_CPPFLAGS="$CPPFLAGS"
2155 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2157 # AC_CHECK_HEADERS(sensors/sensors.h,
2158 # [
2159 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2160 # ],
2161 # [with_libsensors="no (sensors/sensors.h not found)"])
2162 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2164 CPPFLAGS="$SAVE_CPPFLAGS"
2165 fi
2166 if test "x$with_libsensors" = "xyes"
2167 then
2168 SAVE_CPPFLAGS="$CPPFLAGS"
2169 SAVE_LDFLAGS="$LDFLAGS"
2170 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2171 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2173 AC_CHECK_LIB(sensors, sensors_init,
2174 [
2175 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2176 ],
2177 [with_libsensors="no (libsensors not found)"])
2179 CPPFLAGS="$SAVE_CPPFLAGS"
2180 LDFLAGS="$SAVE_LDFLAGS"
2181 fi
2182 if test "x$with_libsensors" = "xyes"
2183 then
2184 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2185 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2186 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2187 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2188 fi
2189 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2190 # }}}
2192 # --with-libstatgrab {{{
2193 with_libstatgrab_cflags=""
2194 with_libstatgrab_ldflags=""
2195 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2196 [
2197 if test "x$withval" != "xno" \
2198 && test "x$withval" != "xyes"
2199 then
2200 with_libstatgrab_cflags="-I$withval/include"
2201 with_libstatgrab_ldflags="-L$withval/lib"
2202 with_libstatgrab="yes"
2203 else
2204 with_libstatgrab="$withval"
2205 fi
2206 ],
2207 [
2208 if test "x$ac_system" = "xunknown"
2209 then
2210 with_libstatgrab="yes"
2211 else
2212 with_libstatgrab="no"
2213 fi
2214 ])
2215 with_libstatgrab_pkg_config="yes"
2216 if test "x$with_libstatgrab" = "xyes" \
2217 && test "x$PKG_CONFIG" != "x"
2218 then
2219 AC_MSG_CHECKING([pkg-config for libstatgrab])
2220 temp_result="found"
2221 $PKG_CONFIG --exists libstatgrab 2>/dev/null
2222 if test "$?" != "0"
2223 then
2224 with_libstatgrab_pkg_config="no"
2225 temp_result="not found"
2226 fi
2227 AC_MSG_RESULT([$temp_result])
2228 else
2229 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2230 with_libstatgrab_pkg_config="no"
2231 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2232 fi
2234 if test "x$with_libstatgrab" = "xyes" \
2235 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2236 && test "x$with_libstatgrab_cflags" = "x"
2237 then
2238 AC_MSG_CHECKING([for libstatgrab CFLAGS])
2239 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2240 if test "$?" = "0"
2241 then
2242 with_libstatgrab_cflags="$temp_result"
2243 else
2244 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2245 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2246 fi
2247 AC_MSG_RESULT([$temp_result])
2248 fi
2250 if test "x$with_libstatgrab" = "xyes" \
2251 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2252 && test "x$with_libstatgrab_ldflags" = "x"
2253 then
2254 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2255 temp_result="`$PKG_CONFIG --libs libstatgrab`"
2256 if test "$?" = "0"
2257 then
2258 with_libstatgrab_ldflags="$temp_result"
2259 else
2260 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2261 temp_result="$PKG_CONFIG --libs libstatgrab failed"
2262 fi
2263 AC_MSG_RESULT([$temp_result])
2264 fi
2266 if test "x$with_libstatgrab" = "xyes"
2267 then
2268 SAVE_CPPFLAGS="$CPPFLAGS"
2269 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2271 AC_CHECK_HEADERS(statgrab.h,
2272 [with_libstatgrab="yes"],
2273 [with_libstatgrab="no (statgrab.h not found)"])
2275 CPPFLAGS="$SAVE_CPPFLAGS"
2276 fi
2278 if test "x$with_libstatgrab" = "xyes"
2279 then
2280 SAVE_CFLAGS="$CFLAGS"
2281 SAVE_LDFLAGS="$LDFLAGS"
2283 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2284 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2286 AC_CHECK_LIB(statgrab, sg_init,
2287 [with_libstatgrab="yes"],
2288 [with_libstatgrab="no (symbol sg_init not found)"])
2290 CFLAGS="$SAVE_CFLAGS"
2291 LDFLAGS="$SAVE_LDFLAGS"
2292 fi
2294 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2295 if test "x$with_libstatgrab" = "xyes"
2296 then
2297 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2298 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2299 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2300 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2301 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2302 fi
2303 # }}}
2305 # --with-libxmms {{{
2306 with_xmms_config="xmms-config"
2307 with_xmms_cflags=""
2308 with_xmms_libs=""
2309 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2310 [
2311 if test "x$withval" != "xno" \
2312 && test "x$withval" != "xyes"
2313 then
2314 if test -f "$withval" && test -x "$withval";
2315 then
2316 with_xmms_config="$withval"
2317 else if test -x "$withval/bin/xmms-config"
2318 then
2319 with_xmms_config="$withval/bin/xmms-config"
2320 fi; fi
2321 with_libxmms="yes"
2322 else if test "x$withval" = "xno"
2323 then
2324 with_libxmms="no"
2325 else
2326 with_libxmms="yes"
2327 fi; fi
2328 ],
2329 [
2330 with_libxmms="yes"
2331 ])
2332 if test "x$with_libxmms" = "xyes"
2333 then
2334 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2335 xmms_config_status=$?
2337 if test $xmms_config_status -ne 0
2338 then
2339 with_libxmms="no"
2340 fi
2341 fi
2342 if test "x$with_libxmms" = "xyes"
2343 then
2344 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2345 xmms_config_status=$?
2347 if test $xmms_config_status -ne 0
2348 then
2349 with_libxmms="no"
2350 fi
2351 fi
2352 if test "x$with_libxmms" = "xyes"
2353 then
2354 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2355 [
2356 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2357 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2358 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2359 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2360 ],
2361 [
2362 with_libxmms="no"
2363 ],
2364 [$with_xmms_libs])
2365 fi
2366 with_libxmms_numeric=0
2367 if test "x$with_libxmms" = "xyes"
2368 then
2369 with_libxmms_numeric=1
2370 fi
2371 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2372 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2373 # }}}
2375 # pkg-config --exists 'libupsclient' {{{
2376 with_libupsclient="no (pkg-config isn't available)"
2377 with_libupsclient_cflags=""
2378 with_libupsclient_libs=""
2379 if test "x$PKG_CONFIG" != "x"
2380 then
2381 pkg-config --exists 'libupsclient' 2>/dev/null
2382 if test "$?" = "0"
2383 then
2384 with_libupsclient="yes"
2385 else
2386 with_libupsclient="no (pkg-config doesn't know library)"
2387 fi
2388 fi
2389 if test "x$with_libupsclient" = "xyes"
2390 then
2391 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
2392 if test $? -ne 0
2393 then
2394 with_libupsclient="no"
2395 fi
2396 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
2397 if test $? -ne 0
2398 then
2399 with_libupsclient="no"
2400 fi
2401 fi
2402 if test "x$with_libupsclient" = "xyes"
2403 then
2404 SAVE_CPPFLAGS="$CPPFLAGS"
2405 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2407 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2409 CPPFLAGS="$SAVE_CPPFLAGS"
2410 fi
2411 if test "x$with_libupsclient" = "xyes"
2412 then
2413 SAVE_CPPFLAGS="$CPPFLAGS"
2414 SAVE_LDFLAGS="$LDFLAGS"
2416 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2417 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2419 AC_CHECK_LIB(upsclient, upscli_connect,
2420 [with_libupsclient="yes"],
2421 [with_libupsclient="no (symbol upscli_connect not found)"])
2423 CPPFLAGS="$SAVE_CPPFLAGS"
2424 LDFLAGS="$SAVE_LDFLAGS"
2425 fi
2426 if test "x$with_libupsclient" = "xyes"
2427 then
2428 SAVE_CPPFLAGS="$CPPFLAGS"
2429 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2431 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2432 [#include <stdlib.h>
2433 #include <stdio.h>
2434 #include <upsclient.h>])
2436 CPPFLAGS="$SAVE_CPPFLAGS"
2437 fi
2438 if test "x$with_libupsclient" = "xyes"
2439 then
2440 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2441 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2442 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2443 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2444 fi
2445 # }}}
2447 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
2448 with_libxml2="no (pkg-config isn't available)"
2449 with_libxml2_cflags=""
2450 with_libxml2_ldflags=""
2451 with_libvirt="no (pkg-config isn't available)"
2452 with_libvirt_cflags=""
2453 with_libvirt_ldflags=""
2454 if test "x$PKG_CONFIG" != "x"
2455 then
2456 pkg-config --exists 'libxml-2.0' 2>/dev/null
2457 if test "$?" = "0"
2458 then
2459 with_libxml2="yes"
2460 else
2461 with_libxml2="no (pkg-config doesn't know library)"
2462 fi
2464 pkg-config --exists libvirt 2>/dev/null
2465 if test "$?" = "0"
2466 then
2467 with_libvirt="yes"
2468 else
2469 with_libvirt="no (pkg-config doesn't know library)"
2470 fi
2471 fi
2472 if test "x$with_libxml2" = "xyes"
2473 then
2474 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2475 if test $? -ne 0
2476 then
2477 with_libxml2="no"
2478 fi
2479 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2480 if test $? -ne 0
2481 then
2482 with_libxml2="no"
2483 fi
2484 fi
2485 if test "x$with_libxml2" = "xyes"
2486 then
2487 SAVE_CPPFLAGS="$CPPFLAGS"
2488 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2490 AC_CHECK_HEADERS(libxml/parser.h, [],
2491 [with_libxml2="no (libxml/parser.h not found)"])
2493 CPPFLAGS="$SAVE_CPPFLAGS"
2494 fi
2495 if test "x$with_libxml2" = "xyes"
2496 then
2497 SAVE_CFLAGS="$CFLAGS"
2498 SAVE_LDFLAGS="$LDFLAGS"
2500 CFLAGS="$CFLAGS $with_libxml2_cflags"
2501 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2503 AC_CHECK_LIB(xml2, xmlXPathEval,
2504 [with_libxml2="yes"],
2505 [with_libxml2="no (symbol xmlXPathEval not found)"])
2507 CFLAGS="$SAVE_CFLAGS"
2508 LDFLAGS="$SAVE_LDFLAGS"
2509 fi
2510 dnl Add the right compiler flags and libraries.
2511 if test "x$with_libxml2" = "xyes"; then
2512 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2513 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2514 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2515 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2516 fi
2517 if test "x$with_libvirt" = "xyes"
2518 then
2519 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2520 if test $? -ne 0
2521 then
2522 with_libvirt="no"
2523 fi
2524 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2525 if test $? -ne 0
2526 then
2527 with_libvirt="no"
2528 fi
2529 fi
2530 if test "x$with_libvirt" = "xyes"
2531 then
2532 SAVE_CPPFLAGS="$CPPFLAGS"
2533 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2535 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2536 [with_libvirt="no (libvirt/libvirt.h not found)"])
2538 CPPFLAGS="$SAVE_CPPFLAGS"
2539 fi
2540 if test "x$with_libvirt" = "xyes"
2541 then
2542 SAVE_CFLAGS="$CFLAGS"
2543 SAVE_LDFLAGS="$LDFLAGS"
2545 CFLAGS="$CFLAGS $with_libvirt_cflags"
2546 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2548 AC_CHECK_LIB(virt, virDomainBlockStats,
2549 [with_libvirt="yes"],
2550 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2552 CFLAGS="$SAVE_CFLAGS"
2553 LDFLAGS="$SAVE_LDFLAGS"
2554 fi
2555 dnl Add the right compiler flags and libraries.
2556 if test "x$with_libvirt" = "xyes"; then
2557 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2558 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2559 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2560 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2561 fi
2562 # }}}
2564 # $PKG_CONFIG --exists OpenIPMIpthread {{{
2565 with_libopenipmipthread="yes"
2566 with_libopenipmipthread_cflags=""
2567 with_libopenipmipthread_libs=""
2569 AC_MSG_CHECKING([for pkg-config])
2570 temp_result="no"
2571 if test "x$PKG_CONFIG" = "x"
2572 then
2573 with_libopenipmipthread="no"
2574 temp_result="no"
2575 else
2576 temp_result="$PKG_CONFIG"
2577 fi
2578 AC_MSG_RESULT([$temp_result])
2580 if test "x$with_libopenipmipthread" = "xyes"
2581 then
2582 AC_MSG_CHECKING([for libOpenIPMIpthread])
2583 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2584 if test "$?" != "0"
2585 then
2586 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2587 fi
2588 AC_MSG_RESULT([$with_libopenipmipthread])
2589 fi
2591 if test "x$with_libopenipmipthread" = "xyes"
2592 then
2593 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2594 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2595 if test "$?" = "0"
2596 then
2597 with_libopenipmipthread_cflags="$temp_result"
2598 else
2599 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2600 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2601 fi
2602 AC_MSG_RESULT([$temp_result])
2603 fi
2605 if test "x$with_libopenipmipthread" = "xyes"
2606 then
2607 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2608 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2609 if test "$?" = "0"
2610 then
2611 with_libopenipmipthread_ldflags="$temp_result"
2612 else
2613 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2614 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2615 fi
2616 AC_MSG_RESULT([$temp_result])
2617 fi
2619 if test "x$with_libopenipmipthread" = "xyes"
2620 then
2621 SAVE_CPPFLAGS="$CPPFLAGS"
2622 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2624 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2625 [with_libopenipmipthread="yes"],
2626 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2627 [#include <OpenIPMI/ipmiif.h>
2628 #include <OpenIPMI/ipmi_err.h>
2629 #include <OpenIPMI/ipmi_posix.h>
2630 #include <OpenIPMI/ipmi_conn.h>
2631 ])
2633 CPPFLAGS="$SAVE_CPPFLAGS"
2634 fi
2636 if test "x$with_libopenipmipthread" = "xyes"
2637 then
2638 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2639 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2640 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2641 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2642 fi
2643 # }}}
2645 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
2646 [with_libnotify="yes"],
2647 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
2649 # Check for enabled/disabled features
2650 #
2652 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2653 # ------------------------------------------------------------
2654 dnl
2655 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2656 dnl
2657 AC_DEFUN(
2658 [AC_COLLECTD],
2659 [
2660 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2661 m4_if(
2662 [$2],
2663 [enable],
2664 [dnl
2665 m4_define([EnDis],[disabled])dnl
2666 m4_define([YesNo],[no])dnl
2667 ],dnl
2668 [m4_if(
2669 [$2],
2670 [disable],
2671 [dnl
2672 m4_define([EnDis],[enabled])dnl
2673 m4_define([YesNo],[yes])dnl
2674 ],
2675 [dnl
2676 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2677 ]dnl
2678 )]dnl
2679 )dnl
2680 m4_if([$3], [feature], [],
2681 [m4_if(
2682 [$3], [module], [],
2683 [dnl
2684 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2685 ]dnl
2686 )]dnl
2687 )dnl
2688 AC_ARG_ENABLE(
2689 [$1],
2690 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2691 [],
2692 enable_$1='[YesNo]'dnl
2693 )# AC_ARG_ENABLE
2694 if test "x$enable_$1" = "xno"
2695 then
2696 collectd_$1=0
2697 else
2698 if test "x$enable_$1" = "xyes"
2699 then
2700 collectd_$1=1
2701 else
2702 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2703 collectd_$1=1
2704 enable_$1='yes'
2705 fi
2706 fi
2707 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2708 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2709 ]dnl
2710 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2712 # AC_PLUGIN(name, default, info)
2713 # ------------------------------------------------------------
2714 dnl
2715 AC_DEFUN(
2716 [AC_PLUGIN],
2717 [
2718 enable_plugin="no"
2719 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2720 [
2721 if test "x$enableval" = "xyes"
2722 then
2723 enable_plugin="yes"
2724 else
2725 enable_plugin="no"
2726 fi
2727 ],
2728 [
2729 if test "x$2" = "xyes"
2730 then
2731 enable_plugin="yes"
2732 else
2733 enable_plugin="no"
2734 fi
2735 ])
2736 if test "x$enable_plugin" = "xyes"
2737 then
2738 if test "x$2" = "xyes"
2739 then
2740 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2741 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
2742 dependency_error="yes"
2743 enable_plugin="no (dependency error)"
2744 fi
2745 fi
2746 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2747 enable_$1="$enable_plugin"
2748 ]
2749 )# AC_PLUGIN(name, default, info)
2751 m4_divert_once([HELP_ENABLE], [
2752 collectd features:])
2753 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2754 AC_COLLECTD([debug], [enable], [feature], [debugging])
2755 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2756 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2758 dependency_error="no"
2759 plugin_ascent="no"
2760 plugin_battery="no"
2761 plugin_cpu="no"
2762 plugin_cpufreq="no"
2763 plugin_df="no"
2764 plugin_disk="no"
2765 plugin_entropy="no"
2766 plugin_interface="no"
2767 plugin_ipmi="no"
2768 plugin_ipvs="no"
2769 plugin_irq="no"
2770 plugin_libvirt="no"
2771 plugin_load="no"
2772 plugin_memory="no"
2773 plugin_multimeter="no"
2774 plugin_nfs="no"
2775 plugin_perl="no"
2776 plugin_processes="no"
2777 plugin_serial="no"
2778 plugin_swap="no"
2779 plugin_tape="no"
2780 plugin_tcpconns="no"
2781 plugin_thermal="no"
2782 plugin_users="no"
2783 plugin_vmem="no"
2784 plugin_vserver="no"
2785 plugin_wireless="no"
2787 # Linux
2788 if test "x$ac_system" = "xLinux"
2789 then
2790 plugin_battery="yes"
2791 plugin_cpu="yes"
2792 plugin_cpufreq="yes"
2793 plugin_disk="yes"
2794 plugin_entropy="yes"
2795 plugin_interface="yes"
2796 plugin_irq="yes"
2797 plugin_load="yes"
2798 plugin_memory="yes"
2799 plugin_nfs="yes"
2800 plugin_processes="yes"
2801 plugin_serial="yes"
2802 plugin_swap="yes"
2803 plugin_tcpconns="yes"
2804 plugin_thermal="yes"
2805 plugin_vmem="yes"
2806 plugin_vserver="yes"
2807 plugin_wireless="yes"
2809 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2810 then
2811 plugin_ipvs="yes"
2812 fi
2813 fi
2815 if test "x$ac_system" = "xOpenBSD"
2816 then
2817 plugin_tcpconns="yes"
2818 fi
2820 # Mac OS X devices
2821 if test "x$with_libiokit" = "xyes"
2822 then
2823 plugin_battery="yes"
2824 plugin_disk="yes"
2825 fi
2827 # Solaris
2828 if test "x$with_devinfo$with_kstat" = "xyesyes"
2829 then
2830 plugin_cpu="yes"
2831 plugin_disk="yes"
2832 plugin_interface="yes"
2833 plugin_memory="yes"
2834 plugin_swap="yes"
2835 plugin_tape="yes"
2836 fi
2838 # libstatgrab
2839 if test "x$with_libstatgrab" = "xyes"
2840 then
2841 plugin_cpu="yes"
2842 plugin_disk="yes"
2843 plugin_interface="yes"
2844 plugin_load="yes"
2845 plugin_memory="yes"
2846 plugin_swap="yes"
2847 plugin_users="yes"
2848 fi
2850 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2851 then
2852 plugin_ascent="yes"
2853 fi
2855 if test "x$with_libopenipmipthread" = "xyes"
2856 then
2857 plugin_ipmi="yes"
2858 fi
2860 if test "x$have_processor_info" = "xyes"
2861 then
2862 plugin_cpu="yes"
2863 fi
2864 if test "x$have_sysctlbyname" = "xyes"
2865 then
2866 plugin_cpu="yes"
2867 plugin_memory="yes"
2868 plugin_tcpconns="yes"
2869 fi
2871 if test "x$have_statfs" = "xyes"
2872 then
2873 plugin_df="yes"
2874 fi
2875 if test "x$have_statvfs" = "xyes"
2876 then
2877 plugin_df="yes"
2878 fi
2880 if test "x$have_getifaddrs" = "xyes"
2881 then
2882 plugin_interface="yes"
2883 fi
2885 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2886 then
2887 plugin_libvirt="yes"
2888 fi
2890 if test "x$have_getloadavg" = "xyes"
2891 then
2892 plugin_load="yes"
2893 fi
2895 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2896 then
2897 plugin_perl="yes"
2898 fi
2900 # Mac OS X memory interface
2901 if test "x$have_host_statistics" = "xyes"
2902 then
2903 plugin_memory="yes"
2904 fi
2906 if test "x$have_termios_h" = "xyes"
2907 then
2908 plugin_multimeter="yes"
2909 fi
2911 if test "x$have_thread_info" = "xyes"
2912 then
2913 plugin_processes="yes"
2914 fi
2916 if test "x$with_kvm_getprocs" = "xyes"
2917 then
2918 plugin_processes="yes"
2919 fi
2921 if test "x$with_kvm_getswapinfo" = "xyes"
2922 then
2923 plugin_swap="yes"
2924 fi
2926 if test "x$with_kvm_nlist" = "xyes"
2927 then
2928 plugin_tcpconns="yes"
2929 fi
2931 if test "x$have_getutent" = "xyes"
2932 then
2933 plugin_users="yes"
2934 fi
2935 if test "x$have_getutxent" = "xyes"
2936 then
2937 plugin_users="yes"
2938 fi
2940 # FIXME: sysctl for swap plugin
2942 m4_divert_once([HELP_ENABLE], [
2943 collectd plugins:])
2945 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2946 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2947 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2948 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2949 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2950 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2951 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2952 AC_PLUGIN([csv], [yes], [CSV output plugin])
2953 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2954 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
2955 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2956 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2957 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2958 AC_PLUGIN([email], [yes], [EMail statistics])
2959 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2960 AC_PLUGIN([exec], [yes], [Execution of external programs])
2961 AC_PLUGIN([filecount], [yes], [Count files in directories])
2962 AC_PLUGIN([filter_ignore], [yes], [Ignore specific values])
2963 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2964 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2965 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2966 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2967 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2968 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2969 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2970 AC_PLUGIN([load], [$plugin_load], [System load])
2971 AC_PLUGIN([logfile], [yes], [File logging plugin])
2972 AC_PLUGIN([match_regex], [yes], [The regex match])
2973 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2974 AC_PLUGIN([memcached], [yes], [memcached statistics])
2975 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2976 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2977 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2978 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2979 AC_PLUGIN([network], [yes], [Network communication plugin])
2980 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2981 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2982 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
2983 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2984 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2985 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
2986 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
2987 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2988 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2989 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
2990 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2991 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2992 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
2993 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
2994 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
2995 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2996 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2997 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2998 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2999 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
3000 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
3001 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3002 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
3003 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
3004 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
3005 AC_PLUGIN([users], [$plugin_users], [User statistics])
3006 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
3007 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
3008 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
3009 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
3010 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
3012 dnl ip_vs.h
3013 if test "x$ac_system" = "xLinux" \
3014 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3015 then
3016 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3017 fi
3019 dnl Perl bindings
3020 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3021 [
3022 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3023 then
3024 PERL_BINDINGS_OPTIONS="$withval"
3025 with_perl_bindings="yes"
3026 else
3027 PERL_BINDINGS_OPTIONS=""
3028 with_perl_bindings="$withval"
3029 fi
3030 ],
3031 [
3032 PERL_BINDINGS_OPTIONS=""
3033 if test -n "$perl_interpreter"
3034 then
3035 with_perl_bindings="yes"
3036 else
3037 with_perl_bindings="no (no perl interpreter found)"
3038 fi
3039 ])
3040 if test "x$with_perl_bindings" = "xyes"
3041 then
3042 PERL_BINDINGS="perl"
3043 else
3044 PERL_BINDINGS=""
3045 fi
3046 AC_SUBST(PERL_BINDINGS)
3047 AC_SUBST(PERL_BINDINGS_OPTIONS)
3049 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
3051 if test "x$with_librrd" = "xyes" \
3052 && test "x$librrd_threadsafe" != "xyes"
3053 then
3054 with_librrd="yes (warning: librrd is not thread-safe)"
3055 fi
3057 if test "x$with_liboping" = "xyes" \
3058 && test "x$with_own_liboping" = "xyes"
3059 then
3060 with_liboping="yes (shipped version)"
3061 fi
3063 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3064 then
3065 with_libiptc="yes (shipped version)"
3066 fi
3068 if test "x$with_libperl" = "xyes"
3069 then
3070 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3071 else
3072 enable_perl="no (needs libperl)"
3073 fi
3075 if test "x$with_perl_bindings" = "xyes" \
3076 && test "x$PERL_BINDINGS_OPTIONS" != "x"
3077 then
3078 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3079 fi
3081 cat <<EOF;
3083 Configuration:
3084 Libraries:
3085 libcurl . . . . . . . $with_libcurl
3086 libdbi . . . . . . . $with_libdbi
3087 libesmtp . . . . . . $with_libesmtp
3088 libiokit . . . . . . $with_libiokit
3089 libiptc . . . . . . . $with_libiptc
3090 libkstat . . . . . . $with_kstat
3091 libkvm . . . . . . . $with_libkvm
3092 libmysql . . . . . . $with_libmysql
3093 libnetlink . . . . . $with_libnetlink
3094 libnetsnmp . . . . . $with_libnetsnmp
3095 libnotify . . . . . . $with_libnotify
3096 liboconfig . . . . . $with_liboconfig
3097 libopenipmi . . . . . $with_libopenipmipthread
3098 liboping . . . . . . $with_liboping
3099 libpcap . . . . . . . $with_libpcap
3100 libpcre . . . . . . . $with_libpcre
3101 libperl . . . . . . . $with_libperl
3102 libpthread . . . . . $with_libpthread
3103 libpq . . . . . . . . $with_libpq
3104 librrd . . . . . . . $with_librrd
3105 libsensors . . . . . $with_libsensors
3106 libstatgrab . . . . . $with_libstatgrab
3107 libupsclient . . . . $with_libupsclient
3108 libvirt . . . . . . . $with_libvirt
3109 libxml2 . . . . . . . $with_libxml2
3110 libxmms . . . . . . . $with_libxmms
3111 oracle . . . . . . . $with_oracle
3113 Features:
3114 daemon mode . . . . . $enable_daemon
3115 debug . . . . . . . . $enable_debug
3117 Bindings:
3118 perl . . . . . . . . $with_perl_bindings
3120 Modules:
3121 apache . . . . . . . $enable_apache
3122 apcups . . . . . . . $enable_apcups
3123 apple_sensors . . . . $enable_apple_sensors
3124 ascent . . . . . . . $enable_ascent
3125 battery . . . . . . . $enable_battery
3126 cpu . . . . . . . . . $enable_cpu
3127 cpufreq . . . . . . . $enable_cpufreq
3128 csv . . . . . . . . . $enable_csv
3129 dbi . . . . . . . . . $enable_dbi
3130 df . . . . . . . . . $enable_df
3131 disk . . . . . . . . $enable_disk
3132 dns . . . . . . . . . $enable_dns
3133 email . . . . . . . . $enable_email
3134 entropy . . . . . . . $enable_entropy
3135 exec . . . . . . . . $enable_exec
3136 filecount . . . . . . $enable_filecount
3137 filter_ignore . . . . $enable_filter_ignore
3138 hddtemp . . . . . . . $enable_hddtemp
3139 interface . . . . . . $enable_interface
3140 iptables . . . . . . $enable_iptables
3141 ipmi . . . . . . . . $enable_ipmi
3142 ipvs . . . . . . . . $enable_ipvs
3143 irq . . . . . . . . . $enable_irq
3144 libvirt . . . . . . . $enable_libvirt
3145 load . . . . . . . . $enable_load
3146 logfile . . . . . . . $enable_logfile
3147 match_regex . . . . . $enable_match_regex
3148 mbmon . . . . . . . . $enable_mbmon
3149 memcached . . . . . . $enable_memcached
3150 memory . . . . . . . $enable_memory
3151 multimeter . . . . . $enable_multimeter
3152 mysql . . . . . . . . $enable_mysql
3153 netlink . . . . . . . $enable_netlink
3154 network . . . . . . . $enable_network
3155 nfs . . . . . . . . . $enable_nfs
3156 nginx . . . . . . . . $enable_nginx
3157 notify_desktop . . . $enable_notify_desktop
3158 notify_email . . . . $enable_notify_email
3159 ntpd . . . . . . . . $enable_ntpd
3160 nut . . . . . . . . . $enable_nut
3161 onewire . . . . . . . $enable_onewire
3162 oracle . . . . . . . $enable_oracle
3163 perl . . . . . . . . $enable_perl
3164 ping . . . . . . . . $enable_ping
3165 postgresql . . . . . $enable_postgresql
3166 powerdns . . . . . . $enable_powerdns
3167 processes . . . . . . $enable_processes
3168 rrdtool . . . . . . . $enable_rrdtool
3169 rrdcached . . . . . . $enable_rrdcached
3170 sensors . . . . . . . $enable_sensors
3171 serial . . . . . . . $enable_serial
3172 snmp . . . . . . . . $enable_snmp
3173 swap . . . . . . . . $enable_swap
3174 syslog . . . . . . . $enable_syslog
3175 tail . . . . . . . . $enable_tail
3176 tape . . . . . . . . $enable_tape
3177 tcpconns . . . . . . $enable_tcpconns
3178 teamspeak2 . . . . . $enable_teamspeak2
3179 thermal . . . . . . . $enable_thermal
3180 unixsock . . . . . . $enable_unixsock
3181 users . . . . . . . . $enable_users
3182 uuid . . . . . . . . $enable_uuid
3183 vmem . . . . . . . . $enable_vmem
3184 vserver . . . . . . . $enable_vserver
3185 wireless . . . . . . $enable_wireless
3186 xmms . . . . . . . . $enable_xmms
3188 EOF
3190 if test "x$dependency_error" = "xyes"; then
3191 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3192 fi
3194 # vim: set fdm=marker :