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 <stdint.h>
614 #include <string.h>
615 ]]]],
616 [[[[
617 uint64_t i0;
618 uint64_t i1;
619 uint8_t c[8];
620 double d;
622 d = 8.642135e130;
623 memcpy ((void *) &i0, (void *) &d, 8);
625 i1 = i0;
626 memcpy ((void *) c, (void *) &i1, 8);
628 if ((c[0] == 0x2f) && (c[1] == 0x25)
629 && (c[2] == 0xc0) && (c[3] == 0xc7)
630 && (c[4] == 0x43) && (c[5] == 0x2b)
631 && (c[6] == 0x1f) && (c[7] == 0x5b))
632 return (0);
633 else
634 return (1);
635 ]]]]),
636 [fp_layout_need_nothing="yes"],
637 [fp_layout_need_nothing="no"]
638 )
639 )
640 if test "x$fp_layout_need_nothing" = "xyes"; then
641 fp_layout_type="nothing"
642 fi
643 fi
644 if test "x$fp_layout_type" = "xunknown"; then
645 AC_CACHE_CHECK([if endianflip converts to x86 representation],
646 [fp_layout_need_endianflip],
647 AC_RUN_IFELSE(
648 AC_LANG_PROGRAM(
649 [[[[
650 #include <stdlib.h>
651 #include <stdio.h>
652 #include <stdint.h>
653 #include <string.h>
654 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
655 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
656 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
657 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
658 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
659 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
660 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
661 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
662 ]]]],
663 [[[[
664 uint64_t i0;
665 uint64_t i1;
666 uint8_t c[8];
667 double d;
669 d = 8.642135e130;
670 memcpy ((void *) &i0, (void *) &d, 8);
672 i1 = endianflip (i0);
673 memcpy ((void *) c, (void *) &i1, 8);
675 if ((c[0] == 0x2f) && (c[1] == 0x25)
676 && (c[2] == 0xc0) && (c[3] == 0xc7)
677 && (c[4] == 0x43) && (c[5] == 0x2b)
678 && (c[6] == 0x1f) && (c[7] == 0x5b))
679 return (0);
680 else
681 return (1);
682 ]]]]),
683 [fp_layout_need_endianflip="yes"],
684 [fp_layout_need_endianflip="no"]
685 )
686 )
687 if test "x$fp_layout_need_endianflip" = "xyes"; then
688 fp_layout_type="endianflip"
689 fi
690 fi
691 if test "x$fp_layout_type" = "xunknown"; then
692 AC_CACHE_CHECK([if intswap converts to x86 representation],
693 [fp_layout_need_intswap],
694 AC_RUN_IFELSE(
695 AC_LANG_PROGRAM(
696 [[[[
697 #include <stdlib.h>
698 #include <stdio.h>
699 #include <stdint.h>
700 #include <string.h>
701 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
702 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
703 ]]]],
704 [[[[
705 uint64_t i0;
706 uint64_t i1;
707 uint8_t c[8];
708 double d;
710 d = 8.642135e130;
711 memcpy ((void *) &i0, (void *) &d, 8);
713 i1 = intswap (i0);
714 memcpy ((void *) c, (void *) &i1, 8);
716 if ((c[0] == 0x2f) && (c[1] == 0x25)
717 && (c[2] == 0xc0) && (c[3] == 0xc7)
718 && (c[4] == 0x43) && (c[5] == 0x2b)
719 && (c[6] == 0x1f) && (c[7] == 0x5b))
720 return (0);
721 else
722 return (1);
723 ]]]]),
724 [fp_layout_need_intswap="yes"],
725 [fp_layout_need_intswap="no"]
726 )
727 )
728 if test "x$fp_layout_need_intswap" = "xyes"; then
729 fp_layout_type="intswap"
730 fi
731 fi
733 if test "x$fp_layout_type" = "xnothing"; then
734 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
735 [Define if doubles are stored in x86 representation.])
736 else if test "x$fp_layout_type" = "xendianflip"; then
737 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
738 [Define if endianflip is needed to convert to x86 representation.])
739 else if test "x$fp_layout_type" = "xintswap"; then
740 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
741 [Define if intswap is needed to convert to x86 representation.])
742 else
743 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
744 fi; fi; fi
746 have_getfsstat="no"
747 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
748 have_getvfsstat="no"
749 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
750 have_listmntent="no"
751 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
753 have_getmntent="no"
754 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
755 if test "x$have_getmntent" = "xno"; then
756 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
757 fi
758 if test "x$have_getmntent" = "xno"; then
759 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
760 fi
761 if test "x$have_getmntent" = "xno"; then
762 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
763 fi
765 if test "x$have_getmntent" = "xc"; then
766 AC_CACHE_CHECK([whether getmntent takes one argument],
767 [have_one_getmntent],
768 AC_COMPILE_IFELSE(
769 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
770 #include <mntent.h>
771 #include "$srcdir/src/utils_mount.h"]],
772 [[
773 FILE *fh;
774 struct mntent *me;
775 fh = setmntent ("/etc/mtab", "r");
776 me = getmntent (fh);
777 ]]
778 ),
779 [have_one_getmntent="yes"],
780 [have_one_getmntent="no"]
781 )
782 )
783 AC_CACHE_CHECK([whether getmntent takes two arguments],
784 [have_two_getmntent],
785 AC_COMPILE_IFELSE(
786 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
787 #include <sys/mnttab.h>
788 #include "$srcdir/src/utils_mount.h"]],
789 [[
790 FILE *fh;
791 struct mnttab mt;
792 int status;
793 fh = fopen ("/etc/mnttab", "r");
794 status = getmntent (fh, &mt);
795 ]]
796 ),
797 [have_two_getmntent="yes"],
798 [have_two_getmntent="no"]
799 )
800 )
801 fi
803 # Check for different versions of `getmntent' here..
805 if test "x$have_getmntent" = "xc"; then
806 if test "x$have_one_getmntent" = "xyes"; then
807 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
808 [Define if the function getmntent exists and takes one argument.])
809 fi
810 if test "x$have_two_getmntent" = "xyes"; then
811 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
812 [Define if the function getmntent exists and takes two arguments.])
813 fi
814 fi
815 if test "x$have_getmntent" = "xsun"; then
816 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
817 [Define if the function getmntent exists. It's the version from libsun.])
818 fi
819 if test "x$have_getmntent" = "xseq"; then
820 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
821 [Define if the function getmntent exists. It's the version from libseq.])
822 fi
823 if test "x$have_getmntent" = "xgen"; then
824 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
825 [Define if the function getmntent exists. It's the version from libgen.])
826 fi
828 # Check for structures
829 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
830 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
831 [],
832 [
833 #include <sys/types.h>
834 #include <sys/socket.h>
835 #include <net/if.h>
836 ])
837 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
838 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
839 [],
840 [
841 #include <sys/types.h>
842 #include <sys/socket.h>
843 #include <linux/if.h>
844 #include <linux/netdevice.h>
845 ])
847 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
848 [#if HAVE_STDINT_H
849 # include <stdint.h>
850 #endif
851 #if HAVE_SYS_TYPES_H
852 # include <sys/types.h>
853 #endif
854 #if HAVE_NETINET_IN_SYSTM_H
855 # include <netinet/in_systm.h>
856 #endif
857 #if HAVE_NETINET_IN_H
858 # include <netinet/in.h>
859 #endif
860 #if HAVE_NETINET_IP_H
861 # include <netinet/ip.h>
862 #endif
863 #if HAVE_NETINET_UDP_H
864 # include <netinet/udp.h>
865 #endif
866 ])
867 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
868 [#if HAVE_STDINT_H
869 # include <stdint.h>
870 #endif
871 #if HAVE_SYS_TYPES_H
872 # include <sys/types.h>
873 #endif
874 #if HAVE_NETINET_IN_SYSTM_H
875 # include <netinet/in_systm.h>
876 #endif
877 #if HAVE_NETINET_IN_H
878 # include <netinet/in.h>
879 #endif
880 #if HAVE_NETINET_IP_H
881 # include <netinet/ip.h>
882 #endif
883 #if HAVE_NETINET_UDP_H
884 # include <netinet/udp.h>
885 #endif
886 ])
888 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
889 [],
890 [],
891 [
892 #if HAVE_KSTAT_H
893 # include <kstat.h>
894 #endif
895 ])
897 #
898 # Checks for libraries begin here
899 #
900 with_libresolv="yes"
901 AC_CHECK_LIB(resolv, res_search,
902 [
903 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
904 ],
905 [with_libresolv="no"])
906 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
908 dnl Check for HAL (hardware abstraction library)
909 with_libhal="yes"
910 AC_CHECK_LIB(hal,libhal_device_property_exists,
911 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
912 [with_libhal="no"])
913 if test "x$with_libhal" = "xyes"; then
914 if test "x$PKG_CONFIG" != "x"; then
915 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
916 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
917 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
918 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
919 fi
920 fi
922 m4_divert_once([HELP_WITH], [
923 collectd additional packages:])
925 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
926 librrd_cflags=""
927 librrd_ldflags=""
928 librrd_threadsafe="yes"
929 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
930 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
931 then
932 librrd_cflags="-I$withval/include"
933 librrd_ldflags="-L$withval/lib"
934 with_rrdtool="yes"
935 else
936 with_rrdtool="$withval"
937 fi
938 ], [with_rrdtool="yes"])
939 if test "x$with_rrdtool" = "xyes"
940 then
941 SAVE_CPPFLAGS="$CPPFLAGS"
942 SAVE_LDFLAGS="$LDFLAGS"
944 CPPFLAGS="$CPPFLAGS $librrd_cflags"
945 LDFLAGS="$LDFLAGS $librrd_ldflags"
947 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
949 CPPFLAGS="$SAVE_CPPFLAGS"
950 LDFLAGS="$SAVE_LDFLAGS"
951 fi
952 if test "x$with_rrdtool" = "xyes"
953 then
954 SAVE_CPPFLAGS="$CPPFLAGS"
955 SAVE_LDFLAGS="$LDFLAGS"
957 CPPFLAGS="$CPPFLAGS $librrd_cflags"
958 LDFLAGS="$LDFLAGS $librrd_ldflags"
960 AC_CHECK_LIB(rrd_th, rrd_update_r,
961 [with_rrdtool="yes"
962 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
963 ],
964 [librrd_threadsafe="no"
965 AC_CHECK_LIB(rrd, rrd_update,
966 [with_rrdtool="yes"
967 librrd_ldflags="$librrd_ldflags -lrrd -lm"
968 ],
969 [with_rrdtool="no (symbol 'rrd_update' not found)"],
970 [-lm])
971 ],
972 [-lm])
974 CPPFLAGS="$SAVE_CPPFLAGS"
975 LDFLAGS="$SAVE_LDFLAGS"
976 fi
977 if test "x$with_rrdtool" = "xyes"
978 then
979 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
980 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
981 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
982 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
983 fi
984 if test "x$librrd_threadsafe" = "xyes"
985 then
986 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
987 fi
989 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
990 [ if test "x$withval" != "xno" \
991 && test "x$withval" != "xyes"
992 then
993 LDFLAGS="$LDFLAGS -L$withval/lib"
994 CPPFLAGS="$CPPFLAGS -I$withval/include"
995 with_libpthread="yes"
996 else
997 if test "x$withval" = "xno"
998 then
999 with_libpthread="no (disabled)"
1000 fi
1001 fi
1002 ], [with_libpthread="yes"])
1003 if test "x$with_libpthread" = "xyes"
1004 then
1005 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1006 fi
1007 if test "x$with_libpthread" = "xyes"
1008 then
1009 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1010 fi
1011 if test "x$with_libpthread" = "xyes"
1012 then
1013 collect_pthread=1
1014 else
1015 collect_pthread=0
1016 fi
1017 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1018 [Wether or not to use pthread (POSIX threads) library])
1019 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1021 if test "x$ac_system" = "xSolaris"
1022 then
1023 with_kstat="yes"
1024 with_devinfo="yes"
1025 else
1026 with_kstat="no (Solaris only)"
1027 with_devinfo="no (Solaris only)"
1028 fi
1030 if test "x$with_kstat" = "xyes"
1031 then
1032 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1033 fi
1034 if test "x$with_kstat" = "xyes"
1035 then
1036 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1037 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1038 fi
1039 if test "x$with_kstat" = "xyes"
1040 then
1041 AC_DEFINE(HAVE_LIBKSTAT, 1,
1042 [Define to 1 if you have the 'kstat' library (-lkstat)])
1043 fi
1044 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1045 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1047 ### BEGIN of check for libcurl ###
1048 with_curl_config="curl-config"
1049 with_curl_cflags=""
1050 with_curl_libs=""
1051 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1052 [
1053 if test "x$withval" = "xno"
1054 then
1055 with_libcurl="no"
1056 else if test "x$withval" = "xyes"
1057 then
1058 with_libcurl="yes"
1059 else
1060 if test -f "$withval" && test -x "$withval"
1061 then
1062 with_curl_config="$withval"
1063 with_libcurl="yes"
1064 else if test -x "$withval/bin/curl-config"
1065 then
1066 with_curl_config="$withval/bin/curl-config"
1067 with_libcurl="yes"
1068 fi; fi
1069 with_libcurl="yes"
1070 fi; fi
1071 ],
1072 [
1073 with_libcurl="yes"
1074 ])
1075 if test "x$with_libcurl" = "xyes"
1076 then
1077 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1078 curl_config_status=$?
1080 if test $curl_config_status -ne 0
1081 then
1082 with_libcurl="no ($with_curl_config failed)"
1083 else
1084 SAVE_CPPFLAGS="$CPPFLAGS"
1085 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1087 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1089 CPPFLAGS="$SAVE_CPPFLAGS"
1090 fi
1091 fi
1092 if test "x$with_libcurl" = "xyes"
1093 then
1094 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1095 curl_config_status=$?
1097 if test $curl_config_status -ne 0
1098 then
1099 with_libcurl="no ($with_curl_config failed)"
1100 else
1101 AC_CHECK_LIB(curl, curl_easy_init,
1102 [with_libcurl="yes"],
1103 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1104 [$with_curl_libs])
1105 fi
1106 fi
1107 if test "x$with_libcurl" = "xyes"
1108 then
1109 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1110 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1111 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1112 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1113 fi
1114 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1115 ### END of check for libcurl ###
1117 with_libiokit="no"
1118 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1119 [
1120 with_libiokit="yes"
1121 ],
1122 [
1123 with_libiokit="no"
1124 ])
1125 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1127 with_libstatgrab_cflags=""
1128 with_libstatgrab_ldflags=""
1129 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1130 [
1131 if test "x$withval" != "xno" \
1132 && test "x$withval" != "xyes"
1133 then
1134 with_libstatgrab_cflags="-I$withval/include"
1135 with_libstatgrab_ldflags="-L$withval/lib"
1136 with_libstatgrab="yes"
1137 else
1138 with_libstatgrab="$withval"
1139 fi
1140 ],
1141 [
1142 if test "x$ac_system" = "xunknown"
1143 then
1144 with_libstatgrab="yes"
1145 else
1146 with_libstatgrab="no"
1147 fi
1148 ])
1149 with_libstatgrab_pkg_config="yes"
1150 if test "x$with_libstatgrab" = "xyes" \
1151 && test "x$PKG_CONFIG" != "x"
1152 then
1153 AC_MSG_CHECKING([pkg-config for libstatgrab])
1154 temp_result="found"
1155 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1156 if test "$?" != "0"
1157 then
1158 with_libstatgrab_pkg_config="no"
1159 temp_result="not found"
1160 fi
1161 AC_MSG_RESULT([$temp_result])
1162 else
1163 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1164 with_libstatgrab_pkg_config="no"
1165 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1166 fi
1168 if test "x$with_libstatgrab" = "xyes" \
1169 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1170 && test "x$with_libstatgrab_cflags" = "x"
1171 then
1172 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1173 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1174 if test "$?" = "0"
1175 then
1176 with_libstatgrab_cflags="$temp_result"
1177 else
1178 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1179 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1180 fi
1181 AC_MSG_RESULT([$temp_result])
1182 fi
1184 if test "x$with_libstatgrab" = "xyes" \
1185 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1186 && test "x$with_libstatgrab_ldflags" = "x"
1187 then
1188 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1189 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1190 if test "$?" = "0"
1191 then
1192 with_libstatgrab_ldflags="$temp_result"
1193 else
1194 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1195 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1196 fi
1197 AC_MSG_RESULT([$temp_result])
1198 fi
1200 if test "x$with_libstatgrab" = "xyes"
1201 then
1202 SAVE_CPPFLAGS="$CPPFLAGS"
1203 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1205 AC_CHECK_HEADERS(statgrab.h,
1206 [with_libstatgrab="yes"],
1207 [with_libstatgrab="no (statgrab.h not found)"])
1209 CPPFLAGS="$SAVE_CPPFLAGS"
1210 fi
1212 if test "x$with_libstatgrab" = "xyes"
1213 then
1214 SAVE_CFLAGS="$CFLAGS"
1215 SAVE_LDFLAGS="$LDFLAGS"
1217 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1218 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1220 AC_CHECK_LIB(statgrab, sg_init,
1221 [with_libstatgrab="yes"],
1222 [with_libstatgrab="no (symbol sg_init not found)"])
1224 CFLAGS="$SAVE_CFLAGS"
1225 LDFLAGS="$SAVE_LDFLAGS"
1226 fi
1228 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1229 if test "x$with_libstatgrab" = "xyes"
1230 then
1231 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1232 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1233 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1234 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1235 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1236 fi
1238 with_libkvm="no"
1239 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1240 if test "x$with_kvm_getprocs" = "xyes"
1241 then
1242 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1243 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1244 with_libkvm="yes"
1245 fi
1246 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1248 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1249 if test "x$with_kvm_getswapinfo" = "xyes"
1250 then
1251 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1252 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1253 with_libkvm="yes"
1254 fi
1255 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1257 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1258 if test "x$with_kvm_nlist" = "xyes"
1259 then
1260 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1261 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1262 with_libkvm="yes"
1263 fi
1264 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1266 with_sensors_cflags=""
1267 with_sensors_ldflags=""
1268 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1269 [
1270 if test "x$withval" = "xno"
1271 then
1272 with_lm_sensors="no"
1273 else
1274 with_lm_sensors="yes"
1275 if test "x$withval" != "xyes"
1276 then
1277 with_sensors_cflags="-I$withval/include"
1278 with_sensors_ldflags="-L$withval/lib"
1279 with_lm_sensors="yes"
1280 fi
1281 fi
1282 ],
1283 [
1284 if test "x$ac_system" = "xLinux"
1285 then
1286 with_lm_sensors="yes"
1287 else
1288 with_lm_sensors="no (Linux only library)"
1289 fi
1290 ])
1291 if test "x$with_lm_sensors" = "xyes"
1292 then
1293 SAVE_CPPFLAGS="$CPPFLAGS"
1294 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1296 # AC_CHECK_HEADERS(sensors/sensors.h,
1297 # [
1298 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1299 # ],
1300 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1301 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1303 CPPFLAGS="$SAVE_CPPFLAGS"
1304 fi
1305 if test "x$with_lm_sensors" = "xyes"
1306 then
1307 SAVE_CPPFLAGS="$CPPFLAGS"
1308 SAVE_LDFLAGS="$LDFLAGS"
1309 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1310 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1312 AC_CHECK_LIB(sensors, sensors_init,
1313 [
1314 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1315 ],
1316 [with_lm_sensors="no (libsensors not found)"])
1318 CPPFLAGS="$SAVE_CPPFLAGS"
1319 LDFLAGS="$SAVE_LDFLAGS"
1320 fi
1321 if test "x$with_lm_sensors" = "xyes"
1322 then
1323 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1324 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1325 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1326 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1327 fi
1328 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1330 with_mysql_config="mysql_config"
1331 with_mysql_cflags=""
1332 with_mysql_libs=""
1333 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1334 [
1335 if test "x$withval" = "xno"
1336 then
1337 with_libmysql="no"
1338 else if test "x$withval" = "xyes"
1339 then
1340 with_libmysql="yes"
1341 else
1342 if test -f "$withval" && test -x "$withval";
1343 then
1344 with_mysql_config="$withval"
1345 else if test -x "$withval/bin/mysql_config"
1346 then
1347 with_mysql_config="$withval/bin/mysql_config"
1348 fi; fi
1349 with_libmysql="yes"
1350 fi; fi
1351 ],
1352 [
1353 with_libmysql="yes"
1354 ])
1355 if test "x$with_libmysql" = "xyes"
1356 then
1357 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1358 mysql_config_status=$?
1360 if test $mysql_config_status -ne 0
1361 then
1362 with_libmysql="no ($with_mysql_config failed)"
1363 else
1364 SAVE_CPPFLAGS="$CPPFLAGS"
1365 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1367 have_mysql_h="no"
1368 have_mysql_mysql_h="no"
1369 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1371 if test "x$have_mysql_h" = "xno"
1372 then
1373 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1374 fi
1376 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1377 then
1378 with_libmysql="no (mysql.h not found)"
1379 fi
1381 CPPFLAGS="$SAVE_CPPFLAGS"
1382 fi
1383 fi
1384 if test "x$with_libmysql" = "xyes"
1385 then
1386 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1387 mysql_config_status=$?
1389 if test $mysql_config_status -ne 0
1390 then
1391 with_libmysql="no ($with_mysql_config failed)"
1392 else
1393 AC_CHECK_LIB(mysqlclient, mysql_init,
1394 [with_libmysql="yes"],
1395 [with_libmysql="no (symbol 'mysql_init' not found)"],
1396 [$with_mysql_libs])
1397 fi
1398 fi
1399 if test "x$with_libmysql" = "xyes"
1400 then
1401 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1402 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1403 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1404 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1405 fi
1406 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1408 with_own_liboconfig="no"
1409 liboconfig_LDFLAGS="$LDFLAGS"
1410 liboconfig_CPPFLAGS="$CPPFLAGS"
1411 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1412 [
1413 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1414 then
1415 if test -d "$withval/lib"
1416 then
1417 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1418 fi
1419 if test -d "$withval/include"
1420 then
1421 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1422 fi
1423 fi
1424 if test "x$withval" = "xno"
1425 then
1426 AC_MSG_ERROR("liboconfig is required")
1427 fi
1428 ],
1429 [
1430 with_liboconfig="yes"
1431 ])
1433 save_LDFLAGS="$LDFLAGS"
1434 save_CPPFLAGS="$CPPFLAGS"
1435 LDFLAGS="$liboconfig_LDFLAGS"
1436 CPPFLAGS="$liboconfig_CPPFLAGS"
1437 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1438 [
1439 with_liboconfig="yes"
1440 with_own_liboconfig="no"
1441 ],
1442 [
1443 with_liboconfig="yes"
1444 with_own_liboconfig="yes"
1445 LDFLAGS="$save_LDFLAGS"
1446 CPPFLAGS="$save_CPPFLAGS"
1447 ])
1449 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1450 if test "x$with_own_liboconfig" = "xyes"
1451 then
1452 with_liboconfig="yes (shipped version)"
1453 fi
1455 #with_liboping="yes"
1456 with_own_liboping="no"
1457 liboping_LDFLAGS="$LDFLAGS"
1458 liboping_CPPFLAGS="$CPPFLAGS"
1459 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1460 [
1461 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1462 then
1463 if test -d "$withval/lib"
1464 then
1465 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1466 fi
1467 if test -d "$withval/include"
1468 then
1469 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1470 fi
1471 fi
1472 if test "x$withval" = "xno"
1473 then
1474 with_liboping="no"
1475 with_own_liboping="no"
1476 else if test "x$withval" = "xyes"
1477 then
1478 with_liboping="yes"
1479 fi; fi
1480 ],
1481 [
1482 with_liboping="yes"
1483 ])
1485 if test "x$with_liboping" = "xyes"
1486 then
1487 save_LDFLAGS="$LDFLAGS"
1488 save_CPPFLAGS="$CPPFLAGS"
1489 LDFLAGS="$liboping_LDFLAGS"
1490 CPPFLAGS="$liboping_CPPFLAGS"
1491 AC_CHECK_LIB(oping, ping_construct,
1492 [
1493 with_liboping="yes"
1494 with_own_liboping="no"
1495 ],
1496 [
1497 with_liboping="yes"
1498 with_own_liboping="yes"
1499 LDFLAGS="$save_LDFLAGS"
1500 CPPFLAGS="$save_CPPFLAGS"
1501 ])
1502 fi
1503 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1504 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1506 with_libowcapi_cppflags=""
1507 with_libowcapi_libs="-lowcapi"
1508 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1509 [
1510 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1511 then
1512 with_libowcapi_cppflags="-I$withval/include"
1513 with_libowcapi_libs="-L$withval/lib -lowcapi"
1514 with_libowcapi="yes"
1515 else
1516 with_libowcapi="$withval"
1517 fi
1518 ],
1519 [
1520 with_libowcapi="yes"
1521 ])
1522 if test "x$with_libowcapi" = "xyes"
1523 then
1524 SAVE_CPPFLAGS="$CPPFLAGS"
1525 CPPFLAGS="$with_libowcapi_cppflags"
1527 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1529 CPPFLAGS="$SAVE_CPPFLAGS"
1530 fi
1531 if test "x$with_libowcapi" = "xyes"
1532 then
1533 SAVE_LDFLAGS="$LDFLAGS"
1534 SAVE_CPPFLAGS="$CPPFLAGS"
1535 LDFLAGS="$with_libowcapi_libs"
1536 CPPFLAGS="$with_libowcapi_cppflags"
1538 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1540 LDFLAGS="$SAVE_LDFLAGS"
1541 CPPFLAGS="$SAVE_CPPFLAGS"
1542 fi
1543 if test "x$with_libowcapi" = "xyes"
1544 then
1545 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1546 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1547 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1548 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1549 fi
1552 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1553 [
1554 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1555 then
1556 LDFLAGS="$LDFLAGS -L$withval/lib"
1557 CPPFLAGS="$CPPFLAGS -I$withval/include"
1558 with_libpcap="yes"
1559 else
1560 with_libpcap="$withval"
1561 fi
1562 ],
1563 [
1564 with_libpcap="yes"
1565 ])
1566 if test "x$with_libpcap" = "xyes"
1567 then
1568 AC_CHECK_LIB(pcap, pcap_open_live,
1569 [
1570 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1571 ], [with_libpcap="no (libpcap not found)"])
1572 fi
1573 if test "x$with_libpcap" = "xyes"
1574 then
1575 AC_CHECK_HEADERS(pcap.h,
1576 [
1577 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1578 ], [with_libpcap="no (pcap.h not found)"])
1579 fi
1580 if test "x$with_libpcap" = "xyes"
1581 then
1582 collect_libpcap=1
1583 else
1584 collect_libpcap=0
1585 fi
1586 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1587 [Wether or not to use the pcap library])
1588 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1590 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1591 [
1592 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1593 then
1594 LDFLAGS="$LDFLAGS -L$withval/lib"
1595 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1596 with_libesmtp="yes"
1597 else
1598 with_libesmtp="$withval"
1599 fi
1600 ],
1601 [
1602 with_libesmtp="yes"
1603 ])
1604 if test "x$with_libesmtp" = "xyes"
1605 then
1606 AC_CHECK_LIB(esmtp, smtp_create_session,
1607 [
1608 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1609 ], [with_libesmtp="no (libesmtp not found)"])
1610 fi
1611 if test "x$with_libesmtp" = "xyes"
1612 then
1613 AC_CHECK_HEADERS(libesmtp.h,
1614 [
1615 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1616 ], [with_libesmtp="no (libesmtp.h not found)"])
1617 fi
1618 if test "x$with_libesmtp" = "xyes"
1619 then
1620 collect_libesmtp=1
1621 else
1622 collect_libesmtp=0
1623 fi
1624 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1625 [Wether or not to use the esmtp library])
1626 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1628 perl_interpreter="perl"
1629 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1630 [
1631 if test -x "$withval"
1632 then
1633 perl_interpreter="$withval"
1634 with_libperl="yes"
1635 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1636 then
1637 LDFLAGS="$LDFLAGS -L$withval/lib"
1638 CPPFLAGS="$CPPFLAGS -I$withval/include"
1639 perl_interpreter="$withval/bin/perl"
1640 with_libperl="yes"
1641 else
1642 with_libperl="$withval"
1643 fi; fi
1644 ],
1645 [
1646 with_libperl="yes"
1647 ])
1649 AC_MSG_CHECKING([for perl])
1650 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1651 if test -x "$perl_interpreter"
1652 then
1653 AC_MSG_RESULT([yes ($perl_interpreter)])
1654 else
1655 perl_interpreter=""
1656 AC_MSG_RESULT([no])
1657 fi
1659 AC_SUBST(PERL, "$perl_interpreter")
1661 if test "x$with_libperl" = "xyes" \
1662 && test -n "$perl_interpreter"
1663 then
1664 SAVE_CFLAGS=$CFLAGS
1665 SAVE_LDFLAGS=$LDFLAGS
1666 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1667 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1668 CFLAGS="$CFLAGS $PERL_CFLAGS"
1669 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1671 AC_CACHE_CHECK([for libperl],
1672 [have_libperl],
1673 AC_LINK_IFELSE(
1674 AC_LANG_PROGRAM(
1675 [[
1676 #define PERL_NO_GET_CONTEXT
1677 #include <EXTERN.h>
1678 #include <perl.h>
1679 #include <XSUB.h>
1680 ]],
1681 [[
1682 dTHX;
1683 load_module (PERL_LOADMOD_NOIMPORT,
1684 newSVpv ("Collectd::Plugin::FooBar", 24),
1685 Nullsv);
1686 ]]),
1687 [have_libperl="yes"],
1688 [have_libperl="no"]
1689 )
1690 )
1692 if test "x$have_libperl" = "xyes"
1693 then
1694 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1695 AC_SUBST(PERL_CFLAGS)
1696 AC_SUBST(PERL_LDFLAGS)
1697 else
1698 with_libperl="no"
1699 fi
1701 CFLAGS=$SAVE_CFLAGS
1702 LDFLAGS=$SAVE_LDFLAGS
1703 else if test -z "$perl_interpreter"; then
1704 with_libperl="no (no perl interpreter found)"
1705 have_libperl="no"
1706 fi; fi
1707 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1709 if test "x$with_libperl" = "xyes"
1710 then
1711 SAVE_CFLAGS=$CFLAGS
1712 SAVE_LDFLAGS=$LDFLAGS
1713 CFLAGS="$CFLAGS $PERL_CFLAGS"
1714 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1716 AC_CACHE_CHECK([if perl supports ithreads],
1717 [have_perl_ithreads],
1718 AC_LINK_IFELSE(
1719 AC_LANG_PROGRAM(
1720 [[
1721 #include <EXTERN.h>
1722 #include <perl.h>
1723 #include <XSUB.h>
1725 #if !defined(USE_ITHREADS)
1726 # error "Perl does not support ithreads!"
1727 #endif /* !defined(USE_ITHREADS) */
1728 ]],
1729 [[ ]]),
1730 [have_perl_ithreads="yes"],
1731 [have_perl_ithreads="no"]
1732 )
1733 )
1735 if test "x$have_perl_ithreads" = "xyes"
1736 then
1737 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1738 fi
1740 CFLAGS=$SAVE_CFLAGS
1741 LDFLAGS=$SAVE_LDFLAGS
1742 fi
1744 with_own_libiptc="no"
1745 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1746 [
1747 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1748 then
1749 LDFLAGS="$LDFLAGS -L$withval/lib"
1750 CPPFLAGS="$CPPFLAGS -I$withval/include"
1751 with_libiptc="yes"
1752 else
1753 with_libiptc="$withval"
1754 fi
1755 ],
1756 [
1757 if test "x$ac_system" = "xLinux"
1758 then
1759 with_libiptc="yes"
1760 else
1761 with_libiptc="no (Linux only)"
1762 fi
1763 ])
1764 if test "x$with_libiptc" = "xyes"
1765 then
1766 AC_CHECK_LIB(iptc, iptc_init,
1767 [
1768 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1769 ],
1770 [
1771 with_libiptc="yes"
1772 with_own_libiptc="yes"
1773 ])
1774 fi
1775 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1776 then
1777 AC_CHECK_HEADERS(libiptc/libiptc.h,
1778 [
1779 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1780 ],
1781 [
1782 with_libiptc="yes"
1783 with_own_libiptc="yes"
1784 ])
1785 fi
1786 if test "x$with_libiptc" = "xyes"
1787 then
1788 SAVE_CFLAGS=$CFLAGS
1789 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1791 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1792 [
1793 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1794 with_own_libiptc="no"
1795 ],
1796 [
1797 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1798 ])
1800 CFLAGS=$SAVE_CFLAGS
1801 fi
1802 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1803 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1804 if test "x$with_own_libiptc" = "xyes"
1805 then
1806 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1807 fi
1809 with_snmp_config="net-snmp-config"
1810 with_snmp_cflags=""
1811 with_snmp_libs=""
1812 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1813 [
1814 if test "x$withval" = "xno"
1815 then
1816 with_libnetsnmp="no"
1817 else if test "x$withval" = "xyes"
1818 then
1819 with_libnetsnmp="yes"
1820 else
1821 if test -x "$withval"
1822 then
1823 with_snmp_config="$withval"
1824 with_libnetsnmp="yes"
1825 else
1826 with_snmp_config="$withval/bin/net-snmp-config"
1827 with_libnetsnmp="yes"
1828 fi
1829 fi; fi
1830 ],
1831 [with_libnetsnmp="yes"])
1832 if test "x$with_libnetsnmp" = "xyes"
1833 then
1834 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1835 snmp_config_status=$?
1837 if test $snmp_config_status -ne 0
1838 then
1839 with_libnetsnmp="no ($with_snmp_config failed)"
1840 else
1841 SAVE_CPPFLAGS="$CPPFLAGS"
1842 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1844 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1846 CPPFLAGS="$SAVE_CPPFLAGS"
1847 fi
1848 fi
1849 if test "x$with_libnetsnmp" = "xyes"
1850 then
1851 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1852 snmp_config_status=$?
1854 if test $snmp_config_status -ne 0
1855 then
1856 with_libnetsnmp="no ($with_snmp_config failed)"
1857 else
1858 AC_CHECK_LIB(netsnmp, init_snmp,
1859 [with_libnetsnmp="yes"],
1860 [with_libnetsnmp="no (libnetsnmp not found)"],
1861 [$with_snmp_libs])
1862 fi
1863 fi
1864 if test "x$with_libnetsnmp" = "xyes"
1865 then
1866 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1867 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1868 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1869 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1870 fi
1871 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1873 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
1874 [with_libnotify="yes"],
1875 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
1877 with_libupsclient="no (pkg-config isn't available)"
1878 with_libupsclient_cflags=""
1879 with_libupsclient_libs=""
1880 if test "x$PKG_CONFIG" != "x"
1881 then
1882 pkg-config --exists 'libupsclient' 2>/dev/null
1883 if test "$?" = "0"
1884 then
1885 with_libupsclient="yes"
1886 else
1887 with_libupsclient="no (pkg-config doesn't know library)"
1888 fi
1889 fi
1890 if test "x$with_libupsclient" = "xyes"
1891 then
1892 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
1893 if test $? -ne 0
1894 then
1895 with_libupsclient="no"
1896 fi
1897 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
1898 if test $? -ne 0
1899 then
1900 with_libupsclient="no"
1901 fi
1902 fi
1903 if test "x$with_libupsclient" = "xyes"
1904 then
1905 SAVE_CPPFLAGS="$CPPFLAGS"
1906 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1908 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1910 CPPFLAGS="$SAVE_CPPFLAGS"
1911 fi
1912 if test "x$with_libupsclient" = "xyes"
1913 then
1914 SAVE_CPPFLAGS="$CPPFLAGS"
1915 SAVE_LDFLAGS="$LDFLAGS"
1917 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1918 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
1920 AC_CHECK_LIB(upsclient, upscli_connect,
1921 [with_libupsclient="yes"],
1922 [with_libupsclient="no (symbol upscli_connect not found)"])
1924 CPPFLAGS="$SAVE_CPPFLAGS"
1925 LDFLAGS="$SAVE_LDFLAGS"
1926 fi
1927 if test "x$with_libupsclient" = "xyes"
1928 then
1929 SAVE_CPPFLAGS="$CPPFLAGS"
1930 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1932 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1933 [#include <stdlib.h>
1934 #include <stdio.h>
1935 #include <upsclient.h>])
1937 CPPFLAGS="$SAVE_CPPFLAGS"
1938 fi
1939 if test "x$with_libupsclient" = "xyes"
1940 then
1941 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
1942 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
1943 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1944 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1945 fi
1947 ### BEGIN of check for libxmms ###
1948 with_xmms_config="xmms-config"
1949 with_xmms_cflags=""
1950 with_xmms_libs=""
1951 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1952 [
1953 if test "x$withval" != "xno" \
1954 && test "x$withval" != "xyes"
1955 then
1956 if test -f "$withval" && test -x "$withval";
1957 then
1958 with_xmms_config="$withval"
1959 else if test -x "$withval/bin/xmms-config"
1960 then
1961 with_xmms_config="$withval/bin/xmms-config"
1962 fi; fi
1963 with_libxmms="yes"
1964 else if test "x$withval" = "xno"
1965 then
1966 with_libxmms="no"
1967 else
1968 with_libxmms="yes"
1969 fi; fi
1970 ],
1971 [
1972 with_libxmms="yes"
1973 ])
1974 if test "x$with_libxmms" = "xyes"
1975 then
1976 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1977 xmms_config_status=$?
1979 if test $xmms_config_status -ne 0
1980 then
1981 with_libxmms="no"
1982 fi
1983 fi
1984 if test "x$with_libxmms" = "xyes"
1985 then
1986 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1987 xmms_config_status=$?
1989 if test $xmms_config_status -ne 0
1990 then
1991 with_libxmms="no"
1992 fi
1993 fi
1994 if test "x$with_libxmms" = "xyes"
1995 then
1996 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1997 [
1998 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1999 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2000 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2001 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2002 ],
2003 [
2004 with_libxmms="no"
2005 ],
2006 [$with_xmms_libs])
2007 fi
2008 with_libxmms_numeric=0
2009 if test "x$with_libxmms" = "xyes"
2010 then
2011 with_libxmms_numeric=1
2012 fi
2013 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2014 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2015 ### END of check for libxmms ###
2017 with_libnetlink_cflags=""
2018 with_libnetlink_libs="-lnetlink"
2019 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2020 [
2021 echo "libnetlink: withval = $withval"
2022 if test "x$withval" = "xyes"
2023 then
2024 with_libnetlink="yes"
2025 else if test "x$withval" = "xno"
2026 then
2027 with_libnetlink="no"
2028 else
2029 if test -d "$withval/include"
2030 then
2031 with_libnetlink_cflags="-I$withval/include"
2032 with_libnetlink_libs="-L$withval/lib -lnetlink"
2033 with_libnetlink="yes"
2034 else
2035 AC_MSG_ERROR("no such directory: $withval/include")
2036 fi
2037 fi; fi
2038 ],
2039 [
2040 if test "x$ac_system" = "xLinux"
2041 then
2042 with_libnetlink="yes"
2043 else
2044 with_libnetlink="no (Linux only library)"
2045 fi
2046 ])
2047 if test "x$with_libnetlink" = "xyes"
2048 then
2049 SAVE_CFLAGS=$CFLAGS
2050 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2052 with_libnetlink="no (libnetlink.h not found)"
2054 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2055 [
2056 with_libnetlink="yes"
2057 break
2058 ], [],
2059 [#include <stdio.h>
2060 #include <sys/types.h>
2061 #include <asm/types.h>
2062 #include <sys/socket.h>
2063 #include <linux/netlink.h>
2064 #include <linux/rtnetlink.h>])
2065 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2066 [#include <stdio.h>
2067 #include <sys/types.h>
2068 #include <asm/types.h>
2069 #include <sys/socket.h>])
2071 AC_COMPILE_IFELSE(
2072 [#include <stdio.h>
2073 #include <sys/types.h>
2074 #include <asm/types.h>
2075 #include <sys/socket.h>
2076 #include <linux/netlink.h>
2077 #include <linux/rtnetlink.h>
2079 int main (void)
2080 {
2081 int retval = TCA_STATS2;
2082 return (retval);
2083 }],
2084 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2085 []);
2087 AC_COMPILE_IFELSE(
2088 [#include <stdio.h>
2089 #include <sys/types.h>
2090 #include <asm/types.h>
2091 #include <sys/socket.h>
2092 #include <linux/netlink.h>
2093 #include <linux/rtnetlink.h>
2095 int main (void)
2096 {
2097 int retval = TCA_STATS;
2098 return (retval);
2099 }],
2100 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2101 []);
2103 CFLAGS="$SAVE_CFLAGS"
2104 fi
2105 if test "x$with_libnetlink" = "xyes"
2106 then
2107 AC_CHECK_LIB(netlink, rtnl_open,
2108 [with_libnetlink="yes"],
2109 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2110 [$with_libnetlink_libs])
2111 fi
2112 if test "x$with_libnetlink" = "xyes"
2113 then
2114 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2115 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2116 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2117 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2118 fi
2119 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2121 with_libopenipmipthread="yes"
2122 with_libopenipmipthread_cflags=""
2123 with_libopenipmipthread_libs=""
2125 AC_MSG_CHECKING([for pkg-config])
2126 temp_result="no"
2127 if test "x$PKG_CONFIG" = "x"
2128 then
2129 with_libopenipmipthread="no"
2130 temp_result="no"
2131 else
2132 temp_result="$PKG_CONFIG"
2133 fi
2134 AC_MSG_RESULT([$temp_result])
2136 if test "x$with_libopenipmipthread" = "xyes"
2137 then
2138 AC_MSG_CHECKING([for libOpenIPMIpthread])
2139 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2140 if test "$?" != "0"
2141 then
2142 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2143 fi
2144 AC_MSG_RESULT([$with_libopenipmipthread])
2145 fi
2147 if test "x$with_libopenipmipthread" = "xyes"
2148 then
2149 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2150 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2151 if test "$?" = "0"
2152 then
2153 with_libopenipmipthread_cflags="$temp_result"
2154 else
2155 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2156 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2157 fi
2158 AC_MSG_RESULT([$temp_result])
2159 fi
2161 if test "x$with_libopenipmipthread" = "xyes"
2162 then
2163 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2164 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2165 if test "$?" = "0"
2166 then
2167 with_libopenipmipthread_ldflags="$temp_result"
2168 else
2169 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2170 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2171 fi
2172 AC_MSG_RESULT([$temp_result])
2173 fi
2175 if test "x$with_libopenipmipthread" = "xyes"
2176 then
2177 SAVE_CPPFLAGS="$CPPFLAGS"
2178 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2180 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2181 [with_libopenipmipthread="yes"],
2182 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2183 [#include <OpenIPMI/ipmiif.h>
2184 #include <OpenIPMI/ipmi_err.h>
2185 #include <OpenIPMI/ipmi_posix.h>
2186 #include <OpenIPMI/ipmi_conn.h>
2187 ])
2189 CPPFLAGS="$SAVE_CPPFLAGS"
2190 fi
2192 if test "x$with_libopenipmipthread" = "xyes"
2193 then
2194 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2195 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2196 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2197 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2198 fi
2200 dnl Check for libpq.
2201 with_pg_config="pg_config"
2202 with_libpq_includedir=""
2203 with_libpq_libdir=""
2204 with_libpq_cppflags=""
2205 with_libpq_ldflags=""
2206 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2207 [Path to libpq.])],
2208 [
2209 if test "x$withval" = "xno"
2210 then
2211 with_libpq="no"
2212 else if test "x$withval" = "xyes"
2213 then
2214 with_libpq="yes"
2215 else
2216 if test -f "$withval" && test -x "$withval";
2217 then
2218 with_pg_config="$withval"
2219 else if test -x "$withval/bin/pg_config"
2220 then
2221 with_pg_config="$withval/bin/pg_config"
2222 fi; fi
2223 with_libpq="yes"
2224 fi; fi
2225 ],
2226 [
2227 with_libpq="yes"
2228 ])
2229 if test "x$with_libpq" = "xyes"
2230 then
2231 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2232 pg_config_status=$?
2234 if test $pg_config_status -eq 0
2235 then
2236 if test -n "$with_libpq_includedir"; then
2237 for dir in $with_libpq_includedir; do
2238 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2239 done
2240 fi
2241 else
2242 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2243 fi
2245 SAVE_CPPFLAGS="$CPPFLAGS"
2246 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2248 AC_CHECK_HEADERS(libpq-fe.h, [],
2249 [with_libpq="no (libpq-fe.h not found)"], [])
2251 CPPFLAGS="$SAVE_CPPFLAGS"
2252 fi
2253 if test "x$with_libpq" = "xyes"
2254 then
2255 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2256 pg_config_status=$?
2258 if test $pg_config_status -eq 0
2259 then
2260 if test -n "$with_libpq_libdir"; then
2261 for dir in $with_libpq_libdir; do
2262 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2263 done
2264 fi
2265 else
2266 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2267 fi
2269 SAVE_LDFLAGS="$LDFLAGS"
2270 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2272 AC_CHECK_LIB(pq, PQconnectdb,
2273 [with_libpq="yes"],
2274 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2276 LDFLAGS="$SAVE_LDFLAGS"
2277 fi
2278 if test "x$with_libpq" = "xyes"
2279 then
2280 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2281 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2282 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2283 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2284 fi
2285 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2287 dnl Check for libvirt and libxml2 libraries.
2288 with_libxml2="no (pkg-config isn't available)"
2289 with_libxml2_cflags=""
2290 with_libxml2_ldflags=""
2291 with_libvirt="no (pkg-config isn't available)"
2292 with_libvirt_cflags=""
2293 with_libvirt_ldflags=""
2294 if test "x$PKG_CONFIG" != "x"
2295 then
2296 pkg-config --exists 'libxml-2.0' 2>/dev/null
2297 if test "$?" = "0"
2298 then
2299 with_libxml2="yes"
2300 else
2301 with_libxml2="no (pkg-config doesn't know library)"
2302 fi
2304 pkg-config --exists libvirt 2>/dev/null
2305 if test "$?" = "0"
2306 then
2307 with_libvirt="yes"
2308 else
2309 with_libvirt="no (pkg-config doesn't know library)"
2310 fi
2311 fi
2312 if test "x$with_libxml2" = "xyes"
2313 then
2314 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2315 if test $? -ne 0
2316 then
2317 with_libxml2="no"
2318 fi
2319 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2320 if test $? -ne 0
2321 then
2322 with_libxml2="no"
2323 fi
2324 fi
2325 if test "x$with_libxml2" = "xyes"
2326 then
2327 SAVE_CPPFLAGS="$CPPFLAGS"
2328 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2330 AC_CHECK_HEADERS(libxml/parser.h, [],
2331 [with_libxml2="no (libxml/parser.h not found)"])
2333 CPPFLAGS="$SAVE_CPPFLAGS"
2334 fi
2335 if test "x$with_libxml2" = "xyes"
2336 then
2337 SAVE_CFLAGS="$CFLAGS"
2338 SAVE_LDFLAGS="$LDFLAGS"
2340 CFLAGS="$CFLAGS $with_libxml2_cflags"
2341 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2343 AC_CHECK_LIB(xml2, xmlXPathEval,
2344 [with_libxml2="yes"],
2345 [with_libxml2="no (symbol xmlXPathEval not found)"])
2347 CFLAGS="$SAVE_CFLAGS"
2348 LDFLAGS="$SAVE_LDFLAGS"
2349 fi
2350 dnl Add the right compiler flags and libraries.
2351 if test "x$with_libxml2" = "xyes"; then
2352 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2353 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2354 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2355 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2356 fi
2357 if test "x$with_libvirt" = "xyes"
2358 then
2359 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2360 if test $? -ne 0
2361 then
2362 with_libvirt="no"
2363 fi
2364 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2365 if test $? -ne 0
2366 then
2367 with_libvirt="no"
2368 fi
2369 fi
2370 if test "x$with_libvirt" = "xyes"
2371 then
2372 SAVE_CPPFLAGS="$CPPFLAGS"
2373 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2375 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2376 [with_libvirt="no (libvirt/libvirt.h not found)"])
2378 CPPFLAGS="$SAVE_CPPFLAGS"
2379 fi
2380 if test "x$with_libvirt" = "xyes"
2381 then
2382 SAVE_CFLAGS="$CFLAGS"
2383 SAVE_LDFLAGS="$LDFLAGS"
2385 CFLAGS="$CFLAGS $with_libvirt_cflags"
2386 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2388 AC_CHECK_LIB(virt, virDomainBlockStats,
2389 [with_libvirt="yes"],
2390 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2392 CFLAGS="$SAVE_CFLAGS"
2393 LDFLAGS="$SAVE_LDFLAGS"
2394 fi
2395 dnl Add the right compiler flags and libraries.
2396 if test "x$with_libvirt" = "xyes"; then
2397 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2398 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2399 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2400 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2401 fi
2403 dnl End of check for libvirt and libxml2 libraries.
2405 # Check for enabled/disabled features
2406 #
2408 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2409 # ------------------------------------------------------------
2410 dnl
2411 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2412 dnl
2413 AC_DEFUN(
2414 [AC_COLLECTD],
2415 [
2416 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2417 m4_if(
2418 [$2],
2419 [enable],
2420 [dnl
2421 m4_define([EnDis],[disabled])dnl
2422 m4_define([YesNo],[no])dnl
2423 ],dnl
2424 [m4_if(
2425 [$2],
2426 [disable],
2427 [dnl
2428 m4_define([EnDis],[enabled])dnl
2429 m4_define([YesNo],[yes])dnl
2430 ],
2431 [dnl
2432 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2433 ]dnl
2434 )]dnl
2435 )dnl
2436 m4_if([$3], [feature], [],
2437 [m4_if(
2438 [$3], [module], [],
2439 [dnl
2440 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2441 ]dnl
2442 )]dnl
2443 )dnl
2444 AC_ARG_ENABLE(
2445 [$1],
2446 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2447 [],
2448 enable_$1='[YesNo]'dnl
2449 )# AC_ARG_ENABLE
2450 if test "x$enable_$1" = "xno"
2451 then
2452 collectd_$1=0
2453 else
2454 if test "x$enable_$1" = "xyes"
2455 then
2456 collectd_$1=1
2457 else
2458 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2459 collectd_$1=1
2460 enable_$1='yes'
2461 fi
2462 fi
2463 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2464 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2465 ]dnl
2466 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2468 # AC_PLUGIN(name, default, info)
2469 # ------------------------------------------------------------
2470 dnl
2471 AC_DEFUN(
2472 [AC_PLUGIN],
2473 [
2474 enable_plugin="no"
2475 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2476 [
2477 if test "x$enableval" = "xyes"
2478 then
2479 enable_plugin="yes"
2480 else
2481 enable_plugin="no"
2482 fi
2483 ],
2484 [
2485 if test "x$2" = "xyes"
2486 then
2487 enable_plugin="yes"
2488 else
2489 enable_plugin="no"
2490 fi
2491 ])
2492 if test "x$enable_plugin" = "xyes"
2493 then
2494 if test "x$2" = "xyes"
2495 then
2496 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2497 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
2498 dependency_error="yes"
2499 enable_plugin="no (dependency error)"
2500 fi
2501 fi
2502 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2503 enable_$1="$enable_plugin"
2504 ]
2505 )# AC_PLUGIN(name, default, info)
2507 m4_divert_once([HELP_ENABLE], [
2508 collectd features:])
2509 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2510 AC_COLLECTD([debug], [enable], [feature], [debugging])
2511 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2512 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2514 dependency_error="no"
2515 plugin_ascent="no"
2516 plugin_battery="no"
2517 plugin_cpu="no"
2518 plugin_cpufreq="no"
2519 plugin_df="no"
2520 plugin_disk="no"
2521 plugin_entropy="no"
2522 plugin_interface="no"
2523 plugin_ipmi="no"
2524 plugin_ipvs="no"
2525 plugin_irq="no"
2526 plugin_libvirt="no"
2527 plugin_load="no"
2528 plugin_memory="no"
2529 plugin_multimeter="no"
2530 plugin_nfs="no"
2531 plugin_perl="no"
2532 plugin_processes="no"
2533 plugin_serial="no"
2534 plugin_swap="no"
2535 plugin_tape="no"
2536 plugin_tcpconns="no"
2537 plugin_thermal="no"
2538 plugin_users="no"
2539 plugin_vmem="no"
2540 plugin_vserver="no"
2541 plugin_wireless="no"
2543 # Linux
2544 if test "x$ac_system" = "xLinux"
2545 then
2546 plugin_battery="yes"
2547 plugin_cpu="yes"
2548 plugin_cpufreq="yes"
2549 plugin_disk="yes"
2550 plugin_entropy="yes"
2551 plugin_interface="yes"
2552 plugin_irq="yes"
2553 plugin_load="yes"
2554 plugin_memory="yes"
2555 plugin_nfs="yes"
2556 plugin_processes="yes"
2557 plugin_serial="yes"
2558 plugin_swap="yes"
2559 plugin_tcpconns="yes"
2560 plugin_thermal="yes"
2561 plugin_vmem="yes"
2562 plugin_vserver="yes"
2563 plugin_wireless="yes"
2565 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2566 then
2567 plugin_ipvs="yes"
2568 fi
2569 fi
2571 if test "x$ac_system" = "xOpenBSD"
2572 then
2573 plugin_tcpconns="yes"
2574 fi
2576 # Mac OS X devices
2577 if test "x$with_libiokit" = "xyes"
2578 then
2579 plugin_battery="yes"
2580 plugin_disk="yes"
2581 fi
2583 # Solaris
2584 if test "x$with_devinfo$with_kstat" = "xyesyes"
2585 then
2586 plugin_cpu="yes"
2587 plugin_disk="yes"
2588 plugin_interface="yes"
2589 plugin_memory="yes"
2590 plugin_swap="yes"
2591 plugin_tape="yes"
2592 fi
2594 # libstatgrab
2595 if test "x$with_libstatgrab" = "xyes"
2596 then
2597 plugin_cpu="yes"
2598 plugin_disk="yes"
2599 plugin_interface="yes"
2600 plugin_load="yes"
2601 plugin_memory="yes"
2602 plugin_swap="yes"
2603 plugin_users="yes"
2604 fi
2606 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2607 then
2608 plugin_ascent="yes"
2609 fi
2611 if test "x$with_libopenipmipthread" = "xyes"
2612 then
2613 plugin_ipmi="yes"
2614 fi
2616 if test "x$have_processor_info" = "xyes"
2617 then
2618 plugin_cpu="yes"
2619 fi
2620 if test "x$have_sysctlbyname" = "xyes"
2621 then
2622 plugin_cpu="yes"
2623 plugin_memory="yes"
2624 plugin_tcpconns="yes"
2625 fi
2627 if test "x$have_statfs" = "xyes"
2628 then
2629 plugin_df="yes"
2630 fi
2631 if test "x$have_statvfs" = "xyes"
2632 then
2633 plugin_df="yes"
2634 fi
2636 if test "x$have_getifaddrs" = "xyes"
2637 then
2638 plugin_interface="yes"
2639 fi
2641 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2642 then
2643 plugin_libvirt="yes"
2644 fi
2646 if test "x$have_getloadavg" = "xyes"
2647 then
2648 plugin_load="yes"
2649 fi
2651 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2652 then
2653 plugin_perl="yes"
2654 fi
2656 # Mac OS X memory interface
2657 if test "x$have_host_statistics" = "xyes"
2658 then
2659 plugin_memory="yes"
2660 fi
2662 if test "x$have_termios_h" = "xyes"
2663 then
2664 plugin_multimeter="yes"
2665 fi
2667 if test "x$have_thread_info" = "xyes"
2668 then
2669 plugin_processes="yes"
2670 fi
2672 if test "x$with_kvm_getprocs" = "xyes"
2673 then
2674 plugin_processes="yes"
2675 fi
2677 if test "x$with_kvm_getswapinfo" = "xyes"
2678 then
2679 plugin_swap="yes"
2680 fi
2682 if test "x$with_kvm_nlist" = "xyes"
2683 then
2684 plugin_tcpconns="yes"
2685 fi
2687 if test "x$have_getutent" = "xyes"
2688 then
2689 plugin_users="yes"
2690 fi
2691 if test "x$have_getutxent" = "xyes"
2692 then
2693 plugin_users="yes"
2694 fi
2696 # FIXME: sysctl for swap plugin
2698 m4_divert_once([HELP_ENABLE], [
2699 collectd plugins:])
2701 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2702 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2703 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2704 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2705 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2706 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2707 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2708 AC_PLUGIN([csv], [yes], [CSV output plugin])
2709 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2710 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2711 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2712 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2713 AC_PLUGIN([email], [yes], [EMail statistics])
2714 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2715 AC_PLUGIN([exec], [yes], [Execution of external programs])
2716 AC_PLUGIN([filecount], [yes], [Count files in directories])
2717 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2718 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2719 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2720 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2721 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2722 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2723 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2724 AC_PLUGIN([load], [$plugin_load], [System load])
2725 AC_PLUGIN([logfile], [yes], [File logging plugin])
2726 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2727 AC_PLUGIN([memcached], [yes], [memcached statistics])
2728 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2729 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2730 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2731 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2732 AC_PLUGIN([network], [yes], [Network communication plugin])
2733 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2734 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2735 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
2736 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2737 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2738 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
2739 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2740 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2741 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
2742 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2743 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2744 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2745 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2746 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2747 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2748 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2749 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2750 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2751 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2752 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2753 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
2754 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
2755 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2756 AC_PLUGIN([users], [$plugin_users], [User statistics])
2757 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2758 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
2759 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2760 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2761 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2763 dnl ip_vs.h
2764 if test "x$ac_system" = "xLinux" \
2765 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2766 then
2767 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2768 fi
2770 dnl Perl bindings
2771 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2772 [
2773 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2774 then
2775 PERL_BINDINGS_OPTIONS="$withval"
2776 with_perl_bindings="yes"
2777 else
2778 PERL_BINDINGS_OPTIONS=""
2779 with_perl_bindings="$withval"
2780 fi
2781 ],
2782 [
2783 PERL_BINDINGS_OPTIONS=""
2784 if test -n "$perl_interpreter"
2785 then
2786 with_perl_bindings="yes"
2787 else
2788 with_perl_bindings="no (no perl interpreter found)"
2789 fi
2790 ])
2791 if test "x$with_perl_bindings" = "xyes"
2792 then
2793 PERL_BINDINGS="perl"
2794 else
2795 PERL_BINDINGS=""
2796 fi
2797 AC_SUBST(PERL_BINDINGS)
2798 AC_SUBST(PERL_BINDINGS_OPTIONS)
2800 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2802 if test "x$with_rrdtool" = "xyes" \
2803 && test "x$librrd_threadsafe" != "xyes"
2804 then
2805 with_rrdtool="yes (warning: librrd is not thread-safe)"
2806 fi
2808 if test "x$with_liboping" = "xyes" \
2809 && test "x$with_own_liboping" = "xyes"
2810 then
2811 with_liboping="yes (shipped version)"
2812 fi
2814 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2815 then
2816 with_libiptc="yes (shipped version)"
2817 fi
2819 if test "x$with_libperl" = "xyes"
2820 then
2821 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2822 else
2823 enable_perl="no (needs libperl)"
2824 fi
2826 if test "x$with_perl_bindings" = "xyes" \
2827 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2828 then
2829 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2830 fi
2832 cat <<EOF;
2834 Configuration:
2835 Libraries:
2836 libcurl . . . . . . . $with_libcurl
2837 libesmtp . . . . . . $with_libesmtp
2838 libiokit . . . . . . $with_libiokit
2839 libiptc . . . . . . . $with_libiptc
2840 libkstat . . . . . . $with_kstat
2841 libkvm . . . . . . . $with_libkvm
2842 libmysql . . . . . . $with_libmysql
2843 libnetlink . . . . . $with_libnetlink
2844 libnetsnmp . . . . . $with_libnetsnmp
2845 libnotify . . . . . . $with_libnotify
2846 liboconfig . . . . . $with_liboconfig
2847 libopenipmi . . . . . $with_libopenipmipthread
2848 liboping . . . . . . $with_liboping
2849 libpcap . . . . . . . $with_libpcap
2850 libperl . . . . . . . $with_libperl
2851 libpthread . . . . . $with_libpthread
2852 libpq . . . . . . . . $with_libpq
2853 librrd . . . . . . . $with_rrdtool
2854 libsensors . . . . . $with_lm_sensors
2855 libstatgrab . . . . . $with_libstatgrab
2856 libupsclient . . . . $with_libupsclient
2857 libvirt . . . . . . . $with_libvirt
2858 libxml2 . . . . . . . $with_libxml2
2859 libxmms . . . . . . . $with_libxmms
2861 Features:
2862 daemon mode . . . . . $enable_daemon
2863 debug . . . . . . . . $enable_debug
2865 Bindings:
2866 perl . . . . . . . . $with_perl_bindings
2868 Modules:
2869 apache . . . . . . . $enable_apache
2870 apcups . . . . . . . $enable_apcups
2871 apple_sensors . . . . $enable_apple_sensors
2872 ascent . . . . . . . $enable_ascent
2873 battery . . . . . . . $enable_battery
2874 cpu . . . . . . . . . $enable_cpu
2875 cpufreq . . . . . . . $enable_cpufreq
2876 csv . . . . . . . . . $enable_csv
2877 df . . . . . . . . . $enable_df
2878 disk . . . . . . . . $enable_disk
2879 dns . . . . . . . . . $enable_dns
2880 email . . . . . . . . $enable_email
2881 entropy . . . . . . . $enable_entropy
2882 exec . . . . . . . . $enable_exec
2883 filecount . . . . . . $enable_filecount
2884 hddtemp . . . . . . . $enable_hddtemp
2885 interface . . . . . . $enable_interface
2886 iptables . . . . . . $enable_iptables
2887 ipmi . . . . . . . . $enable_ipmi
2888 ipvs . . . . . . . . $enable_ipvs
2889 irq . . . . . . . . . $enable_irq
2890 libvirt . . . . . . . $enable_libvirt
2891 load . . . . . . . . $enable_load
2892 logfile . . . . . . . $enable_logfile
2893 mbmon . . . . . . . . $enable_mbmon
2894 memcached . . . . . . $enable_memcached
2895 memory . . . . . . . $enable_memory
2896 multimeter . . . . . $enable_multimeter
2897 mysql . . . . . . . . $enable_mysql
2898 netlink . . . . . . . $enable_netlink
2899 network . . . . . . . $enable_network
2900 nfs . . . . . . . . . $enable_nfs
2901 nginx . . . . . . . . $enable_nginx
2902 notify_desktop . . . $enable_notify_desktop
2903 notify_email . . . . $enable_notify_email
2904 ntpd . . . . . . . . $enable_ntpd
2905 nut . . . . . . . . . $enable_nut
2906 onewire . . . . . . . $enable_onewire
2907 perl . . . . . . . . $enable_perl
2908 ping . . . . . . . . $enable_ping
2909 postgresql . . . . . $enable_postgresql
2910 powerdns . . . . . . $enable_powerdns
2911 processes . . . . . . $enable_processes
2912 rrdtool . . . . . . . $enable_rrdtool
2913 sensors . . . . . . . $enable_sensors
2914 serial . . . . . . . $enable_serial
2915 snmp . . . . . . . . $enable_snmp
2916 swap . . . . . . . . $enable_swap
2917 syslog . . . . . . . $enable_syslog
2918 tail . . . . . . . . $enable_tail
2919 tape . . . . . . . . $enable_tape
2920 tcpconns . . . . . . $enable_tcpconns
2921 teamspeak2 . . . . . $enable_teamspeak2
2922 thermal . . . . . . . $enable_thermal
2923 unixsock . . . . . . $enable_unixsock
2924 users . . . . . . . . $enable_users
2925 uuid . . . . . . . . $enable_uuid
2926 vmem . . . . . . . . $enable_vmem
2927 vserver . . . . . . . $enable_vserver
2928 wireless . . . . . . $enable_wireless
2929 xmms . . . . . . . . $enable_xmms
2931 EOF
2933 if test "x$dependency_error" = "xyes"; then
2934 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
2935 fi