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 if test "x$ac_system" = "xSolaris"
926 then
927 with_kstat="yes"
928 with_devinfo="yes"
929 else
930 with_kstat="no (Solaris only)"
931 with_devinfo="no (Solaris only)"
932 fi
934 if test "x$with_kstat" = "xyes"
935 then
936 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
937 fi
938 if test "x$with_kstat" = "xyes"
939 then
940 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
941 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
942 fi
943 if test "x$with_kstat" = "xyes"
944 then
945 AC_DEFINE(HAVE_LIBKSTAT, 1,
946 [Define to 1 if you have the 'kstat' library (-lkstat)])
947 fi
948 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
949 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
951 with_libiokit="no"
952 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
953 [
954 with_libiokit="yes"
955 ],
956 [
957 with_libiokit="no"
958 ])
959 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
961 with_libkvm="no"
962 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
963 if test "x$with_kvm_getprocs" = "xyes"
964 then
965 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
966 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
967 with_libkvm="yes"
968 fi
969 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
971 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
972 if test "x$with_kvm_getswapinfo" = "xyes"
973 then
974 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
975 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
976 with_libkvm="yes"
977 fi
978 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
980 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
981 if test "x$with_kvm_nlist" = "xyes"
982 then
983 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
984 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
985 with_libkvm="yes"
986 fi
987 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
989 # --with-librrd {{{
990 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
991 librrd_cflags=""
992 librrd_ldflags=""
993 librrd_threadsafe="yes"
994 librrd_rrdc_update="no"
995 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
996 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
997 then
998 librrd_cflags="-I$withval/include"
999 librrd_ldflags="-L$withval/lib"
1000 with_librrd="yes"
1001 else
1002 with_librrd="$withval"
1003 fi
1004 ], [with_librrd="yes"])
1005 if test "x$with_librrd" = "xyes"
1006 then
1007 SAVE_CPPFLAGS="$CPPFLAGS"
1008 SAVE_LDFLAGS="$LDFLAGS"
1010 CPPFLAGS="$CPPFLAGS $librrd_cflags"
1011 LDFLAGS="$LDFLAGS $librrd_ldflags"
1013 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
1015 CPPFLAGS="$SAVE_CPPFLAGS"
1016 LDFLAGS="$SAVE_LDFLAGS"
1017 fi
1018 if test "x$with_librrd" = "xyes"
1019 then
1020 SAVE_CPPFLAGS="$CPPFLAGS"
1021 SAVE_LDFLAGS="$LDFLAGS"
1023 CPPFLAGS="$CPPFLAGS $librrd_cflags"
1024 LDFLAGS="$LDFLAGS $librrd_ldflags"
1026 AC_CHECK_LIB(rrd_th, rrd_update_r,
1027 [with_librrd="yes"
1028 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
1029 ],
1030 [librrd_threadsafe="no"
1031 AC_CHECK_LIB(rrd, rrd_update,
1032 [with_librrd="yes"
1033 librrd_ldflags="$librrd_ldflags -lrrd -lm"
1034 ],
1035 [with_librrd="no (symbol 'rrd_update' not found)"],
1036 [-lm])
1037 ],
1038 [-lm])
1040 if test "x$librrd_threadsafe" = "xyes"
1041 then
1042 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
1043 else
1044 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
1045 fi
1047 CPPFLAGS="$SAVE_CPPFLAGS"
1048 LDFLAGS="$SAVE_LDFLAGS"
1049 fi
1050 if test "x$with_librrd" = "xyes"
1051 then
1052 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
1053 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
1054 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
1055 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
1056 fi
1057 if test "x$librrd_threadsafe" = "xyes"
1058 then
1059 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
1060 fi
1061 # }}}
1063 # --with-libpthread {{{
1064 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
1065 [ if test "x$withval" != "xno" \
1066 && test "x$withval" != "xyes"
1067 then
1068 LDFLAGS="$LDFLAGS -L$withval/lib"
1069 CPPFLAGS="$CPPFLAGS -I$withval/include"
1070 with_libpthread="yes"
1071 else
1072 if test "x$withval" = "xno"
1073 then
1074 with_libpthread="no (disabled)"
1075 fi
1076 fi
1077 ], [with_libpthread="yes"])
1078 if test "x$with_libpthread" = "xyes"
1079 then
1080 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1081 fi
1082 if test "x$with_libpthread" = "xyes"
1083 then
1084 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1085 fi
1086 if test "x$with_libpthread" = "xyes"
1087 then
1088 collect_pthread=1
1089 else
1090 collect_pthread=0
1091 fi
1092 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1093 [Wether or not to use pthread (POSIX threads) library])
1094 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1095 # }}}
1097 # --with-libcurl {{{
1098 with_curl_config="curl-config"
1099 with_curl_cflags=""
1100 with_curl_libs=""
1101 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1102 [
1103 if test "x$withval" = "xno"
1104 then
1105 with_libcurl="no"
1106 else if test "x$withval" = "xyes"
1107 then
1108 with_libcurl="yes"
1109 else
1110 if test -f "$withval" && test -x "$withval"
1111 then
1112 with_curl_config="$withval"
1113 with_libcurl="yes"
1114 else if test -x "$withval/bin/curl-config"
1115 then
1116 with_curl_config="$withval/bin/curl-config"
1117 with_libcurl="yes"
1118 fi; fi
1119 with_libcurl="yes"
1120 fi; fi
1121 ],
1122 [
1123 with_libcurl="yes"
1124 ])
1125 if test "x$with_libcurl" = "xyes"
1126 then
1127 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1128 curl_config_status=$?
1130 if test $curl_config_status -ne 0
1131 then
1132 with_libcurl="no ($with_curl_config failed)"
1133 else
1134 SAVE_CPPFLAGS="$CPPFLAGS"
1135 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1137 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1139 CPPFLAGS="$SAVE_CPPFLAGS"
1140 fi
1141 fi
1142 if test "x$with_libcurl" = "xyes"
1143 then
1144 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1145 curl_config_status=$?
1147 if test $curl_config_status -ne 0
1148 then
1149 with_libcurl="no ($with_curl_config failed)"
1150 else
1151 AC_CHECK_LIB(curl, curl_easy_init,
1152 [with_libcurl="yes"],
1153 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1154 [$with_curl_libs])
1155 fi
1156 fi
1157 if test "x$with_libcurl" = "xyes"
1158 then
1159 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1160 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1161 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1162 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1163 fi
1164 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1165 # }}}
1167 # --with-libstatgrab {{{
1168 with_libstatgrab_cflags=""
1169 with_libstatgrab_ldflags=""
1170 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1171 [
1172 if test "x$withval" != "xno" \
1173 && test "x$withval" != "xyes"
1174 then
1175 with_libstatgrab_cflags="-I$withval/include"
1176 with_libstatgrab_ldflags="-L$withval/lib"
1177 with_libstatgrab="yes"
1178 else
1179 with_libstatgrab="$withval"
1180 fi
1181 ],
1182 [
1183 if test "x$ac_system" = "xunknown"
1184 then
1185 with_libstatgrab="yes"
1186 else
1187 with_libstatgrab="no"
1188 fi
1189 ])
1190 with_libstatgrab_pkg_config="yes"
1191 if test "x$with_libstatgrab" = "xyes" \
1192 && test "x$PKG_CONFIG" != "x"
1193 then
1194 AC_MSG_CHECKING([pkg-config for libstatgrab])
1195 temp_result="found"
1196 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1197 if test "$?" != "0"
1198 then
1199 with_libstatgrab_pkg_config="no"
1200 temp_result="not found"
1201 fi
1202 AC_MSG_RESULT([$temp_result])
1203 else
1204 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1205 with_libstatgrab_pkg_config="no"
1206 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1207 fi
1209 if test "x$with_libstatgrab" = "xyes" \
1210 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1211 && test "x$with_libstatgrab_cflags" = "x"
1212 then
1213 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1214 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1215 if test "$?" = "0"
1216 then
1217 with_libstatgrab_cflags="$temp_result"
1218 else
1219 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1220 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1221 fi
1222 AC_MSG_RESULT([$temp_result])
1223 fi
1225 if test "x$with_libstatgrab" = "xyes" \
1226 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1227 && test "x$with_libstatgrab_ldflags" = "x"
1228 then
1229 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1230 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1231 if test "$?" = "0"
1232 then
1233 with_libstatgrab_ldflags="$temp_result"
1234 else
1235 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1236 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1237 fi
1238 AC_MSG_RESULT([$temp_result])
1239 fi
1241 if test "x$with_libstatgrab" = "xyes"
1242 then
1243 SAVE_CPPFLAGS="$CPPFLAGS"
1244 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1246 AC_CHECK_HEADERS(statgrab.h,
1247 [with_libstatgrab="yes"],
1248 [with_libstatgrab="no (statgrab.h not found)"])
1250 CPPFLAGS="$SAVE_CPPFLAGS"
1251 fi
1253 if test "x$with_libstatgrab" = "xyes"
1254 then
1255 SAVE_CFLAGS="$CFLAGS"
1256 SAVE_LDFLAGS="$LDFLAGS"
1258 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1259 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1261 AC_CHECK_LIB(statgrab, sg_init,
1262 [with_libstatgrab="yes"],
1263 [with_libstatgrab="no (symbol sg_init not found)"])
1265 CFLAGS="$SAVE_CFLAGS"
1266 LDFLAGS="$SAVE_LDFLAGS"
1267 fi
1269 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1270 if test "x$with_libstatgrab" = "xyes"
1271 then
1272 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1273 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1274 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1275 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1276 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1277 fi
1278 # }}}
1280 # --with-libsensors {{{
1281 with_sensors_cflags=""
1282 with_sensors_ldflags=""
1283 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1284 [
1285 if test "x$withval" = "xno"
1286 then
1287 with_libsensors="no"
1288 else
1289 with_libsensors="yes"
1290 if test "x$withval" != "xyes"
1291 then
1292 with_sensors_cflags="-I$withval/include"
1293 with_sensors_ldflags="-L$withval/lib"
1294 with_libsensors="yes"
1295 fi
1296 fi
1297 ],
1298 [
1299 if test "x$ac_system" = "xLinux"
1300 then
1301 with_libsensors="yes"
1302 else
1303 with_libsensors="no (Linux only library)"
1304 fi
1305 ])
1306 if test "x$with_libsensors" = "xyes"
1307 then
1308 SAVE_CPPFLAGS="$CPPFLAGS"
1309 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1311 # AC_CHECK_HEADERS(sensors/sensors.h,
1312 # [
1313 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1314 # ],
1315 # [with_libsensors="no (sensors/sensors.h not found)"])
1316 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
1318 CPPFLAGS="$SAVE_CPPFLAGS"
1319 fi
1320 if test "x$with_libsensors" = "xyes"
1321 then
1322 SAVE_CPPFLAGS="$CPPFLAGS"
1323 SAVE_LDFLAGS="$LDFLAGS"
1324 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1325 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1327 AC_CHECK_LIB(sensors, sensors_init,
1328 [
1329 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1330 ],
1331 [with_libsensors="no (libsensors not found)"])
1333 CPPFLAGS="$SAVE_CPPFLAGS"
1334 LDFLAGS="$SAVE_LDFLAGS"
1335 fi
1336 if test "x$with_libsensors" = "xyes"
1337 then
1338 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1339 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1340 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1341 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1342 fi
1343 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
1344 # }}}
1346 # --with-libmysql {{{
1347 with_mysql_config="mysql_config"
1348 with_mysql_cflags=""
1349 with_mysql_libs=""
1350 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1351 [
1352 if test "x$withval" = "xno"
1353 then
1354 with_libmysql="no"
1355 else if test "x$withval" = "xyes"
1356 then
1357 with_libmysql="yes"
1358 else
1359 if test -f "$withval" && test -x "$withval";
1360 then
1361 with_mysql_config="$withval"
1362 else if test -x "$withval/bin/mysql_config"
1363 then
1364 with_mysql_config="$withval/bin/mysql_config"
1365 fi; fi
1366 with_libmysql="yes"
1367 fi; fi
1368 ],
1369 [
1370 with_libmysql="yes"
1371 ])
1372 if test "x$with_libmysql" = "xyes"
1373 then
1374 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1375 mysql_config_status=$?
1377 if test $mysql_config_status -ne 0
1378 then
1379 with_libmysql="no"
1380 else
1381 SAVE_CPPFLAGS="$CPPFLAGS"
1382 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1384 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1386 CPPFLAGS="$SAVE_CPPFLAGS"
1387 fi
1388 fi
1389 if test "x$with_libmysql" = "xyes"
1390 then
1391 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1392 mysql_config_status=$?
1394 if test $mysql_config_status -ne 0
1395 then
1396 with_libmysql="no"
1397 else
1398 AC_CHECK_LIB(mysqlclient, mysql_init,
1399 [with_libmysql="yes"],
1400 [with_libmysql="no (symbol 'mysql_init' not found)"],
1401 [$with_mysql_libs])
1402 fi
1403 fi
1404 if test "x$with_libmysql" = "xyes"
1405 then
1406 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1407 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1408 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1409 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1410 fi
1411 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1412 # }}}
1414 # --with-liboconfig {{{
1415 with_own_liboconfig="no"
1416 liboconfig_LDFLAGS="$LDFLAGS"
1417 liboconfig_CPPFLAGS="$CPPFLAGS"
1418 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1419 [
1420 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1421 then
1422 if test -d "$withval/lib"
1423 then
1424 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1425 fi
1426 if test -d "$withval/include"
1427 then
1428 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1429 fi
1430 fi
1431 if test "x$withval" = "xno"
1432 then
1433 AC_MSG_ERROR("liboconfig is required")
1434 fi
1435 ],
1436 [
1437 with_liboconfig="yes"
1438 ])
1440 save_LDFLAGS="$LDFLAGS"
1441 save_CPPFLAGS="$CPPFLAGS"
1442 LDFLAGS="$liboconfig_LDFLAGS"
1443 CPPFLAGS="$liboconfig_CPPFLAGS"
1444 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1445 [
1446 with_liboconfig="yes"
1447 with_own_liboconfig="no"
1448 ],
1449 [
1450 with_liboconfig="yes"
1451 with_own_liboconfig="yes"
1452 LDFLAGS="$save_LDFLAGS"
1453 CPPFLAGS="$save_CPPFLAGS"
1454 ])
1456 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1457 if test "x$with_own_liboconfig" = "xyes"
1458 then
1459 with_liboconfig="yes (shipped version)"
1460 fi
1461 # }}}
1463 # --with-liboping {{{
1464 with_own_liboping="no"
1465 liboping_LDFLAGS="$LDFLAGS"
1466 liboping_CPPFLAGS="$CPPFLAGS"
1467 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1468 [
1469 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1470 then
1471 if test -d "$withval/lib"
1472 then
1473 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1474 fi
1475 if test -d "$withval/include"
1476 then
1477 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1478 fi
1479 fi
1480 if test "x$withval" = "xno"
1481 then
1482 with_liboping="no"
1483 with_own_liboping="no"
1484 else if test "x$withval" = "xyes"
1485 then
1486 with_liboping="yes"
1487 fi; fi
1488 ],
1489 [
1490 with_liboping="yes"
1491 ])
1493 if test "x$with_liboping" = "xyes"
1494 then
1495 save_LDFLAGS="$LDFLAGS"
1496 save_CPPFLAGS="$CPPFLAGS"
1497 LDFLAGS="$liboping_LDFLAGS"
1498 CPPFLAGS="$liboping_CPPFLAGS"
1499 AC_CHECK_LIB(oping, ping_construct,
1500 [
1501 with_liboping="yes"
1502 with_own_liboping="no"
1503 ],
1504 [
1505 with_liboping="yes"
1506 with_own_liboping="yes"
1507 LDFLAGS="$save_LDFLAGS"
1508 CPPFLAGS="$save_CPPFLAGS"
1509 ])
1510 fi
1511 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1512 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1513 # }}}
1515 # --with-libowcapi {{{
1516 with_libowcapi_cppflags=""
1517 with_libowcapi_libs="-lowcapi"
1518 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1519 [
1520 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1521 then
1522 with_libowcapi_cppflags="-I$withval/include"
1523 with_libowcapi_libs="-L$withval/lib -lowcapi"
1524 with_libowcapi="yes"
1525 else
1526 with_libowcapi="$withval"
1527 fi
1528 ],
1529 [
1530 with_libowcapi="yes"
1531 ])
1532 if test "x$with_libowcapi" = "xyes"
1533 then
1534 SAVE_CPPFLAGS="$CPPFLAGS"
1535 CPPFLAGS="$with_libowcapi_cppflags"
1537 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1539 CPPFLAGS="$SAVE_CPPFLAGS"
1540 fi
1541 if test "x$with_libowcapi" = "xyes"
1542 then
1543 SAVE_LDFLAGS="$LDFLAGS"
1544 SAVE_CPPFLAGS="$CPPFLAGS"
1545 LDFLAGS="$with_libowcapi_libs"
1546 CPPFLAGS="$with_libowcapi_cppflags"
1548 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1550 LDFLAGS="$SAVE_LDFLAGS"
1551 CPPFLAGS="$SAVE_CPPFLAGS"
1552 fi
1553 if test "x$with_libowcapi" = "xyes"
1554 then
1555 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1556 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1557 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1558 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1559 fi
1560 # }}}
1562 # --with-libpcap {{{
1563 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1564 [
1565 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1566 then
1567 LDFLAGS="$LDFLAGS -L$withval/lib"
1568 CPPFLAGS="$CPPFLAGS -I$withval/include"
1569 with_libpcap="yes"
1570 else
1571 with_libpcap="$withval"
1572 fi
1573 ],
1574 [
1575 with_libpcap="yes"
1576 ])
1577 if test "x$with_libpcap" = "xyes"
1578 then
1579 AC_CHECK_LIB(pcap, pcap_open_live,
1580 [
1581 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1582 ], [with_libpcap="no (libpcap not found)"])
1583 fi
1584 if test "x$with_libpcap" = "xyes"
1585 then
1586 AC_CHECK_HEADERS(pcap.h,
1587 [
1588 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1589 ], [with_libpcap="no (pcap.h not found)"])
1590 fi
1591 if test "x$with_libpcap" = "xyes"
1592 then
1593 collect_libpcap=1
1594 else
1595 collect_libpcap=0
1596 fi
1597 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1598 [Wether or not to use the pcap library])
1599 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1600 # }}}
1602 # --with-libesmtp {{{
1603 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1604 [
1605 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1606 then
1607 LDFLAGS="$LDFLAGS -L$withval/lib"
1608 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1609 with_libesmtp="yes"
1610 else
1611 with_libesmtp="$withval"
1612 fi
1613 ],
1614 [
1615 with_libesmtp="yes"
1616 ])
1617 if test "x$with_libesmtp" = "xyes"
1618 then
1619 AC_CHECK_LIB(esmtp, smtp_create_session,
1620 [
1621 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1622 ], [with_libesmtp="no (libesmtp not found)"])
1623 fi
1624 if test "x$with_libesmtp" = "xyes"
1625 then
1626 AC_CHECK_HEADERS(libesmtp.h,
1627 [
1628 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1629 ], [with_libesmtp="no (libesmtp.h not found)"])
1630 fi
1631 if test "x$with_libesmtp" = "xyes"
1632 then
1633 collect_libesmtp=1
1634 else
1635 collect_libesmtp=0
1636 fi
1637 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1638 [Wether or not to use the esmtp library])
1639 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1640 # }}}
1642 # --with-libperl {{{
1643 perl_interpreter="perl"
1644 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1645 [
1646 if test -x "$withval"
1647 then
1648 perl_interpreter="$withval"
1649 with_libperl="yes"
1650 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1651 then
1652 LDFLAGS="$LDFLAGS -L$withval/lib"
1653 CPPFLAGS="$CPPFLAGS -I$withval/include"
1654 perl_interpreter="$withval/bin/perl"
1655 with_libperl="yes"
1656 else
1657 with_libperl="$withval"
1658 fi; fi
1659 ],
1660 [
1661 with_libperl="yes"
1662 ])
1664 AC_MSG_CHECKING([for perl])
1665 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1666 if test -x "$perl_interpreter"
1667 then
1668 AC_MSG_RESULT([yes ($perl_interpreter)])
1669 else
1670 perl_interpreter=""
1671 AC_MSG_RESULT([no])
1672 fi
1674 AC_SUBST(PERL, "$perl_interpreter")
1676 if test "x$with_libperl" = "xyes" \
1677 && test -n "$perl_interpreter"
1678 then
1679 SAVE_CFLAGS=$CFLAGS
1680 SAVE_LDFLAGS=$LDFLAGS
1681 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1682 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1683 CFLAGS="$CFLAGS $PERL_CFLAGS"
1684 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1686 AC_CACHE_CHECK([for libperl],
1687 [have_libperl],
1688 AC_LINK_IFELSE(
1689 AC_LANG_PROGRAM(
1690 [[
1691 #define PERL_NO_GET_CONTEXT
1692 #include <EXTERN.h>
1693 #include <perl.h>
1694 #include <XSUB.h>
1695 ]],
1696 [[
1697 dTHX;
1698 load_module (PERL_LOADMOD_NOIMPORT,
1699 newSVpv ("Collectd::Plugin::FooBar", 24),
1700 Nullsv);
1701 ]]),
1702 [have_libperl="yes"],
1703 [have_libperl="no"]
1704 )
1705 )
1707 if test "x$have_libperl" = "xyes"
1708 then
1709 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1710 AC_SUBST(PERL_CFLAGS)
1711 AC_SUBST(PERL_LDFLAGS)
1712 else
1713 with_libperl="no"
1714 fi
1716 CFLAGS=$SAVE_CFLAGS
1717 LDFLAGS=$SAVE_LDFLAGS
1718 else if test -z "$perl_interpreter"; then
1719 with_libperl="no (no perl interpreter found)"
1720 have_libperl="no"
1721 fi; fi
1722 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1724 if test "x$with_libperl" = "xyes"
1725 then
1726 SAVE_CFLAGS=$CFLAGS
1727 SAVE_LDFLAGS=$LDFLAGS
1728 CFLAGS="$CFLAGS $PERL_CFLAGS"
1729 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1731 AC_CACHE_CHECK([if perl supports ithreads],
1732 [have_perl_ithreads],
1733 AC_LINK_IFELSE(
1734 AC_LANG_PROGRAM(
1735 [[
1736 #include <EXTERN.h>
1737 #include <perl.h>
1738 #include <XSUB.h>
1740 #if !defined(USE_ITHREADS)
1741 # error "Perl does not support ithreads!"
1742 #endif /* !defined(USE_ITHREADS) */
1743 ]],
1744 [[ ]]),
1745 [have_perl_ithreads="yes"],
1746 [have_perl_ithreads="no"]
1747 )
1748 )
1750 if test "x$have_perl_ithreads" = "xyes"
1751 then
1752 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1753 fi
1755 CFLAGS=$SAVE_CFLAGS
1756 LDFLAGS=$SAVE_LDFLAGS
1757 fi
1758 # }}}
1760 # --with-libiptc {{{
1761 with_own_libiptc="no"
1762 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1763 [
1764 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1765 then
1766 LDFLAGS="$LDFLAGS -L$withval/lib"
1767 CPPFLAGS="$CPPFLAGS -I$withval/include"
1768 with_libiptc="yes"
1769 else
1770 with_libiptc="$withval"
1771 fi
1772 ],
1773 [
1774 if test "x$ac_system" = "xLinux"
1775 then
1776 with_libiptc="yes"
1777 else
1778 with_libiptc="no (Linux only)"
1779 fi
1780 ])
1781 if test "x$with_libiptc" = "xyes"
1782 then
1783 AC_CHECK_LIB(iptc, iptc_init,
1784 [
1785 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1786 ],
1787 [
1788 with_libiptc="yes"
1789 with_own_libiptc="yes"
1790 ])
1791 fi
1792 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1793 then
1794 AC_CHECK_HEADERS(libiptc/libiptc.h,
1795 [
1796 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1797 ],
1798 [
1799 with_libiptc="yes"
1800 with_own_libiptc="yes"
1801 ])
1802 fi
1803 if test "x$with_libiptc" = "xyes"
1804 then
1805 SAVE_CFLAGS=$CFLAGS
1806 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1808 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1809 [
1810 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1811 with_own_libiptc="no"
1812 ],
1813 [
1814 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1815 ])
1817 CFLAGS=$SAVE_CFLAGS
1818 fi
1819 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1820 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1821 if test "x$with_own_libiptc" = "xyes"
1822 then
1823 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1824 fi
1825 # }}}
1827 # --with-libnetsnmp {{{
1828 with_snmp_config="net-snmp-config"
1829 with_snmp_cflags=""
1830 with_snmp_libs=""
1831 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1832 [
1833 if test "x$withval" = "xno"
1834 then
1835 with_libnetsnmp="no"
1836 else if test "x$withval" = "xyes"
1837 then
1838 with_libnetsnmp="yes"
1839 else
1840 if test -x "$withval"
1841 then
1842 with_snmp_config="$withval"
1843 with_libnetsnmp="yes"
1844 else
1845 with_snmp_config="$withval/bin/net-snmp-config"
1846 with_libnetsnmp="yes"
1847 fi
1848 fi; fi
1849 ],
1850 [with_libnetsnmp="yes"])
1851 if test "x$with_libnetsnmp" = "xyes"
1852 then
1853 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1854 snmp_config_status=$?
1856 if test $snmp_config_status -ne 0
1857 then
1858 with_libnetsnmp="no ($with_snmp_config failed)"
1859 else
1860 SAVE_CPPFLAGS="$CPPFLAGS"
1861 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1863 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1865 CPPFLAGS="$SAVE_CPPFLAGS"
1866 fi
1867 fi
1868 if test "x$with_libnetsnmp" = "xyes"
1869 then
1870 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1871 snmp_config_status=$?
1873 if test $snmp_config_status -ne 0
1874 then
1875 with_libnetsnmp="no ($with_snmp_config failed)"
1876 else
1877 AC_CHECK_LIB(netsnmp, init_snmp,
1878 [with_libnetsnmp="yes"],
1879 [with_libnetsnmp="no (libnetsnmp not found)"],
1880 [$with_snmp_libs])
1881 fi
1882 fi
1883 if test "x$with_libnetsnmp" = "xyes"
1884 then
1885 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1886 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1887 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1888 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1889 fi
1890 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1891 # }}}
1893 # pkg-config --exists 'libupsclient' {{{
1894 with_libupsclient="no (pkg-config isn't available)"
1895 with_libupsclient_cflags=""
1896 with_libupsclient_libs=""
1897 if test "x$PKG_CONFIG" != "x"
1898 then
1899 pkg-config --exists 'libupsclient' 2>/dev/null
1900 if test "$?" = "0"
1901 then
1902 with_libupsclient="yes"
1903 else
1904 with_libupsclient="no (pkg-config doesn't know library)"
1905 fi
1906 fi
1907 if test "x$with_libupsclient" = "xyes"
1908 then
1909 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
1910 if test $? -ne 0
1911 then
1912 with_libupsclient="no"
1913 fi
1914 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
1915 if test $? -ne 0
1916 then
1917 with_libupsclient="no"
1918 fi
1919 fi
1920 if test "x$with_libupsclient" = "xyes"
1921 then
1922 SAVE_CPPFLAGS="$CPPFLAGS"
1923 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1925 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1927 CPPFLAGS="$SAVE_CPPFLAGS"
1928 fi
1929 if test "x$with_libupsclient" = "xyes"
1930 then
1931 SAVE_CPPFLAGS="$CPPFLAGS"
1932 SAVE_LDFLAGS="$LDFLAGS"
1934 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1935 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
1937 AC_CHECK_LIB(upsclient, upscli_connect,
1938 [with_libupsclient="yes"],
1939 [with_libupsclient="no (symbol upscli_connect not found)"])
1941 CPPFLAGS="$SAVE_CPPFLAGS"
1942 LDFLAGS="$SAVE_LDFLAGS"
1943 fi
1944 if test "x$with_libupsclient" = "xyes"
1945 then
1946 SAVE_CPPFLAGS="$CPPFLAGS"
1947 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1949 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1950 [#include <stdlib.h>
1951 #include <stdio.h>
1952 #include <upsclient.h>])
1954 CPPFLAGS="$SAVE_CPPFLAGS"
1955 fi
1956 if test "x$with_libupsclient" = "xyes"
1957 then
1958 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
1959 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
1960 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1961 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1962 fi
1963 # }}}
1965 # --with-libxmms {{{
1966 with_xmms_config="xmms-config"
1967 with_xmms_cflags=""
1968 with_xmms_libs=""
1969 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1970 [
1971 if test "x$withval" != "xno" \
1972 && test "x$withval" != "xyes"
1973 then
1974 if test -f "$withval" && test -x "$withval";
1975 then
1976 with_xmms_config="$withval"
1977 else if test -x "$withval/bin/xmms-config"
1978 then
1979 with_xmms_config="$withval/bin/xmms-config"
1980 fi; fi
1981 with_libxmms="yes"
1982 else if test "x$withval" = "xno"
1983 then
1984 with_libxmms="no"
1985 else
1986 with_libxmms="yes"
1987 fi; fi
1988 ],
1989 [
1990 with_libxmms="yes"
1991 ])
1992 if test "x$with_libxmms" = "xyes"
1993 then
1994 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1995 xmms_config_status=$?
1997 if test $xmms_config_status -ne 0
1998 then
1999 with_libxmms="no"
2000 fi
2001 fi
2002 if test "x$with_libxmms" = "xyes"
2003 then
2004 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2005 xmms_config_status=$?
2007 if test $xmms_config_status -ne 0
2008 then
2009 with_libxmms="no"
2010 fi
2011 fi
2012 if test "x$with_libxmms" = "xyes"
2013 then
2014 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2015 [
2016 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2017 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2018 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2019 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2020 ],
2021 [
2022 with_libxmms="no"
2023 ],
2024 [$with_xmms_libs])
2025 fi
2026 with_libxmms_numeric=0
2027 if test "x$with_libxmms" = "xyes"
2028 then
2029 with_libxmms_numeric=1
2030 fi
2031 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2032 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2033 # }}}
2035 # --with-libnetlink {{{
2036 with_libnetlink_cflags=""
2037 with_libnetlink_libs="-lnetlink"
2038 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2039 [
2040 echo "libnetlink: withval = $withval"
2041 if test "x$withval" = "xyes"
2042 then
2043 with_libnetlink="yes"
2044 else if test "x$withval" = "xno"
2045 then
2046 with_libnetlink="no"
2047 else
2048 if test -d "$withval/include"
2049 then
2050 with_libnetlink_cflags="-I$withval/include"
2051 with_libnetlink_libs="-L$withval/lib -lnetlink"
2052 with_libnetlink="yes"
2053 else
2054 AC_MSG_ERROR("no such directory: $withval/include")
2055 fi
2056 fi; fi
2057 ],
2058 [
2059 if test "x$ac_system" = "xLinux"
2060 then
2061 with_libnetlink="yes"
2062 else
2063 with_libnetlink="no (Linux only library)"
2064 fi
2065 ])
2066 if test "x$with_libnetlink" = "xyes"
2067 then
2068 SAVE_CFLAGS=$CFLAGS
2069 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2071 with_libnetlink="no (libnetlink.h not found)"
2073 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2074 [
2075 with_libnetlink="yes"
2076 break
2077 ], [],
2078 [#include <stdio.h>
2079 #include <sys/types.h>
2080 #include <asm/types.h>
2081 #include <sys/socket.h>
2082 #include <linux/netlink.h>
2083 #include <linux/rtnetlink.h>])
2084 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2085 [#include <stdio.h>
2086 #include <sys/types.h>
2087 #include <asm/types.h>
2088 #include <sys/socket.h>])
2090 AC_COMPILE_IFELSE(
2091 [#include <stdio.h>
2092 #include <sys/types.h>
2093 #include <asm/types.h>
2094 #include <sys/socket.h>
2095 #include <linux/netlink.h>
2096 #include <linux/rtnetlink.h>
2098 int main (void)
2099 {
2100 int retval = TCA_STATS2;
2101 return (retval);
2102 }],
2103 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2104 []);
2106 AC_COMPILE_IFELSE(
2107 [#include <stdio.h>
2108 #include <sys/types.h>
2109 #include <asm/types.h>
2110 #include <sys/socket.h>
2111 #include <linux/netlink.h>
2112 #include <linux/rtnetlink.h>
2114 int main (void)
2115 {
2116 int retval = TCA_STATS;
2117 return (retval);
2118 }],
2119 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2120 []);
2122 CFLAGS="$SAVE_CFLAGS"
2123 fi
2124 if test "x$with_libnetlink" = "xyes"
2125 then
2126 AC_CHECK_LIB(netlink, rtnl_open,
2127 [with_libnetlink="yes"],
2128 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2129 [$with_libnetlink_libs])
2130 fi
2131 if test "x$with_libnetlink" = "xyes"
2132 then
2133 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2134 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2135 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2136 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2137 fi
2138 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2139 # }}}
2141 # --with-libpq {{{
2142 with_pg_config="pg_config"
2143 with_libpq_includedir=""
2144 with_libpq_libdir=""
2145 with_libpq_cppflags=""
2146 with_libpq_ldflags=""
2147 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2148 [Path to libpq.])],
2149 [
2150 if test "x$withval" = "xno"
2151 then
2152 with_libpq="no"
2153 else if test "x$withval" = "xyes"
2154 then
2155 with_libpq="yes"
2156 else
2157 if test -f "$withval" && test -x "$withval";
2158 then
2159 with_pg_config="$withval"
2160 else if test -x "$withval/bin/pg_config"
2161 then
2162 with_pg_config="$withval/bin/pg_config"
2163 fi; fi
2164 with_libpq="yes"
2165 fi; fi
2166 ],
2167 [
2168 with_libpq="yes"
2169 ])
2170 if test "x$with_libpq" = "xyes"
2171 then
2172 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2173 pg_config_status=$?
2175 if test $pg_config_status -eq 0
2176 then
2177 if test -n "$with_libpq_includedir"; then
2178 for dir in $with_libpq_includedir; do
2179 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2180 done
2181 fi
2182 else
2183 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2184 fi
2186 SAVE_CPPFLAGS="$CPPFLAGS"
2187 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2189 AC_CHECK_HEADERS(libpq-fe.h, [],
2190 [with_libpq="no (libpq-fe.h not found)"], [])
2192 CPPFLAGS="$SAVE_CPPFLAGS"
2193 fi
2194 if test "x$with_libpq" = "xyes"
2195 then
2196 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2197 pg_config_status=$?
2199 if test $pg_config_status -eq 0
2200 then
2201 if test -n "$with_libpq_libdir"; then
2202 for dir in $with_libpq_libdir; do
2203 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2204 done
2205 fi
2206 else
2207 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2208 fi
2210 SAVE_LDFLAGS="$LDFLAGS"
2211 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2213 AC_CHECK_LIB(pq, PQconnectdb,
2214 [with_libpq="yes"],
2215 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2217 LDFLAGS="$SAVE_LDFLAGS"
2218 fi
2219 if test "x$with_libpq" = "xyes"
2220 then
2221 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2222 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2223 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2224 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2225 fi
2226 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2227 # }}}
2229 # $PKG_CONFIG --exists OpenIPMIpthread {{{
2230 with_libopenipmipthread="yes"
2231 with_libopenipmipthread_cflags=""
2232 with_libopenipmipthread_libs=""
2234 AC_MSG_CHECKING([for pkg-config])
2235 temp_result="no"
2236 if test "x$PKG_CONFIG" = "x"
2237 then
2238 with_libopenipmipthread="no"
2239 temp_result="no"
2240 else
2241 temp_result="$PKG_CONFIG"
2242 fi
2243 AC_MSG_RESULT([$temp_result])
2245 if test "x$with_libopenipmipthread" = "xyes"
2246 then
2247 AC_MSG_CHECKING([for libOpenIPMIpthread])
2248 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2249 if test "$?" != "0"
2250 then
2251 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2252 fi
2253 AC_MSG_RESULT([$with_libopenipmipthread])
2254 fi
2256 if test "x$with_libopenipmipthread" = "xyes"
2257 then
2258 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2259 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2260 if test "$?" = "0"
2261 then
2262 with_libopenipmipthread_cflags="$temp_result"
2263 else
2264 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2265 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2266 fi
2267 AC_MSG_RESULT([$temp_result])
2268 fi
2270 if test "x$with_libopenipmipthread" = "xyes"
2271 then
2272 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2273 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2274 if test "$?" = "0"
2275 then
2276 with_libopenipmipthread_ldflags="$temp_result"
2277 else
2278 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2279 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2280 fi
2281 AC_MSG_RESULT([$temp_result])
2282 fi
2284 if test "x$with_libopenipmipthread" = "xyes"
2285 then
2286 SAVE_CPPFLAGS="$CPPFLAGS"
2287 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2289 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2290 [with_libopenipmipthread="yes"],
2291 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2292 [#include <OpenIPMI/ipmiif.h>
2293 #include <OpenIPMI/ipmi_err.h>
2294 #include <OpenIPMI/ipmi_posix.h>
2295 #include <OpenIPMI/ipmi_conn.h>
2296 ])
2298 CPPFLAGS="$SAVE_CPPFLAGS"
2299 fi
2301 if test "x$with_libopenipmipthread" = "xyes"
2302 then
2303 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2304 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2305 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2306 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2307 fi
2308 # }}}
2310 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
2311 with_libxml2="no (pkg-config isn't available)"
2312 with_libxml2_cflags=""
2313 with_libxml2_ldflags=""
2314 with_libvirt="no (pkg-config isn't available)"
2315 with_libvirt_cflags=""
2316 with_libvirt_ldflags=""
2317 if test "x$PKG_CONFIG" != "x"
2318 then
2319 pkg-config --exists 'libxml-2.0' 2>/dev/null
2320 if test "$?" = "0"
2321 then
2322 with_libxml2="yes"
2323 else
2324 with_libxml2="no (pkg-config doesn't know library)"
2325 fi
2327 pkg-config --exists libvirt 2>/dev/null
2328 if test "$?" = "0"
2329 then
2330 with_libvirt="yes"
2331 else
2332 with_libvirt="no (pkg-config doesn't know library)"
2333 fi
2334 fi
2335 if test "x$with_libxml2" = "xyes"
2336 then
2337 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2338 if test $? -ne 0
2339 then
2340 with_libxml2="no"
2341 fi
2342 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2343 if test $? -ne 0
2344 then
2345 with_libxml2="no"
2346 fi
2347 fi
2348 if test "x$with_libxml2" = "xyes"
2349 then
2350 SAVE_CPPFLAGS="$CPPFLAGS"
2351 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2353 AC_CHECK_HEADERS(libxml/parser.h, [],
2354 [with_libxml2="no (libxml/parser.h not found)"])
2356 CPPFLAGS="$SAVE_CPPFLAGS"
2357 fi
2358 if test "x$with_libxml2" = "xyes"
2359 then
2360 SAVE_CFLAGS="$CFLAGS"
2361 SAVE_LDFLAGS="$LDFLAGS"
2363 CFLAGS="$CFLAGS $with_libxml2_cflags"
2364 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2366 AC_CHECK_LIB(xml2, xmlXPathEval,
2367 [with_libxml2="yes"],
2368 [with_libxml2="no (symbol xmlXPathEval not found)"])
2370 CFLAGS="$SAVE_CFLAGS"
2371 LDFLAGS="$SAVE_LDFLAGS"
2372 fi
2373 dnl Add the right compiler flags and libraries.
2374 if test "x$with_libxml2" = "xyes"; then
2375 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2376 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2377 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2378 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2379 fi
2380 if test "x$with_libvirt" = "xyes"
2381 then
2382 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2383 if test $? -ne 0
2384 then
2385 with_libvirt="no"
2386 fi
2387 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2388 if test $? -ne 0
2389 then
2390 with_libvirt="no"
2391 fi
2392 fi
2393 if test "x$with_libvirt" = "xyes"
2394 then
2395 SAVE_CPPFLAGS="$CPPFLAGS"
2396 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2398 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2399 [with_libvirt="no (libvirt/libvirt.h not found)"])
2401 CPPFLAGS="$SAVE_CPPFLAGS"
2402 fi
2403 if test "x$with_libvirt" = "xyes"
2404 then
2405 SAVE_CFLAGS="$CFLAGS"
2406 SAVE_LDFLAGS="$LDFLAGS"
2408 CFLAGS="$CFLAGS $with_libvirt_cflags"
2409 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2411 AC_CHECK_LIB(virt, virDomainBlockStats,
2412 [with_libvirt="yes"],
2413 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2415 CFLAGS="$SAVE_CFLAGS"
2416 LDFLAGS="$SAVE_LDFLAGS"
2417 fi
2418 dnl Add the right compiler flags and libraries.
2419 if test "x$with_libvirt" = "xyes"; then
2420 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2421 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2422 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2423 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2424 fi
2425 # }}}
2427 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
2428 [with_libnotify="yes"],
2429 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
2431 # Check for enabled/disabled features
2432 #
2434 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2435 # ------------------------------------------------------------
2436 dnl
2437 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2438 dnl
2439 AC_DEFUN(
2440 [AC_COLLECTD],
2441 [
2442 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2443 m4_if(
2444 [$2],
2445 [enable],
2446 [dnl
2447 m4_define([EnDis],[disabled])dnl
2448 m4_define([YesNo],[no])dnl
2449 ],dnl
2450 [m4_if(
2451 [$2],
2452 [disable],
2453 [dnl
2454 m4_define([EnDis],[enabled])dnl
2455 m4_define([YesNo],[yes])dnl
2456 ],
2457 [dnl
2458 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2459 ]dnl
2460 )]dnl
2461 )dnl
2462 m4_if([$3], [feature], [],
2463 [m4_if(
2464 [$3], [module], [],
2465 [dnl
2466 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2467 ]dnl
2468 )]dnl
2469 )dnl
2470 AC_ARG_ENABLE(
2471 [$1],
2472 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2473 [],
2474 enable_$1='[YesNo]'dnl
2475 )# AC_ARG_ENABLE
2476 if test "x$enable_$1" = "xno"
2477 then
2478 collectd_$1=0
2479 else
2480 if test "x$enable_$1" = "xyes"
2481 then
2482 collectd_$1=1
2483 else
2484 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2485 collectd_$1=1
2486 enable_$1='yes'
2487 fi
2488 fi
2489 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2490 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2491 ]dnl
2492 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2494 # AC_PLUGIN(name, default, info)
2495 # ------------------------------------------------------------
2496 dnl
2497 AC_DEFUN(
2498 [AC_PLUGIN],
2499 [
2500 enable_plugin="no"
2501 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2502 [
2503 if test "x$enableval" = "xyes"
2504 then
2505 enable_plugin="yes"
2506 else
2507 enable_plugin="no"
2508 fi
2509 ],
2510 [
2511 if test "x$2" = "xyes"
2512 then
2513 enable_plugin="yes"
2514 else
2515 enable_plugin="no"
2516 fi
2517 ])
2518 if test "x$enable_plugin" = "xyes"
2519 then
2520 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2521 fi
2522 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2523 enable_$1="$enable_plugin"
2524 ]
2525 )# AC_PLUGIN(name, default, info)
2527 m4_divert_once([HELP_ENABLE], [
2528 collectd features:])
2529 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2530 AC_COLLECTD([debug], [enable], [feature], [debugging])
2531 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2532 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2534 plugin_ascent="no"
2535 plugin_battery="no"
2536 plugin_cpu="no"
2537 plugin_cpufreq="no"
2538 plugin_df="no"
2539 plugin_disk="no"
2540 plugin_entropy="no"
2541 plugin_interface="no"
2542 plugin_ipmi="no"
2543 plugin_ipvs="no"
2544 plugin_irq="no"
2545 plugin_libvirt="no"
2546 plugin_load="no"
2547 plugin_memory="no"
2548 plugin_multimeter="no"
2549 plugin_nfs="no"
2550 plugin_perl="no"
2551 plugin_processes="no"
2552 plugin_serial="no"
2553 plugin_swap="no"
2554 plugin_tape="no"
2555 plugin_tcpconns="no"
2556 plugin_thermal="no"
2557 plugin_users="no"
2558 plugin_vmem="no"
2559 plugin_vserver="no"
2560 plugin_wireless="no"
2562 # Linux
2563 if test "x$ac_system" = "xLinux"
2564 then
2565 plugin_battery="yes"
2566 plugin_cpu="yes"
2567 plugin_cpufreq="yes"
2568 plugin_disk="yes"
2569 plugin_entropy="yes"
2570 plugin_interface="yes"
2571 plugin_irq="yes"
2572 plugin_load="yes"
2573 plugin_memory="yes"
2574 plugin_nfs="yes"
2575 plugin_processes="yes"
2576 plugin_serial="yes"
2577 plugin_swap="yes"
2578 plugin_tcpconns="yes"
2579 plugin_thermal="yes"
2580 plugin_vmem="yes"
2581 plugin_vserver="yes"
2582 plugin_wireless="yes"
2584 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2585 then
2586 plugin_ipvs="yes"
2587 fi
2588 fi
2590 if test "x$ac_system" = "xOpenBSD"
2591 then
2592 plugin_tcpconns="yes"
2593 fi
2595 # Mac OS X devices
2596 if test "x$with_libiokit" = "xyes"
2597 then
2598 plugin_battery="yes"
2599 plugin_disk="yes"
2600 fi
2602 # Solaris
2603 if test "x$with_devinfo$with_kstat" = "xyesyes"
2604 then
2605 plugin_cpu="yes"
2606 plugin_disk="yes"
2607 plugin_interface="yes"
2608 plugin_memory="yes"
2609 plugin_swap="yes"
2610 plugin_tape="yes"
2611 fi
2613 # libstatgrab
2614 if test "x$with_libstatgrab" = "xyes"
2615 then
2616 plugin_cpu="yes"
2617 plugin_disk="yes"
2618 plugin_interface="yes"
2619 plugin_load="yes"
2620 plugin_memory="yes"
2621 plugin_swap="yes"
2622 plugin_users="yes"
2623 fi
2625 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2626 then
2627 plugin_ascent="yes"
2628 fi
2630 if test "x$with_libopenipmipthread" = "xyes"
2631 then
2632 plugin_ipmi="yes"
2633 fi
2635 if test "x$have_processor_info" = "xyes"
2636 then
2637 plugin_cpu="yes"
2638 fi
2639 if test "x$have_sysctlbyname" = "xyes"
2640 then
2641 plugin_cpu="yes"
2642 plugin_memory="yes"
2643 plugin_tcpconns="yes"
2644 fi
2646 if test "x$have_statfs" = "xyes"
2647 then
2648 plugin_df="yes"
2649 fi
2650 if test "x$have_statvfs" = "xyes"
2651 then
2652 plugin_df="yes"
2653 fi
2655 if test "x$have_getifaddrs" = "xyes"
2656 then
2657 plugin_interface="yes"
2658 fi
2660 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2661 then
2662 plugin_libvirt="yes"
2663 fi
2665 if test "x$have_getloadavg" = "xyes"
2666 then
2667 plugin_load="yes"
2668 fi
2670 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2671 then
2672 plugin_perl="yes"
2673 fi
2675 # Mac OS X memory interface
2676 if test "x$have_host_statistics" = "xyes"
2677 then
2678 plugin_memory="yes"
2679 fi
2681 if test "x$have_termios_h" = "xyes"
2682 then
2683 plugin_multimeter="yes"
2684 fi
2686 if test "x$have_thread_info" = "xyes"
2687 then
2688 plugin_processes="yes"
2689 fi
2691 if test "x$with_kvm_getprocs" = "xyes"
2692 then
2693 plugin_processes="yes"
2694 fi
2696 if test "x$with_kvm_getswapinfo" = "xyes"
2697 then
2698 plugin_swap="yes"
2699 fi
2701 if test "x$with_kvm_nlist" = "xyes"
2702 then
2703 plugin_tcpconns="yes"
2704 fi
2706 if test "x$have_getutent" = "xyes"
2707 then
2708 plugin_users="yes"
2709 fi
2710 if test "x$have_getutxent" = "xyes"
2711 then
2712 plugin_users="yes"
2713 fi
2715 # FIXME: sysctl for swap plugin
2717 m4_divert_once([HELP_ENABLE], [
2718 collectd plugins:])
2720 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2721 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2722 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2723 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2724 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2725 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2726 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2727 AC_PLUGIN([csv], [yes], [CSV output plugin])
2728 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2729 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2730 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2731 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2732 AC_PLUGIN([email], [yes], [EMail statistics])
2733 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2734 AC_PLUGIN([exec], [yes], [Execution of external programs])
2735 AC_PLUGIN([filecount], [yes], [Count files in directories])
2736 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2737 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2738 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2739 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2740 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2741 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2742 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2743 AC_PLUGIN([load], [$plugin_load], [System load])
2744 AC_PLUGIN([logfile], [yes], [File logging plugin])
2745 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2746 AC_PLUGIN([memcached], [yes], [memcached statistics])
2747 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2748 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2749 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2750 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2751 AC_PLUGIN([network], [yes], [Network communication plugin])
2752 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2753 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2754 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
2755 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2756 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2757 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
2758 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2759 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2760 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
2761 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2762 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2763 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
2764 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
2765 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
2766 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2767 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2768 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2769 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2770 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2771 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2772 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2773 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
2774 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
2775 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2776 AC_PLUGIN([users], [$plugin_users], [User statistics])
2777 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2778 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
2779 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2780 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2781 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2783 dnl ip_vs.h
2784 if test "x$ac_system" = "xLinux" \
2785 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2786 then
2787 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2788 fi
2790 dnl Perl bindings
2791 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2792 [
2793 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2794 then
2795 PERL_BINDINGS_OPTIONS="$withval"
2796 with_perl_bindings="yes"
2797 else
2798 PERL_BINDINGS_OPTIONS=""
2799 with_perl_bindings="$withval"
2800 fi
2801 ],
2802 [
2803 PERL_BINDINGS_OPTIONS=""
2804 if test -n "$perl_interpreter"
2805 then
2806 with_perl_bindings="yes"
2807 else
2808 with_perl_bindings="no (no perl interpreter found)"
2809 fi
2810 ])
2811 if test "x$with_perl_bindings" = "xyes"
2812 then
2813 PERL_BINDINGS="perl"
2814 else
2815 PERL_BINDINGS=""
2816 fi
2817 AC_SUBST(PERL_BINDINGS)
2818 AC_SUBST(PERL_BINDINGS_OPTIONS)
2820 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2822 if test "x$with_librrd" = "xyes" \
2823 && test "x$librrd_threadsafe" != "xyes"
2824 then
2825 with_librrd="yes (warning: librrd is not thread-safe)"
2826 fi
2828 if test "x$with_liboping" = "xyes" \
2829 && test "x$with_own_liboping" = "xyes"
2830 then
2831 with_liboping="yes (shipped version)"
2832 fi
2834 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2835 then
2836 with_libiptc="yes (shipped version)"
2837 fi
2839 if test "x$with_libperl" = "xyes"
2840 then
2841 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2842 else
2843 enable_perl="no (needs libperl)"
2844 fi
2846 if test "x$with_perl_bindings" = "xyes" \
2847 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2848 then
2849 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2850 fi
2852 cat <<EOF;
2854 Configuration:
2855 Libraries:
2856 libcurl . . . . . . . $with_libcurl
2857 libesmtp . . . . . . $with_libesmtp
2858 libiokit . . . . . . $with_libiokit
2859 libiptc . . . . . . . $with_libiptc
2860 libkstat . . . . . . $with_kstat
2861 libkvm . . . . . . . $with_libkvm
2862 libmysql . . . . . . $with_libmysql
2863 libnetlink . . . . . $with_libnetlink
2864 libnetsnmp . . . . . $with_libnetsnmp
2865 libnotify . . . . . . $with_libnotify
2866 liboconfig . . . . . $with_liboconfig
2867 libopenipmi . . . . . $with_libopenipmipthread
2868 liboping . . . . . . $with_liboping
2869 libpcap . . . . . . . $with_libpcap
2870 libperl . . . . . . . $with_libperl
2871 libpthread . . . . . $with_libpthread
2872 libpq . . . . . . . . $with_libpq
2873 librrd . . . . . . . $with_librrd
2874 libsensors . . . . . $with_libsensors
2875 libstatgrab . . . . . $with_libstatgrab
2876 libupsclient . . . . $with_libupsclient
2877 libvirt . . . . . . . $with_libvirt
2878 libxml2 . . . . . . . $with_libxml2
2879 libxmms . . . . . . . $with_libxmms
2881 Features:
2882 daemon mode . . . . . $enable_daemon
2883 debug . . . . . . . . $enable_debug
2885 Bindings:
2886 perl . . . . . . . . $with_perl_bindings
2888 Modules:
2889 apache . . . . . . . $enable_apache
2890 apcups . . . . . . . $enable_apcups
2891 apple_sensors . . . . $enable_apple_sensors
2892 ascent . . . . . . . $enable_ascent
2893 battery . . . . . . . $enable_battery
2894 cpu . . . . . . . . . $enable_cpu
2895 cpufreq . . . . . . . $enable_cpufreq
2896 csv . . . . . . . . . $enable_csv
2897 df . . . . . . . . . $enable_df
2898 disk . . . . . . . . $enable_disk
2899 dns . . . . . . . . . $enable_dns
2900 email . . . . . . . . $enable_email
2901 entropy . . . . . . . $enable_entropy
2902 exec . . . . . . . . $enable_exec
2903 filecount . . . . . . $enable_filecount
2904 hddtemp . . . . . . . $enable_hddtemp
2905 interface . . . . . . $enable_interface
2906 iptables . . . . . . $enable_iptables
2907 ipmi . . . . . . . . $enable_ipmi
2908 ipvs . . . . . . . . $enable_ipvs
2909 irq . . . . . . . . . $enable_irq
2910 libvirt . . . . . . . $enable_libvirt
2911 load . . . . . . . . $enable_load
2912 logfile . . . . . . . $enable_logfile
2913 mbmon . . . . . . . . $enable_mbmon
2914 memcached . . . . . . $enable_memcached
2915 memory . . . . . . . $enable_memory
2916 multimeter . . . . . $enable_multimeter
2917 mysql . . . . . . . . $enable_mysql
2918 netlink . . . . . . . $enable_netlink
2919 network . . . . . . . $enable_network
2920 nfs . . . . . . . . . $enable_nfs
2921 nginx . . . . . . . . $enable_nginx
2922 notify_desktop . . . $enable_notify_desktop
2923 notify_email . . . . $enable_notify_email
2924 ntpd . . . . . . . . $enable_ntpd
2925 nut . . . . . . . . . $enable_nut
2926 onewire . . . . . . . $enable_onewire
2927 perl . . . . . . . . $enable_perl
2928 ping . . . . . . . . $enable_ping
2929 postgresql . . . . . $enable_postgresql
2930 powerdns . . . . . . $enable_powerdns
2931 processes . . . . . . $enable_processes
2932 rrdtool . . . . . . . $enable_rrdtool
2933 rrdcached . . . . . . $enable_rrdcached
2934 sensors . . . . . . . $enable_sensors
2935 serial . . . . . . . $enable_serial
2936 snmp . . . . . . . . $enable_snmp
2937 swap . . . . . . . . $enable_swap
2938 syslog . . . . . . . $enable_syslog
2939 tail . . . . . . . . $enable_tail
2940 tape . . . . . . . . $enable_tape
2941 tcpconns . . . . . . $enable_tcpconns
2942 teamspeak2 . . . . . $enable_teamspeak2
2943 thermal . . . . . . . $enable_thermal
2944 unixsock . . . . . . $enable_unixsock
2945 users . . . . . . . . $enable_users
2946 uuid . . . . . . . . $enable_uuid
2947 vmem . . . . . . . . $enable_vmem
2948 vserver . . . . . . . $enable_vserver
2949 wireless . . . . . . $enable_wireless
2950 xmms . . . . . . . . $enable_xmms
2952 EOF
2954 # vim: set fdm=marker :