configure.in: Bumped version to 4.0.0-rc6
[collectd.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.0-rc6)
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
7
8 AC_PREFIX_DEFAULT("/opt/collectd")
9
10 #
11 # Checks for programs.
12 #
13 AC_PROG_CC
14 AC_PROG_CPP
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_MAKE_SET
18 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
19
20 dnl configure libtool
21 AC_DISABLE_STATIC
22 AC_LIBLTDL_CONVENIENCE
23 AC_SUBST(LTDLINCL)
24 AC_SUBST(LIBLTDL)
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 AC_PROG_LEX
28 AC_PROG_YACC
29 AC_CONFIG_SUBDIRS(libltdl)
30
31 #
32 # Checks for header files.
33 #
34 AC_HEADER_STDC
35 AC_HEADER_SYS_WAIT
36 AC_HEADER_DIRENT
37 AC_CHECK_HEADERS(stdint.h)
38 AC_CHECK_HEADERS(stdio.h)
39 AC_CHECK_HEADERS(errno.h)
40 AC_CHECK_HEADERS(math.h)
41 AC_CHECK_HEADERS(syslog.h)
42 AC_CHECK_HEADERS(fcntl.h)
43 AC_CHECK_HEADERS(signal.h)
44 AC_CHECK_HEADERS(assert.h)
45 AC_CHECK_HEADERS(sys/types.h)
46 AC_CHECK_HEADERS(sys/socket.h)
47 AC_CHECK_HEADERS(sys/select.h)
48 AC_CHECK_HEADERS(poll.h)
49 AC_CHECK_HEADERS(netdb.h)
50 AC_CHECK_HEADERS(arpa/inet.h)
51 AC_CHECK_HEADERS(sys/resource.h)
52 AC_CHECK_HEADERS(sys/param.h)
53 AC_CHECK_HEADERS(kstat.h)
54
55 # For ping library
56 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
57 [#if HAVE_STDINT_H
58 # include <stdint.h>
59 #endif
60 #if HAVE_SYS_TYPES_H
61 # include <sys/types.h>
62 #endif
63 ])
64 AC_CHECK_HEADERS(netinet/in.h, [], [],
65 [#if HAVE_STDINT_H
66 # include <stdint.h>
67 #endif
68 #if HAVE_SYS_TYPES_H
69 # include <sys/types.h>
70 #endif
71 #if HAVE_NETINET_IN_SYSTM_H
72 # include <netinet/in_systm.h>
73 #endif
74 ])
75 AC_CHECK_HEADERS(netinet/ip.h, [], [],
76 [#if HAVE_STDINT_H
77 # include <stdint.h>
78 #endif
79 #if HAVE_SYS_TYPES_H
80 # include <sys/types.h>
81 #endif
82 #if HAVE_NETINET_IN_SYSTM_H
83 # include <netinet/in_systm.h>
84 #endif
85 #if HAVE_NETINET_IN_H
86 # include <netinet/in.h>
87 #endif
88 ])
89 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
90 [#if HAVE_STDINT_H
91 # include <stdint.h>
92 #endif
93 #if HAVE_SYS_TYPES_H
94 # include <sys/types.h>
95 #endif
96 #if HAVE_NETINET_IN_SYSTM_H
97 # include <netinet/in_systm.h>
98 #endif
99 #if HAVE_NETINET_IN_H
100 # include <netinet/in.h>
101 #endif
102 #if HAVE_NETINET_IP_H
103 # include <netinet/ip.h>
104 #endif
105 ])
106 AC_CHECK_HEADERS(netinet/ip_var.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 #if HAVE_NETINET_IP_H
120 # include <netinet/ip.h>
121 #endif
122 ])
123 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
124 [#if HAVE_STDINT_H
125 # include <stdint.h>
126 #endif
127 #if HAVE_SYS_TYPES_H
128 # include <sys/types.h>
129 #endif
130 #if HAVE_NETINET_IN_SYSTM_H
131 # include <netinet/in_systm.h>
132 #endif
133 #if HAVE_NETINET_IN_H
134 # include <netinet/in.h>
135 #endif
136 ])
137 AC_CHECK_HEADERS(netinet/icmp6.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_IP6_H
151 # include <netinet/ip6.h>
152 #endif
153 ])
154 AC_CHECK_HEADERS(netinet/tcp.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 #if HAVE_NETINET_IP_H
168 # include <netinet/ip.h>
169 #endif
170 ])
171 AC_CHECK_HEADERS(netinet/udp.h, [], [],
172 [#if HAVE_STDINT_H
173 # include <stdint.h>
174 #endif
175 #if HAVE_SYS_TYPES_H
176 # include <sys/types.h>
177 #endif
178 #if HAVE_NETINET_IN_SYSTM_H
179 # include <netinet/in_systm.h>
180 #endif
181 #if HAVE_NETINET_IN_H
182 # include <netinet/in.h>
183 #endif
184 #if HAVE_NETINET_IP_H
185 # include <netinet/ip.h>
186 #endif
187 ])
188
189 # For cpu modules
190 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
191 AC_CHECK_HEADERS(mach/mach_init.h)
192 AC_CHECK_HEADERS(mach/host_priv.h)
193 AC_CHECK_HEADERS(mach/mach_error.h)
194 AC_CHECK_HEADERS(mach/mach_host.h)
195 AC_CHECK_HEADERS(mach/mach_port.h)
196 AC_CHECK_HEADERS(mach/mach_types.h)
197 AC_CHECK_HEADERS(mach/message.h)
198 AC_CHECK_HEADERS(mach/processor_set.h)
199 AC_CHECK_HEADERS(mach/processor.h)
200 AC_CHECK_HEADERS(mach/processor_info.h)
201 AC_CHECK_HEADERS(mach/task.h)
202 AC_CHECK_HEADERS(mach/thread_act.h)
203 AC_CHECK_HEADERS(mach/vm_region.h)
204 AC_CHECK_HEADERS(mach/vm_map.h)
205 AC_CHECK_HEADERS(mach/vm_prot.h)
206 AC_CHECK_HEADERS(mach/vm_statistics.h)
207 AC_CHECK_HEADERS(mach/kern_return.h)
208
209 # For hddtemp module
210 AC_CHECK_HEADERS(linux/major.h)
211
212 # For the apple_sensors module
213 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
214 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
215 AC_CHECK_HEADERS(IOKit/IOTypes.h)
216
217 # For the battery plugin
218 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
219 [
220 #if HAVE_IOKIT_IOKITLIB_H
221 #  include <IOKit/IOKitLib.h>
222 #endif
223 #if HAVE_IOKIT_IOTYPES_H
224 #  include <IOKit/IOTypes.h>
225 #endif
226 ])
227 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
228
229 # For the `disk' plugin
230 AC_CHECK_HEADERS(IOKit/IOBSD.h)
231 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
232
233 # For load module
234 AC_CHECK_HEADERS(sys/loadavg.h)
235
236 # For the processes plugin
237 AC_CHECK_HEADERS(linux/config.h)
238
239 # For the swap module
240 AC_CHECK_HEADERS(sys/swap.h)
241
242 # For users module
243 AC_CHECK_HEADERS(utmp.h)
244 AC_CHECK_HEADERS(utmpx.h)
245
246 # For interface plugin
247 AC_CHECK_HEADERS(ifaddrs.h)
248 AC_CHECK_HEADERS(net/if.h, [], [],
249 [
250 #if HAVE_SYS_TYPES_H
251 #  include <sys/types.h>
252 #endif
253 #if HAVE_SYS_SOCKET_H
254 #  include <sys/socket.h>
255 #endif
256 ])
257 AC_CHECK_HEADERS(linux/if.h, [], [],
258 [
259 #if HAVE_SYS_TYPES_H
260 #  include <sys/types.h>
261 #endif
262 #if HAVE_SYS_SOCKET_H
263 #  include <sys/socket.h>
264 #endif
265 ])
266 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
267 [
268 #if HAVE_SYS_TYPES_H
269 #  include <sys/types.h>
270 #endif
271 #if HAVE_SYS_SOCKET_H
272 #  include <sys/socket.h>
273 #endif
274 #if HAVE_LINUX_IF_H
275 # include <linux/if.h>
276 #endif
277 ])
278
279 # For apache plugin
280 AC_CHECK_HEADERS(curl/curl.h)
281
282 # For quota module
283 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
284 AC_CHECK_HEADERS(ctype.h)
285 AC_CHECK_HEADERS(limits.h)
286 AC_CHECK_HEADERS(sys/quota.h)
287 AC_CHECK_HEADERS(xfs/xqm.h)
288
289 # For mount interface
290 AC_CHECK_HEADERS(fs_info.h)
291 AC_CHECK_HEADERS(fshelp.h)
292 AC_CHECK_HEADERS(paths.h)
293 AC_CHECK_HEADERS(mntent.h)
294 AC_CHECK_HEADERS(mnttab.h)
295 AC_CHECK_HEADERS(sys/fstyp.h)
296 AC_CHECK_HEADERS(sys/fs_types.h)
297 AC_CHECK_HEADERS(sys/mntent.h)
298 AC_CHECK_HEADERS(sys/mnttab.h)
299 AC_CHECK_HEADERS(sys/mount.h)
300 AC_CHECK_HEADERS(sys/statfs.h)
301 AC_CHECK_HEADERS(sys/statvfs.h)
302 AC_CHECK_HEADERS(sys/vfs.h)
303 AC_CHECK_HEADERS(sys/vfstab.h)
304
305 # For the swap plugin, FreeBSD
306 AC_CHECK_HEADERS(kvm.h)
307
308 # For the email plugin
309 AC_CHECK_HEADERS(linux/un.h, [], [],
310 [
311 #if HAVE_SYS_SOCKET_H
312 #       include <sys/socket.h>
313 #endif
314 ])
315 AC_CHECK_HEADERS(sys/un.h)
316 AC_CHECK_HEADERS(grp.h)
317
318 # For debugging interface (variable number of arguments)
319 AC_CHECK_HEADERS(stdarg.h)
320
321 # Regular expressions for the ignorelist.
322 AC_CHECK_HEADERS(regex.h)
323
324 # For the dns plugin
325 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
326
327 AC_CHECK_HEADERS(net/if_arp.h, [], [],
328 [#if HAVE_SYS_SOCKET_H
329 # include <sys/socket.h>
330 #endif
331 ])
332 AC_CHECK_HEADERS(net/if_ppp.h)
333 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
334 [#if HAVE_STDINT_H
335 # include <stdint.h>
336 #endif
337 #if HAVE_SYS_TYPES_H
338 # include <sys/types.h>
339 #endif
340 #if HAVE_SYS_SOCKET_H
341 # include <sys/socket.h>
342 #endif
343 #if HAVE_NET_IF_H
344 # include <net/if.h>
345 #endif
346 #if HAVE_NETINET_IN_H
347 # include <netinet/in.h>
348 #endif
349 ])
350
351 # For the multimeter plugin
352 AC_CHECK_HEADERS(termios.h)
353 AC_CHECK_HEADERS(sys/ioctl.h)
354
355 #
356 # Checking for libraries
357 #
358 AC_CHECK_LIB(m, ext)
359
360 #
361 # Checks for typedefs, structures, and compiler characteristics.
362 #
363 AC_C_CONST
364 AC_TYPE_PID_T
365 AC_TYPE_SIZE_T
366 AC_TYPE_UID_T
367 AC_HEADER_TIME
368
369 #
370 # Checks for library functions.
371 #
372 AC_PROG_GCC_TRADITIONAL
373 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
374 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
375 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
376 AC_CHECK_FUNCS(strncasecmp strcasecmp)
377 AC_CHECK_FUNCS(openlog syslog closelog)
378
379 socket_needs_socket="no"
380 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
381 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
382
383 nanosleep_needs_rt="no"
384 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
385 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
386
387 # Regular expressions for the ignorelist.
388 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
389
390 # For cpu module
391 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
392
393 # For df module
394 AC_CHECK_FUNCS(statfs statvfs)
395
396 # For load module
397 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
398
399 # For the `processes' plugin
400 AC_CHECK_FUNCS(thread_info)
401
402 # For users module
403 AC_CHECK_FUNCS(getutent getutxent)
404
405 # For quota module
406 AC_CHECK_FUNCS(quotactl)
407 AC_CHECK_FUNCS(getgrgid getpwuid)
408
409 # For interface module
410 AC_CHECK_FUNCS(getifaddrs)
411
412 # Check for NAN
413 nan_type="none"
414 if test "x$nan_type" = "xnone"; then
415   AC_CACHE_CHECK([whether NAN is defined by default],
416     [have_nan_default],
417     AC_COMPILE_IFELSE(
418       AC_LANG_PROGRAM(
419       [[
420 #include <stdlib.h>
421 #include <math.h>
422 static float foo = NAN;
423       ]],
424       [[
425        if (isnan (foo))
426         return 0;
427        else
428         return 1;
429       ]]),
430       [have_nan_default="yes"],
431       [have_nan_default="no"]
432     )
433   )
434   if test "x$have_nan_default" = "xyes"
435   then
436    nan_type="default"
437    AC_DEFINE(NAN_STATIC_DEFAULT, 1,
438      [Define if NAN is defined by default and can initialize static variables.])
439   fi
440 fi
441 if test "x$nan_type" = "xnone"; then
442   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
443     [have_nan_isoc],
444     AC_COMPILE_IFELSE(
445       AC_LANG_PROGRAM(
446       [[
447 #include <stdlib.h>
448 #define __USE_ISOC99 1
449 #include <math.h>
450 static float foo = NAN;
451       ]],
452       [[
453        if (isnan (foo))
454         return 0;
455        else
456         return 1;
457       ]]),
458       [have_nan_isoc="yes"],
459       [have_nan_isoc="no"]
460     )
461   )
462   if test "x$have_nan_isoc" = "xyes"
463   then
464    nan_type="isoc99"
465    AC_DEFINE(NAN_STATIC_ISOC, 1,
466      [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
467   fi
468 fi
469 if test "x$nan_type" = "xnone"; then
470   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
471     [have_nan_zero],
472     AC_RUN_IFELSE(
473       AC_LANG_PROGRAM(
474       [[
475 #include <stdlib.h>
476 #include <math.h>
477 #ifdef NAN
478 # undef NAN
479 #endif
480 #define NAN (0.0 / 0.0)
481 #ifndef isnan
482 # define isnan(f) ((f) != (f))
483 #endif
484 static float foo = NAN;
485       ]],
486       [[
487        if (isnan (foo))
488         return 0;
489        else
490         return 1;
491       ]]),
492       [have_nan_zero="yes"],
493       [have_nan_zero="no"]
494     )
495   )
496   if test "x$have_nan_zero" = "xyes"
497   then
498    nan_type="zero"
499    AC_DEFINE(NAN_ZERO_ZERO, 1,
500      [Define if NAN can be defined as (0.0 / 0.0)])
501   fi
502 fi
503 if test "x$nan_type" = "xnone"; then
504   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
505 fi
506
507 # For mount interface
508 #AC_CHECK_FUNCS(getfsent getvfsent)
509
510 have_getfsstat="no"
511 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
512 have_getvfsstat="no"
513 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
514 have_listmntent="no"
515 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
516
517 have_getmntent="no"
518 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
519 if test "x$have_getmntent" = "xno"; then
520         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
521 fi
522 if test "x$have_getmntent" = "xno"; then
523         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
524 fi
525 if test "x$have_getmntent" = "xno"; then
526         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
527 fi
528
529 if test "x$have_getmntent" = "xc"; then
530         AC_CACHE_CHECK([whether getmntent takes one argument],
531                 [have_one_getmntent],
532                 AC_COMPILE_IFELSE(
533                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
534 #include <mntent.h>
535 #include "$srcdir/src/utils_mount.h"]],
536                                 [[
537                                  FILE *fh;
538                                  struct mntent *me;
539                                  fh = setmntent ("/etc/mtab", "r");
540                                  me = getmntent (fh);
541                                 ]]
542                         ),
543                         [have_one_getmntent="yes"],
544                         [have_one_getmntent="no"]
545                 )
546         )
547         AC_CACHE_CHECK([whether getmntent takes two arguments],
548                 [have_two_getmntent],
549                 AC_COMPILE_IFELSE(
550                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
551 #include <sys/mnttab.h>
552 #include "$srcdir/src/utils_mount.h"]],
553                                 [[
554                                  FILE *fh;
555                                  struct mnttab mt;
556                                  int status;
557                                  fh = fopen ("/etc/mnttab", "r");
558                                  status = getmntent (fh, &mt);
559                                 ]]
560                         ),
561                         [have_two_getmntent="yes"],
562                         [have_two_getmntent="no"]
563                 )
564         )
565 fi
566
567 # Check for different versions of `getmntent' here..
568
569 if test "x$have_getmntent" = "xc"; then
570         if test "x$have_one_getmntent" = "xyes"; then
571                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
572                           [Define if the function getmntent exists and takes one argument.])
573         fi
574         if test "x$have_two_getmntent" = "xyes"; then
575                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
576                           [Define if the function getmntent exists and takes two arguments.])
577         fi
578 fi
579 if test "x$have_getmntent" = "xsun"; then
580         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
581                   [Define if the function getmntent exists. It's the version from libsun.])
582 fi
583 if test "x$have_getmntent" = "xseq"; then
584         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
585                   [Define if the function getmntent exists. It's the version from libseq.])
586 fi
587 if test "x$have_getmntent" = "xgen"; then
588         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
589                   [Define if the function getmntent exists. It's the version from libgen.])
590 fi
591
592 # Check for structures
593 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
594         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
595         [],
596         [
597         #include <sys/types.h>
598         #include <sys/socket.h>
599         #include <net/if.h>
600         ])
601 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
602         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
603         [],
604         [
605         #include <sys/types.h>
606         #include <sys/socket.h>
607         #include <linux/if.h>
608         #include <linux/netdevice.h>
609         ])
610
611 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
612 [#if HAVE_STDINT_H
613 # include <stdint.h>
614 #endif
615 #if HAVE_SYS_TYPES_H
616 # include <sys/types.h>
617 #endif
618 #if HAVE_NETINET_IN_SYSTM_H
619 # include <netinet/in_systm.h>
620 #endif
621 #if HAVE_NETINET_IN_H
622 # include <netinet/in.h>
623 #endif
624 #if HAVE_NETINET_IP_H
625 # include <netinet/ip.h>
626 #endif
627 #if HAVE_NETINET_UDP_H
628 # include <netinet/udp.h>
629 #endif
630 ])
631 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
632 [#if HAVE_STDINT_H
633 # include <stdint.h>
634 #endif
635 #if HAVE_SYS_TYPES_H
636 # include <sys/types.h>
637 #endif
638 #if HAVE_NETINET_IN_SYSTM_H
639 # include <netinet/in_systm.h>
640 #endif
641 #if HAVE_NETINET_IN_H
642 # include <netinet/in.h>
643 #endif
644 #if HAVE_NETINET_IP_H
645 # include <netinet/ip.h>
646 #endif
647 #if HAVE_NETINET_UDP_H
648 # include <netinet/udp.h>
649 #endif
650 ])
651
652 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
653         [],
654         [],
655         [
656 #if HAVE_KSTAT_H
657 # include <kstat.h>
658 #endif
659         ])
660
661 AC_MSG_CHECKING([for kernel type ($host_os)])
662 case $host_os in
663         *linux*)
664         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
665         ac_system="Linux"
666         ;;
667         *solaris*)
668         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
669         ac_system="Solaris"
670         ;;
671         *)
672         ac_system="unknown"
673 esac
674 AC_MSG_RESULT([$ac_system])
675
676 with_libresolv="yes"
677 AC_CHECK_LIB(resolv, res_search,
678 [
679         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
680 ],
681 [with_libresolv="no"])
682 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
683
684
685 m4_divert_once([HELP_WITH], [
686 collectd additional packages:])
687
688 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
689 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
690 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
691         then
692                 LDFLAGS="$LDFLAGS -L$withval/lib"
693                 CPPFLAGS="$CPPFLAGS -I$withval/include"
694                 with_rrdtool="yes"
695         fi
696 ], [with_rrdtool="yes"])
697 if test "x$with_rrdtool" = "xyes"
698 then
699         AC_CHECK_LIB(rrd, rrd_update,
700         [
701                 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
702         ],
703         [with_rrdtool="no (librrd not found)"], [-lm])
704 fi
705 if test "x$with_rrdtool" = "xyes"
706 then
707         AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
708 fi
709 if test "x$with_rrdtool" = "xyes"
710 then
711         collect_rrdtool=1
712 else
713         collect_rrdtool=0
714 fi
715 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
716         [Wether or not to use rrdtool library])
717 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
718
719 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
720 [       if test "x$withval" != "xno" -a "x$withval" != "xyes"
721         then
722                 LDFLAGS="$LDFLAGS -L$withval/lib"
723                 CPPFLAGS="$CPPFLAGS -I$withval/include"
724                 with_libpthread="yes"
725         else
726                 if test "x$withval" = "xno"
727                 then
728                         with_libpthread="no (disabled)"
729                 fi
730         fi
731 ], [with_libpthread="yes"])
732 if test "x$with_libpthread" = "xyes"
733 then
734         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
735 fi
736 if test "x$with_libpthread" = "xyes"
737 then
738         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
739 fi
740 if test "x$with_libpthread" = "xyes"
741 then
742         collect_pthread=1
743 else
744         collect_pthread=0
745 fi
746 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
747         [Wether or not to use pthread (POSIX threads) library])
748 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
749
750 if test "$ac_system" = "Solaris"
751 then
752         with_kstat="yes"
753         with_devinfo="yes"
754 else
755         with_kstat="no (Solaris only)"
756         with_devinfo="no (Solaris only)"
757 fi
758
759 if test "x$with_kstat" = "xyes"
760 then
761         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
762 fi
763 if test "x$with_kstat" = "xyes"
764 then
765         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
766         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
767 fi
768 if test "x$with_kstat" = "xyes"
769 then
770         AC_DEFINE(HAVE_LIBKSTAT, 1,
771                   [Define to 1 if you have the 'kstat' library (-lkstat)])
772 fi
773 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
774 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
775
776 ### BEGIN of check for libcurl ###
777 with_curl_config="curl-config"
778 with_curl_prefix=0
779 with_curl_libs=""
780 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
781 [
782         if test "x$withval" != "xno" -a "x$withval" != "xyes"
783         then
784                 if test -x "$withval/bin/curl-config"
785                 then
786                         with_curl_config="$withval/bin/curl-config"
787                         with_curl_prefix=1
788                 fi
789         fi
790         if test "x$withval" = "xno"
791         then
792                 with_libcurl="no"
793         else
794                 with_libcurl="yes"
795         fi
796 ],
797 [
798         with_libcurl="yes"
799 ])
800 if test "x$with_libcurl" = "xyes"
801 then
802         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
803         curl_config_status=$?
804
805         if test $curl_config_status -ne 0
806         then
807                 with_libcurl="no"
808         else
809                 AC_CHECK_LIB(curl, curl_easy_init,
810                 [
811                         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
812                         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
813                 ],
814                 [
815                         with_libcurl="no"
816                 ],
817                 [$with_curl_libs])
818         fi
819 fi
820 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
821 then
822         with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
823         curl_config_status=$?
824
825         if test $curl_config_status -ne 0
826         then
827                 with_libcurl="no"
828         else
829                 if test -d "$with_curl_prefix/include"
830                 then
831                         CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
832                 fi
833         fi
834 fi
835
836 with_libcurl_numeric=0
837 if test "x$with_libcurl" = "xyes"
838 then
839         with_libcurl_numeric=1
840 fi
841 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
842 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
843 ### END of check for libcurl ###
844
845 with_libiokit="no"
846 collectd_libiokit=0
847 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
848 [
849         with_libiokit="yes"
850         collectd_libiokit=1
851 ], 
852 [
853         with_libiokit="no"
854         collectd_libiokit=0
855 ])
856 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
857 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
858
859 with_libstatgrab="yes"
860 with_libdevstat="no"
861 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
862 [
863         if test "x$withval" != "xno" -a "x$withval" != "xyes"
864         then
865                 LDFLAGS="$LDFLAGS -L$withval/lib"
866                 CPPFLAGS="$CPPFLAGS -I$withval/include"
867                 with_libstatgrab="yes"
868         fi
869 ],
870 [
871         if test "x$ac_system" == "xunknown"
872         then
873                 with_libstatgrab="yes"
874         else
875                 with_libstatgrab="no"
876         fi
877 ])
878 if test "x$with_libstatgrab" = "xyes"
879 then
880         AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
881 fi
882 if test "x$with_libstatgrab" = "xyes"
883 then
884         AC_CHECK_HEADERS(statgrab.h,,    [with_libstatgrab="no (statgrab.h not found)"])
885 fi
886 if test "x$with_libstatgrab" = "xyes"
887 then
888         AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
889 fi
890 if test "x$with_libstatgrab" = "xyes"
891 then
892         collect_libstatgrab=1
893 else
894         collect_libstatgrab=0
895 fi
896 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
897         [Wether or not to use statgrab library])
898 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
899 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT,  test "x$with_libdevstat"  = "xyes")
900
901 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
902 if test "x$with_libkvm" = "xyes"
903 then
904         AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
905 fi
906 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
907
908 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
909 [
910         if test "x$withval" != "xno" && test "x$withval" != "xyes"
911         then
912                 LDFLAGS="$LDFLAGS -L$withval/lib"
913                 CPPFLAGS="$CPPFLAGS -I$withval/include"
914                 with_lm_sensors="yes"
915         fi
916 ],
917 [
918         if test "x$ac_system" = "xLinux"
919         then
920                 with_lm_sensors="yes"
921         else
922                 with_lm_sensors="no"
923         fi
924 ])
925 if test "x$with_lm_sensors" = "xyes"
926 then
927         AC_CHECK_LIB(sensors, sensors_init,
928         [
929                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
930         ],
931         [with_lm_sensors="no (libsensors not found)"])
932 fi
933 if test "x$with_lm_sensors" = "xyes"
934 then
935         AC_CHECK_HEADERS(sensors/sensors.h,
936         [
937                 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
938         ],
939         [with_lm_sensors="no (sensors/sensors.h not found)"])
940 fi
941 if test "x$with_lm_sensors" = "xyes"
942 then
943         collect_lm_sensors=1
944 else
945         collect_lm_sensors=0
946 fi
947 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
948         [Wether or not to use sensors library])
949 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
950
951 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
952 [
953         if test "x$withval" != "xno" && test "x$withval" != "xyes"
954         then
955                 LDFLAGS="$LDFLAGS -L$withval/lib"
956                 CPPFLAGS="$CPPFLAGS -I$withval/include"
957                 with_libmysql="yes"
958         fi
959 ],
960 [
961         with_libmysql="yes"
962 ])
963 if test "x$with_libmysql" = "xyes"
964 then
965         AC_CHECK_LIB(mysqlclient, mysql_init,
966         [
967                 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
968         ], [with_libmysql="no (libmysql not found)"])
969 fi
970 if test "x$with_libmysql" = "xyes"
971 then
972         AC_CHECK_HEADERS(mysql/mysql.h,
973         [
974                 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
975         ], [with_libmysql="no (mysql/mysql.h not found)"])
976 fi
977 if test "x$with_libmysql" = "xyes"
978 then
979         collect_libmysql=1
980 else
981         collect_libmysql=0
982 fi
983 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
984         [Wether or not to use mysql library])
985 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
986
987 with_own_liboconfig="no"
988 liboconfig_LDFLAGS="$LDFLAGS"
989 liboconfig_CPPFLAGS="$CPPFLAGS"
990 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
991 [
992         if test "x$withval" != "xno" && test "x$withval" != "xyes"
993         then
994                 if test -d "$withval/lib"
995                 then
996                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
997                 fi
998                 if test -d "$withval/include"
999                 then
1000                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1001                 fi
1002         fi
1003         if test "x$withval" = "xno"
1004         then
1005                 AC_MSG_ERROR("liboconfig is required")
1006         fi
1007 ],
1008 [
1009         with_liboconfig="yes"
1010 ])
1011
1012 save_LDFLAGS="$LDFLAGS"
1013 save_CPPFLAGS="$CPPFLAGS"
1014 LDFLAGS="$liboconfig_LDFLAGS"
1015 CPPFLAGS="$liboconfig_CPPFLAGS"
1016 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1017 [
1018         with_liboconfig="yes"
1019         with_own_liboconfig="no"
1020 ],
1021 [
1022         with_liboconfig="yes"
1023         with_own_liboconfig="yes"
1024         LDFLAGS="$save_LDFLAGS"
1025         CPPFLAGS="$save_CPPFLAGS"
1026 ])
1027
1028 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1029 if test "x$with_own_liboconfig" = "xyes"
1030 then
1031         with_liboconfig="yes (shipped version)"
1032 fi
1033
1034 #with_liboping="yes"
1035 with_own_liboping="no"
1036 liboping_LDFLAGS="$LDFLAGS"
1037 liboping_CPPFLAGS="$CPPFLAGS"
1038 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1039 [
1040         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1041         then
1042                 if test -d "$withval/lib"
1043                 then
1044                         liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1045                 fi
1046                 if test -d "$withval/include"
1047                 then
1048                         liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1049                 fi
1050         fi
1051         if test "x$withval" = "xno"
1052         then
1053                 with_liboping="no"
1054                 with_own_liboping="no"
1055         fi
1056 ],
1057 [
1058         #753
1059         with_liboping="yes"
1060 ])
1061
1062 if test "x$with_liboping" = "xyes"
1063 then
1064         save_LDFLAGS="$LDFLAGS"
1065         save_CPPFLAGS="$CPPFLAGS"
1066         LDFLAGS="$liboping_LDFLAGS"
1067         CPPFLAGS="$liboping_CPPFLAGS"
1068         AC_CHECK_LIB(oping, ping_construct,
1069         [
1070                 with_liboping="yes"
1071                 with_own_liboping="no"
1072         ],
1073         [
1074                 with_liboping="yes"
1075                 with_own_liboping="yes"
1076                 LDFLAGS="$save_LDFLAGS"
1077                 CPPFLAGS="$save_CPPFLAGS"
1078         ])
1079 fi
1080 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1081 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1082 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1083 then
1084         with_liboping="yes (shipped version)"
1085 fi
1086
1087 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1088 [
1089         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1090         then
1091                 LDFLAGS="$LDFLAGS -L$withval/lib"
1092                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1093                 with_libpcap="yes"
1094         fi
1095 ],
1096 [
1097         with_libpcap="yes"
1098 ])
1099 if test "x$with_libpcap" = "xyes"
1100 then
1101         AC_CHECK_LIB(pcap, pcap_open_live,
1102         [
1103                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1104         ], [with_libpcap="no (libpcap not found)"])
1105 fi
1106 if test "x$with_libpcap" = "xyes"
1107 then
1108         AC_CHECK_HEADERS(pcap.h,
1109         [
1110                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1111         ], [with_libpcap="no (pcap.h not found)"])
1112 fi
1113 if test "x$with_libpcap" = "xyes"
1114 then
1115         collect_libpcap=1
1116 else
1117         collect_libpcap=0
1118 fi
1119 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1120         [Wether or not to use the pcap library])
1121 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1122
1123 perl_interpreter="perl"
1124 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1125 [
1126         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1127         then
1128                 LDFLAGS="$LDFLAGS -L$withval/lib"
1129                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1130                 perl_interpreter="$withval/bin/perl"
1131                 with_libperl="yes"
1132         fi
1133 ],
1134 [
1135         with_libperl="yes"
1136 ])
1137 if test "x$with_libperl" = "xyes"
1138 then
1139   SAVE_CFLAGS=$CFLAGS
1140   SAVE_LDFLAGS=$LDFLAGS
1141   PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1142   PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1143   CFLAGS="$CFLAGS $PERL_CFLAGS"
1144   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1145
1146   AC_CACHE_CHECK([for libperl],
1147     [have_libperl],
1148     AC_LINK_IFELSE(
1149       AC_LANG_PROGRAM(
1150       [[
1151 #include <EXTERN.h>
1152 #include <perl.h>
1153 #include <XSUB.h>
1154       ]],
1155       [[
1156        PerlInterpreter *perl = NULL;
1157        Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1158                          newSVpv ("Collectd::Plugin::FooBar", 24),
1159                          Nullsv);
1160       ]]),
1161       [have_libperl="yes"],
1162       [have_libperl="no"]
1163     )
1164   )
1165
1166   if test "x$have_libperl" = "xyes"
1167   then
1168           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1169           AC_SUBST(PERL_CFLAGS)
1170           AC_SUBST(PERL_LDFLAGS)
1171   else
1172           with_libperl="no"
1173   fi
1174
1175   CFLAGS=$SAVE_CFLAGS
1176   LDFLAGS=$SAVE_LDFLAGS
1177 fi
1178 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1179
1180 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1181 [
1182         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1183         then
1184                 LDFLAGS="$LDFLAGS -L$withval/lib"
1185                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1186                 with_libiptc="yes"
1187         fi
1188 ],
1189 [
1190         if test "x$ac_system" = "xLinux"
1191         then
1192                 with_libiptc="yes"
1193         else
1194                 with_libiptc="no (Linux only)"
1195         fi
1196 ])
1197 if test "x$with_libiptc" = "xyes"
1198 then
1199         AC_CHECK_LIB(iptc, iptc_init,
1200         [
1201                 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1202         ], [with_libiptc="no (libiptc not found)"])
1203 fi
1204 if test "x$with_libiptc" = "xyes"
1205 then
1206         AC_CHECK_HEADERS(libiptc/libiptc.h,
1207         [
1208                 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1209         ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1210 fi
1211 if test "x$with_libiptc" = "xyes"
1212 then
1213         collect_libiptc=1
1214 else
1215         collect_libiptc=0
1216 fi
1217 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1218
1219 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1220 [
1221         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1222         then
1223                 LDFLAGS="$LDFLAGS -L$withval/lib"
1224                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1225                 with_libupsclient="yes"
1226         fi
1227 ],
1228 [
1229         with_libupsclient="yes"
1230 ])
1231 if test "x$with_libupsclient" = "xyes"
1232 then
1233         AC_CHECK_LIB(upsclient, upscli_connect,
1234         [
1235                 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1236         ], [with_libupsclient="no (libupsclient not found)"])
1237 fi
1238 if test "x$with_libupsclient" = "xyes"
1239 then
1240         AC_CHECK_HEADERS(upsclient.h,
1241         [
1242                 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1243         ], [with_libupsclient="no (upsclient.h not found)"])
1244 fi
1245 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1246
1247 # Check for enabled/disabled features
1248 #
1249
1250 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1251 # ------------------------------------------------------------
1252 dnl
1253 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1254 dnl
1255 AC_DEFUN(
1256         [AC_COLLECTD],
1257         [
1258         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1259         m4_if(
1260                 [$2],
1261                 [enable],
1262                 [dnl
1263                 m4_define([EnDis],[disabled])dnl
1264                 m4_define([YesNo],[no])dnl
1265                 ],dnl
1266                 [m4_if(
1267                         [$2],
1268                         [disable],
1269                         [dnl
1270                         m4_define([EnDis],[enabled])dnl
1271                         m4_define([YesNo],[yes])dnl
1272                         ],
1273                         [dnl
1274                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1275                         ]dnl
1276                 )]dnl
1277         )dnl
1278         m4_if([$3], [feature], [],
1279                 [m4_if(
1280                         [$3], [module], [],
1281                         [dnl
1282                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1283                         ]dnl
1284                 )]dnl
1285         )dnl
1286         AC_ARG_ENABLE(
1287                 [$1],
1288                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1289                 [],
1290                 enable_$1='[YesNo]'dnl
1291         )# AC_ARG_ENABLE
1292 if test "x$enable_$1" = "xno"
1293 then
1294         collectd_$1=0
1295 else
1296         if test "x$enable_$1" = "xyes"
1297         then
1298                 collectd_$1=1
1299         else
1300                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1301                 collectd_$1=1
1302                 enable_$1='yes'
1303         fi
1304 fi
1305         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1306         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1307         ]dnl
1308 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1309
1310 m4_divert_once([HELP_ENABLE], [
1311 collectd features:])
1312 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
1313 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
1314 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
1315
1316 m4_divert_once([HELP_ENABLE], [
1317 collectd modules:])
1318 AC_COLLECTD([apache],    [disable], [module], [Apache httpd statistics])
1319 AC_COLLECTD([apcups],    [disable], [module], [Statistics of UPSes by APC])
1320 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1321 AC_COLLECTD([battery],   [disable], [module], [battery statistics])
1322 AC_COLLECTD([cpu],       [disable], [module], [cpu usage statistics])
1323 AC_COLLECTD([cpufreq],   [disable], [module], [system cpu frequency statistics])
1324 AC_COLLECTD([disk],      [disable], [module], [disk/partition statistics])
1325 AC_COLLECTD([csv],       [disable], [module], [csv output plugin])
1326 AC_COLLECTD([df],        [disable], [module], [df statistics])
1327 AC_COLLECTD([dns],       [disable], [module], [dns statistics])
1328 AC_COLLECTD([email],     [disable], [module], [email statistics])
1329 AC_COLLECTD([entropy],   [disable], [module], [entropy statistics])
1330 AC_COLLECTD([exec],      [disable], [module], [exec of external programs])
1331 AC_COLLECTD([hddtemp],   [disable], [module], [hdd temperature statistics])
1332 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1333 AC_COLLECTD([iptables],  [disable], [module], [IPtables statistics])
1334 AC_COLLECTD([irq],       [disable], [module], [irq statistics])
1335 AC_COLLECTD([load],      [disable], [module], [system load statistics])
1336 AC_COLLECTD([mbmon],     [disable], [module], [motherboard monitor statistics])
1337 AC_COLLECTD([memory],    [disable], [module], [memory statistics])
1338 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1339 AC_COLLECTD([mysql],     [disable], [module], [mysql statistics])
1340 AC_COLLECTD([network],   [disable], [module], [network functionality])
1341 AC_COLLECTD([nfs],       [disable], [module], [nfs statistics])
1342 AC_COLLECTD([ntpd],      [disable], [module], [ntpd statistics])
1343 AC_COLLECTD([nut],       [disable], [module], [network UPS tools statistics])
1344 AC_COLLECTD([perl],      [disable], [module], [embedded perl interpreter])
1345 AC_COLLECTD([ping],      [disable], [module], [ping statistics])
1346 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1347 AC_COLLECTD([sensors],   [disable], [module], [lm_sensors statistics])
1348 AC_COLLECTD([serial],    [disable], [module], [serial statistics])
1349 AC_COLLECTD([logfile],   [disable], [module], [logfile log facility])
1350 AC_COLLECTD([swap],      [disable], [module], [swap statistics])
1351 AC_COLLECTD([syslog],    [disable], [module], [syslog log facility])
1352 AC_COLLECTD([tape],      [disable], [module], [tape statistics])
1353 AC_COLLECTD([unixsock],  [disable], [module], [UNIX socket plugin])
1354 AC_COLLECTD([users],     [disable], [module], [user count statistics])
1355 AC_COLLECTD([vserver],   [disable], [module], [vserver statistics])
1356 AC_COLLECTD([wireless],  [disable], [module], [wireless link statistics])
1357
1358 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1359
1360 if test "x$with_libperl" = "xyes"
1361 then
1362         with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1363 else
1364         enable_perl="no (needs libperl)"
1365 fi
1366
1367 cat <<EOF;
1368
1369 Configuration:
1370   Libraries:
1371     libcurl . . . . . . $with_libcurl
1372     libiokit  . . . . . $with_libiokit
1373     libiptc . . . . . . $with_libiptc
1374     libkstat  . . . . . $with_kstat
1375     libmysql  . . . . . $with_libmysql
1376     liboconfig  . . . . $with_liboconfig
1377     liboping  . . . . . $with_liboping
1378     libpcap . . . . . . $with_libpcap
1379     libperl . . . . . . $with_libperl
1380     libpthread  . . . . $with_libpthread
1381     librrd  . . . . . . $with_rrdtool
1382     libsensors  . . . . $with_lm_sensors
1383     libstatgrab . . . . $with_libstatgrab
1384     libupsclient  . . . $with_libupsclient
1385
1386   Features:
1387     daemon mode . . . . $enable_daemon
1388     debug . . . . . . . $enable_debug
1389
1390   Modules:
1391     apache  . . . . . . $enable_apache
1392     apcups  . . . . . . $enable_apcups
1393     apple_sensors . . . $enable_apple_sensors
1394     battery . . . . . . $enable_battery
1395     cpu . . . . . . . . $enable_cpu
1396     cpufreq . . . . . . $enable_cpufreq
1397     csv . . . . . . . . $enable_csv
1398     df  . . . . . . . . $enable_df
1399     disk  . . . . . . . $enable_disk
1400     dns . . . . . . . . $enable_dns
1401     email . . . . . . . $enable_email
1402     entropy . . . . . . $enable_entropy
1403     exec  . . . . . . . $enable_exec
1404     hddtemp . . . . . . $enable_hddtemp
1405     interface . . . . . $enable_interface
1406     iptables  . . . . . $enable_iptables
1407     irq . . . . . . . . $enable_irq
1408     load  . . . . . . . $enable_load
1409     logfile . . . . . . $enable_logfile
1410     mbmon . . . . . . . $enable_mbmon
1411     memory  . . . . . . $enable_memory
1412     multimeter  . . . . $enable_multimeter
1413     mysql . . . . . . . $enable_mysql
1414     network . . . . . . $enable_network
1415     nfs . . . . . . . . $enable_nfs
1416     ntpd  . . . . . . . $enable_ntpd
1417     nut . . . . . . . . $enable_nut
1418     perl  . . . . . . . $enable_perl
1419     ping  . . . . . . . $enable_ping
1420     processes . . . . . $enable_processes
1421     sensors . . . . . . $enable_sensors
1422     serial  . . . . . . $enable_serial
1423     swap  . . . . . . . $enable_swap
1424     syslog  . . . . . . $enable_syslog
1425     tape  . . . . . . . $enable_tape
1426     unixsock  . . . . . $enable_unixsock
1427     users . . . . . . . $enable_users
1428     vserver . . . . . . $enable_vserver
1429     wireless  . . . . . $enable_wireless
1430
1431 EOF