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